summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/dev/acpica/CHANGES.txt3799
-rw-r--r--sys/contrib/dev/acpica/acapps.h192
-rw-r--r--sys/contrib/dev/acpica/acconfig.h275
-rw-r--r--sys/contrib/dev/acpica/acdebug.h544
-rw-r--r--sys/contrib/dev/acpica/acdisasm.h476
-rw-r--r--sys/contrib/dev/acpica/acdispat.h586
-rw-r--r--sys/contrib/dev/acpica/acdos16.h152
-rw-r--r--sys/contrib/dev/acpica/acefi.h150
-rw-r--r--sys/contrib/dev/acpica/acenv.h438
-rw-r--r--sys/contrib/dev/acpica/acevents.h336
-rw-r--r--sys/contrib/dev/acpica/acexcep.h377
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h208
-rw-r--r--sys/contrib/dev/acpica/acgcc.h132
-rw-r--r--sys/contrib/dev/acpica/acglobal.h380
-rw-r--r--sys/contrib/dev/acpica/achware.h250
-rw-r--r--sys/contrib/dev/acpica/acinterp.h811
-rw-r--r--sys/contrib/dev/acpica/aclocal.h1084
-rw-r--r--sys/contrib/dev/acpica/acmacros.h763
-rw-r--r--sys/contrib/dev/acpica/acnamesp.h586
-rw-r--r--sys/contrib/dev/acpica/acobject.h592
-rw-r--r--sys/contrib/dev/acpica/acoutput.h258
-rw-r--r--sys/contrib/dev/acpica/acparser.h420
-rw-r--r--sys/contrib/dev/acpica/acpi.h142
-rwxr-xr-xsys/contrib/dev/acpica/acpica_prep.sh69
-rw-r--r--sys/contrib/dev/acpica/acpiosxf.h447
-rw-r--r--sys/contrib/dev/acpica/acpixf.h534
-rw-r--r--sys/contrib/dev/acpica/acresrc.h465
-rw-r--r--sys/contrib/dev/acpica/acstruct.h281
-rw-r--r--sys/contrib/dev/acpica/actables.h306
-rw-r--r--sys/contrib/dev/acpica/actbl.h317
-rw-r--r--sys/contrib/dev/acpica/actbl1.h211
-rw-r--r--sys/contrib/dev/acpica/actbl2.h277
-rw-r--r--sys/contrib/dev/acpica/actbl71.h238
-rw-r--r--sys/contrib/dev/acpica/actypes.h1360
-rw-r--r--sys/contrib/dev/acpica/acutils.h910
-rw-r--r--sys/contrib/dev/acpica/amlcode.h579
-rw-r--r--sys/contrib/dev/acpica/amlresrc.h423
-rw-r--r--sys/contrib/dev/acpica/common/adisasm.c1047
-rw-r--r--sys/contrib/dev/acpica/common/getopt.c246
-rw-r--r--sys/contrib/dev/acpica/compiler/aslanalyze.c1697
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcodegen.c608
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompile.c615
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h1120
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.l1153
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.y2902
-rw-r--r--sys/contrib/dev/acpica/compiler/aslerror.c621
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfiles.c839
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfold.c532
-rw-r--r--sys/contrib/dev/acpica/compiler/aslglobal.h267
-rw-r--r--sys/contrib/dev/acpica/compiler/asllength.c504
-rw-r--r--sys/contrib/dev/acpica/compiler/asllisting.c1319
-rw-r--r--sys/contrib/dev/acpica/compiler/aslload.c691
-rw-r--r--sys/contrib/dev/acpica/compiler/asllookup.c974
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c794
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmap.c687
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopcodes.c620
-rw-r--r--sys/contrib/dev/acpica/compiler/asloperands.c1112
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopt.c800
-rw-r--r--sys/contrib/dev/acpica/compiler/aslresource.c632
-rw-r--r--sys/contrib/dev/acpica/compiler/aslrestype1.c1041
-rw-r--r--sys/contrib/dev/acpica/compiler/aslrestype2.c1536
-rw-r--r--sys/contrib/dev/acpica/compiler/aslstubs.c266
-rw-r--r--sys/contrib/dev/acpica/compiler/asltransform.c623
-rw-r--r--sys/contrib/dev/acpica/compiler/asltree.c1182
-rw-r--r--sys/contrib/dev/acpica/compiler/asltypes.h496
-rw-r--r--sys/contrib/dev/acpica/compiler/aslutils.c1015
-rw-r--r--sys/contrib/dev/acpica/dbcmds.c1305
-rw-r--r--sys/contrib/dev/acpica/dbdisply.c809
-rw-r--r--sys/contrib/dev/acpica/dbexec.c601
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c564
-rw-r--r--sys/contrib/dev/acpica/dbhistry.c291
-rw-r--r--sys/contrib/dev/acpica/dbinput.c1001
-rw-r--r--sys/contrib/dev/acpica/dbstats.c558
-rw-r--r--sys/contrib/dev/acpica/dbutils.c541
-rw-r--r--sys/contrib/dev/acpica/dbxface.c588
-rw-r--r--sys/contrib/dev/acpica/dmbuffer.c537
-rw-r--r--sys/contrib/dev/acpica/dmnames.c499
-rw-r--r--sys/contrib/dev/acpica/dmobject.c580
-rw-r--r--sys/contrib/dev/acpica/dmopcode.c600
-rw-r--r--sys/contrib/dev/acpica/dmresrc.c528
-rw-r--r--sys/contrib/dev/acpica/dmresrcl.c619
-rw-r--r--sys/contrib/dev/acpica/dmresrcs.c352
-rw-r--r--sys/contrib/dev/acpica/dmutils.c464
-rw-r--r--sys/contrib/dev/acpica/dmwalk.c917
-rw-r--r--sys/contrib/dev/acpica/dsfield.c698
-rw-r--r--sys/contrib/dev/acpica/dsinit.c316
-rw-r--r--sys/contrib/dev/acpica/dsmethod.c651
-rw-r--r--sys/contrib/dev/acpica/dsmthdat.c787
-rw-r--r--sys/contrib/dev/acpica/dsobject.c721
-rw-r--r--sys/contrib/dev/acpica/dsopcode.c1263
-rw-r--r--sys/contrib/dev/acpica/dsutils.c720
-rw-r--r--sys/contrib/dev/acpica/dswexec.c792
-rw-r--r--sys/contrib/dev/acpica/dswload.c1063
-rw-r--r--sys/contrib/dev/acpica/dswscope.c315
-rw-r--r--sys/contrib/dev/acpica/dswstate.c1200
-rw-r--r--sys/contrib/dev/acpica/evevent.c381
-rw-r--r--sys/contrib/dev/acpica/evgpe.c528
-rw-r--r--sys/contrib/dev/acpica/evgpeblk.c1032
-rw-r--r--sys/contrib/dev/acpica/evmisc.c674
-rw-r--r--sys/contrib/dev/acpica/evregion.c818
-rw-r--r--sys/contrib/dev/acpica/evrgnini.c667
-rw-r--r--sys/contrib/dev/acpica/evsci.c273
-rw-r--r--sys/contrib/dev/acpica/evxface.c830
-rw-r--r--sys/contrib/dev/acpica/evxfevnt.c862
-rw-r--r--sys/contrib/dev/acpica/evxfregn.c523
-rw-r--r--sys/contrib/dev/acpica/exconfig.c562
-rw-r--r--sys/contrib/dev/acpica/exconvrt.c813
-rw-r--r--sys/contrib/dev/acpica/excreate.c728
-rw-r--r--sys/contrib/dev/acpica/exdump.c901
-rw-r--r--sys/contrib/dev/acpica/exdyadic.c939
-rw-r--r--sys/contrib/dev/acpica/exfield.c463
-rw-r--r--sys/contrib/dev/acpica/exfldio.c1223
-rw-r--r--sys/contrib/dev/acpica/exmisc.c620
-rw-r--r--sys/contrib/dev/acpica/exmonad.c1083
-rw-r--r--sys/contrib/dev/acpica/exmutex.c445
-rw-r--r--sys/contrib/dev/acpica/exnames.c531
-rw-r--r--sys/contrib/dev/acpica/exoparg1.c989
-rw-r--r--sys/contrib/dev/acpica/exoparg2.c716
-rw-r--r--sys/contrib/dev/acpica/exoparg3.c337
-rw-r--r--sys/contrib/dev/acpica/exoparg6.c377
-rw-r--r--sys/contrib/dev/acpica/exprep.c538
-rw-r--r--sys/contrib/dev/acpica/exregion.c616
-rw-r--r--sys/contrib/dev/acpica/exresnte.c356
-rw-r--r--sys/contrib/dev/acpica/exresolv.c570
-rw-r--r--sys/contrib/dev/acpica/exresop.c720
-rw-r--r--sys/contrib/dev/acpica/exstore.c600
-rw-r--r--sys/contrib/dev/acpica/exstoren.c376
-rw-r--r--sys/contrib/dev/acpica/exstorob.c282
-rw-r--r--sys/contrib/dev/acpica/exsystem.c461
-rw-r--r--sys/contrib/dev/acpica/exutils.c466
-rw-r--r--sys/contrib/dev/acpica/hwacpi.c307
-rw-r--r--sys/contrib/dev/acpica/hwgpe.c674
-rw-r--r--sys/contrib/dev/acpica/hwregs.c978
-rw-r--r--sys/contrib/dev/acpica/hwsleep.c547
-rw-r--r--sys/contrib/dev/acpica/hwtimer.c290
-rw-r--r--sys/contrib/dev/acpica/nsaccess.c723
-rw-r--r--sys/contrib/dev/acpica/nsalloc.c800
-rw-r--r--sys/contrib/dev/acpica/nsdump.c776
-rw-r--r--sys/contrib/dev/acpica/nsdumpdv.c224
-rw-r--r--sys/contrib/dev/acpica/nseval.c614
-rw-r--r--sys/contrib/dev/acpica/nsinit.c513
-rw-r--r--sys/contrib/dev/acpica/nsload.c553
-rw-r--r--sys/contrib/dev/acpica/nsnames.c341
-rw-r--r--sys/contrib/dev/acpica/nsobject.c562
-rw-r--r--sys/contrib/dev/acpica/nsparse.c249
-rw-r--r--sys/contrib/dev/acpica/nssearch.c463
-rw-r--r--sys/contrib/dev/acpica/nsutils.c1204
-rw-r--r--sys/contrib/dev/acpica/nswalk.c383
-rw-r--r--sys/contrib/dev/acpica/nsxfeval.c876
-rw-r--r--sys/contrib/dev/acpica/nsxfname.c456
-rw-r--r--sys/contrib/dev/acpica/nsxfobj.c351
-rw-r--r--sys/contrib/dev/acpica/osunixxf.c1085
-rw-r--r--sys/contrib/dev/acpica/psargs.c851
-rw-r--r--sys/contrib/dev/acpica/psfind.c485
-rw-r--r--sys/contrib/dev/acpica/psopcode.c846
-rw-r--r--sys/contrib/dev/acpica/psparse.c1396
-rw-r--r--sys/contrib/dev/acpica/psscope.c376
-rw-r--r--sys/contrib/dev/acpica/pstree.c418
-rw-r--r--sys/contrib/dev/acpica/psutils.c396
-rw-r--r--sys/contrib/dev/acpica/pswalk.c393
-rw-r--r--sys/contrib/dev/acpica/psxface.c312
-rw-r--r--sys/contrib/dev/acpica/rsaddr.c1308
-rw-r--r--sys/contrib/dev/acpica/rscalc.c953
-rw-r--r--sys/contrib/dev/acpica/rscreate.c522
-rw-r--r--sys/contrib/dev/acpica/rsdump.c1255
-rw-r--r--sys/contrib/dev/acpica/rsio.c624
-rw-r--r--sys/contrib/dev/acpica/rsirq.c682
-rw-r--r--sys/contrib/dev/acpica/rslist.c599
-rw-r--r--sys/contrib/dev/acpica/rsmemory.c640
-rw-r--r--sys/contrib/dev/acpica/rsmisc.c683
-rw-r--r--sys/contrib/dev/acpica/rsutils.c423
-rw-r--r--sys/contrib/dev/acpica/rsxface.c499
-rw-r--r--sys/contrib/dev/acpica/tbconvrt.c647
-rw-r--r--sys/contrib/dev/acpica/tbget.c586
-rw-r--r--sys/contrib/dev/acpica/tbgetall.c403
-rw-r--r--sys/contrib/dev/acpica/tbinstal.c633
-rw-r--r--sys/contrib/dev/acpica/tbrsdt.c406
-rw-r--r--sys/contrib/dev/acpica/tbutils.c322
-rw-r--r--sys/contrib/dev/acpica/tbxface.c541
-rw-r--r--sys/contrib/dev/acpica/tbxfroot.c611
-rw-r--r--sys/contrib/dev/acpica/utalloc.c1119
-rw-r--r--sys/contrib/dev/acpica/utclib.c892
-rw-r--r--sys/contrib/dev/acpica/utcopy.c1018
-rw-r--r--sys/contrib/dev/acpica/utdebug.c710
-rw-r--r--sys/contrib/dev/acpica/utdelete.c753
-rw-r--r--sys/contrib/dev/acpica/uteval.c666
-rw-r--r--sys/contrib/dev/acpica/utglobal.c876
-rw-r--r--sys/contrib/dev/acpica/utinit.c353
-rw-r--r--sys/contrib/dev/acpica/utmath.c428
-rw-r--r--sys/contrib/dev/acpica/utmisc.c1657
-rw-r--r--sys/contrib/dev/acpica/utobject.c726
-rw-r--r--sys/contrib/dev/acpica/utxface.c608
-rw-r--r--sys/contrib/dev/ath/COPYRIGHT42
-rw-r--r--sys/contrib/dev/ath/README64
-rw-r--r--sys/contrib/dev/ath/ah.h548
-rw-r--r--sys/contrib/dev/ath/ah_desc.h172
-rw-r--r--sys/contrib/dev/ath/ah_devid.h69
-rw-r--r--sys/contrib/dev/ath/freebsd/ah_if.m90
-rw-r--r--sys/contrib/dev/ath/freebsd/ah_osdep.c394
-rw-r--r--sys/contrib/dev/ath/freebsd/ah_osdep.h125
-rw-r--r--sys/contrib/dev/ath/freebsd/i386-elf.hal.o.uu3296
-rw-r--r--sys/contrib/dev/ath/freebsd/opt_ah.h3
-rw-r--r--sys/contrib/dev/ath/version.h38
-rw-r--r--sys/contrib/dev/fla/COPYRIGHT102
-rw-r--r--sys/contrib/dev/fla/README198
-rw-r--r--sys/contrib/dev/fla/fla.c285
-rw-r--r--sys/contrib/dev/fla/i386/msysosak.o.uu823
-rw-r--r--sys/contrib/dev/fla/msysosak.h135
-rw-r--r--sys/contrib/dev/fla/patch.0023
-rw-r--r--sys/contrib/dev/fla/prep.fla.sh45
-rw-r--r--sys/contrib/dev/oltr/COPYRIGHT62
-rw-r--r--sys/contrib/dev/oltr/i386-elf.trlld.o.uu1850
-rw-r--r--sys/contrib/dev/oltr/if_oltr.c1571
-rw-r--r--sys/contrib/dev/oltr/trlld.h902
-rw-r--r--sys/contrib/dev/oltr/trlldbm.c2690
-rw-r--r--sys/contrib/dev/oltr/trlldhm.c2519
-rw-r--r--sys/contrib/dev/oltr/trlldmac.c2641
-rw-r--r--sys/contrib/ia64/libuwx/src/Makefile64
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx.h257
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_bstream.c181
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_bstream.h59
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_context.c346
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_context.h25
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_env.c170
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_env.h103
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_scoreboard.c279
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_scoreboard.h79
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_self.c278
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_self.h59
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_self_context.s153
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_step.c590
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_step.h25
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_str.c124
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_str.h37
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_swap.c70
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_swap.h26
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_trace.c143
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_trace.h350
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_ttrace.c367
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_ttrace.h66
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_uinfo.c1107
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_uinfo.h66
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_utable.c257
-rw-r--r--sys/contrib/ia64/libuwx/src/uwx_utable.h35
-rw-r--r--sys/contrib/ia64/libuwx/test/Makefile14
-rw-r--r--sys/contrib/ia64/libuwx/test/dump_context.c100
-rw-r--r--sys/contrib/ia64/libuwx/test/dumpmyself.c106
-rw-r--r--sys/contrib/ia64/libuwx/test/primeregs.s93
-rw-r--r--sys/contrib/ipfilter/netinet/IPFILTER.LICENCE30
-rw-r--r--sys/contrib/ipfilter/netinet/QNX_OCL.txt277
-rw-r--r--sys/contrib/ipfilter/netinet/fil.c2247
-rw-r--r--sys/contrib/ipfilter/netinet/ip_auth.c657
-rw-r--r--sys/contrib/ipfilter/netinet/ip_auth.h63
-rw-r--r--sys/contrib/ipfilter/netinet/ip_compat.h1387
-rw-r--r--sys/contrib/ipfilter/netinet/ip_fil.c2288
-rw-r--r--sys/contrib/ipfilter/netinet/ip_fil.h661
-rw-r--r--sys/contrib/ipfilter/netinet/ip_frag.c618
-rw-r--r--sys/contrib/ipfilter/netinet/ip_frag.h74
-rw-r--r--sys/contrib/ipfilter/netinet/ip_ftp_pxy.c1213
-rw-r--r--sys/contrib/ipfilter/netinet/ip_ipsec_pxy.c292
-rw-r--r--sys/contrib/ipfilter/netinet/ip_log.c510
-rw-r--r--sys/contrib/ipfilter/netinet/ip_nat.c3011
-rw-r--r--sys/contrib/ipfilter/netinet/ip_nat.h328
-rw-r--r--sys/contrib/ipfilter/netinet/ip_netbios_pxy.c109
-rw-r--r--sys/contrib/ipfilter/netinet/ip_proxy.c612
-rw-r--r--sys/contrib/ipfilter/netinet/ip_proxy.h175
-rw-r--r--sys/contrib/ipfilter/netinet/ip_raudio_pxy.c317
-rw-r--r--sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c175
-rw-r--r--sys/contrib/ipfilter/netinet/ip_state.c2278
-rw-r--r--sys/contrib/ipfilter/netinet/ip_state.h212
-rw-r--r--sys/contrib/ipfilter/netinet/ipl.h15
-rw-r--r--sys/contrib/ipfilter/netinet/mlfk_ipl.c193
-rw-r--r--sys/contrib/ngatm/FREEBSD-upgrade14
273 files changed, 170144 insertions, 0 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt
new file mode 100644
index 0000000..816c8ba
--- /dev/null
+++ b/sys/contrib/dev/acpica/CHANGES.txt
@@ -0,0 +1,3799 @@
+----------------------------------------
+19 June 2003. Summary of changes for version 20030619:
+
+1) ACPI CA Core Subsystem:
+
+Fix To/FromBCD, eliminating the need for an arch-specific
+#define.
+
+Do not acquire a semaphore in the S5 shutdown path.
+
+Fix ex_digits_needed for 0. (Takayoshi Kochi)
+
+Fix sleep/stall code reversal. (Andi Kleen)
+
+Revert a change having to do with control method calling
+semantics.
+
+2) Linux:
+
+acpiphp update (Takayoshi Kochi)
+
+Export acpi_disabled for sonypi (Stelian Pop)
+
+Mention acpismp=force in config help
+
+Re-add acpitable.c and acpismp=force. This improves backwards
+compatibility and also cleans up the code to a significant
+degree.
+
+Add ASUS Value-add driver (Karol Kozimor and Julien Lerouge)
+
+
+
+----------------------------------------
+22 May 2003. Summary of changes for version 20030522:
+
+1) ACPI CA Core Subsystem:
+
+Found and fixed a reported problem where an AE_NOT_FOUND error
+occurred occasionally during _BST evaluation. This turned out to
+be an Owner ID allocation issue where a called method did not get
+a new ID assigned to it. Eventually, (after 64k calls), the
+Owner ID UINT16 would wraparound so that the ID would be the same
+as the caller's and the called method would delete the caller's
+namespace.
+
+Implemented extended error reporting for control methods that are
+aborted due to a run-time exception. Output includes the exact
+AML instruction that caused the method abort, a dump of the
+method locals and arguments at the time of the abort, and a trace
+of all nested control method calls.
+
+Modified the interpreter to allow the creation of buffers of zero
+length from the AML code. Implemented new code to ensure that no
+attempt is made to actually allocate a memory buffer (of length
+zero) - instead, a simple buffer object with a NULL buffer
+pointer and length zero is created. A warning is no longer
+issued when the AML attempts to create a zero-length buffer.
+
+Implemented a workaround for the "leading asterisk issue" in
+_HIDs, _UIDs, and _CIDs in the AML interpreter. One leading
+asterisk is automatically removed if present in any HID, UID, or
+CID strings. The iASL compiler will still flag this asterisk as
+an error, however.
+
+Implemented full support for _CID methods that return a package
+of multiple CIDs (Compatible IDs). The AcpiGetObjectInfo()
+interface now additionally returns a device _CID list if present.
+This required a change to the external interface in order to pass
+an ACPI_BUFFER object as a parameter since the _CID list is of
+variable length.
+
+Fixed a problem with the new AE_SAME_HANDLER exception where
+handler initialization code did not know about this exception.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release (20030509):
+ Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total
+ Debug Version: 156.1K Code, 63.9K Data, 220.0K Total
+ Current Release:
+ Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total
+ Debug Version: 156.9K Code, 64.2K Data, 221.1K Total
+
+
+2) Linux:
+
+Fixed a bug in which we would reinitialize the ACPI interrupt
+after it was already working, thus disabling all ACPI and the
+IRQs for any other device sharing the interrupt. (Thanks to Stian
+Jordet)
+
+Toshiba driver update (John Belmonte)
+
+Return only 0 or 1 for our interrupt handler status (Andrew
+Morton)
+
+
+3) iASL Compiler:
+
+Fixed a reported problem where multiple (nested) ElseIf()
+statements were not handled correctly by the compiler, resulting
+in incorrect warnings and incorrect AML code. This was a problem
+in both the ASL parser and the code generator.
+
+
+4) Documentation:
+
+Added changes to existing interfaces, new exception codes, and
+new text concerning reference count object management versus
+garbage collection.
+
+----------------------------------------
+09 May 2003. Summary of changes for version 20030509.
+
+
+1) ACPI CA Core Subsystem:
+
+Changed the subsystem initialization sequence to hold off
+installation of address space handlers until the hardware has
+been initialized and the system has entered ACPI mode. This is
+because the installation of space handlers can cause _REG methods
+to be run. Previously, the _REG methods could potentially be run
+before ACPI mode was enabled.
+
+Fixed some memory leak issues related to address space handler
+and notify handler installation. There were some problems with
+the reference count mechanism caused by the fact that the handler
+objects are shared across several namespace objects.
+
+Fixed a reported problem where reference counts within the
+namespace were not properly updated when named objects created by
+method execution were deleted.
+
+Fixed a reported problem where multiple SSDTs caused a deletion
+issue during subsystem termination. Restructured the table data
+structures to simplify the linked lists and the related code.
+
+Fixed a problem where the table ID associated with secondary
+tables (SSDTs) was not being propagated into the namespace
+objects created by those tables. This would only present a
+problem for tables that are unloaded at run-time, however.
+
+Updated AcpiOsReadable and AcpiOsWritable to use the ACPI_SIZE
+type as the length parameter (instead of UINT32).
+
+Solved a long-standing problem where an ALREADY_EXISTS error
+appears on various systems. This problem could happen when there
+are multiple PCI_Config operation regions under a single PCI root
+bus. This doesn't happen very frequently, but there are some
+systems that do this in the ASL.
+
+Fixed a reported problem where the internal DeleteNode function
+was incorrectly handling the case where a namespace node was the
+first in the parent's child list, and had additional peers (not
+the only child, but first in the list of children.)
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total
+ Debug Version: 156.1K Code, 63.6K Data, 219.7K Total
+ Current Release:
+ Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total
+ Debug Version: 156.1K Code, 63.9K Data, 220.0K Total
+
+
+2) Linux:
+
+Allow ":" in OS override string (Ducrot Bruno)
+
+Kobject fix (Greg KH)
+
+
+3 iASL Compiler/Disassembler:
+
+Fixed a problem in the generation of the C source code files (AML
+is emitted in C source statements for BIOS inclusion) where the
+Ascii dump that appears within a C comment at the end of each
+line could cause a compile time error if the AML sequence happens
+to have an open comment or close comment sequence embedded.
+
+
+----------------------------------------
+24 April 2003. Summary of changes for version 20030424.
+
+
+1) ACPI CA Core Subsystem:
+
+Support for big-endian systems has been implemented. Most of the
+support has been invisibly added behind big-endian versions of
+the ACPI_MOVE_* macros.
+
+Fixed a problem in AcpiHwDisableGpeBlock() and
+AcpiHwClearGpeBlock() where an incorrect offset was passed to the
+low level hardware write routine. The offset parameter was
+actually eliminated from the low level read/write routines
+because they had become obsolete.
+
+Fixed a problem where a handler object was deleted twice during
+the removal of a fixed event handler.
+
+
+2) Linux:
+
+A fix for SMP systems with link devices was contributed by
+Compaq's Dan Zink.
+
+(2.5) Return whether we handled the interrupt in our IRQ handler.
+(Linux ISRs no longer return void, so we can propagate the
+handler return value from the ACPI CA core back to the OS.)
+
+
+3) Documentation:
+
+The ACPI CA Programmer Reference has been updated to reflect new
+interfaces and changes to existing interfaces.
+
+----------------------------------------
+28 March 2003. Summary of changes for version 20030328.
+
+1) ACPI CA Core Subsystem:
+
+The GPE Block Device support has been completed. New interfaces
+are AcpiInstallGpeBlock and AcpiRemoveGpeBlock. The Event
+interfaces (enable, disable, clear, getstatus) have been split
+into separate interfaces for Fixed Events and General Purpose
+Events (GPEs) in order to support GPE Block Devices properly.
+
+Fixed a problem where the error message "Failed to acquire
+semaphore" would appear during operations on the embedded
+controller (EC).
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total
+ Debug Version: 154.0K Code, 63.4K Data, 217.4K Total
+ Current Release:
+ Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total
+ Debug Version: 156.1K Code, 63.6K Data, 219.7K Total
+
+
+----------------------------------------
+28 February 2003. Summary of changes for version 20030228.
+
+
+1) ACPI CA Core Subsystem:
+
+The GPE handling and dispatch code has been completely overhauled
+in preparation for support of GPE Block Devices (ID ACPI0006).
+This affects internal data structures and code only; there should
+be no differences visible externally. One new file has been
+added, evgpeblk.c
+
+The FADT fields GPE0_BLK_LEN and GPE1_BLK_LEN are now the only
+fields that are used to determine the GPE block lengths. The
+REGISTER_BIT_WIDTH field of the X_GPEx_BLK extended address
+structures are ignored. This is per the ACPI specification but
+it isn't very clear. The full 256 Block 0/1 GPEs are now
+supported (the use of REGISTER_BIT_WIDTH limited the number of
+GPEs to 128).
+
+In the SCI interrupt handler, removed the read of the PM1_CONTROL
+register to look at the SCI_EN bit. On some machines, this read
+causes an SMI event and greatly slows down SCI events. (This may
+in fact be the cause of slow battery status response on some
+systems.)
+
+Fixed a problem where a store of a NULL string to a package
+object could cause the premature deletion of the object. This
+was seen during execution of the battery _BIF method on some
+systems, resulting in no battery data being returned.
+
+Added AcpiWalkResources interface to simplify parsing of resource
+lists.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total
+ Debug Version: 153.0K Code, 62.9K Data, 215.9K Total
+ Current Release:
+ Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total
+ Debug Version: 154.0K Code, 63.4K Data, 217.4K Total
+
+
+2) Linux
+
+S3 fixes (Ole Rohne)
+
+Update ACPI PHP driver with to use new acpi_walk_resource API
+(Bjorn Helgaas)
+
+Add S4BIOS support (Pavel Machek)
+
+Map in entire table before performing checksum (John Stultz)
+
+Expand the mem= cmdline to allow the specification of reserved
+and ACPI DATA blocks (Pavel Machek)
+
+Never use ACPI on VISWS
+
+Fix derive_pci_id (Ducrot Bruno, Alvaro Lopez)
+
+Revert a change that allowed P_BLK lengths to be 4 or 5. This is
+causing us to think that some systems support C2 when they really
+don't.
+
+Do not count processor objects for non-present CPUs (Thanks to
+Dominik Brodowski)
+
+
+3) iASL Compiler:
+
+Fixed a problem where ASL include files could not be found and
+opened.
+
+Added support for the _PDC reserved name.
+
+
+----------------------------------------
+22 January 2003. Summary of changes for version 20030122.
+
+
+1) ACPI CA Core Subsystem:
+
+Added a check for constructs of the form: Store (Local0, Local0)
+where Local0 is not initialized. Apparently, some BIOS
+programmers believe that this is a NOOP. Since this store
+doesn't do anything anyway, the new prototype behavior will
+ignore this error. This is a case where we can relax the strict
+checking in the interpreter in the name of compatibility.
+
+
+2) Linux
+
+The AcpiSrc Source Conversion Utility has been released with the
+Linux package for the first time. This is the utility that is
+used to convert the ACPI CA base source code to the Linux
+version.
+
+(Both) Handle P_BLK lengths shorter than 6 more gracefully
+
+(Both) Move more headers to include/acpi, and delete an unused
+header.
+
+(Both) Move drivers/acpi/include directory to include/acpi
+
+(Both) Boot functions don't use cmdline, so don't pass it around
+
+(Both) Remove include of unused header (Adrian Bunk)
+
+(Both) acpiphp.h includes both linux/acpi.h and acpi_bus.h. Since
+the
+former now also includes the latter, acpiphp.h only needs the
+one, now.
+
+(2.5) Make it possible to select method of bios restoring after
+S3
+resume. [=> no more ugly ifdefs] (Pavel Machek)
+
+(2.5) Make proc write interfaces work (Pavel Machek)
+
+(2.5) Properly init/clean up in cpufreq/acpi (Dominik Brodowski)
+
+(2.5) Break out ACPI Perf code into its own module, under cpufreq
+(Dominik Brodowski)
+
+(2.4) S4BIOS support (Ducrot Bruno)
+
+(2.4) Fix acpiphp_glue.c for latest ACPI struct changes (Sergio
+Visinoni)
+
+
+3) iASL Compiler:
+
+Added support to disassemble SSDT and PSDTs.
+
+Implemented support to obtain SSDTs from the Windows registry if
+available.
+
+
+----------------------------------------
+09 January 2003. Summary of changes for version 20030109.
+
+1) ACPI CA Core Subsystem:
+
+Changed the behavior of the internal Buffer-to-String conversion
+function. The current ACPI specification states that the
+contents of the buffer are "converted to a string of two-
+character hexadecimal numbers, each separated by a space".
+Unfortunately, this definition is not backwards compatible with
+existing ACPI 1.0 implementations (although the behavior was not
+defined in the ACPI 1.0 specification). The new behavior simply
+copies data from the buffer to the string until a null character
+is found or the end of the buffer is reached. The new String
+object is always null terminated. This problem was seen during
+the generation of _BIF battery data where incorrect strings were
+returned for battery type, etc. This will also require an errata
+to the ACPI specification.
+
+Renamed all instances of NATIVE_UINT and NATIVE_INT to
+ACPI_NATIVE_UINT and ACPI_NATIVE_INT, respectively.
+
+Copyright in all module headers (both Linux and non-Linux) has be
+updated to 2003.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total
+ Debug Version: 153.0K Code, 62.9K Data, 215.9K Total
+ Current Release:
+ Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total
+ Debug Version: 153.0K Code, 62.9K Data, 215.9K Total
+
+
+2) Linux
+
+Fixed an oops on module insertion/removal (Matthew Tippett)
+
+(2.4) Fix to handle dynamic size of mp_irqs (Joerg Prante)
+
+(2.5) Replace pr_debug (Randy Dunlap)
+
+(2.5) Remove usage of CPUFREQ_ALL_CPUS (Dominik Brodowski)
+
+(Both) Eliminate spawning of thread from timer callback, in favor
+of schedule_work()
+
+(Both) Show Lid status in /proc (Zdenek OGAR Skalak)
+
+(Both) Added define for Fixed Function HW region (Matthew Wilcox)
+
+(Both) Add missing statics to button.c (Pavel Machek)
+
+Several changes have been made to the source code translation
+utility that generates the Linux Code in order to make the code
+more "Linux-like":
+
+All typedefs on structs and unions have been removed in keeping
+with the Linux coding style.
+
+Removed the non-Linux SourceSafe module revision number from each
+module header.
+
+Completed major overhaul of symbols to be lowercased for linux.
+Doubled the number of symbols that are lowercased.
+
+Fixed a problem where identifiers within procedure headers and
+within quotes were not fully lower cased (they were left with a
+starting capital.)
+
+Some C macros whose only purpose is to allow the generation of 16-
+bit code are now completely removed in the Linux code, increasing
+readability and maintainability.
+
+----------------------------------------
+
+12 December 2002. Summary of changes for version 20021212.
+
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem where the creation of a zero-length AML Buffer
+would cause a fault.
+
+Fixed a problem where a Buffer object that pointed to a static
+AML buffer (in an ACPI table) could inadvertently be deleted,
+causing memory corruption.
+
+Fixed a problem where a user buffer (passed in to the external
+ACPI CA interfaces) could be overwritten if the buffer was too
+small to complete the operation, causing memory corruption.
+
+Fixed a problem in the Buffer-to-String conversion code where a
+string of length one was always returned, regardless of the size
+of the input Buffer object.
+
+Removed the NATIVE_CHAR data type across the entire source due to
+lack of need and lack of consistent use.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total
+ Debug Version: 152.7K Code, 62.7K Data, 215.4K Total
+ Current Release:
+ Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total
+ Debug Version: 153.0K Code, 62.9K Data, 215.9K Total
+
+
+----------------------------------------
+05 December 2002. Summary of changes for version 20021205.
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem where a store to a String or Buffer object could
+cause corruption of the DSDT if the object type being stored was
+the same as the target object type and the length of the object
+being stored was equal to or smaller than the original (existing)
+target object. This was seen to cause corruption of battery _BIF
+buffers if the _BIF method modified the buffer on the fly.
+
+Fixed a problem where an internal error was generated if a
+control method invocation was used in an OperationRegion, Buffer,
+or Package declaration. This was caused by the deferred parsing
+of the control method and thus the deferred creation of the
+internal method object. The solution to this problem was to
+create the internal method object at the moment the method is
+encountered in the first pass - so that subsequent references to
+the method will able to obtain the required parameter count and
+thus properly parse the method invocation. This problem
+presented itself as an AE_AML_INTERNAL during the pass 1 parse
+phase during table load.
+
+Fixed a problem where the internal String object copy routine did
+not always allocate sufficient memory for the target String
+object and caused memory corruption. This problem was seen to
+cause "Allocation already present in list!" errors as memory
+allocation became corrupted.
+
+Implemented a new function for the evaluation of namespace
+objects that allows the specification of the allowable return
+object types. This simplifies a lot of code that checks for a
+return object of one or more specific objects returned from the
+evaluation (such as _STA, etc.) This may become and external
+function if it would be useful to ACPI-related drivers.
+
+Completed another round of prefixing #defines with "ACPI_" for
+clarity.
+
+Completed additional code restructuring to allow more modular
+linking for iASL compiler and AcpiExec. Several files were split
+creating new files. New files: nsparse.c dsinit.c evgpe.c
+
+Implemented an abort mechanism to terminate an executing control
+method via the AML debugger. This feature is useful for
+debugging control methods that depend (wait) for specific
+hardware responses.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total
+ Debug Version: 152.9K Code, 63.3K Data, 216.2K Total
+ Current Release:
+ Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total
+ Debug Version: 152.7K Code, 62.7K Data, 215.4K Total
+
+
+2) iASL Compiler/Disassembler
+
+Fixed a compiler code generation problem for "Interrupt" Resource
+Descriptors. If specified in the ASL, the optional "Resource
+Source Index" and "Resource Source" fields were not inserted into
+the correct location within the AML resource descriptor, creating
+an invalid descriptor.
+
+Fixed a disassembler problem for "Interrupt" resource
+descriptors. The optional "Resource Source Index" and "Resource
+Source" fields were ignored.
+
+
+----------------------------------------
+22 November 2002. Summary of changes for version 20021122.
+
+
+1) ACPI CA Core Subsystem:
+
+Fixed a reported problem where an object stored to a Method Local
+or Arg was not copied to a new object during the store - the
+object pointer was simply copied to the Local/Arg. This caused
+all subsequent operations on the Local/Arg to also affect the
+original source of the store operation.
+
+Fixed a problem where a store operation to a Method Local or Arg
+was not completed properly if the Local/Arg contained a reference
+(from RefOf) to a named field. The general-purpose store-to-
+namespace-node code is now used so that this case is handled
+automatically.
+
+Fixed a problem where the internal object copy routine would
+cause a protection fault if the object being copied was a Package
+and contained either 1) a NULL package element or 2) a nested sub-
+package.
+
+Fixed a problem with the GPE initialization that resulted from an
+ambiguity in the ACPI specification. One section of the
+specification states that both the address and length of the GPE
+block must be zero if the block is not supported. Another
+section implies that only the address need be zero if the block
+is not supported. The code has been changed so that both the
+address and the length must be non-zero to indicate a valid GPE
+block (i.e., if either the address or the length is zero, the GPE
+block is invalid.)
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total
+ Debug Version: 152.7K Code, 63.2K Data, 215.5K Total
+ Current Release:
+ Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total
+ Debug Version: 152.9K Code, 63.3K Data, 216.2K Total
+
+
+2) Linux
+
+Cleaned up EC driver. Exported an external EC read/write
+interface. By going through this, other drivers (most notably
+sonypi) will be able to serialize access to the EC.
+
+
+3) iASL Compiler/Disassembler
+
+Implemented support to optionally generate include files for both
+ASM and C (the -i switch). This simplifies BIOS development by
+automatically creating include files that contain external
+declarations for the symbols that are created within the
+(optionally generated) ASM and C AML source files.
+
+
+----------------------------------------
+15 November 2002. Summary of changes for version 20021115.
+
+1) ACPI CA Core Subsystem:
+
+Fixed a memory leak problem where an error during resolution of
+method arguments during a method invocation from another method
+failed to cleanup properly by deleting all successfully resolved
+argument objects.
+
+Fixed a problem where the target of the Index() operator was not
+correctly constructed if the source object was a package. This
+problem has not been detected because the use of a target operand
+with Index() is very rare.
+
+Fixed a problem with the Index() operator where an attempt was
+made to delete the operand objects twice.
+
+Fixed a problem where an attempt was made to delete an operand
+twice during execution of the CondRefOf() operator if the target
+did not exist.
+
+Implemented the first of perhaps several internal create object
+functions that create and initialize a specific object type.
+This consolidates duplicated code wherever the object is created,
+thus shrinking the size of the subsystem.
+
+Implemented improved debug/error messages for errors that occur
+during nested method invocations. All executing method pathnames
+are displayed (with the error) as the call stack is unwound -
+thus simplifying debug.
+
+Fixed a problem introduced in the 10/02 release that caused
+premature deletion of a buffer object if a buffer was used as an
+ASL operand where an integer operand is required (Thus causing an
+implicit object conversion from Buffer to Integer.) The change
+in the 10/02 release was attempting to fix a memory leak (albeit
+incorrectly.)
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total
+ Debug Version: 153.1K Code, 63.3K Data, 216.4K Total
+ Current Release:
+ Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total
+ Debug Version: 152.7K Code, 63.2K Data, 215.5K Total
+
+
+2) Linux
+
+Changed the implementation of the ACPI semaphores to use down()
+instead of down_interruptable(). It is important that the
+execution of ACPI control methods not be interrupted by signals.
+Methods must run to completion, or the system may be left in an
+unknown/unstable state.
+
+Fixed a compilation error when CONFIG_SOFTWARE_SUSPEND is not
+set. (Shawn Starr)
+
+
+3) iASL Compiler/Disassembler
+
+
+Changed the default location of output files. All output files
+are now placed in the current directory by default instead of in
+the directory of the source file. This change may affect some
+existing makefiles, but it brings the behavior of the compiler in
+line with other similar tools. The location of the output files
+can be overridden with the -p command line switch.
+
+
+----------------------------------------
+11 November 2002. Summary of changes for version 20021111.
+
+
+0) ACPI Specification 2.0B is released and is now available at:
+http://www.acpi.info/index.html
+
+
+1) ACPI CA Core Subsystem:
+
+Implemented support for the ACPI 2.0 SMBus Operation Regions.
+This includes the early detection and handoff of the request to
+the SMBus region handler (avoiding all of the complex field
+support code), and support for the bidirectional return packet
+from an SMBus write operation. This paves the way for the
+development of SMBus drivers in each host operating system.
+
+Fixed a problem where the semaphore WAIT_FOREVER constant was
+defined as 32 bits, but must be 16 bits according to the ACPI
+specification. This had the side effect of causing ASL
+Mutex/Event timeouts even though the ASL code requested a wait
+forever. Changed all internal references to the ACPI timeout
+parameter to 16 bits to prevent future problems. Changed the
+name of WAIT_FOREVER to ACPI_WAIT_FOREVER.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total
+ Debug Version: 152.3K Code, 63.0K Data, 215.3K Total
+ Current Release:
+ Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total
+ Debug Version: 153.1K Code, 63.3K Data, 216.4K Total
+
+
+2) Linux
+
+Module loading/unloading fixes (John Cagle)
+
+
+3) iASL Compiler/Disassembler
+
+Added support for the SMBBlockProcessCall keyword (ACPI 2.0)
+
+Implemented support for the disassembly of all SMBus protocol
+keywords (SMBQuick, SMBWord, etc.)
+
+----------------------------------------
+01 November 2002. Summary of changes for version 20021101.
+
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem where platforms that have a GPE1 block but no
+GPE0 block were not handled correctly. This resulted in a "GPE
+overlap" error message. GPE0 is no longer required.
+
+Removed code added in the previous release that inserted nodes
+into the namespace in alphabetical order. This caused some side-
+effects on various machines. The root cause of the problem is
+still under investigation since in theory, the internal ordering
+of the namespace nodes should not matter.
+
+
+Enhanced error reporting for the case where a named object is not
+found during control method execution. The full ACPI namepath
+(name reference) of the object that was not found is displayed in
+this case.
+
+Note: as a result of the overhaul of the namespace object types
+in the previous release, the namespace nodes for the predefined
+scopes (_TZ, _PR, etc.) are now of the type ACPI_TYPE_LOCAL_SCOPE
+instead of ACPI_TYPE_ANY. This simplifies the namespace
+management code but may affect code that walks the namespace tree
+looking for specific object types.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total
+ Debug Version: 151.7K Code, 62.4K Data, 214.1K Total
+ Current Release:
+ Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total
+ Debug Version: 152.3K Code, 63.0K Data, 215.3K Total
+
+
+2) Linux
+
+Fixed a problem introduced in the previous release where the
+Processor and Thermal objects were not recognized and installed
+in /proc. This was related to the scope type change described
+above.
+
+
+3) iASL Compiler/Disassembler
+
+Implemented the -g option to get all of the required ACPI tables
+from the registry and save them to files (Windows version of the
+compiler only.) The required tables are the FADT, FACS, and
+DSDT.
+
+Added ACPI table checksum validation during table disassembly in
+order to catch corrupted tables.
+
+
+----------------------------------------
+22 October 2002. Summary of changes for version 20021022.
+
+1) ACPI CA Core Subsystem:
+
+Implemented a restriction on the Scope operator that the target
+must already exist in the namespace at the time the operator is
+encountered (during table load or method execution). In other
+words, forward references are not allowed and Scope() cannot
+create a new object. This changes the previous behavior where the
+interpreter would create the name if not found. This new
+behavior correctly enables the search-to-root algorithm during
+namespace lookup of the target name. Because of this upsearch,
+this fixes the known Compaq _SB_.OKEC problem and makes both the
+AML interpreter and iASL compiler compatible with other ACPI
+implementations.
+
+Completed a major overhaul of the internal ACPI object types for
+the ACPI Namespace and the associated operand objects. Many of
+these types had become obsolete with the introduction of the two-
+pass namespace load. This cleanup simplifies the code and makes
+the entire namespace load mechanism much clearer and easier to
+understand.
+
+Improved debug output for tracking scope opening/closing to help
+diagnose scoping issues. The old scope name as well as the new
+scope name are displayed. Also improved error messages for
+problems with ASL Mutex objects and error messages for GPE
+problems.
+
+Cleaned up the namespace dump code, removed obsolete code.
+
+All string output (for all namespace/object dumps) now uses the
+common ACPI string output procedure which handles escapes
+properly and does not emit non-printable characters.
+
+Fixed some issues with constants in the 64-bit version of the
+local C library (utclib.c)
+
+
+2) Linux
+
+EC Driver: No longer attempts to acquire the Global Lock at
+interrupt level.
+
+
+3) iASL Compiler/Disassembler
+
+Implemented ACPI 2.0B grammar change that disallows all Type 1
+and 2 opcodes outside of a control method. This means that the
+"executable" operators (versus the "namespace" operators) cannot
+be used at the table level; they can only be used within a
+control method.
+
+Implemented the restriction on the Scope() operator where the
+target must already exist in the namespace at the time the
+operator is encountered (during ASL compilation). In other words,
+forward references are not allowed and Scope() cannot create a
+new object. This makes the iASL compiler compatible with other
+ACPI implementations and makes the Scope() implementation adhere
+to the ACPI specification.
+
+Fixed a problem where namepath optimization for the Alias
+operator was optimizing the wrong path (of the two namepaths.)
+This caused a "Missing alias link" error message.
+
+Fixed a problem where an "unknown reserved name" warning could be
+incorrectly generated for names like "_SB" when the trailing
+underscore is not used in the original ASL.
+
+Fixed a problem where the reserved name check did not handle
+NamePaths with multiple NameSegs correctly. The first nameseg of
+the NamePath was examined instead of the last NameSeg.
+
+
+----------------------------------------
+
+02 October 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem version 20021002:
+
+Fixed a problem where a store/copy of a string to an existing
+string did not always set the string length properly in the
+String object.
+
+Fixed a reported problem with the ToString operator where the
+behavior was identical to the ToHexString operator instead of
+just simply converting a raw buffer to a string data type.
+
+Fixed a problem where CopyObject and the other "explicit"
+conversion operators were not updating the internal namespace
+node type as part of the store operation.
+
+Fixed a memory leak during implicit source operand conversion
+where the original object was not deleted if it was converted to
+a new object of a different type.
+
+Enhanced error messages for all problems associated with
+namespace lookups. Common procedure generates and prints the
+lookup name as well as the formatted status.
+
+Completed implementation of a new design for the Alias support
+within the namespace. The existing design did not handle the
+case where a new object was assigned to one of the two names due
+to the use of an explicit conversion operator, resulting in the
+two names pointing to two different objects. The new design
+simply points the Alias name to the original name node - not to
+the object. This results in a level of indirection that must be
+handled in the name resolution mechanism.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total
+ Debug Version: 150.0K Code, 61.7K Data, 211.7K Total
+ Current Release:
+ Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total
+ Debug Version: 151.7K Code, 62.4K Data, 214.1K Total
+
+
+2) Linux
+
+Initialize thermal driver's timer before it is used. (Knut
+Neumann)
+
+Allow handling negative celsius values. (Kochi Takayoshi)
+
+Fix thermal management and make trip points. R/W (Pavel Machek)
+
+Fix /proc/acpi/sleep. (P. Christeas)
+
+IA64 fixes. (David Mosberger)
+
+Fix reversed logic in blacklist code. (Sergio Monteiro Basto)
+
+Replace ACPI_DEBUG define with ACPI_DEBUG_OUTPUT. (Dominik
+Brodowski)
+
+
+3) iASL Compiler/Disassembler
+
+Clarified some warning/error messages.
+
+
+----------------------------------------
+18 September 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem version 20020918:
+
+Fixed a reported problem with reference chaining (via the Index()
+and RefOf() operators) in the ObjectType() and SizeOf()
+operators. The definition of these operators includes the
+dereferencing of all chained references to return information on
+the base object.
+
+Fixed a problem with stores to indexed package elements - the
+existing code would not complete the store if an "implicit
+conversion" was not performed. In other words, if the existing
+object (package element) was to be replaced completely, the code
+didn't handle this case.
+
+Relaxed typechecking on the ASL "Scope" operator to allow the
+target name to refer to an object of type Integer, String, or
+Buffer, in addition to the scoping object types (Device,
+predefined Scopes, Processor, PowerResource, and ThermalZone.)
+This allows existing AML code that has workarounds for a bug in
+Windows to function properly. A warning is issued, however.
+This affects both the AML interpreter and the iASL compiler.
+Below is an example of this type of ASL code:
+
+ Name(DEB,0x00)
+ Scope(DEB)
+ {
+
+Fixed some reported problems with 64-bit integer support in the
+local implementation of C library functions (clib.c)
+
+
+2) Linux
+
+Use ACPI fix map region instead of IOAPIC region, since it is
+undefined in non-SMP.
+
+Ensure that the SCI has the proper polarity and trigger, even on
+systems that do not have an interrupt override entry in the MADT.
+
+2.5 big driver reorganization (Pat Mochel)
+
+Use early table mapping code from acpitable.c (Andi Kleen)
+
+New blacklist entries (Andi Kleen)
+
+Blacklist improvements. Split blacklist code out into a separate
+file. Move checking the blacklist to very early. Previously, we
+would use ACPI tables, and then halfway through init, check the
+blacklist -- too late. Now, it's early enough to completely fall-
+back to non-ACPI.
+
+
+3) iASL Compiler/Disassembler version 20020918:
+
+Fixed a problem where the typechecking code didn't know that an
+alias could point to a method. In other words, aliases were not
+being dereferenced during typechecking.
+
+
+----------------------------------------
+29 August 2002. Summary of changes for this release.
+
+1) ACPI CA Core Subsystem Version 20020829:
+
+If the target of a Scope() operator already exists, it must be an
+object type that actually opens a scope -- such as a Device,
+Method, Scope, etc. This is a fatal runtime error. Similar
+error check has been added to the iASL compiler also.
+
+Tightened up the namespace load to disallow multiple names in the
+same scope. This previously was allowed if both objects were of
+the same type. (i.e., a lookup was the same as entering a new
+name).
+
+
+2) Linux
+
+Ensure that the ACPI interrupt has the proper trigger and
+polarity.
+
+local_irq_disable is extraneous. (Matthew Wilcox)
+
+Make "acpi=off" actually do what it says, and not use the ACPI
+interpreter *or* the tables.
+
+Added arch-neutral support for parsing SLIT and SRAT tables
+(Kochi Takayoshi)
+
+
+3) iASL Compiler/Disassembler Version 20020829:
+
+Implemented namepath optimization for name declarations. For
+example, a declaration like "Method (\_SB_.ABCD)" would get
+optimized to "Method (ABCD)" if the declaration is within the
+\_SB_ scope. This optimization is in addition to the named
+reference path optimization first released in the previous
+version. This would seem to complete all possible optimizations
+for namepaths within the ASL/AML.
+
+If the target of a Scope() operator already exists, it must be an
+object type that actually opens a scope -- such as a Device,
+Method, Scope, etc.
+
+Implemented a check and warning for unreachable code in the same
+block below a Return() statement.
+
+Fixed a problem where the listing file was not generated if the
+compiler aborted if the maximum error count was exceeded (200).
+
+Fixed a problem where the typechecking of method return values
+was broken. This includes the check for a return value when the
+method is invoked as a TermArg (a return value is expected.)
+
+Fixed a reported problem where EOF conditions during a quoted
+string or comment caused a fault.
+
+
+----------------------------------------
+15 August 2002. Summary of changes for this release.
+
+1) ACPI CA Core Subsystem Version 20020815:
+
+Fixed a reported problem where a Store to a method argument that
+contains a reference did not perform the indirect store
+correctly. This problem was created during the conversion to the
+new reference object model - the indirect store to a method
+argument code was not updated to reflect the new model.
+
+Reworked the ACPI mode change code to better conform to ACPI 2.0,
+handle corner cases, and improve code legibility (Kochi
+Takayoshi)
+
+Fixed a problem with the pathname parsing for the carat (^)
+prefix. The heavy use of the carat operator by the new namepath
+optimization in the iASL compiler uncovered a problem with the
+AML interpreter handling of this prefix. In the case where one
+or more carats precede a single nameseg, the nameseg was treated
+as standalone and the search rule (to root) was inadvertently
+applied. This could cause both the iASL compiler and the
+interpreter to find the wrong object or to miss the error that
+should occur if the object does not exist at that exact pathname.
+
+Found and fixed the problem where the HP Pavilion DSDT would not
+load. This was a relatively minor tweak to the table loading
+code (a problem caused by the unexpected encounter with a method
+invocation not within a control method), but it does not solve
+the overall issue of the execution of AML code at the table
+level. This investigation is still ongoing.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total
+ Debug Version: 149.4K Code, 61.6K Data, 211.0K Total
+ Current Release:
+ Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total
+ Debug Version: 150.0K Code, 61.7K Data, 211.7K Total
+
+
+2) Linux
+
+Remove redundant slab.h include (Brad Hards)
+
+Fix several bugs in thermal.c (Herbert Nachtnebel)
+
+Make CONFIG_ACPI_BOOT work properly (Pavel Machek)
+
+Change acpi_system_suspend to use updated irq functions (Pavel
+Machek)
+
+Export acpi_get_firmware_table (Matthew Wilcox)
+
+Use proper root proc entry for ACPI (Kochi Takayoshi)
+
+Fix early-boot table parsing (Bjorn Helgaas)
+
+
+3) iASL Compiler/Disassembler
+
+Reworked the compiler options to make them more consistent and to
+use two-letter options where appropriate. We were running out of
+sensible letters. This may break some makefiles, so check the
+current options list by invoking the compiler with no parameters.
+
+Completed the design and implementation of the ASL namepath
+optimization option for the compiler. This option optimizes all
+references to named objects to the shortest possible path. The
+first attempt tries to utilize a single nameseg (4 characters)
+and the "search-to-root" algorithm used by the interpreter. If
+that cannot be used (because either the name is not in the search
+path or there is a conflict with another object with the same
+name), the pathname is optimized using the carat prefix (usually
+a shorter string than specifying the entire path from the root.)
+
+Implemented support to obtain the DSDT from the Windows registry
+(when the disassembly option is specified with no input file).
+Added this code as the implementation for AcpiOsTableOverride in
+the Windows OSL. Migrated the 16-bit code (used in the AcpiDump
+utility) to scan memory for the DSDT to the AcpiOsTableOverride
+function in the DOS OSL to make the disassembler truly OS
+independent.
+
+Implemented a new option to disassemble and compile in one step.
+When used without an input filename, this option will grab the
+DSDT from the local machine, disassemble it, and compile it in
+one step.
+
+Added a warning message for invalid escapes (a backslash followed
+by any character other than the allowable escapes). This catches
+the quoted string error "\_SB_" (which should be "\\_SB_" ).
+Also, there are numerous instances in the ACPI specification
+where this error occurs.
+
+Added a compiler option to disable all optimizations. This is
+basically the "compatibility mode" because by using this option,
+the AML code will come out exactly the same as other ASL
+compilers.
+
+Added error messages for incorrectly ordered dependent resource
+functions. This includes: missing EndDependentFn macro at end of
+dependent resource list, nested dependent function macros (both
+start and end), and missing StartDependentFn macro. These are
+common errors that should be caught at compile time.
+
+Implemented _OSI support for the disassembler and compiler. _OSI
+must be included in the namespace for proper disassembly (because
+the disassembler must know the number of arguments.)
+
+Added an "optimization" message type that is optional (off by
+default). This message is used for all optimizations - including
+constant folding, integer optimization, and namepath
+optimization.
+
+----------------------------------------
+25 July 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem Version 20020725:
+
+The AML Disassembler has been enhanced to produce compilable ASL
+code and has been integrated into the iASL compiler (see below)
+as well as the single-step disassembly for the AML debugger and
+the disassembler for the AcpiDump utility. All ACPI 2.0A
+opcodes, resource templates and macros are fully supported. The
+disassembler has been tested on over 30 different AML files,
+producing identical AML when the resulting disassembled ASL file
+is recompiled with the same ASL compiler.
+
+Modified the Resource Manager to allow zero interrupts and zero
+dma channels during the GetCurrentResources call. This was
+causing problems on some platforms.
+
+Added the AcpiOsRedirectOutput interface to the OSL to simplify
+output redirection for the AcpiOsPrintf and AcpiOsVprintf
+interfaces.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total
+ Debug Version: 142.9K Code, 58.7K Data, 201.6K Total
+ Current Release:
+ Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total
+ Debug Version: 149.4K Code, 61.6K Data, 211.0K Total
+
+
+2) Linux
+
+Fixed a panic in the EC driver (Dominik Brodowski)
+
+Implemented checksum of the R/XSDT itself during Linux table scan
+(Richard Schaal)
+
+
+3) iASL compiler
+
+The AML disassembler is integrated into the compiler. The "-d"
+option invokes the disassembler to completely disassemble an
+input AML file, producing as output a text ASL file with the
+extension ".dsl" (to avoid name collisions with existing .asl
+source files.) A future enhancement will allow the disassembler
+to obtain the BIOS DSDT from the registry under Windows.
+
+Fixed a problem with the VendorShort and VendorLong resource
+descriptors where an invalid AML sequence was created.
+
+Implemented a fix for BufferData term in the ASL parser. It was
+inadvertently defined twice, allowing invalid syntax to pass and
+causing reduction conflicts.
+
+Fixed a problem where the Ones opcode could get converted to a
+value of zero if "Ones" was used where a byte, word or dword
+value was expected. The 64-bit value is now truncated to the
+correct size with the correct value.
+
+
+----------------------------------------
+02 July 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem Version 20020702:
+
+The Table Manager code has been restructured to add several new
+features. Tables that are not required by the core subsystem
+(other than the FADT, DSDT, FACS, PSDTs, etc.) are no longer
+validated in any way and are returned from AcpiGetFirmwareTable
+if requested. The AcpiOsTableOverride interface is now called
+for each table that is loaded by the subsystem in order to allow
+the host to override any table it chooses. Previously, only the
+DSDT could be overridden. Added one new files, tbrsdt.c and
+tbgetall.c.
+
+Fixed a problem with the conversion of internal package objects
+to external objects (when a package is returned from a control
+method.) The return buffer length was set to zero instead of the
+proper length of the package object.
+
+Fixed a reported problem with the use of the RefOf and DeRefOf
+operators when passing reference arguments to control methods. A
+new type of Reference object is used internally for references
+produced by the RefOf operator.
+
+Added additional error messages in the Resource Manager to
+explain AE_BAD_DATA errors when they occur during resource
+parsing.
+
+Split the AcpiEnableSubsystem into two primitives to enable a
+finer granularity initialization sequence. These two calls
+should be called in this order: AcpiEnableSubsystem (flags),
+AcpiInitializeObjects (flags). The flags parameter remains the
+same.
+
+
+2) Linux
+
+Updated the ACPI utilities module to understand the new style of
+fully resolved package objects that are now returned from the
+core subsystem. This eliminates errors of the form:
+
+ ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PPB_._PRT]
+ acpi_utils-0430 [145] acpi_evaluate_reference:
+ Invalid element in package (not a device reference)
+
+The method evaluation utility uses the new buffer allocation
+scheme instead of calling AcpiEvaluate Object twice.
+
+Added support for ECDT. This allows the use of the Embedded
+Controller before the namespace has been fully initialized, which
+is necessary for ACPI 2.0 support, and for some laptops to
+initialize properly. (Laptops using ECDT are still rare, so only
+limited testing was performed of the added functionality.)
+
+Fixed memory leaks in the EC driver.
+
+Eliminated a brittle code structure in acpi_bus_init().
+
+Eliminated the acpi_evaluate() helper function in utils.c. It is
+no longer needed since acpi_evaluate_object can optionally
+allocate memory for the return object.
+
+Implemented fix for keyboard hang when getting battery readings
+on some systems (Stephen White)
+
+PCI IRQ routing update (Dominik Brodowski)
+
+Fix an ifdef to allow compilation on UP with LAPIC but no IOAPIC
+support
+
+----------------------------------------
+11 June 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem Version 20020611:
+
+Fixed a reported problem where constants such as Zero and One
+appearing within _PRT packages were not handled correctly within
+the resource manager code. Originally reported against the ASL
+compiler because the code generator now optimizes integers to
+their minimal AML representation (i.e. AML constants if
+possible.) The _PRT code now handles all AML constant opcodes
+correctly (Zero, One, Ones, Revision).
+
+Fixed a problem with the Concatenate operator in the AML
+interpreter where a buffer result object was incorrectly marked
+as not fully evaluated, causing a run-time error of
+AE_AML_INTERNAL.
+
+All package sub-objects are now fully resolved before they are
+returned from the external ACPI interfaces. This means that name
+strings are resolved to object handles, and constant operators
+(Zero, One, Ones, Revision) are resolved to Integers.
+
+Implemented immediate resolution of the AML Constant opcodes
+(Zero, One, Ones, Revision) to Integer objects upon detection
+within the AML stream. This has simplified and reduced the
+generated code size of the subsystem by eliminating about 10
+switch statements for these constants (which previously were
+contained in Reference objects.) The complicating issues are
+that the Zero opcode is used as a "placeholder" for unspecified
+optional target operands and stores to constants are defined to
+be no-ops.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 compiler, and these
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release
+ Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total
+ Debug Version: 143.8K Code, 58.8K Data, 202.6K Total
+ Current Release:
+ Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total
+ Debug Version: 142.9K Code, 58.7K Data, 201.6K Total
+
+
+2) Linux
+
+Added preliminary support for obtaining _TRA data for PCI root
+bridges (Bjorn Helgaas).
+
+
+3) iASL Compiler Version X2046:
+
+Fixed a problem where the "_DDN" reserved name was defined to be
+a control method with one argument. There are no arguments, and
+_DDN does not have to be a control method.
+
+Fixed a problem with the Linux version of the compiler where the
+source lines printed with error messages were the wrong lines.
+This turned out to be the "LF versus CR/LF" difference between
+Windows and Unix. This appears to be the longstanding issue
+concerning listing output and error messages.
+
+Fixed a problem with the Linux version of compiler where opcode
+names within error messages were wrong. This was caused by a
+slight difference in the output of the Flex tool on Linux versus
+Windows.
+
+Fixed a problem with the Linux compiler where the hex output
+files contained some garbage data caused by an internal buffer
+overrun.
+
+
+----------------------------------------
+17 May 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem Version 20020517:
+
+Implemented a workaround to an BIOS bug discovered on the HP
+OmniBook where the FADT revision number and the table size are
+inconsistent (ACPI 2.0 revision vs. ACPI 1.0 table size). The
+new behavior is to fallback to using only the ACPI 1.0 fields of
+the FADT if the table is too small to be a ACPI 2.0 table as
+claimed by the revision number. Although this is a BIOS bug,
+this is a case where the workaround is simple enough and with no
+side effects, so it seemed prudent to add it. A warning message
+is issued, however.
+
+Implemented minimum size checks for the fixed-length ACPI tables
+-- the FADT and FACS, as well as consistency checks between the
+revision number and the table size.
+
+Fixed a reported problem in the table override support where the
+new table pointer was incorrectly treated as a physical address
+instead of a logical address.
+
+Eliminated the use of the AE_AML_ERROR exception and replaced it
+with more descriptive codes.
+
+Fixed a problem where an exception would occur if an ASL Field
+was defined with no named Field Units underneath it (used by some
+index fields).
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total
+ Debug Version: 142.9K Code, 58.4K Data, 201.3K Total
+ Current Release:
+ Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total
+ Debug Version: 143.8K Code, 58.8K Data, 202.6K Total
+
+
+
+2) Linux
+
+Much work done on ACPI init (MADT and PCI IRQ routing support).
+(Paul D. and Dominik Brodowski)
+
+Fix PCI IRQ-related panic on boot (Sam Revitch)
+
+Set BM_ARB_DIS when entering a sleep state (Ducrot Bruno)
+
+Fix "MHz" typo (Dominik Brodowski)
+
+Fix RTC year 2000 issue (Dominik Brodowski)
+
+Preclude multiple button proc entries (Eric Brunet)
+
+Moved arch-specific code out of include/platform/aclinux.h
+
+3) iASL Compiler Version X2044:
+
+Implemented error checking for the string used in the EISAID
+macro (Usually used in the definition of the _HID object.) The
+code now strictly enforces the PnP format - exactly 7 characters,
+3 uppercase letters and 4 hex digits.
+
+If a raw string is used in the definition of the _HID object
+(instead of the EISAID macro), the string must contain all
+alphanumeric characters (e.g., "*PNP0011" is not allowed because
+of the asterisk.)
+
+Implemented checking for invalid use of ACPI reserved names for
+most of the name creation operators (Name, Device, Event, Mutex,
+OperationRegion, PowerResource, Processor, and ThermalZone.)
+Previously, this check was only performed for control methods.
+
+Implemented an additional check on the Name operator to emit an
+error if a reserved name that must be implemented in ASL as a
+control method is used. We know that a reserved name must be a
+method if it is defined with input arguments.
+
+The warning emitted when a namespace object reference is not
+found during the cross reference phase has been changed into an
+error. The "External" directive should be used for names defined
+in other modules.
+
+
+4) Tools and Utilities
+
+The 16-bit tools (adump16 and aexec16) have been regenerated and
+tested.
+
+Fixed a problem with the output of both acpidump and adump16
+where the indentation of closing parentheses and brackets was not
+aligned properly with the parent block.
+
+
+----------------------------------------
+03 May 2002. Summary of changes for this release.
+
+
+1) ACPI CA Core Subsystem Version 20020503:
+
+Added support a new OSL interface that allows the host operating
+system software to override the DSDT found in the firmware -
+AcpiOsTableOverride. With this interface, the OSL can examine
+the version of the firmware DSDT and replace it with a different
+one if desired.
+
+Added new external interfaces for accessing ACPI registers from
+device drivers and other system software - AcpiGetRegister and
+AcpiSetRegister. This was simply an externalization of the
+existing AcpiHwBitRegister interfaces.
+
+Fixed a regression introduced in the previous build where the
+ASL/AML CreateField operator always returned an error,
+"destination must be a NS Node".
+
+Extended the maximum time (before failure) to successfully enable
+ACPI mode to 3 seconds.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total
+ Debug Version: 142.4K Code, 58.3K Data, 200.7K Total
+ Current Release:
+ Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total
+ Debug Version: 142.9K Code, 58.4K Data, 201.3K Total
+
+
+2) Linux
+
+Enhanced ACPI init code for SMP. We are now fully MPS and $PIR-
+free. While 3 out of 4 of our in-house systems work fine, the
+last one still hangs when testing the LAPIC timer.
+
+Renamed many files in 2.5 kernel release to omit "acpi_" from the
+name.
+
+Added warning on boot for Presario 711FR.
+
+Sleep improvements (Pavel Machek)
+
+ACPI can now be built without CONFIG_PCI enabled.
+
+IA64: Fixed memory map functions (JI Lee)
+
+
+3) iASL Compiler Version X2043:
+
+Added support to allow the compiler to be integrated into the MS
+VC++ development environment for one-button compilation of single
+files or entire projects -- with error-to-source-line mapping.
+
+Implemented support for compile-time constant folding for the
+Type3, Type4, and Type5 opcodes first defined in the ACPI 2.0
+specification. This allows the ASL writer to use expressions
+instead of Integer/Buffer/String constants in terms that must
+evaluate to constants at compile time and will also simplify the
+emitted AML in any such sub-expressions that can be folded
+(evaluated at compile-time.) This increases the size of the
+compiler significantly because a portion of the ACPI CA AML
+interpreter is included within the compiler in order to pre-
+evaluate constant expressions.
+
+
+Fixed a problem with the "Unicode" ASL macro that caused the
+compiler to fault. (This macro is used in conjunction with the
+_STR reserved name.)
+
+Implemented an AML opcode optimization to use the Zero, One, and
+Ones opcodes where possible to further reduce the size of integer
+constants and thus reduce the overall size of the generated AML
+code.
+
+Implemented error checking for new reserved terms for ACPI
+version 2.0A.
+
+Implemented the -qr option to display the current list of ACPI
+reserved names known to the compiler.
+
+Implemented the -qc option to display the current list of ASL
+operators that are allowed within constant expressions and can
+therefore be folded at compile time if the operands are
+constants.
+
+
+4) Documentation
+
+Updated the Programmer's Reference for new interfaces, data
+types, and memory allocation model options.
+
+Updated the iASL Compiler User Reference to apply new format and
+add information about new features and options.
+
+----------------------------------------
+19 April 2002. Summary of changes for this release.
+
+1) ACPI CA Core Subsystem Version 20020419:
+
+The source code base for the Core Subsystem has been completely
+cleaned with PC-lint (FlexLint) for both 32-bit and 64-bit
+versions. The Lint option files used are included in the
+/acpi/generate/lint directory.
+
+Implemented enhanced status/error checking across the entire
+Hardware manager subsystem. Any hardware errors (reported from
+the OSL) are now bubbled up and will abort a running control
+method.
+
+Fixed a problem where the per-ACPI-table integer width (32 or 64)
+was stored only with control method nodes, causing a fault when
+non-control method code was executed during table loading. The
+solution implemented uses a global variable to indicate table
+width across the entire ACPI subsystem. Therefore, ACPI CA does
+not support mixed integer widths across different ACPI tables
+(DSDT, SSDT).
+
+Fixed a problem where NULL extended fields (X fields) in an ACPI
+2.0 ACPI FADT caused the table load to fail. Although the
+existing ACPI specification is a bit fuzzy on this topic, the new
+behavior is to fall back on a ACPI 1.0 field if the corresponding
+ACPI 2.0 X field is zero (even though the table revision
+indicates a full ACPI 2.0 table.) The ACPI specification will be
+updated to clarify this issue.
+
+Fixed a problem with the SystemMemory operation region handler
+where memory was always accessed byte-wise even if the AML-
+specified access width was larger than a byte. This caused
+problems on systems with memory-mapped I/O. Memory is now
+accessed with the width specified. On systems that do not
+support non-aligned transfers, a check is made to guarantee
+proper address alignment before proceeding in order to avoid an
+AML-caused alignment fault within the kernel.
+
+
+Fixed a problem with the ExtendedIrq resource where only one byte
+of the 4-byte Irq field was extracted.
+
+Fixed the AcpiExDigitsNeeded() procedure to support _UID. This
+function was out of date and required a rewrite.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total
+ Debug Version: 139.8K Code, 57.4K Data, 197.2K Total
+ Current Release:
+ Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total
+ Debug Version: 142.4K Code, 58.3K Data, 200.7K Total
+
+
+2) Linux
+
+PCI IRQ routing fixes (Dominik Brodowski)
+
+
+3) iASL Compiler Version X2042:
+
+Implemented an additional compile-time error check for a field
+unit whose size + minimum access width would cause a run-time
+access beyond the end-of-region. Previously, only the field size
+itself was checked.
+
+The Core subsystem and iASL compiler now share a common parse
+object in preparation for compile-time evaluation of the type
+3/4/5 ASL operators.
+
+
+----------------------------------------
+Summary of changes for this release: 03_29_02
+
+1) ACPI CA Core Subsystem Version 20020329:
+
+Implemented support for late evaluation of TermArg operands to
+Buffer and Package objects. This allows complex expressions to
+be used in the declarations of these object types.
+
+Fixed an ACPI 1.0 compatibility issue when reading Fields. In
+ACPI 1.0, if the field was larger than 32 bits, it was returned
+as a buffer - otherwise it was returned as an integer. In ACPI
+2.0, the field is returned as a buffer only if the field is
+larger than 64 bits. The TableRevision is now considered when
+making this conversion to avoid incompatibility with existing ASL
+code.
+
+Implemented logical addressing for AcpiOsGetRootPointer. This
+allows an RSDP with either a logical or physical address. With
+this support, the host OS can now override all ACPI tables with
+one logical RSDP. Includes implementation of "typed" pointer
+support to allow a common data type for both physical and logical
+pointers internally. This required a change to the
+AcpiOsGetRootPointer interface.
+
+Implemented the use of ACPI 2.0 Generic Address Structures for
+all GPE, Fixed Event, and PM Timer I/O. This allows the use of
+memory mapped I/O for these ACPI features.
+
+Initialization now ignores not only non-required tables (All
+tables other than the FADT, FACS, DSDT, and SSDTs), but also does
+not validate the table headers of unrecognized tables.
+
+Fixed a problem where a notify handler could only be
+installed/removed on an object of type Device. All "notify"
+objects are now supported -- Devices, Processor, Power, and
+Thermal.
+
+Removed most verbosity from the ACPI_DB_INFO debug level. Only
+critical information is returned when this debug level is
+enabled.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total
+ Debug Version: 138.0K Code, 56.6K Data, 194.6K Total
+ Current Release:
+ Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total
+ Debug Version: 139.8K Code, 57.4K Data, 197.2K Total
+
+
+2) Linux:
+
+The processor driver (acpi_processor.c) now fully supports ACPI
+2.0-based processor performance control (e.g. Intel(R)
+SpeedStep(TM) technology) Note that older laptops that only have
+the Intel "applet" interface are not supported through this. The
+'limit' and 'performance' interface (/proc) are fully functional.
+[Note that basic policy for controlling performance state
+transitions will be included in the next version of ospmd.] The
+idle handler was modified to more aggressively use C2, and PIIX4
+errata handling underwent a complete overhaul (big thanks to
+Dominik Brodowski).
+
+Added support for ACPI-PCI device binding (acpi_pci_root.c). _ADR-
+based devices in the ACPI namespace are now dynamically bound
+(associated) with their PCI counterparts (e.g. PCI1->01:00.0).
+This allows, among other things, ACPI to resolve bus numbers for
+subordinate PCI bridges.
+
+Enhanced PCI IRQ routing to get the proper bus number for _PRT
+entries defined underneath PCI bridges.
+
+Added IBM 600E to bad bios list due to invalid _ADR value for
+PIIX4 PCI-ISA bridge, resulting in improper PCI IRQ routing.
+
+In the process of adding full MADT support (e.g. IOAPIC) for IA32
+(acpi.c, mpparse.c) -- stay tuned.
+
+Added back visual differentiation between fixed-feature and
+control-method buttons in dmesg. Buttons are also subtyped (e.g.
+button/power/PWRF) to simplify button identification.
+
+We no longer use -Wno-unused when compiling debug. Please ignore
+any "_THIS_MODULE defined but not used" messages.
+
+Can now shut down the system using "magic sysrq" key.
+
+
+3) iASL Compiler version 2041:
+
+Fixed a problem where conversion errors for hex/octal/decimal
+constants were not reported.
+
+Implemented a fix for the General Register template Address
+field. This field was 8 bits when it should be 64.
+
+Fixed a problem where errors/warnings were no longer being
+emitted within the listing output file.
+
+Implemented the ACPI 2.0A restriction on ACPI Table Signatures to
+exactly 4 characters, alphanumeric only.
+
+
+
+
+----------------------------------------
+Summary of changes for this release: 03_08_02
+
+
+1) ACPI CA Core Subsystem Version 20020308:
+
+Fixed a problem with AML Fields where the use of the "AccessAny"
+keyword could cause an interpreter error due to attempting to
+read or write beyond the end of the parent Operation Region.
+
+Fixed a problem in the SystemMemory Operation Region handler
+where an attempt was made to map memory beyond the end of the
+region. This was the root cause of the "AE_ERROR" and
+"AE_NO_MEMORY" errors on some Linux systems.
+
+Fixed a problem where the interpreter/namespace "search to root"
+algorithm was not functioning for some object types. Relaxed the
+internal restriction on the search to allow upsearches for all
+external object types as well as most internal types.
+
+
+2) Linux:
+
+We now use safe_halt() macro versus individual calls to sti |
+hlt.
+
+Writing to the processor limit interface should now work. "echo
+1" will increase the limit, 2 will decrease, and 0 will reset to
+the default.
+
+
+3) ASL compiler:
+
+Fixed segfault on Linux version.
+
+
+----------------------------------------
+Summary of changes for this release: 02_25_02
+
+1) ACPI CA Core Subsystem:
+
+
+Fixed a problem where the GPE bit masks were not initialized
+properly, causing erratic GPE behavior.
+
+Implemented limited support for multiple calling conventions.
+The code can be generated with either the VPL (variable parameter
+list, or "C") convention, or the FPL (fixed parameter list, or
+"Pascal") convention. The core subsystem is about 3.4% smaller
+when generated with FPL.
+
+
+2) Linux
+
+Re-add some /proc/acpi/event functionality that was lost during
+the rewrite
+
+Resolved issue with /proc events for fixed-feature buttons
+showing up as the system device.
+
+Fixed checks on C2/C3 latencies to be inclusive of maximum
+values.
+
+Replaced AE_ERRORs in acpi_osl.c with more specific error codes.
+
+Changed ACPI PRT option from "pci=noacpi-routing" to "pci=noacpi"
+
+Fixed limit interface & usage to fix bugs with passive cooling
+hysterisis.
+
+Restructured PRT support.
+
+
+----------------------------------------
+Summary of changes for this label: 02_14_02
+
+
+1) ACPI CA Core Subsystem:
+
+Implemented support in AcpiLoadTable to allow loading of FACS and
+FADT tables.
+
+Suport for the now-obsolete interim 0.71 64-bit ACPI tables has
+been removed. All 64-bit platforms should be migrated to the
+ACPI 2.0 tables. The actbl71.h header has been removed from the
+source tree.
+
+All C macros defined within the subsystem have been prefixed with
+"ACPI_" to avoid collision with other system include files.
+
+Removed the return value for the two AcpiOsPrint interfaces,
+since it is never used and causes lint warnings for ignoring the
+return value.
+
+Added error checking to all internal mutex acquire and release
+calls. Although a failure from one of these interfaces is
+probably a fatal system error, these checks will cause the
+immediate abort of the currently executing method or interface.
+
+Fixed a problem where the AcpiSetCurrentResources interface could
+fault. This was a side effect of the deployment of the new
+memory allocation model.
+
+Fixed a couple of problems with the Global Lock support
+introduced in the last major build. The "common" (1.0/2.0)
+internal FACS was being overwritten with the FACS signature and
+clobbering the Global Lock pointer. Also, the actual firmware
+FACS was being unmapped after construction of the "common" FACS,
+preventing access to the actual Global Lock field within it. The
+"common" internal FACS is no longer installed as an actual ACPI
+table; it is used simply as a global.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Previous Release (02_07_01)
+ Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total
+ Debug Version: 136.9K Code, 56.4K Data, 193.3K Total
+ Current Release:
+ Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total
+ Debug Version: 138.0K Code, 56.6K Data, 194.6K Total
+
+
+2) Linux
+
+Updated Linux-specific code for core macro and OSL interface
+changes described above.
+
+Improved /proc/acpi/event. It now can be opened only once and has
+proper poll functionality.
+
+Fixed and restructured power management (acpi_bus).
+
+Only create /proc "view by type" when devices of that class
+exist.
+
+Fixed "charging/discharging" bug (and others) in acpi_battery.
+
+Improved thermal zone code.
+
+
+3) ASL Compiler, version X2039:
+
+
+Implemented the new compiler restriction on ASL String hex/octal
+escapes to non-null, ASCII values. An error results if an
+invalid value is used. (This will require an ACPI 2.0
+specification change.)
+
+AML object labels that are output to the optional C and ASM
+source are now prefixed with both the ACPI table signature and
+table ID to help guarantee uniqueness within a large BIOS
+project.
+
+
+----------------------------------------
+Summary of changes for this label: 02_01_02
+
+1) ACPI CA Core Subsystem:
+
+ACPI 2.0 support is complete in the entire Core Subsystem and the
+ASL compiler. All new ACPI 2.0 operators are implemented and all
+other changes for ACPI 2.0 support are complete. With
+simultaneous code and data optimizations throughout the
+subsystem, ACPI 2.0 support has been implemented with almost no
+additional cost in terms of code and data size.
+
+Implemented a new mechanism for allocation of return buffers. If
+the buffer length is set to ACPI_ALLOCATE_BUFFER, the buffer will
+be allocated on behalf of the caller. Consolidated all return
+buffer validation and allocation to a common procedure. Return
+buffers will be allocated via the primary OSL allocation
+interface since it appears that a separate pool is not needed by
+most users. If a separate pool is required for these buffers,
+the caller can still use the original mechanism and pre-allocate
+the buffer(s).
+
+Implemented support for string operands within the DerefOf
+operator.
+
+Restructured the Hardware and Event managers to be table driven,
+simplifying the source code and reducing the amount of generated
+code.
+
+Split the common read/write low-level ACPI register bitfield
+procedure into a separate read and write, simplifying the code
+considerably.
+
+Obsoleted the AcpiOsCallocate OSL interface. This interface was
+used only a handful of times and didn't have enough critical mass
+for a separate interface. Replaced with a common calloc
+procedure in the core.
+
+Fixed a reported problem with the GPE number mapping mechanism
+that allows GPE1 numbers to be non-contiguous with GPE0.
+Reorganized the GPE information and shrunk a large array that was
+originally large enough to hold info for all possible GPEs (256)
+to simply large enough to hold all GPEs up to the largest GPE
+number on the machine.
+
+Fixed a reported problem with resource structure alignment on 64-
+bit platforms.
+
+Changed the AcpiEnableEvent and AcpiDisableEvent external
+interfaces to not require any flags for the common case of
+enabling/disabling a GPE.
+
+Implemented support to allow a "Notify" on a Processor object.
+
+Most TBDs in comments within the source code have been resolved
+and eliminated.
+
+Fixed a problem in the interpreter where a standalone parent
+prefix (^) was not handled correctly in the interpreter and
+debugger.
+
+Removed obsolete and unnecessary GPE save/restore code.
+
+Implemented Field support in the ASL Load operator. This allows
+a table to be loaded from a named field, in addition to loading a
+table directly from an Operation Region.
+
+Implemented timeout and handle support in the external Global
+Lock interfaces.
+
+Fixed a problem in the AcpiDump utility where pathnames were no
+longer being generated correctly during the dump of named
+objects.
+
+Modified the AML debugger to give a full display of if/while
+predicates instead of just one AML opcode at a time. (The
+predicate can have several nested ASL statements.) The old
+method was confusing during single stepping.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 compiler, and these
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release (12_18_01)
+ Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total
+ Debug Version: 138.3K Code, 55.9K Data, 194.2K Total
+ Current Release:
+ Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total
+ Debug Version: 136.9K Code, 56.4K Data, 193.3K Total
+
+2) Linux
+
+ Implemented fix for PIIX reverse throttling errata (Processor
+driver)
+
+Added new Limit interface (Processor and Thermal drivers)
+
+New thermal policy (Thermal driver)
+
+Many updates to /proc
+
+Battery "low" event support (Battery driver)
+
+Supports ACPI PCI IRQ routing (PCI Link and PCI root drivers)
+
+IA32 - IA64 initialization unification, no longer experimental
+
+Menuconfig options redesigned
+
+3) ASL Compiler, version X2037:
+
+Implemented several new output features to simplify integration
+of AML code into firmware: 1) Output the AML in C source code
+with labels for each named ASL object. The original ASL
+source code is interleaved as C comments. 2) Output the AML in
+ASM source code with labels and interleaved ASL source. 3)
+Output the AML in raw hex table form, in either C or ASM.
+
+Implemented support for optional string parameters to the
+LoadTable operator.
+
+Completed support for embedded escape sequences within string
+literals. The compiler now supports all single character escapes
+as well as the Octal and Hex escapes. Note: the insertion of a
+null byte into a string literal (via the hex/octal escape) causes
+the string to be immediately terminated. A warning is issued.
+
+Fixed a problem where incorrect AML was generated for the case
+where an ASL namepath consists of a single parent prefix (
+
+) with no trailing name segments.
+
+The compiler has been successfully generated with a 64-bit C
+compiler.
+
+
+
+
+----------------------------------------
+Summary of changes for this label: 12_18_01
+
+1) Linux
+
+Enhanced blacklist with reason and severity fields. Any table's
+signature may now be used to identify a blacklisted system.
+
+Call _PIC control method to inform the firmware which interrupt
+model the OS is using. Turn on any disabled link devices.
+
+Cleaned up busmgr /proc error handling (Andreas Dilger)
+
+ 2) ACPI CA Core Subsystem:
+
+Implemented ACPI 2.0 semantics for the "Break" operator (Exit
+from while loop)
+
+Completed implementation of the ACPI 2.0 "Continue",
+"ConcatenateResTemplate", "DataTableRegion", and "LoadTable"
+operators. All new ACPI 2.0 operators are now implemented in
+both the ASL compiler and the AML interpreter. The only
+remaining ACPI 2.0 task is support for the String data type in
+the DerefOf operator. Fixed a problem with AcquireMutex where
+the status code was lost if the caller had to actually wait for
+the mutex.
+
+Increased the maximum ASL Field size from 64K bits to 4G bits.
+
+Completed implementation of the external Global Lock interfaces -
+- AcpiAcquireGlobalLock and AcpiReleaseGlobalLock. The Timeout
+and Handler parameters were added.
+
+Completed another pass at removing warnings and issues when
+compiling with 64-bit compilers. The code now compiles cleanly
+with the Intel 64-bit C/C++ compiler. Most notably, the pointer
+add and subtract (diff) macros have changed considerably.
+
+Created and deployed a new ACPI_SIZE type that is 64-bits wide on
+64-bit platforms, 32-bits on all others. This type is used
+wherever memory allocation and/or the C sizeof() operator is
+used, and affects the OSL memory allocation interfaces
+AcpiOsAllocate and AcpiOsCallocate.
+
+Implemented sticky user breakpoints in the AML debugger.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 compiler, and these
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a larger code and data size. Note that these values will vary
+depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release (12_05_01)
+ Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total
+ Debug Version: 136.2K Code, 55.6K Data, 191.8K Total
+ Current Release:
+ Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total
+ Debug Version: 138.3K Code, 55.9K Data, 194.2K Total
+
+ 3) ASL Compiler, version X2034:
+
+Now checks for (and generates an error if detected) the use of a
+Break or Continue statement without an enclosing While statement.
+
+Successfully generated the compiler with the Intel 64-bit C
+compiler.
+
+ ----------------------------------------
+Summary of changes for this label: 12_05_01
+
+ 1) ACPI CA Core Subsystem:
+
+The ACPI 2.0 CopyObject operator is fully implemented. This
+operator creates a new copy of an object (and is also used to
+bypass the "implicit conversion" mechanism of the Store
+operator.)
+
+The ACPI 2.0 semantics for the SizeOf operator are fully
+implemented. The change is that performing a SizeOf on a
+reference object causes an automatic dereference of the object to
+tha actual value before the size is evaluated. This behavior was
+undefined in ACPI 1.0.
+
+The ACPI 2.0 semantics for the Extended IRQ resource descriptor
+have been implemented. The interrupt polarity and mode are now
+independently set.
+
+Fixed a problem where ASL Constants (Zero, One, Ones, Revision)
+appearing in Package objects were not properly converted to
+integers when the internal Package was converted to an external
+object (via the AcpiEvaluateObject interface.)
+
+Fixed a problem with the namespace object deletion mechanism for
+objects created by control methods. There were two parts to this
+problem: 1) Objects created during the initialization phase
+method parse were not being deleted, and 2) The object owner ID
+mechanism to track objects was broken.
+
+Fixed a problem where the use of the ASL Scope operator within a
+control method would result in an invalid opcode exception.
+
+Fixed a problem introduced in the previous label where the buffer
+length required for the _PRT structure was not being returned
+correctly.
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 compiler, and these
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release (11_20_01)
+ Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total
+ Debug Version: 135.1K Code, 55.4K Data, 190.5K Total
+
+ Current Release:
+ Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total
+ Debug Version: 136.2K Code, 55.6K Data, 191.8K Total
+
+ 2) Linux:
+
+Updated all files to apply cleanly against 2.4.16.
+
+Added basic PCI Interrupt Routing Table (PRT) support for IA32
+(acpi_pci.c), and unified the PRT code for IA32 and IA64. This
+version supports both static and dyanmic PRT entries, but dynamic
+entries are treated as if they were static (not yet
+reconfigurable). Architecture- specific code to use this data is
+absent on IA32 but should be available shortly.
+
+Changed the initialization sequence to start the ACPI interpreter
+(acpi_init) prior to initialization of the PCI driver (pci_init)
+in init/main.c. This ordering is required to support PRT and
+facilitate other (future) enhancement. A side effect is that the
+ACPI bus driver and certain device drivers can no longer be
+loaded as modules.
+
+Modified the 'make menuconfig' options to allow PCI Interrupt
+Routing support to be included without the ACPI Bus and other
+device drivers.
+
+ 3) ASL Compiler, version X2033:
+
+Fixed some issues with the use of the new CopyObject and
+DataTableRegion operators. Both are fully functional.
+
+ ----------------------------------------
+Summary of changes for this label: 11_20_01
+
+ 20 November 2001. Summary of changes for this release.
+
+ 1) ACPI CA Core Subsystem:
+
+Updated Index support to match ACPI 2.0 semantics. Storing a
+Integer, String, or Buffer to an Index of a Buffer will store
+only the least-significant byte of the source to the Indexed
+buffer byte. Multiple writes are not performed.
+
+Fixed a problem where the access type used in an AccessAs ASL
+operator was not recorded correctly into the field object.
+
+Fixed a problem where ASL Event objects were created in a
+signalled state. Events are now created in an unsignalled state.
+
+The internal object cache is now purged after table loading and
+initialization to reduce the use of dynamic kernel memory -- on
+the assumption that object use is greatest during the parse phase
+of the entire table (versus the run-time use of individual
+control methods.)
+
+ACPI 2.0 variable-length packages are now fully operational.
+
+Code and Data Size: Code and Data optimizations have permitted
+new feature development with an actual reduction in the library
+size. Current core subsystem library sizes are shown below.
+These are the code and data sizes for the acpica.lib produced by
+the Microsoft Visual C++ 6.0 compiler, and these values do not
+include any ACPI driver or OSPM code. The debug version of the
+code includes the debug output trace mechanism and has a larger
+code and data size. Note that these values will vary depending
+on the efficiency of the compiler and the compiler options used
+during generation.
+
+ Previous Release (11_09_01):
+ Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total
+ Debug Version: 134.5K Code, 55.4K Data, 189.9K Total
+
+ Current Release:
+ Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total
+ Debug Version: 135.1K Code, 55.4K Data, 190.5K Total
+
+ 2) Linux:
+
+Enhanced the ACPI boot-time initialization code to allow the use
+of Local APIC tables for processor enumeration on IA-32, and to
+pave the way for a fully MPS-free boot (on SMP systems) in the
+near future. This functionality replaces
+arch/i386/kernel/acpitables.c, which was introduced in an earlier
+2.4.15-preX release. To enable this feature you must add
+"acpi_boot=on" to the kernel command line -- see the help entry
+for CONFIG_ACPI_BOOT for more information. An IA-64 release is
+in the works...
+
+Restructured the configuration options to allow boot-time table
+parsing support without inclusion of the ACPI Interpreter (and
+other) code.
+
+NOTE: This release does not include fixes for the reported
+events, power-down, and thermal passive cooling issues (coming
+soon).
+
+ 3) ASL Compiler:
+
+Added additional typechecking for Fields within restricted access
+Operation Regions. All fields within EC and CMOS regions must be
+declared with ByteAcc. All fields withing SMBus regions must be
+declared with the BufferAcc access type.
+
+Fixed a problem where the listing file output of control methods
+no longer interleaved the actual AML code with the ASL source
+code.
+
+
+
+----------------------------------------
+Summary of changes for this label: 11_09_01
+
+1) ACPI CA Core Subsystem:
+
+Implemented ACPI 2.0-defined support for writes to fields with a
+Buffer, String, or Integer source operand that is smaller than
+the target field. In these cases, the source operand is zero-
+extended to fill the target field.
+
+Fixed a problem where a Field starting bit offset (within the
+parent operation region) was calculated incorrectly if the
+alignment of the field differed from the access width. This
+affected CreateWordField, CreateDwordField, CreateQwordField, and
+possibly other fields that use the "AccessAny" keyword.
+
+Fixed a problem introduced in the 11_02_01 release where indirect
+stores through method arguments did not operate correctly.
+
+2) Linux:
+
+Implemented boot-time ACPI table parsing support
+(CONFIG_ACPI_BOOT) for IA32 and IA64 UP/SMP systems. This code
+facilitates the use of ACPI tables (e.g. MADT, SRAT) rather than
+legacy BIOS interfaces (e.g. MPS) for the configuration of system
+processors, memory, and interrupts during setup_arch(). Note
+that this patch does not include the required architecture-
+specific changes required to apply this information -- subsequent
+patches will be posted for both IA32 and IA64 to achieve this.
+
+Added low-level sleep support for IA32 platforms, courtesy of Pat
+Mochel. This allows IA32 systems to transition to/from various
+sleeping states (e.g. S1, S3), although the lack of a centralized
+driver model and power-manageable drivers will prevent its
+(successful) use on most systems.
+
+Revamped the ACPI 'menuconfig' layout: created new "ACPI Support"
+submenu, unified IA32 and IA64 options, added new "Boot using
+ACPI tables" option, etc.
+
+Increased the default timeout for the EC driver from 1ms to 10ms
+(1000 cycles of 10us) to try to address AE_TIME errors during EC
+transactions.
+
+ ----------------------------------------
+Summary of changes for this label: 11_02_01
+
+1) ACPI CA Core Subsystem:
+
+ACPI 2.0 Support: Implemented ACPI 2.0 64-bit Field access
+(QWordAcc keyword). All ACPI 2.0 64-bit support is now
+implemented.
+
+OSL Interfaces: Several of the OSL (AcpiOs*) interfaces required
+changes to support ACPI 2.0 Qword field access. Read/Write
+PciConfiguration(), Read/Write Memory(), and Read/Write Port()
+now accept an ACPI_INTEGER (64 bits) as the value parameter.
+Also, the value parameter for the address space handler interface
+is now an ACPI_INTEGER. OSL implementations of these interfaces
+must now handle the case where the Width parameter is 64.
+
+Index Fields: Fixed a problem where unaligned bit assembly and
+disassembly for IndexFields was not supported correctly.
+
+Index and Bank Fields: Nested Index and Bank Fields are now
+supported. During field access, a check is performed to ensure
+that the value written to an Index or Bank register is not out of
+the range of the register. The Index (or Bank) register is
+written before each access to the field data. Future support will
+include allowing individual IndexFields to be wider than the
+DataRegister width.
+
+Fields: Fixed a problem where the AML interpreter was incorrectly
+attempting to write beyond the end of a Field/OpRegion. This was
+a boundary case that occurred when a DWORD field was written to a
+BYTE access OpRegion, forcing multiple writes and causing the
+interpreter to write one datum too many.
+
+Fields: Fixed a problem with Field/OpRegion access where the
+starting bit address of a field was incorrectly calculated if the
+current access type was wider than a byte (WordAcc, DwordAcc, or
+QwordAcc).
+
+Fields: Fixed a problem where forward references to individual
+FieldUnits (individual Field names within a Field definition)
+were not resolved during the AML table load.
+
+Fields: Fixed a problem where forward references from a Field
+definition to the parent Operation Region definition were not
+resolved during the AML table load.
+
+Fields: Duplicate FieldUnit names within a scope are now detected
+during AML table load.
+
+Acpi Interfaces: Fixed a problem where the AcpiGetName()
+interface returned an incorrect name for the root node.
+
+Code and Data Size: Code and Data optimizations have permitted
+new feature development with an actual reduction in the library
+size. Current core subsystem library sizes are shown below.
+These are the code and data sizes for the acpica.lib produced by
+the Microsoft Visual C++ 6.0 compiler, and these values do not
+include any ACPI driver or OSPM code. The debug version of the
+code includes the debug output trace mechanism and has a larger
+code and data size. Note that these values will vary depending
+on the efficiency of the compiler and the compiler options used
+during generation.
+
+ Previous Release (10_18_01):
+ Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total
+ Debug Version: 136.7K Code, 57.4K Data, 194.2K Total
+
+ Current Release:
+ Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total
+ Debug Version: 134.5K Code, 55.4K Data, 189.9K Total
+
+ 2) Linux:
+
+Improved /proc processor output (Pavel Machek) Re-added
+MODULE_LICENSE("GPL") to all modules.
+
+ 3) ASL Compiler version X2030:
+
+Duplicate FieldUnit names within a scope are now detected and
+flagged as errors.
+
+ 4) Documentation:
+
+Programmer Reference updated to reflect OSL and address space
+handler interface changes described above.
+
+----------------------------------------
+Summary of changes for this label: 10_18_01
+
+ACPI CA Core Subsystem:
+
+Fixed a problem with the internal object reference count
+mechanism that occasionally caused premature object deletion.
+This resolves all of the outstanding problem reports where an
+object is deleted in the middle of an interpreter evaluation.
+Although this problem only showed up in rather obscure cases, the
+solution to the problem involved an adjustment of all reference
+counts involving objects attached to namespace nodes.
+
+Fixed a problem with Field support in the interpreter where
+writing to an aligned field whose length is an exact multiple (2
+or greater) of the field access granularity would cause an
+attempt to write beyond the end of the field.
+
+The top level AML opcode execution functions within the
+interpreter have been renamed with a more meaningful and
+consistent naming convention. The modules exmonad.c and
+exdyadic.c were eliminated. New modules are exoparg1.c,
+exoparg2.c, exoparg3.c, and exoparg6.c.
+
+Support for the ACPI 2.0 "Mid" ASL operator has been implemented.
+
+Fixed a problem where the AML debugger was causing some internal
+objects to not be deleted during subsystem termination.
+
+Fixed a problem with the external AcpiEvaluateObject interface
+where the subsystem would fault if the named object to be
+evaluated refered to a constant such as Zero, Ones, etc.
+
+Fixed a problem with IndexFields and BankFields where the
+subsystem would fault if the index, data, or bank registers were
+not defined in the same scope as the field itself.
+
+Added printf format string checking for compilers that support
+this feature. Corrected more than 50 instances of issues with
+format specifiers within invocations of ACPI_DEBUG_PRINT
+throughout the core subsystem code.
+
+The ASL "Revision" operator now returns the ACPI support level
+implemented in the core - the value "2" since the ACPI 2.0
+support is more than 50% implemented.
+
+Enhanced the output of the AML debugger "dump namespace" command
+to output in a more human-readable form.
+
+Current core subsystem library code sizes are shown below. These
+are the code and data sizes for the acpica.lib produced by the
+Microsoft Visual C++ 6.0 compiler, and these values do not
+include any ACPI driver or OSPM code. The debug version of the
+code includes the full debug trace mechanism -- leading to a much
+larger code and data size. Note that these values will vary
+depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Label (09_20_01):
+ Non-Debug Version: 65K Code, 5K Data, 70K Total
+ Debug Version: 138K Code, 58K Data, 196K Total
+
+ This Label:
+
+ Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total
+ Debug Version: 136.7K Code, 57.4K Data, 194.2K Total
+
+Linux:
+
+Implemented a "Bad BIOS Blacklist" to track machines that have
+known ASL/AML problems.
+
+Enhanced the /proc interface for the thermal zone driver and
+added support for _HOT (the critical suspend trip point). The
+'info' file now includes threshold/policy information, and allows
+setting of _SCP (cooling preference) and _TZP (polling frequency)
+values to the 'info' file. Examples: "echo tzp=5 > info" sets the
+polling frequency to 5 seconds, and "echo scp=1 > info" sets the
+cooling preference to the passive/quiet mode (if supported by the
+ASL).
+
+Implemented a workaround for a gcc bug that resuted in an OOPs
+when loading the control method battery driver.
+
+ ----------------------------------------
+Summary of changes for this label: 09_20_01
+
+ ACPI CA Core Subsystem:
+
+The AcpiEnableEvent and AcpiDisableEvent interfaces have been
+modified to allow individual GPE levels to be flagged as wake-
+enabled (i.e., these GPEs are to remain enabled when the platform
+sleeps.)
+
+The AcpiEnterSleepState and AcpiLeaveSleepState interfaces now
+support wake-enabled GPEs. This means that upon entering the
+sleep state, all GPEs that are not wake-enabled are disabled.
+When leaving the sleep state, these GPEs are reenabled.
+
+A local double-precision divide/modulo module has been added to
+enhance portability to OS kernels where a 64-bit math library is
+not available. The new module is "utmath.c".
+
+Several optimizations have been made to reduce the use of CPU
+stack. Originally over 2K, the maximum stack usage is now below
+2K at 1860 bytes (1.82k)
+
+Fixed a problem with the AcpiGetFirmwareTable interface where the
+root table pointer was not mapped into a logical address
+properly.
+
+Fixed a problem where a NULL pointer was being dereferenced in
+the interpreter code for the ASL Notify operator.
+
+Fixed a problem where the use of the ASL Revision operator
+returned an error. This operator now returns the current version
+of the ACPI CA core subsystem.
+
+Fixed a problem where objects passed as control method parameters
+to AcpiEvaluateObject were always deleted at method termination.
+However, these objects may end up being stored into the namespace
+by the called method. The object reference count mechanism was
+applied to these objects instead of a force delete.
+
+Fixed a problem where static strings or buffers (contained in the
+AML code) that are declared as package elements within the ASL
+code could cause a fault because the interpreter would attempt to
+delete them. These objects are now marked with the "static
+object" flag to prevent any attempt to delete them.
+
+Implemented an interpreter optimization to use operands directly
+from the state object instead of extracting the operands to local
+variables. This reduces stack use and code size, and improves
+performance.
+
+The module exxface.c was eliminated as it was an unnecessary
+extra layer of code.
+
+Current core subsystem library code sizes are shown below. These
+are the code and data sizes for the acpica.lib produced by the
+Microsoft Visual C++ 6.0 compiler, and these values do not
+include any ACPI driver or OSPM code. The debug version of the
+code includes the full debug trace mechanism -- leading to a much
+larger code and data size. Note that these values will vary
+depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Non-Debug Version: 65K Code, 5K Data, 70K Total
+(Previously 69K) Debug Version: 138K Code, 58K Data, 196K
+Total (Previously 195K)
+
+Linux:
+
+Support for ACPI 2.0 64-bit integers has been added. All ACPI
+Integer objects are now 64 bits wide
+
+All Acpi data types and structures are now in lower case. Only
+Acpi macros are upper case for differentiation.
+
+ Documentation:
+
+Changes to the external interfaces as described above.
+
+ ----------------------------------------
+Summary of changes for this label: 08_31_01
+
+ ACPI CA Core Subsystem:
+
+A bug with interpreter implementation of the ASL Divide operator
+was found and fixed. The implicit function return value (not the
+explicit store operands) was returning the remainder instead of
+the quotient. This was a longstanding bug and it fixes several
+known outstanding issues on various platforms.
+
+The ACPI_DEBUG_PRINT and function trace entry/exit macros have
+been further optimized for size. There are 700 invocations of
+the DEBUG_PRINT macro alone, so each optimization reduces the
+size of the debug version of the subsystem significantly.
+
+A stack trace mechanism has been implemented. The maximum stack
+usage is about 2K on 32-bit platforms. The debugger command
+"stat stack" will display the current maximum stack usage.
+
+All public symbols and global variables within the subsystem are
+now prefixed with the string "Acpi". This keeps all of the
+symbols grouped together in a kernel map, and avoids conflicts
+with other kernel subsystems.
+
+Most of the internal fixed lookup tables have been moved into the
+code segment via the const operator.
+
+Several enhancements have been made to the interpreter to both
+reduce the code size and improve performance.
+
+Current core subsystem library code sizes are shown below. These
+are the code and data sizes for the acpica.lib produced by the
+Microsoft Visual C++ 6.0 compiler, and these values do not
+include any ACPI driver or OSPM code. The debug version of the
+code includes the full debug trace mechanism which contains over
+700 invocations of the DEBUG_PRINT macro, 500 function entry
+macro invocations, and over 900 function exit macro invocations -
+- leading to a much larger code and data size. Note that these
+values will vary depending on the efficiency of the compiler and
+the compiler options used during generation.
+
+ Non-Debug Version: 64K Code, 5K Data, 69K Total
+Debug Version: 137K Code, 58K Data, 195K Total
+
+ Linux:
+
+Implemented wbinvd() macro, pending a kernel-wide definition.
+
+Fixed /proc/acpi/event to handle poll() and short reads.
+
+ ASL Compiler, version X2026:
+
+Fixed a problem introduced in the previous label where the AML
+code emitted for package objects produced packages with zero
+length.
+
+ ----------------------------------------
+Summary of changes for this label: 08_16_01
+
+ACPI CA Core Subsystem:
+
+The following ACPI 2.0 ASL operators have been implemented in the
+AML interpreter (These are already supported by the Intel ASL
+compiler): ToDecimalString, ToHexString, ToString, ToInteger,
+and ToBuffer. Support for 64-bit AML constants is implemented in
+the AML parser, debugger, and disassembler.
+
+The internal memory tracking mechanism (leak detection code) has
+been upgraded to reduce the memory overhead (a separate tracking
+block is no longer allocated for each memory allocation), and now
+supports all of the internal object caches.
+
+The data structures and code for the internal object caches have
+been coelesced and optimized so that there is a single cache and
+memory list data structure and a single group of functions that
+implement generic cache management. This has reduced the code
+size in both the debug and release versions of the subsystem.
+
+The DEBUG_PRINT macro(s) have been optimized for size and
+replaced by ACPI_DEBUG_PRINT. The syntax for this macro is
+slightly different, because it generates a single call to an
+internal function. This results in a savings of about 90 bytes
+per invocation, resulting in an overall code and data savings of
+about 16% in the debug version of the subsystem.
+
+ Linux:
+
+Fixed C3 disk corruption problems and re-enabled C3 on supporting
+machines.
+
+Integrated low-level sleep code by Patrick Mochel.
+
+Further tweaked source code Linuxization.
+
+Other minor fixes.
+
+ ASL Compiler:
+
+Support for ACPI 2.0 variable length packages is fixed/completed.
+
+Fixed a problem where the optional length parameter for the ACPI
+2.0 ToString operator.
+
+Fixed multiple extraneous error messages when a syntax error is
+detected within the declaration line of a control method.
+
+ ----------------------------------------
+Summary of changes for this label: 07_17_01
+
+ACPI CA Core Subsystem:
+
+Added a new interface named AcpiGetFirmwareTable to obtain any
+ACPI table via the ACPI signature. The interface can be called
+at any time during kernel initialization, even before the kernel
+virtual memory manager is initialized and paging is enabled.
+This allows kernel subsystems to obtain ACPI tables very early,
+even before the ACPI CA subsystem is initialized.
+
+Fixed a problem where Fields defined with the AnyAcc attribute
+could be resolved to the incorrect address under the following
+conditions: 1) the field width is larger than 8 bits and 2) the
+parent operation region is not defined on a DWORD boundary.
+
+Fixed a problem where the interpreter is not being locked during
+namespace initialization (during execution of the _INI control
+methods), causing an error when an attempt is made to release it
+later.
+
+ACPI 2.0 support in the AML Interpreter has begun and will be
+ongoing throughout the rest of this year. In this label, The Mod
+operator is implemented.
+
+Added a new data type to contain full PCI addresses named
+ACPI_PCI_ID. This structure contains the PCI Segment, Bus,
+Device, and Function values.
+
+ Linux:
+
+Enhanced the Linux version of the source code to change most
+capitalized ACPI type names to lowercase. For example, all
+instances of ACPI_STATUS are changed to acpi_status. This will
+result in a large diff, but the change is strictly cosmetic and
+aligns the CA code closer to the Linux coding standard.
+
+OSL Interfaces:
+
+The interfaces to the PCI configuration space have been changed
+to add the PCI Segment number and to split the single 32-bit
+combined DeviceFunction field into two 16-bit fields. This was
+accomplished by moving the four values that define an address in
+PCI configuration space (segment, bus, device, and function) to
+the new ACPI_PCI_ID structure.
+
+The changes to the PCI configuration space interfaces led to a
+reexamination of the complete set of address space access
+interfaces for PCI, I/O, and Memory. The previously existing 18
+interfaces have proven difficult to maintain (any small change
+must be propagated across at least 6 interfaces) and do not
+easily allow for future expansion to 64 bits if necessary. Also,
+on some systems, it would not be appropriate to demultiplex the
+access width (8, 16, 32,or 64) before calling the OSL if the
+corresponding native OS interfaces contain a similar access width
+parameter. For these reasons, the 18 address space interfaces
+have been replaced by these 6 new ones:
+
+AcpiOsReadPciConfiguration
+AcpiOsWritePciConfiguration
+AcpiOsReadMemory
+AcpiOsWriteMemory
+AcpiOsReadPort
+AcpiOsWritePort
+
+Added a new interface named AcpiOsGetRootPointer to allow the OSL
+to perform the platform and/or OS-specific actions necessary to
+obtain the ACPI RSDP table pointer. On IA-32 platforms, this
+interface will simply call down to the CA core to perform the low-
+memory search for the table. On IA-64, the RSDP is obtained from
+EFI. Migrating this interface to the OSL allows the CA core to
+remain OS and platform independent.
+
+Added a new interface named AcpiOsSignal to provide a generic
+"function code and pointer" interface for various miscellaneous
+signals and notifications that must be made to the host OS. The
+first such signals are intended to support the ASL Fatal and
+Breakpoint operators. In the latter case, the AcpiOsBreakpoint
+interface has been obsoleted.
+
+The definition of the AcpiFormatException interface has been
+changed to simplify its use. The caller no longer must supply a
+buffer to the call; A pointer to a const string is now returned
+directly. This allows the call to be easily used in printf
+statements, etc. since the caller does not have to manage a local
+buffer.
+
+
+ ASL Compiler, Version X2025:
+
+The ACPI 2.0 Switch/Case/Default operators have been implemented
+and are fully functional. They will work with all ACPI 1.0
+interpreters, since the operators are simply translated to
+If/Else pairs.
+
+The ACPI 2.0 ElseIf operator is implemented and will also work
+with 1.0 interpreters, for the same reason.
+
+Implemented support for ACPI 2.0 variable-length packages. These
+packages have a separate opcode, and their size is determined by
+the interpreter at run-time.
+
+Documentation The ACPI CA Programmer Reference has been updated
+to reflect the new interfaces and changes to existing interfaces.
+
+ ------------------------------------------
+Summary of changes for this label: 06_15_01
+
+ ACPI CA Core Subsystem:
+
+Fixed a problem where a DWORD-accessed field within a Buffer
+object would get its byte address inadvertently rounded down to
+the nearest DWORD. Buffers are always Byte-accessible.
+
+ ASL Compiler, version X2024:
+
+Fixed a problem where the Switch() operator would either fault or
+hang the compiler. Note however, that the AML code for this ACPI
+2.0 operator is not yet implemented.
+
+Compiler uses the new AcpiOsGetTimer interface to obtain compile
+timings.
+
+Implementation of the CreateField operator automatically converts
+a reference to a named field within a resource descriptor from a
+byte offset to a bit offset if required.
+
+Added some missing named fields from the resource descriptor
+support. These are the names that are automatically created by
+the compiler to reference fields within a descriptor. They are
+only valid at compile time and are not passed through to the AML
+interpreter.
+
+Resource descriptor named fields are now typed as Integers and
+subject to compile-time typechecking when used in expressions.
+
+ ------------------------------------------
+Summary of changes for this label: 05_18_01
+
+ ACPI CA Core Subsystem:
+
+Fixed a couple of problems in the Field support code where bits
+from adjacent fields could be returned along with the proper
+field bits. Restructured the field support code to improve
+performance, readability and maintainability.
+
+New DEBUG_PRINTP macro automatically inserts the procedure name
+into the output, saving hundreds of copies of procedure name
+strings within the source, shrinking the memory footprint of the
+debug version of the core subsystem.
+
+ Source Code Structure:
+
+The source code directory tree was restructured to reflect the
+current organization of the component architecture. Some files
+and directories have been moved and/or renamed.
+
+ Linux:
+
+Fixed leaking kacpidpc processes.
+
+Fixed queueing event data even when /proc/acpi/event is not
+opened.
+
+ ASL Compiler, version X2020:
+
+Memory allocation performance enhancement - over 24X compile time
+improvement on large ASL files. Parse nodes and namestring
+buffers are now allocated from a large internal compiler buffer.
+
+The temporary .SRC file is deleted unless the "-s" option is
+specified
+
+The "-d" debug output option now sends all output to the .DBG
+file instead of the console.
+
+"External" second parameter is now optional
+
+"ElseIf" syntax now properly allows the predicate
+
+Last operand to "Load" now recognized as a Target operand
+
+Debug object can now be used anywhere as a normal object.
+
+ResourceTemplate now returns an object of type BUFFER
+
+EISAID now returns an object of type INTEGER
+
+"Index" now works with a STRING operand
+
+"LoadTable" now accepts optional parameters
+
+"ToString" length parameter is now optional
+
+"Interrupt (ResourceType," parse error fixed.
+
+"Register" with a user-defined region space parse error fixed
+
+Escaped backslash at the end of a string ("\\") scan/parse error
+fixed
+
+"Revision" is now an object of type INTEGER.
+
+
+
+------------------------------------------
+Summary of changes for this label: 05_02_01
+
+Linux:
+
+/proc/acpi/event now blocks properly.
+
+Removed /proc/sys/acpi. You can still dump your DSDT from
+/proc/acpi/dsdt.
+
+ ACPI CA Core Subsystem:
+
+Fixed a problem introduced in the previous label where some of
+the "small" resource descriptor types were not recognized.
+
+Improved error messages for the case where an ASL Field is
+outside the range of the parent operation region.
+
+ ASL Compiler, version X2018:
+
+Added error detection for ASL Fields that extend beyond the
+length of the parent operation region (only if the length of the
+region is known at compile time.) This includes fields that have
+a minimum access width that is smaller than the parent region,
+and individual field units that are partially or entirely beyond
+the extent of the parent.
+
+
+
+------------------------------------------
+Summary of changes for this label: 04_27_01
+
+ ACPI CA Core Subsystem:
+
+Fixed a problem where the namespace mutex could be released at
+the wrong time during execution of AcpiRemoveAddressSpaceHandler.
+
+Added optional thread ID output for debug traces, to simplify
+debugging of multiple threads. Added context switch notification
+when the debug code realizes that a different thread is now
+executing ACPI code.
+
+Some additional external data types have been prefixed with the
+string "ACPI_" for consistency. This may effect existing code.
+The data types affected are the external callback typedefs -
+e.g., WALK_CALLBACK becomes ACPI_WALK_CALLBACK.
+
+ Linux:
+
+Fixed an issue with the OSL semaphore implementation where a
+thread was waking up with an error from receiving a SIGCHLD
+signal.
+
+Linux version of ACPI CA now uses the system C library for string
+manipulation routines instead of a local implementation.
+
+Cleaned up comments and removed TBDs.
+
+ ASL Compiler, version X2017:
+
+Enhanced error detection and reporting for all file I/O
+operations.
+
+ Documentation:
+
+Programmer Reference updated to version 1.06.
+
+
+
+------------------------------------------
+Summary of changes for this label: 04_13_01
+
+ ACPI CA Core Subsystem:
+
+Restructured support for BufferFields and RegionFields.
+BankFields support is now fully operational. All known 32-bit
+limitations on field sizes have been removed. Both BufferFields
+and (Operation) RegionFields are now supported by the same field
+management code.
+
+Resource support now supports QWORD address and IO resources. The
+16/32/64 bit address structures and the Extended IRQ structure
+have been changed to properly handle Source Resource strings.
+
+A ThreadId of -1 is now used to indicate a "mutex not acquired"
+condition internally and must never be returned by
+AcpiOsThreadId. This reserved value was changed from 0 since Unix
+systems allow a thread ID of 0.
+
+Linux:
+
+Driver code reorganized to enhance portability
+
+Added a kernel configuration option to control ACPI_DEBUG
+
+Fixed the EC driver to honor _GLK.
+
+ASL Compiler, version X2016:
+
+Fixed support for the "FixedHw" keyword. Previously, the FixedHw
+address space was set to 0, not 0x7f as it should be.
+
+ ------------------------------------------
+Summary of changes for this label: 03_13_01
+
+ ACPI CA Core Subsystem:
+
+During ACPI initialization, the _SB_._INI method is now run if
+present.
+
+Notify handler fix - notifies are deferred until the parent
+method completes execution. This fixes the "mutex already
+acquired" issue seen occasionally.
+
+Part of the "implicit conversion" rules in ACPI 2.0 have been
+found to cause compatibility problems with existing ASL/AML. The
+convert "result-to-target-type" implementation has been removed
+for stores to method Args and Locals. Source operand conversion
+is still fully implemented. Possible changes to ACPI 2.0
+specification pending.
+
+Fix to AcpiRsCalculatePciRoutingTableLength to return correct
+length.
+
+Fix for compiler warnings for 64-bit compiles.
+
+ Linux:
+
+/proc output aligned for easier parsing.
+
+Release-version compile problem fixed.
+
+New kernel configuration options documented in Configure.help.
+
+IBM 600E - Fixed Sleep button may generate "Invalid <NULL>
+context" message.
+
+ OSPM:
+
+Power resource driver integrated with bus manager.
+
+Fixed kernel fault during active cooling for thermal zones.
+
+Source Code:
+
+The source code tree has been restructured.
+
+
+
+------------------------------------------
+Summary of changes for this label: 03_02_01
+
+ Linux OS Services Layer (OSL):
+
+Major revision of all Linux-specific code.
+
+Modularized all ACPI-specific drivers.
+
+Added new thermal zone and power resource drivers.
+
+Revamped /proc interface (new functionality is under /proc/acpi).
+
+New kernel configuration options.
+
+ Linux known issues:
+
+New kernel configuration options not documented in Configure.help
+yet.
+
+
+Module dependencies not currently implemented. If used, they
+should be loaded in this order: busmgr, power, ec, system,
+processor, battery, ac_adapter, button, thermal.
+
+Modules will not load if CONFIG_MODVERSION is set.
+
+IBM 600E - entering S5 may reboot instead of shutting down.
+
+IBM 600E - Sleep button may generate "Invalid <NULL> context"
+message.
+
+Some systems may fail with "execution mutex already acquired"
+message.
+
+ ACPI CA Core Subsystem:
+
+Added a new OSL Interface, AcpiOsGetThreadId. This was required
+for the deadlock detection code. Defined to return a non-zero,
+32-bit thread ID for the currently executing thread. May be a
+non-zero constant integer on single-thread systems.
+
+Implemented deadlock detection for internal subsystem mutexes.
+We may add conditional compilation for this code (debug only)
+later.
+
+ASL/AML Mutex object semantics are now fully supported. This
+includes multiple acquires/releases by owner and support for the
+Mutex SyncLevel parameter.
+
+A new "Force Release" mechanism automatically frees all ASL
+Mutexes that have been acquired but not released when a thread
+exits the interpreter. This forces conformance to the ACPI spec
+("All mutexes must be released when an invocation exits") and
+prevents deadlocked ASL threads. This mechanism can be expanded
+(later) to monitor other resource acquisitions if OEM ASL code
+continues to misbehave (which it will).
+
+Several new ACPI exception codes have been added for the Mutex
+support.
+
+Recursive method calls are now allowed and supported (the ACPI
+spec does in fact allow recursive method calls.) The number of
+recursive calls is subject to the restrictions imposed by the
+SERIALIZED method keyword and SyncLevel (ACPI 2.0) method
+parameter.
+
+Implemented support for the SyncLevel parameter for control
+methods (ACPI 2.0 feature)
+
+Fixed a deadlock problem when multiple threads attempted to use
+the interpreter.
+
+Fixed a problem where the string length of a String package
+element was not always set in a package returned from
+AcpiEvaluateObject.
+
+Fixed a problem where the length of a String package element was
+not always included in the length of the overall package returned
+from AcpiEvaluateObject.
+
+Added external interfaces (Acpi*) to the ACPI debug memory
+manager. This manager keeps a list of all outstanding
+allocations, and can therefore detect memory leaks and attempts
+to free memory blocks more than once. Useful for code such as the
+power manager, etc. May not be appropriate for device drivers.
+Performance with the debug code enabled is slow.
+
+The ACPI Global Lock is now an optional hardware element.
+
+ ASL Compiler Version X2015:
+
+Integrated changes to allow the compiler to be generated on
+multiple platforms.
+
+Linux makefile added to generate the compiler on Linux
+
+ Source Code:
+
+All platform-specific headers have been moved to their own
+subdirectory, Include/Platform.
+
+New source file added, Interpreter/ammutex.c
+
+New header file, Include/acstruct.h
+
+ Documentation:
+
+The programmer reference has been updated for the following new
+interfaces: AcpiOsGetThreadId AcpiAllocate AcpiCallocate AcpiFree
+
+ ------------------------------------------
+Summary of changes for this label: 02_08_01
+
+Core ACPI CA Subsystem: Fixed a problem where an error was
+incorrectly returned if the return resource buffer was larger
+than the actual data (in the resource interfaces).
+
+References to named objects within packages are resolved to the
+full pathname string before packages are returned directly (via
+the AcpiEvaluateObject interface) or indirectly via the resource
+interfaces.
+
+Linux OS Services Layer (OSL):
+
+Improved /proc battery interface.
+
+
+Added C-state debugging output and other miscellaneous fixes.
+
+ASL Compiler Version X2014:
+
+All defined method arguments can now be used as local variables,
+including the ones that are not actually passed in as parameters.
+The compiler tracks initialization of the arguments and issues an
+exception if they are used without prior assignment (just like
+locals).
+
+The -o option now specifies a filename prefix that is used for
+all output files, including the AML output file. Otherwise, the
+default behavior is as follows: 1) the AML goes to the file
+specified in the DSDT. 2) all other output files use the input
+source filename as the base.
+
+ ------------------------------------------
+Summary of changes for this label: 01_25_01
+
+Core ACPI CA Subsystem: Restructured the implementation of object
+store support within the interpreter. This includes support for
+the Store operator as well as any ASL operators that include a
+target operand.
+
+Partially implemented support for Implicit Result-to-Target
+conversion. This is when a result object is converted on the fly
+to the type of an existing target object. Completion of this
+support is pending further analysis of the ACPI specification
+concerning this matter.
+
+CPU-specific code has been removed from the subsystem (hardware
+directory).
+
+New Power Management Timer functions added
+
+Linux OS Services Layer (OSL): Moved system state transition code
+to the core, fixed it, and modified Linux OSL accordingly.
+
+Fixed C2 and C3 latency calculations.
+
+
+We no longer use the compilation date for the version message on
+initialization, but retrieve the version from
+AcpiGetSystemInfo().
+
+Incorporated for fix Sony VAIO machines.
+
+Documentation: The Programmer Reference has been updated and
+reformatted.
+
+
+ASL Compiler: Version X2013: Fixed a problem where the line
+numbering and error reporting could get out of sync in the
+presence of multiple include files.
+
+ ------------------------------------------
+Summary of changes for this label: 01_15_01
+
+Core ACPI CA Subsystem:
+
+Implemented support for type conversions in the execution of the
+ASL Concatenate operator (The second operand is converted to
+match the type of the first operand before concatenation.)
+
+Support for implicit source operand conversion is partially
+implemented. The ASL source operand types Integer, Buffer, and
+String are freely interchangeable for most ASL operators and are
+converted by the interpreter on the fly as required. Implicit
+Target operand conversion (where the result is converted to the
+target type before storing) is not yet implemented.
+
+Support for 32-bit and 64-bit BCD integers is implemented.
+
+Problem fixed where a field read on an aligned field could cause
+a read past the end of the field.
+
+New exception, AE_AML_NO_RETURN_VALUE, is returned when a method
+does not return a value, but the caller expects one. (The ASL
+compiler flags this as a warning.)
+
+ASL Compiler:
+
+Version X2011:
+1. Static typechecking of all operands is implemented. This
+prevents the use of invalid objects (such as using a Package
+where an Integer is required) at compile time instead of at
+interpreter run-time.
+2. The ASL source line is printed with ALL errors and warnings.
+3. Bug fix for source EOF without final linefeed.
+4. Debug option is split into a parse trace and a namespace
+trace.
+5. Namespace output option (-n) includes initial values for
+integers and strings.
+6. Parse-only option added for quick syntax checking.
+7. Compiler checks for duplicate ACPI name declarations
+
+Version X2012:
+1. Relaxed typechecking to allow interchangeability between
+strings, integers, and buffers. These types are now converted by
+the interpreter at runtime.
+2. Compiler reports time taken by each internal subsystem in the
+debug output file.
+
+
+ ------------------------------------------
+Summary of changes for this label: 12_14_00
+
+ASL Compiler:
+
+This is the first official release of the compiler. Since the
+compiler requires elements of the Core Subsystem, this label
+synchronizes everything.
+
+------------------------------------------
+Summary of changes for this label: 12_08_00
+
+
+Fixed a problem where named references within the ASL definition
+of both OperationRegions and CreateXXXFields did not work
+properly. The symptom was an AE_AML_OPERAND_TYPE during
+initialization of the region/field. This is similar (but not
+related internally) to the problem that was fixed in the last
+label.
+
+Implemented both 32-bit and 64-bit support for the BCD ASL
+functions ToBCD and FromBCD.
+
+Updated all legal headers to include "2000" in the copyright
+years.
+
+ ------------------------------------------
+Summary of changes for this label: 12_01_00
+
+Fixed a problem where method invocations within the ASL
+definition of both OperationRegions and CreateXXXFields did not
+work properly. The symptom was an AE_AML_OPERAND_TYPE during
+initialization of the region/field:
+
+ nsinit-0209: AE_AML_OPERAND_TYPE while getting region arguments
+[DEBG] ammonad-0284: Exec_monadic2_r/Not: bad operand(s)
+(0x3005)
+
+Fixed a problem where operators with more than one nested
+subexpression would fail. The symptoms were varied, by mostly
+AE_AML_OPERAND_TYPE errors. This was actually a rather serious
+problem that has gone unnoticed until now.
+
+ Subtract (Add (1,2), Multiply (3,4))
+
+Fixed a problem where AcpiGetHandle didn't quite get fixed in the
+previous build (The prefix part of a relative path was handled
+incorrectly).
+
+Fixed a problem where Operation Region initialization failed if
+the operation region name was a "namepath" instead of a simple
+"nameseg". Symptom was an AE_NO_OPERAND error.
+
+Fixed a problem where an assignment to a local variable via the
+indirect RefOf mechanism only worked for the first such
+assignment. Subsequent assignments were ignored.
+
+ ------------------------------------------
+Summary of changes for this label: 11_15_00
+
+ACPI 2.0 table support with backwards support for ACPI 1.0 and
+the 0.71 extensions. Note: although we can read ACPI 2.0 BIOS
+tables, the AML interpreter does NOT have support for the new
+2.0 ASL grammar terms at this time.
+
+All ACPI hardware access is via the GAS structures in the ACPI
+2.0 FADT.
+
+All physical memory addresses across all platforms are now 64
+bits wide. Logical address width remains dependent on the
+platform (i.e., "void *").
+
+AcpiOsMapMemory interface changed to a 64-bit physical address.
+
+The AML interpreter integer size is now 64 bits, as per the ACPI
+2.0 specification.
+
+For backwards compatibility with ACPI 1.0, ACPI tables with a
+revision number less than 2 use 32-bit integers only.
+
+Fixed a problem where the evaluation of OpRegion operands did not
+always resolve them to numbers properly.
+
+------------------------------------------
+Summary of changes for this label: 10_20_00
+
+Fix for CBN_._STA issue. This fix will allow correct access to
+CBN_ OpRegions when the _STA returns 0x8.
+
+Support to convert ACPI constants (Ones, Zeros, One) to actual
+values before a package object is returned
+
+Fix for method call as predicate to if/while construct causing
+incorrect if/while behavior
+
+Fix for Else block package lengths sometimes calculated wrong (if
+block > 63 bytes)
+
+Fix for Processor object length field, was always zero
+
+Table load abort if FACP sanity check fails
+
+Fix for problem with Scope(name) if name already exists
+
+Warning emitted if a named object referenced cannot be found
+(resolved) during method execution.
+
+
+
+
+
+------------------------------------------
+Summary of changes for this label: 9_29_00
+
+New table initialization interfaces: AcpiInitializeSubsystem no
+longer has any parameters AcpiFindRootPointer - Find the RSDP (if
+necessary) AcpiLoadTables (RSDP) - load all tables found at RSDP-
+>RSDT Obsolete Interfaces AcpiLoadFirmwareTables - replaced by
+AcpiLoadTables
+
+Note: These interface changes require changes to all existing
+OSDs
+
+The PCI_Config default address space handler is always installed
+at the root namespace object.
+
+-------------------------------------------
+Summary of changes for this label: 09_15_00
+
+The new initialization architecture is implemented. New
+interfaces are: AcpiInitializeSubsystem (replaces AcpiInitialize)
+AcpiEnableSubsystem Obsolete Interfaces: AcpiLoadNamespace
+(Namespace is automatically loaded when a table is loaded)
+
+The ACPI_OPERAND_OBJECT has been optimized to shrink its size
+from 52 bytes to 32 bytes. There is usually one of these for
+every namespace object, so the memory savings is significant.
+
+Implemented just-in-time evaluation of the CreateField operators.
+
+Bug fixes for IA-64 support have been integrated.
+
+Additional code review comments have been implemented
+
+The so-called "third pass parse" has been replaced by a final
+walk through the namespace to initialize all operation regions
+(address spaces) and fields that have not yet been initialized
+during the execution of the various _INI and REG methods.
+
+New file - namespace/nsinit.c
+
+-------------------------------------------
+Summary of changes for this label: 09_01_00
+
+Namespace manager data structures have been reworked to change
+the primary object from a table to a single object. This has
+resulted in dynamic memory savings of 3X within the namespace
+and 2X overall in the ACPI CA subsystem.
+
+Fixed problem where the call to AcpiEvFindPciRootBuses was
+inadvertently left commented out.
+
+Reduced the warning count when generating the source with the GCC
+compiler.
+
+Revision numbers added to each module header showing the
+SourceSafe version of the file. Please refer to this version
+number when giving us feedback or comments on individual modules.
+
+The main object types within the subsystem have been renamed to
+clarify their purpose:
+
+ACPI_INTERNAL_OBJECT -> ACPI_OPERAND_OBJECT
+ACPI_GENERIC_OP -> ACPI_PARSE_OBJECT
+ACPI_NAME_TABLE_ENTRY -> ACPI_NAMESPACE_NODE
+
+NOTE: no changes to the initialization sequence are included in
+this label.
+
+-------------------------------------------
+Summary of changes for this label: 08_23_00
+
+Fixed problem where TerminateControlMethod was being called
+multiple times per method
+
+Fixed debugger problem where single stepping caused a semaphore
+to be oversignalled
+
+Improved performance through additional parse object caching -
+added ACPI_EXTENDED_OP type
+
+-------------------------------------------
+Summary of changes for this label: 08_10_00
+
+Parser/Interpreter integration: Eliminated the creation of
+complete parse trees for ACPI tables and control methods.
+Instead, parse subtrees are created and then deleted as soon as
+they are processed (Either entered into the namespace or
+executed by the interpreter). This reduces the use of dynamic
+kernel memory significantly. (about 10X)
+
+Exception codes broken into classes and renumbered. Be sure to
+recompile all code that includes acexcep.h. Hopefully we won't
+have to renumber the codes again now that they are split into
+classes (environment, programmer, AML code, ACPI table, and
+internal).
+
+Fixed some additional alignment issues in the Resource Manager
+subcomponent
+
+Implemented semaphore tracking in the AcpiExec utility, and fixed
+several places where mutexes/semaphores were being unlocked
+without a corresponding lock operation. There are no known
+semaphore or mutex "leaks" at this time.
+
+Fixed the case where an ASL Return operator is used to return an
+unnamed package.
+
+-------------------------------------------
+Summary of changes for this label: 07_28_00
+
+Fixed a problem with the way addresses were calculated in
+AcpiAmlReadFieldData() and AcpiAmlWriteFieldData(). This problem
+manifested itself when a Field was created with WordAccess or
+DwordAccess, but the field unit defined within the Field was
+less than a Word or Dword.
+
+Fixed a problem in AmlDumpOperands() module's loop to pull
+operands off of the operand stack to display information. The
+problem manifested itself as a TLB error on 64-bit systems when
+accessing an operand stack with two or more operands.
+
+Fixed a problem with the PCI configuration space handlers where
+context was getting confused between accesses. This required a
+change to the generic address space handler and address space
+setup definitions. Handlers now get both a global handler
+context (this is the one passed in by the user when executing
+AcpiInstallAddressSpaceHandler() and a specific region context
+that is unique to each region (For example, the _ADR, _SEG and
+_BBN values associated with a specific region). The generic
+function definitions have changed to the following:
+
+typedef ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( UINT32 Function,
+UINT32 Address, UINT32 BitWidth, UINT32 *Value, void
+*HandlerContext, // This used to be void *Context void
+*RegionContext); // This is an additional parameter
+
+typedef ACPI_STATUS (*ADDRESS_SPACE_SETUP) ( ACPI_HANDLE
+RegionHandle, UINT32 Function, void *HandlerContext, void
+**RegionContext); // This used to be **ReturnContext
+
+-------------------------------------------
+Summary of changes for this label: 07_21_00
+
+Major file consolidation and rename. All files within the
+interpreter have been renamed as well as most header files.
+This was done to prevent collisions with existing files in the
+host OSs -- filenames such as "config.h" and "global.h" seem to
+be quite common. The VC project files have been updated. All
+makefiles will require modification.
+
+The parser/interpreter integration continues in Phase 5 with the
+implementation of a complete 2-pass parse (the AML is parsed
+twice) for each table; This avoids the construction of a huge
+parse tree and therefore reduces the amount of dynamic memory
+required by the subsystem. Greater use of the parse object cache
+means that performance is unaffected.
+
+Many comments from the two code reviews have been rolled in.
+
+The 64-bit alignment support is complete.
+
+-------------------------------------------
+Summary of changes for this label: 06_30_00
+
+With a nod and a tip of the hat to the technology of yesteryear,
+we've added support in the source code for 80 column output
+devices. The code is now mostly constrained to 80 columns or
+less to support environments and editors that 1) cannot display
+or print more than 80 characters on a single line, and 2) cannot
+disable line wrapping.
+
+A major restructuring of the namespace data structure has been
+completed. The result is 1) cleaner and more
+understandable/maintainable code, and 2) a significant reduction
+in the dynamic memory requirement for each named ACPI object
+(almost half).
+
+-------------------------------------------
+Summary of changes for this label: 06_23_00
+
+Linux support has been added. In order to obtain approval to get
+the ACPI CA subsystem into the Linux kernel, we've had to make
+quite a few changes to the base subsystem that will affect all
+users (all the changes are generic and OS- independent). The
+effects of these global changes have been somewhat far reaching.
+Files have been merged and/or renamed and interfaces have been
+renamed. The major changes are described below.
+
+Osd* interfaces renamed to AcpiOs* to eliminate namespace
+pollution/confusion within our target kernels. All OSD
+interfaces must be modified to match the new naming convention.
+
+Files merged across the subsystem. A number of the smaller
+source and header files have been merged to reduce the file
+count and increase the density of the existing files. There are
+too many to list here. In general, makefiles that call out
+individual files will require rebuilding.
+
+Interpreter files renamed. All interpreter files now have the
+prefix am* instead of ie* and is*.
+
+Header files renamed: The acapi.h file is now acpixf.h. The
+acpiosd.h file is now acpiosxf.h. We are removing references to
+the acronym "API" since it is somewhat windowsy. The new name is
+"external interface" or xface or xf in the filenames.j
+
+
+All manifest constants have been forced to upper case (some were
+mixed case.) Also, the string "ACPI_" has been prepended to
+many (not all) of the constants, typedefs, and structs.
+
+The globals "DebugLevel" and "DebugLayer" have been renamed
+"AcpiDbgLevel" and "AcpiDbgLayer" respectively.
+
+All other globals within the subsystem are now prefixed with
+"AcpiGbl_" Internal procedures within the subsystem are now
+prefixed with "Acpi" (with only a few exceptions). The original
+two-letter abbreviation for the subcomponent remains after
+"Acpi" - for example, CmCallocate became AcpiCmCallocate.
+
+Added a source code translation/conversion utility. Used to
+generate the Linux source code, it can be modified to generate
+other types of source as well. Can also be used to cleanup
+existing source by removing extraneous spaces and blank lines.
+Found in tools/acpisrc/*
+
+OsdUnMapMemory was renamed to OsdUnmapMemory and then
+AcpiOsUnmapMemory. (UnMap became Unmap).
+
+A "MaxUnits" parameter has been added to AcpiOsCreateSemaphore.
+When set to one, this indicates that the caller wants to use the
+semaphore as a mutex, not a counting semaphore. ACPI CA uses
+both types. However, implementers of this call may want to use
+different OS primitives depending on the type of semaphore
+requested. For example, some operating systems provide separate
+"mutex" and "semaphore" interfaces - where the mutex interface
+is much faster because it doesn't have all the overhead of a
+full semaphore implementation.
+
+Fixed a deadlock problem where a method that accesses the PCI
+address space can block forever if it is the first access to the
+space.
+
+-------------------------------------------
+Summary of changes for this label: 06_02_00
+
+Support for environments that cannot handle unaligned data
+accesses (e.g. firmware and OS environments devoid of alignment
+handler technology namely SAL/EFI and the IA-64 Linux kernel)
+has been added (via configurable macros) in these three areas: -
+Transfer of data from the raw AML byte stream is done via byte
+moves instead of word/dword/qword moves. - External objects
+are aligned within the user buffer, including package elements
+(sub-objects). - Conversion of name strings to UINT32 Acpi Names
+is now done byte-wise.
+
+The Store operator was modified to mimic Microsoft's
+implementation when storing to a Buffer Field.
+
+Added a check of the BM_STS bit before entering C3.
+
+The methods subdirectory has been obsoleted and removed. A new
+file, cmeval.c subsumes the functionality.
+
+A 16-bit (DOS) version of AcpiExec has been developed. The
+makefile is under the acpiexec directory.
diff --git a/sys/contrib/dev/acpica/acapps.h b/sys/contrib/dev/acpica/acapps.h
new file mode 100644
index 0000000..154593f
--- /dev/null
+++ b/sys/contrib/dev/acpica/acapps.h
@@ -0,0 +1,192 @@
+/******************************************************************************
+ *
+ * Module Name: acapps - common include for ACPI applications/tools
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef _ACAPPS
+#define _ACAPPS
+
+
+#ifdef _MSC_VER /* disable some level-4 warnings */
+#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
+#endif
+
+extern UINT8 *DsdtPtr;
+extern UINT32 AcpiDsdtLength;
+extern UINT8 *AmlStart;
+extern UINT32 AmlLength;
+
+
+extern int AcpiGbl_Optind;
+extern char *AcpiGbl_Optarg;
+
+int
+AcpiGetopt(
+ int argc,
+ char **argv,
+ char *opts);
+
+ACPI_STATUS
+AdInitialize (
+ void);
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix);
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename);
+
+ACPI_STATUS
+AdAmlDisassemble (
+ BOOLEAN OutToFile,
+ char *Filename,
+ char *Prefix,
+ char **OutFilename,
+ BOOLEAN GetAllTables);
+
+void
+AdPrintStatistics (void);
+
+ACPI_STATUS
+AdFindDsdt(
+ UINT8 **DsdtPtr,
+ UINT32 *DsdtLength);
+
+void
+AdDumpTables (void);
+
+ACPI_STATUS
+AdGetLocalTables (
+ char *Filename,
+ BOOLEAN GetAllTables);
+
+ACPI_STATUS
+AdParseTable (
+ ACPI_TABLE_HEADER *Table);
+
+ACPI_STATUS
+AdDisplayTables (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table);
+
+ACPI_STATUS
+AdDisplayStatistics (void);
+
+
+#endif /* _ACAPPS */
+
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h
new file mode 100644
index 0000000..bba73c6
--- /dev/null
+++ b/sys/contrib/dev/acpica/acconfig.h
@@ -0,0 +1,275 @@
+/******************************************************************************
+ *
+ * Name: acconfig.h - Global configuration constants
+ * $Revision: 139 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef _ACCONFIG_H
+#define _ACCONFIG_H
+
+
+/******************************************************************************
+ *
+ * Configuration options
+ *
+ *****************************************************************************/
+
+/*
+ * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
+ * ACPI subsystem. This includes the DEBUG_PRINT output
+ * statements. When disabled, all DEBUG_PRINT
+ * statements are compiled out.
+ *
+ * ACPI_APPLICATION - Use this switch if the subsystem is going to be run
+ * at the application level.
+ *
+ */
+
+/* Version string */
+
+#define ACPI_CA_VERSION 0x20030619
+
+/* Maximum objects in the various object caches */
+
+#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
+#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
+#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
+
+/*
+ * Should the subystem abort the loading of an ACPI table if the
+ * table checksum is incorrect?
+ */
+#define ACPI_CHECKSUM_ABORT FALSE
+
+
+/******************************************************************************
+ *
+ * Subsystem Constants
+ *
+ *****************************************************************************/
+
+/* Version of ACPI supported */
+
+#define ACPI_CA_SUPPORT_LEVEL 2
+
+/* String size constants */
+
+#define ACPI_MAX_STRING_LENGTH 512
+#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
+
+/* Maximum count for a semaphore object */
+
+#define ACPI_MAX_SEMAPHORE_COUNT 256
+
+/* Max reference count (for debug only) */
+
+#define ACPI_MAX_REFERENCE_COUNT 0x400
+
+/* Size of cached memory mapping for system memory operation region */
+
+#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
+
+
+/******************************************************************************
+ *
+ * ACPI Specification constants (Do not change unless the specification changes)
+ *
+ *****************************************************************************/
+
+/* Number of distinct GPE register blocks and register width */
+
+#define ACPI_MAX_GPE_BLOCKS 2
+#define ACPI_GPE_REGISTER_WIDTH 8
+
+/*
+ * Method info (in WALK_STATE), containing local variables and argumetns
+ */
+#define ACPI_METHOD_NUM_LOCALS 8
+#define ACPI_METHOD_MAX_LOCAL 7
+
+#define ACPI_METHOD_NUM_ARGS 7
+#define ACPI_METHOD_MAX_ARG 6
+
+/* Maximum length of resulting string when converting from a buffer */
+
+#define ACPI_MAX_STRING_CONVERSION 200
+
+/* Length of _HID, _UID, and _CID values */
+
+#define ACPI_DEVICE_ID_LENGTH 0x09
+#define ACPI_MAX_CID_LENGTH 48
+
+/*
+ * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
+ */
+#define ACPI_OBJ_NUM_OPERANDS 8
+#define ACPI_OBJ_MAX_OPERAND 7
+
+/* Names within the namespace are 4 bytes long */
+
+#define ACPI_NAME_SIZE 4
+#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
+#define ACPI_PATH_SEPARATOR '.'
+
+/* Constants used in searching for the RSDP in low memory */
+
+#define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */
+#define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
+#define ACPI_LO_RSDP_WINDOW_SIZE 0x400
+#define ACPI_HI_RSDP_WINDOW_SIZE 0x20000
+#define ACPI_RSDP_SCAN_STEP 16
+
+/* Operation regions */
+
+#define ACPI_NUM_PREDEFINED_REGIONS 8
+#define ACPI_USER_REGION_BEGIN 0x80
+
+/* Maximum SpaceIds for Operation Regions */
+
+#define ACPI_MAX_ADDRESS_SPACE 255
+
+/* Array sizes. Used for range checking also */
+
+#define ACPI_NUM_ACCESS_TYPES 6
+#define ACPI_NUM_UPDATE_RULES 3
+#define ACPI_NUM_LOCK_RULES 2
+#define ACPI_NUM_MATCH_OPS 6
+#define ACPI_NUM_OPCODES 256
+#define ACPI_NUM_FIELD_NAMES 2
+
+/* RSDP checksums */
+
+#define ACPI_RSDP_CHECKSUM_LENGTH 20
+#define ACPI_RSDP_XCHECKSUM_LENGTH 36
+
+/* SMBus bidirectional buffer size */
+
+#define ACPI_SMBUS_BUFFER_SIZE 34
+
+
+/******************************************************************************
+ *
+ * ACPI AML Debugger
+ *
+ *****************************************************************************/
+
+#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
+
+#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
+#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
+
+
+#endif /* _ACCONFIG_H */
+
diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h
new file mode 100644
index 0000000..ac4bd5f
--- /dev/null
+++ b/sys/contrib/dev/acpica/acdebug.h
@@ -0,0 +1,544 @@
+/******************************************************************************
+ *
+ * Name: acdebug.h - ACPI/AML debugger
+ * $Revision: 72 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACDEBUG_H__
+#define __ACDEBUG_H__
+
+
+#define ACPI_DEBUG_BUFFER_SIZE 4196
+
+typedef struct CommandInfo
+{
+ char *Name; /* Command Name */
+ UINT8 MinArgs; /* Minimum arguments required */
+
+} COMMAND_INFO;
+
+
+typedef struct ArgumentInfo
+{
+ char *Name; /* Argument Name */
+
+} ARGUMENT_INFO;
+
+
+#define PARAM_LIST(pl) pl
+
+#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_verbose)
+
+#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
+ AcpiOsPrintf PARAM_LIST(fp);}
+
+#define EX_NO_SINGLE_STEP 1
+#define EX_SINGLE_STEP 2
+
+
+/* Prototypes */
+
+
+/*
+ * dbxface - external debugger interfaces
+ */
+
+ACPI_STATUS
+AcpiDbInitialize (
+ void);
+
+void
+AcpiDbTerminate (
+ void);
+
+ACPI_STATUS
+AcpiDbSingleStep (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 OpType);
+
+ACPI_STATUS
+AcpiDbStartCommand (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbMethodEnd (
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * dbcmds - debug commands and output routines
+ */
+
+void
+AcpiDbDisplayTableInfo (
+ char *TableArg);
+
+void
+AcpiDbUnloadAcpiTable (
+ char *TableArg,
+ char *InstanceArg);
+
+void
+AcpiDbSetMethodBreakpoint (
+ char *Location,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbSetMethodCallBreakpoint (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbDisassembleAml (
+ char *Statements,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbDumpNamespace (
+ char *StartArg,
+ char *DepthArg);
+
+void
+AcpiDbDumpNamespaceByOwner (
+ char *OwnerArg,
+ char *DepthArg);
+
+void
+AcpiDbSendNotify (
+ char *Name,
+ UINT32 Value);
+
+void
+AcpiDbSetMethodData (
+ char *TypeArg,
+ char *IndexArg,
+ char *ValueArg);
+
+ACPI_STATUS
+AcpiDbDisplayObjects (
+ char *ObjTypeArg,
+ char *DisplayCountArg);
+
+ACPI_STATUS
+AcpiDbFindNameInNamespace (
+ char *NameArg);
+
+void
+AcpiDbSetScope (
+ char *Name);
+
+void
+AcpiDbFindReferences (
+ char *ObjectArg);
+
+void
+AcpiDbDisplayLocks (void);
+
+
+void
+AcpiDbDisplayResources (
+ char *ObjectArg);
+
+void
+AcpiDbDisplayGpes (void);
+
+void
+AcpiDbCheckIntegrity (
+ void);
+
+ACPI_STATUS
+AcpiDbIntegrityWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiDbWalkAndMatchName (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiDbWalkForReferences (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiDbWalkForSpecificObjects (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+void
+AcpiDbGenerateGpe (
+ char *GpeArg,
+ char *BlockArg);
+
+/*
+ * dbdisply - debug display commands
+ */
+
+void
+AcpiDbDisplayMethodInfo (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbDecodeAndDisplayObject (
+ char *Target,
+ char *OutputType);
+
+void
+AcpiDbDisplayResultObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDbDisplayAllMethods (
+ char *DisplayCountArg);
+
+void
+AcpiDbDisplayArguments (
+ void);
+
+void
+AcpiDbDisplayLocals (
+ void);
+
+void
+AcpiDbDisplayResults (
+ void);
+
+void
+AcpiDbDisplayCallingTree (
+ void);
+
+void
+AcpiDbDisplayObjectType (
+ char *ObjectArg);
+
+void
+AcpiDbDisplayArgumentObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDbDumpParserDescriptor (
+ ACPI_PARSE_OBJECT *Op);
+
+void *
+AcpiDbGetPointer (
+ void *Target);
+
+
+/*
+ * dbexec - debugger control method execution
+ */
+
+void
+AcpiDbExecute (
+ char *Name,
+ char **Args,
+ UINT32 Flags);
+
+void
+AcpiDbCreateExecutionThreads (
+ char *NumThreadsArg,
+ char *NumLoopsArg,
+ char *MethodNameArg);
+
+ACPI_STATUS
+AcpiDbExecuteMethod (
+ ACPI_DB_METHOD_INFO *Info,
+ ACPI_BUFFER *ReturnObj);
+
+void
+AcpiDbExecuteSetup (
+ ACPI_DB_METHOD_INFO *Info);
+
+UINT32
+AcpiDbGetOutstandingAllocations (
+ void);
+
+void ACPI_SYSTEM_XFACE
+AcpiDbMethodThread (
+ void *Context);
+
+ACPI_STATUS
+AcpiDbExecutionWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+
+/*
+ * dbfileio - Debugger file I/O commands
+ */
+
+ACPI_OBJECT_TYPE
+AcpiDbMatchArgument (
+ char *UserArgument,
+ ARGUMENT_INFO *Arguments);
+
+ACPI_STATUS
+AeLocalLoadTable (
+ ACPI_TABLE_HEADER *TablePtr);
+
+void
+AcpiDbCloseDebugFile (
+ void);
+
+void
+AcpiDbOpenDebugFile (
+ char *Name);
+
+ACPI_STATUS
+AcpiDbLoadAcpiTable (
+ char *Filename);
+
+ACPI_STATUS
+AcpiDbGetTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table);
+
+ACPI_STATUS
+AcpiDbReadTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table);
+
+/*
+ * dbhistry - debugger HISTORY command
+ */
+
+void
+AcpiDbAddToHistory (
+ char *CommandLine);
+
+void
+AcpiDbDisplayHistory (void);
+
+char *
+AcpiDbGetFromHistory (
+ char *CommandNumArg);
+
+
+/*
+ * dbinput - user front-end to the AML debugger
+ */
+
+ACPI_STATUS
+AcpiDbCommandDispatch (
+ char *InputBuffer,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+void ACPI_SYSTEM_XFACE
+AcpiDbExecuteThread (
+ void *Context);
+
+ACPI_STATUS
+AcpiDbUserCommands (
+ char Prompt,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbDisplayHelp (
+ char *HelpType);
+
+char *
+AcpiDbGetNextToken (
+ char *String,
+ char **Next);
+
+UINT32
+AcpiDbGetLine (
+ char *InputBuffer);
+
+UINT32
+AcpiDbMatchCommand (
+ char *UserCommand);
+
+void
+AcpiDbSingleThread (
+ void);
+
+
+/*
+ * dbstats - Generation and display of ACPI table statistics
+ */
+
+void
+AcpiDbGenerateStatistics (
+ ACPI_PARSE_OBJECT *Root,
+ BOOLEAN IsMethod);
+
+
+ACPI_STATUS
+AcpiDbDisplayStatistics (
+ char *TypeArg);
+
+ACPI_STATUS
+AcpiDbClassifyOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+void
+AcpiDbCountNamespaceObjects (
+ void);
+
+void
+AcpiDbEnumerateObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+
+/*
+ * dbutils - AML debugger utilities
+ */
+
+void
+AcpiDbSetOutputDestination (
+ UINT32 Where);
+
+void
+AcpiDbDumpBuffer (
+ UINT32 Address);
+
+void
+AcpiDbDumpObject (
+ ACPI_OBJECT *ObjDesc,
+ UINT32 Level);
+
+void
+AcpiDbPrepNamestring (
+ char *Name);
+
+
+ACPI_STATUS
+AcpiDbSecondPassParse (
+ ACPI_PARSE_OBJECT *Root);
+
+ACPI_NAMESPACE_NODE *
+AcpiDbLocalNsLookup (
+ char *Name);
+
+
+#endif /* __ACDEBUG_H__ */
diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/acdisasm.h
new file mode 100644
index 0000000..801e6d6
--- /dev/null
+++ b/sys/contrib/dev/acpica/acdisasm.h
@@ -0,0 +1,476 @@
+/******************************************************************************
+ *
+ * Name: acdisasm.h - AML disassembler
+ * $Revision: 9 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACDISASM_H__
+#define __ACDISASM_H__
+
+#include "amlresrc.h"
+
+
+#define BLOCK_NONE 0
+#define BLOCK_PAREN 1
+#define BLOCK_BRACE 2
+#define BLOCK_COMMA_LIST 4
+
+extern const char *AcpiGbl_IoDecode[2];
+extern const char *AcpiGbl_WordDecode[4];
+extern const char *AcpiGbl_ConsumeDecode[2];
+extern const char *AcpiGbl_MinDecode[2];
+extern const char *AcpiGbl_MaxDecode[2];
+extern const char *AcpiGbl_DECDecode[2];
+extern const char *AcpiGbl_RNGDecode[4];
+extern const char *AcpiGbl_MEMDecode[4];
+extern const char *AcpiGbl_RWDecode[2];
+extern const char *AcpiGbl_IrqDecode[2];
+extern const char *AcpiGbl_HEDecode[2];
+extern const char *AcpiGbl_LLDecode[2];
+extern const char *AcpiGbl_SHRDecode[2];
+extern const char *AcpiGbl_TYPDecode[4];
+extern const char *AcpiGbl_BMDecode[2];
+extern const char *AcpiGbl_SIZDecode[4];
+extern const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES];
+extern const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES];
+extern const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES];
+extern const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS];
+
+
+typedef struct acpi_op_walk_info
+{
+ UINT32 Level;
+ UINT32 BitOffset;
+
+} ACPI_OP_WALK_INFO;
+
+typedef
+ACPI_STATUS (*ASL_WALK_CALLBACK) (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*
+ * dmwalk
+ */
+
+void
+AcpiDmWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context);
+
+ACPI_STATUS
+AcpiDmDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AcpiDmAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*
+ * dmopcode
+ */
+
+void
+AcpiDmValidateName (
+ char *Name,
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+AcpiDmDumpName (
+ char *Name);
+
+void
+AcpiDmUnicode (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmDisassemble (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Origin,
+ UINT32 NumOpcodes);
+
+void
+AcpiDmNamestring (
+ char *Name);
+
+void
+AcpiDmDisplayPath (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmDisassembleOneOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmDecodeInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+UINT32
+AcpiDmBlockType (
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+AcpiDmListType (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiPsDisplayObjectPathname (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmMethodFlags (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmFieldFlags (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmAddressSpace (
+ UINT8 SpaceId);
+
+void
+AcpiDmRegionFlags (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmMatchOp (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmMatchKeyword (
+ ACPI_PARSE_OBJECT *Op);
+
+BOOLEAN
+AcpiDmCommaIfListMember (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmCommaIfFieldMember (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * dmobject
+ */
+
+void
+AcpiDmDecodeNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+void
+AcpiDmDisplayInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDisplayArguments (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDisplayLocals (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDumpMethodInfo (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * dmbuffer
+ */
+
+void
+AcpiIsEisaId (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmEisaId (
+ UINT32 EncodedId);
+
+BOOLEAN
+AcpiDmIsUnicodeBuffer (
+ ACPI_PARSE_OBJECT *Op);
+
+BOOLEAN
+AcpiDmIsStringBuffer (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * dmresrc
+ */
+
+void
+AcpiDmDisasmByteList (
+ UINT32 Level,
+ UINT8 *ByteData,
+ UINT32 ByteCount);
+
+void
+AcpiDmByteList (
+ ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmResourceDescriptor (
+ ACPI_OP_WALK_INFO *Info,
+ UINT8 *ByteData,
+ UINT32 ByteCount);
+
+BOOLEAN
+AcpiDmIsResourceDescriptor (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmIndent (
+ UINT32 Level);
+
+void
+AcpiDmBitList (
+ UINT16 Mask);
+
+void
+AcpiDmDecodeAttribute (
+ UINT8 Attribute);
+
+/*
+ * dmresrcl
+ */
+
+void
+AcpiDmIoFlags (
+ UINT8 Flags);
+
+void
+AcpiDmMemoryFlags (
+ UINT8 Flags,
+ UINT8 SpecificFlags);
+
+void
+AcpiDmWordDescriptor (
+ ASL_WORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmDwordDescriptor (
+ ASL_DWORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmQwordDescriptor (
+ ASL_QWORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmMemory24Descriptor (
+ ASL_MEMORY_24_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmMemory32Descriptor (
+ ASL_MEMORY_32_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmFixedMem32Descriptor (
+ ASL_FIXED_MEMORY_32_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmGenericRegisterDescriptor (
+ ASL_GENERAL_REGISTER_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmInterruptDescriptor (
+ ASL_EXTENDED_XRUPT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmVendorLargeDescriptor (
+ ASL_LARGE_VENDOR_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+
+/*
+ * dmresrcs
+ */
+
+void
+AcpiDmIrqDescriptor (
+ ASL_IRQ_FORMAT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmDmaDescriptor (
+ ASL_DMA_FORMAT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmIoDescriptor (
+ ASL_IO_PORT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmFixedIoDescriptor (
+ ASL_FIXED_IO_PORT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmStartDependentDescriptor (
+ ASL_START_DEPENDENT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmEndDependentDescriptor (
+ ASL_START_DEPENDENT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmVendorSmallDescriptor (
+ ASL_SMALL_VENDOR_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+
+#endif /* __ACDISASM_H__ */
diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h
new file mode 100644
index 0000000..bd14a6a
--- /dev/null
+++ b/sys/contrib/dev/acpica/acdispat.h
@@ -0,0 +1,586 @@
+/******************************************************************************
+ *
+ * Name: acdispat.h - dispatcher (parser to interpreter interface)
+ * $Revision: 56 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef _ACDISPAT_H_
+#define _ACDISPAT_H_
+
+
+#define NAMEOF_LOCAL_NTE "__L0"
+#define NAMEOF_ARG_NTE "__A0"
+
+
+/* Common interfaces */
+
+ACPI_STATUS
+AcpiDsObjStackPush (
+ void *Object,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsObjStackPop (
+ UINT32 PopCount,
+ ACPI_WALK_STATE *WalkState);
+
+void *
+AcpiDsObjStackGetValue (
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsObjStackPopObject (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState);
+
+
+/* dsopcode - support for late evaluation */
+
+ACPI_STATUS
+AcpiDsExecuteArguments (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ScopeNode,
+ UINT32 AmlLength,
+ UINT8 *AmlStart);
+
+ACPI_STATUS
+AcpiDsGetBufferFieldArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiDsGetRegionArguments (
+ ACPI_OPERAND_OBJECT *RgnDesc);
+
+ACPI_STATUS
+AcpiDsGetBufferArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiDsGetPackageArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiDsInitBufferField (
+ UINT16 AmlOpcode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *BufferDesc,
+ ACPI_OPERAND_OBJECT *OffsetDesc,
+ ACPI_OPERAND_OBJECT *LengthDesc,
+ ACPI_OPERAND_OBJECT *ResultDesc);
+
+ACPI_STATUS
+AcpiDsEvalBufferFieldOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiDsEvalRegionOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiDsEvalDataObjectOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiDsInitializeRegion (
+ ACPI_HANDLE ObjHandle);
+
+
+/* dsctrl - Parser/Interpreter interface, control stack routines */
+
+
+ACPI_STATUS
+AcpiDsExecBeginControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiDsExecEndControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/* dsexec - Parser/Interpreter interface, method execution callbacks */
+
+
+ACPI_STATUS
+AcpiDsGetPredicateValue (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ResultObj);
+
+ACPI_STATUS
+AcpiDsExecBeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp);
+
+ACPI_STATUS
+AcpiDsExecEndOp (
+ ACPI_WALK_STATE *State);
+
+
+/* dsfield - Parser/Interpreter interface for AML fields */
+
+ACPI_STATUS
+AcpiDsGetFieldNames (
+ ACPI_CREATE_FIELD_INFO *Info,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Arg);
+
+ACPI_STATUS
+AcpiDsCreateField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsCreateBankField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsCreateIndexField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsCreateBufferField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsInitFieldObjects (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
+
+
+/* dsload - Parser/Interpreter interface, namespace load callbacks */
+
+ACPI_STATUS
+AcpiDsLoad1BeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp);
+
+ACPI_STATUS
+AcpiDsLoad1EndOp (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsLoad2BeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp);
+
+ACPI_STATUS
+AcpiDsLoad2EndOp (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsInitCallbacks (
+ ACPI_WALK_STATE *WalkState,
+ UINT32 PassNumber);
+
+
+/* dsmthdat - method data (locals/args) */
+
+
+ACPI_STATUS
+AcpiDsStoreObjectToLocal (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *SrcDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsMethodDataGetEntry (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT ***Node);
+
+void
+AcpiDsMethodDataDeleteAll (
+ ACPI_WALK_STATE *WalkState);
+
+BOOLEAN
+AcpiDsIsMethodValue (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_OBJECT_TYPE
+AcpiDsMethodDataGetType (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsMethodDataGetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **DestDesc);
+
+void
+AcpiDsMethodDataDeleteValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsMethodDataInitArgs (
+ ACPI_OPERAND_OBJECT **Params,
+ UINT32 MaxParamCount,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsMethodDataGetNode (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE **Node);
+
+void
+AcpiDsMethodDataInit (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsMethodDataSetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_WALK_STATE *WalkState);
+
+
+/* dsmethod - Parser/Interpreter interface - control method parsing */
+
+ACPI_STATUS
+AcpiDsParseMethod (
+ ACPI_HANDLE ObjHandle);
+
+ACPI_STATUS
+AcpiDsCallControlMethod (
+ ACPI_THREAD_STATE *Thread,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiDsRestartControlMethod (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ReturnDesc);
+
+ACPI_STATUS
+AcpiDsTerminateControlMethod (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsBeginMethodExecution (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_NAMESPACE_NODE *CallingMethodNode);
+
+
+/* dsobj - Parser/Interpreter interface - object initialization and conversion */
+
+ACPI_STATUS
+AcpiDsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiDsInitializeObjects (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *StartNode);
+
+ACPI_STATUS
+AcpiDsBuildInternalBufferObj (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 BufferLength,
+ ACPI_OPERAND_OBJECT **ObjDescPtr);
+
+ACPI_STATUS
+AcpiDsBuildInternalPackageObj (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *op,
+ UINT32 PackageLength,
+ ACPI_OPERAND_OBJECT **ObjDesc);
+
+ACPI_STATUS
+AcpiDsBuildInternalObject (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT **ObjDescPtr);
+
+ACPI_STATUS
+AcpiDsInitObjectFromOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT16 Opcode,
+ ACPI_OPERAND_OBJECT **ObjDesc);
+
+ACPI_STATUS
+AcpiDsCreateNode (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/* dsutils - Parser/Interpreter interface utility routines */
+
+BOOLEAN
+AcpiDsIsResultUsed (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDsDeleteResultIfNotUsed (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT *ResultObj,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsCreateOperand (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Arg,
+ UINT32 ArgsRemaining);
+
+ACPI_STATUS
+AcpiDsCreateOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *FirstArg);
+
+ACPI_STATUS
+AcpiDsResolveOperands (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDsClearOperands (
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * dswscope - Scope Stack manipulation
+ */
+
+ACPI_STATUS
+AcpiDsScopeStackPush (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_WALK_STATE *WalkState);
+
+
+ACPI_STATUS
+AcpiDsScopeStackPop (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDsScopeStackClear (
+ ACPI_WALK_STATE *WalkState);
+
+
+/* dswstate - parser WALK_STATE management routines */
+
+ACPI_WALK_STATE *
+AcpiDsCreateWalkState (
+ ACPI_OWNER_ID OwnerId,
+ ACPI_PARSE_OBJECT *Origin,
+ ACPI_OPERAND_OBJECT *MthDesc,
+ ACPI_THREAD_STATE *Thread);
+
+ACPI_STATUS
+AcpiDsInitAmlWalk (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *MethodNode,
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc,
+ UINT32 PassNumber);
+
+ACPI_STATUS
+AcpiDsObjStackDeleteAll (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsObjStackPopAndDelete (
+ UINT32 PopCount,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDsDeleteWalkState (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_WALK_STATE *
+AcpiDsPopWalkState (
+ ACPI_THREAD_STATE *Thread);
+
+void
+AcpiDsPushWalkState (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_THREAD_STATE *Thread);
+
+ACPI_STATUS
+AcpiDsResultStackPop (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultStackPush (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultStackClear (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_WALK_STATE *
+AcpiDsGetCurrentWalkState (
+ ACPI_THREAD_STATE *Thread);
+
+void
+AcpiDsDeleteWalkStateCache (
+ void);
+
+ACPI_STATUS
+AcpiDsResultInsert (
+ void *Object,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultRemove (
+ ACPI_OPERAND_OBJECT **Object,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultPop (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultPush (
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsResultPopFromBottom (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState);
+
+#endif /* _ACDISPAT_H_ */
diff --git a/sys/contrib/dev/acpica/acdos16.h b/sys/contrib/dev/acpica/acdos16.h
new file mode 100644
index 0000000..435f293
--- /dev/null
+++ b/sys/contrib/dev/acpica/acdos16.h
@@ -0,0 +1,152 @@
+/******************************************************************************
+ *
+ * Name: acdos16.h - DOS specific defines, etc.
+ * $Revision: 2 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACDOS16_H__
+#define __ACDOS16_H__
+
+#define ACPI_USE_STANDARD_HEADERS
+#define ACPI_OS_NAME "MSDOS"
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE __cdecl
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE __cdecl
+
+#define ACPI_ASM_MACROS
+#define BREAKPOINT3
+#define ACPI_DISABLE_IRQS()
+#define ACPI_ENABLE_IRQS()
+#define halt()
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)
+
+
+
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems. MSVC
+ * doesn't, so this is proprocessed away.
+ */
+#define ACPI_PRINTF_LIKE_FUNC
+
+#endif /* __ACDOS16_H__ */
diff --git a/sys/contrib/dev/acpica/acefi.h b/sys/contrib/dev/acpica/acefi.h
new file mode 100644
index 0000000..a7d7bb0
--- /dev/null
+++ b/sys/contrib/dev/acpica/acefi.h
@@ -0,0 +1,150 @@
+/******************************************************************************
+ *
+ * Name: acefi.h - OS specific defines, etc.
+ * $Revision: 13 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACEFI_H__
+#define __ACEFI_H__
+
+#define ACPI_OS_NAME "AED EFI"
+
+#include <efi.h>
+#include <efistdarg.h>
+#include <efilib.h>
+
+
+/* _int64 works for both IA32 and IA64 */
+
+#define COMPILER_DEPENDENT_INT64 __int64
+#define COMPILER_DEPENDENT_UINT64 unsigned __int64
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* warn C4142: redefinition of type */
+
+#pragma warning(disable:4142)
+
+
+#endif /* __ACEFI_H__ */
diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h
new file mode 100644
index 0000000..5cc9376
--- /dev/null
+++ b/sys/contrib/dev/acpica/acenv.h
@@ -0,0 +1,438 @@
+/******************************************************************************
+ *
+ * Name: acenv.h - Generation environment specific items
+ * $Revision: 104 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACENV_H__
+#define __ACENV_H__
+
+
+/*
+ * Configuration for ACPI tools and utilities
+ */
+
+#ifdef _ACPI_DUMP_APP
+#ifndef MSDOS
+#define ACPI_DEBUG_OUTPUT
+#endif
+#define ACPI_APPLICATION
+#define ACPI_DISASSEMBLER
+#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+#ifdef _ACPI_EXEC_APP
+#undef DEBUGGER_THREADING
+#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_APPLICATION
+#define ACPI_DEBUGGER
+#define ACPI_DISASSEMBLER
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+#ifdef _ACPI_ASL_COMPILER
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_APPLICATION
+#define ACPI_DISASSEMBLER
+#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+/*
+ * Environment configuration. The purpose of this file is to interface to the
+ * local generation environment.
+ *
+ * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
+ * Otherwise, local versions of string/memory functions will be used.
+ * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
+ * the standard header files may be used.
+ *
+ * The ACPI subsystem only uses low level C library functions that do not call
+ * operating system services and may therefore be inlined in the code.
+ *
+ * It may be necessary to tailor these include files to the target
+ * generation environment.
+ *
+ *
+ * Functions and constants used from each header:
+ *
+ * string.h: memcpy
+ * memset
+ * strcat
+ * strcmp
+ * strcpy
+ * strlen
+ * strncmp
+ * strncat
+ * strncpy
+ *
+ * stdlib.h: strtoul
+ *
+ * stdarg.h: va_list
+ * va_arg
+ * va_start
+ * va_end
+ *
+ */
+
+/*! [Begin] no source code translation */
+
+#if defined(__linux__)
+#include "aclinux.h"
+
+#elif defined(_AED_EFI)
+#include "acefi.h"
+
+#elif defined(WIN32)
+#include "acwin.h"
+
+#elif defined(WIN64)
+#include "acwin64.h"
+
+#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
+#include "acdos16.h"
+
+#elif defined(__FreeBSD__)
+#include "acfreebsd.h"
+
+#elif defined(MODESTO)
+#include "acmodesto.h"
+
+#elif defined(NETWARE)
+#include "acnetware.h"
+
+#else
+
+/* All other environments */
+
+#define ACPI_USE_STANDARD_HEADERS
+
+#define COMPILER_DEPENDENT_INT64 long long
+#define COMPILER_DEPENDENT_UINT64 unsigned long long
+
+
+/* Name of host operating system (returned by the _OS_ namespace object) */
+
+#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem"
+
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems. MSVC
+ * doesn't, so this is proprocessed away.
+ */
+#define ACPI_PRINTF_LIKE_FUNC
+
+#endif
+
+/*
+ * Memory allocation tracking. Used only if
+ * 1) This is the debug version
+ * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+#if ACPI_MACHINE_WIDTH != 16
+#define ACPI_DBG_TRACK_ALLOCATIONS
+#endif
+#endif
+
+/*! [End] no source code translation !*/
+
+
+/*
+ * Debugger threading model
+ * Use single threaded if the entire subsystem is contained in an application
+ * Use multiple threaded when the subsystem is running in the kernel.
+ *
+ * By default the model is single threaded if ACPI_APPLICATION is set,
+ * multi-threaded if ACPI_APPLICATION is not set.
+ */
+#define DEBUGGER_SINGLE_THREADED 0
+#define DEBUGGER_MULTI_THREADED 1
+
+#ifndef DEBUGGER_THREADING
+#ifdef ACPI_APPLICATION
+#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
+
+#else
+#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
+#endif
+#endif
+
+
+/******************************************************************************
+ *
+ * C library configuration
+ *
+ *****************************************************************************/
+
+#ifdef ACPI_USE_SYSTEM_CLIBRARY
+/*
+ * Use the standard C library headers.
+ * We want to keep these to a minimum.
+ */
+
+#ifdef ACPI_USE_STANDARD_HEADERS
+/*
+ * Use the standard headers from the standard locations
+ */
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#endif /* ACPI_USE_STANDARD_HEADERS */
+
+/*
+ * We will be linking to the standard Clib functions
+ */
+
+#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
+#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
+#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s))
+#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
+#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRCMP(d,s) strcmp((d), (s))
+#define ACPI_STRCAT(d,s) (void) strcat((d), (s))
+#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
+
+#define ACPI_TOUPPER toupper
+#define ACPI_TOLOWER tolower
+#define ACPI_IS_XDIGIT isxdigit
+#define ACPI_IS_DIGIT isdigit
+#define ACPI_IS_SPACE isspace
+#define ACPI_IS_UPPER isupper
+#define ACPI_IS_PRINT isprint
+#define ACPI_IS_ALPHA isalpha
+#define ACPI_IS_ASCII isascii
+
+/******************************************************************************
+ *
+ * Not using native C library, use local implementations
+ *
+ *****************************************************************************/
+#else
+
+/*
+ * Use local definitions of C library macros and functions
+ * NOTE: The function implementations may not be as efficient
+ * as an inline or assembly code implementation provided by a
+ * native C library.
+ */
+
+#ifndef va_arg
+
+#ifndef _VALIST
+#define _VALIST
+typedef char *va_list;
+#endif /* _VALIST */
+
+/*
+ * Storage alignment properties
+ */
+
+#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1)
+#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1)
+
+/*
+ * Variable argument list macro definitions
+ */
+
+#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
+#define va_end(ap) (void) 0
+#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
+
+#endif /* va_arg */
+
+
+#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
+#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
+#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s))
+#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s))
+#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
+#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s))
+#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
+#define ACPI_TOUPPER AcpiUtToUpper
+#define ACPI_TOLOWER AcpiUtToLower
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+
+/******************************************************************************
+ *
+ * Assembly code macros
+ *
+ *****************************************************************************/
+
+/*
+ * Handle platform- and compiler-specific assembly language differences.
+ * These should already have been defined by the platform includes above.
+ *
+ * Notes:
+ * 1) Interrupt 3 is used to break into a debugger
+ * 2) Interrupts are turned off during ACPI register setup
+ */
+
+/* Unrecognized compiler, use defaults */
+
+#ifndef ACPI_ASM_MACROS
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+#define ACPI_ASM_MACROS
+#define BREAKPOINT3
+#define ACPI_DISABLE_IRQS()
+#define ACPI_ENABLE_IRQS()
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)
+
+#endif /* ACPI_ASM_MACROS */
+
+
+#ifdef ACPI_APPLICATION
+
+/* Don't want software interrupts within a ring3 application */
+
+#undef BREAKPOINT3
+#define BREAKPOINT3
+#endif
+
+
+/******************************************************************************
+ *
+ * Compiler-specific information is contained in the compiler-specific
+ * headers.
+ *
+ *****************************************************************************/
+#endif /* __ACENV_H__ */
diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h
new file mode 100644
index 0000000..172a5f7
--- /dev/null
+++ b/sys/contrib/dev/acpica/acevents.h
@@ -0,0 +1,336 @@
+/******************************************************************************
+ *
+ * Name: acevents.h - Event subcomponent prototypes and defines
+ * $Revision: 91 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACEVENTS_H__
+#define __ACEVENTS_H__
+
+
+ACPI_STATUS
+AcpiEvInitialize (
+ void);
+
+ACPI_STATUS
+AcpiEvHandlerInitialize (
+ void);
+
+
+/*
+ * Evfixed - Fixed event handling
+ */
+
+ACPI_STATUS
+AcpiEvFixedEventInitialize (
+ void);
+
+UINT32
+AcpiEvFixedEventDetect (
+ void);
+
+UINT32
+AcpiEvFixedEventDispatch (
+ UINT32 Event);
+
+
+/*
+ * Evmisc
+ */
+
+BOOLEAN
+AcpiEvIsNotifyObject (
+ ACPI_NAMESPACE_NODE *Node);
+
+ACPI_STATUS
+AcpiEvAcquireGlobalLock(
+ UINT16 Timeout);
+
+ACPI_STATUS
+AcpiEvReleaseGlobalLock(
+ void);
+
+ACPI_STATUS
+AcpiEvInitGlobalLockHandler (
+ void);
+
+UINT32
+AcpiEvGetGpeNumberIndex (
+ UINT32 GpeNumber);
+
+ACPI_STATUS
+AcpiEvQueueNotifyRequest (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 NotifyValue);
+
+void ACPI_SYSTEM_XFACE
+AcpiEvNotifyDispatch (
+ void *Context);
+
+
+/*
+ * Evgpe - GPE handling and dispatch
+ */
+
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback);
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_GPE_EVENT_INFO *
+AcpiEvGetGpeEventInfo (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber);
+
+ACPI_STATUS
+AcpiEvGpeInitialize (
+ void);
+
+ACPI_STATUS
+AcpiEvCreateGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT8 GpeBlockBaseNumber,
+ UINT32 InterruptLevel,
+ ACPI_GPE_BLOCK_INFO **ReturnGpeBlock);
+
+ACPI_STATUS
+AcpiEvDeleteGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+UINT32
+AcpiEvGpeDispatch (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber);
+
+UINT32
+AcpiEvGpeDetect (
+ ACPI_GPE_XRUPT_INFO *GpeXruptList);
+
+/*
+ * Evregion - Address Space handling
+ */
+
+ACPI_STATUS
+AcpiEvInitAddressSpaces (
+ void);
+
+ACPI_STATUS
+AcpiEvAddressSpaceDispatch (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ void *Value);
+
+ACPI_STATUS
+AcpiEvInstallHandler (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiEvAttachRegion (
+ ACPI_OPERAND_OBJECT *HandlerObj,
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsIsLocked);
+
+void
+AcpiEvDetachRegion (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsIsLocked);
+
+
+/*
+ * Evregini - Region initialization and setup
+ */
+
+ACPI_STATUS
+AcpiEvSystemMemoryRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvIoSpaceRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvPciConfigRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvCmosRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvPciBarRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvDefaultRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+ACPI_STATUS
+AcpiEvInitializeRegion (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsLocked);
+
+
+/*
+ * Evsci - SCI (System Control Interrupt) handling/dispatch
+ */
+
+UINT32 ACPI_SYSTEM_XFACE
+AcpiEvGpeXruptHandler (
+ void *Context);
+
+UINT32
+AcpiEvInstallSciHandler (
+ void);
+
+ACPI_STATUS
+AcpiEvRemoveSciHandler (
+ void);
+
+UINT32
+AcpiEvInitializeSCI (
+ UINT32 ProgramSCI);
+
+void
+AcpiEvTerminate (
+ void);
+
+
+#endif /* __ACEVENTS_H__ */
diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h
new file mode 100644
index 0000000..8aaacf2
--- /dev/null
+++ b/sys/contrib/dev/acpica/acexcep.h
@@ -0,0 +1,377 @@
+/******************************************************************************
+ *
+ * Name: acexcep.h - Exception codes returned by the ACPI subsystem
+ * $Revision: 68 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACEXCEP_H__
+#define __ACEXCEP_H__
+
+
+/*
+ * Exceptions returned by external ACPI interfaces
+ */
+
+#define AE_CODE_ENVIRONMENTAL 0x0000
+#define AE_CODE_PROGRAMMER 0x1000
+#define AE_CODE_ACPI_TABLES 0x2000
+#define AE_CODE_AML 0x3000
+#define AE_CODE_CONTROL 0x4000
+#define AE_CODE_MASK 0xF000
+
+
+#define ACPI_SUCCESS(a) (!(a))
+#define ACPI_FAILURE(a) (a)
+
+
+#define AE_OK (ACPI_STATUS) 0x0000
+
+/*
+ * Environmental exceptions
+ */
+#define AE_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_ACPI_TABLES (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_NAMESPACE (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_MEMORY (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_FOUND (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_EXIST (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_EXISTS (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL)
+#define AE_TYPE (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_OBJECT (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_ENTRY (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL)
+#define AE_BUFFER_OVERFLOW (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_OVERFLOW (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_UNDERFLOW (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_IMPLEMENTED (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL)
+#define AE_VERSION_MISMATCH (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL)
+#define AE_SUPPORT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL)
+#define AE_SHARE (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL)
+#define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL)
+#define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL)
+#define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL)
+#define AE_ACQUIRE_DEADLOCK (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL)
+#define AE_RELEASE_DEADLOCK (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_ACQUIRED (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HARDWARE_RESPONSE (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
+#define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
+#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
+#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL)
+
+#define AE_CODE_ENV_MAX 0x001D
+
+/*
+ * Programmer exceptions
+ */
+#define AE_BAD_PARAMETER (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER)
+#define AE_BAD_CHARACTER (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER)
+#define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER)
+#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_ALIGNMENT (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER)
+#define AE_BAD_HEX_CONSTANT (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER)
+#define AE_BAD_OCTAL_CONSTANT (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DECIMAL_CONSTANT (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER)
+
+#define AE_CODE_PGM_MAX 0x0009
+
+
+/*
+ * Acpi table exceptions
+ */
+#define AE_BAD_SIGNATURE (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES)
+#define AE_TABLE_NOT_SUPPORTED (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES)
+#define AE_INVALID_TABLE_LENGTH (ACPI_STATUS) (0x0006 | AE_CODE_ACPI_TABLES)
+
+#define AE_CODE_TBL_MAX 0x0006
+
+
+/*
+ * AML exceptions. These are caused by problems with
+ * the actual AML byte stream
+ */
+#define AE_AML_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_AML)
+#define AE_AML_PARSE (ACPI_STATUS) (0x0002 | AE_CODE_AML)
+#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0003 | AE_CODE_AML)
+#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0004 | AE_CODE_AML)
+#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0005 | AE_CODE_AML)
+#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0006 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0007 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0008 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0009 | AE_CODE_AML)
+#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x000A | AE_CODE_AML)
+#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML)
+#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000C | AE_CODE_AML)
+#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000D | AE_CODE_AML)
+#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000E | AE_CODE_AML)
+#define AE_AML_BAD_NAME (ACPI_STATUS) (0x000F | AE_CODE_AML)
+#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML)
+#define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML)
+#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML)
+#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML)
+#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML)
+#define AE_AML_METHOD_LIMIT (ACPI_STATUS) (0x0015 | AE_CODE_AML)
+#define AE_AML_NOT_OWNER (ACPI_STATUS) (0x0016 | AE_CODE_AML)
+#define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0017 | AE_CODE_AML)
+#define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_AML)
+#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML)
+#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML)
+#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML)
+#define AE_AML_NO_WHILE (ACPI_STATUS) (0x001C | AE_CODE_AML)
+#define AE_AML_ALIGNMENT (ACPI_STATUS) (0x001D | AE_CODE_AML)
+#define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML)
+#define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML)
+
+#define AE_CODE_AML_MAX 0x0020
+
+/*
+ * Internal exceptions used for control
+ */
+#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL)
+#define AE_CTRL_PENDING (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL)
+#define AE_CTRL_TERMINATE (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL)
+#define AE_CTRL_TRUE (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL)
+#define AE_CTRL_FALSE (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL)
+#define AE_CTRL_DEPTH (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL)
+#define AE_CTRL_END (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL)
+#define AE_CTRL_TRANSFER (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL)
+#define AE_CTRL_BREAK (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL)
+#define AE_CTRL_CONTINUE (ACPI_STATUS) (0x000A | AE_CODE_CONTROL)
+#define AE_CTRL_SKIP (ACPI_STATUS) (0x000B | AE_CODE_CONTROL)
+
+#define AE_CODE_CTRL_MAX 0x000B
+
+
+#ifdef DEFINE_ACPI_GLOBALS
+
+/*
+ * String versions of the exception codes above
+ * These strings must match the corresponding defines exactly
+ */
+char const *AcpiGbl_ExceptionNames_Env[] =
+{
+ "AE_OK",
+ "AE_ERROR",
+ "AE_NO_ACPI_TABLES",
+ "AE_NO_NAMESPACE",
+ "AE_NO_MEMORY",
+ "AE_NOT_FOUND",
+ "AE_NOT_EXIST",
+ "AE_ALREADY_EXISTS",
+ "AE_TYPE",
+ "AE_NULL_OBJECT",
+ "AE_NULL_ENTRY",
+ "AE_BUFFER_OVERFLOW",
+ "AE_STACK_OVERFLOW",
+ "AE_STACK_UNDERFLOW",
+ "AE_NOT_IMPLEMENTED",
+ "AE_VERSION_MISMATCH",
+ "AE_SUPPORT",
+ "AE_SHARE",
+ "AE_LIMIT",
+ "AE_TIME",
+ "AE_UNKNOWN_STATUS",
+ "AE_ACQUIRE_DEADLOCK",
+ "AE_RELEASE_DEADLOCK",
+ "AE_NOT_ACQUIRED",
+ "AE_ALREADY_ACQUIRED",
+ "AE_NO_HARDWARE_RESPONSE",
+ "AE_NO_GLOBAL_LOCK",
+ "AE_LOGICAL_ADDRESS",
+ "AE_ABORT_METHOD",
+ "AE_SAME_HANDLER"
+};
+
+char const *AcpiGbl_ExceptionNames_Pgm[] =
+{
+ "AE_BAD_PARAMETER",
+ "AE_BAD_CHARACTER",
+ "AE_BAD_PATHNAME",
+ "AE_BAD_DATA",
+ "AE_BAD_ADDRESS",
+ "AE_ALIGNMENT",
+ "AE_BAD_HEX_CONSTANT",
+ "AE_BAD_OCTAL_CONSTANT",
+ "AE_BAD_DECIMAL_CONSTANT"
+};
+
+char const *AcpiGbl_ExceptionNames_Tbl[] =
+{
+ "AE_BAD_SIGNATURE",
+ "AE_BAD_HEADER",
+ "AE_BAD_CHECKSUM",
+ "AE_BAD_VALUE",
+ "AE_TABLE_NOT_SUPPORTED",
+ "AE_INVALID_TABLE_LENGTH"
+};
+
+char const *AcpiGbl_ExceptionNames_Aml[] =
+{
+ "AE_AML_ERROR",
+ "AE_AML_PARSE",
+ "AE_AML_BAD_OPCODE",
+ "AE_AML_NO_OPERAND",
+ "AE_AML_OPERAND_TYPE",
+ "AE_AML_OPERAND_VALUE",
+ "AE_AML_UNINITIALIZED_LOCAL",
+ "AE_AML_UNINITIALIZED_ARG",
+ "AE_AML_UNINITIALIZED_ELEMENT",
+ "AE_AML_NUMERIC_OVERFLOW",
+ "AE_AML_REGION_LIMIT",
+ "AE_AML_BUFFER_LIMIT",
+ "AE_AML_PACKAGE_LIMIT",
+ "AE_AML_DIVIDE_BY_ZERO",
+ "AE_AML_BAD_NAME",
+ "AE_AML_NAME_NOT_FOUND",
+ "AE_AML_INTERNAL",
+ "AE_AML_INVALID_SPACE_ID",
+ "AE_AML_STRING_LIMIT",
+ "AE_AML_NO_RETURN_VALUE",
+ "AE_AML_METHOD_LIMIT",
+ "AE_AML_NOT_OWNER",
+ "AE_AML_MUTEX_ORDER",
+ "AE_AML_MUTEX_NOT_ACQUIRED",
+ "AE_AML_INVALID_RESOURCE_TYPE",
+ "AE_AML_INVALID_INDEX",
+ "AE_AML_REGISTER_LIMIT",
+ "AE_AML_NO_WHILE",
+ "AE_AML_ALIGNMENT",
+ "AE_AML_NO_RESOURCE_END_TAG",
+ "AE_AML_BAD_RESOURCE_VALUE",
+ "AE_AML_CIRCULAR_REFERENCE"
+};
+
+char const *AcpiGbl_ExceptionNames_Ctrl[] =
+{
+ "AE_CTRL_RETURN_VALUE",
+ "AE_CTRL_PENDING",
+ "AE_CTRL_TERMINATE",
+ "AE_CTRL_TRUE",
+ "AE_CTRL_FALSE",
+ "AE_CTRL_DEPTH",
+ "AE_CTRL_END",
+ "AE_CTRL_TRANSFER",
+ "AE_CTRL_BREAK",
+ "AE_CTRL_CONTINUE",
+ "AE_CTRL_SKIP"
+};
+
+#endif /* ACPI GLOBALS */
+
+
+#endif /* __ACEXCEP_H__ */
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
new file mode 100644
index 0000000..52c3444
--- /dev/null
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -0,0 +1,208 @@
+/******************************************************************************
+ *
+ * Name: acfreebsd.h - OS specific defines, etc.
+ * $Revision: 11 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACFREEBSD_H__
+#define __ACFREEBSD_H__
+
+/*
+ * Some systems' ASL may have problems because they look for names
+ * of Microsoft operating systems. To override this, set hw.acpi.os_name
+ * to the appropriate string.
+ */
+#define ACPI_OS_NAME "FreeBSD"
+
+/* FreeBSD uses GCC */
+
+#include "acgcc.h"
+#include <machine/acpica_machdep.h>
+
+#ifdef _KERNEL
+#include "opt_acpi.h"
+#endif
+
+#ifdef ACPI_DEBUG
+#define ACPI_DEBUG_OUTPUT /* for backward compatibility */
+#define ACPI_DISASSEMBLER
+#endif
+
+#ifdef _KERNEL
+#include <sys/ctype.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/libkern.h>
+#include <machine/stdarg.h>
+
+#ifdef DEBUGGER_THREADING
+#undef DEBUGGER_THREADING
+#endif /* DEBUGGER_THREADING */
+#define DEBUGGER_THREADING 0 /* integrated with DDB */
+#ifdef ACPI_DEBUG_OUTPUT
+#include "opt_ddb.h"
+#ifdef DDB
+#define ACPI_DEBUGGER
+#endif /* DDB */
+#endif /* ACPI_DEBUG_OUTPUT */
+
+#else /* _KERNEL */
+
+/* Not building kernel code, so use libc */
+#define ACPI_USE_STANDARD_HEADERS
+#define ACPI_FLUSH_CPU_CACHE()
+#include <sys/types.h>
+
+#define __cli()
+#define __sti()
+
+#endif /* _KERNEL */
+
+/* Always use FreeBSD code over our local versions */
+#define ACPI_USE_SYSTEM_CLIBRARY
+
+/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */
+static __inline char *
+strupr(char *str)
+{
+ char *c = str;
+ while(*c) {
+ *c = toupper(*c);
+ c++;
+ }
+ return(str);
+}
+
+#ifdef _KERNEL
+/* Or strstr (used in debugging mode, also move to libkern) */
+static __inline char *
+strstr(char *s, char *find)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ len = strlen(find);
+ do {
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while (sc != c);
+ } while (strncmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char *)s);
+}
+#endif /* _KERNEL */
+
+#endif /* __ACFREEBSD_H__ */
diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h
new file mode 100644
index 0000000..af60e3a
--- /dev/null
+++ b/sys/contrib/dev/acpica/acgcc.h
@@ -0,0 +1,132 @@
+/******************************************************************************
+ *
+ * Name: acgcc.h - GCC specific defines, etc.
+ * $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACGCC_H__
+#define __ACGCC_H__
+
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers (like GCC) can catch printf format string problems.
+ */
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+
+/* Some compilers complain about unused variables. Sometimes we don't want to
+ * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * to to tell the compiler warning in a per-variable manner that a variable
+ * is unused.
+ */
+#define ACPI_UNUSED_VAR __attribute__ ((unused))
+
+#endif /* __ACGCC_H__ */
diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h
new file mode 100644
index 0000000..7ee14d3
--- /dev/null
+++ b/sys/contrib/dev/acpica/acglobal.h
@@ -0,0 +1,380 @@
+/******************************************************************************
+ *
+ * Name: acglobal.h - Declarations for global variables
+ * $Revision: 143 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACGLOBAL_H__
+#define __ACGLOBAL_H__
+
+
+/*
+ * Ensure that the globals are actually defined only once.
+ *
+ * The use of these defines allows a single list of globals (here) in order
+ * to simplify maintenance of the code.
+ */
+#ifdef DEFINE_ACPI_GLOBALS
+#define ACPI_EXTERN
+#else
+#define ACPI_EXTERN extern
+#endif
+
+
+/*****************************************************************************
+ *
+ * Debug support
+ *
+ ****************************************************************************/
+
+/* Runtime configuration of debug print levels */
+
+extern UINT32 AcpiDbgLevel;
+extern UINT32 AcpiDbgLayer;
+
+/* Procedure nesting level for debug output */
+
+extern UINT32 AcpiGbl_NestingLevel;
+
+
+/*****************************************************************************
+ *
+ * ACPI Table globals
+ *
+ ****************************************************************************/
+
+/*
+ * Table pointers.
+ * Although these pointers are somewhat redundant with the global AcpiTable,
+ * they are convenient because they are typed pointers.
+ *
+ * These tables are single-table only; meaning that there can be at most one
+ * of each in the system. Each global points to the actual table.
+ *
+ */
+ACPI_EXTERN UINT32 AcpiGbl_TableFlags;
+ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount;
+ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
+ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
+ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
+ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS;
+ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
+
+/*
+ * Handle both ACPI 1.0 and ACPI 2.0 Integer widths
+ * If we are running a method that exists in a 32-bit ACPI table.
+ * Use only 32 bits of the Integer for conversion.
+ */
+ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth;
+ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
+ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
+
+/*
+ * Since there may be multiple SSDTs and PSDTS, a single pointer is not
+ * sufficient; Therefore, there isn't one!
+ */
+
+
+/*
+ * ACPI Table info arrays
+ */
+extern ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
+extern ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES];
+
+/*
+ * Predefined mutex objects. This array contains the
+ * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
+ * (The table maps local handles to the real OS handles)
+ */
+ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
+
+
+/*****************************************************************************
+ *
+ * Miscellaneous globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS];
+ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
+ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
+ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
+ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
+ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
+
+ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount;
+ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
+ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
+ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
+ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
+ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
+ACPI_EXTERN UINT16 AcpiGbl_NextTableOwnerId;
+ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId;
+ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
+ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
+ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
+ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
+ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
+
+extern BOOLEAN AcpiGbl_Shutdown;
+extern UINT32 AcpiGbl_StartupFlags;
+extern const UINT8 AcpiGbl_DecodeTo8bit[8];
+extern const char *AcpiGbl_DbSleepStates[ACPI_S_STATE_COUNT];
+extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
+extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
+
+
+/*****************************************************************************
+ *
+ * Namespace globals
+ *
+ ****************************************************************************/
+
+#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
+
+#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
+#define NUM_PREDEFINED_NAMES 10
+#else
+#define NUM_PREDEFINED_NAMES 9
+#endif
+
+ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct;
+ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode;
+
+extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES];
+extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
+
+#ifdef ACPI_DEBUG_OUTPUT
+ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount;
+ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize;
+ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount;
+ACPI_EXTERN ACPI_SIZE AcpiGbl_EntryStackPointer;
+ACPI_EXTERN ACPI_SIZE AcpiGbl_LowestStackPointer;
+ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting;
+#endif
+
+/*****************************************************************************
+ *
+ * Interpreter globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList;
+
+/* Control method single step flag */
+
+ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
+
+
+/*****************************************************************************
+ *
+ * Parser globals
+ *
+ ****************************************************************************/
+
+ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+
+/*****************************************************************************
+ *
+ * Hardware globals
+ *
+ ****************************************************************************/
+
+extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
+ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA;
+ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB;
+
+
+/*****************************************************************************
+ *
+ * Event and GPE globals
+ *
+ ****************************************************************************/
+
+extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
+ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeLock;
+
+
+/*****************************************************************************
+ *
+ * Debugger globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
+
+#ifdef ACPI_DISASSEMBLER
+
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
+#endif
+
+
+#ifdef ACPI_DEBUGGER
+
+extern BOOLEAN AcpiGbl_MethodExecuting;
+extern BOOLEAN AcpiGbl_AbortMethod;
+extern BOOLEAN AcpiGbl_DbTerminateThreads;
+
+ACPI_EXTERN int optind;
+ACPI_EXTERN char *optarg;
+
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
+
+
+ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN char AcpiGbl_DbLineBuf[80];
+ACPI_EXTERN char AcpiGbl_DbParsedBuf[80];
+ACPI_EXTERN char AcpiGbl_DbScopeBuf[40];
+ACPI_EXTERN char AcpiGbl_DbDebugFilename[40];
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
+ACPI_EXTERN char *AcpiGbl_DbBuffer;
+ACPI_EXTERN char *AcpiGbl_DbFilename;
+ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
+ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
+ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr;
+ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode;
+
+/*
+ * Statistic globals
+ */
+ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1];
+ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1];
+ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc;
+ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc;
+ACPI_EXTERN UINT32 AcpiGbl_NumNodes;
+ACPI_EXTERN UINT32 AcpiGbl_NumObjects;
+
+
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects;
+
+#endif /* ACPI_DEBUGGER */
+
+
+#endif /* __ACGLOBAL_H__ */
diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h
new file mode 100644
index 0000000..459848e
--- /dev/null
+++ b/sys/contrib/dev/acpica/achware.h
@@ -0,0 +1,250 @@
+/******************************************************************************
+ *
+ * Name: achware.h -- hardware specific interfaces
+ * $Revision: 67 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACHWARE_H__
+#define __ACHWARE_H__
+
+
+/* PM Timer ticks per second (HZ) */
+#define PM_TIMER_FREQUENCY 3579545
+
+
+/* Prototypes */
+
+
+ACPI_STATUS
+AcpiHwInitialize (
+ void);
+
+ACPI_STATUS
+AcpiHwShutdown (
+ void);
+
+ACPI_STATUS
+AcpiHwInitializeSystemInfo (
+ void);
+
+ACPI_STATUS
+AcpiHwSetMode (
+ UINT32 Mode);
+
+UINT32
+AcpiHwGetMode (
+ void);
+
+UINT32
+AcpiHwGetModeCapabilities (
+ void);
+
+/* Register I/O Prototypes */
+
+ACPI_BIT_REGISTER_INFO *
+AcpiHwGetBitRegisterInfo (
+ UINT32 RegisterId);
+
+ACPI_STATUS
+AcpiHwRegisterRead (
+ BOOLEAN UseLock,
+ UINT32 RegisterId,
+ UINT32 *ReturnValue);
+
+ACPI_STATUS
+AcpiHwRegisterWrite (
+ BOOLEAN UseLock,
+ UINT32 RegisterId,
+ UINT32 Value);
+
+ACPI_STATUS
+AcpiHwLowLevelRead (
+ UINT32 Width,
+ UINT32 *Value,
+ ACPI_GENERIC_ADDRESS *Reg);
+
+ACPI_STATUS
+AcpiHwLowLevelWrite (
+ UINT32 Width,
+ UINT32 Value,
+ ACPI_GENERIC_ADDRESS *Reg);
+
+ACPI_STATUS
+AcpiHwClearAcpiStatus (
+ UINT32 Flags);
+
+
+/* GPE support */
+
+ACPI_STATUS
+AcpiHwEnableGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+void
+AcpiHwEnableGpeForWakeup (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_STATUS
+AcpiHwDisableGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_STATUS
+AcpiHwDisableGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+void
+AcpiHwDisableGpeForWakeup (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_STATUS
+AcpiHwClearGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_STATUS
+AcpiHwClearGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+ACPI_STATUS
+AcpiHwGetGpeStatus (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ ACPI_EVENT_STATUS *EventStatus);
+
+ACPI_STATUS
+AcpiHwDisableNonWakeupGpes (
+ void);
+
+ACPI_STATUS
+AcpiHwEnableNonWakeupGpes (
+ void);
+
+
+/* ACPI Timer prototypes */
+
+ACPI_STATUS
+AcpiGetTimerResolution (
+ UINT32 *Resolution);
+
+ACPI_STATUS
+AcpiGetTimer (
+ UINT32 *Ticks);
+
+ACPI_STATUS
+AcpiGetTimerDuration (
+ UINT32 StartTicks,
+ UINT32 EndTicks,
+ UINT32 *TimeElapsed);
+
+
+#endif /* __ACHWARE_H__ */
diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h
new file mode 100644
index 0000000..1756b8d
--- /dev/null
+++ b/sys/contrib/dev/acpica/acinterp.h
@@ -0,0 +1,811 @@
+/******************************************************************************
+ *
+ * Name: acinterp.h - Interpreter subcomponent prototypes and defines
+ * $Revision: 146 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACINTERP_H__
+#define __ACINTERP_H__
+
+
+#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+
+
+ACPI_STATUS
+AcpiExResolveOperands (
+ UINT16 Opcode,
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCheckObjectType (
+ ACPI_OBJECT_TYPE TypeNeeded,
+ ACPI_OBJECT_TYPE ThisType,
+ void *Object);
+
+/*
+ * exxface - External interpreter interfaces
+ */
+
+ACPI_STATUS
+AcpiExLoadTable (
+ ACPI_TABLE_TYPE TableId);
+
+ACPI_STATUS
+AcpiExExecuteMethod (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc);
+
+
+/*
+ * exconvrt - object conversion
+ */
+
+ACPI_STATUS
+AcpiExConvertToInteger (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExConvertToBuffer (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExConvertToString (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ UINT32 Base,
+ UINT32 MaxLength,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExConvertToTargetType (
+ ACPI_OBJECT_TYPE DestinationType,
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState);
+
+UINT32
+AcpiExConvertToAscii (
+ ACPI_INTEGER Integer,
+ UINT32 Base,
+ UINT8 *String,
+ UINT8 MaxLength);
+
+/*
+ * exfield - ACPI AML (p-code) execution - field manipulation
+ */
+
+ACPI_STATUS
+AcpiExExtractFromField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength);
+
+ACPI_STATUS
+AcpiExInsertIntoField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength);
+
+ACPI_STATUS
+AcpiExSetupRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset);
+
+ACPI_STATUS
+AcpiExAccessRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 ReadWrite);
+
+BOOLEAN
+AcpiExRegisterOverflow (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_INTEGER Value);
+
+ACPI_STATUS
+AcpiExFieldDatumIo (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 ReadWrite);
+
+ACPI_STATUS
+AcpiExWriteWithUpdateRule (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_INTEGER Mask,
+ ACPI_INTEGER FieldValue,
+ UINT32 FieldDatumByteOffset);
+
+void
+AcpiExGetBufferDatum(
+ ACPI_INTEGER *Datum,
+ void *Buffer,
+ UINT32 BufferLength,
+ UINT32 ByteGranularity,
+ UINT32 BufferOffset);
+
+void
+AcpiExSetBufferDatum (
+ ACPI_INTEGER MergedDatum,
+ void *Buffer,
+ UINT32 BufferLength,
+ UINT32 ByteGranularity,
+ UINT32 BufferOffset);
+
+ACPI_STATUS
+AcpiExReadDataFromField (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **RetBufferDesc);
+
+ACPI_STATUS
+AcpiExWriteDataToField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc);
+
+/*
+ * exmisc - ACPI AML (p-code) execution - specific opcodes
+ */
+
+ACPI_STATUS
+AcpiExOpcode_3A_0T_0R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_3A_1T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_6A_0T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+BOOLEAN
+AcpiExDoMatch (
+ UINT32 MatchOp,
+ ACPI_INTEGER PackageValue,
+ ACPI_INTEGER MatchValue);
+
+ACPI_STATUS
+AcpiExGetObjectReference (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ReturnDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExResolveMultiple (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *Operand,
+ ACPI_OBJECT_TYPE *ReturnType,
+ ACPI_OPERAND_OBJECT **ReturnDesc);
+
+ACPI_STATUS
+AcpiExConcatTemplate (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExDoConcatenate (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState);
+
+BOOLEAN
+AcpiExDoLogicalOp (
+ UINT16 Opcode,
+ ACPI_INTEGER Operand0,
+ ACPI_INTEGER Operand1);
+
+ACPI_INTEGER
+AcpiExDoMathOp (
+ UINT16 Opcode,
+ ACPI_INTEGER Operand0,
+ ACPI_INTEGER Operand1);
+
+ACPI_STATUS
+AcpiExCreateMutex (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateProcessor (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreatePowerResource (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateRegion (
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ UINT8 RegionSpace,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateTableRegion (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateEvent (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateAlias (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExCreateMethod (
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exconfig - dynamic table load/unload
+ */
+
+ACPI_STATUS
+AcpiExAddTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_OPERAND_OBJECT **DdbHandle);
+
+ACPI_STATUS
+AcpiExLoadOp (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *Target,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExLoadTableOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **ReturnDesc);
+
+ACPI_STATUS
+AcpiExUnloadTable (
+ ACPI_OPERAND_OBJECT *DdbHandle);
+
+
+/*
+ * exmutex - mutex support
+ */
+
+ACPI_STATUS
+AcpiExAcquireMutex (
+ ACPI_OPERAND_OBJECT *TimeDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExReleaseMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiExReleaseAllMutexes (
+ ACPI_THREAD_STATE *Thread);
+
+void
+AcpiExUnlinkMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+void
+AcpiExLinkMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_STATE *Thread);
+
+/*
+ * exprep - ACPI AML (p-code) execution - prep utilities
+ */
+
+ACPI_STATUS
+AcpiExPrepCommonFieldObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 FieldFlags,
+ UINT8 FieldAttribute,
+ UINT32 FieldBitPosition,
+ UINT32 FieldBitLength);
+
+ACPI_STATUS
+AcpiExPrepFieldValue (
+ ACPI_CREATE_FIELD_INFO *Info);
+
+/*
+ * exsystem - Interface to OS services
+ */
+
+ACPI_STATUS
+AcpiExSystemDoNotifyOp (
+ ACPI_OPERAND_OBJECT *Value,
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemDoSuspend(
+ UINT32 Time);
+
+ACPI_STATUS
+AcpiExSystemDoStall (
+ UINT32 Time);
+
+ACPI_STATUS
+AcpiExSystemAcquireMutex(
+ ACPI_OPERAND_OBJECT *Time,
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemReleaseMutex(
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemSignalEvent(
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemWaitEvent(
+ ACPI_OPERAND_OBJECT *Time,
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemResetEvent(
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiExSystemWaitSemaphore (
+ ACPI_HANDLE Semaphore,
+ UINT16 Timeout);
+
+
+/*
+ * exmonadic - ACPI AML (p-code) execution, monadic operators
+ */
+
+ACPI_STATUS
+AcpiExOpcode_1A_0T_0R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_1A_0T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_1A_1T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_1A_1T_0R (
+ ACPI_WALK_STATE *WalkState);
+
+/*
+ * exdyadic - ACPI AML (p-code) execution, dyadic operators
+ */
+
+ACPI_STATUS
+AcpiExOpcode_2A_0T_0R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_2A_0T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_2A_1T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExOpcode_2A_2T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exresolv - Object resolution and get value functions
+ */
+
+ACPI_STATUS
+AcpiExResolveToValue (
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExResolveNodeToValue (
+ ACPI_NAMESPACE_NODE **StackPtr,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExResolveObjectToValue (
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exdump - Scanner debug output routines
+ */
+
+void
+AcpiExDumpOperand (
+ ACPI_OPERAND_OBJECT *EntryDesc);
+
+void
+AcpiExDumpOperands (
+ ACPI_OPERAND_OBJECT **Operands,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ char *Ident,
+ UINT32 NumLevels,
+ char *Note,
+ char *ModuleName,
+ UINT32 LineNumber);
+
+void
+AcpiExDumpObjectDescriptor (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT32 Flags);
+
+void
+AcpiExDumpNode (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 Flags);
+
+void
+AcpiExOutString (
+ char *Title,
+ char *Value);
+
+void
+AcpiExOutPointer (
+ char *Title,
+ void *Value);
+
+void
+AcpiExOutInteger (
+ char *Title,
+ UINT32 Value);
+
+void
+AcpiExOutAddress (
+ char *Title,
+ ACPI_PHYSICAL_ADDRESS Value);
+
+
+/*
+ * exnames - interpreter/scanner name load/execute
+ */
+
+char *
+AcpiExAllocateNameString (
+ UINT32 PrefixCount,
+ UINT32 NumNameSegs);
+
+UINT32
+AcpiExGoodChar (
+ UINT32 Character);
+
+ACPI_STATUS
+AcpiExNameSegment (
+ UINT8 **InAmlAddress,
+ char *NameString);
+
+ACPI_STATUS
+AcpiExGetNameString (
+ ACPI_OBJECT_TYPE DataType,
+ UINT8 *InAmlAddress,
+ char **OutNameString,
+ UINT32 *OutNameLength);
+
+ACPI_STATUS
+AcpiExDoName (
+ ACPI_OBJECT_TYPE DataType,
+ ACPI_INTERPRETER_MODE LoadExecMode);
+
+
+/*
+ * exstore - Object store support
+ */
+
+ACPI_STATUS
+AcpiExStore (
+ ACPI_OPERAND_OBJECT *ValDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExStoreObjectToIndex (
+ ACPI_OPERAND_OBJECT *ValDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExStoreObjectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exstoren
+ */
+
+ACPI_STATUS
+AcpiExResolveObject (
+ ACPI_OPERAND_OBJECT **SourceDescPtr,
+ ACPI_OBJECT_TYPE TargetType,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExStoreObjectToObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_OPERAND_OBJECT **NewDesc,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * excopy - object copy
+ */
+
+ACPI_STATUS
+AcpiExStoreBufferToBuffer (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc);
+
+ACPI_STATUS
+AcpiExStoreStringToString (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc);
+
+ACPI_STATUS
+AcpiExCopyIntegerToIndexField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc);
+
+ACPI_STATUS
+AcpiExCopyIntegerToBankField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc);
+
+ACPI_STATUS
+AcpiExCopyDataToNamedField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node);
+
+ACPI_STATUS
+AcpiExCopyIntegerToBufferField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc);
+
+/*
+ * exutils - interpreter/scanner utilities
+ */
+
+ACPI_STATUS
+AcpiExEnterInterpreter (
+ void);
+
+void
+AcpiExExitInterpreter (
+ void);
+
+void
+AcpiExTruncateFor32bitTable (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+BOOLEAN
+AcpiExAcquireGlobalLock (
+ UINT32 Rule);
+
+void
+AcpiExReleaseGlobalLock (
+ BOOLEAN Locked);
+
+UINT32
+AcpiExDigitsNeeded (
+ ACPI_INTEGER Value,
+ UINT32 Base);
+
+void
+AcpiExEisaIdToString (
+ UINT32 NumericId,
+ char *OutString);
+
+void
+AcpiExUnsignedIntegerToString (
+ ACPI_INTEGER Value,
+ char *OutString);
+
+
+/*
+ * exregion - default OpRegion handlers
+ */
+
+ACPI_STATUS
+AcpiExSystemMemorySpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExSystemIoSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExPciConfigSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExCmosSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExPciBarSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExEmbeddedControllerSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+ACPI_STATUS
+AcpiExSmBusSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+
+ACPI_STATUS
+AcpiExDataTableSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+#endif /* __INTERP_H__ */
diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h
new file mode 100644
index 0000000..e867e09
--- /dev/null
+++ b/sys/contrib/dev/acpica/aclocal.h
@@ -0,0 +1,1084 @@
+/******************************************************************************
+ *
+ * Name: aclocal.h - Internal data types used across the ACPI subsystem
+ * $Revision: 197 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACLOCAL_H__
+#define __ACLOCAL_H__
+
+
+#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */
+
+typedef void * ACPI_MUTEX;
+typedef UINT32 ACPI_MUTEX_HANDLE;
+
+
+/* Total number of aml opcodes defined */
+
+#define AML_NUM_OPCODES 0x7E
+
+
+/*****************************************************************************
+ *
+ * Mutex typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/*
+ * Predefined handles for the mutex objects used within the subsystem
+ * All mutex objects are automatically created by AcpiUtMutexInitialize.
+ *
+ * The acquire/release ordering protocol is implied via this list. Mutexes
+ * with a lower value must be acquired before mutexes with a higher value.
+ *
+ * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also!
+ */
+
+#define ACPI_MTX_EXECUTE 0
+#define ACPI_MTX_INTERPRETER 1
+#define ACPI_MTX_PARSER 2
+#define ACPI_MTX_DISPATCHER 3
+#define ACPI_MTX_TABLES 4
+#define ACPI_MTX_OP_REGIONS 5
+#define ACPI_MTX_NAMESPACE 6
+#define ACPI_MTX_EVENTS 7
+#define ACPI_MTX_HARDWARE 8
+#define ACPI_MTX_CACHES 9
+#define ACPI_MTX_MEMORY 10
+#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
+#define ACPI_MTX_DEBUG_CMD_READY 12
+
+#define MAX_MUTEX 12
+#define NUM_MUTEX MAX_MUTEX+1
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+#ifdef DEFINE_ACPI_GLOBALS
+
+/* Names for the mutexes used in the subsystem */
+
+static char *AcpiGbl_MutexNames[] =
+{
+ "ACPI_MTX_Execute",
+ "ACPI_MTX_Interpreter",
+ "ACPI_MTX_Parser",
+ "ACPI_MTX_Dispatcher",
+ "ACPI_MTX_Tables",
+ "ACPI_MTX_OpRegions",
+ "ACPI_MTX_Namespace",
+ "ACPI_MTX_Events",
+ "ACPI_MTX_Hardware",
+ "ACPI_MTX_Caches",
+ "ACPI_MTX_Memory",
+ "ACPI_MTX_DebugCmdComplete",
+ "ACPI_MTX_DebugCmdReady",
+};
+
+#endif
+#endif
+
+
+/* Table for the global mutexes */
+
+typedef struct acpi_mutex_info
+{
+ ACPI_MUTEX Mutex;
+ UINT32 UseCount;
+ UINT32 OwnerId;
+
+} ACPI_MUTEX_INFO;
+
+/* This owner ID means that the mutex is not in use (unlocked) */
+
+#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) (-1)
+
+
+/* Lock flag parameter for various interfaces */
+
+#define ACPI_MTX_DO_NOT_LOCK 0
+#define ACPI_MTX_LOCK 1
+
+
+typedef UINT16 ACPI_OWNER_ID;
+#define ACPI_OWNER_TYPE_TABLE 0x0
+#define ACPI_OWNER_TYPE_METHOD 0x1
+#define ACPI_FIRST_METHOD_ID 0x0001
+#define ACPI_FIRST_TABLE_ID 0xF000
+
+
+/* Field access granularities */
+
+#define ACPI_FIELD_BYTE_GRANULARITY 1
+#define ACPI_FIELD_WORD_GRANULARITY 2
+#define ACPI_FIELD_DWORD_GRANULARITY 4
+#define ACPI_FIELD_QWORD_GRANULARITY 8
+
+/*****************************************************************************
+ *
+ * Namespace typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/* Operational modes of the AML interpreter/scanner */
+
+typedef enum
+{
+ ACPI_IMODE_LOAD_PASS1 = 0x01,
+ ACPI_IMODE_LOAD_PASS2 = 0x02,
+ ACPI_IMODE_EXECUTE = 0x0E
+
+} ACPI_INTERPRETER_MODE;
+
+
+/*
+ * The Node describes a named object that appears in the AML
+ * An AcpiNode is used to store Nodes.
+ *
+ * DataType is used to differentiate between internal descriptors, and MUST
+ * be the first byte in this structure.
+ */
+
+typedef union acpi_name_union
+{
+ UINT32 Integer;
+ char Ascii[4];
+
+} ACPI_NAME_UNION;
+
+typedef struct acpi_namespace_node
+{
+ UINT8 Descriptor; /* Used to differentiate object descriptor types */
+ UINT8 Type; /* Type associated with this name */
+ UINT16 OwnerId;
+ ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
+
+
+ union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
+ struct acpi_namespace_node *Child; /* First child */
+ struct acpi_namespace_node *Peer; /* Next peer*/
+ UINT16 ReferenceCount; /* Current count of references and children */
+ UINT8 Flags;
+
+} ACPI_NAMESPACE_NODE;
+
+
+#define ACPI_ENTRY_NOT_FOUND NULL
+
+
+/* Node flags */
+
+#define ANOBJ_RESERVED 0x01
+#define ANOBJ_END_OF_PEER_LIST 0x02
+#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
+#define ANOBJ_METHOD_ARG 0x08
+#define ANOBJ_METHOD_LOCAL 0x10
+#define ANOBJ_METHOD_NO_RETVAL 0x20
+#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
+
+#define ANOBJ_IS_BIT_OFFSET 0x80
+
+
+/*
+ * ACPI Table Descriptor. One per ACPI table
+ */
+typedef struct acpi_table_desc
+{
+ struct acpi_table_desc *Prev;
+ struct acpi_table_desc *Next;
+ struct acpi_table_desc *InstalledDesc;
+ ACPI_TABLE_HEADER *Pointer;
+ UINT8 *AmlStart;
+ UINT64 PhysicalAddress;
+ UINT32 AmlLength;
+ ACPI_SIZE Length;
+ ACPI_OWNER_ID TableId;
+ UINT8 Type;
+ UINT8 Allocation;
+ BOOLEAN LoadedIntoNamespace;
+
+} ACPI_TABLE_DESC;
+
+typedef struct acpi_table_list
+{
+ struct acpi_table_desc *Next;
+ UINT32 Count;
+
+} ACPI_TABLE_LIST;
+
+
+typedef struct acpi_find_context
+{
+ char *SearchFor;
+ ACPI_HANDLE *List;
+ UINT32 *Count;
+
+} ACPI_FIND_CONTEXT;
+
+
+typedef struct acpi_ns_search_data
+{
+ ACPI_NAMESPACE_NODE *Node;
+
+} ACPI_NS_SEARCH_DATA;
+
+
+/*
+ * Predefined Namespace items
+ */
+typedef struct acpi_predefined_names
+{
+ char *Name;
+ UINT8 Type;
+ char *Val;
+
+} ACPI_PREDEFINED_NAMES;
+
+
+/* Object types used during package copies */
+
+
+#define ACPI_COPY_TYPE_SIMPLE 0
+#define ACPI_COPY_TYPE_PACKAGE 1
+
+/* Info structure used to convert external<->internal namestrings */
+
+typedef struct acpi_namestring_info
+{
+ char *ExternalName;
+ char *NextExternalChar;
+ char *InternalName;
+ UINT32 Length;
+ UINT32 NumSegments;
+ UINT32 NumCarats;
+ BOOLEAN FullyQualified;
+
+} ACPI_NAMESTRING_INFO;
+
+
+/* Field creation info */
+
+typedef struct acpi_create_field_info
+{
+ ACPI_NAMESPACE_NODE *RegionNode;
+ ACPI_NAMESPACE_NODE *FieldNode;
+ ACPI_NAMESPACE_NODE *RegisterNode;
+ ACPI_NAMESPACE_NODE *DataRegisterNode;
+ UINT32 BankValue;
+ UINT32 FieldBitPosition;
+ UINT32 FieldBitLength;
+ UINT8 FieldFlags;
+ UINT8 Attribute;
+ UINT8 FieldType;
+
+} ACPI_CREATE_FIELD_INFO;
+
+
+/*****************************************************************************
+ *
+ * Event typedefs and structs
+ *
+ ****************************************************************************/
+
+/* Information about a GPE, one per each GPE in an array */
+
+typedef struct acpi_gpe_event_info
+{
+ ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
+ ACPI_GPE_HANDLER Handler; /* Address of handler, if any */
+ void *Context; /* Context to be passed to handler */
+ struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
+ UINT8 Flags; /* Level or Edge */
+ UINT8 BitMask; /* This GPE within the register */
+
+} ACPI_GPE_EVENT_INFO;
+
+/* Information about a GPE register pair, one per each status/enable pair in an array */
+
+typedef struct acpi_gpe_register_info
+{
+ ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
+ ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
+ UINT8 Status; /* Current value of status reg */
+ UINT8 Enable; /* Current value of enable reg */
+ UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */
+ UINT8 BaseGpeNumber; /* Base GPE number for this register */
+
+} ACPI_GPE_REGISTER_INFO;
+
+/*
+ * Information about a GPE register block, one per each installed block --
+ * GPE0, GPE1, and one per each installed GPE Block Device.
+ */
+typedef struct acpi_gpe_block_info
+{
+ struct acpi_gpe_block_info *Previous;
+ struct acpi_gpe_block_info *Next;
+ struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
+ ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
+ ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
+ ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
+ UINT32 RegisterCount; /* Number of register pairs in block */
+ UINT8 BlockBaseNumber;/* Base GPE number for this block */
+
+} ACPI_GPE_BLOCK_INFO;
+
+/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
+
+typedef struct acpi_gpe_xrupt_info
+{
+ struct acpi_gpe_xrupt_info *Previous;
+ struct acpi_gpe_xrupt_info *Next;
+ ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
+ UINT32 InterruptLevel; /* System interrupt level */
+
+} ACPI_GPE_XRUPT_INFO;
+
+
+typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+
+/* Information about each particular fixed event */
+
+typedef struct acpi_fixed_event_handler
+{
+ ACPI_EVENT_HANDLER Handler; /* Address of handler. */
+ void *Context; /* Context to be passed to handler */
+
+} ACPI_FIXED_EVENT_HANDLER;
+
+typedef struct acpi_fixed_event_info
+{
+ UINT8 StatusRegisterId;
+ UINT8 EnableRegisterId;
+ UINT16 StatusBitMask;
+ UINT16 EnableBitMask;
+
+} ACPI_FIXED_EVENT_INFO;
+
+/* Information used during field processing */
+
+typedef struct acpi_field_info
+{
+ UINT8 SkipField;
+ UINT8 FieldFlag;
+ UINT32 PkgLength;
+
+} ACPI_FIELD_INFO;
+
+
+/*****************************************************************************
+ *
+ * Generic "state" object for stacks
+ *
+ ****************************************************************************/
+
+
+#define ACPI_CONTROL_NORMAL 0xC0
+#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
+#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
+#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
+#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
+
+
+/* Forward declarations */
+struct acpi_walk_state;
+struct acpi_obj_mutex;
+union acpi_parse_object;
+
+
+#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
+ UINT8 DataType; /* To differentiate various internal objs */\
+ UINT8 Flags; \
+ UINT16 Value; \
+ UINT16 State; \
+ UINT16 Reserved; \
+ void *Next; \
+
+typedef struct acpi_common_state
+{
+ ACPI_STATE_COMMON
+} ACPI_COMMON_STATE;
+
+
+/*
+ * Update state - used to traverse complex objects such as packages
+ */
+typedef struct acpi_update_state
+{
+ ACPI_STATE_COMMON
+ union acpi_operand_object *Object;
+
+} ACPI_UPDATE_STATE;
+
+
+/*
+ * Pkg state - used to traverse nested package structures
+ */
+typedef struct acpi_pkg_state
+{
+ ACPI_STATE_COMMON
+ union acpi_operand_object *SourceObject;
+ union acpi_operand_object *DestObject;
+ struct acpi_walk_state *WalkState;
+ void *ThisTargetObj;
+ UINT32 NumPackages;
+ UINT16 Index;
+
+} ACPI_PKG_STATE;
+
+
+/*
+ * Control state - one per if/else and while constructs.
+ * Allows nesting of these constructs
+ */
+typedef struct acpi_control_state
+{
+ ACPI_STATE_COMMON
+ union acpi_parse_object *PredicateOp;
+ UINT8 *AmlPredicateStart; /* Start of if/while predicate */
+ UINT8 *PackageEnd; /* End of if/while block */
+ UINT16 Opcode;
+
+} ACPI_CONTROL_STATE;
+
+
+/*
+ * Scope state - current scope during namespace lookups
+ */
+typedef struct acpi_scope_state
+{
+ ACPI_STATE_COMMON
+ ACPI_NAMESPACE_NODE *Node;
+
+} ACPI_SCOPE_STATE;
+
+
+typedef struct acpi_pscope_state
+{
+ ACPI_STATE_COMMON
+ union acpi_parse_object *Op; /* Current op being parsed */
+ UINT8 *ArgEnd; /* Current argument end */
+ UINT8 *PkgEnd; /* Current package end */
+ UINT32 ArgList; /* Next argument to parse */
+ UINT32 ArgCount; /* Number of fixed arguments */
+
+} ACPI_PSCOPE_STATE;
+
+
+/*
+ * Thread state - one per thread across multiple walk states. Multiple walk
+ * states are created when there are nested control methods executing.
+ */
+typedef struct acpi_thread_state
+{
+ ACPI_STATE_COMMON
+ struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
+ union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
+ UINT32 ThreadId; /* Running thread ID */
+ UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
+
+} ACPI_THREAD_STATE;
+
+
+/*
+ * Result values - used to accumulate the results of nested
+ * AML arguments
+ */
+typedef struct acpi_result_values
+{
+ ACPI_STATE_COMMON
+ union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
+ UINT8 NumResults;
+ UINT8 LastInsert;
+
+} ACPI_RESULT_VALUES;
+
+
+typedef
+ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
+ struct acpi_walk_state *WalkState,
+ union acpi_parse_object **OutOp);
+
+typedef
+ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
+ struct acpi_walk_state *WalkState);
+
+
+/*
+ * Notify info - used to pass info to the deferred notify
+ * handler/dispatcher.
+ */
+typedef struct acpi_notify_info
+{
+ ACPI_STATE_COMMON
+ ACPI_NAMESPACE_NODE *Node;
+ union acpi_operand_object *HandlerObj;
+
+} ACPI_NOTIFY_INFO;
+
+
+/* Generic state is union of structs above */
+
+typedef union acpi_generic_state
+{
+ ACPI_COMMON_STATE Common;
+ ACPI_CONTROL_STATE Control;
+ ACPI_UPDATE_STATE Update;
+ ACPI_SCOPE_STATE Scope;
+ ACPI_PSCOPE_STATE ParseScope;
+ ACPI_PKG_STATE Pkg;
+ ACPI_THREAD_STATE Thread;
+ ACPI_RESULT_VALUES Results;
+ ACPI_NOTIFY_INFO Notify;
+
+} ACPI_GENERIC_STATE;
+
+
+/*****************************************************************************
+ *
+ * Interpreter typedefs and structs
+ *
+ ****************************************************************************/
+
+typedef
+ACPI_STATUS (*ACPI_EXECUTE_OP) (
+ struct acpi_walk_state *WalkState);
+
+
+/*****************************************************************************
+ *
+ * Parser typedefs and structs
+ *
+ ****************************************************************************/
+
+/*
+ * AML opcode, name, and argument layout
+ */
+typedef struct acpi_opcode_info
+{
+#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
+ char *Name; /* Opcode name (disassembler/debug only) */
+#endif
+ UINT32 ParseArgs; /* Grammar/Parse time arguments */
+ UINT32 RuntimeArgs; /* Interpret time arguments */
+ UINT32 Flags; /* Misc flags */
+ UINT8 ObjectType; /* Corresponding internal object type */
+ UINT8 Class; /* Opcode class */
+ UINT8 Type; /* Opcode type */
+
+} ACPI_OPCODE_INFO;
+
+
+typedef union acpi_parse_value
+{
+ ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
+ UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
+ UINT32 Size; /* bytelist or field size */
+ char *String; /* NULL terminated string */
+ UINT8 *Buffer; /* buffer or string */
+ char *Name; /* NULL terminated string */
+ union acpi_parse_object *Arg; /* arguments and contained ops */
+
+} ACPI_PARSE_VALUE;
+
+
+#define ACPI_PARSE_COMMON \
+ UINT8 DataType; /* To differentiate various internal objs */\
+ UINT8 Flags; /* Type of Op */\
+ UINT16 AmlOpcode; /* AML opcode */\
+ UINT32 AmlOffset; /* Offset of declaration in AML */\
+ union acpi_parse_object *Parent; /* Parent op */\
+ union acpi_parse_object *Next; /* Next op */\
+ ACPI_DISASM_ONLY_MEMBERS (\
+ UINT8 DisasmFlags; /* Used during AML disassembly */\
+ UINT8 DisasmOpcode; /* Subtype used for disassembly */\
+ char AmlOpName[16]) /* Op name (debug only) */\
+ /* NON-DEBUG members below: */\
+ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
+ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
+
+
+#define ACPI_DASM_BUFFER 0x00
+#define ACPI_DASM_RESOURCE 0x01
+#define ACPI_DASM_STRING 0x02
+#define ACPI_DASM_UNICODE 0x03
+#define ACPI_DASM_EISAID 0x04
+#define ACPI_DASM_MATCHOP 0x05
+
+/*
+ * generic operation (for example: If, While, Store)
+ */
+typedef struct acpi_parse_obj_common
+{
+ ACPI_PARSE_COMMON
+} ACPI_PARSE_OBJ_COMMON;
+
+
+/*
+ * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
+ * and bytelists.
+ */
+typedef struct acpi_parse_obj_named
+{
+ ACPI_PARSE_COMMON
+ UINT8 *Path;
+ UINT8 *Data; /* AML body or bytelist data */
+ UINT32 Length; /* AML length */
+ UINT32 Name; /* 4-byte name or zero if no name */
+
+} ACPI_PARSE_OBJ_NAMED;
+
+
+/* The parse node is the fundamental element of the parse tree */
+
+typedef struct acpi_parse_obj_asl
+{
+ ACPI_PARSE_COMMON
+ union acpi_parse_object *Child;
+ union acpi_parse_object *ParentMethod;
+ char *Filename;
+ char *ExternalName;
+ char *Namepath;
+ char NameSeg[4];
+ UINT32 ExtraValue;
+ UINT32 Column;
+ UINT32 LineNumber;
+ UINT32 LogicalLineNumber;
+ UINT32 LogicalByteOffset;
+ UINT32 EndLine;
+ UINT32 EndLogicalLine;
+ UINT32 AcpiBtype;
+ UINT32 AmlLength;
+ UINT32 AmlSubtreeLength;
+ UINT32 FinalAmlLength;
+ UINT32 FinalAmlOffset;
+ UINT32 CompileFlags;
+ UINT16 ParseOpcode;
+ UINT8 AmlOpcodeLength;
+ UINT8 AmlPkgLenBytes;
+ UINT8 Extra;
+ char ParseOpName[12];
+
+} ACPI_PARSE_OBJ_ASL;
+
+
+typedef union acpi_parse_object
+{
+ ACPI_PARSE_OBJ_COMMON Common;
+ ACPI_PARSE_OBJ_NAMED Named;
+ ACPI_PARSE_OBJ_ASL Asl;
+
+} ACPI_PARSE_OBJECT;
+
+
+/*
+ * Parse state - one state per parser invocation and each control
+ * method.
+ */
+typedef struct acpi_parse_state
+{
+ UINT32 AmlSize;
+ UINT8 *AmlStart; /* First AML byte */
+ UINT8 *Aml; /* Next AML byte */
+ UINT8 *AmlEnd; /* (last + 1) AML byte */
+ UINT8 *PkgStart; /* Current package begin */
+ UINT8 *PkgEnd; /* Current package end */
+ union acpi_parse_object *StartOp; /* Root of parse tree */
+ struct acpi_namespace_node *StartNode;
+ union acpi_generic_state *Scope; /* Current scope */
+ union acpi_parse_object *StartScope;
+
+} ACPI_PARSE_STATE;
+
+
+/* Parse object flags */
+
+#define ACPI_PARSEOP_GENERIC 0x01
+#define ACPI_PARSEOP_NAMED 0x02
+#define ACPI_PARSEOP_DEFERRED 0x04
+#define ACPI_PARSEOP_BYTELIST 0x08
+#define ACPI_PARSEOP_IN_CACHE 0x80
+
+/* Parse object DisasmFlags */
+
+#define ACPI_PARSEOP_IGNORE 0x01
+#define ACPI_PARSEOP_PARAMLIST 0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
+#define ACPI_PARSEOP_SPECIAL 0x10
+
+
+/*****************************************************************************
+ *
+ * Hardware (ACPI registers) and PNP
+ *
+ ****************************************************************************/
+
+#define PCI_ROOT_HID_STRING "PNP0A03"
+
+typedef struct acpi_bit_register_info
+{
+ UINT8 ParentRegister;
+ UINT8 BitPosition;
+ UINT16 AccessBitMask;
+
+} ACPI_BIT_REGISTER_INFO;
+
+
+/*
+ * Register IDs
+ * These are the full ACPI registers
+ */
+#define ACPI_REGISTER_PM1_STATUS 0x01
+#define ACPI_REGISTER_PM1_ENABLE 0x02
+#define ACPI_REGISTER_PM1_CONTROL 0x03
+#define ACPI_REGISTER_PM1A_CONTROL 0x04
+#define ACPI_REGISTER_PM1B_CONTROL 0x05
+#define ACPI_REGISTER_PM2_CONTROL 0x06
+#define ACPI_REGISTER_PM_TIMER 0x07
+#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
+#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
+
+
+/* Masks used to access the BitRegisters */
+
+#define ACPI_BITMASK_TIMER_STATUS 0x0001
+#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
+#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
+#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
+#define ACPI_BITMASK_WAKE_STATUS 0x8000
+
+#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
+ ACPI_BITMASK_BUS_MASTER_STATUS | \
+ ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
+ ACPI_BITMASK_POWER_BUTTON_STATUS | \
+ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
+ ACPI_BITMASK_RT_CLOCK_STATUS | \
+ ACPI_BITMASK_WAKE_STATUS)
+
+#define ACPI_BITMASK_TIMER_ENABLE 0x0001
+#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
+#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
+
+#define ACPI_BITMASK_SCI_ENABLE 0x0001
+#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
+#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
+#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
+#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
+
+#define ACPI_BITMASK_ARB_DISABLE 0x0001
+
+
+/* Raw bit position of each BitRegister */
+
+#define ACPI_BITPOSITION_TIMER_STATUS 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
+#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
+#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
+
+#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
+#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
+
+#define ACPI_BITPOSITION_SCI_ENABLE 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
+#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
+#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
+#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
+
+#define ACPI_BITPOSITION_ARB_DISABLE 0x00
+
+
+/*****************************************************************************
+ *
+ * Resource descriptors
+ *
+ ****************************************************************************/
+
+
+/* ResourceType values */
+
+#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
+#define ACPI_RESOURCE_TYPE_IO_RANGE 1
+#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
+
+/* Resource descriptor types and masks */
+
+#define ACPI_RDESC_TYPE_LARGE 0x80
+#define ACPI_RDESC_TYPE_SMALL 0x00
+
+#define ACPI_RDESC_TYPE_MASK 0x80
+#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
+
+
+/*
+ * Small resource descriptor types
+ * Note: The 3 length bits (2:0) must be zero
+ */
+#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
+#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
+#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
+#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
+#define ACPI_RDESC_TYPE_IO_PORT 0x40
+#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
+#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
+#define ACPI_RDESC_TYPE_END_TAG 0x78
+
+/*
+ * Large resource descriptor types
+ */
+
+#define ACPI_RDESC_TYPE_MEMORY_24 0x81
+#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
+#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
+#define ACPI_RDESC_TYPE_MEMORY_32 0x85
+#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
+#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
+#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
+#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
+#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
+
+
+/*****************************************************************************
+ *
+ * Miscellaneous
+ *
+ ****************************************************************************/
+
+#define ACPI_ASCII_ZERO 0x30
+
+
+/*****************************************************************************
+ *
+ * Debugger
+ *
+ ****************************************************************************/
+
+typedef struct acpi_db_method_info
+{
+ ACPI_HANDLE ThreadGate;
+ char *Name;
+ char **Args;
+ UINT32 Flags;
+ UINT32 NumLoops;
+ char Pathname[128];
+
+} ACPI_DB_METHOD_INFO;
+
+typedef struct acpi_integrity_info
+{
+ UINT32 Nodes;
+ UINT32 Objects;
+
+} ACPI_INTEGRITY_INFO;
+
+
+#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
+#define ACPI_DB_CONSOLE_OUTPUT 0x02
+#define ACPI_DB_DUPLICATE_OUTPUT 0x03
+
+
+/*****************************************************************************
+ *
+ * Debug
+ *
+ ****************************************************************************/
+
+typedef struct acpi_debug_print_info
+{
+ UINT32 ComponentId;
+ char *ProcName;
+ char *ModuleName;
+
+} ACPI_DEBUG_PRINT_INFO;
+
+
+/* Entry for a memory allocation (debug only) */
+
+#define ACPI_MEM_MALLOC 0
+#define ACPI_MEM_CALLOC 1
+#define ACPI_MAX_MODULE_NAME 16
+
+#define ACPI_COMMON_DEBUG_MEM_HEADER \
+ struct acpi_debug_mem_block *Previous; \
+ struct acpi_debug_mem_block *Next; \
+ UINT32 Size; \
+ UINT32 Component; \
+ UINT32 Line; \
+ char Module[ACPI_MAX_MODULE_NAME]; \
+ UINT8 AllocType;
+
+typedef struct acpi_debug_mem_header
+{
+ ACPI_COMMON_DEBUG_MEM_HEADER
+
+} ACPI_DEBUG_MEM_HEADER;
+
+typedef struct acpi_debug_mem_block
+{
+ ACPI_COMMON_DEBUG_MEM_HEADER
+ UINT64 UserSpace;
+
+} ACPI_DEBUG_MEM_BLOCK;
+
+
+#define ACPI_MEM_LIST_GLOBAL 0
+#define ACPI_MEM_LIST_NSNODE 1
+
+#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2
+#define ACPI_MEM_LIST_STATE 2
+#define ACPI_MEM_LIST_PSNODE 3
+#define ACPI_MEM_LIST_PSNODE_EXT 4
+#define ACPI_MEM_LIST_OPERAND 5
+#define ACPI_MEM_LIST_WALK 6
+#define ACPI_MEM_LIST_MAX 6
+#define ACPI_NUM_MEM_LISTS 7
+
+
+typedef struct acpi_memory_list
+{
+ void *ListHead;
+ UINT16 LinkOffset;
+ UINT16 MaxCacheDepth;
+ UINT16 CacheDepth;
+ UINT16 ObjectSize;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+ /* Statistics for debug memory tracking only */
+
+ UINT32 TotalAllocated;
+ UINT32 TotalFreed;
+ UINT32 CurrentTotalSize;
+ UINT32 CacheRequests;
+ UINT32 CacheHits;
+ char *ListName;
+#endif
+
+} ACPI_MEMORY_LIST;
+
+
+#endif /* __ACLOCAL_H__ */
diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h
new file mode 100644
index 0000000..a0212aa
--- /dev/null
+++ b/sys/contrib/dev/acpica/acmacros.h
@@ -0,0 +1,763 @@
+/******************************************************************************
+ *
+ * Name: acmacros.h - C macros for the entire subsystem.
+ * $Revision: 145 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACMACROS_H__
+#define __ACMACROS_H__
+
+
+/*
+ * Data manipulation macros
+ */
+
+#define ACPI_LOWORD(l) ((UINT16)(UINT32)(l))
+#define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF))
+#define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l))
+#define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF))
+
+
+#if ACPI_MACHINE_WIDTH == 16
+
+/*
+ * For 16-bit addresses, we have to assume that the upper 32 bits
+ * are zero.
+ */
+#define ACPI_LODWORD(l) ((UINT32)(l))
+#define ACPI_HIDWORD(l) ((UINT32)(0))
+
+#define ACPI_GET_ADDRESS(a) ((a).Lo)
+#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);}
+#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo)
+
+#else
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+/*
+ * ACPI_INTEGER is 32-bits, no 64-bit support on this platform
+ */
+#define ACPI_LODWORD(l) ((UINT32)(l))
+#define ACPI_HIDWORD(l) ((UINT32)(0))
+
+#define ACPI_GET_ADDRESS(a) (a)
+#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
+#define ACPI_VALID_ADDRESS(a) (a)
+
+#else
+
+/*
+ * Full 64-bit address/integer on both 32-bit and 64-bit platforms
+ */
+#define ACPI_LODWORD(l) ((UINT32)(UINT64)(l))
+#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi))
+
+#define ACPI_GET_ADDRESS(a) (a)
+#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b))
+#define ACPI_VALID_ADDRESS(a) (a)
+#endif
+#endif
+
+ /*
+ * Extract a byte of data using a pointer. Any more than a byte and we
+ * get into potential aligment issues -- see the STORE macros below
+ */
+#define ACPI_GET8(addr) (*(UINT8*)(addr))
+
+/* Pointer arithmetic */
+
+#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b))
+#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b))
+
+/* Pointer/Integer type conversions */
+
+#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(ACPI_NATIVE_UINT)i)
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
+#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
+#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
+
+#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
+#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
+
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
+#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
+#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i)
+#else
+#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
+#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
+#endif
+
+/*
+ * Macros for moving data around to/from buffers that are possibly unaligned.
+ * If the hardware supports the transfer of unaligned data, just do the store.
+ * Otherwise, we have to move one byte at a time.
+ */
+
+#ifdef ACPI_BIG_ENDIAN
+/*
+ * Macros for big-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the end of the buffer */
+
+#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) ((BufLen) - (((BufOffset)+1) * (ByteGran)))
+
+/* These macros reverse the bytes during the move, converting little-endian to big endian */
+
+ /* Big Endian <== Little Endian */
+ /* Hi...Lo Lo...Hi */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
+ ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
+ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+
+#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\
+ (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
+#else
+/*
+ * Macros for little-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the beginning of the buffer */
+
+#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset)
+
+#ifdef ACPI_MISALIGNED_TRANSFERS
+
+/* The hardware supports unaligned transfers, just do the little-endian move */
+
+#if ACPI_MACHINE_WIDTH == 16
+
+/* No 64-bit integers */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
+
+#else
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
+#endif
+
+#else
+/*
+ * The hardware does not support unaligned transfers. We must move the
+ * data one byte at a time. These macros work whether the source or
+ * the destination (or both) is/are unaligned. (Little-endian move)
+ */
+
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
+
+#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];}
+
+#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\
+ (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\
+ (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\
+ (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];}
+#endif
+#endif
+
+/* Macros based on machine integer width */
+
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
+
+#elif ACPI_MACHINE_WIDTH == 32
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
+
+#elif ACPI_MACHINE_WIDTH == 64
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s)
+
+#else
+#error unknown ACPI_MACHINE_WIDTH
+#endif
+
+
+/*
+ * Fast power-of-two math macros for non-optimized compilers
+ */
+
+#define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2)))
+#define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2)))
+#define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1)))
+
+#define ACPI_DIV_2(a) _ACPI_DIV(a,1)
+#define ACPI_MUL_2(a) _ACPI_MUL(a,1)
+#define ACPI_MOD_2(a) _ACPI_MOD(a,2)
+
+#define ACPI_DIV_4(a) _ACPI_DIV(a,2)
+#define ACPI_MUL_4(a) _ACPI_MUL(a,2)
+#define ACPI_MOD_4(a) _ACPI_MOD(a,4)
+
+#define ACPI_DIV_8(a) _ACPI_DIV(a,3)
+#define ACPI_MUL_8(a) _ACPI_MUL(a,3)
+#define ACPI_MOD_8(a) _ACPI_MOD(a,8)
+
+#define ACPI_DIV_16(a) _ACPI_DIV(a,4)
+#define ACPI_MUL_16(a) _ACPI_MUL(a,4)
+#define ACPI_MOD_16(a) _ACPI_MOD(a,16)
+
+
+/*
+ * Rounding macros (Power of two boundaries only)
+ */
+#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & (~(((ACPI_NATIVE_UINT) boundary)-1)))
+#define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + (((ACPI_NATIVE_UINT) boundary)-1)) & (~(((ACPI_NATIVE_UINT) boundary)-1)))
+
+#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+
+#define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+
+
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
+
+#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
+
+/* Generic (non-power-of-two) rounding */
+
+#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
+
+/*
+ * Bitmask creation
+ * Bit positions start at zero.
+ * MASK_BITS_ABOVE creates a mask starting AT the position and above
+ * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ */
+#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position))))
+#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position)))
+
+#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
+
+/* Macros for GAS addressing */
+
+#if ACPI_MACHINE_WIDTH != 16
+
+#define ACPI_PCI_DEVICE(a) (UINT16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF)
+#define ACPI_PCI_FUNCTION(a) (UINT16) ((ACPI_LODWORD ((a))) >> 16)
+#define ACPI_PCI_REGISTER(a) (UINT16) ((ACPI_LODWORD ((a))) & 0x0000FFFF)
+
+#else
+
+/* No support for GAS and PCI IDs in 16-bit mode */
+
+#define ACPI_PCI_FUNCTION(a) (UINT16) ((a) & 0xFFFF0000)
+#define ACPI_PCI_DEVICE(a) (UINT16) ((a) & 0x0000FFFF)
+#define ACPI_PCI_REGISTER(a) (UINT16) ((a) & 0x0000FFFF)
+
+#endif
+
+
+/* Bitfields within ACPI registers */
+
+#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
+#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
+
+/*
+ * An ACPI_NAMESPACE_NODE * can appear in some contexts,
+ * where a pointer to an ACPI_OPERAND_OBJECT can also
+ * appear. This macro is used to distinguish them.
+ *
+ * The "Descriptor" field is the first field in both structures.
+ */
+#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t)
+
+
+/* Macro to test the object type */
+
+#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type)
+
+/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
+
+#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
+
+/*
+ * Macros for the master AML opcode table
+ */
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
+#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type}
+#else
+#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type}
+#endif
+
+#ifdef ACPI_DISASSEMBLER
+#define ACPI_DISASM_ONLY_MEMBERS(a) a;
+#else
+#define ACPI_DISASM_ONLY_MEMBERS(a)
+#endif
+
+#define ARG_TYPE_WIDTH 5
+#define ARG_1(x) ((UINT32)(x))
+#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH))
+#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH))
+#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH))
+#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH))
+#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH))
+
+#define ARGI_LIST1(a) (ARG_1(a))
+#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a))
+#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
+#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
+#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
+#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
+
+#define ARGP_LIST1(a) (ARG_1(a))
+#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b))
+#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
+#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
+#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
+#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
+
+#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F))
+#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH))
+
+
+/*
+ * Reporting macros that are never compiled out
+ */
+
+#define ACPI_PARAM_LIST(pl) pl
+
+/*
+ * Error reporting. These versions add callers module and line#. Since
+ * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
+ * use it in debug mode.
+ */
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+
+#else
+
+#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError("ACPI",__LINE__,_COMPONENT, s, e);
+
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError("ACPI",__LINE__,_COMPONENT, s, n, p, e);
+
+#endif
+
+/* Error reporting. These versions pass thru the module and line# */
+
+#define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+
+/*
+ * Debug macros that are conditionally compiled
+ */
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
+
+/*
+ * Function entry tracing.
+ * The first parameter should be the procedure name as a quoted string. This is declared
+ * as a local string ("_ProcName) so that it can be also used by the function exit macros below.
+ */
+
+#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \
+ _Dbg.ComponentId = _COMPONENT; \
+ _Dbg.ProcName = a; \
+ _Dbg.ModuleName = _THIS_MODULE;
+
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTrace(__LINE__,&_Dbg)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
+
+/*
+ * Function exit tracing.
+ * WARNING: These macros include a return statement. This is usually considered
+ * bad form, but having a separate exit macro is very ugly and difficult to maintain.
+ * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
+ * so that "_ProcName" is defined.
+ */
+#ifdef ACPI_USE_DO_WHILE_0
+#define ACPI_DO_WHILE0(a) do a while(0)
+#else
+#define ACPI_DO_WHILE0(a) a
+#endif
+
+#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_Dbg);return;})
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_Dbg,(s));return((s));})
+#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_Dbg,(ACPI_INTEGER)(s));return((s));})
+#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_Dbg,(UINT8 *)(s));return((s));})
+
+/* Conditional execution */
+
+#define ACPI_DEBUG_EXEC(a) a
+#define ACPI_NORMAL_EXEC(a)
+
+#define ACPI_DEBUG_DEFINE(a) a;
+#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
+#define _VERBOSE_STRUCTURES
+
+
+/* Stack and buffer dumping */
+
+#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+
+
+#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)
+#define ACPI_DUMP_TABLES(a,b) AcpiNsDumpTables(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a)
+#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a))
+
+
+/*
+ * Generate INT3 on ACPI_ERROR (Debug only!)
+ */
+
+#define ACPI_ERROR_BREAK
+#ifdef ACPI_ERROR_BREAK
+#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
+ AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
+#else
+#define ACPI_BREAK_ON_ERROR(lvl)
+#endif
+
+/*
+ * Master debug print macros
+ * Print iff:
+ * 1) Debug print for the current component is enabled
+ * 2) Debug error level or trace level for the print statement is enabled
+ */
+
+#define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl)
+
+
+#else
+/*
+ * This is the non-debug case -- make everything go away,
+ * leaving no executable debug code!
+ */
+
+#define ACPI_MODULE_NAME(name)
+#define _THIS_MODULE ""
+
+#define ACPI_DEBUG_EXEC(a)
+#define ACPI_NORMAL_EXEC(a) a;
+
+#define ACPI_DEBUG_DEFINE(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#define ACPI_FUNCTION_NAME(a)
+#define ACPI_FUNCTION_TRACE(a)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)
+#define ACPI_FUNCTION_EXIT
+#define ACPI_FUNCTION_STATUS_EXIT(s)
+#define ACPI_FUNCTION_VALUE_EXIT(s)
+#define ACPI_FUNCTION_ENTRY()
+#define ACPI_DUMP_STACK_ENTRY(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
+#define ACPI_DUMP_ENTRY(a,b)
+#define ACPI_DUMP_TABLES(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a)
+#define ACPI_DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_PRINT(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)
+#define ACPI_BREAK_MSG(a)
+
+#define return_VOID return
+#define return_ACPI_STATUS(s) return(s)
+#define return_VALUE(s) return(s)
+#define return_PTR(s) return(s)
+
+#endif
+
+/*
+ * Some code only gets executed when the debugger is built in.
+ * Note that this is entirely independent of whether the
+ * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
+ */
+#ifdef ACPI_DEBUGGER
+#define ACPI_DEBUGGER_EXEC(a) a
+#else
+#define ACPI_DEBUGGER_EXEC(a)
+#endif
+
+
+/*
+ * For 16-bit code, we want to shrink some things even though
+ * we are using ACPI_DEBUG_OUTPUT to get the debug output
+ */
+#if ACPI_MACHINE_WIDTH == 16
+#undef ACPI_DEBUG_ONLY_MEMBERS
+#undef _VERBOSE_STRUCTURES
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#endif
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+/*
+ * 1) Set name to blanks
+ * 2) Copy the object name
+ */
+#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\
+ ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name))
+#else
+
+#define ACPI_ADD_OBJECT_NAME(a,b)
+#endif
+
+
+/*
+ * Memory allocation tracking (DEBUG ONLY)
+ */
+
+#ifndef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a) AcpiOsFree(a)
+#define ACPI_MEM_TRACKING(a)
+
+
+#else
+
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_TRACKING(a) a
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
+
+#define ACPI_GET_STACK_POINTER _asm {mov eax, ebx}
+
+#endif /* ACMACROS_H */
diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h
new file mode 100644
index 0000000..ed1ec33
--- /dev/null
+++ b/sys/contrib/dev/acpica/acnamesp.h
@@ -0,0 +1,586 @@
+/******************************************************************************
+ *
+ * Name: acnamesp.h - Namespace subcomponent prototypes and defines
+ * $Revision: 134 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACNAMESP_H__
+#define __ACNAMESP_H__
+
+
+/* To search the entire name space, pass this as SearchBase */
+
+#define ACPI_NS_ALL ((ACPI_HANDLE)0)
+
+/*
+ * Elements of AcpiNsProperties are bit significant
+ * and should be one-to-one with values of ACPI_OBJECT_TYPE
+ */
+#define ACPI_NS_NORMAL 0
+#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
+#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
+
+
+/* Definitions of the predefined namespace names */
+
+#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */
+#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */
+#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */
+
+#define ACPI_NS_ROOT_PATH "\\"
+#define ACPI_NS_SYSTEM_BUS "_SB_"
+
+
+/* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */
+
+#define ACPI_NS_NO_UPSEARCH 0
+#define ACPI_NS_SEARCH_PARENT 0x01
+#define ACPI_NS_DONT_OPEN_SCOPE 0x02
+#define ACPI_NS_NO_PEER_SEARCH 0x04
+#define ACPI_NS_ERROR_IF_FOUND 0x08
+
+#define ACPI_NS_WALK_UNLOCK TRUE
+#define ACPI_NS_WALK_NO_UNLOCK FALSE
+
+
+ACPI_STATUS
+AcpiNsLoadNamespace (
+ void);
+
+ACPI_STATUS
+AcpiNsInitializeObjects (
+ void);
+
+ACPI_STATUS
+AcpiNsInitializeDevices (
+ void);
+
+
+/* Namespace init - nsxfinit */
+
+ACPI_STATUS
+AcpiNsInitOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiNsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+
+ACPI_STATUS
+AcpiNsWalkNamespace (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE StartObject,
+ UINT32 MaxDepth,
+ BOOLEAN UnlockBeforeCallback,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextNode (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE *Parent,
+ ACPI_NAMESPACE_NODE *Child);
+
+void
+AcpiNsDeleteNamespaceByOwner (
+ UINT16 TableId);
+
+
+/* Namespace loading - nsload */
+
+ACPI_STATUS
+AcpiNsOneCompleteParse (
+ UINT32 PassNumber,
+ ACPI_TABLE_DESC *TableDesc);
+
+ACPI_STATUS
+AcpiNsParseTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *Scope);
+
+ACPI_STATUS
+AcpiNsLoadTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *Node);
+
+ACPI_STATUS
+AcpiNsLoadTableByType (
+ ACPI_TABLE_TYPE TableType);
+
+
+/*
+ * Top-level namespace access - nsaccess
+ */
+
+ACPI_STATUS
+AcpiNsRootInitialize (
+ void);
+
+ACPI_STATUS
+AcpiNsLookup (
+ ACPI_GENERIC_STATE *ScopeInfo,
+ char *Name,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ UINT32 Flags,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE **RetNode);
+
+
+/*
+ * Named object allocation/deallocation - nsalloc
+ */
+
+ACPI_NAMESPACE_NODE *
+AcpiNsCreateNode (
+ UINT32 Name);
+
+void
+AcpiNsDeleteNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+void
+AcpiNsDeleteNamespaceSubtree (
+ ACPI_NAMESPACE_NODE *ParentHandle);
+
+void
+AcpiNsDetachObject (
+ ACPI_NAMESPACE_NODE *Node);
+
+void
+AcpiNsDeleteChildren (
+ ACPI_NAMESPACE_NODE *Parent);
+
+int
+AcpiNsCompareNames (
+ char *Name1,
+ char *Name2);
+
+void
+AcpiNsRemoveReference (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+/*
+ * Namespace modification - nsmodify
+ */
+
+ACPI_STATUS
+AcpiNsUnloadNamespace (
+ ACPI_HANDLE Handle);
+
+ACPI_STATUS
+AcpiNsDeleteSubtree (
+ ACPI_HANDLE StartHandle);
+
+
+/*
+ * Namespace dump/print utilities - nsdump
+ */
+
+void
+AcpiNsDumpTables (
+ ACPI_HANDLE SearchBase,
+ UINT32 MaxDepth);
+
+void
+AcpiNsDumpEntry (
+ ACPI_HANDLE Handle,
+ UINT32 DebugLevel);
+
+void
+AcpiNsDumpPathname (
+ ACPI_HANDLE Handle,
+ char *Msg,
+ UINT32 Level,
+ UINT32 Component);
+
+void
+AcpiNsPrintPathname (
+ UINT32 NumSegments,
+ char *Pathname);
+
+ACPI_STATUS
+AcpiNsDumpOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+void
+AcpiNsDumpRootDevices (
+ void);
+
+ACPI_STATUS
+AcpiNsDumpOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+void
+AcpiNsDumpObjects (
+ ACPI_OBJECT_TYPE Type,
+ UINT8 DisplayType,
+ UINT32 MaxDepth,
+ UINT32 OwnderId,
+ ACPI_HANDLE StartHandle);
+
+
+/*
+ * Namespace evaluation functions - nseval
+ */
+
+ACPI_STATUS
+AcpiNsEvaluateByHandle (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+ACPI_STATUS
+AcpiNsEvaluateByName (
+ char *Pathname,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+ACPI_STATUS
+AcpiNsEvaluateRelative (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ char *Pathname,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+ACPI_STATUS
+AcpiNsExecuteControlMethod (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc);
+
+ACPI_STATUS
+AcpiNsGetObjectValue (
+ ACPI_NAMESPACE_NODE *ObjectNode,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc);
+
+
+/*
+ * Parent/Child/Peer utility functions
+ */
+
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *NodeToSearch);
+
+
+/*
+ * Name and Scope manipulation - nsnames
+ */
+
+UINT32
+AcpiNsOpensScope (
+ ACPI_OBJECT_TYPE Type);
+
+void
+AcpiNsBuildExternalPath (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_SIZE Size,
+ char *NameBuffer);
+
+char *
+AcpiNsGetExternalPathname (
+ ACPI_NAMESPACE_NODE *Node);
+
+char *
+AcpiNsNameOfCurrentScope (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiNsHandleToPathname (
+ ACPI_HANDLE TargetHandle,
+ ACPI_BUFFER *Buffer);
+
+BOOLEAN
+AcpiNsPatternMatch (
+ ACPI_NAMESPACE_NODE *ObjNode,
+ char *SearchFor);
+
+ACPI_STATUS
+AcpiNsGetNodeByPath (
+ char *ExternalPathname,
+ ACPI_NAMESPACE_NODE *InPrefixNode,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **OutNode);
+
+ACPI_SIZE
+AcpiNsGetPathnameLength (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+/*
+ * Object management for namespace nodes - nsobject
+ */
+
+ACPI_STATUS
+AcpiNsAttachObject (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_OBJECT_TYPE Type);
+
+ACPI_OPERAND_OBJECT *
+AcpiNsGetAttachedObject (
+ ACPI_NAMESPACE_NODE *Node);
+
+ACPI_OPERAND_OBJECT *
+AcpiNsGetSecondaryObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+ACPI_STATUS
+AcpiNsAttachData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler,
+ void *Data);
+
+ACPI_STATUS
+AcpiNsDetachData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler);
+
+ACPI_STATUS
+AcpiNsGetAttachedData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler,
+ void **Data);
+
+
+/*
+ * Namespace searching and entry - nssearch
+ */
+
+ACPI_STATUS
+AcpiNsSearchAndEnter (
+ UINT32 EntryName,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **RetNode);
+
+ACPI_STATUS
+AcpiNsSearchNode (
+ UINT32 EntryName,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE **RetNode);
+
+void
+AcpiNsInstallNode (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type);
+
+
+/*
+ * Utility functions - nsutils
+ */
+
+BOOLEAN
+AcpiNsValidRootPrefix (
+ char Prefix);
+
+BOOLEAN
+AcpiNsValidPathSeparator (
+ char Sep);
+
+ACPI_OBJECT_TYPE
+AcpiNsGetType (
+ ACPI_NAMESPACE_NODE *Node);
+
+UINT32
+AcpiNsLocal (
+ ACPI_OBJECT_TYPE Type);
+
+void
+AcpiNsReportError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ char *InternalName,
+ ACPI_STATUS LookupStatus);
+
+void
+AcpiNsReportMethodError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ char *Message,
+ ACPI_NAMESPACE_NODE *Node,
+ char *Path,
+ ACPI_STATUS LookupStatus);
+
+void
+AcpiNsPrintNodePathname (
+ ACPI_NAMESPACE_NODE *Node,
+ char *Msg);
+
+ACPI_STATUS
+AcpiNsBuildInternalName (
+ ACPI_NAMESTRING_INFO *Info);
+
+void
+AcpiNsGetInternalNameLength (
+ ACPI_NAMESTRING_INFO *Info);
+
+ACPI_STATUS
+AcpiNsInternalizeName (
+ char *DottedName,
+ char **ConvertedName);
+
+ACPI_STATUS
+AcpiNsExternalizeName (
+ UINT32 InternalNameLength,
+ char *InternalName,
+ UINT32 *ConvertedNameLength,
+ char **ConvertedName);
+
+ACPI_NAMESPACE_NODE *
+AcpiNsMapHandleToNode (
+ ACPI_HANDLE Handle);
+
+ACPI_HANDLE
+AcpiNsConvertEntryToHandle(
+ ACPI_NAMESPACE_NODE *Node);
+
+void
+AcpiNsTerminate (
+ void);
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetParentNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextValidNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+#endif /* __ACNAMESP_H__ */
diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h
new file mode 100644
index 0000000..5abe983
--- /dev/null
+++ b/sys/contrib/dev/acpica/acobject.h
@@ -0,0 +1,592 @@
+
+/******************************************************************************
+ *
+ * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
+ * $Revision: 120 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef _ACOBJECT_H
+#define _ACOBJECT_H
+
+
+/*
+ * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
+ * to the interpreter, and to keep track of the various handlers such as
+ * address space handlers and notify handlers. The object is a constant
+ * size in order to allow it to be cached and reused.
+ */
+
+/*******************************************************************************
+ *
+ * Common Descriptors
+ *
+ ******************************************************************************/
+
+/*
+ * Common area for all objects.
+ *
+ * DataType is used to differentiate between internal descriptors, and MUST
+ * be the first byte in this structure.
+ */
+#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
+ UINT8 Descriptor; /* To differentiate various internal objs */\
+ UINT8 Type; /* ACPI_OBJECT_TYPE */\
+ UINT16 ReferenceCount; /* For object deletion management */\
+ union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
+ UINT8 Flags; \
+
+/* Values for flag byte above */
+
+#define AOPOBJ_AML_CONSTANT 0x01
+#define AOPOBJ_STATIC_POINTER 0x02
+#define AOPOBJ_DATA_VALID 0x04
+#define AOPOBJ_OBJECT_INITIALIZED 0x08
+#define AOPOBJ_SETUP_COMPLETE 0x10
+#define AOPOBJ_SINGLE_DATUM 0x20
+
+
+/*
+ * Common bitfield for the field objects
+ * "Field Datum" -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ */
+#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
+ UINT8 FieldFlags; /* Access, update, and lock bits */\
+ UINT8 Attribute; /* From AccessAs keyword */\
+ UINT8 AccessByteWidth; /* Read/Write size in bytes */\
+ UINT32 BitLength; /* Length of field in bits */\
+ UINT32 BaseByteOffset; /* Byte offset within containing object */\
+ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
+ UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\
+ UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\
+ UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\
+ UINT32 Value; /* Value to store into the Bank or Index register */\
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
+
+
+/*
+ * Fields common to both Strings and Buffers
+ */
+#define ACPI_COMMON_BUFFER_INFO \
+ UINT32 Length;
+
+
+/*
+ * Common fields for objects that support ASL notifications
+ */
+#define ACPI_COMMON_NOTIFY_INFO \
+ union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
+ union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *AddressSpace; /* Handler for Address space */
+
+
+/******************************************************************************
+ *
+ * Basic data types
+ *
+ *****************************************************************************/
+
+typedef struct acpi_object_common
+{
+ ACPI_OBJECT_COMMON_HEADER
+
+} ACPI_OBJECT_COMMON;
+
+
+typedef struct acpi_object_integer
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_INTEGER Value;
+
+} ACPI_OBJECT_INTEGER;
+
+
+typedef struct acpi_object_string /* Null terminated, ASCII characters only */
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_BUFFER_INFO
+ char *Pointer; /* String in AML stream or allocated string */
+
+} ACPI_OBJECT_STRING;
+
+
+typedef struct acpi_object_buffer
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_BUFFER_INFO
+ UINT8 *Pointer; /* Buffer in AML stream or allocated buffer */
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
+
+} ACPI_OBJECT_BUFFER;
+
+
+typedef struct acpi_object_package
+{
+ ACPI_OBJECT_COMMON_HEADER
+
+ UINT32 Count; /* # of elements in package */
+ UINT32 AmlLength;
+ UINT8 *AmlStart;
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
+ union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */
+
+} ACPI_OBJECT_PACKAGE;
+
+
+/******************************************************************************
+ *
+ * Complex data types
+ *
+ *****************************************************************************/
+
+typedef struct acpi_object_event
+{
+ ACPI_OBJECT_COMMON_HEADER
+ void *Semaphore;
+
+} ACPI_OBJECT_EVENT;
+
+
+#define INFINITE_CONCURRENCY 0xFF
+
+typedef struct acpi_object_method
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 MethodFlags;
+ UINT8 ParamCount;
+ UINT32 AmlLength;
+ void *Semaphore;
+ UINT8 *AmlStart;
+ UINT8 Concurrency;
+ UINT8 ThreadCount;
+ ACPI_OWNER_ID OwningId;
+
+} ACPI_OBJECT_METHOD;
+
+
+typedef struct acpi_object_mutex
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT16 SyncLevel;
+ UINT16 AcquisitionDepth;
+ struct acpi_thread_state *OwnerThread;
+ void *Semaphore;
+ union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
+ union acpi_operand_object *Next; /* Link for list of acquired mutexes */
+ ACPI_NAMESPACE_NODE *Node; /* containing object */
+
+} ACPI_OBJECT_MUTEX;
+
+
+typedef struct acpi_object_region
+{
+ ACPI_OBJECT_COMMON_HEADER
+
+ UINT8 SpaceId;
+ union acpi_operand_object *AddressSpace; /* Handler for region access */
+ ACPI_NAMESPACE_NODE *Node; /* containing object */
+ union acpi_operand_object *Next;
+ UINT32 Length;
+ ACPI_PHYSICAL_ADDRESS Address;
+
+} ACPI_OBJECT_REGION;
+
+
+/******************************************************************************
+ *
+ * Objects that can be notified. All share a common NotifyInfo area.
+ *
+ *****************************************************************************/
+
+typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_NOTIFY_INFO
+
+} ACPI_OBJECT_NOTIFY_COMMON;
+
+
+typedef struct acpi_object_device
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_NOTIFY_INFO
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+} ACPI_OBJECT_DEVICE;
+
+
+typedef struct acpi_object_power_resource
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_NOTIFY_INFO
+ UINT32 SystemLevel;
+ UINT32 ResourceOrder;
+
+} ACPI_OBJECT_POWER_RESOURCE;
+
+
+typedef struct acpi_object_processor
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_NOTIFY_INFO
+ UINT32 ProcId;
+ UINT32 Length;
+ ACPI_IO_ADDRESS Address;
+
+} ACPI_OBJECT_PROCESSOR;
+
+
+typedef struct acpi_object_thermal_zone
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_NOTIFY_INFO
+
+} ACPI_OBJECT_THERMAL_ZONE;
+
+
+/******************************************************************************
+ *
+ * Fields. All share a common header/info field.
+ *
+ *****************************************************************************/
+
+typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_FIELD_INFO
+ union acpi_operand_object *RegionObj; /* Containing Operation Region object */
+ /* (REGION/BANK fields only) */
+} ACPI_OBJECT_FIELD_COMMON;
+
+
+typedef struct acpi_object_region_field
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_FIELD_INFO
+ union acpi_operand_object *RegionObj; /* Containing OpRegion object */
+
+} ACPI_OBJECT_REGION_FIELD;
+
+
+typedef struct acpi_object_bank_field
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_FIELD_INFO
+ union acpi_operand_object *RegionObj; /* Containing OpRegion object */
+ union acpi_operand_object *BankObj; /* BankSelect Register object */
+
+} ACPI_OBJECT_BANK_FIELD;
+
+
+typedef struct acpi_object_index_field
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_FIELD_INFO
+
+ /*
+ * No "RegionObj" pointer needed since the Index and Data registers
+ * are each field definitions unto themselves.
+ */
+ union acpi_operand_object *IndexObj; /* Index register */
+ union acpi_operand_object *DataObj; /* Data register */
+
+} ACPI_OBJECT_INDEX_FIELD;
+
+
+/* The BufferField is different in that it is part of a Buffer, not an OpRegion */
+
+typedef struct acpi_object_buffer_field
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_COMMON_FIELD_INFO
+ union acpi_operand_object *BufferObj; /* Containing Buffer object */
+
+} ACPI_OBJECT_BUFFER_FIELD;
+
+
+/******************************************************************************
+ *
+ * Objects for handlers
+ *
+ *****************************************************************************/
+
+typedef struct acpi_object_notify_handler
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_NAMESPACE_NODE *Node; /* Parent device */
+ ACPI_NOTIFY_HANDLER Handler;
+ void *Context;
+
+} ACPI_OBJECT_NOTIFY_HANDLER;
+
+
+/* Flags for address handler */
+
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
+
+
+typedef struct acpi_object_addr_handler
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 SpaceId;
+ UINT16 Hflags;
+ ACPI_ADR_SPACE_HANDLER Handler;
+ ACPI_NAMESPACE_NODE *Node; /* Parent device */
+ void *Context;
+ ACPI_ADR_SPACE_SETUP Setup;
+ union acpi_operand_object *RegionList; /* regions using this handler */
+ union acpi_operand_object *Next;
+
+} ACPI_OBJECT_ADDR_HANDLER;
+
+
+/******************************************************************************
+ *
+ * Special internal objects
+ *
+ *****************************************************************************/
+
+/*
+ * The Reference object type is used for these opcodes:
+ * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp
+ */
+typedef struct acpi_object_reference
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 TargetType; /* Used for IndexOp */
+ UINT16 Opcode;
+ UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */
+ void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
+ ACPI_NAMESPACE_NODE *Node;
+ union acpi_operand_object **Where;
+
+} ACPI_OBJECT_REFERENCE;
+
+
+/*
+ * Extra object is used as additional storage for types that
+ * have AML code in their declarations (TermArgs) that must be
+ * evaluated at run time.
+ *
+ * Currently: Region and FieldUnit types
+ */
+typedef struct acpi_object_extra
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 ByteFill1;
+ UINT16 WordFill1;
+ UINT32 AmlLength;
+ UINT8 *AmlStart;
+ ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
+ void *RegionContext; /* Region-specific data */
+
+} ACPI_OBJECT_EXTRA;
+
+
+/* Additional data that can be attached to namespace nodes */
+
+typedef struct acpi_object_data
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_OBJECT_HANDLER Handler;
+ void *Pointer;
+
+} ACPI_OBJECT_DATA;
+
+
+/* Structure used when objects are cached for reuse */
+
+typedef struct acpi_object_cache_list
+{
+ ACPI_OBJECT_COMMON_HEADER
+ union acpi_operand_object *Next; /* Link for object cache and internal lists*/
+
+} ACPI_OBJECT_CACHE_LIST;
+
+
+/******************************************************************************
+ *
+ * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
+ *
+ *****************************************************************************/
+
+typedef union acpi_operand_object
+{
+ ACPI_OBJECT_COMMON Common;
+ ACPI_OBJECT_INTEGER Integer;
+ ACPI_OBJECT_STRING String;
+ ACPI_OBJECT_BUFFER Buffer;
+ ACPI_OBJECT_PACKAGE Package;
+ ACPI_OBJECT_EVENT Event;
+ ACPI_OBJECT_METHOD Method;
+ ACPI_OBJECT_MUTEX Mutex;
+ ACPI_OBJECT_REGION Region;
+ ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
+ ACPI_OBJECT_DEVICE Device;
+ ACPI_OBJECT_POWER_RESOURCE PowerResource;
+ ACPI_OBJECT_PROCESSOR Processor;
+ ACPI_OBJECT_THERMAL_ZONE ThermalZone;
+ ACPI_OBJECT_FIELD_COMMON CommonField;
+ ACPI_OBJECT_REGION_FIELD Field;
+ ACPI_OBJECT_BUFFER_FIELD BufferField;
+ ACPI_OBJECT_BANK_FIELD BankField;
+ ACPI_OBJECT_INDEX_FIELD IndexField;
+ ACPI_OBJECT_NOTIFY_HANDLER Notify;
+ ACPI_OBJECT_ADDR_HANDLER AddressSpace;
+ ACPI_OBJECT_REFERENCE Reference;
+ ACPI_OBJECT_EXTRA Extra;
+ ACPI_OBJECT_DATA Data;
+ ACPI_OBJECT_CACHE_LIST Cache;
+
+} ACPI_OPERAND_OBJECT;
+
+
+/******************************************************************************
+ *
+ * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
+ *
+ *****************************************************************************/
+
+
+/* Object descriptor types */
+
+#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */
+#define ACPI_DESC_TYPE_STATE 0x20
+#define ACPI_DESC_TYPE_STATE_UPDATE 0x21
+#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22
+#define ACPI_DESC_TYPE_STATE_CONTROL 0x23
+#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24
+#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25
+#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26
+#define ACPI_DESC_TYPE_STATE_RESULT 0x27
+#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28
+#define ACPI_DESC_TYPE_STATE_THREAD 0x29
+#define ACPI_DESC_TYPE_WALK 0x44
+#define ACPI_DESC_TYPE_PARSER 0x66
+#define ACPI_DESC_TYPE_OPERAND 0x88
+#define ACPI_DESC_TYPE_NAMED 0xAA
+
+
+typedef union acpi_descriptor
+{
+ UINT8 DescriptorId; /* To differentiate various internal objs */\
+ ACPI_OPERAND_OBJECT Object;
+ ACPI_NAMESPACE_NODE Node;
+ ACPI_PARSE_OBJECT Op;
+
+} ACPI_DESCRIPTOR;
+
+
+#endif /* _ACOBJECT_H */
diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h
new file mode 100644
index 0000000..74f7aeb
--- /dev/null
+++ b/sys/contrib/dev/acpica/acoutput.h
@@ -0,0 +1,258 @@
+/******************************************************************************
+ *
+ * Name: acoutput.h -- debug output
+ * $Revision: 93 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACOUTPUT_H__
+#define __ACOUTPUT_H__
+
+/*
+ * Debug levels and component IDs. These are used to control the
+ * granularity of the output of the DEBUG_PRINT macro -- on a per-
+ * component basis and a per-exception-type basis.
+ */
+
+/* Component IDs are used in the global "DebugLayer" */
+
+#define ACPI_UTILITIES 0x00000001
+#define ACPI_HARDWARE 0x00000002
+#define ACPI_EVENTS 0x00000004
+#define ACPI_TABLES 0x00000008
+#define ACPI_NAMESPACE 0x00000010
+#define ACPI_PARSER 0x00000020
+#define ACPI_DISPATCHER 0x00000040
+#define ACPI_EXECUTER 0x00000080
+#define ACPI_RESOURCES 0x00000100
+#define ACPI_CA_DEBUGGER 0x00000200
+#define ACPI_OS_SERVICES 0x00000400
+#define ACPI_CA_DISASSEMBLER 0x00000800
+
+/* Component IDs for ACPI tools and utilities */
+
+#define ACPI_COMPILER 0x00001000
+#define ACPI_TOOLS 0x00002000
+
+#define ACPI_ALL_COMPONENTS 0x00003FFF
+#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
+
+
+/* Component IDs reserved for ACPI drivers */
+
+#define ACPI_ALL_DRIVERS 0xFFFF0000
+
+
+/*
+ * Raw debug output levels, do not use these in the DEBUG_PRINT macros
+ */
+#define ACPI_LV_ERROR 0x00000001
+#define ACPI_LV_WARN 0x00000002
+#define ACPI_LV_INIT 0x00000004
+#define ACPI_LV_DEBUG_OBJECT 0x00000008
+#define ACPI_LV_INFO 0x00000010
+#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
+
+/* Trace verbosity level 1 [Standard Trace Level] */
+
+#define ACPI_LV_INIT_NAMES 0x00000020
+#define ACPI_LV_PARSE 0x00000040
+#define ACPI_LV_LOAD 0x00000080
+#define ACPI_LV_DISPATCH 0x00000100
+#define ACPI_LV_EXEC 0x00000200
+#define ACPI_LV_NAMES 0x00000400
+#define ACPI_LV_OPREGION 0x00000800
+#define ACPI_LV_BFIELD 0x00001000
+#define ACPI_LV_TABLES 0x00002000
+#define ACPI_LV_VALUES 0x00004000
+#define ACPI_LV_OBJECTS 0x00008000
+#define ACPI_LV_RESOURCES 0x00010000
+#define ACPI_LV_USER_REQUESTS 0x00020000
+#define ACPI_LV_PACKAGE 0x00040000
+#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
+
+/* Trace verbosity level 2 [Function tracing and memory allocation] */
+
+#define ACPI_LV_ALLOCATIONS 0x00100000
+#define ACPI_LV_FUNCTIONS 0x00200000
+#define ACPI_LV_OPTIMIZATIONS 0x00400000
+#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1
+#define ACPI_LV_ALL ACPI_LV_VERBOSITY2
+
+/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
+
+#define ACPI_LV_MUTEX 0x01000000
+#define ACPI_LV_THREADS 0x02000000
+#define ACPI_LV_IO 0x04000000
+#define ACPI_LV_INTERRUPTS 0x08000000
+#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
+
+/* Exceptionally verbose output -- also used in the global "DebugLevel" */
+
+#define ACPI_LV_AML_DISASSEMBLE 0x10000000
+#define ACPI_LV_VERBOSE_INFO 0x20000000
+#define ACPI_LV_FULL_TABLES 0x40000000
+#define ACPI_LV_EVENTS 0x80000000
+
+#define ACPI_LV_VERBOSE 0xF0000000
+
+
+/*
+ * Debug level macros that are used in the DEBUG_PRINT macros
+ */
+#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,__LINE__,&_Dbg
+
+/* Exception level -- used in the global "DebugLevel" */
+
+#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
+#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
+#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
+#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
+#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
+
+
+/* Trace level -- also used in the global "DebugLevel" */
+
+#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
+#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
+#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
+#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
+#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
+#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
+#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
+#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
+#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
+#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
+#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
+#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
+#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
+#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
+#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
+#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
+#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO)
+#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
+#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
+#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
+#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
+
+#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
+
+
+/* Defaults for DebugLevel, debug and normal */
+
+#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
+
+
+#endif /* __ACOUTPUT_H__ */
diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h
new file mode 100644
index 0000000..d3f6727
--- /dev/null
+++ b/sys/contrib/dev/acpica/acparser.h
@@ -0,0 +1,420 @@
+/******************************************************************************
+ *
+ * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
+ * $Revision: 65 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ACPARSER_H__
+#define __ACPARSER_H__
+
+
+#define OP_HAS_RETURN_VALUE 1
+
+/* variable # arguments */
+
+#define ACPI_VAR_ARGS ACPI_UINT32_MAX
+
+
+#define ACPI_PARSE_DELETE_TREE 0x0001
+#define ACPI_PARSE_NO_TREE_DELETE 0x0000
+#define ACPI_PARSE_TREE_MASK 0x0001
+
+#define ACPI_PARSE_LOAD_PASS1 0x0010
+#define ACPI_PARSE_LOAD_PASS2 0x0020
+#define ACPI_PARSE_EXECUTE 0x0030
+#define ACPI_PARSE_MODE_MASK 0x0030
+
+#define ACPI_PARSE_DEFERRED_OP 0x0100
+
+/* Parser external interfaces */
+
+ACPI_STATUS
+AcpiPsxLoadTable (
+ UINT8 *PcodeAddr,
+ UINT32 PcodeLength);
+
+ACPI_STATUS
+AcpiPsxExecute (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc);
+
+
+/******************************************************************************
+ *
+ * Parser interfaces
+ *
+ *****************************************************************************/
+
+
+/* psargs - Parse AML opcode arguments */
+
+UINT8 *
+AcpiPsGetNextPackageEnd (
+ ACPI_PARSE_STATE *ParserState);
+
+UINT32
+AcpiPsGetNextPackageLength (
+ ACPI_PARSE_STATE *ParserState);
+
+char *
+AcpiPsGetNextNamestring (
+ ACPI_PARSE_STATE *ParserState);
+
+void
+AcpiPsGetNextSimpleArg (
+ ACPI_PARSE_STATE *ParserState,
+ UINT32 ArgType,
+ ACPI_PARSE_OBJECT *Arg);
+
+ACPI_STATUS
+AcpiPsGetNextNamepath (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *Arg,
+ BOOLEAN MethodCall);
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetNextField (
+ ACPI_PARSE_STATE *ParserState);
+
+ACPI_STATUS
+AcpiPsGetNextArg (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_STATE *ParserState,
+ UINT32 ArgType,
+ ACPI_PARSE_OBJECT **ReturnArg);
+
+
+/* psfind */
+
+ACPI_PARSE_OBJECT *
+AcpiPsFindName (
+ ACPI_PARSE_OBJECT *Scope,
+ UINT32 Name,
+ UINT32 Opcode);
+
+ACPI_PARSE_OBJECT*
+AcpiPsGetParent (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/* psopcode - AML Opcode information */
+
+const ACPI_OPCODE_INFO *
+AcpiPsGetOpcodeInfo (
+ UINT16 Opcode);
+
+char *
+AcpiPsGetOpcodeName (
+ UINT16 Opcode);
+
+
+/* psparse - top level parsing routines */
+
+UINT32
+AcpiPsGetOpcodeSize (
+ UINT32 Opcode);
+
+void
+AcpiPsCompleteThisOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiPsNextParseState (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS CallbackStatus);
+
+ACPI_STATUS
+AcpiPsFindObject (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp);
+
+void
+AcpiPsDeleteParseTree (
+ ACPI_PARSE_OBJECT *root);
+
+ACPI_STATUS
+AcpiPsParseLoop (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiPsParseAml (
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiPsParseTable (
+ UINT8 *aml,
+ UINT32 amlSize,
+ ACPI_PARSE_DOWNWARDS DescendingCallback,
+ ACPI_PARSE_UPWARDS AscendingCallback,
+ ACPI_PARSE_OBJECT **RootObject);
+
+UINT16
+AcpiPsPeekOpcode (
+ ACPI_PARSE_STATE *state);
+
+
+/* psscope - Scope stack management routines */
+
+
+ACPI_STATUS
+AcpiPsInitScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *Root);
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetParentScope (
+ ACPI_PARSE_STATE *state);
+
+BOOLEAN
+AcpiPsHasCompletedScope (
+ ACPI_PARSE_STATE *ParserState);
+
+void
+AcpiPsPopScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT **Op,
+ UINT32 *ArgList,
+ UINT32 *ArgCount);
+
+ACPI_STATUS
+AcpiPsPushScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 RemainingArgs,
+ UINT32 ArgCount);
+
+void
+AcpiPsCleanupScope (
+ ACPI_PARSE_STATE *state);
+
+
+/* pstree - parse tree manipulation routines */
+
+void
+AcpiPsAppendArg(
+ ACPI_PARSE_OBJECT *op,
+ ACPI_PARSE_OBJECT *arg);
+
+ACPI_PARSE_OBJECT*
+AcpiPsFind (
+ ACPI_PARSE_OBJECT *Scope,
+ char *Path,
+ UINT16 Opcode,
+ UINT32 Create);
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetArg(
+ ACPI_PARSE_OBJECT *op,
+ UINT32 argn);
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetChild (
+ ACPI_PARSE_OBJECT *op);
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetDepthNext (
+ ACPI_PARSE_OBJECT *Origin,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/* pswalk - parse tree walk routines */
+
+ACPI_STATUS
+AcpiPsWalkParsedAml (
+ ACPI_PARSE_OBJECT *StartOp,
+ ACPI_PARSE_OBJECT *EndOp,
+ ACPI_OPERAND_OBJECT *MthDesc,
+ ACPI_NAMESPACE_NODE *StartNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **CallerReturnDesc,
+ ACPI_OWNER_ID OwnerId,
+ ACPI_PARSE_DOWNWARDS DescendingCallback,
+ ACPI_PARSE_UPWARDS AscendingCallback);
+
+ACPI_STATUS
+AcpiPsGetNextWalkOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_UPWARDS AscendingCallback);
+
+ACPI_STATUS
+AcpiPsDeleteCompletedOp (
+ ACPI_WALK_STATE *WalkState);
+
+
+/* psutils - parser utilities */
+
+ACPI_PARSE_OBJECT *
+AcpiPsCreateScopeOp (
+ void);
+
+void
+AcpiPsInitOp (
+ ACPI_PARSE_OBJECT *op,
+ UINT16 opcode);
+
+ACPI_PARSE_OBJECT *
+AcpiPsAllocOp (
+ UINT16 opcode);
+
+void
+AcpiPsFreeOp (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiPsDeleteParseCache (
+ void);
+
+BOOLEAN
+AcpiPsIsLeadingChar (
+ UINT32 c);
+
+BOOLEAN
+AcpiPsIsPrefixChar (
+ UINT32 c);
+
+UINT32
+AcpiPsGetName(
+ ACPI_PARSE_OBJECT *op);
+
+void
+AcpiPsSetName(
+ ACPI_PARSE_OBJECT *op,
+ UINT32 name);
+
+
+/* psdump - display parser tree */
+
+UINT32
+AcpiPsSprintPath (
+ char *BufferStart,
+ UINT32 BufferSize,
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+AcpiPsSprintOp (
+ char *BufferStart,
+ UINT32 BufferSize,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiPsShow (
+ ACPI_PARSE_OBJECT *op);
+
+
+#endif /* __ACPARSER_H__ */
diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h
new file mode 100644
index 0000000..11fdb69
--- /dev/null
+++ b/sys/contrib/dev/acpica/acpi.h
@@ -0,0 +1,142 @@
+/******************************************************************************
+ *
+ * Name: acpi.h - Master include file, Publics and external data.
+ * $Revision: 56 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACPI_H__
+#define __ACPI_H__
+
+/*
+ * Common includes for all ACPI driver files
+ * We put them here because we don't want to duplicate them
+ * in the rest of the source code again and again.
+ */
+#include "acconfig.h" /* Configuration constants */
+#include "acenv.h" /* Target environment specific items */
+#include "actypes.h" /* Fundamental common data types */
+#include "acexcep.h" /* ACPI exception codes */
+#include "acmacros.h" /* C macros */
+#include "actbl.h" /* ACPI table definitions */
+#include "aclocal.h" /* Internal data types */
+#include "acoutput.h" /* Error output and Debug macros */
+#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/
+#include "acpixf.h" /* ACPI core subsystem external interfaces */
+#include "acobject.h" /* ACPI internal object */
+#include "acstruct.h" /* Common structures */
+#include "acglobal.h" /* All global variables */
+#include "achware.h" /* Hardware defines and interfaces */
+#include "acutils.h" /* Utility interfaces */
+
+
+#endif /* __ACPI_H__ */
diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh
new file mode 100755
index 0000000..a128538
--- /dev/null
+++ b/sys/contrib/dev/acpica/acpica_prep.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout
+#
+
+if [ ! $# -eq 1 ]; then
+ echo "usage: $0 acpica_archive"
+ exit
+fi
+
+src=$1
+wrk=./_acpi_ca_unpack
+dst=./acpi_ca_destination
+
+# files to remove
+stripdirs="common compiler generate acpisrc"
+stripfiles="osunixxf.c Makefile README adisasm.h acdos16.h \
+ acintel.h aclinux.h acmsvc.h acwin.h acwin64.h"
+# files to update paths in
+src_update_files="acpi.h acpiosxf.h"
+
+# pre-clean
+echo pre-clean
+rm -rf ${wrk}
+rm -rf ${dst}
+mkdir -p ${wrk}
+mkdir -p ${dst}
+
+# fetch document
+echo fetch document
+fetch http://developer.intel.com/technology/iapc/acpi/downloads/CHANGES.txt
+tr -d '\r' < CHANGES.txt > CHANGES.txt.tmp
+mv CHANGES.txt.tmp CHANGES.txt
+
+# unpack
+echo unpack
+tar -x -z -f ${src} -C ${wrk}
+
+# strip files
+echo strip
+for i in ${stripdirs}; do
+ find ${wrk} -name ${i} -type d | xargs rm -r
+done
+for i in ${stripfiles}; do
+ find ${wrk} -name ${i} -type f -delete
+done
+
+# move files to destination
+echo copy
+find ${wrk} -type f | xargs -J % mv % ${dst}
+mv CHANGES.txt ${dst}
+
+# update src/headers for appropriate paths
+echo updating paths
+for i in ${src_update_files}; do
+ i=${dst}/$i
+ sed -e 's/platform\///' $i > $i.new && mv $i.new $i
+done
+
+# post-clean
+echo post-clean
+rm -rf ${wrk}
+
+# assist the developer in generating a diff
+echo "Directories you may want to 'cvs diff':"
+echo " src/sys/dev/acpica src/sys/i386/acpica src/sys/ia64/acpica \\"
+echo " src/sys/modules/acpi src/sys/boot src/sys/i386/include \\"
+echo " src/usr.sbin/acpi src/sys/contrib/dev/acpica"
diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h
new file mode 100644
index 0000000..d0e82b2
--- /dev/null
+++ b/sys/contrib/dev/acpica/acpiosxf.h
@@ -0,0 +1,447 @@
+
+/******************************************************************************
+ *
+ * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
+ * interfaces must be implemented by OSL to interface the
+ * ACPI components to the host operating system.
+ *
+ *****************************************************************************/
+
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exer
+ se the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACPIOSXF_H__
+#define __ACPIOSXF_H__
+
+#include "acenv.h"
+#include "actypes.h"
+
+
+/* Priorities for AcpiOsQueueForExecution */
+
+#define OSD_PRIORITY_GPE 1
+#define OSD_PRIORITY_HIGH 2
+#define OSD_PRIORITY_MED 3
+#define OSD_PRIORITY_LO 4
+
+#define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
+#define ACPI_MUTEX_SEM 1
+
+
+/* Functions for AcpiOsSignal */
+
+#define ACPI_SIGNAL_FATAL 0
+#define ACPI_SIGNAL_BREAKPOINT 1
+
+typedef struct acpi_signal_fatal_info
+{
+ UINT32 Type;
+ UINT32 Code;
+ UINT32 Argument;
+
+} ACPI_SIGNAL_FATAL_INFO;
+
+
+/*
+ * OSL Initialization and shutdown primitives
+ */
+
+ACPI_STATUS
+AcpiOsInitialize (
+ void);
+
+ACPI_STATUS
+AcpiOsTerminate (
+ void);
+
+
+/*
+ * ACPI Table interfaces
+ */
+
+ACPI_STATUS
+AcpiOsGetRootPointer (
+ UINT32 Flags,
+ ACPI_POINTER *Address);
+
+ACPI_STATUS
+AcpiOsPredefinedOverride (
+ const ACPI_PREDEFINED_NAMES *InitVal,
+ ACPI_STRING *NewVal);
+
+ACPI_STATUS
+AcpiOsTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_TABLE_HEADER **NewTable);
+
+
+/*
+ * Synchronization primitives
+ */
+
+ACPI_STATUS
+AcpiOsCreateSemaphore (
+ UINT32 MaxUnits,
+ UINT32 InitialUnits,
+ ACPI_HANDLE *OutHandle);
+
+ACPI_STATUS
+AcpiOsDeleteSemaphore (
+ ACPI_HANDLE Handle);
+
+ACPI_STATUS
+AcpiOsWaitSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units,
+ UINT16 Timeout);
+
+ACPI_STATUS
+AcpiOsSignalSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units);
+
+ACPI_STATUS
+AcpiOsCreateLock (
+ ACPI_HANDLE *OutHandle);
+
+void
+AcpiOsDeleteLock (
+ ACPI_HANDLE Handle);
+
+void
+AcpiOsAcquireLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags);
+
+void
+AcpiOsReleaseLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags);
+
+
+/*
+ * Memory allocation and mapping
+ */
+
+void *
+AcpiOsAllocate (
+ ACPI_SIZE Size);
+
+void
+AcpiOsFree (
+ void * Memory);
+
+ACPI_STATUS
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS PhysicalAddress,
+ ACPI_SIZE Size,
+ void **LogicalAddress);
+
+void
+AcpiOsUnmapMemory (
+ void *LogicalAddress,
+ ACPI_SIZE Size);
+
+ACPI_STATUS
+AcpiOsGetPhysicalAddress (
+ void *LogicalAddress,
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
+
+
+/*
+ * Interrupt handlers
+ */
+
+ACPI_STATUS
+AcpiOsInstallInterruptHandler (
+ UINT32 InterruptNumber,
+ OSD_HANDLER ServiceRoutine,
+ void *Context);
+
+ACPI_STATUS
+AcpiOsRemoveInterruptHandler (
+ UINT32 InterruptNumber,
+ OSD_HANDLER ServiceRoutine);
+
+
+/*
+ * Threads and Scheduling
+ */
+
+UINT32
+AcpiOsGetThreadId (
+ void);
+
+ACPI_STATUS
+AcpiOsQueueForExecution (
+ UINT32 Priority,
+ OSD_EXECUTION_CALLBACK Function,
+ void *Context);
+
+void
+AcpiOsSleep (
+ UINT32 Seconds,
+ UINT32 Milliseconds);
+
+void
+AcpiOsStall (
+ UINT32 Microseconds);
+
+
+/*
+ * Platform and hardware-independent I/O interfaces
+ */
+
+ACPI_STATUS
+AcpiOsReadPort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 *Value,
+ UINT32 Width);
+
+ACPI_STATUS
+AcpiOsWritePort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 Value,
+ UINT32 Width);
+
+
+/*
+ * Platform and hardware-independent physical memory interfaces
+ */
+
+ACPI_STATUS
+AcpiOsReadMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 *Value,
+ UINT32 Width);
+
+ACPI_STATUS
+AcpiOsWriteMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Value,
+ UINT32 Width);
+
+
+/*
+ * Platform and hardware-independent PCI configuration space access
+ */
+
+ACPI_STATUS
+AcpiOsReadPciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ void *Value,
+ UINT32 Width);
+
+ACPI_STATUS
+AcpiOsWritePciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ ACPI_INTEGER Value,
+ UINT32 Width);
+
+/*
+ * Interim function needed for PCI IRQ routing
+ */
+void
+AcpiOsDerivePciId(
+ ACPI_HANDLE rhandle,
+ ACPI_HANDLE chandle,
+ ACPI_PCI_ID **PciId);
+
+/*
+ * Miscellaneous
+ */
+
+BOOLEAN
+AcpiOsReadable (
+ void *Pointer,
+ ACPI_SIZE Length);
+
+BOOLEAN
+AcpiOsWritable (
+ void *Pointer,
+ ACPI_SIZE Length);
+
+UINT32
+AcpiOsGetTimer (
+ void);
+
+ACPI_STATUS
+AcpiOsSignal (
+ UINT32 Function,
+ void *Info);
+
+/*
+ * Debug print routines
+ */
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiOsPrintf (
+ const char *Format,
+ ...);
+
+void
+AcpiOsVprintf (
+ const char *Format,
+ va_list Args);
+
+void
+AcpiOsRedirectOutput (
+ void *Destination);
+
+
+/*
+ * Debug input
+ */
+
+UINT32
+AcpiOsGetLine (
+ char *Buffer);
+
+
+/*
+ * Directory manipulation
+ */
+
+void *
+AcpiOsOpenDirectory (
+ char *Pathname,
+ char *WildcardSpec,
+ char RequestedFileType);
+
+/* RequesteFileType values */
+
+#define REQUEST_FILE_ONLY 0
+#define REQUEST_DIR_ONLY 1
+
+
+char *
+AcpiOsGetNextFilename (
+ void *DirHandle);
+
+void
+AcpiOsCloseDirectory (
+ void *DirHandle);
+
+/*
+ * Debug
+ */
+
+void
+AcpiOsDbgAssert(
+ void *FailedAssertion,
+ void *FileName,
+ UINT32 LineNumber,
+ char *Message);
+
+
+#endif /* __ACPIOSXF_H__ */
diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h
new file mode 100644
index 0000000..c30c94e
--- /dev/null
+++ b/sys/contrib/dev/acpica/acpixf.h
@@ -0,0 +1,534 @@
+
+/******************************************************************************
+ *
+ * Name: acpixf.h - External interfaces to the ACPI subsystem
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ACXFACE_H__
+#define __ACXFACE_H__
+
+#include "actypes.h"
+#include "actbl.h"
+
+
+ /*
+ * Global interfaces
+ */
+
+ACPI_STATUS
+AcpiInitializeSubsystem (
+ void);
+
+ACPI_STATUS
+AcpiEnableSubsystem (
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiInitializeObjects (
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiTerminate (
+ void);
+
+ACPI_STATUS
+AcpiSubsystemStatus (
+ void);
+
+ACPI_STATUS
+AcpiEnable (
+ void);
+
+ACPI_STATUS
+AcpiDisable (
+ void);
+
+ACPI_STATUS
+AcpiGetSystemInfo (
+ ACPI_BUFFER *RetBuffer);
+
+const char *
+AcpiFormatException (
+ ACPI_STATUS Exception);
+
+ACPI_STATUS
+AcpiPurgeCachedObjects (
+ void);
+
+ACPI_STATUS
+AcpiInstallInitializationHandler (
+ ACPI_INIT_HANDLER Handler,
+ UINT32 Function);
+
+/*
+ * ACPI Memory manager
+ */
+
+void *
+AcpiAllocate (
+ UINT32 Size);
+
+void *
+AcpiCallocate (
+ UINT32 Size);
+
+void
+AcpiFree (
+ void *Address);
+
+
+/*
+ * ACPI table manipulation interfaces
+ */
+
+ACPI_STATUS
+AcpiFindRootPointer (
+ UINT32 Flags,
+ ACPI_POINTER *RsdpAddress);
+
+ACPI_STATUS
+AcpiLoadTables (
+ void);
+
+ACPI_STATUS
+AcpiLoadTable (
+ ACPI_TABLE_HEADER *TablePtr);
+
+ACPI_STATUS
+AcpiUnloadTable (
+ ACPI_TABLE_TYPE TableType);
+
+ACPI_STATUS
+AcpiGetTableHeader (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_TABLE_HEADER *OutTableHeader);
+
+ACPI_STATUS
+AcpiGetTable (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiGetFirmwareTable (
+ ACPI_STRING Signature,
+ UINT32 Instance,
+ UINT32 Flags,
+ ACPI_TABLE_HEADER **TablePointer);
+
+
+/*
+ * Namespace and name interfaces
+ */
+
+ACPI_STATUS
+AcpiWalkNamespace (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE StartObject,
+ UINT32 MaxDepth,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiGetDevices (
+ char *HID,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiGetName (
+ ACPI_HANDLE Handle,
+ UINT32 NameType,
+ ACPI_BUFFER *RetPathPtr);
+
+ACPI_STATUS
+AcpiGetHandle (
+ ACPI_HANDLE Parent,
+ ACPI_STRING Pathname,
+ ACPI_HANDLE *RetHandle);
+
+ACPI_STATUS
+AcpiAttachData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler,
+ void *Data);
+
+ACPI_STATUS
+AcpiDetachData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler);
+
+ACPI_STATUS
+AcpiGetData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler,
+ void **Data);
+
+
+/*
+ * Object manipulation and enumeration
+ */
+
+ACPI_STATUS
+AcpiEvaluateObject (
+ ACPI_HANDLE Object,
+ ACPI_STRING Pathname,
+ ACPI_OBJECT_LIST *ParameterObjects,
+ ACPI_BUFFER *ReturnObjectBuffer);
+
+ACPI_STATUS
+AcpiEvaluateObjectTyped (
+ ACPI_HANDLE Object,
+ ACPI_STRING Pathname,
+ ACPI_OBJECT_LIST *ExternalParams,
+ ACPI_BUFFER *ReturnBuffer,
+ ACPI_OBJECT_TYPE ReturnType);
+
+ACPI_STATUS
+AcpiGetObjectInfo (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *ReturnBuffer);
+
+ACPI_STATUS
+AcpiGetNextObject (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE Parent,
+ ACPI_HANDLE Child,
+ ACPI_HANDLE *OutHandle);
+
+ACPI_STATUS
+AcpiGetType (
+ ACPI_HANDLE Object,
+ ACPI_OBJECT_TYPE *OutType);
+
+ACPI_STATUS
+AcpiGetParent (
+ ACPI_HANDLE Object,
+ ACPI_HANDLE *OutHandle);
+
+
+/*
+ * Event handler interfaces
+ */
+
+ACPI_STATUS
+AcpiInstallFixedEventHandler (
+ UINT32 AcpiEvent,
+ ACPI_EVENT_HANDLER Handler,
+ void *Context);
+
+ACPI_STATUS
+AcpiRemoveFixedEventHandler (
+ UINT32 AcpiEvent,
+ ACPI_EVENT_HANDLER Handler);
+
+ACPI_STATUS
+AcpiInstallNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler,
+ void *Context);
+
+ACPI_STATUS
+AcpiRemoveNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler);
+
+ACPI_STATUS
+AcpiInstallAddressSpaceHandler (
+ ACPI_HANDLE Device,
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_ADR_SPACE_HANDLER Handler,
+ ACPI_ADR_SPACE_SETUP Setup,
+ void *Context);
+
+ACPI_STATUS
+AcpiRemoveAddressSpaceHandler (
+ ACPI_HANDLE Device,
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_ADR_SPACE_HANDLER Handler);
+
+ACPI_STATUS
+AcpiInstallGpeHandler (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Type,
+ ACPI_GPE_HANDLER Handler,
+ void *Context);
+
+ACPI_STATUS
+AcpiAcquireGlobalLock (
+ UINT16 Timeout,
+ UINT32 *Handle);
+
+ACPI_STATUS
+AcpiReleaseGlobalLock (
+ UINT32 Handle);
+
+ACPI_STATUS
+AcpiRemoveGpeHandler (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ ACPI_GPE_HANDLER Handler);
+
+ACPI_STATUS
+AcpiEnableEvent (
+ UINT32 Event,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiDisableEvent (
+ UINT32 Event,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiClearEvent (
+ UINT32 Event);
+
+ACPI_STATUS
+AcpiGetEventStatus (
+ UINT32 Event,
+ ACPI_EVENT_STATUS *EventStatus);
+
+ACPI_STATUS
+AcpiEnableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiDisableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiClearGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiGetGpeStatus (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags,
+ ACPI_EVENT_STATUS *EventStatus);
+
+ACPI_STATUS
+AcpiInstallGpeBlock (
+ ACPI_HANDLE GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT32 InterruptLevel);
+
+ACPI_STATUS
+AcpiRemoveGpeBlock (
+ ACPI_HANDLE GpeDevice);
+
+
+/*
+ * Resource interfaces
+ */
+
+typedef
+ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
+ ACPI_RESOURCE *Resource,
+ void *Context);
+
+
+ACPI_STATUS
+AcpiGetCurrentResources(
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiGetPossibleResources(
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiWalkResources (
+ ACPI_HANDLE DeviceHandle,
+ char *Path,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context);
+
+ACPI_STATUS
+AcpiSetCurrentResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *InBuffer);
+
+ACPI_STATUS
+AcpiGetIrqRoutingTable (
+ ACPI_HANDLE BusDeviceHandle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiResourceToAddress64 (
+ ACPI_RESOURCE *Resource,
+ ACPI_RESOURCE_ADDRESS64 *Out);
+
+/*
+ * Hardware (ACPI device) interfaces
+ */
+
+ACPI_STATUS
+AcpiGetRegister (
+ UINT32 RegisterId,
+ UINT32 *ReturnValue,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiSetRegister (
+ UINT32 RegisterId,
+ UINT32 Value,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiSetFirmwareWakingVector (
+ ACPI_PHYSICAL_ADDRESS PhysicalAddress);
+
+ACPI_STATUS
+AcpiGetFirmwareWakingVector (
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
+
+ACPI_STATUS
+AcpiGetSleepTypeData (
+ UINT8 SleepState,
+ UINT8 *Slp_TypA,
+ UINT8 *Slp_TypB);
+
+ACPI_STATUS
+AcpiEnterSleepStatePrep (
+ UINT8 SleepState);
+
+ACPI_STATUS
+AcpiEnterSleepState (
+ UINT8 SleepState);
+
+ACPI_STATUS
+AcpiEnterSleepStateS4bios (
+ void);
+
+ACPI_STATUS
+AcpiLeaveSleepState (
+ UINT8 SleepState);
+
+
+#endif /* __ACXFACE_H__ */
diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/acresrc.h
new file mode 100644
index 0000000..f1b1729
--- /dev/null
+++ b/sys/contrib/dev/acpica/acresrc.h
@@ -0,0 +1,465 @@
+/******************************************************************************
+ *
+ * Name: acresrc.h - Resource Manager function prototypes
+ * $Revision: 37 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACRESRC_H__
+#define __ACRESRC_H__
+
+
+/*
+ * Function prototypes called from Acpi* APIs
+ */
+
+ACPI_STATUS
+AcpiRsGetPrtMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer);
+
+
+ACPI_STATUS
+AcpiRsGetCrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiRsGetPrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiRsGetMethodData (
+ ACPI_HANDLE Handle,
+ char *Path,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiRsSetSrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiRsCreateResourceList (
+ ACPI_OPERAND_OBJECT *ByteStreamBuffer,
+ ACPI_BUFFER *OutputBuffer);
+
+ACPI_STATUS
+AcpiRsCreateByteStream (
+ ACPI_RESOURCE *LinkedListBuffer,
+ ACPI_BUFFER *OutputBuffer);
+
+ACPI_STATUS
+AcpiRsCreatePciRoutingTable (
+ ACPI_OPERAND_OBJECT *PackageObject,
+ ACPI_BUFFER *OutputBuffer);
+
+
+/*
+ * Function prototypes called from AcpiRsCreate*
+ */
+void
+AcpiRsDumpIrq (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpAddress16 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpAddress32 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpAddress64 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpDma (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpIo (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpExtendedIrq (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpFixedIo (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpFixedMemory32 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpMemory24 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpMemory32 (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpStartDependFns (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpVendorSpecific (
+ ACPI_RESOURCE_DATA *Data);
+
+void
+AcpiRsDumpResourceList (
+ ACPI_RESOURCE *Resource);
+
+void
+AcpiRsDumpIrqList (
+ UINT8 *RouteTable);
+
+ACPI_STATUS
+AcpiRsGetByteStreamStart (
+ UINT8 *ByteStreamBuffer,
+ UINT8 **ByteStreamStart,
+ UINT32 *Size);
+
+ACPI_STATUS
+AcpiRsGetListLength (
+ UINT8 *ByteStreamBuffer,
+ UINT32 ByteStreamBufferLength,
+ ACPI_SIZE *SizeNeeded);
+
+ACPI_STATUS
+AcpiRsGetByteStreamLength (
+ ACPI_RESOURCE *LinkedListBuffer,
+ ACPI_SIZE *SizeNeeded);
+
+ACPI_STATUS
+AcpiRsGetPciRoutingTableLength (
+ ACPI_OPERAND_OBJECT *PackageObject,
+ ACPI_SIZE *BufferSizeNeeded);
+
+ACPI_STATUS
+AcpiRsByteStreamToList (
+ UINT8 *ByteStreamBuffer,
+ UINT32 ByteStreamBufferLength,
+ UINT8 *OutputBuffer);
+
+ACPI_STATUS
+AcpiRsListToByteStream (
+ ACPI_RESOURCE *LinkedList,
+ ACPI_SIZE ByteStreamSizeNeeded,
+ UINT8 *OutputBuffer);
+
+ACPI_STATUS
+AcpiRsIoResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsFixedIoResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsIoStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsFixedIoStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsIrqResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsIrqStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsDmaResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsDmaStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsAddress16Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsAddress16Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsAddress32Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsAddress32Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsAddress64Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsAddress64Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsStartDependFnsResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsEndDependFnsResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsStartDependFnsStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsEndDependFnsStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsMemory24Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsMemory24Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsMemory32RangeResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsFixedMemory32Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsMemory32RangeStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsFixedMemory32Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsExtendedIrqResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsExtendedIrqStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsEndTagResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsEndTagStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+ACPI_STATUS
+AcpiRsVendorResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize);
+
+ACPI_STATUS
+AcpiRsVendorStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed);
+
+UINT8
+AcpiRsGetResourceType (
+ UINT8 ResourceStartByte);
+
+#endif /* __ACRESRC_H__ */
diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h
new file mode 100644
index 0000000..9ce641e
--- /dev/null
+++ b/sys/contrib/dev/acpica/acstruct.h
@@ -0,0 +1,281 @@
+/******************************************************************************
+ *
+ * Name: acstruct.h - Internal structs
+ * $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACSTRUCT_H__
+#define __ACSTRUCT_H__
+
+
+/*****************************************************************************
+ *
+ * Tree walking typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/*
+ * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
+ * the tree (for whatever reason), and for control method execution.
+ */
+
+#define ACPI_NEXT_OP_DOWNWARD 1
+#define ACPI_NEXT_OP_UPWARD 2
+
+#define ACPI_WALK_NON_METHOD 0
+#define ACPI_WALK_METHOD 1
+#define ACPI_WALK_METHOD_RESTART 2
+#define ACPI_WALK_CONST_REQUIRED 3
+#define ACPI_WALK_CONST_OPTIONAL 4
+
+typedef struct acpi_walk_state
+{
+ UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\
+ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
+ BOOLEAN LastPredicate; /* Result of last predicate */
+ UINT8 CurrentResult; /* */
+ UINT8 NextOpInfo; /* Info about NextOp */
+ UINT8 NumOperands; /* Stack pointer for Operands[] array */
+ UINT8 ReturnUsed;
+ UINT8 WalkType;
+ UINT16 Opcode; /* Current AML opcode */
+ UINT8 ScopeDepth;
+ UINT8 Reserved1;
+ UINT32 ArgCount; /* push for fixed or var args */
+ UINT32 AmlOffset;
+ UINT32 ArgTypes;
+ UINT32 MethodBreakpoint; /* For single stepping */
+ UINT32 UserBreakpoint; /* User AML breakpoint */
+ UINT32 ParseFlags;
+ UINT32 PrevArgTypes;
+
+ UINT8 *AmlLastWhile;
+ struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
+ union acpi_operand_object **CallerReturnDesc;
+ ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
+ struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
+ struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
+ ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
+ union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
+ struct acpi_namespace_node *MethodNode; /* Method Node if running a method */
+ ACPI_PARSE_OBJECT *Op; /* Current parser op */
+ union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+ const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
+ ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
+ union acpi_operand_object **Params;
+ ACPI_PARSE_STATE ParserState; /* Current state of parser */
+ union acpi_operand_object *ResultObj;
+ ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
+ union acpi_operand_object *ReturnDesc; /* Return object, if any */
+ ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
+
+ ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
+ ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
+ ACPI_PARSE_DOWNWARDS DescendingCallback;
+ ACPI_PARSE_UPWARDS AscendingCallback;
+ ACPI_THREAD_STATE *Thread;
+ struct acpi_walk_state *Next; /* Next WalkState in list */
+
+} ACPI_WALK_STATE;
+
+
+/* Info used by AcpiPsInitObjects */
+
+typedef struct acpi_init_walk_info
+{
+ UINT16 MethodCount;
+ UINT16 DeviceCount;
+ UINT16 OpRegionCount;
+ UINT16 FieldCount;
+ UINT16 BufferCount;
+ UINT16 PackageCount;
+ UINT16 OpRegionInit;
+ UINT16 FieldInit;
+ UINT16 BufferInit;
+ UINT16 PackageInit;
+ UINT16 ObjectCount;
+ ACPI_TABLE_DESC *TableDesc;
+
+} ACPI_INIT_WALK_INFO;
+
+
+/* Info used by AcpiNsInitializeDevices */
+
+typedef struct acpi_device_walk_info
+{
+ UINT16 DeviceCount;
+ UINT16 Num_STA;
+ UINT16 Num_INI;
+ ACPI_TABLE_DESC *TableDesc;
+
+} ACPI_DEVICE_WALK_INFO;
+
+
+/* TBD: [Restructure] Merge with struct above */
+
+typedef struct acpi_walk_info
+{
+ UINT32 DebugLevel;
+ UINT32 OwnerId;
+ UINT8 DisplayType;
+
+} ACPI_WALK_INFO;
+
+/* Display Types */
+
+#define ACPI_DISPLAY_SUMMARY 0
+#define ACPI_DISPLAY_OBJECTS 1
+
+typedef struct acpi_get_devices_info
+{
+ ACPI_WALK_CALLBACK UserFunction;
+ void *Context;
+ char *Hid;
+
+} ACPI_GET_DEVICES_INFO;
+
+
+typedef union acpi_aml_operands
+{
+ ACPI_OPERAND_OBJECT *Operands[7];
+
+ struct
+ {
+ ACPI_OBJECT_INTEGER *Type;
+ ACPI_OBJECT_INTEGER *Code;
+ ACPI_OBJECT_INTEGER *Argument;
+
+ } Fatal;
+
+ struct
+ {
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OPERAND_OBJECT *Target;
+
+ } Index;
+
+ struct
+ {
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OBJECT_INTEGER *Length;
+ ACPI_OPERAND_OBJECT *Target;
+
+ } Mid;
+
+} ACPI_AML_OPERANDS;
+
+
+#endif
diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/actables.h
new file mode 100644
index 0000000..b40588a
--- /dev/null
+++ b/sys/contrib/dev/acpica/actables.h
@@ -0,0 +1,306 @@
+/******************************************************************************
+ *
+ * Name: actables.h - ACPI table management
+ * $Revision: 45 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTABLES_H__
+#define __ACTABLES_H__
+
+
+/* Used in AcpiTbMapAcpiTable for size parameter if table header is to be used */
+
+#define SIZE_IN_HEADER 0
+
+
+ACPI_STATUS
+AcpiTbHandleToObject (
+ UINT16 TableId,
+ ACPI_TABLE_DESC **TableDesc);
+
+/*
+ * tbconvrt - Table conversion routines
+ */
+
+ACPI_STATUS
+AcpiTbConvertToXsdt (
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbConvertTableFadt (
+ void);
+
+ACPI_STATUS
+AcpiTbBuildCommonFacs (
+ ACPI_TABLE_DESC *TableInfo);
+
+UINT32
+AcpiTbGetTableCount (
+ RSDP_DESCRIPTOR *RSDP,
+ ACPI_TABLE_HEADER *RSDT);
+
+/*
+ * tbget - Table "get" routines
+ */
+
+ACPI_STATUS
+AcpiTbGetTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbGetTableHeader (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *ReturnHeader);
+
+ACPI_STATUS
+AcpiTbGetTableBody (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbGetThisTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbTableOverride (
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbGetTablePtr (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_TABLE_HEADER **TablePtrLoc);
+
+ACPI_STATUS
+AcpiTbVerifyRsdp (
+ ACPI_POINTER *Address);
+
+void
+AcpiTbGetRsdtAddress (
+ ACPI_POINTER *OutAddress);
+
+ACPI_STATUS
+AcpiTbValidateRsdt (
+ ACPI_TABLE_HEADER *TablePtr);
+
+ACPI_STATUS
+AcpiTbGetRequiredTables (
+ void);
+
+ACPI_STATUS
+AcpiTbGetPrimaryTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbGetSecondaryTable (
+ ACPI_POINTER *Address,
+ ACPI_STRING Signature,
+ ACPI_TABLE_DESC *TableInfo);
+
+/*
+ * tbinstall - Table installation
+ */
+
+ACPI_STATUS
+AcpiTbInstallTable (
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
+AcpiTbMatchSignature (
+ char *Signature,
+ ACPI_TABLE_DESC *TableInfo,
+ UINT8 SearchType);
+
+ACPI_STATUS
+AcpiTbRecognizeTable (
+ ACPI_TABLE_DESC *TableInfo,
+ UINT8 SearchType);
+
+ACPI_STATUS
+AcpiTbInitTableDescriptor (
+ ACPI_TABLE_TYPE TableType,
+ ACPI_TABLE_DESC *TableInfo);
+
+
+/*
+ * tbremove - Table removal and deletion
+ */
+
+void
+AcpiTbDeleteAllTables (
+ void);
+
+void
+AcpiTbDeleteTablesByType (
+ ACPI_TABLE_TYPE Type);
+
+void
+AcpiTbDeleteSingleTable (
+ ACPI_TABLE_DESC *TableDesc);
+
+ACPI_TABLE_DESC *
+AcpiTbUninstallTable (
+ ACPI_TABLE_DESC *TableDesc);
+
+
+/*
+ * tbrsd - RSDP, RSDT utilities
+ */
+
+ACPI_STATUS
+AcpiTbGetTableRsdt (
+ void);
+
+UINT8 *
+AcpiTbScanMemoryForRsdp (
+ UINT8 *StartAddress,
+ UINT32 Length);
+
+ACPI_STATUS
+AcpiTbFindRsdp (
+ ACPI_TABLE_DESC *TableInfo,
+ UINT32 Flags);
+
+
+/*
+ * tbutils - common table utilities
+ */
+
+ACPI_STATUS
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_TABLE_HEADER **TablePtr);
+
+ACPI_STATUS
+AcpiTbVerifyTableChecksum (
+ ACPI_TABLE_HEADER *TableHeader);
+
+UINT8
+AcpiTbChecksum (
+ void *Buffer,
+ UINT32 Length);
+
+ACPI_STATUS
+AcpiTbValidateTableHeader (
+ ACPI_TABLE_HEADER *TableHeader);
+
+
+#endif /* __ACTABLES_H__ */
diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h
new file mode 100644
index 0000000..0482fac
--- /dev/null
+++ b/sys/contrib/dev/acpica/actbl.h
@@ -0,0 +1,317 @@
+/******************************************************************************
+ *
+ * Name: actbl.h - Table data structures defined in ACPI specification
+ * $Revision: 59 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTBL_H__
+#define __ACTBL_H__
+
+
+/*
+ * Values for description table header signatures
+ */
+#define RSDP_NAME "RSDP"
+#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
+#define APIC_SIG "APIC" /* Multiple APIC Description Table */
+#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
+#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
+#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
+#define PSDT_SIG "PSDT" /* Persistent System Description Table */
+#define RSDT_SIG "RSDT" /* Root System Description Table */
+#define XSDT_SIG "XSDT" /* Extended System Description Table */
+#define SSDT_SIG "SSDT" /* Secondary System Description Table */
+#define SBST_SIG "SBST" /* Smart Battery Specification Table */
+#define SPIC_SIG "SPIC" /* IOSAPIC table */
+#define BOOT_SIG "BOOT" /* Boot table */
+
+
+#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
+
+/* values of Mapic.Model */
+
+#define DUAL_PIC 0
+#define MULTIPLE_APIC 1
+
+/* values of Type in APIC_HEADER */
+
+#define APIC_PROC 0
+#define APIC_IO 1
+
+
+/*
+ * Common table types. The base code can remain
+ * constant if the underlying tables are changed
+ */
+#define RSDT_DESCRIPTOR RSDT_DESCRIPTOR_REV2
+#define XSDT_DESCRIPTOR XSDT_DESCRIPTOR_REV2
+#define FACS_DESCRIPTOR FACS_DESCRIPTOR_REV2
+#define FADT_DESCRIPTOR FADT_DESCRIPTOR_REV2
+
+
+#pragma pack(1)
+
+/*
+ * Architecture-independent tables
+ * The architecture dependent tables are in separate files
+ */
+typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
+{
+ char Signature [8]; /* ACPI signature, contains "RSD PTR " */
+ UINT8 Checksum; /* To make sum of struct == 0 */
+ char OemId [6]; /* OEM identification */
+ UINT8 Revision; /* Must be 0 for 1.0, 2 for 2.0 */
+ UINT32 RsdtPhysicalAddress; /* 32-bit physical address of RSDT */
+ UINT32 Length; /* XSDT Length in bytes including hdr */
+ UINT64 XsdtPhysicalAddress; /* 64-bit physical address of XSDT */
+ UINT8 ExtendedChecksum; /* Checksum of entire table */
+ char Reserved [3]; /* Reserved field must be 0 */
+
+} RSDP_DESCRIPTOR;
+
+
+typedef struct acpi_table_header /* ACPI common table header */
+{
+ char Signature [4]; /* ACPI signature (4 ASCII characters) */
+ UINT32 Length; /* Length of table, in bytes, including header */
+ UINT8 Revision; /* ACPI Specification minor version # */
+ UINT8 Checksum; /* To make sum of entire table == 0 */
+ char OemId [6]; /* OEM identification */
+ char OemTableId [8]; /* OEM table identification */
+ UINT32 OemRevision; /* OEM revision number */
+ char AslCompilerId [4]; /* ASL compiler vendor ID */
+ UINT32 AslCompilerRevision; /* ASL compiler revision number */
+
+} ACPI_TABLE_HEADER;
+
+
+typedef struct acpi_common_facs /* Common FACS for internal use */
+{
+ UINT32 *GlobalLock;
+ UINT64 *FirmwareWakingVector;
+ UINT8 VectorWidth;
+
+} ACPI_COMMON_FACS;
+
+
+typedef struct apic_table
+{
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
+ UINT32 LocalApicAddress; /* Physical address for accessing local APICs */
+ UINT32_BIT PCATCompat : 1; /* a one indicates system also has dual 8259s */
+ UINT32_BIT Reserved1 : 31;
+
+} APIC_TABLE;
+
+
+typedef struct apic_header
+{
+ UINT8 Type; /* APIC type. Either APIC_PROC or APIC_IO */
+ UINT8 Length; /* Length of APIC structure */
+
+} APIC_HEADER;
+
+
+typedef struct processor_apic
+{
+ APIC_HEADER Header;
+ UINT8 ProcessorApicId; /* ACPI processor id */
+ UINT8 LocalApicId; /* Processor's local APIC id */
+ UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */
+ UINT32_BIT Reserved1 : 31;
+
+} PROCESSOR_APIC;
+
+
+typedef struct io_apic
+{
+ APIC_HEADER Header;
+ UINT8 IoApicId; /* I/O APIC ID */
+ UINT8 Reserved; /* Reserved - must be zero */
+ UINT32 IoApicAddress; /* APIC's physical address */
+ UINT32 Vector; /* Interrupt vector index where INTI
+ * lines start */
+} IO_APIC;
+
+
+/*
+ * IA64 TBD: Add SAPIC Tables
+ */
+
+/*
+ * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64
+ * extensions.
+ */
+typedef struct smart_battery_description_table
+{
+ ACPI_TABLE_HEADER Header;
+ UINT32 WarningLevel;
+ UINT32 LowLevel;
+ UINT32 CriticalLevel;
+
+} SMART_BATTERY_DESCRIPTION_TABLE;
+
+typedef struct hpet_description_table
+{
+ ACPI_TABLE_HEADER Header;
+ UINT32 HardwareId;
+ UINT32 BaseAddress[3];
+ UINT8 HpetNumber;
+ UINT16 ClockTick;
+ UINT8 Attributes;
+
+} HPET_DESCRIPTION_TABLE;
+#pragma pack()
+
+
+/*
+ * ACPI Table information. We save the table address, length,
+ * and type of memory allocation (mapped or allocated) for each
+ * table for 1) when we exit, and 2) if a new table is installed
+ */
+#define ACPI_MEM_NOT_ALLOCATED 0
+#define ACPI_MEM_ALLOCATED 1
+#define ACPI_MEM_MAPPED 2
+
+/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
+
+#define ACPI_TABLE_SINGLE 0x00
+#define ACPI_TABLE_MULTIPLE 0x01
+#define ACPI_TABLE_EXECUTABLE 0x02
+
+#define ACPI_TABLE_ROOT 0x00
+#define ACPI_TABLE_PRIMARY 0x10
+#define ACPI_TABLE_SECONDARY 0x20
+#define ACPI_TABLE_ALL 0x30
+#define ACPI_TABLE_TYPE_MASK 0x30
+
+/* Data about each known table type */
+
+typedef struct acpi_table_support
+{
+ char *Name;
+ char *Signature;
+ void **GlobalPtr;
+ UINT8 SigLength;
+ UINT8 Flags;
+
+} ACPI_TABLE_SUPPORT;
+
+
+/*
+ * Get the architecture-specific tables
+ */
+#include "actbl1.h" /* Acpi 1.0 table definitions */
+#include "actbl2.h" /* Acpi 2.0 table definitions */
+
+#endif /* __ACTBL_H__ */
diff --git a/sys/contrib/dev/acpica/actbl1.h b/sys/contrib/dev/acpica/actbl1.h
new file mode 100644
index 0000000..5b931a3
--- /dev/null
+++ b/sys/contrib/dev/acpica/actbl1.h
@@ -0,0 +1,211 @@
+/******************************************************************************
+ *
+ * Name: actbl1.h - ACPI 1.0 tables
+ * $Revision: 26 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTBL1_H__
+#define __ACTBL1_H__
+
+#pragma pack(1)
+
+/*
+ * ACPI 1.0 Root System Description Table (RSDT)
+ */
+typedef struct rsdt_descriptor_rev1
+{
+ ACPI_TABLE_HEADER Header; /* ACPI Table header */
+ UINT32 TableOffsetEntry [1]; /* Array of pointers to other */
+ /* ACPI tables */
+} RSDT_DESCRIPTOR_REV1;
+
+
+/*
+ * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ */
+typedef struct facs_descriptor_rev1
+{
+ char Signature[4]; /* ACPI Signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
+ UINT32 FirmwareWakingVector; /* ACPI OS waking vector */
+ UINT32 GlobalLock; /* Global Lock */
+ UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
+ UINT32_BIT Reserved1 : 31; /* Must be 0 */
+ UINT8 Resverved3 [40]; /* Reserved - must be zero */
+
+} FACS_DESCRIPTOR_REV1;
+
+
+/*
+ * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ */
+typedef struct fadt_descriptor_rev1
+{
+ ACPI_TABLE_HEADER Header; /* ACPI Table header */
+ UINT32 FirmwareCtrl; /* Physical address of FACS */
+ UINT32 Dsdt; /* Physical address of DSDT */
+ UINT8 Model; /* System Interrupt Model */
+ UINT8 Reserved1; /* Reserved */
+ UINT16 SciInt; /* System vector of SCI interrupt */
+ UINT32 SmiCmd; /* Port address of SMI command port */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
+ UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
+ UINT8 Reserved2; /* Reserved - must be zero */
+ UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
+ UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
+ UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
+ UINT32 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */
+ UINT32 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */
+ UINT32 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
+ UINT32 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */
+ UINT32 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */
+ UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */
+ UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */
+ UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */
+ UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
+ UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
+ UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
+ UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
+ UINT8 Reserved3; /* Reserved */
+ UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
+ UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
+ UINT16 FlushSize; /* Size of area read to flush caches */
+ UINT16 FlushStride; /* Stride used in flushing caches */
+ UINT8 DutyOffset; /* Bit location of duty cycle field in p_cnt reg */
+ UINT8 DutyWidth; /* Bit width of duty cycle field in p_cnt reg */
+ UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* Index to century in RTC CMOS RAM */
+ UINT8 Reserved4; /* Reserved */
+ UINT8 Reserved4a; /* Reserved */
+ UINT8 Reserved4b; /* Reserved */
+ UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
+ UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
+ UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
+ UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
+ UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
+ UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
+ UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
+ UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
+ UINT32_BIT TmrValExt : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
+ UINT32_BIT Reserved5 : 23; /* Reserved - must be zero */
+
+} FADT_DESCRIPTOR_REV1;
+
+#pragma pack()
+
+#endif /* __ACTBL1_H__ */
+
+
diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/actbl2.h
new file mode 100644
index 0000000..a683645
--- /dev/null
+++ b/sys/contrib/dev/acpica/actbl2.h
@@ -0,0 +1,277 @@
+/******************************************************************************
+ *
+ * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
+ * $Revision: 32 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTBL2_H__
+#define __ACTBL2_H__
+
+/*
+ * Prefered Power Management Profiles
+ */
+#define PM_UNSPECIFIED 0
+#define PM_DESKTOP 1
+#define PM_MOBILE 2
+#define PM_WORKSTATION 3
+#define PM_ENTERPRISE_SERVER 4
+#define PM_SOHO_SERVER 5
+#define PM_APPLIANCE_PC 6
+
+/*
+ * ACPI Boot Arch Flags
+ */
+#define BAF_LEGACY_DEVICES 0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
+
+#define FADT2_REVISION_ID 3
+
+
+#pragma pack(1)
+
+/*
+ * ACPI 2.0 Root System Description Table (RSDT)
+ */
+typedef struct rsdt_descriptor_rev2
+{
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
+ UINT32 TableOffsetEntry [1]; /* Array of pointers to */
+ /* ACPI table headers */
+} RSDT_DESCRIPTOR_REV2;
+
+
+/*
+ * ACPI 2.0 Extended System Description Table (XSDT)
+ */
+typedef struct xsdt_descriptor_rev2
+{
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
+ UINT64 TableOffsetEntry [1]; /* Array of pointers to */
+ /* ACPI table headers */
+} XSDT_DESCRIPTOR_REV2;
+
+
+/*
+ * ACPI 2.0 Firmware ACPI Control Structure (FACS)
+ */
+typedef struct facs_descriptor_rev2
+{
+ char Signature[4]; /* ACPI signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
+ UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */
+ UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */
+ UINT32 S4Bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
+ UINT32_BIT Reserved1 : 31; /* Must be 0 */
+ UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */
+ UINT8 Version; /* Version of this table */
+ UINT8 Reserved3 [31]; /* Reserved - must be zero */
+
+} FACS_DESCRIPTOR_REV2;
+
+
+/*
+ * ACPI 2.0 Generic Address Structure (GAS)
+ */
+typedef struct acpi_generic_address
+{
+ UINT8 AddressSpaceId; /* Address space where struct or register exists. */
+ UINT8 RegisterBitWidth; /* Size in bits of given register */
+ UINT8 RegisterBitOffset; /* Bit offset within the register */
+ UINT8 Reserved; /* Must be 0 */
+ UINT64 Address; /* 64-bit address of struct or register */
+
+} ACPI_GENERIC_ADDRESS;
+
+
+/*
+ * ACPI 2.0 Fixed ACPI Description Table (FADT)
+ */
+typedef struct fadt_descriptor_rev2
+{
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
+ UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */
+ UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */
+ UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/
+ UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */
+ UINT16 SciInt; /* System vector of SCI interrupt */
+ UINT32 SmiCmd; /* Port address of SMI command port */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
+ UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
+ UINT8 PstateCnt; /* Processor performance state control*/
+ UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
+ UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
+ UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
+ UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */
+ UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */
+ UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
+ UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */
+ UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */
+ UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */
+ UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */
+ UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */
+ UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
+ UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
+ UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
+ UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
+ UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/
+ UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
+ UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
+ UINT16 FlushSize; /* Number of flush strides that need to be read */
+ UINT16 FlushStride; /* Processor's memory cache line width, in bytes */
+ UINT8 DutyOffset; /* Processor's duty cycle index in processor's P_CNT reg*/
+ UINT8 DutyWidth; /* Processor's duty cycle value bit width in P_CNT register.*/
+ UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* Index to century in RTC CMOS RAM */
+ UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
+ UINT8 Reserved2; /* Reserved */
+ UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
+ UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
+ UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
+ UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
+ UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
+ UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
+ UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
+ UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
+ UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/
+ UINT32_BIT DockCap : 1; /* Supports Docking */
+ UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
+ UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */
+ UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/
+ UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */
+ /* Must be executed after writing the SLP_TYPx register. */
+ UINT32_BIT Reserved6 : 18; /* Reserved - must be zero */
+
+ ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
+ UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
+ UINT8 Reserved7[3]; /* These three bytes must be zero */
+ UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */
+ UINT64 XDsdt; /* 64-bit physical address of DSDT */
+ ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */
+
+} FADT_DESCRIPTOR_REV2;
+
+
+#pragma pack()
+
+#endif /* __ACTBL2_H__ */
+
diff --git a/sys/contrib/dev/acpica/actbl71.h b/sys/contrib/dev/acpica/actbl71.h
new file mode 100644
index 0000000..6a84009
--- /dev/null
+++ b/sys/contrib/dev/acpica/actbl71.h
@@ -0,0 +1,238 @@
+/******************************************************************************
+ *
+ * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
+ * This file includes tables specific to this
+ * specification revision.
+ * $Revision: 12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTBL71_H__
+#define __ACTBL71_H__
+
+
+/* 0.71 FADT AddressSpace data item bitmasks defines */
+/* If the associated bit is zero then it is in memory space else in io space */
+
+#define SMI_CMD_ADDRESS_SPACE 0x01
+#define PM1_BLK_ADDRESS_SPACE 0x02
+#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
+#define PM_TMR_BLK_ADDRESS_SPACE 0x08
+#define GPE0_BLK_ADDRESS_SPACE 0x10
+#define GPE1_BLK_ADDRESS_SPACE 0x20
+
+/* Only for clarity in declarations */
+
+typedef UINT64 IO_ADDRESS;
+
+
+#pragma pack(1)
+typedef struct /* Root System Descriptor Pointer */
+{
+ NATIVE_CHAR Signature [8]; /* contains "RSD PTR " */
+ UINT8 Checksum; /* to make sum of struct == 0 */
+ NATIVE_CHAR OemId [6]; /* OEM identification */
+ UINT8 Reserved; /* Must be 0 for 1.0, 2 for 2.0 */
+ UINT64 RsdtPhysicalAddress; /* 64-bit physical address of RSDT */
+} RSDP_DESCRIPTOR_REV071;
+
+
+/*****************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71 */
+/* for the Root System Description Table */
+/*****************************************/
+typedef struct
+{
+ ACPI_TABLE_HEADER header; /* Table header */
+ UINT32 ReservedPad; /* IA64 alignment, must be 0 */
+ UINT64 TableOffsetEntry [1]; /* Array of pointers to other */
+ /* tables' headers */
+} RSDT_DESCRIPTOR_REV071;
+
+
+/*******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71 */
+/* for the Firmware ACPI Control Structure */
+/*******************************************/
+typedef struct
+{
+ NATIVE_CHAR Signature[4]; /* signature "FACS" */
+ UINT32 Length; /* length of structure, in bytes */
+ UINT32 HardwareSignature; /* hardware configuration signature */
+ UINT32 Reserved4; /* must be 0 */
+ UINT64 FirmwareWakingVector; /* ACPI OS waking vector */
+ UINT64 GlobalLock; /* Global Lock */
+ UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
+ UINT32_BIT Reserved1 : 31; /* must be 0 */
+ UINT8 Reserved3 [28]; /* reserved - must be zero */
+
+} FACS_DESCRIPTOR_REV071;
+
+
+/******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71 */
+/* for the Fixed ACPI Description Table */
+/******************************************/
+typedef struct
+{
+ ACPI_TABLE_HEADER header; /* table header */
+ UINT32 ReservedPad; /* IA64 alignment, must be 0 */
+ UINT64 FirmwareCtrl; /* 64-bit Physical address of FACS */
+ UINT64 Dsdt; /* 64-bit Physical address of DSDT */
+ UINT8 Model; /* System Interrupt Model */
+ UINT8 AddressSpace; /* Address Space Bitmask */
+ UINT16 SciInt; /* System vector of SCI interrupt */
+ UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */
+ UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
+ UINT8 Reserved2; /* reserved - must be zero */
+ UINT64 SmiCmd; /* Port address of SMI command port */
+ UINT64 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
+ UINT64 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
+ UINT64 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
+ UINT64 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */
+ UINT64 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */
+ UINT64 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
+ UINT64 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */
+ UINT64 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */
+ UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */
+ UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */
+ UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */
+ UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
+ UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
+ UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
+ UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */
+ UINT8 Reserved3; /* reserved */
+ UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */
+ UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */
+ UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* index to century in RTC CMOS RAM */
+ UINT8 Reserved4; /* reserved */
+ UINT32_BIT FlushCash : 1; /* PAL_FLUSH_CACHE is correctly supported */
+ UINT32_BIT Reserved5 : 1; /* reserved - must be zero */
+ UINT32_BIT ProcC1 : 1; /* all processors support C1 state */
+ UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
+ UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
+ UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
+ UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
+ UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
+ UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */
+ UINT32_BIT DockCap : 1; /* Supports Docking */
+ UINT32_BIT Reserved6 : 22; /* reserved - must be zero */
+
+} FADT_DESCRIPTOR_REV071;
+
+#pragma pack()
+
+#endif /* __ACTBL71_H__ */
+
diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h
new file mode 100644
index 0000000..3064a1f
--- /dev/null
+++ b/sys/contrib/dev/acpica/actypes.h
@@ -0,0 +1,1360 @@
+/******************************************************************************
+ *
+ * Name: actypes.h - Common data types for the entire ACPI subsystem
+ * $Revision: 261 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACTYPES_H__
+#define __ACTYPES_H__
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+
+
+/*
+ * Data type ranges
+ * Note: These macros are designed to be compiler independent as well as
+ * working around problems that some 32-bit compilers have with 64-bit
+ * constants.
+ */
+#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
+#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
+#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
+#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
+#define ACPI_ASCII_MAX 0x7F
+
+
+#ifdef DEFINE_ALTERNATE_TYPES
+/*
+ * Types used only in translated source, defined here to enable
+ * cross-platform compilation only.
+ */
+typedef int s32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef COMPILER_DEPENDENT_UINT64 u64;
+
+#endif
+
+
+/*
+ * Data types - Fixed across all compilation models (16/32/64)
+ *
+ * BOOLEAN Logical Boolean.
+ * INT8 8-bit (1 byte) signed value
+ * UINT8 8-bit (1 byte) unsigned value
+ * INT16 16-bit (2 byte) signed value
+ * UINT16 16-bit (2 byte) unsigned value
+ * INT32 32-bit (4 byte) signed value
+ * UINT32 32-bit (4 byte) unsigned value
+ * INT64 64-bit (8 byte) signed value
+ * UINT64 64-bit (8 byte) unsigned value
+ * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
+ * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
+ */
+
+#ifndef ACPI_MACHINE_WIDTH
+#error ACPI_MACHINE_WIDTH not defined
+#endif
+
+#if ACPI_MACHINE_WIDTH == 64
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 64-bit type definitions
+ */
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned short UINT16;
+typedef int INT32;
+typedef unsigned int UINT32;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
+
+/*! [End] no source code translation !*/
+
+typedef INT64 ACPI_NATIVE_INT;
+typedef UINT64 ACPI_NATIVE_UINT;
+
+typedef UINT64 ACPI_TABLE_PTR;
+typedef UINT64 ACPI_IO_ADDRESS;
+typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT64 ACPI_SIZE;
+
+#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
+#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
+#define ACPI_MAX_PTR ACPI_UINT64_MAX
+#define ACPI_SIZE_MAX ACPI_UINT64_MAX
+
+
+#elif ACPI_MACHINE_WIDTH == 16
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 16-bit type definitions
+ */
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned int UINT16;
+typedef long INT32;
+typedef int INT16;
+typedef unsigned long UINT32;
+
+typedef struct
+{
+ UINT32 Lo;
+ UINT32 Hi;
+
+} UINT64;
+
+/*! [End] no source code translation !*/
+
+typedef UINT16 ACPI_NATIVE_UINT;
+typedef INT16 ACPI_NATIVE_INT;
+
+typedef UINT32 ACPI_TABLE_PTR;
+typedef UINT32 ACPI_IO_ADDRESS;
+typedef char *ACPI_PHYSICAL_ADDRESS;
+typedef UINT16 ACPI_SIZE;
+
+#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
+#define ACPI_MISALIGNED_TRANSFERS
+#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
+#define ACPI_MAX_PTR ACPI_UINT16_MAX
+#define ACPI_SIZE_MAX ACPI_UINT16_MAX
+
+/*
+ * (16-bit only) internal integers must be 32-bits, so
+ * 64-bit integers cannot be supported
+ */
+#define ACPI_NO_INTEGER64_SUPPORT
+
+
+#elif ACPI_MACHINE_WIDTH == 32
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 32-bit type definitions (default)
+ */
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned short UINT16;
+typedef int INT32;
+typedef unsigned int UINT32;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
+
+/*! [End] no source code translation !*/
+
+typedef INT32 ACPI_NATIVE_INT;
+typedef UINT32 ACPI_NATIVE_UINT;
+
+typedef UINT64 ACPI_TABLE_PTR;
+typedef UINT32 ACPI_IO_ADDRESS;
+typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT32 ACPI_SIZE;
+
+#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
+#define ACPI_MISALIGNED_TRANSFERS
+#define ACPI_MAX_PTR ACPI_UINT32_MAX
+#define ACPI_SIZE_MAX ACPI_UINT32_MAX
+
+#else
+#error unknown ACPI_MACHINE_WIDTH
+#endif
+
+
+/*
+ * Miscellaneous common types
+ */
+typedef UINT32 UINT32_BIT;
+typedef ACPI_NATIVE_UINT ACPI_PTRDIFF;
+
+/*
+ * Pointer overlays to avoid lots of typecasting for
+ * code that accepts both physical and logical pointers.
+ */
+typedef union acpi_pointers
+{
+ ACPI_PHYSICAL_ADDRESS Physical;
+ void *Logical;
+ ACPI_TABLE_PTR Value;
+
+} ACPI_POINTERS;
+
+typedef struct acpi_pointer
+{
+ UINT32 PointerType;
+ union acpi_pointers Pointer;
+
+} ACPI_POINTER;
+
+/* PointerTypes for above */
+
+#define ACPI_PHYSICAL_POINTER 0x01
+#define ACPI_LOGICAL_POINTER 0x02
+
+/* Processor mode */
+
+#define ACPI_PHYSICAL_ADDRESSING 0x04
+#define ACPI_LOGICAL_ADDRESSING 0x08
+#define ACPI_MEMORY_MODE 0x0C
+
+#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
+#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
+#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
+
+
+/*
+ * Useful defines
+ */
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE (1 == 0)
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE (1 == 1)
+
+#ifndef NULL
+#define NULL (void *) 0
+#endif
+
+
+/*
+ * Local datatypes
+ */
+typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */
+typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */
+typedef char * ACPI_STRING; /* Null terminated ASCII string */
+typedef void * ACPI_HANDLE; /* Actually a ptr to an Node */
+
+typedef struct uint64_struct
+{
+ UINT32 Lo;
+ UINT32 Hi;
+
+} UINT64_STRUCT;
+
+typedef union uint64_overlay
+{
+ UINT64 Full;
+ UINT64_STRUCT Part;
+
+} UINT64_OVERLAY;
+
+typedef struct uint32_struct
+{
+ UINT32 Lo;
+ UINT32 Hi;
+
+} UINT32_STRUCT;
+
+
+/*
+ * Acpi integer width. In ACPI version 1, integers are
+ * 32 bits. In ACPI version 2, integers are 64 bits.
+ * Note that this pertains to the ACPI integer type only, not
+ * other integers used in the implementation of the ACPI CA
+ * subsystem.
+ */
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+
+/* 32-bit integers only, no 64-bit support */
+
+typedef UINT32 ACPI_INTEGER;
+#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
+#define ACPI_INTEGER_BIT_SIZE 32
+#define ACPI_MAX_DECIMAL_DIGITS 10
+
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
+
+
+#else
+
+/* 64-bit integers */
+
+typedef UINT64 ACPI_INTEGER;
+#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
+#define ACPI_INTEGER_BIT_SIZE 64
+#define ACPI_MAX_DECIMAL_DIGITS 19
+
+#if ACPI_MACHINE_WIDTH == 64
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
+#endif
+#endif
+
+
+/*
+ * Constants with special meanings
+ */
+#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
+
+
+/*
+ * Initialization sequence
+ */
+#define ACPI_FULL_INITIALIZATION 0x00
+#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
+#define ACPI_NO_HARDWARE_INIT 0x02
+#define ACPI_NO_EVENT_INIT 0x04
+#define ACPI_NO_HANDLER_INIT 0x08
+#define ACPI_NO_ACPI_ENABLE 0x10
+#define ACPI_NO_DEVICE_INIT 0x20
+#define ACPI_NO_OBJECT_INIT 0x40
+
+/*
+ * Initialization state
+ */
+#define ACPI_INITIALIZED_OK 0x01
+
+/*
+ * Power state values
+ */
+
+#define ACPI_STATE_UNKNOWN (UINT8) 0xFF
+
+#define ACPI_STATE_S0 (UINT8) 0
+#define ACPI_STATE_S1 (UINT8) 1
+#define ACPI_STATE_S2 (UINT8) 2
+#define ACPI_STATE_S3 (UINT8) 3
+#define ACPI_STATE_S4 (UINT8) 4
+#define ACPI_STATE_S5 (UINT8) 5
+#define ACPI_S_STATES_MAX ACPI_STATE_S5
+#define ACPI_S_STATE_COUNT 6
+
+#define ACPI_STATE_D0 (UINT8) 0
+#define ACPI_STATE_D1 (UINT8) 1
+#define ACPI_STATE_D2 (UINT8) 2
+#define ACPI_STATE_D3 (UINT8) 3
+#define ACPI_D_STATES_MAX ACPI_STATE_D3
+#define ACPI_D_STATE_COUNT 4
+
+#define ACPI_STATE_C0 (UINT8) 0
+#define ACPI_STATE_C1 (UINT8) 1
+#define ACPI_STATE_C2 (UINT8) 2
+#define ACPI_STATE_C3 (UINT8) 3
+#define ACPI_C_STATES_MAX ACPI_STATE_C3
+#define ACPI_C_STATE_COUNT 4
+
+/*
+ * Sleep type invalid value
+ */
+#define ACPI_SLEEP_TYPE_MAX 0x7
+#define ACPI_SLEEP_TYPE_INVALID 0xFF
+
+/*
+ * Standard notify values
+ */
+#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0
+#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1
+#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2
+#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3
+#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4
+#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5
+#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6
+#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7
+
+
+/*
+ * Table types. These values are passed to the table related APIs
+ */
+typedef UINT32 ACPI_TABLE_TYPE;
+
+#define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0
+#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1
+#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2
+#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3
+#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4
+#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5
+#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6
+#define ACPI_TABLE_MAX 6
+#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
+
+
+/*
+ * Types associated with ACPI names and objects. The first group of
+ * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
+ * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
+ * only add to the first group if the spec changes.
+ *
+ * Types must be kept in sync with the global AcpiNsProperties
+ * and AcpiNsTypeNames arrays.
+ */
+typedef UINT32 ACPI_OBJECT_TYPE;
+
+#define ACPI_TYPE_ANY 0x00
+#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
+#define ACPI_TYPE_STRING 0x02
+#define ACPI_TYPE_BUFFER 0x03
+#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */
+#define ACPI_TYPE_FIELD_UNIT 0x05
+#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
+#define ACPI_TYPE_EVENT 0x07
+#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */
+#define ACPI_TYPE_MUTEX 0x09
+#define ACPI_TYPE_REGION 0x0A
+#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */
+#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
+#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
+#define ACPI_TYPE_BUFFER_FIELD 0x0E
+#define ACPI_TYPE_DDB_HANDLE 0x0F
+#define ACPI_TYPE_DEBUG_OBJECT 0x10
+
+#define ACPI_TYPE_EXTERNAL_MAX 0x10
+
+/*
+ * These are object types that do not map directly to the ACPI
+ * ObjectType() operator. They are used for various internal purposes only.
+ * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
+ * internal types must move upwards. (There is code that depends on these
+ * values being contiguous with the external types above.)
+ */
+#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
+#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
+#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
+#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */
+#define ACPI_TYPE_LOCAL_ALIAS 0x15
+#define ACPI_TYPE_LOCAL_NOTIFY 0x16
+#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17
+#define ACPI_TYPE_LOCAL_RESOURCE 0x18
+#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x19
+#define ACPI_TYPE_LOCAL_SCOPE 0x1A /* 1 Name, multiple ObjectList Nodes */
+
+#define ACPI_TYPE_NS_NODE_MAX 0x1A /* Last typecode used within a NS Node */
+
+/*
+ * These are special object types that never appear in
+ * a Namespace node, only in an ACPI_OPERAND_OBJECT
+ */
+#define ACPI_TYPE_LOCAL_EXTRA 0x1B
+#define ACPI_TYPE_LOCAL_DATA 0x1C
+
+#define ACPI_TYPE_LOCAL_MAX 0x1C
+
+/* All types above here are invalid */
+
+#define ACPI_TYPE_INVALID 0x1D
+#define ACPI_TYPE_NOT_FOUND 0xFF
+
+
+/*
+ * Bitmapped ACPI types. Used internally only
+ */
+#define ACPI_BTYPE_ANY 0x00000000
+#define ACPI_BTYPE_INTEGER 0x00000001
+#define ACPI_BTYPE_STRING 0x00000002
+#define ACPI_BTYPE_BUFFER 0x00000004
+#define ACPI_BTYPE_PACKAGE 0x00000008
+#define ACPI_BTYPE_FIELD_UNIT 0x00000010
+#define ACPI_BTYPE_DEVICE 0x00000020
+#define ACPI_BTYPE_EVENT 0x00000040
+#define ACPI_BTYPE_METHOD 0x00000080
+#define ACPI_BTYPE_MUTEX 0x00000100
+#define ACPI_BTYPE_REGION 0x00000200
+#define ACPI_BTYPE_POWER 0x00000400
+#define ACPI_BTYPE_PROCESSOR 0x00000800
+#define ACPI_BTYPE_THERMAL 0x00001000
+#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
+#define ACPI_BTYPE_DDB_HANDLE 0x00004000
+#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
+#define ACPI_BTYPE_REFERENCE 0x00010000
+#define ACPI_BTYPE_RESOURCE 0x00020000
+
+#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
+
+#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
+#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
+#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
+#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
+
+/*
+ * All I/O
+ */
+#define ACPI_READ 0
+#define ACPI_WRITE 1
+#define ACPI_IO_MASK 1
+
+
+/*
+ * Acpi Event Types: Fixed & General Purpose
+ */
+typedef UINT32 ACPI_EVENT_TYPE;
+
+/*
+ * Fixed events
+ */
+#define ACPI_EVENT_PMTIMER 0
+#define ACPI_EVENT_GLOBAL 1
+#define ACPI_EVENT_POWER_BUTTON 2
+#define ACPI_EVENT_SLEEP_BUTTON 3
+#define ACPI_EVENT_RTC 4
+#define ACPI_EVENT_MAX 4
+#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
+
+#define ACPI_GPE_INVALID 0xFF
+#define ACPI_GPE_MAX 0xFF
+#define ACPI_NUM_GPE 256
+
+#define ACPI_EVENT_LEVEL_TRIGGERED 1
+#define ACPI_EVENT_EDGE_TRIGGERED 2
+
+/*
+ * Flags for GPE and Lock interfaces
+ */
+#define ACPI_EVENT_WAKE_ENABLE 0x2
+#define ACPI_EVENT_WAKE_DISABLE 0x2
+
+#define ACPI_NOT_ISR 0x1
+#define ACPI_ISR 0x0
+
+
+/*
+ * AcpiEvent Status:
+ * -------------
+ * The encoding of ACPI_EVENT_STATUS is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the event is enabled).
+ * +-------------+-+-+-+
+ * | Bits 31:3 |2|1|0|
+ * +-------------+-+-+-+
+ * | | | |
+ * | | | +- Enabled?
+ * | | +--- Enabled for wake?
+ * | +----- Set?
+ * +----------- <Reserved>
+ */
+typedef UINT32 ACPI_EVENT_STATUS;
+
+#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00
+#define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01
+#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02
+#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04
+
+
+/* Notify types */
+
+#define ACPI_SYSTEM_NOTIFY 0
+#define ACPI_DEVICE_NOTIFY 1
+#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1
+
+#define ACPI_MAX_SYS_NOTIFY 0x7f
+
+
+/* Address Space (Operation Region) Types */
+
+typedef UINT8 ACPI_ADR_SPACE_TYPE;
+
+#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0
+#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1
+#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2
+#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3
+#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4
+#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
+#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
+#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7
+#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127
+
+
+/*
+ * BitRegister IDs
+ * These are bitfields defined within the full ACPI registers
+ */
+#define ACPI_BITREG_TIMER_STATUS 0x00
+#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
+#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
+#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
+#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
+#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
+#define ACPI_BITREG_WAKE_STATUS 0x06
+
+#define ACPI_BITREG_TIMER_ENABLE 0x07
+#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
+#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
+#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
+#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
+#define ACPI_BITREG_WAKE_ENABLE 0x0C
+
+#define ACPI_BITREG_SCI_ENABLE 0x0D
+#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
+#define ACPI_BITREG_SLEEP_TYPE_A 0x10
+#define ACPI_BITREG_SLEEP_TYPE_B 0x11
+#define ACPI_BITREG_SLEEP_ENABLE 0x12
+
+#define ACPI_BITREG_ARB_DISABLE 0x13
+
+#define ACPI_BITREG_MAX 0x13
+#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
+
+
+/*
+ * External ACPI object definition
+ */
+typedef union acpi_object
+{
+ ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ ACPI_INTEGER Value; /* The actual number */
+ } Integer;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Length; /* # of bytes in string, excluding trailing null */
+ char *Pointer; /* points to the string value */
+ } String;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Length; /* # of bytes in buffer */
+ UINT8 *Pointer; /* points to the buffer */
+ } Buffer;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Fill1;
+ ACPI_HANDLE Handle; /* object reference */
+ } Reference;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Count; /* # of elements in package */
+ union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
+ } Package;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 ProcId;
+ ACPI_IO_ADDRESS PblkAddress;
+ UINT32 PblkLength;
+ } Processor;
+
+ struct
+ {
+ ACPI_OBJECT_TYPE Type;
+ UINT32 SystemLevel;
+ UINT32 ResourceOrder;
+ } PowerResource;
+
+} ACPI_OBJECT;
+
+
+/*
+ * List of objects, used as a parameter list for control method evaluation
+ */
+typedef struct acpi_object_list
+{
+ UINT32 Count;
+ ACPI_OBJECT *Pointer;
+
+} ACPI_OBJECT_LIST;
+
+
+/*
+ * Miscellaneous common Data Structures used by the interfaces
+ */
+#define ACPI_NO_BUFFER 0
+#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1)
+#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2)
+
+typedef struct acpi_buffer
+{
+ ACPI_SIZE Length; /* Length in bytes of the buffer */
+ void *Pointer; /* pointer to buffer */
+
+} ACPI_BUFFER;
+
+
+/*
+ * NameType for AcpiGetName
+ */
+#define ACPI_FULL_PATHNAME 0
+#define ACPI_SINGLE_NAME 1
+#define ACPI_NAME_TYPE_MAX 1
+
+
+/*
+ * Structure and flags for AcpiGetSystemInfo
+ */
+#define ACPI_SYS_MODE_UNKNOWN 0x0000
+#define ACPI_SYS_MODE_ACPI 0x0001
+#define ACPI_SYS_MODE_LEGACY 0x0002
+#define ACPI_SYS_MODES_MASK 0x0003
+
+
+/*
+ * ACPI Table Info. One per ACPI table _type_
+ */
+typedef struct acpi_table_info
+{
+ UINT32 Count;
+
+} ACPI_TABLE_INFO;
+
+
+/*
+ * System info returned by AcpiGetSystemInfo()
+ */
+typedef struct acpi_system_info
+{
+ UINT32 AcpiCaVersion;
+ UINT32 Flags;
+ UINT32 TimerResolution;
+ UINT32 Reserved1;
+ UINT32 Reserved2;
+ UINT32 DebugLevel;
+ UINT32 DebugLayer;
+ UINT32 NumTableTypes;
+ ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLE_TYPES];
+
+} ACPI_SYSTEM_INFO;
+
+
+/*
+ * Types specific to the OS service interfaces
+ */
+
+typedef UINT32
+(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
+ void *Context);
+
+typedef void
+(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
+ void *Context);
+
+/*
+ * Various handlers and callback procedures
+ */
+typedef
+UINT32 (*ACPI_EVENT_HANDLER) (
+ void *Context);
+
+typedef
+void (*ACPI_GPE_HANDLER) (
+ void *Context);
+
+typedef
+void (*ACPI_NOTIFY_HANDLER) (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context);
+
+typedef
+void (*ACPI_OBJECT_HANDLER) (
+ ACPI_HANDLE Object,
+ UINT32 Function,
+ void *Data);
+
+typedef
+ACPI_STATUS (*ACPI_INIT_HANDLER) (
+ ACPI_HANDLE Object,
+ UINT32 Function);
+
+#define ACPI_INIT_DEVICE_INI 1
+
+
+/* Address Spaces (Operation Regions */
+
+typedef
+ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
+#define ACPI_DEFAULT_HANDLER NULL
+
+
+typedef
+ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
+ ACPI_HANDLE RegionHandle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
+
+#define ACPI_REGION_ACTIVATE 0
+#define ACPI_REGION_DEACTIVATE 1
+
+typedef
+ACPI_STATUS (*ACPI_WALK_CALLBACK) (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+
+/* Interrupt handler return values */
+
+#define ACPI_INTERRUPT_NOT_HANDLED 0x00
+#define ACPI_INTERRUPT_HANDLED 0x01
+
+
+/* Common string version of device HIDs and UIDs */
+
+typedef struct acpi_device_id
+{
+ char Value[ACPI_DEVICE_ID_LENGTH];
+
+} ACPI_DEVICE_ID;
+
+/* Common string version of device CIDs */
+
+typedef struct acpi_compatible_id
+{
+ char Value[ACPI_MAX_CID_LENGTH];
+
+} ACPI_COMPATIBLE_ID;
+
+typedef struct acpi_compatible_id_list
+{
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID Id[1];
+
+} ACPI_COMPATIBLE_ID_LIST;
+
+
+/* Structure and flags for AcpiGetObjectInfo */
+
+#define ACPI_VALID_STA 0x0001
+#define ACPI_VALID_ADR 0x0002
+#define ACPI_VALID_HID 0x0004
+#define ACPI_VALID_UID 0x0008
+#define ACPI_VALID_CID 0x0010
+
+
+#define ACPI_COMMON_OBJ_INFO \
+ ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
+ ACPI_NAME Name /* ACPI object Name */
+
+
+typedef struct acpi_obj_info_header
+{
+ ACPI_COMMON_OBJ_INFO;
+
+} ACPI_OBJ_INFO_HEADER;
+
+
+/* Structure returned from Get Object Info */
+
+typedef struct acpi_device_info
+{
+ ACPI_COMMON_OBJ_INFO;
+
+ UINT32 Valid; /* Indicates which fields are valid */
+ UINT32 CurrentStatus; /* _STA value */
+ ACPI_INTEGER Address; /* _ADR value if any */
+ ACPI_DEVICE_ID HardwareId; /* _HID value if any */
+ ACPI_DEVICE_ID UniqueId; /* _UID value if any */
+ ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
+
+} ACPI_DEVICE_INFO;
+
+
+/* Context structs for address space handlers */
+
+typedef struct acpi_pci_id
+{
+ UINT16 Segment;
+ UINT16 Bus;
+ UINT16 Device;
+ UINT16 Function;
+
+} ACPI_PCI_ID;
+
+
+typedef struct acpi_mem_space_context
+{
+ UINT32 Length;
+ ACPI_PHYSICAL_ADDRESS Address;
+ ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
+ UINT8 *MappedLogicalAddress;
+ ACPI_SIZE MappedLength;
+
+} ACPI_MEM_SPACE_CONTEXT;
+
+
+/*
+ * Definitions for Resource Attributes
+ */
+
+/*
+ * Memory Attributes
+ */
+#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
+#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
+
+#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00
+#define ACPI_CACHABLE_MEMORY (UINT8) 0x01
+#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
+#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
+
+/*
+ * IO Attributes
+ * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
+ * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
+ */
+#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
+#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
+#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
+
+#define ACPI_SPARSE_TRANSLATION (UINT8) 0x03
+
+/*
+ * IO Port Descriptor Decode
+ */
+#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
+#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
+
+/*
+ * IRQ Attributes
+ */
+#define ACPI_EDGE_SENSITIVE (UINT8) 0x00
+#define ACPI_LEVEL_SENSITIVE (UINT8) 0x01
+
+#define ACPI_ACTIVE_HIGH (UINT8) 0x00
+#define ACPI_ACTIVE_LOW (UINT8) 0x01
+
+#define ACPI_EXCLUSIVE (UINT8) 0x00
+#define ACPI_SHARED (UINT8) 0x01
+
+/*
+ * DMA Attributes
+ */
+#define ACPI_COMPATIBILITY (UINT8) 0x00
+#define ACPI_TYPE_A (UINT8) 0x01
+#define ACPI_TYPE_B (UINT8) 0x02
+#define ACPI_TYPE_F (UINT8) 0x03
+
+#define ACPI_NOT_BUS_MASTER (UINT8) 0x00
+#define ACPI_BUS_MASTER (UINT8) 0x01
+
+#define ACPI_TRANSFER_8 (UINT8) 0x00
+#define ACPI_TRANSFER_8_16 (UINT8) 0x01
+#define ACPI_TRANSFER_16 (UINT8) 0x02
+
+/*
+ * Start Dependent Functions Priority definitions
+ */
+#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
+#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
+#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
+
+/*
+ * 16, 32 and 64-bit Address Descriptor resource types
+ */
+#define ACPI_MEMORY_RANGE (UINT8) 0x00
+#define ACPI_IO_RANGE (UINT8) 0x01
+#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
+
+#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
+#define ACPI_ADDRESS_FIXED (UINT8) 0x01
+
+#define ACPI_POS_DECODE (UINT8) 0x00
+#define ACPI_SUB_DECODE (UINT8) 0x01
+
+#define ACPI_PRODUCER (UINT8) 0x00
+#define ACPI_CONSUMER (UINT8) 0x01
+
+
+/*
+ * Structures used to describe device resources
+ */
+typedef struct acpi_resource_irq
+{
+ UINT32 EdgeLevel;
+ UINT32 ActiveHighLow;
+ UINT32 SharedExclusive;
+ UINT32 NumberOfInterrupts;
+ UINT32 Interrupts[1];
+
+} ACPI_RESOURCE_IRQ;
+
+typedef struct ACPI_RESOURCE_DMA
+{
+ UINT32 Type;
+ UINT32 BusMaster;
+ UINT32 Transfer;
+ UINT32 NumberOfChannels;
+ UINT32 Channels[1];
+
+} ACPI_RESOURCE_DMA;
+
+typedef struct acpi_resource_start_dpf
+{
+ UINT32 CompatibilityPriority;
+ UINT32 PerformanceRobustness;
+
+} ACPI_RESOURCE_START_DPF;
+
+/*
+ * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
+ * needed because it has no fields
+ */
+
+typedef struct acpi_resource_io
+{
+ UINT32 IoDecode;
+ UINT32 MinBaseAddress;
+ UINT32 MaxBaseAddress;
+ UINT32 Alignment;
+ UINT32 RangeLength;
+
+} ACPI_RESOURCE_IO;
+
+typedef struct acpi_resource_fixed_io
+{
+ UINT32 BaseAddress;
+ UINT32 RangeLength;
+
+} ACPI_RESOURCE_FIXED_IO;
+
+typedef struct acpi_resource_vendor
+{
+ UINT32 Length;
+ UINT8 Reserved[1];
+
+} ACPI_RESOURCE_VENDOR;
+
+typedef struct acpi_resource_end_tag
+{
+ UINT8 Checksum;
+
+} ACPI_RESOURCE_END_TAG;
+
+typedef struct acpi_resource_mem24
+{
+ UINT32 ReadWriteAttribute;
+ UINT32 MinBaseAddress;
+ UINT32 MaxBaseAddress;
+ UINT32 Alignment;
+ UINT32 RangeLength;
+
+} ACPI_RESOURCE_MEM24;
+
+typedef struct acpi_resource_mem32
+{
+ UINT32 ReadWriteAttribute;
+ UINT32 MinBaseAddress;
+ UINT32 MaxBaseAddress;
+ UINT32 Alignment;
+ UINT32 RangeLength;
+
+} ACPI_RESOURCE_MEM32;
+
+typedef struct acpi_resource_fixed_mem32
+{
+ UINT32 ReadWriteAttribute;
+ UINT32 RangeBaseAddress;
+ UINT32 RangeLength;
+
+} ACPI_RESOURCE_FIXED_MEM32;
+
+typedef struct acpi_memory_attribute
+{
+ UINT16 CacheAttribute;
+ UINT16 ReadWriteAttribute;
+
+} ACPI_MEMORY_ATTRIBUTE;
+
+typedef struct acpi_io_attribute
+{
+ UINT16 RangeAttribute;
+ UINT16 TranslationAttribute;
+
+} ACPI_IO_ATTRIBUTE;
+
+typedef struct acpi_bus_attribute
+{
+ UINT16 Reserved1;
+ UINT16 Reserved2;
+
+} ACPI_BUS_ATTRIBUTE;
+
+typedef union acpi_resource_attribute
+{
+ ACPI_MEMORY_ATTRIBUTE Memory;
+ ACPI_IO_ATTRIBUTE Io;
+ ACPI_BUS_ATTRIBUTE Bus;
+
+} ACPI_RESOURCE_ATTRIBUTE;
+
+typedef struct acpi_resource_source
+{
+ UINT32 Index;
+ UINT32 StringLength;
+ char *StringPtr;
+
+} ACPI_RESOURCE_SOURCE;
+
+typedef struct acpi_resource_address16
+{
+ UINT32 ResourceType;
+ UINT32 ProducerConsumer;
+ UINT32 Decode;
+ UINT32 MinAddressFixed;
+ UINT32 MaxAddressFixed;
+ ACPI_RESOURCE_ATTRIBUTE Attribute;
+ UINT32 Granularity;
+ UINT32 MinAddressRange;
+ UINT32 MaxAddressRange;
+ UINT32 AddressTranslationOffset;
+ UINT32 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS16;
+
+typedef struct acpi_resource_address32
+{
+ UINT32 ResourceType;
+ UINT32 ProducerConsumer;
+ UINT32 Decode;
+ UINT32 MinAddressFixed;
+ UINT32 MaxAddressFixed;
+ ACPI_RESOURCE_ATTRIBUTE Attribute;
+ UINT32 Granularity;
+ UINT32 MinAddressRange;
+ UINT32 MaxAddressRange;
+ UINT32 AddressTranslationOffset;
+ UINT32 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS32;
+
+typedef struct acpi_resource_address64
+{
+ UINT32 ResourceType;
+ UINT32 ProducerConsumer;
+ UINT32 Decode;
+ UINT32 MinAddressFixed;
+ UINT32 MaxAddressFixed;
+ ACPI_RESOURCE_ATTRIBUTE Attribute;
+ UINT64 Granularity;
+ UINT64 MinAddressRange;
+ UINT64 MaxAddressRange;
+ UINT64 AddressTranslationOffset;
+ UINT64 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS64;
+
+typedef struct acpi_resource_ext_irq
+{
+ UINT32 ProducerConsumer;
+ UINT32 EdgeLevel;
+ UINT32 ActiveHighLow;
+ UINT32 SharedExclusive;
+ UINT32 NumberOfInterrupts;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+ UINT32 Interrupts[1];
+
+} ACPI_RESOURCE_EXT_IRQ;
+
+
+/* ACPI_RESOURCE_TYPEs */
+
+#define ACPI_RSTYPE_IRQ 0
+#define ACPI_RSTYPE_DMA 1
+#define ACPI_RSTYPE_START_DPF 2
+#define ACPI_RSTYPE_END_DPF 3
+#define ACPI_RSTYPE_IO 4
+#define ACPI_RSTYPE_FIXED_IO 5
+#define ACPI_RSTYPE_VENDOR 6
+#define ACPI_RSTYPE_END_TAG 7
+#define ACPI_RSTYPE_MEM24 8
+#define ACPI_RSTYPE_MEM32 9
+#define ACPI_RSTYPE_FIXED_MEM32 10
+#define ACPI_RSTYPE_ADDRESS16 11
+#define ACPI_RSTYPE_ADDRESS32 12
+#define ACPI_RSTYPE_ADDRESS64 13
+#define ACPI_RSTYPE_EXT_IRQ 14
+
+typedef UINT32 ACPI_RESOURCE_TYPE;
+
+typedef union acpi_resource_data
+{
+ ACPI_RESOURCE_IRQ Irq;
+ ACPI_RESOURCE_DMA Dma;
+ ACPI_RESOURCE_START_DPF StartDpf;
+ ACPI_RESOURCE_IO Io;
+ ACPI_RESOURCE_FIXED_IO FixedIo;
+ ACPI_RESOURCE_VENDOR VendorSpecific;
+ ACPI_RESOURCE_END_TAG EndTag;
+ ACPI_RESOURCE_MEM24 Memory24;
+ ACPI_RESOURCE_MEM32 Memory32;
+ ACPI_RESOURCE_FIXED_MEM32 FixedMemory32;
+ ACPI_RESOURCE_ADDRESS16 Address16;
+ ACPI_RESOURCE_ADDRESS32 Address32;
+ ACPI_RESOURCE_ADDRESS64 Address64;
+ ACPI_RESOURCE_EXT_IRQ ExtendedIrq;
+
+} ACPI_RESOURCE_DATA;
+
+typedef struct acpi_resource
+{
+ ACPI_RESOURCE_TYPE Id;
+ UINT32 Length;
+ ACPI_RESOURCE_DATA Data;
+
+} ACPI_RESOURCE;
+
+#define ACPI_RESOURCE_LENGTH 12
+#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
+
+#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
+
+#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
+
+#ifdef ACPI_MISALIGNED_TRANSFERS
+#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length)
+#else
+#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
+#endif
+
+/*
+ * END: of definitions for Resource Attributes
+ */
+
+
+typedef struct acpi_pci_routing_table
+{
+ UINT32 Length;
+ UINT32 Pin;
+ ACPI_INTEGER Address; /* here for 64-bit alignment */
+ UINT32 SourceIndex;
+ char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
+
+} ACPI_PCI_ROUTING_TABLE;
+
+/*
+ * END: of definitions for PCI Routing tables
+ */
+
+
+#endif /* __ACTYPES_H__ */
diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h
new file mode 100644
index 0000000..ca52024
--- /dev/null
+++ b/sys/contrib/dev/acpica/acutils.h
@@ -0,0 +1,910 @@
+/******************************************************************************
+ *
+ * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
+ * $Revision: 155 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef _ACUTILS_H
+#define _ACUTILS_H
+
+
+typedef
+ACPI_STATUS (*ACPI_PKG_CALLBACK) (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+
+ACPI_STATUS
+AcpiUtWalkPackageTree (
+ ACPI_OPERAND_OBJECT *SourceObject,
+ void *TargetObject,
+ ACPI_PKG_CALLBACK WalkCallback,
+ void *Context);
+
+
+typedef struct acpi_pkg_info
+{
+ UINT8 *FreeSpace;
+ ACPI_SIZE Length;
+ UINT32 ObjectSpace;
+ UINT32 NumPackages;
+
+} ACPI_PKG_INFO;
+
+#define REF_INCREMENT (UINT16) 0
+#define REF_DECREMENT (UINT16) 1
+#define REF_FORCE_DELETE (UINT16) 2
+
+/* AcpiUtDumpBuffer */
+
+#define DB_BYTE_DISPLAY 1
+#define DB_WORD_DISPLAY 2
+#define DB_DWORD_DISPLAY 4
+#define DB_QWORD_DISPLAY 8
+
+
+/* Global initialization interfaces */
+
+void
+AcpiUtInitGlobals (
+ void);
+
+void
+AcpiUtTerminate (
+ void);
+
+
+/*
+ * UtInit - miscellaneous initialization and shutdown
+ */
+
+ACPI_STATUS
+AcpiUtHardwareInitialize (
+ void);
+
+void
+AcpiUtSubsystemShutdown (
+ void);
+
+ACPI_STATUS
+AcpiUtValidateFadt (
+ void);
+
+/*
+ * UtGlobal - Global data structures and procedures
+ */
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+char *
+AcpiUtGetMutexName (
+ UINT32 MutexId);
+
+#endif
+
+char *
+AcpiUtGetTypeName (
+ ACPI_OBJECT_TYPE Type);
+
+char *
+AcpiUtGetObjectTypeName (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+char *
+AcpiUtGetRegionName (
+ UINT8 SpaceId);
+
+char *
+AcpiUtGetEventName (
+ UINT32 EventId);
+
+char
+AcpiUtHexToAsciiChar (
+ ACPI_INTEGER Integer,
+ UINT32 Position);
+
+BOOLEAN
+AcpiUtValidObjectType (
+ ACPI_OBJECT_TYPE Type);
+
+ACPI_OWNER_ID
+AcpiUtAllocateOwnerId (
+ UINT32 IdType);
+
+
+/*
+ * UtClib - Local implementations of C library functions
+ */
+
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+
+ACPI_SIZE
+AcpiUtStrlen (
+ const char *String);
+
+char *
+AcpiUtStrcpy (
+ char *DstString,
+ const char *SrcString);
+
+char *
+AcpiUtStrncpy (
+ char *DstString,
+ const char *SrcString,
+ ACPI_SIZE Count);
+
+int
+AcpiUtStrncmp (
+ const char *String1,
+ const char *String2,
+ ACPI_SIZE Count);
+
+int
+AcpiUtStrcmp (
+ const char *String1,
+ const char *String2);
+
+char *
+AcpiUtStrcat (
+ char *DstString,
+ const char *SrcString);
+
+char *
+AcpiUtStrncat (
+ char *DstString,
+ const char *SrcString,
+ ACPI_SIZE Count);
+
+UINT32
+AcpiUtStrtoul (
+ const char *String,
+ char **Terminator,
+ UINT32 Base);
+
+char *
+AcpiUtStrstr (
+ char *String1,
+ char *String2);
+
+void *
+AcpiUtMemcpy (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count);
+
+void *
+AcpiUtMemset (
+ void *Dest,
+ ACPI_NATIVE_UINT Value,
+ ACPI_SIZE Count);
+
+int
+AcpiUtToUpper (
+ int c);
+
+int
+AcpiUtToLower (
+ int c);
+
+extern const UINT8 _acpi_ctype[];
+
+#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
+#define _ACPI_XS 0x40 /* extra space */
+#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
+#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
+#define _ACPI_DI 0x04 /* '0'-'9' */
+#define _ACPI_LO 0x02 /* 'a'-'z' */
+#define _ACPI_PU 0x10 /* punctuation */
+#define _ACPI_SP 0x08 /* space */
+#define _ACPI_UP 0x01 /* 'A'-'Z' */
+#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
+
+#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
+#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+#define ACPI_IS_ASCII(c) ((c) < 0x80)
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+/*
+ * UtCopy - Object construction and conversion interfaces
+ */
+
+ACPI_STATUS
+AcpiUtBuildSimpleObject(
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_OBJECT *UserObj,
+ UINT8 *DataSpace,
+ UINT32 *BufferSpaceUsed);
+
+ACPI_STATUS
+AcpiUtBuildPackageObject (
+ ACPI_OPERAND_OBJECT *Obj,
+ UINT8 *Buffer,
+ UINT32 *SpaceUsed);
+
+ACPI_STATUS
+AcpiUtCopyIelementToEelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+ACPI_STATUS
+AcpiUtCopyIelementToIelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+ACPI_STATUS
+AcpiUtCopyIobjectToEobject (
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
+AcpiUtCopyEsimpleToIsimple(
+ ACPI_OBJECT *UserObj,
+ ACPI_OPERAND_OBJECT **ReturnObj);
+
+ACPI_STATUS
+AcpiUtCopyEobjectToIobject (
+ ACPI_OBJECT *Obj,
+ ACPI_OPERAND_OBJECT **InternalObj);
+
+ACPI_STATUS
+AcpiUtCopyISimpleToIsimple (
+ ACPI_OPERAND_OBJECT *SourceObj,
+ ACPI_OPERAND_OBJECT *DestObj);
+
+ACPI_STATUS
+AcpiUtCopyIpackageToIpackage (
+ ACPI_OPERAND_OBJECT *SourceObj,
+ ACPI_OPERAND_OBJECT *DestObj,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiUtCopySimpleObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc);
+
+ACPI_STATUS
+AcpiUtCopyIobjectToIobject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **DestDesc,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * UtCreate - Object creation
+ */
+
+ACPI_STATUS
+AcpiUtUpdateObjectReference (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action);
+
+
+/*
+ * UtDebug - Debug interfaces
+ */
+
+void
+AcpiUtInitStackPtrTrace (
+ void);
+
+void
+AcpiUtTrackStackPtr (
+ void);
+
+void
+AcpiUtTrace (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo);
+
+void
+AcpiUtTracePtr (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ void *Pointer);
+
+void
+AcpiUtTraceU32 (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ UINT32 Integer);
+
+void
+AcpiUtTraceStr (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *String);
+
+void
+AcpiUtExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo);
+
+void
+AcpiUtStatusExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ ACPI_STATUS Status);
+
+void
+AcpiUtValueExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ ACPI_INTEGER Value);
+
+void
+AcpiUtPtrExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ UINT8 *Ptr);
+
+void
+AcpiUtReportInfo (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId);
+
+void
+AcpiUtReportError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId);
+
+void
+AcpiUtReportWarning (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId);
+
+void
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 componentId);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtDebugPrint (
+ UINT32 RequestedDebugLevel,
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE_FUNC;
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtDebugPrintRaw (
+ UINT32 RequestedDebugLevel,
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE_FUNC;
+
+
+/*
+ * UtDelete - Object deletion
+ */
+
+void
+AcpiUtDeleteInternalObj (
+ ACPI_OPERAND_OBJECT *Object);
+
+void
+AcpiUtDeleteInternalPackageObject (
+ ACPI_OPERAND_OBJECT *Object);
+
+void
+AcpiUtDeleteInternalSimpleObject (
+ ACPI_OPERAND_OBJECT *Object);
+
+void
+AcpiUtDeleteInternalObjectList (
+ ACPI_OPERAND_OBJECT **ObjList);
+
+
+/*
+ * UtEval - object evaluation
+ */
+
+/* Method name strings */
+
+#define METHOD_NAME__HID "_HID"
+#define METHOD_NAME__CID "_CID"
+#define METHOD_NAME__UID "_UID"
+#define METHOD_NAME__ADR "_ADR"
+#define METHOD_NAME__STA "_STA"
+#define METHOD_NAME__REG "_REG"
+#define METHOD_NAME__SEG "_SEG"
+#define METHOD_NAME__BBN "_BBN"
+#define METHOD_NAME__PRT "_PRT"
+#define METHOD_NAME__CRS "_CRS"
+#define METHOD_NAME__PRS "_PRS"
+
+
+ACPI_STATUS
+AcpiUtEvaluateObject (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ char *Path,
+ UINT32 ExpectedReturnBtypes,
+ ACPI_OPERAND_OBJECT **ReturnDesc);
+
+ACPI_STATUS
+AcpiUtEvaluateNumericObject (
+ char *ObjectName,
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_INTEGER *Address);
+
+ACPI_STATUS
+AcpiUtExecute_HID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_DEVICE_ID *Hid);
+
+ACPI_STATUS
+AcpiUtExecute_CID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
+
+ACPI_STATUS
+AcpiUtExecute_STA (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ UINT32 *StatusFlags);
+
+ACPI_STATUS
+AcpiUtExecute_UID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_DEVICE_ID *Uid);
+
+
+/*
+ * UtMutex - mutual exclusion interfaces
+ */
+
+ACPI_STATUS
+AcpiUtMutexInitialize (
+ void);
+
+void
+AcpiUtMutexTerminate (
+ void);
+
+ACPI_STATUS
+AcpiUtCreateMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+ACPI_STATUS
+AcpiUtDeleteMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+ACPI_STATUS
+AcpiUtAcquireMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+ACPI_STATUS
+AcpiUtReleaseMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+
+/*
+ * UtObject - internal object create/delete/cache routines
+ */
+
+ACPI_OPERAND_OBJECT *
+AcpiUtCreateInternalObjectDbg (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ ACPI_OBJECT_TYPE Type);
+
+void *
+AcpiUtAllocateObjectDescDbg (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId);
+
+#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
+#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
+
+void
+AcpiUtDeleteObjectDesc (
+ ACPI_OPERAND_OBJECT *Object);
+
+BOOLEAN
+AcpiUtValidInternalObject (
+ void *Object);
+
+ACPI_OPERAND_OBJECT *
+AcpiUtCreateBufferObject (
+ ACPI_SIZE BufferSize);
+
+
+/*
+ * UtRefCnt - Object reference count management
+ */
+
+void
+AcpiUtAddReference (
+ ACPI_OPERAND_OBJECT *Object);
+
+void
+AcpiUtRemoveReference (
+ ACPI_OPERAND_OBJECT *Object);
+
+/*
+ * UtSize - Object size routines
+ */
+
+ACPI_STATUS
+AcpiUtGetSimpleObjectSize (
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_SIZE *ObjLength);
+
+ACPI_STATUS
+AcpiUtGetPackageObjectSize (
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_SIZE *ObjLength);
+
+ACPI_STATUS
+AcpiUtGetObjectSize(
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_SIZE *ObjLength);
+
+ACPI_STATUS
+AcpiUtGetElementLength (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+
+/*
+ * UtState - Generic state creation/cache routines
+ */
+
+void
+AcpiUtPushGenericState (
+ ACPI_GENERIC_STATE **ListHead,
+ ACPI_GENERIC_STATE *State);
+
+ACPI_GENERIC_STATE *
+AcpiUtPopGenericState (
+ ACPI_GENERIC_STATE **ListHead);
+
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateGenericState (
+ void);
+
+ACPI_THREAD_STATE *
+AcpiUtCreateThreadState (
+ void);
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateUpdateState (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action);
+
+ACPI_GENERIC_STATE *
+AcpiUtCreatePkgState (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index);
+
+ACPI_STATUS
+AcpiUtCreateUpdateStateAndPush (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action,
+ ACPI_GENERIC_STATE **StateList);
+
+ACPI_STATUS
+AcpiUtCreatePkgStateAndPush (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index,
+ ACPI_GENERIC_STATE **StateList);
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateControlState (
+ void);
+
+void
+AcpiUtDeleteGenericState (
+ ACPI_GENERIC_STATE *State);
+
+void
+AcpiUtDeleteGenericStateCache (
+ void);
+
+void
+AcpiUtDeleteObjectCache (
+ void);
+
+/*
+ * utmisc
+ */
+
+void
+AcpiUtPrintString (
+ char *String,
+ UINT8 MaxLength);
+
+ACPI_STATUS
+AcpiUtDivide (
+ ACPI_INTEGER *InDividend,
+ ACPI_INTEGER *InDivisor,
+ ACPI_INTEGER *OutQuotient,
+ ACPI_INTEGER *OutRemainder);
+
+ACPI_STATUS
+AcpiUtShortDivide (
+ ACPI_INTEGER *InDividend,
+ UINT32 Divisor,
+ ACPI_INTEGER *OutQuotient,
+ UINT32 *OutRemainder);
+
+BOOLEAN
+AcpiUtValidAcpiName (
+ UINT32 Name);
+
+BOOLEAN
+AcpiUtValidAcpiCharacter (
+ char Character);
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger);
+
+char *
+AcpiUtStrupr (
+ char *SrcString);
+
+UINT8 *
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+UINT8
+AcpiUtGenerateChecksum (
+ UINT8 *Buffer,
+ UINT32 Length);
+
+UINT32
+AcpiUtDwordByteSwap (
+ UINT32 Value);
+
+void
+AcpiUtSetIntegerWidth (
+ UINT8 Revision);
+
+#ifdef ACPI_DEBUG_OUTPUT
+void
+AcpiUtDisplayInitPathname (
+ UINT8 Type,
+ ACPI_NAMESPACE_NODE *ObjHandle,
+ char *Path);
+
+#endif
+
+
+/*
+ * Utalloc - memory allocation and object caching
+ */
+
+void *
+AcpiUtAcquireFromCache (
+ UINT32 ListId);
+
+void
+AcpiUtReleaseToCache (
+ UINT32 ListId,
+ void *Object);
+
+void
+AcpiUtDeleteGenericCache (
+ UINT32 ListId);
+
+ACPI_STATUS
+AcpiUtValidateBuffer (
+ ACPI_BUFFER *Buffer);
+
+ACPI_STATUS
+AcpiUtInitializeBuffer (
+ ACPI_BUFFER *Buffer,
+ ACPI_SIZE RequiredLength);
+
+
+/* Memory allocation functions */
+
+void *
+AcpiUtAllocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+void *
+AcpiUtCallocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+void *
+AcpiUtAllocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+void *
+AcpiUtCallocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+void
+AcpiUtFreeAndTrack (
+ void *Address,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+ACPI_DEBUG_MEM_BLOCK *
+AcpiUtFindAllocation (
+ UINT32 ListId,
+ void *Allocation);
+
+ACPI_STATUS
+AcpiUtTrackAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ ACPI_SIZE Size,
+ UINT8 AllocType,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+ACPI_STATUS
+AcpiUtRemoveAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+void
+AcpiUtDumpAllocationInfo (
+ void);
+
+void
+AcpiUtDumpAllocations (
+ UINT32 Component,
+ char *Module);
+#endif
+
+
+#endif /* _ACUTILS_H */
diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h
new file mode 100644
index 0000000..fba83b2
--- /dev/null
+++ b/sys/contrib/dev/acpica/amlcode.h
@@ -0,0 +1,579 @@
+/******************************************************************************
+ *
+ * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
+ * Declarations and definitions contained herein are derived
+ * directly from the ACPI specification.
+ * $Revision: 73 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __AMLCODE_H__
+#define __AMLCODE_H__
+
+/* primary opcodes */
+
+#define AML_NULL_CHAR (UINT16) 0x00
+
+#define AML_ZERO_OP (UINT16) 0x00
+#define AML_ONE_OP (UINT16) 0x01
+#define AML_UNASSIGNED (UINT16) 0x02
+#define AML_ALIAS_OP (UINT16) 0x06
+#define AML_NAME_OP (UINT16) 0x08
+#define AML_BYTE_OP (UINT16) 0x0a
+#define AML_WORD_OP (UINT16) 0x0b
+#define AML_DWORD_OP (UINT16) 0x0c
+#define AML_STRING_OP (UINT16) 0x0d
+#define AML_QWORD_OP (UINT16) 0x0e /* ACPI 2.0 */
+#define AML_SCOPE_OP (UINT16) 0x10
+#define AML_BUFFER_OP (UINT16) 0x11
+#define AML_PACKAGE_OP (UINT16) 0x12
+#define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */
+#define AML_METHOD_OP (UINT16) 0x14
+#define AML_DUAL_NAME_PREFIX (UINT16) 0x2e
+#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f
+#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30
+#define AML_NAME_CHAR_FIRST (UINT16) 0x41
+#define AML_OP_PREFIX (UINT16) 0x5b
+#define AML_ROOT_PREFIX (UINT16) 0x5c
+#define AML_PARENT_PREFIX (UINT16) 0x5e
+#define AML_LOCAL_OP (UINT16) 0x60
+#define AML_LOCAL0 (UINT16) 0x60
+#define AML_LOCAL1 (UINT16) 0x61
+#define AML_LOCAL2 (UINT16) 0x62
+#define AML_LOCAL3 (UINT16) 0x63
+#define AML_LOCAL4 (UINT16) 0x64
+#define AML_LOCAL5 (UINT16) 0x65
+#define AML_LOCAL6 (UINT16) 0x66
+#define AML_LOCAL7 (UINT16) 0x67
+#define AML_ARG_OP (UINT16) 0x68
+#define AML_ARG0 (UINT16) 0x68
+#define AML_ARG1 (UINT16) 0x69
+#define AML_ARG2 (UINT16) 0x6a
+#define AML_ARG3 (UINT16) 0x6b
+#define AML_ARG4 (UINT16) 0x6c
+#define AML_ARG5 (UINT16) 0x6d
+#define AML_ARG6 (UINT16) 0x6e
+#define AML_STORE_OP (UINT16) 0x70
+#define AML_REF_OF_OP (UINT16) 0x71
+#define AML_ADD_OP (UINT16) 0x72
+#define AML_CONCAT_OP (UINT16) 0x73
+#define AML_SUBTRACT_OP (UINT16) 0x74
+#define AML_INCREMENT_OP (UINT16) 0x75
+#define AML_DECREMENT_OP (UINT16) 0x76
+#define AML_MULTIPLY_OP (UINT16) 0x77
+#define AML_DIVIDE_OP (UINT16) 0x78
+#define AML_SHIFT_LEFT_OP (UINT16) 0x79
+#define AML_SHIFT_RIGHT_OP (UINT16) 0x7a
+#define AML_BIT_AND_OP (UINT16) 0x7b
+#define AML_BIT_NAND_OP (UINT16) 0x7c
+#define AML_BIT_OR_OP (UINT16) 0x7d
+#define AML_BIT_NOR_OP (UINT16) 0x7e
+#define AML_BIT_XOR_OP (UINT16) 0x7f
+#define AML_BIT_NOT_OP (UINT16) 0x80
+#define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81
+#define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82
+#define AML_DEREF_OF_OP (UINT16) 0x83
+#define AML_CONCAT_RES_OP (UINT16) 0x84 /* ACPI 2.0 */
+#define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */
+#define AML_NOTIFY_OP (UINT16) 0x86
+#define AML_SIZE_OF_OP (UINT16) 0x87
+#define AML_INDEX_OP (UINT16) 0x88
+#define AML_MATCH_OP (UINT16) 0x89
+#define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a
+#define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b
+#define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c
+#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d
+#define AML_TYPE_OP (UINT16) 0x8e
+#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */
+#define AML_LAND_OP (UINT16) 0x90
+#define AML_LOR_OP (UINT16) 0x91
+#define AML_LNOT_OP (UINT16) 0x92
+#define AML_LEQUAL_OP (UINT16) 0x93
+#define AML_LGREATER_OP (UINT16) 0x94
+#define AML_LLESS_OP (UINT16) 0x95
+#define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */
+#define AML_TO_DECSTRING_OP (UINT16) 0x97 /* ACPI 2.0 */
+#define AML_TO_HEXSTRING_OP (UINT16) 0x98 /* ACPI 2.0 */
+#define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */
+#define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */
+#define AML_COPY_OP (UINT16) 0x9d /* ACPI 2.0 */
+#define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */
+#define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */
+#define AML_IF_OP (UINT16) 0xa0
+#define AML_ELSE_OP (UINT16) 0xa1
+#define AML_WHILE_OP (UINT16) 0xa2
+#define AML_NOOP_OP (UINT16) 0xa3
+#define AML_RETURN_OP (UINT16) 0xa4
+#define AML_BREAK_OP (UINT16) 0xa5
+#define AML_BREAK_POINT_OP (UINT16) 0xcc
+#define AML_ONES_OP (UINT16) 0xff
+
+/* prefixed opcodes */
+
+#define AML_EXTOP (UINT16) 0x005b
+
+
+#define AML_MUTEX_OP (UINT16) 0x5b01
+#define AML_EVENT_OP (UINT16) 0x5b02
+#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10
+#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11
+#define AML_COND_REF_OF_OP (UINT16) 0x5b12
+#define AML_CREATE_FIELD_OP (UINT16) 0x5b13
+#define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */
+#define AML_LOAD_OP (UINT16) 0x5b20
+#define AML_STALL_OP (UINT16) 0x5b21
+#define AML_SLEEP_OP (UINT16) 0x5b22
+#define AML_ACQUIRE_OP (UINT16) 0x5b23
+#define AML_SIGNAL_OP (UINT16) 0x5b24
+#define AML_WAIT_OP (UINT16) 0x5b25
+#define AML_RESET_OP (UINT16) 0x5b26
+#define AML_RELEASE_OP (UINT16) 0x5b27
+#define AML_FROM_BCD_OP (UINT16) 0x5b28
+#define AML_TO_BCD_OP (UINT16) 0x5b29
+#define AML_UNLOAD_OP (UINT16) 0x5b2a
+#define AML_REVISION_OP (UINT16) 0x5b30
+#define AML_DEBUG_OP (UINT16) 0x5b31
+#define AML_FATAL_OP (UINT16) 0x5b32
+#define AML_REGION_OP (UINT16) 0x5b80
+#define AML_FIELD_OP (UINT16) 0x5b81
+#define AML_DEVICE_OP (UINT16) 0x5b82
+#define AML_PROCESSOR_OP (UINT16) 0x5b83
+#define AML_POWER_RES_OP (UINT16) 0x5b84
+#define AML_THERMAL_ZONE_OP (UINT16) 0x5b85
+#define AML_INDEX_FIELD_OP (UINT16) 0x5b86
+#define AML_BANK_FIELD_OP (UINT16) 0x5b87
+#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */
+
+
+/* Bogus opcodes (they are actually two separate opcodes) */
+
+#define AML_LGREATEREQUAL_OP (UINT16) 0x9295
+#define AML_LLESSEQUAL_OP (UINT16) 0x9294
+#define AML_LNOTEQUAL_OP (UINT16) 0x9293
+
+
+/*
+ * Internal opcodes
+ * Use only "Unknown" AML opcodes, don't attempt to use
+ * any valid ACPI ASCII values (A-Z, 0-9, '-')
+ */
+
+#define AML_INT_NAMEPATH_OP (UINT16) 0x002d
+#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030
+#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031
+#define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032
+#define AML_INT_BYTELIST_OP (UINT16) 0x0033
+#define AML_INT_STATICSTRING_OP (UINT16) 0x0034
+#define AML_INT_METHODCALL_OP (UINT16) 0x0035
+#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036
+#define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037
+
+
+#define ARG_NONE 0x0
+
+/*
+ * Argument types for the AML Parser
+ * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
+ * There can be up to 31 unique argument types
+ * Zero is reserved as end-of-list indicator
+ */
+
+#define ARGP_BYTEDATA 0x01
+#define ARGP_BYTELIST 0x02
+#define ARGP_CHARLIST 0x03
+#define ARGP_DATAOBJ 0x04
+#define ARGP_DATAOBJLIST 0x05
+#define ARGP_DWORDDATA 0x06
+#define ARGP_FIELDLIST 0x07
+#define ARGP_NAME 0x08
+#define ARGP_NAMESTRING 0x09
+#define ARGP_OBJLIST 0x0A
+#define ARGP_PKGLENGTH 0x0B
+#define ARGP_SUPERNAME 0x0C
+#define ARGP_TARGET 0x0D
+#define ARGP_TERMARG 0x0E
+#define ARGP_TERMLIST 0x0F
+#define ARGP_WORDDATA 0x10
+#define ARGP_QWORDDATA 0x11
+#define ARGP_SIMPLENAME 0x12
+
+/*
+ * Resolved argument types for the AML Interpreter
+ * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
+ * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
+ *
+ * Note1: These values are completely independent from the ACPI_TYPEs
+ * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
+ *
+ * Note2: If and when 5 bits becomes insufficient, it would probably be best
+ * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
+ */
+
+/* Single, simple types */
+
+#define ARGI_ANYTYPE 0x01 /* Don't care */
+#define ARGI_PACKAGE 0x02
+#define ARGI_EVENT 0x03
+#define ARGI_MUTEX 0x04
+#define ARGI_DDBHANDLE 0x05
+
+/* Interchangeable types (via implicit conversion) */
+
+#define ARGI_INTEGER 0x06
+#define ARGI_STRING 0x07
+#define ARGI_BUFFER 0x08
+#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */
+#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */
+
+/* Reference objects */
+
+#define ARGI_INTEGER_REF 0x0B
+#define ARGI_OBJECT_REF 0x0C
+#define ARGI_DEVICE_REF 0x0D
+#define ARGI_REFERENCE 0x0E
+#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
+#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
+#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
+
+/* Multiple/complex types */
+
+#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
+#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
+#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
+#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */
+
+/* Note: types above can expand to 0x1F maximum */
+
+#define ARGI_INVALID_OPCODE 0xFFFFFFFF
+
+
+/*
+ * hash offsets
+ */
+#define AML_EXTOP_HASH_OFFSET 22
+#define AML_LNOT_HASH_OFFSET 19
+
+
+/*
+ * opcode groups and types
+ */
+
+#define OPGRP_NAMED 0x01
+#define OPGRP_FIELD 0x02
+#define OPGRP_BYTELIST 0x04
+
+
+/*
+ * Opcode information
+ */
+
+/* Opcode flags */
+
+#define AML_HAS_ARGS 0x0800
+#define AML_HAS_TARGET 0x0400
+#define AML_HAS_RETVAL 0x0200
+#define AML_NSOBJECT 0x0100
+#define AML_NSOPCODE 0x0080
+#define AML_NSNODE 0x0040
+#define AML_NAMED 0x0020
+#define AML_DEFER 0x0010
+#define AML_FIELD 0x0008
+#define AML_CREATE 0x0004
+#define AML_MATH 0x0002
+#define AML_LOGICAL 0x0001
+#define AML_CONSTANT 0x1000
+
+/* Convenient flag groupings */
+
+#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
+#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
+#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
+#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */
+#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
+#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
+#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R */
+#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
+#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
+
+
+/*
+ * The opcode Type is used in a dispatch table, do not change
+ * without updating the table.
+ */
+#define AML_TYPE_EXEC_1A_0T_0R 0x00 /* Monadic1 */
+#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */
+#define AML_TYPE_EXEC_1A_1T_0R 0x02
+#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* Monadic2R */
+#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */
+#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */
+#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* Dyadic2R */
+#define AML_TYPE_EXEC_2A_2T_1R 0x07
+#define AML_TYPE_EXEC_3A_0T_0R 0x08
+#define AML_TYPE_EXEC_3A_1T_1R 0x09
+#define AML_TYPE_EXEC_6A_0T_1R 0x0A
+/* End of types used in dispatch table */
+
+#define AML_TYPE_LITERAL 0x0B
+#define AML_TYPE_CONSTANT 0x0C
+#define AML_TYPE_METHOD_ARGUMENT 0x0D
+#define AML_TYPE_LOCAL_VARIABLE 0x0E
+#define AML_TYPE_DATA_TERM 0x0F
+
+/* Generic for an op that returns a value */
+
+#define AML_TYPE_METHOD_CALL 0x10
+
+/* Misc */
+
+#define AML_TYPE_CREATE_FIELD 0x11
+#define AML_TYPE_CREATE_OBJECT 0x12
+#define AML_TYPE_CONTROL 0x13
+#define AML_TYPE_NAMED_NO_OBJ 0x14
+#define AML_TYPE_NAMED_FIELD 0x15
+#define AML_TYPE_NAMED_SIMPLE 0x16
+#define AML_TYPE_NAMED_COMPLEX 0x17
+#define AML_TYPE_RETURN 0x18
+
+#define AML_TYPE_UNDEFINED 0x19
+#define AML_TYPE_BOGUS 0x1A
+
+
+/*
+ * Opcode classes
+ */
+#define AML_CLASS_EXECUTE 0x00
+#define AML_CLASS_CREATE 0x01
+#define AML_CLASS_ARGUMENT 0x02
+#define AML_CLASS_NAMED_OBJECT 0x03
+#define AML_CLASS_CONTROL 0x04
+#define AML_CLASS_ASCII 0x05
+#define AML_CLASS_PREFIX 0x06
+#define AML_CLASS_INTERNAL 0x07
+#define AML_CLASS_RETURN_VALUE 0x08
+#define AML_CLASS_METHOD_CALL 0x09
+#define AML_CLASS_UNKNOWN 0x0A
+
+
+/* Predefined Operation Region SpaceIDs */
+
+typedef enum
+{
+ REGION_MEMORY = 0,
+ REGION_IO,
+ REGION_PCI_CONFIG,
+ REGION_EC,
+ REGION_SMBUS,
+ REGION_CMOS,
+ REGION_PCI_BAR,
+ REGION_DATA_TABLE, /* Internal use only */
+ REGION_FIXED_HW = 0x7F
+
+} AML_REGION_TYPES;
+
+
+/* Comparison operation codes for MatchOp operator */
+
+typedef enum
+{
+ MATCH_MTR = 0,
+ MATCH_MEQ = 1,
+ MATCH_MLE = 2,
+ MATCH_MLT = 3,
+ MATCH_MGE = 4,
+ MATCH_MGT = 5
+
+} AML_MATCH_OPERATOR;
+
+#define MAX_MATCH_OPERATOR 5
+
+
+/*
+ * FieldFlags
+ *
+ * This byte is extracted from the AML and includes three separate
+ * pieces of information about the field:
+ * 1) The field access type
+ * 2) The field update rule
+ * 3) The lock rule for the field
+ *
+ * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
+ * 04 : LockRule (1 == Lock)
+ * 05 - 06 : UpdateRule
+ */
+#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
+#define AML_FIELD_LOCK_RULE_MASK 0x10
+#define AML_FIELD_UPDATE_RULE_MASK 0x60
+
+
+/* 1) Field Access Types */
+
+typedef enum
+{
+ AML_FIELD_ACCESS_ANY = 0x00,
+ AML_FIELD_ACCESS_BYTE = 0x01,
+ AML_FIELD_ACCESS_WORD = 0x02,
+ AML_FIELD_ACCESS_DWORD = 0x03,
+ AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
+ AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
+
+} AML_ACCESS_TYPE;
+
+
+/* 2) Field Lock Rules */
+
+typedef enum
+{
+ AML_FIELD_LOCK_NEVER = 0x00,
+ AML_FIELD_LOCK_ALWAYS = 0x10
+
+} AML_LOCK_RULE;
+
+
+/* 3) Field Update Rules */
+
+typedef enum
+{
+ AML_FIELD_UPDATE_PRESERVE = 0x00,
+ AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
+ AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
+
+} AML_UPDATE_RULE;
+
+
+/*
+ * Field Access Attributes.
+ * This byte is extracted from the AML via the
+ * AccessAs keyword
+ */
+typedef enum
+{
+ AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
+ AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
+ AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
+ AML_FIELD_ATTRIB_SMB_WORD = 0x08,
+ AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
+ AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
+ AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
+
+} AML_ACCESS_ATTRIBUTE;
+
+
+/* bit fields in MethodFlags byte */
+
+#define METHOD_FLAGS_ARG_COUNT 0x07
+#define METHOD_FLAGS_SERIALIZED 0x08
+#define METHOD_FLAGS_SYNCH_LEVEL 0xF0
+
+
+#endif /* __AMLCODE_H__ */
diff --git a/sys/contrib/dev/acpica/amlresrc.h b/sys/contrib/dev/acpica/amlresrc.h
new file mode 100644
index 0000000..6ca7978
--- /dev/null
+++ b/sys/contrib/dev/acpica/amlresrc.h
@@ -0,0 +1,423 @@
+
+/******************************************************************************
+ *
+ * Module Name: amlresrc.h - AML resource descriptors
+ * $Revision: 23 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __AMLRESRC_H
+#define __AMLRESRC_H
+
+
+#define ASL_RESNAME_ADDRESS "_ADR"
+#define ASL_RESNAME_ALIGNMENT "_ALN"
+#define ASL_RESNAME_ADDRESSSPACE "_ASI"
+#define ASL_RESNAME_BASEADDRESS "_BAS"
+#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
+#define ASL_RESNAME_DECODE "_DEC"
+#define ASL_RESNAME_DMA "_DMA"
+#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
+#define ASL_RESNAME_GRANULARITY "_GRA"
+#define ASL_RESNAME_INTERRUPT "_INT"
+#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
+#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
+#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
+#define ASL_RESNAME_LENGTH "_LEN"
+#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ASL_RESNAME_MAXADDR "_MAX"
+#define ASL_RESNAME_MINADDR "_MIN"
+#define ASL_RESNAME_MAXTYPE "_MAF"
+#define ASL_RESNAME_MINTYPE "_MIF"
+#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
+#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
+#define ASL_RESNAME_RANGETYPE "_RNG"
+#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
+#define ASL_RESNAME_TRANSLATION "_TRA"
+#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
+#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
+#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
+
+
+/* Default sizes for "small" resource descriptors */
+
+#define ASL_RDESC_IRQ_SIZE 0x02
+#define ASL_RDESC_DMA_SIZE 0x02
+#define ASL_RDESC_ST_DEPEND_SIZE 0x00
+#define ASL_RDESC_END_DEPEND_SIZE 0x00
+#define ASL_RDESC_IO_SIZE 0x07
+#define ASL_RDESC_FIXED_IO_SIZE 0x03
+#define ASL_RDESC_END_TAG_SIZE 0x01
+
+
+typedef struct asl_resource_node
+{
+ UINT32 BufferLength;
+ void *Buffer;
+ struct asl_resource_node *Next;
+
+} ASL_RESOURCE_NODE;
+
+
+/*
+ * Resource descriptors defined in the ACPI specification.
+ *
+ * Alignment must be BYTE because these descriptors
+ * are used to overlay the AML byte stream.
+ */
+#pragma pack(1)
+
+typedef struct asl_irq_format_desc
+{
+ UINT8 DescriptorType;
+ UINT16 IrqMask;
+ UINT8 Flags;
+
+} ASL_IRQ_FORMAT_DESC;
+
+
+typedef struct asl_irq_noflags_desc
+{
+ UINT8 DescriptorType;
+ UINT16 IrqMask;
+
+} ASL_IRQ_NOFLAGS_DESC;
+
+
+typedef struct asl_dma_format_desc
+{
+ UINT8 DescriptorType;
+ UINT8 DmaChannelMask;
+ UINT8 Flags;
+
+} ASL_DMA_FORMAT_DESC;
+
+
+typedef struct asl_start_dependent_desc
+{
+ UINT8 DescriptorType;
+ UINT8 Flags;
+
+} ASL_START_DEPENDENT_DESC;
+
+
+typedef struct asl_start_dependent_noprio_desc
+{
+ UINT8 DescriptorType;
+
+} ASL_START_DEPENDENT_NOPRIO_DESC;
+
+
+typedef struct asl_end_dependent_desc
+{
+ UINT8 DescriptorType;
+
+} ASL_END_DEPENDENT_DESC;
+
+
+typedef struct asl_io_port_desc
+{
+ UINT8 DescriptorType;
+ UINT8 Information;
+ UINT16 AddressMin;
+ UINT16 AddressMax;
+ UINT8 Alignment;
+ UINT8 Length;
+
+} ASL_IO_PORT_DESC;
+
+
+typedef struct asl_fixed_io_port_desc
+{
+ UINT8 DescriptorType;
+ UINT16 BaseAddress;
+ UINT8 Length;
+
+} ASL_FIXED_IO_PORT_DESC;
+
+
+typedef struct asl_small_vendor_desc
+{
+ UINT8 DescriptorType;
+ UINT8 VendorDefined[7];
+
+} ASL_SMALL_VENDOR_DESC;
+
+
+typedef struct asl_end_tag_desc
+{
+ UINT8 DescriptorType;
+ UINT8 Checksum;
+
+} ASL_END_TAG_DESC;
+
+
+/* LARGE descriptors */
+
+typedef struct asl_memory_24_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 Information;
+ UINT16 AddressMin;
+ UINT16 AddressMax;
+ UINT16 Alignment;
+ UINT16 RangeLength;
+
+} ASL_MEMORY_24_DESC;
+
+
+typedef struct asl_large_vendor_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 VendorDefined[1];
+
+} ASL_LARGE_VENDOR_DESC;
+
+
+typedef struct asl_memory_32_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 Information;
+ UINT32 AddressMin;
+ UINT32 AddressMax;
+ UINT32 Alignment;
+ UINT32 RangeLength;
+
+} ASL_MEMORY_32_DESC;
+
+
+typedef struct asl_fixed_memory_32_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 Information;
+ UINT32 BaseAddress;
+ UINT32 RangeLength;
+
+} ASL_FIXED_MEMORY_32_DESC;
+
+
+typedef struct asl_qword_address_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 ResourceType;
+ UINT8 Flags;
+ UINT8 SpecificFlags;
+ UINT64 Granularity;
+ UINT64 AddressMin;
+ UINT64 AddressMax;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
+ UINT8 OptionalFields[2];
+
+} ASL_QWORD_ADDRESS_DESC;
+
+
+typedef struct asl_dword_address_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 ResourceType;
+ UINT8 Flags;
+ UINT8 SpecificFlags;
+ UINT32 Granularity;
+ UINT32 AddressMin;
+ UINT32 AddressMax;
+ UINT32 TranslationOffset;
+ UINT32 AddressLength;
+ UINT8 OptionalFields[2];
+
+} ASL_DWORD_ADDRESS_DESC;
+
+
+typedef struct asl_word_address_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 ResourceType;
+ UINT8 Flags;
+ UINT8 SpecificFlags;
+ UINT16 Granularity;
+ UINT16 AddressMin;
+ UINT16 AddressMax;
+ UINT16 TranslationOffset;
+ UINT16 AddressLength;
+ UINT8 OptionalFields[2];
+
+} ASL_WORD_ADDRESS_DESC;
+
+
+typedef struct asl_extended_xrupt_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 Flags;
+ UINT8 TableLength;
+ UINT32 InterruptNumber[1];
+ /* ResSourceIndex, ResSource optional fields follow */
+
+} ASL_EXTENDED_XRUPT_DESC;
+
+
+typedef struct asl_general_register_desc
+{
+ UINT8 DescriptorType;
+ UINT16 Length;
+ UINT8 AddressSpaceId;
+ UINT8 BitWidth;
+ UINT8 BitOffset;
+ UINT8 Reserved;
+ UINT64 Address;
+
+} ASL_GENERAL_REGISTER_DESC;
+
+/* restore default alignment */
+
+#pragma pack()
+
+/* Union of all resource descriptors, sow we can allocate the worst case */
+
+typedef union asl_resource_desc
+{
+ ASL_IRQ_FORMAT_DESC Irq;
+ ASL_DMA_FORMAT_DESC Dma;
+ ASL_START_DEPENDENT_DESC Std;
+ ASL_END_DEPENDENT_DESC End;
+ ASL_IO_PORT_DESC Iop;
+ ASL_FIXED_IO_PORT_DESC Fio;
+ ASL_SMALL_VENDOR_DESC Smv;
+ ASL_END_TAG_DESC Et;
+
+ ASL_MEMORY_24_DESC M24;
+ ASL_LARGE_VENDOR_DESC Lgv;
+ ASL_MEMORY_32_DESC M32;
+ ASL_FIXED_MEMORY_32_DESC F32;
+ ASL_QWORD_ADDRESS_DESC Qas;
+ ASL_DWORD_ADDRESS_DESC Das;
+ ASL_WORD_ADDRESS_DESC Was;
+ ASL_EXTENDED_XRUPT_DESC Exx;
+ ASL_GENERAL_REGISTER_DESC Grg;
+ UINT32 U32Item;
+ UINT16 U16Item;
+ UINT8 U8Item;
+
+} ASL_RESOURCE_DESC;
+
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c
new file mode 100644
index 0000000..a13baf8
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/adisasm.c
@@ -0,0 +1,1047 @@
+/******************************************************************************
+ *
+ * Module Name: adisasm - Application-level disassembler routines
+ * $Revision: 58 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdebug.h"
+#include "acdisasm.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acapps.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adisasm")
+
+
+ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+
+
+#ifndef _ACPI_ASL_COMPILER
+BOOLEAN
+AcpiDsIsResultUsed (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ return TRUE;
+}
+#endif
+
+
+ACPI_STATUS
+AcpiDsRestartControlMethod (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ReturnDesc)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiDsTerminateControlMethod (
+ ACPI_WALK_STATE *WalkState)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiDsCallControlMethod (
+ ACPI_THREAD_STATE *Thread,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiDsMethodDataInitArgs (
+ ACPI_OPERAND_OBJECT **Params,
+ UINT32 MaxParamCount,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (AE_OK);
+}
+
+
+#define FILE_SUFFIX_DISASSEMBLY "dsl"
+#define ACPI_TABLE_FILE_SUFFIX ".dat"
+char FilenameBuf[20];
+
+/******************************************************************************
+ *
+ * FUNCTION: AfGenerateFilename
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Build an output filename from an ACPI table ID string
+ *
+ ******************************************************************************/
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ for (i = 0; Prefix[i]; i++)
+ {
+ FilenameBuf[i] = Prefix[i];
+ }
+
+ FilenameBuf[i] = '_';
+ i++;
+
+ for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
+ {
+ FilenameBuf[i] = TableId[j];
+ }
+
+ FilenameBuf[i] = 0;
+ strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
+ return FilenameBuf;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteBuffer
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Open a file and write out a single buffer
+ *
+ ******************************************************************************/
+
+ACPI_NATIVE_INT
+AdWriteBuffer (
+ char *Filename,
+ char *Buffer,
+ UINT32 Length)
+{
+ FILE *fp;
+ ACPI_NATIVE_INT Actual;
+
+
+ fp = fopen (Filename, "wb");
+ if (!fp)
+ {
+ printf ("Couldn't open %s\n", Filename);
+ return -1;
+ }
+
+ Actual = fwrite (Buffer, (size_t) Length, 1, fp);
+ fclose (fp);
+ return Actual;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteTable
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Dump the loaded tables to a file (or files)
+ *
+ ******************************************************************************/
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId)
+{
+ char *Filename;
+
+
+ Filename = AdGenerateFilename (TableName, OemTableId);
+ AdWriteBuffer (Filename, (char *) Table, Length);
+
+ AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AdInitialize
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: CA initialization
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AdInitialize (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ /* ACPI CA subsystem initialization */
+
+ AcpiUtInitGlobals ();
+ Status = AcpiUtMutexInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
+ Status = AcpiNsRootInitialize ();
+ return Status;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlGenerateFilename
+ *
+ * PARAMETERS: InputFilename - Original ASL source filename
+ * Suffix - New extension.
+ *
+ * RETURN: New filename containing the original base + the new suffix
+ *
+ * DESCRIPTION: Generate a new filename from the ASL source filename and a new
+ * extension. Used to create the *.LST, *.TXT, etc. files.
+ *
+ ******************************************************************************/
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix)
+{
+ char *Position;
+ char *NewFilename;
+
+
+ /* Copy the original filename to a new buffer */
+
+ NewFilename = ACPI_MEM_CALLOCATE (strlen (InputFilename) + strlen (Suffix));
+ strcpy (NewFilename, InputFilename);
+
+ /* Try to find the last dot in the filename */
+
+ Position = strrchr (NewFilename, '.');
+ if (Position)
+ {
+ /* Tack on the new suffix */
+
+ Position++;
+ *Position = 0;
+ strcat (Position, Suffix);
+ }
+ else
+ {
+ /* No dot, add one and then the suffix */
+
+ strcat (NewFilename, ".");
+ strcat (NewFilename, Suffix);
+ }
+
+ return NewFilename;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSplitInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename)
+{
+ char *Substring;
+ char *DirectoryPath;
+ char *Filename;
+
+
+ *OutDirectoryPath = NULL;
+ *OutFilename = NULL;
+
+ if (!InputPath)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ DirectoryPath = strdup (InputPath);
+ if (!DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ DirectoryPath[0] = 0;
+ Filename = strdup (InputPath);
+ }
+ else
+ {
+ Filename = strdup (Substring + 1);
+ *(Substring+1) = 0;
+ }
+
+ if (!Filename)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ *OutDirectoryPath = DirectoryPath;
+ *OutFilename = Filename;
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdAmlDisassemble
+ *
+ * PARAMETERS: OutToFile - TRUE if output should go to a file
+ * Filename - AML input filename
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disassemble an entire ACPI table
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdAmlDisassemble (
+ BOOLEAN OutToFile,
+ char *Filename,
+ char *Prefix,
+ char **OutFilename,
+ BOOLEAN GetAllTables)
+{
+ ACPI_STATUS Status;
+ char *DisasmFilename = NULL;
+ FILE *File = NULL;
+ ACPI_TABLE_HEADER *Table;
+
+
+ /*
+ * Input: AML Code from either a file,
+ * or via GetTables (memory or registry)
+ */
+ if (Filename)
+ {
+ Status = AcpiDbGetTableFromFile (Filename, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+ }
+ else
+ {
+ Status = AdGetLocalTables (Filename, GetAllTables);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ return Status;
+ }
+
+ if (!AcpiGbl_DbOpt_disasm)
+ {
+ return AE_OK;
+ }
+
+ /* Obtained the local tables, just disassmeble the DSDT */
+
+ Table = AcpiGbl_DSDT;
+ AcpiOsPrintf ("\nDisassembly of DSDT\n");
+ Prefix = AdGenerateFilename ("dsdt", AcpiGbl_DSDT->OemTableId);
+ }
+
+ /*
+ * Output: ASL code.
+ * Redirect to a file if requested
+ */
+ if (OutToFile)
+ {
+ /* Create/Open a disassembly output file */
+
+ DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY);
+ if (!OutFilename)
+ {
+ fprintf (stderr, "Could not generate output filename\n");
+ }
+
+ File = fopen (DisasmFilename, "w+");
+ if (!File)
+ {
+ fprintf (stderr, "Could not open output file\n");
+ }
+
+ AcpiOsRedirectOutput (File);
+ }
+
+ *OutFilename = DisasmFilename;
+
+ /* Always parse the tables, only option is what to display */
+
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ /* Optional displays */
+
+ if (AcpiGbl_DbOpt_disasm)
+ {
+ AdDisplayTables (Filename, Table);
+ fprintf (stderr, "Disassembly completed, written to \"%s\"\n", DisasmFilename);
+ }
+
+Cleanup:
+ if (OutToFile)
+ {
+ fclose (File);
+ AcpiOsRedirectOutput (stdout);
+ }
+
+ AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdCreateTableHeader
+ *
+ * PARAMETERS: Filename - Input file for the table
+ * Table - Pointer to the raw table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create the ASL table header, including ACPI CA signon with
+ * current time and date.
+ *
+ *****************************************************************************/
+
+void
+AdCreateTableHeader (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table)
+{
+ time_t Timer;
+
+
+ time (&Timer);
+
+ AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
+ AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
+ AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer));
+
+ AcpiOsPrintf (
+ "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", %d)\n",
+ Table->Signature, Table->Signature, Table->Revision,
+ Table->OemId, Table->OemTableId, Table->OemRevision);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdDisplayTables
+ *
+ * PARAMETERS: Filename - Input file for the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdDisplayTables (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table)
+{
+
+
+ if (!AcpiGbl_ParsedNamespaceRoot)
+ {
+ return AE_NOT_EXIST;
+ }
+
+ if (!AcpiGbl_DbOpt_verbose)
+ {
+ AdCreateTableHeader (Filename, Table);
+ }
+
+ AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX);
+
+ if (AcpiGbl_DbOpt_verbose)
+ {
+ AcpiOsPrintf ("\n\nTable Header:\n");
+ AcpiUtDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER),
+ DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+
+ AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length);
+ AcpiUtDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)), Table->Length,
+ DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+ }
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdDeferredParse
+ *
+ * PARAMETERS: Op - Root Op of the deferred opcode
+ * Aml - Pointer to the raw AML
+ * AmlLength - Length of the AML
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse one deferred opcode
+ * (Methods, operation regions, etc.)
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdDeferredParse (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 *Aml,
+ UINT32 AmlLength)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *SearchOp;
+ ACPI_PARSE_OBJECT *StartOp;
+ UINT32 BaseAmlOffset;
+ ACPI_PARSE_OBJECT *ExtraOp;
+
+
+ ACPI_FUNCTION_TRACE ("AdDeferredParse");
+
+
+ fprintf (stderr, ".");
+
+ if (!Aml || !AmlLength)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n",
+ Op->Common.AmlOpName, (char *) &Op->Named.Name));
+
+ WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
+ AmlLength, NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parse the method */
+
+ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ Status = AcpiPsParseAml (WalkState);
+
+ /*
+ * We need to update all of the Aml offsets, since the parser thought
+ * that the method began at offset zero. In reality, it began somewhere
+ * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
+ * was just created and update the AmlOffset in each Op
+ */
+ BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
+ StartOp = (Op->Common.Value.Arg)->Common.Next;
+ SearchOp = StartOp;
+
+ /* Walk the parse tree */
+
+ while (SearchOp)
+ {
+ SearchOp->Common.AmlOffset += BaseAmlOffset;
+ SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
+ }
+
+ /*
+ * Link the newly parsed subtree into the main parse tree
+ */
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+ ExtraOp = Op->Common.Value.Arg;
+ ExtraOp = ExtraOp->Common.Next;
+ Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
+ break;
+
+ case AML_BUFFER_OP:
+ default:
+ ExtraOp = Op->Common.Value.Arg;
+ Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
+ break;
+ }
+
+ /* Must point all parents to the main tree */
+
+ StartOp = Op;
+ SearchOp = StartOp;
+ while (SearchOp)
+ {
+ if (SearchOp->Common.Parent == ExtraOp)
+ {
+ SearchOp->Common.Parent = Op;
+ }
+ SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdParseDeferredOps
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.)
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdParseDeferredOps (
+ ACPI_PARSE_OBJECT *Root)
+{
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_STATUS Status = AE_OK;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_NAME ("AdParseDeferredOps");
+ fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
+
+ while (Op)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (!(OpInfo->Flags & AML_DEFER))
+ {
+ Op = AcpiPsGetDepthNext (Root, Op);
+ continue;
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ break;
+
+ case AML_REGION_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+ case AML_CREATE_DWORD_FIELD_OP:
+ case AML_CREATE_WORD_FIELD_OP:
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_CREATE_BIT_FIELD_OP:
+ case AML_CREATE_FIELD_OP:
+
+ /* Nothing to do in these cases */
+
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unhandled deferred opcode [%s]\n",
+ Op->Common.AmlOpName));
+ break;
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+
+ fprintf (stderr, "\n");
+ return Status;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AdGetLocalTables
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get the ACPI tables from either memory or a file
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdGetLocalTables (
+ char *Filename,
+ BOOLEAN GetAllTables)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER TableHeader;
+ ACPI_TABLE_HEADER *NewTable;
+ UINT32 NumTables;
+ UINT32 PointerSize;
+
+
+ if (GetAllTables)
+ {
+ ACPI_STRNCPY (TableHeader.Signature, "RSDT", 4);
+ AcpiOsTableOverride (&TableHeader, &NewTable);
+
+#if ACPI_MACHINE_WIDTH != 64
+
+ if (!ACPI_STRNCMP (NewTable->Signature, "RSDT", 4))
+ {
+ PointerSize = sizeof (UINT32);
+ }
+ else
+#endif
+ {
+ PointerSize = sizeof (UINT64);
+ }
+
+ /*
+ * Determine the number of tables pointed to by the RSDT/XSDT.
+ * This is defined by the ACPI Specification to be the number of
+ * pointers contained within the RSDT/XSDT. The size of the pointers
+ * is architecture-dependent.
+ */
+ NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize;
+ AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n",
+ NumTables, NewTable->Signature);
+
+ /* Get the FADT */
+
+ ACPI_STRNCPY (TableHeader.Signature, "FADT", 4);
+ AcpiOsTableOverride (&TableHeader, &NewTable);
+ if (NewTable)
+ {
+ AcpiGbl_FADT = (void *) NewTable;
+ AdWriteTable (NewTable, NewTable->Length,
+ "FADT", NewTable->OemTableId);
+ }
+ AcpiOsPrintf ("\n");
+
+ /* Get the FACS */
+
+ ACPI_STRNCPY (TableHeader.Signature, "FACS", 4);
+ AcpiOsTableOverride (&TableHeader, &NewTable);
+ if (NewTable)
+ {
+ AcpiGbl_FACS = (void *) NewTable;
+ AdWriteTable (NewTable, AcpiGbl_FACS->Length,
+ "FACS", AcpiGbl_FADT->Header.OemTableId);
+ }
+ AcpiOsPrintf ("\n");
+ }
+
+ /* Always get the DSDT */
+
+ ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
+ AcpiOsTableOverride (&TableHeader, &NewTable);
+ if (NewTable)
+ {
+ Status = AE_OK;
+ AcpiGbl_DSDT = NewTable;
+ AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
+ "DSDT", AcpiGbl_DSDT->OemTableId);
+ }
+ else
+ {
+ fprintf (stderr, "Could not obtain DSDT\n");
+ Status = AE_NO_ACPI_TABLES;
+ }
+
+ AcpiOsPrintf ("\n");
+
+ /* Get all SSDTs */
+
+ ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4);
+ Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+ if (NewTable)
+ {
+ while (NewTable)
+ {
+ Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+ }
+ }
+
+#ifdef _HPET
+ AfGetHpet ();
+#endif
+
+ return AE_OK;
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: AdParseTable
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse the DSDT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdParseTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_TABLE_DESC TableDesc;
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
+
+
+ if (!Table)
+ {
+ return AE_NOT_EXIST;
+ }
+
+ /* Pass 1: Parse everything except control method bodies */
+
+ fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
+
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+
+ /* Create the root object */
+
+ AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp ();
+ if (!AcpiGbl_ParsedNamespaceRoot)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0,
+ AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
+ NULL, AmlStart, AmlLength, NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+
+ Status = AcpiPsParseAml (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
+ /* Pass 2 */
+
+ TableDesc.AmlStart = AmlStart;
+ TableDesc.AmlLength = AmlLength;
+ fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
+
+ Status = AcpiNsOneCompleteParse (2, &TableDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Pass 3: Parse control methods and link their parse trees into the main parse tree */
+
+ Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot);
+
+ fprintf (stderr, "Parsing completed\n");
+ return AE_OK;
+}
+
+
diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c
new file mode 100644
index 0000000..05d22b3
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/getopt.c
@@ -0,0 +1,246 @@
+
+/******************************************************************************
+ *
+ * Module Name: getopt
+ * $Revision: 6 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <stdio.h>
+#include <string.h>
+
+#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);}
+
+
+int AcpiGbl_Opterr = 1;
+int AcpiGbl_Optind = 1;
+int AcpiGbl_Optopt;
+char *AcpiGbl_Optarg;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetopt
+ *
+ * PARAMETERS: argc, argv - from main
+ * opts - options info list
+ *
+ * RETURN: Option character or EOF
+ *
+ * DESCRIPTION: Get the next option
+ *
+ ******************************************************************************/
+
+int
+AcpiGetopt(
+ int argc,
+ char **argv,
+ char *opts)
+{
+ static int CurrentCharPtr = 1;
+ int CurrentChar;
+ char *OptsPtr;
+
+
+ if (CurrentCharPtr == 1)
+ {
+ if (AcpiGbl_Optind >= argc ||
+ argv[AcpiGbl_Optind][0] != '-' ||
+ argv[AcpiGbl_Optind][1] == '\0')
+ {
+ return(EOF);
+ }
+ else if (strcmp (argv[AcpiGbl_Optind], "--") == 0)
+ {
+ AcpiGbl_Optind++;
+ return(EOF);
+ }
+ }
+
+ /* Get the option */
+
+ CurrentChar =
+ AcpiGbl_Optopt =
+ argv[AcpiGbl_Optind][CurrentCharPtr];
+
+ /* Make sure that the option is legal */
+
+ if (CurrentChar == ':' ||
+ (OptsPtr = strchr (opts, CurrentChar)) == NULL)
+ {
+ ERR (": illegal option -- ", CurrentChar);
+
+ if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
+ {
+ AcpiGbl_Optind++;
+ CurrentCharPtr = 1;
+ }
+
+ return ('?');
+ }
+
+ /* Option requires an argument? */
+
+ if (*++OptsPtr == ':')
+ {
+ if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0')
+ {
+ AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][CurrentCharPtr+1];
+ }
+ else if (++AcpiGbl_Optind >= argc)
+ {
+ ERR (": option requires an argument -- ", CurrentChar);
+
+ CurrentCharPtr = 1;
+ return ('?');
+ }
+ else
+ {
+ AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
+ }
+
+ CurrentCharPtr = 1;
+ }
+
+ /* Option has optional single-char arguments? */
+
+ else if (*OptsPtr == '^')
+ {
+ if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0')
+ {
+ AcpiGbl_Optarg = &argv[AcpiGbl_Optind][CurrentCharPtr+1];
+ }
+ else
+ {
+ AcpiGbl_Optarg = "^";
+ }
+
+ AcpiGbl_Optind++;
+ CurrentCharPtr = 1;
+ }
+
+ /* Option with no arguments */
+
+ else
+ {
+ if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
+ {
+ CurrentCharPtr = 1;
+ AcpiGbl_Optind++;
+ }
+
+ AcpiGbl_Optarg = NULL;
+ }
+
+ return (CurrentChar);
+}
diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c
new file mode 100644
index 0000000..a843f17
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -0,0 +1,1697 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslanalyze.c - check for semantic errors
+ * $Revision: 77 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+#include <ctype.h>
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslanalyze")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapArgTypeToBtype
+ *
+ * PARAMETERS: ArgType - The ARGI required type(s) for this argument,
+ * from the opcode info table
+ *
+ * RETURN: The corresponding Bit-encoded types
+ *
+ * DESCRIPTION: Convert an encoded ARGI required argument type code into a
+ * bitfield type code. Implements the implicit source conversion
+ * rules.
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapArgTypeToBtype (
+ UINT32 ArgType)
+{
+
+ switch (ArgType)
+ {
+
+ /* Simple types */
+
+ case ARGI_ANYTYPE:
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+
+ case ARGI_PACKAGE:
+ return (ACPI_BTYPE_PACKAGE);
+
+ case ARGI_EVENT:
+ return (ACPI_BTYPE_EVENT);
+
+ case ARGI_MUTEX:
+ return (ACPI_BTYPE_MUTEX);
+
+ case ARGI_DDBHANDLE:
+ return (ACPI_BTYPE_DDB_HANDLE);
+
+ /* Interchangeable types */
+ /*
+ * Source conversion rules:
+ * Integer, String, and Buffer are all interchangeable
+ */
+ case ARGI_INTEGER:
+ case ARGI_STRING:
+ case ARGI_BUFFER:
+ case ARGI_BUFFER_OR_STRING:
+ case ARGI_COMPUTEDATA:
+ return (ACPI_BTYPE_COMPUTE_DATA);
+
+ /* References */
+
+ case ARGI_INTEGER_REF:
+ return (ACPI_BTYPE_INTEGER);
+
+ case ARGI_OBJECT_REF:
+ return (ACPI_BTYPE_ALL_OBJECTS);
+
+ case ARGI_DEVICE_REF:
+ return (ACPI_BTYPE_DEVICE_OBJECTS);
+
+ case ARGI_REFERENCE:
+ return (ACPI_BTYPE_REFERENCE);
+
+ case ARGI_TARGETREF:
+ case ARGI_FIXED_TARGET:
+ case ARGI_SIMPLE_TARGET:
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+
+ /* Complex types */
+
+ case ARGI_DATAOBJECT:
+
+ /* Buffer, string, package or reference to a Op - Used only by SizeOf operator*/
+
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
+
+ case ARGI_COMPLEXOBJ:
+
+ /* Buffer, String, or package */
+
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
+
+ case ARGI_REF_OR_STRING:
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
+
+ case ARGI_REGION_OR_FIELD:
+ return (ACPI_BTYPE_REGION | ACPI_BTYPE_FIELD_UNIT);
+
+ default:
+ break;
+ }
+
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapEtypeToBtype
+ *
+ * PARAMETERS: Etype - Encoded ACPI Type
+ *
+ * RETURN: Btype corresponding to the Etype
+ *
+ * DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
+ * operand conversion rules. In other words, returns the type(s)
+ * this Etype is implicitly converted to during interpretation.
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapEtypeToBtype (
+ UINT32 Etype)
+{
+
+
+ if (Etype == ACPI_TYPE_ANY)
+ {
+ return ACPI_BTYPE_OBJECTS_AND_REFS;
+ }
+
+ /* Try the standard ACPI data types */
+
+ if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
+ {
+ /*
+ * This switch statement implements the allowed operand conversion
+ * rules as per the "ASL Data Types" section of the ACPI
+ * specification.
+ */
+ switch (Etype)
+ {
+ case ACPI_TYPE_INTEGER:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
+
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ return (ACPI_BTYPE_COMPUTE_DATA);
+
+ case ACPI_TYPE_PACKAGE:
+ return (ACPI_BTYPE_PACKAGE);
+
+ case ACPI_TYPE_FIELD_UNIT:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
+
+ case ACPI_TYPE_DDB_HANDLE:
+ return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
+
+ case ACPI_BTYPE_DEBUG_OBJECT:
+
+ /* Cannot be used as a source operand */
+
+ return (0);
+
+ default:
+ return (1 << (Etype - 1));
+ }
+ }
+
+ /* Try the internal data types */
+
+ switch (Etype)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ /* Named fields can be either Integer/Buffer/String */
+
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
+
+ case ACPI_TYPE_LOCAL_ALIAS:
+
+ return (ACPI_BTYPE_INTEGER);
+
+
+ case ACPI_TYPE_LOCAL_RESOURCE:
+ case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
+
+ return (ACPI_BTYPE_REFERENCE);
+
+ default:
+ printf ("Unhandled encoded type: %X\n", Etype);
+ return (0);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapBtypeToEtype
+ *
+ * PARAMETERS: Btype - Bitfield of ACPI types
+ *
+ * RETURN: The Etype corresponding the the Btype
+ *
+ * DESCRIPTION: Convert a bitfield type to an encoded type
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapBtypeToEtype (
+ UINT32 Btype)
+{
+ UINT32 i;
+ UINT32 Etype;
+
+
+ if (Btype == 0)
+ {
+ return 0;
+ }
+
+ Etype = 1;
+ for (i = 1; i < Btype; i *= 2)
+ {
+ Etype++;
+ }
+
+ return (Etype);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnFormatBtype
+ *
+ * PARAMETERS: Btype - Bitfield of ACPI types
+ * Buffer - Where to put the ascii string
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Convert a Btype to a string of ACPI types
+ *
+ ******************************************************************************/
+
+void
+AnFormatBtype (
+ char *Buffer,
+ UINT32 Btype)
+{
+ UINT32 Type;
+ BOOLEAN First = TRUE;
+
+
+ *Buffer = 0;
+
+ if (Btype == 0)
+ {
+ strcat (Buffer, "NoReturnValue");
+ return;
+ }
+
+ for (Type = 1; Type < ACPI_TYPE_EXTERNAL_MAX; Type++)
+ {
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, AcpiUtGetTypeName (Type));
+ }
+ Btype >>= 1;
+ }
+
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, "Reference");
+ }
+
+ Btype >>= 1;
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, "Resource");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnGetBtype
+ *
+ * PARAMETERS: Op - Parse node whose type will be returned.
+ *
+ * RETURN: The Btype associated with the Op.
+ *
+ * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
+ * Handles the case where the node is a name or method call and
+ * the actual type must be obtained from the namespace node.
+ *
+ ******************************************************************************/
+
+UINT32
+AnGetBtype (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *ReferencedNode;
+ UINT32 ThisNodeBtype = 0;
+
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
+ {
+ Node = Op->Asl.Node;
+ if (!Node)
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "Null attached Nsnode: [%s] at line %d\n",
+ Op->Asl.ParseOpName, Op->Asl.LineNumber);
+ return ACPI_UINT32_MAX;
+ }
+
+ ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
+
+ /*
+ * Since it was a named reference, enable the
+ * reference bit also
+ */
+ ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
+
+ if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ ReferencedNode = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ if (!ReferencedNode)
+ {
+ printf ("No back ptr to Op: type %X\n", Node->Type);
+ return ACPI_UINT32_MAX;
+ }
+
+ if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
+ {
+ ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
+ }
+ else
+ {
+ return (ACPI_UINT32_MAX -1);
+ }
+ }
+ }
+ else
+ {
+ ThisNodeBtype = Op->Asl.AcpiBtype;
+ }
+
+ return (ThisNodeBtype);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnCheckForReservedName
+ *
+ * PARAMETERS: Op - A parse node
+ * Name - NameSeg to check
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check a NameSeg against the reserved list.
+ *
+ ******************************************************************************/
+
+#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000
+#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX
+#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1)
+#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2)
+#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3)
+
+UINT32
+AnCheckForReservedName (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name)
+{
+ UINT32 i;
+
+
+ if (Name[0] == 0)
+ {
+ AcpiOsPrintf ("Found a null name, external = %s\n", Op->Asl.ExternalName);
+ }
+
+ /* All reserved names are prefixed with a single underscore */
+
+ if (Name[0] != '_')
+ {
+ return (ACPI_NOT_RESERVED_NAME);
+ }
+
+ /* Check for a standard reserved method name */
+
+ for (i = 0; ReservedMethods[i].Name; i++)
+ {
+ if (!ACPI_STRNCMP (Name, ReservedMethods[i].Name, ACPI_NAME_SIZE))
+ {
+ if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
+ return (ACPI_PREDEFINED_NAME);
+ }
+ else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
+ return (ACPI_PREDEFINED_NAME);
+ }
+
+ /* Return index into reserved array */
+
+ return i;
+ }
+ }
+
+ /*
+ * Now check for the "special" reserved names --
+ * GPE: _Lxx
+ * GPE: _Exx
+ * EC: _Qxx
+ */
+ if ((Name[1] == 'L') ||
+ (Name[1] == 'E') ||
+ (Name[1] == 'Q'))
+ {
+ /* The next two characters must be hex digits */
+
+ if ((isxdigit (Name[2])) &&
+ (isxdigit (Name[3])))
+ {
+ return (ACPI_EVENT_RESERVED_NAME);
+ }
+ }
+
+
+ /* Check for the names reserved for the compiler itself: _T_x */
+
+ else if ((Op->Asl.ExternalName[1] == 'T') &&
+ (Op->Asl.ExternalName[2] == '_'))
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
+ return (ACPI_COMPILER_RESERVED_NAME);
+ }
+
+ /*
+ * The name didn't match any of the known reserved names. Flag it as a
+ * warning, since the entire namespace starting with an underscore is
+ * reserved by the ACPI spec.
+ */
+ AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, Op->Asl.ExternalName);
+
+ return (ACPI_NOT_RESERVED_NAME);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnCheckForReservedMethod
+ *
+ * PARAMETERS: Op - A parse node of type "METHOD".
+ * MethodInfo - Saved info about this method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: If method is a reserved name, check that the number of arguments
+ * and the return type (returns a value or not) is correct.
+ *
+ ******************************************************************************/
+
+void
+AnCheckForReservedMethod (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo)
+{
+ UINT32 Index;
+
+
+ /* Check for a match against the reserved name list */
+
+ Index = AnCheckForReservedName (Op, Op->Asl.NameSeg);
+
+ switch (Index)
+ {
+ case ACPI_NOT_RESERVED_NAME:
+ case ACPI_PREDEFINED_NAME:
+ case ACPI_COMPILER_RESERVED_NAME:
+
+ /* Just return, nothing to do */
+ break;
+
+
+ case ACPI_EVENT_RESERVED_NAME:
+
+ Gbl_ReservedMethods++;
+
+ /* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */
+
+ if (MethodInfo->NumArguments != 0)
+ {
+ sprintf (MsgBuffer, " %s requires %d",
+ Op->Asl.ExternalName, 0);
+
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
+ }
+ break;
+
+
+ default:
+
+ Gbl_ReservedMethods++;
+
+ /* Matched a reserved method name */
+
+ if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments)
+ {
+ sprintf (MsgBuffer, " %s requires %d",
+ ReservedMethods[Index].Name,
+ ReservedMethods[Index].NumArguments);
+
+ if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments)
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
+ }
+ else
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, MsgBuffer);
+ }
+ }
+
+ if (MethodInfo->NumReturnNoValue &&
+ ReservedMethods[Index].Flags & ASL_RSVD_RETURN_VALUE)
+ {
+ sprintf (MsgBuffer, "%s", ReservedMethods[Index].Name);
+
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, MsgBuffer);
+ }
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodAnalysisWalkBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * 1) Initialized local variables
+ * 2) Valid arguments
+ * 3) Return types
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
+ ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
+ ACPI_PARSE_OBJECT *Next;
+ UINT32 RegisterNumber;
+ UINT32 i;
+ char LocalName[] = "Local0";
+ char ArgName[] = "Arg0";
+
+
+ ACPI_FUNCTION_NAME ("AnMethodAnalysisWalkBegin");
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ TotalMethods++;
+
+ /*
+ * Create and init method info
+ */
+ MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
+ MethodInfo->Next = WalkInfo->MethodStack;
+ MethodInfo->Op = Op;
+
+ WalkInfo->MethodStack = MethodInfo;
+
+ /* Get the NumArguments node */
+
+ Next = Op->Asl.Child;
+ Next = Next->Asl.Next;
+ MethodInfo->NumArguments = (UINT8) (((UINT8) Next->Asl.Value.Integer) & 0x07);
+
+ /*
+ * Actual arguments are initialized at method entry.
+ * All other ArgX "registers" can be used as locals, so we
+ * track their initialization.
+ */
+ for (i = 0; i < MethodInfo->NumArguments; i++)
+ {
+ MethodInfo->ArgInitialized[i] = TRUE;
+ }
+
+ break;
+
+
+ case PARSEOP_METHODCALL:
+
+ if (MethodInfo &&
+ (Op->Asl.Node == MethodInfo->Op->Asl.Node))
+ {
+ AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
+ }
+ break;
+
+
+ case PARSEOP_LOCAL0:
+ case PARSEOP_LOCAL1:
+ case PARSEOP_LOCAL2:
+ case PARSEOP_LOCAL3:
+ case PARSEOP_LOCAL4:
+ case PARSEOP_LOCAL5:
+ case PARSEOP_LOCAL6:
+ case PARSEOP_LOCAL7:
+
+ if (!MethodInfo)
+ {
+ /* Probably was an error in the method declaration, no additional error here */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ return (AE_ERROR);
+ }
+
+ RegisterNumber = (Op->Asl.AmlOpcode & 0x000F);
+
+ /*
+ * If the local is being used as a target, mark the local
+ * initialized
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ MethodInfo->LocalInitialized[RegisterNumber] = TRUE;
+ }
+
+ /*
+ * Otherwise, this is a reference, check if the local
+ * has been previously initialized.
+ */
+ else if (!MethodInfo->LocalInitialized[RegisterNumber])
+ {
+ LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30);
+ AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName);
+ }
+ break;
+
+
+ case PARSEOP_ARG0:
+ case PARSEOP_ARG1:
+ case PARSEOP_ARG2:
+ case PARSEOP_ARG3:
+ case PARSEOP_ARG4:
+ case PARSEOP_ARG5:
+ case PARSEOP_ARG6:
+
+ if (!MethodInfo)
+ {
+ /* Probably was an error in the method declaration, no additional error here */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ return (AE_ERROR);
+ }
+
+ RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8;
+ ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30);
+
+ /*
+ * If the Arg is being used as a target, mark the local
+ * initialized
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ MethodInfo->ArgInitialized[RegisterNumber] = TRUE;
+ }
+
+ /*
+ * Otherwise, this is a reference, check if the Arg
+ * has been previously initialized.
+ */
+ else if (!MethodInfo->ArgInitialized[RegisterNumber])
+ {
+ AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
+ }
+
+ /* Flag this arg if it is not a "real" argument to the method */
+
+ if (RegisterNumber >= MethodInfo->NumArguments)
+ {
+ AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName);
+ }
+ break;
+
+
+ case PARSEOP_RETURN:
+
+ if (!MethodInfo)
+ {
+ /* Probably was an error in the method declaration, no additional error here */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ return (AE_ERROR);
+ }
+
+ /* Child indicates a return value */
+
+ if ((Op->Asl.Child) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ MethodInfo->NumReturnWithValue++;
+ }
+ else
+ {
+ MethodInfo->NumReturnNoValue++;
+ }
+ break;
+
+
+ case PARSEOP_BREAK:
+ case PARSEOP_CONTINUE:
+
+ Next = Op->Asl.Parent;
+ while (Next)
+ {
+ if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
+ {
+ break;
+ }
+ Next = Next->Asl.Parent;
+ }
+
+ if (!Next)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
+ }
+ break;
+
+
+ case PARSEOP_DEVICE:
+ case PARSEOP_EVENT:
+ case PARSEOP_MUTEX:
+ case PARSEOP_OPERATIONREGION:
+ case PARSEOP_POWERRESOURCE:
+ case PARSEOP_PROCESSOR:
+ case PARSEOP_THERMALZONE:
+
+ /*
+ * The first operand is a name to be created in the namespace.
+ * Check against the reserved list.
+ */
+ i = AnCheckForReservedName (Op, Op->Asl.NameSeg);
+ if (i < ACPI_VALID_RESERVED_NAME_MAX)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
+ }
+ break;
+
+
+ case PARSEOP_NAME:
+
+ i = AnCheckForReservedName (Op, Op->Asl.NameSeg);
+ if (i < ACPI_VALID_RESERVED_NAME_MAX)
+ {
+ if (ReservedMethods[i].NumArguments > 0)
+ {
+ /*
+ * This reserved name must be a control method because
+ * it must have arguments
+ */
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments");
+ }
+
+ /*
+ * Typechecking for _HID
+ */
+ else if (!ACPI_STRCMP (METHOD_NAME__HID, ReservedMethods[i].Name))
+ {
+ /* Examine the second operand to typecheck it */
+
+ Next = Op->Asl.Child->Asl.Next;
+
+ if ((Next->Asl.ParseOpcode != PARSEOP_INTEGER) &&
+ (Next->Asl.ParseOpcode != PARSEOP_STRING_LITERAL))
+ {
+ /* _HID must be a string or an integer */
+
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next, "String or Integer");
+ }
+
+ if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
+ {
+ /*
+ * _HID is a string, all characters must be alphanumeric.
+ * One of the things we want to catch here is the use of
+ * a leading asterisk in the string.
+ */
+ for (i = 0; Next->Asl.Value.String[i]; i++)
+ {
+ if (!isalnum (Next->Asl.Value.String[i]))
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, Next, Next->Asl.Value.String);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ break;
+
+
+ default:
+ break;
+ }
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnLastStatementIsReturn
+ *
+ * PARAMETERS: Op - A method parse node
+ *
+ * RETURN: TRUE if last statement is an ASL RETURN. False otherwise
+ *
+ * DESCRIPTION: Walk down the list of top level statements within a method
+ * to find the last one. Check if that last statement is in
+ * fact a RETURN statement.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AnLastStatementIsReturn (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /*
+ * Check if last statement is a return
+ */
+ Next = ASL_GET_CHILD_NODE (Op);
+ while (Next)
+ {
+ if ((!Next->Asl.Next) &&
+ (Next->Asl.ParseOpcode == PARSEOP_RETURN))
+ {
+ return TRUE;
+ }
+
+ Next = ASL_GET_PEER_NODE (Next);
+ }
+
+ return FALSE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodAnalysisWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * return analysis.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
+ ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+ case PARSEOP_RETURN:
+ if (!MethodInfo)
+ {
+ printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "No method info for this method");
+ CmCleanupAndExit ();
+ return (AE_AML_INTERNAL);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ WalkInfo->MethodStack = MethodInfo->Next;
+
+ /*
+ * Check if there is no return statement at the end of the
+ * method AND we can actually get there -- i.e., the execution
+ * of the method can possibly terminate without a return statement.
+ */
+ if ((!AnLastStatementIsReturn (Op)) &&
+ (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT)))
+ {
+ /*
+ * No return statement, and execution can possibly exit
+ * via this path. This is equivalent to Return ()
+ */
+ MethodInfo->NumReturnNoValue++;
+ }
+
+ /*
+ * Check for case where some return statements have a return value
+ * and some do not. Exit without a return statement is a return with
+ * no value
+ */
+ if (MethodInfo->NumReturnNoValue &&
+ MethodInfo->NumReturnWithValue)
+ {
+ AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, Op->Asl.ExternalName);
+ }
+
+ /*
+ * If there are any RETURN() statements with no value, or there is a
+ * control path that allows the method to exit without a return value,
+ * we mark the method as a method that does not return a value. This
+ * knowledge can be used to check method invocations that expect a
+ * returned value.
+ */
+ if (MethodInfo->NumReturnNoValue)
+ {
+ if (MethodInfo->NumReturnWithValue)
+ {
+ Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL;
+ }
+ else
+ {
+ Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL;
+ }
+ }
+
+ /*
+ * Check predefined method names for correct return behavior
+ * and correct number of arguments
+ */
+ AnCheckForReservedMethod (Op, MethodInfo);
+ ACPI_MEM_FREE (MethodInfo);
+ break;
+
+
+ case PARSEOP_RETURN:
+
+ /*
+ * The parent block does not "exit" and continue execution -- the
+ * method is terminated here with the Return() statement.
+ */
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+ Op->Asl.ParentMethod = MethodInfo->Op; /* Used in the "typing" pass later */
+
+ /*
+ * If there is a peer node after the return statement, then this
+ * node is unreachable code -- i.e., it won't be executed because of the
+ * preceeding Return() statement.
+ */
+ if (Op->Asl.Next)
+ {
+ AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
+ }
+ break;
+
+
+ case PARSEOP_IF:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.Next) &&
+ (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
+ {
+ /*
+ * This IF has a corresponding ELSE. The IF block has no exit,
+ * (it contains an unconditional Return)
+ * mark the ELSE block to remember this fact.
+ */
+ Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT;
+ }
+ break;
+
+
+ case PARSEOP_ELSE:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT))
+ {
+ /*
+ * This ELSE block has no exit and the corresponding IF block
+ * has no exit either. Therefore, the parent node has no exit.
+ */
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+ }
+ break;
+
+
+ default:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.Parent))
+ {
+ /* If this node has no exit, then the parent has no exit either */
+
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+ }
+ break;
+ }
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodTypingWalkBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for the typing walk.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodTypingWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodTypingWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for typing walk. Complete method
+ * return analysis. Check methods for :
+ * 1) Initialized local variables
+ * 2) Valid arguments
+ * 3) Return types
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodTypingWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ UINT32 ThisNodeBtype;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ Op->Asl.CompileFlags |= NODE_METHOD_TYPED;
+ break;
+
+ case PARSEOP_RETURN:
+
+ if ((Op->Asl.Child) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+
+ if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
+ (ThisNodeBtype == (ACPI_UINT32_MAX -1)))
+ {
+ /*
+ * The method is untyped at this time (typically a forward reference).
+ * We must recursively type the method here
+ */
+ TrWalkParseTree (ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Op->Asl.Child->Asl.Node->Object),
+ ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
+ AnMethodTypingWalkEnd, NULL);
+
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ }
+
+ /* Returns a value, get it's type */
+
+ if (Op->Asl.ParentMethod)
+ {
+ Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnCheckMethodReturnValue
+ *
+ * PARAMETERS: Op - Parent
+ * OpInfo - Parent info
+ * ArgOp - Method invocation op
+ * RequiredBtypes - What caller requires
+ * ThisNodeBtype - What this node returns (if anything)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check a method invocation for 1) A return value and if it does
+ * in fact return a value, 2) check the type of the return value.
+ *
+ ******************************************************************************/
+
+void
+AnCheckMethodReturnValue (
+ ACPI_PARSE_OBJECT *Op,
+ const ACPI_OPCODE_INFO *OpInfo,
+ ACPI_PARSE_OBJECT *ArgOp,
+ UINT32 RequiredBtypes,
+ UINT32 ThisNodeBtype)
+{
+ ACPI_PARSE_OBJECT *OwningOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ Node = ArgOp->Asl.Node;
+
+
+ /* Examine the parent op of this method */
+
+ OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL)
+ {
+ /*
+ * Method NEVER returns a value
+ */
+ AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName);
+ }
+ else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL)
+ {
+ /*
+ * Method SOMETIMES returns a value, SOMETIMES not
+ */
+ AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName);
+ }
+ else if (!(ThisNodeBtype & RequiredBtypes))
+ {
+ /*
+ * Method returns a value, but the type is wrong
+ */
+ AnFormatBtype (StringBuffer, ThisNodeBtype);
+ AnFormatBtype (StringBuffer2, RequiredBtypes);
+
+
+ /*
+ * The case where the method does not return any value at all
+ * was already handled in the namespace cross reference
+ * -- Only issue an error if the method in fact returns a value,
+ * but it is of the wrong type
+ */
+ if (ThisNodeBtype != 0)
+ {
+ sprintf (MsgBuffer, "Method returns [%s], %s operator requires [%s]",
+ StringBuffer, OpInfo->Name, StringBuffer2);
+
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOperandTypecheckWalkBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * 1) Initialized local variables
+ * 2) Valid arguments
+ * 3) Return types
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOperandTypecheckWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOperandTypecheckWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * return analysis.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOperandTypecheckWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 RuntimeArgTypes;
+ UINT32 RuntimeArgTypes2;
+ UINT32 RequiredBtypes;
+ UINT32 ThisNodeBtype;
+ UINT32 CommonBtypes;
+ UINT32 OpcodeClass;
+ ACPI_PARSE_OBJECT *ArgOp;
+ UINT32 ArgType;
+
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_RAW_DATA_BYTE:
+ case AML_RAW_DATA_WORD:
+ case AML_RAW_DATA_DWORD:
+ case AML_RAW_DATA_QWORD:
+ case AML_RAW_DATA_BUFFER:
+ case AML_RAW_DATA_CHAIN:
+ case AML_PACKAGE_LENGTH:
+ case AML_UNASSIGNED_OPCODE:
+ case AML_DEFAULT_ARG_OP:
+
+ /* Ignore the internal (compiler-only) AML opcodes */
+
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (!OpInfo)
+ {
+ return (AE_OK);
+ }
+
+ ArgOp = Op->Asl.Child;
+ RuntimeArgTypes = OpInfo->RuntimeArgs;
+ OpcodeClass = OpInfo->Class;
+
+
+ /*
+ * Special case for control opcodes IF/RETURN/WHILE since they
+ * have no runtime arg list (at this time)
+ */
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_RETURN_OP:
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ /* The lone arg is a method call, check it */
+
+ RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
+ if (Op->Asl.AmlOpcode == AML_RETURN_OP)
+ {
+ RequiredBtypes = 0xFFFFFFFF;
+ }
+
+ ThisNodeBtype = AnGetBtype (ArgOp);
+ if (ThisNodeBtype == ACPI_UINT32_MAX)
+ {
+ return (AE_OK);
+ }
+ AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype);
+ }
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ /* Ignore the non-executable opcodes */
+
+ if (RuntimeArgTypes == ARGI_INVALID_OPCODE)
+ {
+ return (AE_OK);
+ }
+
+ switch (OpcodeClass)
+ {
+ case AML_CLASS_EXECUTE:
+ case AML_CLASS_CREATE:
+ case AML_CLASS_CONTROL:
+ case AML_CLASS_RETURN_VALUE:
+
+ /* TBD: Change class or fix typechecking for these */
+
+ if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Asl.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ break;
+ }
+
+ /* Reverse the runtime argument list */
+
+ RuntimeArgTypes2 = 0;
+ while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes)))
+ {
+ RuntimeArgTypes2 <<= ARG_TYPE_WIDTH;
+ RuntimeArgTypes2 |= ArgType;
+ INCREMENT_ARG_LIST (RuntimeArgTypes);
+ }
+
+ while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
+ {
+ RequiredBtypes = AnMapArgTypeToBtype (ArgType);
+
+ ThisNodeBtype = AnGetBtype (ArgOp);
+ if (ThisNodeBtype == ACPI_UINT32_MAX)
+ {
+ goto NextArgument;
+ }
+
+ /* Examine the arg based on the required type of the arg */
+
+ switch (ArgType)
+ {
+ case ARGI_TARGETREF:
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ /* ZERO is the placeholder for "don't store result" */
+
+ ThisNodeBtype = RequiredBtypes;
+ break;
+ }
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
+ {
+ /*
+ * This is the case where an original reference to a resource
+ * descriptor field has been replaced by an (Integer) offset.
+ * These named fields are supported at compile-time only;
+ * the names are not passed to the interpreter (via the AML).
+ */
+ if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
+ (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
+ }
+ break;
+ }
+
+ if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
+ (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF))
+ {
+ break;
+ }
+
+ ThisNodeBtype = RequiredBtypes;
+ break;
+
+
+ case ARGI_REFERENCE: /* References */
+ case ARGI_INTEGER_REF:
+ case ARGI_OBJECT_REF:
+ case ARGI_DEVICE_REF:
+
+ switch (ArgOp->Asl.ParseOpcode)
+ {
+ case PARSEOP_LOCAL0:
+ case PARSEOP_LOCAL1:
+ case PARSEOP_LOCAL2:
+ case PARSEOP_LOCAL3:
+ case PARSEOP_LOCAL4:
+ case PARSEOP_LOCAL5:
+ case PARSEOP_LOCAL6:
+ case PARSEOP_LOCAL7:
+
+ /* TBD: implement analysis of current value (type) of the local */
+ /* For now, just treat any local as a typematch */
+
+ /*ThisNodeBtype = RequiredBtypes;*/
+ break;
+
+ case PARSEOP_ARG0:
+ case PARSEOP_ARG1:
+ case PARSEOP_ARG2:
+ case PARSEOP_ARG3:
+ case PARSEOP_ARG4:
+ case PARSEOP_ARG5:
+ case PARSEOP_ARG6:
+
+ /* Hard to analyze argument types, sow we won't */
+ /* For now, just treat any arg as a typematch */
+
+ /* ThisNodeBtype = RequiredBtypes; */
+ break;
+
+ case PARSEOP_DEBUG:
+ break;
+
+ case PARSEOP_REFOF:
+ case PARSEOP_INDEX:
+ default:
+ break;
+
+ }
+ break;
+
+ case ARGI_INTEGER:
+ default:
+ break;
+ }
+
+
+ CommonBtypes = ThisNodeBtype & RequiredBtypes;
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ /* Check a method call for a valid return value */
+
+ AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype);
+ }
+
+ /*
+ * Now check if the actual type(s) match at least one
+ * bit to the required type
+ */
+ else if (!CommonBtypes)
+ {
+ /* No match -- this is a type mismatch error */
+
+ AnFormatBtype (StringBuffer, ThisNodeBtype);
+ AnFormatBtype (StringBuffer2, RequiredBtypes);
+
+ sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
+ StringBuffer, OpInfo->Name, StringBuffer2);
+
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
+ }
+
+ NextArgument:
+ ArgOp = ArgOp->Asl.Next;
+ INCREMENT_ARG_LIST (RuntimeArgTypes2);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOtherSemanticAnalysisWalkBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * 1) Initialized local variables
+ * 2) Valid arguments
+ * 3) Return types
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOtherSemanticAnalysisWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * return analysis.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ return AE_OK;
+
+}
diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c
new file mode 100644
index 0000000..2b3c570
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c
@@ -0,0 +1,608 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslcodegen - AML code generation
+ * $Revision: 49 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslcodegen")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgGenerateAmlOutput
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generate AML code. Currently generates the listing file
+ * simultaneously.
+ *
+ ******************************************************************************/
+
+void
+CgGenerateAmlOutput (void)
+{
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n");
+
+ /* Generate the AML output file */
+
+ FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
+ Gbl_SourceLine = 0;
+ Gbl_NextError = Gbl_ErrorLog;
+
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL);
+ CgCloseTable ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgAmlWriteWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse tree walk to generate the AML code.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+CgAmlWriteWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ /*
+ * Debug output
+ */
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
+ UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
+
+ if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG ||
+ Op->Asl.ParseOpcode == PARSEOP_NAMESTRING ||
+ Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%10.32s ", Op->Asl.ExternalName);
+ }
+ else
+ {
+ DbgPrint (ASL_TREE_OUTPUT, " ");
+ }
+
+ DbgPrint (ASL_TREE_OUTPUT,
+ "Val-%08X POp-%04X AOp-%04X OpLen-%01X PByts-%01X Len-%04X SubLen-%04X PSubLen-%04X Op-%08X Chld-%08X Paren-%08X Flags-%04X AcTyp-%08X C-%2d L-%d\n",
+ (UINT32) Op->Asl.Value.Integer,
+ Op->Asl.ParseOpcode,
+ Op->Asl.AmlOpcode,
+ Op->Asl.AmlOpcodeLength,
+ Op->Asl.AmlPkgLenBytes,
+ Op->Asl.AmlLength,
+ Op->Asl.AmlSubtreeLength,
+ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
+ Op,
+ Op->Asl.Child,
+ Op->Asl.Parent,
+ Op->Asl.CompileFlags,
+ Op->Asl.AcpiBtype,
+ Op->Asl.Column,
+ Op->Asl.LineNumber);
+
+ /*
+ * Generate the AML for this node
+ */
+ CgWriteNode (Op);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgLocalWriteAmlData
+ *
+ * PARAMETERS: Buffer - Buffer to write
+ * Length - Size of data in buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write a buffer of AML data to the AML output file.
+ *
+ ******************************************************************************/
+
+void
+CgLocalWriteAmlData (
+ ACPI_PARSE_OBJECT *Op,
+ void *Buffer,
+ UINT32 Length)
+{
+
+
+ /* Write the raw data to the AML file */
+
+ FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length);
+
+ /* Update the final AML length for this node (used for listings) */
+
+ if (Op)
+ {
+ Op->Asl.FinalAmlLength += Length;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteAmlOpcode
+ *
+ * PARAMETERS: Op - Parse node with an AML opcode
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Write the AML opcode corresponding to a parse node.
+ *
+ ******************************************************************************/
+
+void
+CgWriteAmlOpcode (
+ ACPI_PARSE_OBJECT *Op)
+{
+ union {
+ UINT16 Opcode;
+ UINT8 OpcodeBytes[2];
+ } Aml;
+ union {
+ UINT32 Len;
+ UINT8 LenBytes[4];
+ } PkgLen;
+
+ UINT8 PkgLenFirstByte;
+ UINT32 i;
+
+
+ /* We expect some DEFAULT_ARGs, just ignore them */
+
+ if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ return;
+ }
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_UNASSIGNED_OPCODE:
+
+ /* These opcodes should not get here */
+
+ printf ("Found a node with an unassigned AML opcode\n");
+ fprintf (stderr, "Found a node with an unassigned AML opcode\n");
+ return;
+
+ case AML_INT_RESERVEDFIELD_OP:
+
+ /* Special opcodes for within a field definition */
+
+ Aml.Opcode = 0x00;
+ break;
+
+ case AML_INT_ACCESSFIELD_OP:
+
+ Aml.Opcode = 0x01;
+ break;
+
+ default:
+ Aml.Opcode = Op->Asl.AmlOpcode;
+ break;
+ }
+
+
+ switch (Aml.Opcode)
+ {
+ case AML_PACKAGE_LENGTH:
+
+ /* Value is the length to be encoded (Used in field definitions) */
+
+ PkgLen.Len = (UINT32) Op->Asl.Value.Integer;
+ break;
+
+ default:
+
+ /* Check for two-byte opcode */
+
+ if (Aml.Opcode > 0x00FF)
+ {
+ /* Write the high byte first */
+
+ CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
+ }
+
+ CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
+
+ /* Subtreelength doesn't include length of package length bytes */
+
+ PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
+ break;
+ }
+
+ /* Does this opcode have an associated "PackageLength" field? */
+
+ if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
+ {
+ if (Op->Asl.AmlPkgLenBytes == 1)
+ {
+ /* Simplest case -- no bytes to follow, just write the count */
+
+ CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
+ }
+ else
+ {
+ /*
+ * Encode the "bytes to follow" in the first byte, top two bits.
+ * The low-order nybble of the length is in the bottom 4 bits
+ */
+ PkgLenFirstByte = (UINT8) (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
+ (PkgLen.LenBytes[0] & 0x0F));
+
+ CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
+
+ /* Shift the length over by the 4 bits we just stuffed in the first byte */
+
+ PkgLen.Len >>= 4;
+
+ /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */
+
+ for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
+ {
+ CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
+ }
+ }
+ }
+
+ switch (Aml.Opcode)
+ {
+ case AML_BYTE_OP:
+
+ CgLocalWriteAmlData (Op, (UINT8 *) &Op->Asl.Value.Integer, 1);
+ break;
+
+ case AML_WORD_OP:
+
+ CgLocalWriteAmlData (Op, (UINT16 *) &Op->Asl.Value.Integer, 2);
+ break;
+
+ case AML_DWORD_OP:
+
+ CgLocalWriteAmlData (Op, (UINT32 *) &Op->Asl.Value.Integer, 4);
+ break;
+
+ case AML_QWORD_OP:
+
+ CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
+ break;
+
+ case AML_STRING_OP:
+
+ CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength);
+ break;
+
+ default:
+ /* All data opcodes must appear above */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteTableHeader
+ *
+ * PARAMETERS: Op - The DEFINITIONBLOCK node
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK
+ *
+ ******************************************************************************/
+
+void
+CgWriteTableHeader (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child;
+
+
+ /* AML filename */
+
+ Child = Op->Asl.Child;
+
+ /* Signature */
+
+ Child = Child->Asl.Next;
+ strncpy (TableHeader.Signature, Child->Asl.Value.String, 4);
+
+ /* Revision */
+
+ Child = Child->Asl.Next;
+ TableHeader.Revision = (UINT8) Child->Asl.Value.Integer;
+
+ /* OEMID */
+
+ Child = Child->Asl.Next;
+ strncpy (TableHeader.OemId, Child->Asl.Value.String, 6);
+
+ /* OEM TableID */
+
+ Child = Child->Asl.Next;
+ strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8);
+
+ /* OEM Revision */
+
+ Child = Child->Asl.Next;
+ TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
+
+ /* Compiler ID */
+
+ strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4);
+
+ /* Compiler version */
+
+ TableHeader.AslCompilerRevision = CompilerCreatorRevision;
+
+ /* Table length. Checksum zero for now, will rewrite later */
+
+ TableHeader.Length = Gbl_TableLength;
+ TableHeader.Checksum = 0;
+
+ CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgCloseTable
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Complete the ACPI table by calculating the checksum and
+ * re-writing the header.
+ *
+ ******************************************************************************/
+
+void
+CgCloseTable (void)
+{
+ signed char Sum;
+ UINT8 FileByte;
+
+
+ FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+ Sum = 0;
+
+ /* Calculate the checksum over the entire file */
+
+ while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK)
+ {
+ Sum = (signed char) (Sum + FileByte);
+ }
+
+ /* Re-write the table header with the checksum */
+
+ TableHeader.Checksum = (UINT8) (0 - Sum);
+
+ FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+ CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteNode
+ *
+ * PARAMETERS: Op - Parse node to write.
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Write the AML that corresponds to a parse node.
+ *
+ ******************************************************************************/
+
+void
+CgWriteNode (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ASL_RESOURCE_NODE *Rnode;
+
+
+ Op->Asl.FinalAmlLength = 0;
+
+ /* Always check for DEFAULT_ARG and other "Noop" nodes */
+ /* TBD: this may not be the best place for this check */
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) ||
+ (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) ||
+ (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END))
+ {
+ return;
+ }
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_RAW_DATA_BYTE:
+ case AML_RAW_DATA_WORD:
+ case AML_RAW_DATA_DWORD:
+ case AML_RAW_DATA_QWORD:
+
+ CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
+ return;
+
+
+ case AML_RAW_DATA_BUFFER:
+
+ CgLocalWriteAmlData (Op, Op->Asl.Value.Buffer, Op->Asl.AmlLength);
+ return;
+
+
+ case AML_RAW_DATA_CHAIN:
+
+ Rnode = ACPI_CAST_PTR (ASL_RESOURCE_NODE, Op->Asl.Value.Buffer);
+ while (Rnode)
+ {
+ CgLocalWriteAmlData (Op, Rnode->Buffer, Rnode->BufferLength);
+ Rnode = Rnode->Next;
+ }
+ return;
+
+ default:
+ /* Internal data opcodes must all appear above */
+ break;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFAULT_ARG:
+
+ break;
+
+ case PARSEOP_DEFINITIONBLOCK:
+
+ CgWriteTableHeader (Op);
+ break;
+
+ case PARSEOP_NAMESEG:
+ case PARSEOP_NAMESTRING:
+ case PARSEOP_METHODCALL:
+
+ CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength);
+ break;
+
+ default:
+
+ CgWriteAmlOpcode (Op);
+ break;
+ }
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c
new file mode 100644
index 0000000..fa3d45e
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -0,0 +1,615 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslcompile - top level compile module
+ * $Revision: 69 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <stdio.h>
+#include "aslcompiler.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslcompile")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCompilerSignon
+ *
+ * PARAMETERS: FileId - ID of the output file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display compiler signon
+ *
+ ******************************************************************************/
+
+void
+AslCompilerSignon (
+ UINT32 FileId)
+{
+ char *Prefix = "";
+
+
+ /*
+ * Set line prefix depending on the destination file type
+ */
+ switch (FileId)
+ {
+ case ASL_FILE_ASM_SOURCE_OUTPUT:
+ case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
+ Prefix = "; ";
+ break;
+
+ case ASL_FILE_HEX_OUTPUT:
+
+ if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+ {
+ Prefix = "; ";
+ }
+ else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
+ Prefix = " * ";
+ }
+ break;
+
+ case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_INCLUDE_OUTPUT:
+
+ Prefix = " * ";
+ break;
+
+ default:
+ /* No other output types supported */
+ break;
+ }
+
+ /* Compiler signon with copyright */
+
+ FlPrintFile (FileId,
+ "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0b\n%s\n",
+ Prefix,
+ Prefix, IntelAcpiCA,
+ Prefix, CompilerId, ACPI_CA_VERSION, __DATE__,
+ Prefix, CompilerCopyright,
+ Prefix,
+ Prefix);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCompilerFileHeader
+ *
+ * PARAMETERS: FileId - ID of the output file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Header used at the beginning of output files
+ *
+ ******************************************************************************/
+
+void
+AslCompilerFileHeader (
+ UINT32 FileId)
+{
+ struct tm *NewTime;
+ time_t Aclock;
+ char *Prefix = "";
+
+
+ /*
+ * Set line prefix depending on the destination file type
+ */
+ switch (FileId)
+ {
+ case ASL_FILE_ASM_SOURCE_OUTPUT:
+ case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
+ Prefix = "; ";
+ break;
+
+ case ASL_FILE_HEX_OUTPUT:
+
+ if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+ {
+ Prefix = "; ";
+ }
+ else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ {
+ Prefix = " * ";
+ }
+ break;
+
+ case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_INCLUDE_OUTPUT:
+
+ Prefix = " * ";
+ break;
+
+ default:
+ /* No other output types supported */
+ break;
+ }
+
+ /* Compilation header with timestamp */
+
+ (void) time (&Aclock);
+ NewTime = localtime (&Aclock);
+
+ FlPrintFile (FileId,
+ "%sCompilation of \"%s\" - %s%s\n",
+ Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
+ Prefix);
+
+ switch (FileId)
+ {
+ case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_INCLUDE_OUTPUT:
+ FlPrintFile (FileId, " */\n");
+ break;
+
+ default:
+ /* Nothing to do for other output types */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CmFlushSourceCode
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Read in any remaining source code after the parse tree
+ * has been constructed.
+ *
+ ******************************************************************************/
+
+void
+CmFlushSourceCode (void)
+{
+ char Buffer;
+
+
+ while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
+ {
+ InsertLineBuffer ((int) Buffer);
+ }
+
+ ResetCurrentLineBuffer ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CmDoCompile
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status (0 = OK)
+ *
+ * DESCRIPTION: This procedure performs the entire compile
+ *
+ ******************************************************************************/
+
+int
+CmDoCompile (void)
+{
+ ACPI_STATUS Status;
+ UINT32 i = 0;
+
+
+ UtBeginEvent (12, "Total Compile time");
+ UtBeginEvent (i, "Initialize");
+
+ /* Open the required input and output files */
+
+ Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
+ if (ACPI_FAILURE (Status))
+ {
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return -1;
+ }
+
+ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+ if (ACPI_FAILURE (Status))
+ {
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return -1;
+ }
+
+ UtEndEvent (i++);
+
+ /* Build the parse tree */
+
+ UtBeginEvent (i, "Parse source code and build parse tree");
+ AslCompilerparse();
+ UtEndEvent (i++);
+
+ /* Flush out any remaining source after parse tree is complete */
+
+ CmFlushSourceCode ();
+
+ /* Did the parse tree get successfully constructed? */
+
+ if (!RootNode)
+ {
+ CmCleanupAndExit ();
+ return -1;
+ }
+
+ OpcGetIntegerWidth (RootNode);
+
+ /* Pre-process parse tree for any operator transforms */
+
+ UtBeginEvent (i, "Generate AML opcodes");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, TrAmlTransformWalk, NULL, NULL);
+
+ /* Generate AML opcodes corresponding to the parse tokens */
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL);
+ UtEndEvent (i++);
+
+ /*
+ * Now that the input is parsed, we can open the AML output file.
+ * Note: by default, the name of this file comes from the table descriptor
+ * within the input file.
+ */
+ Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
+ if (ACPI_FAILURE (Status))
+ {
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return -1;
+ }
+
+ /* Interpret and generate all compile-time constants */
+
+ UtBeginEvent (i, "Constant folding via AML interpreter");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nInterpreting compile-time constant expressions\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, OpcAmlConstantWalk, NULL, NULL);
+ UtEndEvent (i++);
+
+ /* Calculate all AML package lengths */
+
+ UtBeginEvent (i, "Generate AML package lengths");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL);
+ UtEndEvent (i++);
+
+ if (Gbl_ParseOnlyFlag)
+ {
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ UtDisplaySummary (ASL_FILE_STDOUT);
+ if (Gbl_DebugFlag)
+ {
+ /* Print error summary to the debug file */
+
+ AePrintErrorLog (ASL_FILE_STDERR);
+ UtDisplaySummary (ASL_FILE_STDERR);
+ }
+ return 0;
+ }
+
+ /*
+ * Create an internal namespace and use it as a symbol table
+ */
+
+ /* Namespace loading */
+
+ UtBeginEvent (i, "Create ACPI Namespace");
+ Status = LdLoadNamespace (RootNode);
+ UtEndEvent (i++);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ /* Namespace lookup */
+
+ UtBeginEvent (i, "Cross reference parse tree and Namespace");
+ Status = LkCrossReferenceNamespace ();
+ UtEndEvent (i++);
+ UtEndEvent (i++);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ /*
+ * Semantic analysis. This can happen only after the
+ * namespace has been loaded and cross-referenced.
+ *
+ * part one - check control methods
+ */
+ UtBeginEvent (i, "Analyze control method return types");
+ AnalysisWalkInfo.MethodStack = NULL;
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodAnalysisWalkBegin,
+ AnMethodAnalysisWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (i++);
+
+ /* Semantic error checking part two - typing of method returns */
+
+ UtBeginEvent (i, "Determine object types returned by methods");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing \n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
+ AnMethodTypingWalkEnd, NULL);
+ UtEndEvent (i++);
+
+ /* Semantic error checking part three - operand type checking */
+
+ UtBeginEvent (i, "Analyze AML operand types");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking \n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOperandTypecheckWalkBegin,
+ AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (i++);
+
+ /* Semantic error checking part four - other miscellaneous checks */
+
+ UtBeginEvent (i, "Miscellaneous analysis");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous \n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOtherSemanticAnalysisWalkBegin,
+ AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (i++);
+
+ /* Calculate all AML package lengths */
+
+ UtBeginEvent (i, "Finish AML package length generation");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnInitLengthsWalk, NULL);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL);
+ UtEndEvent (i++);
+
+
+ /* Code generation - emit the AML */
+
+ UtBeginEvent (i, "Generate AML code and write output files");
+ CgGenerateAmlOutput ();
+ UtEndEvent (i++);
+
+ UtBeginEvent (i, "Write optional output files");
+ CmDoOutputFiles ();
+ UtEndEvent (i++);
+
+ UtEndEvent (13);
+ CmCleanupAndExit ();
+ return 0;
+}
+
+void
+CmDoOutputFiles (void)
+{
+
+ /* Create listings and hex files */
+
+ LsDoListings ();
+ LsDoHexOutput ();
+
+ /* Dump the namespace to the .nsp file if requested */
+
+ LsDisplayNamespace ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CmCleanupAndExit
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Close all open files and exit the compiler
+ *
+ ******************************************************************************/
+
+void
+CmCleanupAndExit (void)
+{
+ UINT32 i;
+
+
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ if (Gbl_DebugFlag)
+ {
+ /* Print error summary to the debug file */
+
+ AePrintErrorLog (ASL_FILE_STDERR);
+ }
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
+ for (i = 0; i < 13; i++)
+ {
+ if (AslGbl_Events[i].Valid)
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT, "%8lu ms - %s\n",
+ AslGbl_Events[i].EndTime -
+ AslGbl_Events[i].StartTime,
+ AslGbl_Events[i].EventName);
+ }
+ }
+
+ if (Gbl_CompileTimesFlag)
+ {
+ printf ("\nElapsed time for major events\n\n");
+ for (i = 0; i < 13; i++)
+ {
+ if (AslGbl_Events[i].Valid)
+ {
+ printf ("%8lu ms : %s\n",
+ AslGbl_Events[i].EndTime -
+ AslGbl_Events[i].StartTime,
+ AslGbl_Events[i].EventName);
+ }
+ }
+ printf ("\nMiscellaneous compile statistics\n\n");
+ printf ("%11u : %s\n", TotalParseNodes, "Parse nodes");
+ printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches");
+ printf ("%11u : %s\n", TotalNamedObjects, "Named objects");
+ printf ("%11u : %s\n", TotalMethods, "Control methods");
+ printf ("%11u : %s\n", TotalAllocations, "Memory Allocations");
+ printf ("%11u : %s\n", TotalAllocated, "Total allocated memory");
+ printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded");
+ printf ("\n");
+ }
+
+ if (Gbl_NsLookupCount)
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n");
+ DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches", Gbl_NsLookupCount);
+ DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Time per search",
+ ((UINT32) (AslGbl_Events[7].EndTime - AslGbl_Events[7].StartTime) * 1000) /
+ Gbl_NsLookupCount);
+ }
+
+ /* Close all open files */
+
+ for (i = 2; i < ASL_MAX_FILE_TYPE; i++)
+ {
+ FlCloseFile (i);
+ }
+
+ /*
+ * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
+ */
+ if (!Gbl_SourceOutputFlag)
+ {
+ unlink (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ }
+
+ /* Delete AML file if there are errors */
+
+ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ {
+ unlink (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ }
+
+ if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
+ {
+ printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+ }
+
+ UtDisplaySummary (ASL_FILE_STDOUT);
+ exit (0);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
new file mode 100644
index 0000000..5e6724b
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -0,0 +1,1120 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslcompiler.h - common include file
+ * $Revision: 127 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ASLCOMPILER_H
+#define __ASLCOMPILER_H
+
+
+/* Microsoft-specific */
+
+#if (defined WIN32 || defined WIN64)
+
+/* warn : used #pragma pack */
+#pragma warning(disable:4103)
+
+/* warn : named type definition in parentheses */
+#pragma warning(disable:4115)
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+
+
+#include "acpi.h"
+#include "amlresrc.h"
+#include "acdebug.h"
+#include "asltypes.h"
+#include "aslglobal.h"
+
+
+/*
+ * Compiler versions and names
+ */
+
+#define CompilerCreatorRevision ACPI_CA_VERSION
+
+#define IntelAcpiCA "Intel ACPI Component Architecture"
+#define CompilerId "ASL Optimizing Compiler / AML Disassembler"
+#define CompilerCopyright "Copyright (C) 2000 - 2003 Intel Corporation"
+#define CompilerCompliance "ACPI 2.0b"
+#define CompilerName "iasl"
+#define CompilerCreatorId "INTL"
+
+
+/* Configuration constants */
+
+#define ASL_MAX_ERROR_COUNT 200
+#define ASL_NODE_CACHE_SIZE 1024
+#define ASL_STRING_CACHE_SIZE 32768
+
+#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS
+#define ASL_YYTNAME_START 3
+
+/*
+ * Macros
+ */
+
+#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (ASL_RESOURCE_DESC, m)
+#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a))
+#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
+#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child
+#define ASL_GET_PEER_NODE(a) (a)->Asl.Next
+#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c}
+
+
+#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */
+
+
+/* Internal AML opcodes */
+
+#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */
+#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */
+#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */
+#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */
+#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */
+#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */
+#define AML_PACKAGE_LENGTH (UINT16) 0xAA10
+#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE
+#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD
+
+
+/* filename suffixes for output files */
+
+#define FILE_SUFFIX_AML_CODE "aml"
+#define FILE_SUFFIX_LISTING "lst"
+#define FILE_SUFFIX_HEX_DUMP "hex"
+#define FILE_SUFFIX_DEBUG "txt"
+#define FILE_SUFFIX_SOURCE "src"
+#define FILE_SUFFIX_NAMESPACE "nsp"
+#define FILE_SUFFIX_ASM_SOURCE "asm"
+#define FILE_SUFFIX_C_SOURCE "c"
+#define FILE_SUFFIX_DISASSEMBLY "dsl"
+#define FILE_SUFFIX_ASM_INCLUDE "inc"
+#define FILE_SUFFIX_C_INCLUDE "h"
+
+
+/* Misc */
+
+#define ASL_EXTERNAL_METHOD 255
+#define ASL_ABORT TRUE
+#define ASL_NO_ABORT FALSE
+
+
+/*******************************************************************************
+ *
+ * Compiler prototypes
+ *
+ ******************************************************************************/
+
+
+void
+end_stmt (void);
+
+
+/* parser */
+
+int
+AslCompilerparse(
+ void);
+
+ACPI_PARSE_OBJECT *
+AslDoError (
+ void);
+
+int
+AslCompilererror(
+ char *s);
+
+int
+AslCompilerlex(
+ void);
+
+void
+ResetCurrentLineBuffer (
+ void);
+
+void
+InsertLineBuffer (
+ int SourceChar);
+
+int
+AslPopInputFileStack (
+ void);
+
+void
+AslPushInputFileStack (
+ FILE *InputFile,
+ char *Filename);
+
+/* aslmain */
+
+void
+AslCompilerSignon (
+ UINT32 FileId);
+
+void
+AslCompilerFileHeader (
+ UINT32 FileId);
+
+void
+AslDoSourceOutputFile (
+ char *Buffer);
+
+#define ASL_DEBUG_OUTPUT 0
+#define ASL_PARSE_OUTPUT 1
+#define ASL_TREE_OUTPUT 2
+
+
+void
+DbgPrint (
+ UINT32 Type,
+ char *Format,
+ ...);
+
+void
+ErrorContext (void);
+
+/* aslcompile */
+
+int
+CmDoCompile (void);
+
+void
+CmDoOutputFiles (void);
+
+void
+CmCleanupAndExit (void);
+
+
+/* aslerror */
+
+void
+AslError (
+ UINT8 Level,
+ UINT8 MessageId,
+ ACPI_PARSE_OBJECT *Op,
+ char *ExtraMessage);
+
+void
+AslCoreSubsystemError (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS Status,
+ char *ExtraMessage,
+ BOOLEAN Abort);
+
+void
+AslCommonError (
+ UINT8 Level,
+ UINT8 MessageId,
+ UINT32 CurrentLineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+ char *ExtraMessage);
+
+void
+AePrintException (
+ UINT32 FileId,
+ ASL_ERROR_MSG *Enode,
+ char *Header);
+
+void
+AePrintErrorLog (
+ UINT32 FileId);
+
+ACPI_STATUS
+AeLocalGetRootPointer (
+ UINT32 Flags,
+ ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress);
+
+
+/* asllisting */
+
+void
+LsWriteListingHexBytes (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 FileId);
+
+void
+LsWriteNodeToListing (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 FileId);
+
+void
+LsWriteNodeToAsmListing (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+LsWriteNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 FileId);
+
+void
+LsFinishSourceListing (
+ UINT32 FileId);
+
+void
+LsFlushListingBuffer (
+ UINT32 FileId);
+
+void
+LsDoHexOutput (
+ void);
+
+void
+LsDoHexOutputC (
+ void);
+
+void
+LsDoHexOutputAsm (
+ void);
+
+void
+LsPushNode (
+ char *Filename);
+
+ASL_LISTING_NODE *
+LsPopNode (
+ void);
+
+
+/*
+ * aslopcodes - generate AML opcodes
+ */
+
+ACPI_STATUS
+OpcAmlOpcodeWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+OpcAmlConstantWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+void
+OpcGenerateAmlOpcode (
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+OpcSetOptimalIntegerSize (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpcGetIntegerWidth (
+ ACPI_PARSE_OBJECT *Op);
+
+/*
+ * asloperands - generate AML operands for the AML opcodes
+ */
+
+void
+OpnGenerateAmlOperands (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoField (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoBankField (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoBuffer (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoFieldCommon (
+ ACPI_PARSE_OBJECT *FieldOp,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoIndexField (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoLoadTable (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoMethod (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoPackage (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+OpnDoRegion (
+ ACPI_PARSE_OBJECT *Op);
+
+/*
+ * aslopt - optmization
+ */
+
+void
+OptOptimizeNamePath (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Flags,
+ ACPI_WALK_STATE *WalkState,
+ char *AmlNameString,
+ ACPI_NAMESPACE_NODE *TargetNode);
+
+
+/*
+ * aslresource - resource template generation
+ */
+
+void
+RsDoResourceTemplate (
+ ACPI_PARSE_OBJECT *Op);
+
+
+void
+CgGenerateAmlOutput (void);
+
+void
+CgGenerateListing (
+ UINT32 FileId);
+
+void
+LsDoListings (void);
+
+void
+CgGenerateAmlLengths (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+CgOpenOutputFile (
+ char *InputFilename);
+
+
+/* asllength */
+
+ACPI_STATUS
+LnPackageLengthWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+LnInitLengthsWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+ACPI_STATUS
+CgAmlWriteWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+void
+CgGenerateOutput(
+ void);
+
+void
+CgCloseTable (void);
+
+
+void
+CgWriteNode (
+ ACPI_PARSE_OBJECT *Op);
+
+/*
+ * aslmap
+ */
+
+ACPI_OBJECT_TYPE
+AslMapNamedOpcodeToDataType (
+ UINT16 Opcode);
+
+/*
+ * asltransform - parse tree transformations
+ */
+
+ACPI_STATUS
+TrAmlTransformWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+void
+TrTransformSubtree (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+TrDoSwitch (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+TrDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+TrDoElseif (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * asltree - parse tree support
+ */
+
+ACPI_STATUS
+TrWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Visitation,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context);
+
+ACPI_PARSE_OBJECT *
+TrAllocateNode (
+ UINT32 ParseOpcode);
+
+
+/* Values for "Visitation" parameter above */
+
+#define ASL_WALK_VISIT_DOWNWARD 0x01
+#define ASL_WALK_VISIT_UPWARD 0x02
+#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
+
+
+char *
+TrAddNode (
+ void *Thing);
+
+ACPI_PARSE_OBJECT *
+TrUpdateNode (
+ UINT32 ParseOpcode,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_PARSE_OBJECT *
+TrCreateNode (
+ UINT32 ParseOpcode,
+ UINT32 NumChildren,
+ ...);
+
+ACPI_PARSE_OBJECT *
+TrCreateLeafNode (
+ UINT32 ParseOpcode);
+
+ACPI_PARSE_OBJECT *
+TrCreateValuedLeafNode (
+ UINT32 ParseOpcode,
+ ACPI_INTEGER Value);
+
+ACPI_PARSE_OBJECT *
+TrLinkChildren (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 NumChildren,
+ ...);
+
+void
+TrSetEndLineNumber (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+TrWalkTree (void);
+
+ACPI_PARSE_OBJECT *
+TrLinkPeerNode (
+ ACPI_PARSE_OBJECT *Op1,
+ ACPI_PARSE_OBJECT *Op2);
+
+ACPI_PARSE_OBJECT *
+TrLinkChildNode (
+ ACPI_PARSE_OBJECT *Op1,
+ ACPI_PARSE_OBJECT *Op2);
+
+ACPI_PARSE_OBJECT *
+TrSetNodeFlags (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Flags);
+
+ACPI_PARSE_OBJECT *
+TrLinkPeerNodes (
+ UINT32 NumPeers,
+ ...);
+
+void
+TrReleaseNode (
+ ACPI_PARSE_OBJECT *Op);
+
+/* Analyze */
+
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnOperandTypecheckWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnOperandTypecheckWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnMethodAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnMethodAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnMethodTypingWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnMethodTypingWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*
+ * aslfiles - File I/O support
+ */
+
+void
+AslAbort (void);
+
+FILE *
+FlOpenLocalFile (
+ char *LocalName,
+ char *Mode);
+
+void
+FlOpenIncludeFile (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+FlFileError (
+ UINT32 FileId,
+ UINT8 ErrorId);
+
+void
+FlOpenFile (
+ UINT32 FileId,
+ char *Filename,
+ char *Mode);
+
+ACPI_STATUS
+FlReadFile (
+ UINT32 FileId,
+ void *Buffer,
+ UINT32 Length);
+
+void
+FlWriteFile (
+ UINT32 FileId,
+ void *Buffer,
+ UINT32 Length);
+
+void
+FlSeekFile (
+ UINT32 FileId,
+ long Offset);
+
+void
+FlCloseFile (
+ UINT32 FileId);
+
+void
+FlPrintFile (
+ UINT32 FileId,
+ char *Format,
+ ...);
+
+void
+FlSetLineNumber (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+FlParseInputPathname (
+ char *InputFilename);
+
+ACPI_STATUS
+FlOpenInputFile (
+ char *InputFilename);
+
+ACPI_STATUS
+FlOpenAmlOutputFile (
+ char *InputFilename);
+
+ACPI_STATUS
+FlOpenMiscOutputFiles (
+ char *InputFilename);
+
+void
+MpDisplayReservedNames (
+ void);
+
+
+/* Load */
+
+ACPI_STATUS
+LdLoadNamespace (
+ ACPI_PARSE_OBJECT *RootOp);
+
+
+ACPI_STATUS
+LdNamespace1Begin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+LdNamespace1End (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/* Lookup */
+
+ACPI_STATUS
+LkCrossReferenceNamespace (void);
+
+ACPI_STATUS
+LkNamespaceLocateBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+LkNamespaceLocateEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+LsDisplayNamespace (
+ void);
+
+ACPI_STATUS
+LsCompareOneNamespaceObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+
+/* Utils */
+
+void
+UtDisplayConstantOpcodes (
+ void);
+
+void
+UtBeginEvent (
+ UINT32 Event,
+ char *Name);
+
+void
+UtEndEvent (
+ UINT32 Event);
+
+void *
+UtLocalCalloc (
+ UINT32 Size);
+
+void
+UtPrintFormattedName (
+ UINT16 ParseOpcode,
+ UINT32 Level);
+
+void
+UtDisplaySummary (
+ UINT32 FileId);
+
+UINT8
+UtHexCharToValue (
+ int hc);
+
+void
+UtConvertByteToHex (
+ UINT8 RawByte,
+ UINT8 *Buffer);
+
+void
+UtConvertByteToAsmHex (
+ UINT8 RawByte,
+ UINT8 *Buffer);
+
+char *
+UtGetOpName (
+ UINT32 ParseOpcode);
+
+void
+UtSetParseOpName (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_PARSE_OBJECT *
+UtGetArg (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Argn);
+
+char *
+UtGetStringBuffer (
+ UINT32 Length);
+
+ACPI_STATUS
+UtInternalizeName (
+ char *ExternalName,
+ char **ConvertedName);
+
+void
+UtAttachNamepathToOwner (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *NameNode);
+
+ACPI_PARSE_OBJECT *
+UtCheckIntegerRange (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 LowValue,
+ UINT32 HighValue);
+
+ACPI_STATUS
+UtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger);
+
+ACPI_INTEGER
+UtDoConstant (
+ char *String);
+
+
+/* Find */
+
+void
+LnAdjustLengthToRoot (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 LengthDelta);
+
+
+#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b))
+
+#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC))
+
+
+/*
+ * Resource utilities
+ */
+
+ASL_RESOURCE_NODE *
+RsAllocateResourceNode (
+ UINT32 Size);
+
+ void
+RsCreateBitField (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name,
+ UINT32 ByteOffset,
+ UINT32 BitOffset);
+
+void
+RsCreateByteField (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name,
+ UINT32 ByteOffset);
+
+void
+RsSetFlagBits (
+ UINT8 *Flags,
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 Position,
+ UINT8 DefaultBit);
+
+ACPI_PARSE_OBJECT *
+RsCompleteNodeAndGetNext (
+ ACPI_PARSE_OBJECT *Op);
+
+ASL_RESOURCE_NODE *
+RsDoOneResourceDescriptor (
+ ACPI_PARSE_OBJECT *DescriptorTypeOp,
+ UINT32 CurrentByteOffset,
+ UINT8 *State);
+
+#define ACPI_RSTATE_NORMAL 0
+#define ACPI_RSTATE_START_DEPENDENT 1
+#define ACPI_RSTATE_DEPENDENT_LIST 2
+
+UINT32
+RsLinkDescriptorChain (
+ ASL_RESOURCE_NODE **PreviousRnode,
+ ASL_RESOURCE_NODE *Rnode);
+
+
+/*
+ * Small descriptors
+ */
+
+ASL_RESOURCE_NODE *
+RsDoDmaDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoEndDependentDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoFixedIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoInterruptDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoIrqDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoIrqNoFlagsDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoMemory24Descriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoMemory32Descriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoMemory32FixedDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoStartDependentDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoStartDependentNoPriDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoVendorSmallDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+
+/*
+ * Large descriptors
+ */
+
+UINT32
+RsGetStringDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp);
+
+ASL_RESOURCE_NODE *
+RsDoDwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoDwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoQwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoQwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoWordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoWordBusNumberDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoVendorLargeDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoGeneralRegisterDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+
+#endif /* __ASLCOMPILER_H */
+
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l
new file mode 100644
index 0000000..a7598e6
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l
@@ -0,0 +1,1153 @@
+
+%{
+/******************************************************************************
+ *
+ * Module Name: aslcompiler.l - Flex input file
+ * $Revision: $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+YYSTYPE AslCompilerlval;
+
+/*
+ * Generation: Use the following command line:
+ *
+ * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath)
+ *
+ * -i: Scanner must be case-insensitive
+ */
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslscan")
+char
+comment (void);
+char
+comment2 (void);
+void
+count (int type);
+char
+literal (void);
+void
+copy (void);
+
+/*! [Begin] no source code translation */
+
+%}
+
+
+LeadNameChar [A-Za-z_]
+DigitChar [0-9]
+HexDigitChar [A-Fa-f0-9]
+RootChar [\\]
+Nothing []
+
+NameChar [A-Za-z_0-9]
+NameSeg1 {LeadNameChar}{NameChar}
+NameSeg2 {LeadNameChar}{NameChar}{NameChar}
+NameSeg3 {LeadNameChar}{NameChar}{NameChar}{NameChar}
+NameSeg {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3}
+
+NameString {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath}
+NamePath {NonEmptyNamePath}?
+NonEmptyNamePath {NameSeg}{NamePathTail}*
+NamePathTail [.]{NameSeg}
+
+%%
+
+[ ] { count (0); }
+[\n] { count (0); }
+[ \t] { count (0); }
+
+
+"/*" { if (!comment ()) yyterminate (); }
+"//" { if (!comment2 ()) yyterminate (); }
+
+"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
+
+
+0[xX]{HexDigitChar}+ |
+{DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);
+ count (1); return (PARSEOP_INTEGER); }
+
+"Include" { count (1); return (PARSEOP_INCLUDE); }
+"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); }
+"#line" { count (1); return (PARSEOP_LINE_CSTYLE); }
+"External" { count (1); return (PARSEOP_EXTERNAL); }
+
+
+"Ones" { count (1); return (PARSEOP_ONES); }
+"One" { count (1); return (PARSEOP_ONE); }
+"Zero" { count (1); return (PARSEOP_ZERO); }
+"Revision" { count (1); return (PARSEOP_REVISION); }
+
+"Offset" { count (1); return (PARSEOP_OFFSET); }
+"AccessAs" { count (1); return (PARSEOP_ACCESSAS); }
+"BankField" { count (2); return (PARSEOP_BANKFIELD); }
+"CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); }
+"CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); }
+"CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); }
+"CreateField" { count (2); return (PARSEOP_CREATEFIELD); }
+"CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); }
+"CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); }
+"DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); }
+"Device" { count (2); return (PARSEOP_DEVICE); }
+"Event" { count (2); return (PARSEOP_EVENT); }
+"Field" { count (2); return (PARSEOP_FIELD); }
+"IndexField" { count (2); return (PARSEOP_INDEXFIELD); }
+"Method" { count (2); return (PARSEOP_METHOD); }
+"Mutex" { count (2); return (PARSEOP_MUTEX); }
+"OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); }
+"PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); }
+"Processor" { count (2); return (PARSEOP_PROCESSOR); }
+"ThermalZone" { count (2); return (PARSEOP_THERMALZONE); }
+"Alias" { count (2); return (PARSEOP_ALIAS); }
+"Name" { count (2); return (PARSEOP_NAME); }
+"Scope" { count (2); return (PARSEOP_SCOPE); }
+"Break" { count (3); return (PARSEOP_BREAK); }
+"BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); }
+"Continue" { count (3); return (PARSEOP_CONTINUE); }
+"Fatal" { count (3); return (PARSEOP_FATAL); }
+"If" { count (3); return (PARSEOP_IF); }
+"Else" { count (3); return (PARSEOP_ELSE); }
+"ElseIf" { count (3); return (PARSEOP_ELSEIF); }
+"Load" { count (3); return (PARSEOP_LOAD); }
+"Noop" { count (3); return (PARSEOP_NOOP); }
+"Notify" { count (3); return (PARSEOP_NOTIFY); }
+"Release" { count (3); return (PARSEOP_RELEASE); }
+"Reset" { count (3); return (PARSEOP_RESET); }
+"Return" { count (3); return (PARSEOP_RETURN); }
+"Signal" { count (3); return (PARSEOP_SIGNAL); }
+"Sleep" { count (3); return (PARSEOP_SLEEP); }
+"Stall" { count (3); return (PARSEOP_STALL); }
+"Switch" { count (3); return (PARSEOP_SWITCH); }
+"Case" { count (3); return (PARSEOP_CASE); }
+"Default" { count (3); return (PARSEOP_DEFAULT); }
+"Unload" { count (3); return (PARSEOP_UNLOAD); }
+"While" { count (3); return (PARSEOP_WHILE); }
+
+"Acquire" { count (3); return (PARSEOP_ACQUIRE); }
+"Add" { count (3); return (PARSEOP_ADD); }
+"And" { count (3); return (PARSEOP_AND); }
+"Concatenate" { count (3); return (PARSEOP_CONCATENATE); }
+"ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); }
+"CondRefOf" { count (3); return (PARSEOP_CONDREFOF); }
+"CopyObject" { count (3); return (PARSEOP_COPYOBJECT); }
+"Decrement" { count (3); return (PARSEOP_DECREMENT); }
+"DeRefOf" { count (3); return (PARSEOP_DEREFOF); }
+"Divide" { count (3); return (PARSEOP_DIVIDE); }
+"FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); }
+"FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); }
+"FromBCD" { count (3); return (PARSEOP_FROMBCD); }
+"Increment" { count (3); return (PARSEOP_INCREMENT); }
+"Index" { count (3); return (PARSEOP_INDEX); }
+"LAnd" { count (3); return (PARSEOP_LAND); }
+"LEqual" { count (3); return (PARSEOP_LEQUAL); }
+"LGreater" { count (3); return (PARSEOP_LGREATER); }
+"LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); }
+"LLess" { count (3); return (PARSEOP_LLESS); }
+"LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); }
+"LNot" { count (3); return (PARSEOP_LNOT); }
+"LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); }
+"LoadTable" { count (3); return (PARSEOP_LOADTABLE); }
+"LOr" { count (3); return (PARSEOP_LOR); }
+"Match" { count (3); return (PARSEOP_MATCH); }
+"Mid" { count (3); return (PARSEOP_MID); }
+"Mod" { count (3); return (PARSEOP_MOD); }
+"Multiply" { count (3); return (PARSEOP_MULTIPLY); }
+"NAnd" { count (3); return (PARSEOP_NAND); }
+"NOr" { count (3); return (PARSEOP_NOR); }
+"Not" { count (3); return (PARSEOP_NOT); }
+"ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); }
+"Or" { count (3); return (PARSEOP_OR); }
+"RefOf" { count (3); return (PARSEOP_REFOF); }
+"ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); }
+"ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); }
+"SizeOf" { count (3); return (PARSEOP_SIZEOF); }
+"Store" { count (3); return (PARSEOP_STORE); }
+"Subtract" { count (3); return (PARSEOP_SUBTRACT); }
+"ToBCD" { count (3); return (PARSEOP_TOBCD); }
+"ToBuffer" { count (3); return (PARSEOP_TOBUFFER); }
+"ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); }
+"ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); }
+"ToInteger" { count (3); return (PARSEOP_TOINTEGER); }
+"ToString" { count (3); return (PARSEOP_TOSTRING); }
+"Wait" { count (3); return (PARSEOP_WAIT); }
+"XOr" { count (3); return (PARSEOP_XOR); }
+
+"Arg0" { count (1); return (PARSEOP_ARG0); }
+"Arg1" { count (1); return (PARSEOP_ARG1); }
+"Arg2" { count (1); return (PARSEOP_ARG2); }
+"Arg3" { count (1); return (PARSEOP_ARG3); }
+"Arg4" { count (1); return (PARSEOP_ARG4); }
+"Arg5" { count (1); return (PARSEOP_ARG5); }
+"Arg6" { count (1); return (PARSEOP_ARG6); }
+
+"Local0" { count (1); return (PARSEOP_LOCAL0); }
+"Local1" { count (1); return (PARSEOP_LOCAL1); }
+"Local2" { count (1); return (PARSEOP_LOCAL2); }
+"Local3" { count (1); return (PARSEOP_LOCAL3); }
+"Local4" { count (1); return (PARSEOP_LOCAL4); }
+"Local5" { count (1); return (PARSEOP_LOCAL5); }
+"Local6" { count (1); return (PARSEOP_LOCAL6); }
+"Local7" { count (1); return (PARSEOP_LOCAL7); }
+
+"Debug" { count (1); return (PARSEOP_DEBUG); }
+
+"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); }
+"Buffer" { count (1); return (PARSEOP_BUFFER); }
+"Package" { count (1); return (PARSEOP_PACKAGE); }
+
+"EISAID" { count (1); return (PARSEOP_EISAID); }
+"ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); }
+"Unicode" { count (1); return (PARSEOP_UNICODE); }
+"DMA" { count (1); return (PARSEOP_DMA); }
+"DWordIO" { count (1); return (PARSEOP_DWORDIO); }
+"DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); }
+"EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); }
+"FixedIO" { count (1); return (PARSEOP_FIXEDIO); }
+"Interrupt" { count (1); return (PARSEOP_INTERRUPT); }
+"IO" { count (1); return (PARSEOP_IO); }
+"IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); }
+"IRQ" { count (1); return (PARSEOP_IRQ); }
+"Memory24" { count (1); return (PARSEOP_MEMORY24); }
+"Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); }
+"Memory32" { count (1); return (PARSEOP_MEMORY32); }
+"QWordIO" { count (1); return (PARSEOP_QWORDIO); }
+"QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); }
+"Register" { count (1); return (PARSEOP_REGISTER); }
+"StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); }
+"StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
+"VendorLong" { count (1); return (PARSEOP_VENDORLONG); }
+"VendorShort" { count (1); return (PARSEOP_VENDORSHORT); }
+"WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); }
+"WordIO" { count (1); return (PARSEOP_WORDIO); }
+
+"UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
+"IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); }
+"StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); }
+"BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); }
+"PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); }
+"FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); }
+"DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); }
+"EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); }
+"MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); }
+"MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
+"OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
+"PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); }
+"ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
+"BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
+"DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
+
+"AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); }
+"ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); }
+"WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); }
+"DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); }
+"QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); }
+"BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); }
+
+"Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); }
+"NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); }
+
+"Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); }
+"WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); }
+"WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); }
+
+"Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); }
+"NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); }
+
+"SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); }
+"SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); }
+"PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); }
+"EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); }
+"SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
+"SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
+"PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
+
+"FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); }
+
+"SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
+"SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
+"SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
+"SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
+"SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
+"SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
+"SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
+
+"MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); }
+"MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); }
+"MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); }
+"MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); }
+"MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); }
+"MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); }
+
+"Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); }
+"TypeA" { count (0); return (PARSEOP_DMATYPE_A); }
+"TypeB" { count (0); return (PARSEOP_DMATYPE_B); }
+"TypeF" { count (0); return (PARSEOP_DMATYPE_F); }
+
+"BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); }
+"NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); }
+
+"Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); }
+"Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); }
+"Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); }
+
+"ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); }
+"ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); }
+
+"MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); }
+"MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); }
+
+"MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); }
+"MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); }
+
+"PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); }
+"SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); }
+
+"ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); }
+"NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); }
+"EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); }
+
+"Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); }
+"WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); }
+"Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); }
+"NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); }
+
+"ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); }
+"ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); }
+
+"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); }
+"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); }
+
+"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
+"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
+
+"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); }
+"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
+
+"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); }
+"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); }
+
+"TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); }
+"TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); }
+
+"SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); }
+"DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); }
+
+"AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); }
+"AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); }
+"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
+"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
+
+
+"{" { count (0); return('{'); }
+"}" { count (0); return('}'); }
+"," { count (0); return(','); }
+"(" { count (0); return('('); }
+")" { count (0); return(')'); }
+
+
+{NameSeg} { char *s;
+ count (0);
+ s=malloc (ACPI_NAME_SIZE + 1);
+ if (strcmp (AslCompilertext, "\\"))
+ {
+ strcpy (s, "____");
+ ACPI_STRUPR (AslCompilertext);
+ }
+ memcpy (s, AslCompilertext, strlen (AslCompilertext));
+ AslCompilerlval.s = s;
+ DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s);
+ return (PARSEOP_NAMESEG); }
+
+{NameString} { char *s;
+ count (0);
+ s=malloc (strlen (AslCompilertext)+1);
+ ACPI_STRUPR (AslCompilertext);
+ strcpy (s, AslCompilertext);
+ s[strlen (AslCompilertext)] = 0;
+ AslCompilerlval.s = s;
+ DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
+ return (PARSEOP_NAMESTRING); }
+
+"*" |
+"/" { count (1);
+ AslCompilererror ("Parse error, expecting ASL keyword or name");}
+
+. { count (1);
+ sprintf (MsgBuffer,
+ "Invalid character (0x%2.2X), expecting ASL keyword or name",
+ *AslCompilertext);
+ AslCompilererror (MsgBuffer);}
+
+<<EOF>> { if (AslPopInputFileStack ())
+ yyterminate();
+ else
+ return (PARSEOP_INCLUDE_END);};
+
+%%
+
+/*! [End] no source code translation !*/
+
+typedef struct asl_file_node
+{
+ FILE *File;
+ UINT32 CurrentLineNumber;
+ YY_BUFFER_STATE State;
+ char *Filename;
+ struct asl_file_node *Next;
+
+} ASL_FILE_NODE;
+
+ASL_FILE_NODE *InputStack = NULL;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPopInputFileStack
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: 0 if a node was popped, -1 otherwise
+ *
+ * DESCRIPTION: Pop the top of the input file stack and point the parser to
+ * the saved parse buffer contained in the fnode. Also, set the
+ * global line counters to the saved values. This function is
+ * called when an include file reaches EOF.
+ *
+ ******************************************************************************/
+
+int
+AslPopInputFileStack (
+ void)
+{
+ ASL_FILE_NODE *Fnode;
+ FILE *InputFile = NULL;
+
+
+ Fnode = InputStack;
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
+
+
+ if (!Fnode)
+ {
+ return -1;
+ }
+
+ /* Close the current include file */
+
+ fclose (yyin);
+
+ /* Update the top-of-stack */
+
+ InputStack = Fnode->Next;
+ InputFile = Fnode->File;
+
+ /* Reset global line counter and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
+ Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
+
+ /* Point the parser to the popped file */
+
+ yy_delete_buffer (YY_CURRENT_BUFFER);
+ yy_switch_to_buffer (Fnode->State);
+
+ /* All done with this node */
+
+ ACPI_MEM_FREE (Fnode);
+ return 0;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPushInputFileStack
+ *
+ * PARAMETERS: InputFile - Open file pointer
+ * Filename - Name of the file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
+ * to this file. Called when an include file is successfully
+ * opened.
+ *
+ ******************************************************************************/
+
+void
+AslPushInputFileStack (
+ FILE *InputFile,
+ char *Filename)
+{
+ ASL_FILE_NODE *Fnode;
+ YY_BUFFER_STATE State;
+
+
+ /* Save the current state in an Fnode */
+
+ Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
+
+ Fnode->File = yyin;
+ Fnode->Next = InputStack;
+ Fnode->State = YY_CURRENT_BUFFER;
+ Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
+ Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
+
+ /* Push it on the stack */
+
+ InputStack = Fnode;
+
+ /* Point the parser to this file */
+
+ State = yy_create_buffer (InputFile, YY_BUF_SIZE);
+ yy_switch_to_buffer (State);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
+
+ /* Reset the global line count and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
+ Gbl_CurrentLineNumber = 1;
+ yyin = InputFile;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ResetCurrentLineBuffer
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
+ *
+ ******************************************************************************/
+
+void
+ResetCurrentLineBuffer (
+ void)
+{
+
+ if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
+ {
+ FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
+ Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
+ }
+
+ Gbl_CurrentLineOffset += Gbl_CurrentColumn;
+ Gbl_CurrentColumn = 0;
+
+ Gbl_CurrentLineNumber++;
+ Gbl_LogicalLineNumber++;
+ Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: InsertLineBuffer
+ *
+ * PARAMETERS: SourceChar - One char from the input ASL source file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Put one character of the source file into the temp line buffer
+ *
+ ******************************************************************************/
+
+#define ASL_SPACES_PER_TAB 4
+
+void
+InsertLineBuffer (
+ int SourceChar)
+{
+ UINT32 i;
+ UINT32 Count = 1;
+
+
+ if (SourceChar == EOF)
+ {
+ return;
+ }
+
+ Gbl_InputByteCount++;
+
+ /* Handle tabs. Convert to spaces */
+
+ if (SourceChar == '\t')
+ {
+ SourceChar = ' ';
+ Count = ASL_SPACES_PER_TAB -
+ (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
+ }
+
+
+ for (i = 0; i < Count; i++)
+ {
+ Gbl_CurrentColumn++;
+
+ /* Insert the character into the line buffer */
+
+ *Gbl_LineBufPtr = (UINT8) SourceChar;
+ Gbl_LineBufPtr++;
+
+ if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
+ {
+#if 0
+ /*
+ * Warning if we have split a long source line.
+ * <Probably overkill>
+ */
+ sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE);
+ AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
+#endif
+
+ ResetCurrentLineBuffer ();
+ }
+ else if (SourceChar == '\n')
+ {
+ /* End of line */
+
+ ResetCurrentLineBuffer ();
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: count
+ *
+ * PARAMETERS: yytext - Contains the matched keyword.
+ * Type - Keyword/Character type:
+ * 0 = anything except a keyword
+ * 1 = pseudo-keywords
+ * 2 = non-executable ASL keywords
+ * 3 = executable ASL keywords
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Count keywords and put them into the line buffer
+ *
+ ******************************************************************************/
+
+void
+count (
+ int Type)
+{
+ int i;
+
+
+ switch (Type)
+ {
+ case 2:
+ TotalKeywords++;
+ TotalNamedObjects++;
+ break;
+
+ case 3:
+ TotalKeywords++;
+ TotalExecutableOpcodes++;
+ break;
+ }
+
+ for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
+ {
+ InsertLineBuffer (yytext[i]);
+ *Gbl_LineBufPtr = 0;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: comment
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a standard comment.
+ *
+ ******************************************************************************/
+
+char
+comment (void)
+{
+ char c;
+ char c1 = 0;
+
+
+ InsertLineBuffer ('/');
+ InsertLineBuffer ('*');
+
+loop:
+
+ /* Eat chars until end-of-comment */
+
+ while ((c = (char) input()) != '*' && c != EOF)
+ {
+ InsertLineBuffer (c);
+ c1 = c;
+ }
+
+ if (c == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ /*
+ * Check for nested comment -- can help catch cases where a previous
+ * comment was accidently left unterminated
+ */
+ if ((c1 == '/') && (c == '*'))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+
+ /* Comment is closed only if the NEXT character is a slash */
+
+ InsertLineBuffer (c);
+
+ if ((c1 = (char) input()) != '/' && c1 != EOF)
+ {
+ unput(c1);
+ goto loop;
+ }
+
+ if (c1 == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ InsertLineBuffer (c1);
+ return TRUE;
+
+
+EarlyEOF:
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: comment
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a new "//" comment.
+ *
+ ******************************************************************************/
+
+char
+comment2 (void)
+{
+ char c;
+
+
+ InsertLineBuffer ('/');
+ InsertLineBuffer ('/');
+
+ while ((c = (char) input()) != '\n' && c != EOF)
+ {
+ InsertLineBuffer (c);
+ }
+
+ if (c == EOF)
+ {
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+ }
+
+ InsertLineBuffer (c);
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: literal
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a string literal (surrounded by quotes)
+ *
+ ******************************************************************************/
+
+#define ASL_NORMAL_CHAR 0
+#define ASL_ESCAPE_SEQUENCE 1
+#define ASL_OCTAL_CONSTANT 2
+#define ASL_HEX_CONSTANT 3
+
+char
+literal (void)
+{
+ char *s = MsgBuffer;
+ char *CleanString;
+ char StringChar;
+ UINT32 State = ASL_NORMAL_CHAR;
+ UINT32 i = 0;
+ UINT8 Digit;
+ char ConvertBuffer[4];
+
+
+ /*
+ * Eat chars until end-of-literal.
+ * NOTE: Put back the original surrounding quotes into the
+ * source line buffer.
+ */
+ InsertLineBuffer ('\"');
+ while ((StringChar = (char) input()) != EOF)
+ {
+ InsertLineBuffer (StringChar);
+
+DoCharacter:
+
+ switch (State)
+ {
+ case ASL_NORMAL_CHAR:
+
+ switch (StringChar)
+ {
+ case '\\':
+ /*
+ * Special handling for backslash-escape sequence. We will
+ * toss the backslash and translate the escape char(s).
+ */
+ State = ASL_ESCAPE_SEQUENCE;
+ continue;
+
+ case '\"':
+
+ /* String terminator */
+
+ goto CompletedString;
+ }
+ break;
+
+
+ case ASL_ESCAPE_SEQUENCE:
+
+ State = ASL_NORMAL_CHAR;
+ switch (StringChar)
+ {
+ case 'a':
+ StringChar = 0x07; /* BELL */
+ break;
+
+ case 'b':
+ StringChar = 0x08; /* BACKSPACE */
+ break;
+
+ case 'f':
+ StringChar = 0x0C; /* FORMFEED */
+ break;
+
+ case 'n':
+ StringChar = 0x0A; /* LINEFEED */
+ break;
+
+ case 'r':
+ StringChar = 0x0D; /* CARRIAGE RETURN*/
+ break;
+
+ case 't':
+ StringChar = 0x09; /* HORIZONTAL TAB */
+ break;
+
+ case 'v':
+ StringChar = 0x0B; /* VERTICAL TAB */
+ break;
+
+ case 'x':
+ State = ASL_HEX_CONSTANT;
+ i = 0;
+ continue;
+
+ case '\'': /* Single Quote */
+ case '\"': /* Double Quote */
+ case '\\': /* Backslash */
+ break;
+
+ default:
+
+ /* Check for an octal digit (0-7) */
+
+ if (ACPI_IS_OCTAL_DIGIT (StringChar))
+ {
+ State = ASL_OCTAL_CONSTANT;
+ ConvertBuffer[0] = StringChar;
+ i = 1;
+ continue;
+ }
+
+ /* Unknown escape sequence issue warning, but use the character */
+
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ break;
+ }
+ break;
+
+
+ case ASL_OCTAL_CONSTANT:
+
+ /* Up to three octal digits allowed */
+
+ if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
+ (i > 2))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *s = (char) Digit;
+ s++;
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+
+
+ case ASL_HEX_CONSTANT:
+
+ /* Up to two hex digits allowed */
+
+ if (!ACPI_IS_XDIGIT (StringChar) ||
+ (i > 1))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *s = (char) Digit;
+ s++;
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+ }
+
+ /* Save the finished character */
+
+ *s = StringChar;
+ s++;
+ }
+
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+
+
+CompletedString:
+ /*
+ * Null terminate the input string and copy string to a new buffer
+ */
+ *s = 0;
+
+ CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
+ if (!CleanString)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+ }
+
+ ACPI_STRCPY (CleanString, MsgBuffer);
+ AslCompilerlval.s = CleanString;
+ return (TRUE);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y
new file mode 100644
index 0000000..307e876
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -0,0 +1,2902 @@
+
+%{
+/******************************************************************************
+ *
+ * Module Name: aslcompiler.y - Bison input file (ASL grammar and actions)
+ * $Revision: $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define YYDEBUG 1
+#define YYERROR_VERBOSE 1
+
+/*
+ * State stack - compiler will fault if it overflows. (Default was 200)
+ */
+#define YYINITDEPTH 600
+
+#include "aslcompiler.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "acpi.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslparse")
+
+
+/*
+ * Next statement is important - this makes everything public so that
+ * we can access some of the parser tables from other modules
+ */
+#define static
+#undef alloca
+#define alloca AslLocalAllocate
+#define YYERROR_VERBOSE 1
+
+void *
+AslLocalAllocate (unsigned int Size);
+
+/*
+ * The windows version of bison defines this incorrectly as "32768" (Not negative).
+ * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
+ * instead (#define YYFBAD 32768), so we can define it correctly here.
+ *
+ * The problem is that if YYFLAG is positive, the extended syntax error messages
+ * are disabled.
+ */
+
+#define YYFLAG -32768
+
+
+%}
+
+
+/*
+ * Declare the type of values in the grammar
+ */
+
+%union {
+ UINT64 i;
+ char *s;
+ ACPI_PARSE_OBJECT *n;
+}
+
+
+/*! [Begin] no source code translation */
+
+
+/*
+ * Token types: These are returned by the lexer
+ */
+
+%token <i> PARSEOP_ACCESSAS
+%token <i> PARSEOP_ACCESSATTRIB_BLOCK
+%token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
+%token <i> PARSEOP_ACCESSATTRIB_BYTE
+%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL
+%token <i> PARSEOP_ACCESSATTRIB_QUICK
+%token <i> PARSEOP_ACCESSATTRIB_SND_RCV
+%token <i> PARSEOP_ACCESSATTRIB_WORD
+%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL
+%token <i> PARSEOP_ACCESSTYPE_ANY
+%token <i> PARSEOP_ACCESSTYPE_BUF
+%token <i> PARSEOP_ACCESSTYPE_BYTE
+%token <i> PARSEOP_ACCESSTYPE_DWORD
+%token <i> PARSEOP_ACCESSTYPE_QWORD
+%token <i> PARSEOP_ACCESSTYPE_WORD
+%token <i> PARSEOP_ACQUIRE
+%token <i> PARSEOP_ADD
+%token <i> PARSEOP_ADDRESSSPACE_FFIXEDHW
+%token <i> PARSEOP_ADDRESSTYPE_ACPI
+%token <i> PARSEOP_ADDRESSTYPE_MEMORY
+%token <i> PARSEOP_ADDRESSTYPE_NVS
+%token <i> PARSEOP_ADDRESSTYPE_RESERVED
+%token <i> PARSEOP_ALIAS
+%token <i> PARSEOP_AND
+%token <i> PARSEOP_ARG0
+%token <i> PARSEOP_ARG1
+%token <i> PARSEOP_ARG2
+%token <i> PARSEOP_ARG3
+%token <i> PARSEOP_ARG4
+%token <i> PARSEOP_ARG5
+%token <i> PARSEOP_ARG6
+%token <i> PARSEOP_BANKFIELD
+%token <i> PARSEOP_BREAK
+%token <i> PARSEOP_BREAKPOINT
+%token <i> PARSEOP_BUFFER
+%token <i> PARSEOP_BUSMASTERTYPE_MASTER
+%token <i> PARSEOP_BUSMASTERTYPE_NOTMASTER
+%token <i> PARSEOP_BYTECONST
+%token <i> PARSEOP_CASE
+%token <i> PARSEOP_CONCATENATE
+%token <i> PARSEOP_CONCATENATERESTEMPLATE
+%token <i> PARSEOP_CONDREFOF
+%token <i> PARSEOP_CONTINUE
+%token <i> PARSEOP_COPYOBJECT
+%token <i> PARSEOP_CREATEBITFIELD
+%token <i> PARSEOP_CREATEBYTEFIELD
+%token <i> PARSEOP_CREATEDWORDFIELD
+%token <i> PARSEOP_CREATEFIELD
+%token <i> PARSEOP_CREATEQWORDFIELD
+%token <i> PARSEOP_CREATEWORDFIELD
+%token <i> PARSEOP_DATATABLEREGION
+%token <i> PARSEOP_DEBUG
+%token <i> PARSEOP_DECODETYPE_POS
+%token <i> PARSEOP_DECODETYPE_SUB
+%token <i> PARSEOP_DECREMENT
+%token <i> PARSEOP_DEFAULT
+%token <i> PARSEOP_DEFAULT_ARG
+%token <i> PARSEOP_DEFINITIONBLOCK
+%token <i> PARSEOP_DEREFOF
+%token <i> PARSEOP_DEVICE
+%token <i> PARSEOP_DIVIDE
+%token <i> PARSEOP_DMA
+%token <i> PARSEOP_DMATYPE_A
+%token <i> PARSEOP_DMATYPE_COMPATIBILITY
+%token <i> PARSEOP_DMATYPE_B
+%token <i> PARSEOP_DMATYPE_F
+%token <i> PARSEOP_DWORDCONST
+%token <i> PARSEOP_DWORDIO
+%token <i> PARSEOP_DWORDMEMORY
+%token <i> PARSEOP_EISAID
+%token <i> PARSEOP_ELSE
+%token <i> PARSEOP_ELSEIF
+%token <i> PARSEOP_ENDDEPENDENTFN
+%token <i> PARSEOP_ERRORNODE
+%token <i> PARSEOP_EVENT
+%token <i> PARSEOP_EXTERNAL
+%token <i> PARSEOP_FATAL
+%token <i> PARSEOP_FIELD
+%token <i> PARSEOP_FINDSETLEFTBIT
+%token <i> PARSEOP_FINDSETRIGHTBIT
+%token <i> PARSEOP_FIXEDIO
+%token <i> PARSEOP_FROMBCD
+%token <i> PARSEOP_IF
+%token <i> PARSEOP_INCLUDE
+%token <i> PARSEOP_INCLUDE_CSTYLE
+%token <i> PARSEOP_INCLUDE_END
+%token <i> PARSEOP_INCREMENT
+%token <i> PARSEOP_INDEX
+%token <i> PARSEOP_INDEXFIELD
+%token <i> PARSEOP_INTEGER
+%token <i> PARSEOP_INTERRUPT
+%token <i> PARSEOP_INTLEVEL_ACTIVEHIGH
+%token <i> PARSEOP_INTLEVEL_ACTIVELOW
+%token <i> PARSEOP_INTTYPE_EDGE
+%token <i> PARSEOP_INTTYPE_LEVEL
+%token <i> PARSEOP_IO
+%token <i> PARSEOP_IODECODETYPE_10
+%token <i> PARSEOP_IODECODETYPE_16
+%token <i> PARSEOP_IRQ
+%token <i> PARSEOP_IRQNOFLAGS
+%token <i> PARSEOP_LAND
+%token <i> PARSEOP_LEQUAL
+%token <i> PARSEOP_LGREATER
+%token <i> PARSEOP_LGREATEREQUAL
+%token <i> PARSEOP_LINE_CSTYLE
+%token <i> PARSEOP_LLESS
+%token <i> PARSEOP_LLESSEQUAL
+%token <i> PARSEOP_LNOT
+%token <i> PARSEOP_LNOTEQUAL
+%token <i> PARSEOP_LOAD
+%token <i> PARSEOP_LOADTABLE
+%token <i> PARSEOP_LOCAL0
+%token <i> PARSEOP_LOCAL1
+%token <i> PARSEOP_LOCAL2
+%token <i> PARSEOP_LOCAL3
+%token <i> PARSEOP_LOCAL4
+%token <i> PARSEOP_LOCAL5
+%token <i> PARSEOP_LOCAL6
+%token <i> PARSEOP_LOCAL7
+%token <i> PARSEOP_LOCKRULE_LOCK
+%token <i> PARSEOP_LOCKRULE_NOLOCK
+%token <i> PARSEOP_LOR
+%token <i> PARSEOP_MATCH
+%token <i> PARSEOP_MATCHTYPE_MEQ
+%token <i> PARSEOP_MATCHTYPE_MGE
+%token <i> PARSEOP_MATCHTYPE_MGT
+%token <i> PARSEOP_MATCHTYPE_MLE
+%token <i> PARSEOP_MATCHTYPE_MLT
+%token <i> PARSEOP_MATCHTYPE_MTR
+%token <i> PARSEOP_MAXTYPE_FIXED
+%token <i> PARSEOP_MAXTYPE_NOTFIXED
+%token <i> PARSEOP_MEMORY24
+%token <i> PARSEOP_MEMORY32
+%token <i> PARSEOP_MEMORY32FIXED
+%token <i> PARSEOP_MEMTYPE_CACHEABLE
+%token <i> PARSEOP_MEMTYPE_NONCACHEABLE
+%token <i> PARSEOP_MEMTYPE_PREFETCHABLE
+%token <i> PARSEOP_MEMTYPE_WRITECOMBINING
+%token <i> PARSEOP_METHOD
+%token <i> PARSEOP_METHODCALL
+%token <i> PARSEOP_MID
+%token <i> PARSEOP_MINTYPE_FIXED
+%token <i> PARSEOP_MINTYPE_NOTFIXED
+%token <i> PARSEOP_MOD
+%token <i> PARSEOP_MULTIPLY
+%token <i> PARSEOP_MUTEX
+%token <i> PARSEOP_NAME
+%token <s> PARSEOP_NAMESEG
+%token <s> PARSEOP_NAMESTRING
+%token <i> PARSEOP_NAND
+%token <i> PARSEOP_NOOP
+%token <i> PARSEOP_NOR
+%token <i> PARSEOP_NOT
+%token <i> PARSEOP_NOTIFY
+%token <i> PARSEOP_OBJECTTYPE
+%token <i> PARSEOP_OBJECTTYPE_BFF
+%token <i> PARSEOP_OBJECTTYPE_BUF
+%token <i> PARSEOP_OBJECTTYPE_DDB
+%token <i> PARSEOP_OBJECTTYPE_DEV
+%token <i> PARSEOP_OBJECTTYPE_EVT
+%token <i> PARSEOP_OBJECTTYPE_FLD
+%token <i> PARSEOP_OBJECTTYPE_INT
+%token <i> PARSEOP_OBJECTTYPE_MTH
+%token <i> PARSEOP_OBJECTTYPE_MTX
+%token <i> PARSEOP_OBJECTTYPE_OPR
+%token <i> PARSEOP_OBJECTTYPE_PKG
+%token <i> PARSEOP_OBJECTTYPE_POW
+%token <i> PARSEOP_OBJECTTYPE_STR
+%token <i> PARSEOP_OBJECTTYPE_THZ
+%token <i> PARSEOP_OBJECTTYPE_UNK
+%token <i> PARSEOP_OFFSET
+%token <i> PARSEOP_ONE
+%token <i> PARSEOP_ONES
+%token <i> PARSEOP_OPERATIONREGION
+%token <i> PARSEOP_OR
+%token <i> PARSEOP_PACKAGE
+%token <i> PARSEOP_PACKAGE_LENGTH
+%token <i> PARSEOP_POWERRESOURCE
+%token <i> PARSEOP_PROCESSOR
+%token <i> PARSEOP_QWORDCONST
+%token <i> PARSEOP_QWORDIO
+%token <i> PARSEOP_QWORDMEMORY
+%token <i> PARSEOP_RANGETYPE_ENTIRE
+%token <i> PARSEOP_RANGETYPE_ISAONLY
+%token <i> PARSEOP_RANGETYPE_NONISAONLY
+%token <i> PARSEOP_RAW_DATA
+%token <i> PARSEOP_READWRITETYPE_BOTH
+%token <i> PARSEOP_READWRITETYPE_READONLY
+%token <i> PARSEOP_REFOF
+%token <i> PARSEOP_REGIONSPACE_CMOS
+%token <i> PARSEOP_REGIONSPACE_EC
+%token <i> PARSEOP_REGIONSPACE_IO
+%token <i> PARSEOP_REGIONSPACE_MEM
+%token <i> PARSEOP_REGIONSPACE_PCI
+%token <i> PARSEOP_REGIONSPACE_PCIBAR
+%token <i> PARSEOP_REGIONSPACE_SMBUS
+%token <i> PARSEOP_REGISTER
+%token <i> PARSEOP_RELEASE
+%token <i> PARSEOP_RESERVED_BYTES
+%token <i> PARSEOP_RESET
+%token <i> PARSEOP_RESOURCETEMPLATE
+%token <i> PARSEOP_RESOURCETYPE_CONSUMER
+%token <i> PARSEOP_RESOURCETYPE_PRODUCER
+%token <i> PARSEOP_RETURN
+%token <i> PARSEOP_REVISION
+%token <i> PARSEOP_SCOPE
+%token <i> PARSEOP_SERIALIZERULE_NOTSERIAL
+%token <i> PARSEOP_SERIALIZERULE_SERIAL
+%token <i> PARSEOP_SHARETYPE_EXCLUSIVE
+%token <i> PARSEOP_SHARETYPE_SHARED
+%token <i> PARSEOP_SHIFTLEFT
+%token <i> PARSEOP_SHIFTRIGHT
+%token <i> PARSEOP_SIGNAL
+%token <i> PARSEOP_SIZEOF
+%token <i> PARSEOP_SLEEP
+%token <i> PARSEOP_STALL
+%token <i> PARSEOP_STARTDEPENDENTFN
+%token <i> PARSEOP_STARTDEPENDENTFN_NOPRI
+%token <i> PARSEOP_STORE
+%token <s> PARSEOP_STRING_LITERAL
+%token <i> PARSEOP_SUBTRACT
+%token <i> PARSEOP_SWITCH
+%token <i> PARSEOP_THERMALZONE
+%token <i> PARSEOP_TOBCD
+%token <i> PARSEOP_TOBUFFER
+%token <i> PARSEOP_TODECIMALSTRING
+%token <i> PARSEOP_TOHEXSTRING
+%token <i> PARSEOP_TOINTEGER
+%token <i> PARSEOP_TOSTRING
+%token <i> PARSEOP_TRANSLATIONTYPE_DENSE
+%token <i> PARSEOP_TRANSLATIONTYPE_SPARSE
+%token <i> PARSEOP_TYPE_STATIC
+%token <i> PARSEOP_TYPE_TRANSLATION
+%token <i> PARSEOP_UNICODE
+%token <i> PARSEOP_UNLOAD
+%token <i> PARSEOP_UPDATERULE_ONES
+%token <i> PARSEOP_UPDATERULE_PRESERVE
+%token <i> PARSEOP_UPDATERULE_ZEROS
+%token <i> PARSEOP_VAR_PACKAGE
+%token <i> PARSEOP_VENDORLONG
+%token <i> PARSEOP_VENDORSHORT
+%token <i> PARSEOP_WAIT
+%token <i> PARSEOP_WHILE
+%token <i> PARSEOP_WORDBUSNUMBER
+%token <i> PARSEOP_WORDCONST
+%token <i> PARSEOP_WORDIO
+%token <i> PARSEOP_XFERTYPE_8
+%token <i> PARSEOP_XFERTYPE_8_16
+%token <i> PARSEOP_XFERTYPE_16
+%token <i> PARSEOP_XOR
+%token <i> PARSEOP_ZERO
+
+
+/*
+ * Production names
+ */
+
+%type <n> ASLCode
+%type <n> DefinitionBlockTerm
+%type <n> TermList
+%type <n> Term
+%type <n> CompilerDirective
+%type <n> ObjectList
+%type <n> Object
+%type <n> DataObject
+%type <n> BufferData
+%type <n> PackageData
+%type <n> IntegerData
+%type <n> StringData
+%type <n> NamedObject
+%type <n> NameSpaceModifier
+%type <n> UserTerm
+%type <n> ArgList
+%type <n> ArgListTail
+%type <n> TermArg
+%type <n> Target
+%type <n> RequiredTarget
+%type <n> SimpleTarget
+%type <n> BufferTermData
+
+%type <n> Type1Opcode
+%type <n> Type2Opcode
+%type <n> Type2IntegerOpcode
+%type <n> Type2StringOpcode
+%type <n> Type2BufferOpcode
+%type <n> Type2BufferOrStringOpcode
+%type <n> Type3Opcode
+
+/* Obsolete %type <n> Type4Opcode */
+
+%type <n> Type5Opcode
+%type <n> Type6Opcode
+
+%type <n> LineTerm
+%type <n> IncludeTerm
+%type <n> IncludeCStyleTerm
+%type <n> ExternalTerm
+
+%type <n> FieldUnitList
+%type <n> FieldUnitListTail
+%type <n> FieldUnit
+%type <n> FieldUnitEntry
+
+%type <n> OffsetTerm
+%type <n> AccessAsTerm
+%type <n> OptionalAccessAttribTerm
+
+
+/* Named Objects */
+
+%type <n> BankFieldTerm
+%type <n> CreateBitFieldTerm
+%type <n> CreateByteFieldTerm
+%type <n> CreateDWordFieldTerm
+%type <n> CreateFieldTerm
+%type <n> CreateQWordFieldTerm
+%type <n> CreateWordFieldTerm
+%type <n> DataRegionTerm
+%type <n> DeviceTerm
+%type <n> EventTerm
+%type <n> FieldTerm
+%type <n> IndexFieldTerm
+%type <n> MethodTerm
+%type <n> MutexTerm
+%type <n> OpRegionTerm
+%type <n> OpRegionSpaceIdTerm
+%type <n> PowerResTerm
+%type <n> ProcessorTerm
+%type <n> ThermalZoneTerm
+
+
+/* Namespace modifiers */
+
+%type <n> AliasTerm
+%type <n> NameTerm
+%type <n> ScopeTerm
+
+/* Type 1 opcodes */
+
+%type <n> BreakTerm
+%type <n> BreakPointTerm
+%type <n> ContinueTerm
+%type <n> FatalTerm
+%type <n> IfElseTerm
+%type <n> IfTerm
+%type <n> ElseTerm
+%type <n> LoadTerm
+%type <n> NoOpTerm
+%type <n> NotifyTerm
+%type <n> ReleaseTerm
+%type <n> ResetTerm
+%type <n> ReturnTerm
+%type <n> SignalTerm
+%type <n> SleepTerm
+%type <n> StallTerm
+%type <n> SwitchTerm
+%type <n> CaseTermList
+%type <n> DefaultTermList
+%type <n> CaseTerm
+%type <n> DefaultTerm
+%type <n> UnloadTerm
+%type <n> WhileTerm
+
+/* Type 2 opcodes */
+
+%type <n> AcquireTerm
+%type <n> AddTerm
+%type <n> AndTerm
+%type <n> ConcatTerm
+%type <n> ConcatResTerm
+%type <n> CondRefOfTerm
+%type <n> CopyObjectTerm
+%type <n> DecTerm
+%type <n> DerefOfTerm
+%type <n> DivideTerm
+%type <n> FindSetLeftBitTerm
+%type <n> FindSetRightBitTerm
+%type <n> FromBCDTerm
+%type <n> IncTerm
+%type <n> IndexTerm
+%type <n> LAndTerm
+%type <n> LEqualTerm
+%type <n> LGreaterTerm
+%type <n> LGreaterEqualTerm
+%type <n> LLessTerm
+%type <n> LLessEqualTerm
+%type <n> LNotTerm
+%type <n> LNotEqualTerm
+%type <n> LoadTableTerm
+%type <n> LOrTerm
+%type <n> MatchTerm
+%type <n> MidTerm
+%type <n> ModTerm
+%type <n> MultiplyTerm
+%type <n> NAndTerm
+%type <n> NOrTerm
+%type <n> NotTerm
+%type <n> ObjectTypeTerm
+%type <n> OrTerm
+%type <n> RefOfTerm
+%type <n> ShiftLeftTerm
+%type <n> ShiftRightTerm
+%type <n> SizeOfTerm
+%type <n> StoreTerm
+%type <n> SubtractTerm
+%type <n> ToBCDTerm
+%type <n> ToBufferTerm
+%type <n> ToDecimalStringTerm
+%type <n> ToHexStringTerm
+%type <n> ToIntegerTerm
+%type <n> ToStringTerm
+%type <n> WaitTerm
+%type <n> XOrTerm
+
+%type <n> OptionalTermArg
+%type <n> OptionalListString
+
+
+/* Keywords */
+
+%type <n> ObjectTypeKeyword
+%type <n> AccessTypeKeyword
+%type <n> AccessAttribKeyword
+%type <n> LockRuleKeyword
+%type <n> UpdateRuleKeyword
+%type <n> RegionSpaceKeyword
+%type <n> AddressSpaceKeyword
+%type <n> MatchOpKeyword
+%type <n> SerializeRuleKeyword
+%type <n> DMATypeKeyword
+%type <n> BusMasterKeyword
+%type <n> XferTypeKeyword
+%type <n> ResourceTypeKeyword
+%type <n> MinKeyword
+%type <n> MaxKeyword
+%type <n> DecodeKeyword
+%type <n> RangeTypeKeyword
+%type <n> MemTypeKeyword
+%type <n> ReadWriteKeyword
+%type <n> InterruptTypeKeyword
+%type <n> InterruptLevel
+%type <n> ShareTypeKeyword
+%type <n> IODecodeKeyword
+%type <n> TypeKeyword
+%type <n> TranslationKeyword
+%type <n> AddressKeyword
+
+/* Types */
+
+%type <n> SuperName
+%type <n> ArgTerm
+%type <n> LocalTerm
+%type <n> DebugTerm
+
+
+%type <n> Integer
+
+%type <n> ByteConst
+%type <n> WordConst
+%type <n> DWordConst
+%type <n> QWordConst
+
+/* Useless
+%type <n> WordConst
+%type <n> QWordConst
+*/
+
+%type <n> String
+
+%type <n> ConstTerm
+%type <n> ByteConstExpr
+%type <n> WordConstExpr
+%type <n> DWordConstExpr
+%type <n> QWordConstExpr
+%type <n> ConstExprTerm
+
+%type <n> BufferTerm
+%type <n> ByteList
+%type <n> ByteListTail
+%type <n> DWordList
+%type <n> DWordListTail
+
+%type <n> PackageTerm
+%type <n> PackageLengthTerm
+%type <n> PackageList
+%type <n> PackageListTail
+%type <n> PackageElement
+
+%type <n> VarPackageLengthTerm
+
+
+%type <n> EISAIDTerm
+%type <n> ResourceTemplateTerm
+%type <n> UnicodeTerm
+%type <n> ResourceMacroList
+%type <n> ResourceMacroTerm
+
+%type <n> DMATerm
+%type <n> DWordIOTerm
+%type <n> DWordMemoryTerm
+%type <n> EndDependentFnTerm
+%type <n> FixedIOTerm
+%type <n> InterruptTerm
+%type <n> IOTerm
+%type <n> IRQNoFlagsTerm
+%type <n> IRQTerm
+%type <n> Memory24Term
+%type <n> Memory32FixedTerm
+%type <n> Memory32Term
+%type <n> QWordIOTerm
+%type <n> QWordMemoryTerm
+%type <n> RegisterTerm
+%type <n> StartDependentFnTerm
+%type <n> StartDependentFnNoPriTerm
+%type <n> VendorLongTerm
+%type <n> VendorShortTerm
+%type <n> WordBusNumberTerm
+%type <n> WordIOTerm
+
+%type <n> NameString
+%type <n> NameSeg
+
+
+/* Local types that help construct the AML, not in ACPI spec */
+
+%type <n> IncludeEndTerm
+%type <n> AmlPackageLengthTerm
+%type <n> OptionalByteConstExpr
+%type <n> OptionalDWordConstExpr
+%type <n> OptionalSerializeRuleKeyword
+%type <n> OptionalResourceType_First
+%type <n> OptionalMinType
+%type <n> OptionalMaxType
+%type <n> OptionalMemType
+%type <n> OptionalCount
+%type <n> OptionalDecodeType
+%type <n> OptionalRangeType
+%type <n> OptionalShareType
+%type <n> OptionalType
+%type <n> OptionalType_Last
+%type <n> OptionalTranslationType_Last
+%type <n> OptionalStringData
+%type <n> OptionalNameString
+%type <n> OptionalNameString_First
+%type <n> OptionalNameString_Last
+%type <n> OptionalAddressRange
+%type <n> OptionalObjectTypeKeyword
+%type <n> OptionalReference
+
+
+%type <n> TermArgItem
+%type <n> NameStringItem
+
+%%
+
+
+/*******************************************************************************
+ *
+ * Production rules start here
+ *
+ ******************************************************************************/
+
+/*
+ * ASL Names
+ */
+
+
+/*
+ * Blocks, Data, and Opcodes
+ */
+
+ASLCode
+ : DefinitionBlockTerm
+ | error {YYABORT; $$ = NULL;}
+ ;
+
+DefinitionBlockTerm
+ : PARSEOP_DEFINITIONBLOCK '(' {$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
+ String ','
+ String ','
+ ByteConst ','
+ String ','
+ String ','
+ DWordConst
+ ')' {TrSetEndLineNumber ($<n>3);}
+ '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
+ ;
+
+TermList
+ : {$$ = NULL;}
+ | Term TermList {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
+ ;
+
+Term
+ : Object {}
+ | Type1Opcode {}
+ | Type2Opcode {}
+ | Type2IntegerOpcode {}
+ | Type2StringOpcode {}
+ | Type2BufferOpcode {}
+ | Type2BufferOrStringOpcode {}
+ | error {$$ = AslDoError(); yyclearin;}
+ ;
+
+CompilerDirective
+ : IncludeTerm {}
+ | IncludeCStyleTerm {$$ = NULL;}
+ | LineTerm {$$ = NULL;}
+ | ExternalTerm {}
+ ;
+
+ObjectList
+ : {$$ = NULL;}
+ | Object ObjectList {$$ = TrLinkPeerNode ($1,$2);}
+ | error {$$ = AslDoError(); yyclearin;}
+ ;
+
+Object
+ : CompilerDirective {}
+ | NamedObject {}
+ | NameSpaceModifier {}
+ ;
+
+DataObject
+ : BufferData {}
+ | PackageData {}
+ | IntegerData {}
+ | StringData {}
+ ;
+
+BufferData
+ : Type5Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | BufferTerm {}
+ ;
+
+PackageData
+ : PackageTerm {}
+ ;
+
+IntegerData
+ : Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | Integer {}
+ | ConstTerm {}
+ ;
+
+StringData
+ : Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
+ | String {}
+ ;
+
+NamedObject
+ : BankFieldTerm {}
+ | CreateBitFieldTerm {}
+ | CreateByteFieldTerm {}
+ | CreateDWordFieldTerm {}
+ | CreateFieldTerm {}
+ | CreateQWordFieldTerm {}
+ | CreateWordFieldTerm {}
+ | DataRegionTerm {}
+ | DeviceTerm {}
+ | EventTerm {}
+ | FieldTerm {}
+ | IndexFieldTerm {}
+ | MethodTerm {}
+ | MutexTerm {}
+ | OpRegionTerm {}
+ | PowerResTerm {}
+ | ProcessorTerm {}
+ | ThermalZoneTerm {}
+ ;
+
+NameSpaceModifier
+ : AliasTerm {}
+ | NameTerm {}
+ | ScopeTerm {}
+ ;
+
+UserTerm
+ : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);}
+ ArgList ')' {$$ = TrLinkChildNode ($1,$4);}
+ ;
+
+ArgList
+ : {$$ = NULL;}
+ | TermArg ArgListTail {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+ArgListTail
+ : {$$ = NULL;}
+ | ',' TermArg ArgListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ ;
+
+TermArg
+ : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+ ;
+
+Target
+ : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */
+ | ',' {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */
+ | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
+ ;
+
+RequiredTarget
+ : ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
+ ;
+
+SimpleTarget
+ : NameString {}
+ | LocalTerm {}
+ | ArgTerm {}
+ ;
+
+
+/* Opcode types */
+
+Type1Opcode
+ : BreakTerm {}
+ | BreakPointTerm {}
+ | ContinueTerm {}
+ | FatalTerm {}
+ | IfElseTerm {}
+ | LoadTerm {}
+ | NoOpTerm {}
+ | NotifyTerm {}
+ | ReleaseTerm {}
+ | ResetTerm {}
+ | ReturnTerm {}
+ | SignalTerm {}
+ | SleepTerm {}
+ | StallTerm {}
+ | SwitchTerm {}
+ | UnloadTerm {}
+ | WhileTerm {}
+ ;
+
+Type2Opcode
+ : AcquireTerm {}
+ | CondRefOfTerm {}
+ | CopyObjectTerm {}
+ | DerefOfTerm {}
+ | ObjectTypeTerm {}
+ | RefOfTerm {}
+ | SizeOfTerm {}
+ | StoreTerm {}
+ | WaitTerm {}
+ | UserTerm {}
+ ;
+
+/*
+ * A type 2 opcode evaluates to an Integer and cannot have a destination operand
+ */
+
+Type2IntegerOpcode /* "Type3" opcodes */
+ : AddTerm {}
+ | AndTerm {}
+ | DecTerm {}
+ | DivideTerm {}
+ | FindSetLeftBitTerm {}
+ | FindSetRightBitTerm {}
+ | FromBCDTerm {}
+ | IncTerm {}
+ | IndexTerm {}
+ | LAndTerm {}
+ | LEqualTerm {}
+ | LGreaterTerm {}
+ | LGreaterEqualTerm {}
+ | LLessTerm {}
+ | LLessEqualTerm {}
+ | LNotTerm {}
+ | LNotEqualTerm {}
+ | LoadTableTerm {}
+ | LOrTerm {}
+ | MatchTerm {}
+ | ModTerm {}
+ | MultiplyTerm {}
+ | NAndTerm {}
+ | NOrTerm {}
+ | NotTerm {}
+ | OrTerm {}
+ | ShiftLeftTerm {}
+ | ShiftRightTerm {}
+ | SubtractTerm {}
+ | ToBCDTerm {}
+ | ToIntegerTerm {}
+ | XOrTerm {}
+ ;
+
+
+Type2StringOpcode /* "Type4" Opcodes */
+ : ToDecimalStringTerm {}
+ | ToHexStringTerm {}
+ | ToStringTerm {}
+ ;
+
+Type2BufferOpcode /* "Type5" Opcodes */
+ : ToBufferTerm {}
+ | ConcatResTerm {}
+ ;
+
+Type2BufferOrStringOpcode
+ : ConcatTerm {}
+ | MidTerm {}
+ ;
+
+/*
+ * A type 3 opcode evaluates to an Integer and cannot have a destination operand
+ */
+
+Type3Opcode
+ : EISAIDTerm {}
+ ;
+
+/* Obsolete
+Type4Opcode
+ : ConcatTerm {}
+ | ToDecimalStringTerm {}
+ | ToHexStringTerm {}
+ | MidTerm {}
+ | ToStringTerm {}
+ ;
+*/
+
+
+Type5Opcode
+ : ResourceTemplateTerm {}
+ | UnicodeTerm {}
+ ;
+
+Type6Opcode
+ : RefOfTerm {}
+ | DerefOfTerm {}
+ | IndexTerm {}
+ | UserTerm {}
+ ;
+
+IncludeTerm
+ : PARSEOP_INCLUDE '(' {$$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
+ String ')' {$$ = TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);}
+ TermList
+ IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);}
+ ;
+
+IncludeEndTerm
+ : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
+ ;
+
+IncludeCStyleTerm
+ : PARSEOP_INCLUDE_CSTYLE
+ String {FlOpenIncludeFile ($2);}
+ ;
+
+LineTerm
+ : PARSEOP_LINE_CSTYLE
+ Integer {FlSetLineNumber ($2);}
+ ;
+
+ExternalTerm
+ : PARSEOP_EXTERNAL '('
+ NameString
+ OptionalObjectTypeKeyword
+ ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,2,$3,$4);}
+ | PARSEOP_EXTERNAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Named Objects *******************************************************/
+
+
+BankFieldTerm
+ : PARSEOP_BANKFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
+ NameString
+ NameStringItem
+ TermArgItem
+ ',' AccessTypeKeyword
+ ',' LockRuleKeyword
+ ',' UpdateRuleKeyword
+ ')' '{'
+ FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);}
+ | PARSEOP_BANKFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FieldUnitList
+ : {$$ = NULL;}
+ | FieldUnit
+ FieldUnitListTail {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+FieldUnitListTail
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | ',' FieldUnit
+ FieldUnitListTail {$$ = TrLinkPeerNode ($2,$3);}
+ ;
+
+FieldUnit
+ : FieldUnitEntry {}
+ | OffsetTerm {}
+ | AccessAsTerm {}
+ ;
+
+FieldUnitEntry
+ : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
+ | NameSeg ','
+ AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);}
+ ;
+
+OffsetTerm
+ : PARSEOP_OFFSET '('
+ AmlPackageLengthTerm
+ ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);}
+ | PARSEOP_OFFSET '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+AccessAsTerm
+ : PARSEOP_ACCESSAS '('
+ AccessTypeKeyword
+ OptionalAccessAttribTerm
+ ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);}
+ | PARSEOP_ACCESSAS '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateBitFieldTerm
+ : PARSEOP_CREATEBITFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
+ TermArg
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEBITFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateByteFieldTerm
+ : PARSEOP_CREATEBYTEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
+ TermArg
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEBYTEFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateDWordFieldTerm
+ : PARSEOP_CREATEDWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
+ TermArg
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEDWORDFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateFieldTerm
+ : PARSEOP_CREATEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
+ TermArg
+ TermArgItem
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateQWordFieldTerm
+ : PARSEOP_CREATEQWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
+ TermArg
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEQWORDFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CreateWordFieldTerm
+ : PARSEOP_CREATEWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
+ TermArg
+ TermArgItem
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_CREATEWORDFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DataRegionTerm
+ : PARSEOP_DATATABLEREGION '(' {$$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
+ NameString
+ TermArgItem
+ TermArgItem
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);}
+ | PARSEOP_DATATABLEREGION '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DeviceTerm
+ : PARSEOP_DEVICE '(' {$$ = TrCreateLeafNode (PARSEOP_DEVICE);}
+ NameString
+ ')' '{'
+ ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
+ | PARSEOP_DEVICE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+EventTerm
+ : PARSEOP_EVENT '(' {$$ = TrCreateLeafNode (PARSEOP_EVENT);}
+ NameString
+ ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_EVENT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FieldTerm
+ : PARSEOP_FIELD '(' {$$ = TrCreateLeafNode (PARSEOP_FIELD);}
+ NameString
+ ',' AccessTypeKeyword
+ ',' LockRuleKeyword
+ ',' UpdateRuleKeyword
+ ')' '{'
+ FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);}
+ | PARSEOP_FIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IndexFieldTerm
+ : PARSEOP_INDEXFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
+ NameString
+ NameStringItem
+ ',' AccessTypeKeyword
+ ',' LockRuleKeyword
+ ',' UpdateRuleKeyword
+ ')' '{'
+ FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);}
+ | PARSEOP_INDEXFIELD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+MethodTerm
+ : PARSEOP_METHOD '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ NameString
+ OptionalByteConstExpr {$$ = UtCheckIntegerRange ($5, 0, 7);}
+ OptionalSerializeRuleKeyword
+ OptionalByteConstExpr
+ ')' '{'
+ TermList '}' {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$11);}
+ | PARSEOP_METHOD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+MutexTerm
+ : PARSEOP_MUTEX '(' {$$ = TrCreateLeafNode (PARSEOP_MUTEX);}
+ NameString
+ ',' ByteConstExpr
+ ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
+ | PARSEOP_MUTEX '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+OpRegionTerm
+ : PARSEOP_OPERATIONREGION '(' {$$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
+ NameString
+ ',' OpRegionSpaceIdTerm
+ TermArgItem
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);}
+ | PARSEOP_OPERATIONREGION '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+OpRegionSpaceIdTerm
+ : RegionSpaceKeyword {}
+ | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
+ ;
+
+PowerResTerm
+ : PARSEOP_POWERRESOURCE '(' {$$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
+ NameString
+ ',' ByteConstExpr
+ ',' WordConstExpr
+ ')' '{'
+ ObjectList '}' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);}
+ | PARSEOP_POWERRESOURCE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ProcessorTerm
+ : PARSEOP_PROCESSOR '(' {$$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
+ NameString
+ ',' ByteConstExpr
+ OptionalDWordConstExpr
+ OptionalByteConstExpr
+ ')' '{'
+ ObjectList '}' {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);}
+ | PARSEOP_PROCESSOR '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ThermalZoneTerm
+ : PARSEOP_THERMALZONE '(' {$$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
+ NameString
+ ')' '{'
+ ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
+ | PARSEOP_THERMALZONE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Namespace modifiers *************************************************/
+
+
+AliasTerm
+ : PARSEOP_ALIAS '(' {$$ = TrCreateLeafNode (PARSEOP_ALIAS);}
+ NameString
+ NameStringItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
+ | PARSEOP_ALIAS '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+NameTerm
+ : PARSEOP_NAME '(' {$$ = TrCreateLeafNode (PARSEOP_NAME);}
+ NameString
+ ',' DataObject
+ ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
+ | PARSEOP_NAME '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ScopeTerm
+ : PARSEOP_SCOPE '(' {$$ = TrCreateLeafNode (PARSEOP_SCOPE);}
+ NameString
+ ')' '{'
+ ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
+ | PARSEOP_SCOPE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Type 1 opcodes *******************************************************/
+
+
+BreakTerm
+ : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
+ ;
+
+BreakPointTerm
+ : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
+ ;
+
+ContinueTerm
+ : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
+ ;
+
+FatalTerm
+ : PARSEOP_FATAL '(' {$$ = TrCreateLeafNode (PARSEOP_FATAL);}
+ ByteConstExpr
+ ',' DWordConstExpr
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
+ | PARSEOP_FATAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IfElseTerm
+ : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+IfTerm
+ : PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);}
+ TermArg
+ ')' '{'
+ TermList '}'
+ {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_IF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ElseTerm
+ : {$$ = NULL;}
+ | PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ TermList '}'
+ {$$ = TrLinkChildren ($<n>3,1,$4);}
+
+ | PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSEIF);}
+ TermArg
+ ')' '{'
+ TermList '}'
+ ElseTerm {$$ = TrLinkChildren ($<n>3,3,$4,$7,$9);}
+
+ | PARSEOP_ELSEIF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LoadTerm
+ : PARSEOP_LOAD '(' {$$ = TrCreateLeafNode (PARSEOP_LOAD);}
+ NameString
+ RequiredTarget
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LOAD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+NoOpTerm
+ : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
+ ;
+
+NotifyTerm
+ : PARSEOP_NOTIFY '(' {$$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
+ SuperName
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_NOTIFY '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ReleaseTerm
+ : PARSEOP_RELEASE '(' {$$ = TrCreateLeafNode (PARSEOP_RELEASE);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_RELEASE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ResetTerm
+ : PARSEOP_RESET '(' {$$ = TrCreateLeafNode (PARSEOP_RESET);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_RESET '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ReturnTerm
+ : PARSEOP_RETURN '(' {$$ = TrCreateLeafNode (PARSEOP_RETURN);}
+ OptionalTermArg
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_RETURN '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+SignalTerm
+ : PARSEOP_SIGNAL '(' {$$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_SIGNAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+SleepTerm
+ : PARSEOP_SLEEP '(' {$$ = TrCreateLeafNode (PARSEOP_SLEEP);}
+ TermArg
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_SLEEP '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+StallTerm
+ : PARSEOP_STALL '(' {$$ = TrCreateLeafNode (PARSEOP_STALL);}
+ TermArg
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_STALL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+SwitchTerm
+ : PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);}
+ TermArg
+ ')' '{'
+ CaseTermList '}'
+ {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_SWITCH '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CaseTermList
+ : {$$ = NULL;}
+ | CaseTerm {}
+ | DefaultTerm
+ DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseTerm
+ CaseTermList {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+DefaultTermList
+ : {$$ = NULL;}
+ | CaseTerm {}
+ | CaseTerm
+ DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+CaseTerm
+ : PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);}
+ DataObject
+ ')' '{'
+ TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_CASE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DefaultTerm
+ : PARSEOP_DEFAULT '{' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
+ TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_DEFAULT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+UnloadTerm
+ : PARSEOP_UNLOAD '(' {$$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_UNLOAD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+WhileTerm
+ : PARSEOP_WHILE '(' {$$ = TrCreateLeafNode (PARSEOP_WHILE);}
+ TermArg
+ ')' '{' TermList '}'
+ {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_WHILE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Type 2 opcodes *******************************************************/
+
+AcquireTerm
+ : PARSEOP_ACQUIRE '(' {$$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
+ SuperName
+ ',' WordConstExpr
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
+ | PARSEOP_ACQUIRE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+AddTerm
+ : PARSEOP_ADD '(' {$$ = TrCreateLeafNode (PARSEOP_ADD);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_ADD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+AndTerm
+ : PARSEOP_AND '(' {$$ = TrCreateLeafNode (PARSEOP_AND);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_AND '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ConcatTerm
+ : PARSEOP_CONCATENATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_CONCATENATE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ConcatResTerm
+ : PARSEOP_CONCATENATERESTEMPLATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_CONCATENATERESTEMPLATE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CondRefOfTerm
+ : PARSEOP_CONDREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
+ SuperName
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_CONDREFOF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+CopyObjectTerm
+ : PARSEOP_COPYOBJECT '(' {$$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
+ TermArg
+ ',' SimpleTarget
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
+ | PARSEOP_COPYOBJECT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DecTerm
+ : PARSEOP_DECREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_DECREMENT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DerefOfTerm
+ : PARSEOP_DEREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
+ TermArg
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_DEREFOF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DivideTerm
+ : PARSEOP_DIVIDE '(' {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
+ TermArg
+ TermArgItem
+ Target
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
+ | PARSEOP_DIVIDE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FindSetLeftBitTerm
+ : PARSEOP_FINDSETLEFTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_FINDSETLEFTBIT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FindSetRightBitTerm
+ : PARSEOP_FINDSETRIGHTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_FINDSETRIGHTBIT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FromBCDTerm
+ : PARSEOP_FROMBCD '(' {$$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_FROMBCD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IncTerm
+ : PARSEOP_INCREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_INCREMENT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IndexTerm
+ : PARSEOP_INDEX '(' {$$ = TrCreateLeafNode (PARSEOP_INDEX);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_INDEX '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LAndTerm
+ : PARSEOP_LAND '(' {$$ = TrCreateLeafNode (PARSEOP_LAND);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LAND '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LEqualTerm
+ : PARSEOP_LEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LEQUAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LGreaterTerm
+ : PARSEOP_LGREATER '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LGREATER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LGreaterEqualTerm
+ : PARSEOP_LGREATEREQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
+ | PARSEOP_LGREATEREQUAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LLessTerm
+ : PARSEOP_LLESS '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LLESS '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LLessEqualTerm
+ : PARSEOP_LLESSEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
+ | PARSEOP_LLESSEQUAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LNotTerm
+ : PARSEOP_LNOT '(' {$$ = TrCreateLeafNode (PARSEOP_LNOT);}
+ TermArg
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_LNOT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LNotEqualTerm
+ : PARSEOP_LNOTEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
+ | PARSEOP_LNOTEQUAL '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LoadTableTerm
+ : PARSEOP_LOADTABLE '(' {$$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
+ TermArg
+ TermArgItem
+ TermArgItem
+ OptionalListString
+ OptionalListString
+ OptionalReference
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);}
+ | PARSEOP_LOADTABLE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+LOrTerm
+ : PARSEOP_LOR '(' {$$ = TrCreateLeafNode (PARSEOP_LOR);}
+ TermArg
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_LOR '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+MatchTerm
+ : PARSEOP_MATCH '(' {$$ = TrCreateLeafNode (PARSEOP_MATCH);}
+ TermArg
+ ',' MatchOpKeyword
+ TermArgItem
+ ',' MatchOpKeyword
+ TermArgItem
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);}
+ | PARSEOP_MATCH '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+MidTerm
+ : PARSEOP_MID '(' {$$ = TrCreateLeafNode (PARSEOP_MID);}
+ TermArg
+ TermArgItem
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
+ | PARSEOP_MID '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ModTerm
+ : PARSEOP_MOD '(' {$$ = TrCreateLeafNode (PARSEOP_MOD);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_MOD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+MultiplyTerm
+ : PARSEOP_MULTIPLY '(' {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_MULTIPLY '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+NAndTerm
+ : PARSEOP_NAND '(' {$$ = TrCreateLeafNode (PARSEOP_NAND);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_NAND '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+NOrTerm
+ : PARSEOP_NOR '(' {$$ = TrCreateLeafNode (PARSEOP_NOR);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_NOR '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+NotTerm
+ : PARSEOP_NOT '(' {$$ = TrCreateLeafNode (PARSEOP_NOT);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_NOT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ObjectTypeTerm
+ : PARSEOP_OBJECTTYPE '(' {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_OBJECTTYPE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+OrTerm
+ : PARSEOP_OR '(' {$$ = TrCreateLeafNode (PARSEOP_OR);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_OR '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+/*
+ * In RefOf, the node isn't really a target, but we can't keep track of it after
+ * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
+ */
+RefOfTerm
+ : PARSEOP_REFOF '(' {$$ = TrCreateLeafNode (PARSEOP_REFOF);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
+ | PARSEOP_REFOF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ShiftLeftTerm
+ : PARSEOP_SHIFTLEFT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_SHIFTLEFT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ShiftRightTerm
+ : PARSEOP_SHIFTRIGHT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_SHIFTRIGHT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+SizeOfTerm
+ : PARSEOP_SIZEOF '(' {$$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
+ SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_SIZEOF '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+StoreTerm
+ : PARSEOP_STORE '(' {$$ = TrCreateLeafNode (PARSEOP_STORE);}
+ TermArg
+ ',' SuperName
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
+ | PARSEOP_STORE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+SubtractTerm
+ : PARSEOP_SUBTRACT '(' {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_SUBTRACT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToBCDTerm
+ : PARSEOP_TOBCD '(' {$$ = TrCreateLeafNode (PARSEOP_TOBCD);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_TOBCD '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToBufferTerm
+ : PARSEOP_TOBUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_TOBUFFER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToDecimalStringTerm
+ : PARSEOP_TODECIMALSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_TODECIMALSTRING '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToHexStringTerm
+ : PARSEOP_TOHEXSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_TOHEXSTRING '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToIntegerTerm
+ : PARSEOP_TOINTEGER '(' {$$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
+ TermArg
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_TOINTEGER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ToStringTerm
+ : PARSEOP_TOSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
+ TermArg
+ OptionalCount
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_TOSTRING '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+WaitTerm
+ : PARSEOP_WAIT '(' {$$ = TrCreateLeafNode (PARSEOP_WAIT);}
+ SuperName
+ TermArgItem
+ ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+ | PARSEOP_WAIT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+XOrTerm
+ : PARSEOP_XOR '(' {$$ = TrCreateLeafNode (PARSEOP_XOR);}
+ TermArg
+ TermArgItem
+ Target
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
+ | PARSEOP_XOR '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Keywords *************************************************************/
+
+
+ObjectTypeKeyword
+ : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
+ | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);}
+ | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);}
+ | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);}
+ | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);}
+ | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);}
+ | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);}
+ | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);}
+ | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);}
+ | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);}
+ | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);}
+ | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);}
+ | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);}
+ | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);}
+ | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);}
+ ;
+
+AccessTypeKeyword
+ : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);}
+ | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);}
+ | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);}
+ | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);}
+ | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);}
+ | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);}
+ ;
+
+AccessAttribKeyword
+ : PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );}
+ | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);}
+ | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);}
+ | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);}
+ | PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);}
+ | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);}
+ | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);}
+ ;
+
+LockRuleKeyword
+ : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);}
+ | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);}
+ ;
+
+UpdateRuleKeyword
+ : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);}
+ | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);}
+ | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);}
+ ;
+
+
+RegionSpaceKeyword
+ : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);}
+ | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);}
+ | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);}
+ | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);}
+ | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);}
+ | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);}
+ | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);}
+ ;
+
+AddressSpaceKeyword
+ : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
+ | RegionSpaceKeyword {}
+ | PARSEOP_ADDRESSSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_ADDRESSSPACE_FFIXEDHW);}
+ ;
+
+
+SerializeRuleKeyword
+ : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);}
+ | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);}
+ ;
+
+MatchOpKeyword
+ : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);}
+ | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);}
+ | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);}
+ | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);}
+ | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);}
+ | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);}
+ ;
+
+DMATypeKeyword
+ : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);}
+ | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);}
+ | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);}
+ | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);}
+ ;
+
+BusMasterKeyword
+ : PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
+ | PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);}
+ ;
+
+XferTypeKeyword
+ : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);}
+ | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);}
+ | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);}
+ ;
+
+ResourceTypeKeyword
+ : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
+ | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);}
+ ;
+
+MinKeyword
+ : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);}
+ | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);}
+ ;
+
+MaxKeyword
+ : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);}
+ | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);}
+ ;
+
+DecodeKeyword
+ : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);}
+ | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);}
+ ;
+
+RangeTypeKeyword
+ : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);}
+ | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);}
+ | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);}
+ ;
+
+MemTypeKeyword
+ : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);}
+ | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);}
+ | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);}
+ | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);}
+ ;
+
+ReadWriteKeyword
+ : PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
+ | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);}
+ ;
+
+InterruptTypeKeyword
+ : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);}
+ | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);}
+ ;
+
+InterruptLevel
+ : PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);}
+ | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);}
+ ;
+
+ShareTypeKeyword
+ : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);}
+ | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);}
+ ;
+
+IODecodeKeyword
+ : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);}
+ | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);}
+ ;
+
+TypeKeyword
+ : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);}
+ | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);}
+ ;
+
+TranslationKeyword
+ : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);}
+ | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);}
+ ;
+
+AddressKeyword
+ : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);}
+ | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);}
+ | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);}
+ | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);}
+ ;
+
+
+/******* Miscellaneous Types **************************************************/
+
+
+SuperName
+ : NameString {}
+ | ArgTerm {}
+ | LocalTerm {}
+ | DebugTerm {}
+ | Type6Opcode {}
+/* | UserTerm {} */ /* Caused reduce/reduce with Type6Opcode->UserTerm */
+ ;
+
+ArgTerm
+ : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);}
+ | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);}
+ | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);}
+ | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);}
+ | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);}
+ | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);}
+ | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);}
+ ;
+
+LocalTerm
+ : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);}
+ | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);}
+ | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);}
+ | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);}
+ | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);}
+ | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);}
+ | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);}
+ | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);}
+ ;
+
+DebugTerm
+ : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);}
+ ;
+
+
+ByteConst
+ : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
+ ;
+
+WordConst
+ : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
+ ;
+
+DWordConst
+ : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
+ ;
+
+QWordConst
+ : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
+ ;
+
+Integer
+ : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);}
+ ;
+
+String
+ : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+ ;
+
+ConstTerm
+ : ConstExprTerm {}
+ | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
+ ;
+
+ByteConstExpr
+ : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
+ | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
+ | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
+ | ByteConst {}
+ ;
+
+WordConstExpr
+ : Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
+ | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
+ | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
+ | WordConst {}
+ ;
+
+DWordConstExpr
+ : Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
+ | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
+ | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
+ | DWordConst {}
+ ;
+
+QWordConstExpr
+ : Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
+ | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
+ | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
+ | QWordConst {}
+ ;
+
+ConstExprTerm
+ : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
+ | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
+ | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, 0xFFFFFFFFFFFFFFFF);}
+ ;
+
+/* OptionalCount must appear before ByteList or an incorrect reduction will result */
+
+OptionalCount
+ : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
+ | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
+ | ',' TermArg {$$ = $2;}
+ ;
+
+
+BufferTerm
+ : PARSEOP_BUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_BUFFER);}
+ OptionalTermArg
+ ')' '{'
+ BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_BUFFER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+BufferTermData
+ : ByteList {}
+ | StringData {}
+ ;
+
+ByteList
+ : {$$ = NULL;}
+ | ByteConstExpr
+ ByteListTail {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+ByteListTail
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | ',' ByteConstExpr
+ ByteListTail {$$ = TrLinkPeerNode ($2,$3);}
+ ;
+
+DWordList
+ : {$$ = NULL;}
+ | DWordConstExpr
+ DWordListTail {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+DWordListTail
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | ',' DWordConstExpr
+ DWordListTail {$$ = TrLinkPeerNode ($2,$3);}
+ ;
+
+PackageTerm
+ : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_PACKAGE);}
+ PackageLengthTerm
+ ')' '{'
+ PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
+ VarPackageLengthTerm
+ ')' '{'
+ PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_PACKAGE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+PackageLengthTerm
+ : {$$ = NULL;}
+ | ByteConstExpr {}
+ ;
+
+VarPackageLengthTerm
+ : TermArg {}
+ ;
+
+PackageList
+ : {$$ = NULL;}
+ | PackageElement
+ PackageListTail {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+PackageListTail
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | ',' PackageElement
+ PackageListTail {$$ = TrLinkPeerNode ($2,$3);}
+ ;
+
+PackageElement
+ : DataObject {}
+ | NameString {}
+ ;
+
+EISAIDTerm
+ : PARSEOP_EISAID '('
+ StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);}
+ | PARSEOP_EISAID '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Resources and Memory ***********************************************/
+
+
+ResourceTemplateTerm
+ : PARSEOP_RESOURCETEMPLATE '(' ')'
+ '{'
+ ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,3,
+ TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
+ TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$5);}
+ ;
+
+UnicodeTerm
+ : PARSEOP_UNICODE '(' {$$ = TrCreateLeafNode (PARSEOP_UNICODE);}
+ StringData
+ ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);}
+ | PARSEOP_UNICODE '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+ResourceMacroList
+ : {$$ = NULL;}
+ | ResourceMacroTerm
+ ResourceMacroList {$$ = TrLinkPeerNode ($1,$2);}
+ ;
+
+ResourceMacroTerm
+ : DMATerm {}
+ | DWordIOTerm {}
+ | DWordMemoryTerm {}
+ | EndDependentFnTerm {}
+ | FixedIOTerm {}
+ | InterruptTerm {}
+ | IOTerm {}
+ | IRQNoFlagsTerm {}
+ | IRQTerm {}
+ | Memory24Term {}
+ | Memory32FixedTerm {}
+ | Memory32Term {}
+ | QWordIOTerm {}
+ | QWordMemoryTerm {}
+ | RegisterTerm {}
+ | StartDependentFnTerm {}
+ | StartDependentFnNoPriTerm {}
+ | VendorLongTerm {}
+ | VendorShortTerm {}
+ | WordBusNumberTerm {}
+ | WordIOTerm {}
+ ;
+
+DMATerm
+ : PARSEOP_DMA '(' {$$ = TrCreateLeafNode (PARSEOP_DMA);}
+ DMATypeKeyword
+ ',' BusMasterKeyword
+ ',' XferTypeKeyword
+ OptionalNameString_Last
+ ')' '{'
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$9,$12);}
+ | PARSEOP_DMA '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DWordIOTerm
+ : PARSEOP_DWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDIO);}
+ OptionalResourceType_First
+ OptionalMinType
+ OptionalMaxType
+ OptionalDecodeType
+ OptionalRangeType
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString
+ OptionalType
+ OptionalTranslationType_Last
+ ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
+ | PARSEOP_DWORDIO '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+DWordMemoryTerm
+ : PARSEOP_DWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);}
+ OptionalResourceType_First
+ OptionalDecodeType
+ OptionalMinType
+ OptionalMaxType
+ OptionalMemType
+ ',' ReadWriteKeyword
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString
+ OptionalAddressRange
+ OptionalType_Last
+ ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
+ | PARSEOP_DWORDMEMORY '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+EndDependentFnTerm
+ : PARSEOP_ENDDEPENDENTFN '('
+ ')' {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);}
+ | PARSEOP_ENDDEPENDENTFN '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+FixedIOTerm
+ : PARSEOP_FIXEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_FIXEDIO);}
+ WordConstExpr
+ ',' ByteConstExpr
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
+ | PARSEOP_FIXEDIO '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+InterruptTerm
+ : PARSEOP_INTERRUPT '(' {$$ = TrCreateLeafNode (PARSEOP_INTERRUPT);}
+ OptionalResourceType_First
+ ',' InterruptTypeKeyword
+ ',' InterruptLevel
+ OptionalShareType
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString_Last
+ ')' '{'
+ DWordList '}' {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);}
+ | PARSEOP_INTERRUPT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IOTerm
+ : PARSEOP_IO '(' {$$ = TrCreateLeafNode (PARSEOP_IO);}
+ IODecodeKeyword
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' ByteConstExpr
+ ',' ByteConstExpr
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
+ | PARSEOP_IO '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IRQNoFlagsTerm
+ : PARSEOP_IRQNOFLAGS '(' {$$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);}
+ OptionalNameString_First
+ ')' '{'
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_IRQNOFLAGS '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+IRQTerm
+ : PARSEOP_IRQ '(' {$$ = TrCreateLeafNode (PARSEOP_IRQ);}
+ InterruptTypeKeyword
+ ',' InterruptLevel
+ OptionalShareType
+ OptionalNameString_Last
+ ')' '{'
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$7,$8,$11);}
+ | PARSEOP_IRQ '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+Memory24Term
+ : PARSEOP_MEMORY24 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY24);}
+ ReadWriteKeyword
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
+ | PARSEOP_MEMORY24 '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+Memory32FixedTerm
+ : PARSEOP_MEMORY32FIXED '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);}
+ ReadWriteKeyword
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);}
+ | PARSEOP_MEMORY32FIXED '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+Memory32Term
+ : PARSEOP_MEMORY32 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32);}
+ ReadWriteKeyword
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ ',' DWordConstExpr
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
+ | PARSEOP_MEMORY32 '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+QWordIOTerm
+ : PARSEOP_QWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDIO);}
+ OptionalResourceType_First
+ OptionalMinType
+ OptionalMaxType
+ OptionalDecodeType
+ OptionalRangeType
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString
+ OptionalType
+ OptionalTranslationType_Last
+ ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
+ | PARSEOP_QWORDIO '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+QWordMemoryTerm
+ : PARSEOP_QWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);}
+ OptionalResourceType_First
+ OptionalDecodeType
+ OptionalMinType
+ OptionalMaxType
+ OptionalMemType
+ ',' ReadWriteKeyword
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ ',' QWordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString
+ OptionalAddressRange
+ OptionalType_Last
+ ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
+ | PARSEOP_QWORDMEMORY '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+RegisterTerm
+ : PARSEOP_REGISTER '(' {$$ = TrCreateLeafNode (PARSEOP_REGISTER);}
+ AddressSpaceKeyword
+ ',' ByteConstExpr
+ ',' ByteConstExpr
+ ',' QWordConstExpr
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$10);}
+ | PARSEOP_REGISTER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+StartDependentFnTerm
+ : PARSEOP_STARTDEPENDENTFN '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);}
+ ByteConstExpr
+ ',' ByteConstExpr
+ ')' '{'
+ ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$9);}
+ | PARSEOP_STARTDEPENDENTFN '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+StartDependentFnNoPriTerm
+ : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);}
+ ')' '{'
+ ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);}
+ | PARSEOP_STARTDEPENDENTFN_NOPRI '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+VendorLongTerm
+ : PARSEOP_VENDORLONG '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORLONG);}
+ OptionalNameString_First
+ ')' '{'
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_VENDORLONG '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+VendorShortTerm
+ : PARSEOP_VENDORSHORT '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);}
+ OptionalNameString_First
+ ')' '{'
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ | PARSEOP_VENDORSHORT '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+WordBusNumberTerm
+ : PARSEOP_WORDBUSNUMBER '(' {$$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);}
+ OptionalResourceType_First
+ OptionalMinType
+ OptionalMaxType
+ OptionalDecodeType
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);}
+ | PARSEOP_WORDBUSNUMBER '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+WordIOTerm
+ : PARSEOP_WORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_WORDIO);}
+ OptionalResourceType_First
+ OptionalMinType
+ OptionalMaxType
+ OptionalDecodeType
+ OptionalRangeType
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ ',' WordConstExpr
+ OptionalByteConstExpr
+ OptionalStringData
+ OptionalNameString
+ OptionalType
+ OptionalTranslationType_Last
+ ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
+ | PARSEOP_WORDIO '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+/******* Object References ***********************************************/
+
+
+NameString
+ : NameSeg {}
+ | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+ ;
+
+NameSeg
+ : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+ ;
+
+
+/******* Helper rules ****************************************************/
+
+
+AmlPackageLengthTerm
+ : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);}
+ ;
+
+OptionalAccessAttribTerm
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' ByteConstExpr {$$ = $2;}
+ | ',' AccessAttribKeyword {$$ = $2;}
+ ;
+
+OptionalAddressRange
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' AddressKeyword {$$ = $2;}
+ ;
+
+OptionalByteConstExpr
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' ByteConstExpr {$$ = $2;}
+ ;
+
+OptionalDecodeType
+ : ',' {$$ = NULL;}
+ | ',' DecodeKeyword {$$ = $2;}
+ ;
+
+OptionalDWordConstExpr
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' DWordConstExpr {$$ = $2;}
+ ;
+
+OptionalListString
+ : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */
+ | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */
+ | ',' TermArg {$$ = $2;}
+ ;
+
+OptionalMaxType
+ : ',' {$$ = NULL;}
+ | ',' MaxKeyword {$$ = $2;}
+ ;
+
+OptionalMemType
+ : ',' {$$ = NULL;}
+ | ',' MemTypeKeyword {$$ = $2;}
+ ;
+
+OptionalMinType
+ : ',' {$$ = NULL;}
+ | ',' MinKeyword {$$ = $2;}
+ ;
+
+OptionalNameString
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' NameString {$$ = $2;}
+ ;
+
+OptionalNameString_Last
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' NameString {$$ = $2;}
+ ;
+
+OptionalNameString_First
+ : {$$ = TrCreateLeafNode (PARSEOP_ZERO);}
+ | NameString {$$ = $1;}
+ ;
+
+OptionalObjectTypeKeyword
+ : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
+ | ',' ObjectTypeKeyword {$$ = $2;}
+ ;
+
+OptionalRangeType
+ : ',' {$$ = NULL;}
+ | ',' RangeTypeKeyword {$$ = $2;}
+ ;
+
+OptionalReference
+ : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
+ | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
+ | ',' DataObject {$$ = $2;}
+ | ',' NameString {$$ = $2;}
+ ;
+
+OptionalResourceType_First
+ : {$$ = NULL;}
+ | ResourceTypeKeyword {$$ = $1;}
+ ;
+
+OptionalSerializeRuleKeyword
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' SerializeRuleKeyword {$$ = $2;}
+ ;
+
+OptionalShareType
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' ShareTypeKeyword {$$ = $2;}
+ ;
+
+OptionalStringData
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' StringData {$$ = $2;}
+ ;
+
+OptionalTermArg
+ : {$$ = NULL;}
+ | TermArg {$$ = $1;}
+ ;
+
+OptionalType
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' TypeKeyword {$$ = $2;}
+ ;
+
+OptionalType_Last
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' TypeKeyword {$$ = $2;}
+ ;
+
+OptionalTranslationType_Last
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' TranslationKeyword {$$ = $2;}
+ ;
+
+
+TermArgItem
+ : ',' TermArg {$$ = $2;}
+ | ',' error {$$ = AslDoError (); yyclearin;}
+ ;
+
+NameStringItem
+ : ',' NameString {$$ = $2;}
+ | ',' error {$$ = AslDoError (); yyclearin;}
+ ;
+
+
+%%
+
+
+/*
+ * Local support functions
+ */
+
+int
+AslCompilerwrap(void)
+{
+ return 1;
+}
+
+/*! [End] no source code translation !*/
+
+void *
+AslLocalAllocate (unsigned int Size)
+{
+ void *Mem;
+
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size);
+
+ Mem = ACPI_MEM_CALLOCATE (Size);
+ if (!Mem)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ exit (1);
+ }
+
+ return (Mem);
+}
+
+ACPI_PARSE_OBJECT *
+AslDoError (void)
+{
+
+
+ return (TrCreateLeafNode (PARSEOP_ERRORNODE));
+
+}
diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c
new file mode 100644
index 0000000..6ab54ff
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslerror.c
@@ -0,0 +1,621 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslerror - Error handling and statistics
+ * $Revision: 82 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define ASL_EXCEPTIONS
+#include "aslcompiler.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslerror")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AeAddToErrorLog
+ *
+ * PARAMETERS: Enode - An error node to add to the log
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add a new error node to the error log. The error log is
+ * ordered by the "logical" line number (cumulative line number
+ * including all include files.)
+ *
+ ******************************************************************************/
+
+void
+AeAddToErrorLog (
+ ASL_ERROR_MSG *Enode)
+{
+ ASL_ERROR_MSG *Next;
+ ASL_ERROR_MSG *Prev;
+
+
+ if (!Gbl_ErrorLog)
+ {
+ Gbl_ErrorLog = Enode;
+ return;
+ }
+
+ /* List is sorted according to line number */
+
+ if (!Gbl_ErrorLog)
+ {
+ Gbl_ErrorLog = Enode;
+ return;
+ }
+
+ /* Walk error list until we find a line number greater than ours */
+
+ Prev = NULL;
+ Next = Gbl_ErrorLog;
+
+ while ((Next) &&
+ (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
+ {
+ Prev = Next;
+ Next = Next->Next;
+ }
+
+ /* Found our place in the list */
+
+ Enode->Next = Next;
+
+ if (Prev)
+ {
+ Prev->Next = Enode;
+ }
+ else
+ {
+ Gbl_ErrorLog = Enode;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AePrintException
+ *
+ * PARAMETERS: Where - Where to send the message
+ * Enode - Error node to print
+ * Header - Additional text before each message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the contents of an error node.
+ *
+ * NOTE: We don't use the FlxxxFile I/O functions here because on error
+ * they abort the compiler and call this function! Since we
+ * are reporting errors here, we ignore most output errors and
+ * just try to get out as much as we can.
+ *
+ ******************************************************************************/
+
+void
+AePrintException (
+ UINT32 FileId,
+ ASL_ERROR_MSG *Enode,
+ char *Header)
+{
+ UINT8 SourceByte;
+ UINT32 Actual;
+ UINT32 MsgLength;
+ char *MainMessage;
+ char *ExtraMessage;
+ UINT32 SourceColumn;
+ UINT32 ErrorColumn;
+ FILE *OutputFile;
+ FILE *SourceFile;
+
+
+ /* Only listing files have a header, and remarks/optimizations are always output */
+
+ if (!Header)
+ {
+ /* Ignore remarks if requested */
+
+ switch (Enode->Level)
+ {
+ case ASL_REMARK:
+ if (!Gbl_DisplayRemarks)
+ {
+ return;
+ }
+ break;
+
+ case ASL_OPTIMIZATION:
+ if (!Gbl_DisplayOptimizations)
+ {
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Get the file handles */
+
+ OutputFile = Gbl_Files[FileId].Handle;
+ SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
+
+ if (Header)
+ {
+ fprintf (OutputFile, "%s", Header);
+ }
+
+ /* Print filename and line number if present and valid */
+
+ if (Enode->Filename)
+ {
+ if (Gbl_VerboseErrors)
+ {
+ fprintf (OutputFile, "%6s", Enode->Filename);
+
+ if (Enode->LineNumber)
+ {
+ fprintf (OutputFile, "%6u: ", Enode->LineNumber);
+
+ /*
+ * Seek to the offset in the combined source file, read the source
+ * line, and write it to the output.
+ */
+ Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, SEEK_SET);
+ if (Actual)
+ {
+ fprintf (OutputFile, "[*** iASL: Seek error on source code temp file ***]");
+ }
+ else
+ {
+ Actual = fread (&SourceByte, 1, 1, SourceFile);
+ if (!Actual)
+ {
+ fprintf (OutputFile, "[*** iASL: Read error on source code temp file ***]");
+ }
+
+ else while (Actual && SourceByte && (SourceByte != '\n'))
+ {
+ fwrite (&SourceByte, 1, 1, OutputFile);
+ Actual = fread (&SourceByte, 1, 1, SourceFile);
+ }
+ }
+ fprintf (OutputFile, "\n");
+ }
+ }
+ else
+ {
+ fprintf (OutputFile, "%s", Enode->Filename);
+
+ if (Enode->LineNumber)
+ {
+ fprintf (OutputFile, "(%u) : ", Enode->LineNumber);
+ }
+ }
+ }
+
+ /* NULL message ID, just print the raw message */
+
+ if (Enode->MessageId == 0)
+ {
+ fprintf (OutputFile, "%s\n", Enode->Message);
+ }
+ else
+ {
+ /* Decode the message ID */
+
+ fprintf (OutputFile, "%s %4.4d -",
+ AslErrorLevel[Enode->Level],
+ Enode->MessageId + ((Enode->Level+1) * 1000));
+
+ MainMessage = AslMessages[Enode->MessageId];
+ ExtraMessage = Enode->Message;
+
+ if (Enode->LineNumber)
+ {
+ MsgLength = strlen (MainMessage);
+ if (MsgLength == 0)
+ {
+ MainMessage = Enode->Message;
+
+ MsgLength = strlen (MainMessage);
+ ExtraMessage = NULL;
+ }
+
+ if (Gbl_VerboseErrors)
+ {
+ SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
+ ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
+
+ if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
+ {
+ fprintf (OutputFile, "%*s%s",
+ (int) ((SourceColumn - 1) - ErrorColumn),
+ MainMessage, " ^ ");
+ }
+ else
+ {
+ fprintf (OutputFile, "%*s %s",
+ (int) ((SourceColumn - ErrorColumn) + 1), "^",
+ MainMessage);
+ }
+ }
+ else
+ {
+ fprintf (OutputFile, " %s", MainMessage);
+ }
+
+ /* Print the extra info message if present */
+
+ if (ExtraMessage)
+ {
+ fprintf (OutputFile, " (%s)", ExtraMessage);
+ }
+
+ fprintf (OutputFile, "\n");
+ if (Gbl_VerboseErrors)
+ {
+ fprintf (OutputFile, "\n");
+ }
+ }
+ else
+ {
+ fprintf (OutputFile, " %s %s\n\n",
+ MainMessage,
+ ExtraMessage);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AePrintErrorLog
+ *
+ * PARAMETERS: FileId - Where to output the error log
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the entire contents of the error log
+ *
+ ******************************************************************************/
+
+void
+AePrintErrorLog (
+ UINT32 FileId)
+{
+ ASL_ERROR_MSG *Enode = Gbl_ErrorLog;
+
+
+ /* Walk the error node list */
+
+ while (Enode)
+ {
+ AePrintException (FileId, Enode, NULL);
+ Enode = Enode->Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCommonError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * CurrentLineNumber - Actual file line number
+ * LogicalLineNumber - Cumulative line number
+ * LogicalByteOffset - Byte offset in source file
+ * Column - Column in current line
+ * Filename - source filename
+ * ExtraMessage - additional error message
+ *
+ * RETURN: New error node for this error
+ *
+ * DESCRIPTION: Create a new error node and add it to the error log
+ *
+ ******************************************************************************/
+
+void
+AslCommonError (
+ UINT8 Level,
+ UINT8 MessageId,
+ UINT32 CurrentLineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+ char *ExtraMessage)
+{
+ UINT32 MessageSize;
+ char *MessageBuffer = NULL;
+ ASL_ERROR_MSG *Enode;
+
+
+ Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
+
+ if (ExtraMessage)
+ {
+ /* Allocate a buffer for the message and a new error node */
+
+ MessageSize = strlen (ExtraMessage) + 1;
+ MessageBuffer = UtLocalCalloc (MessageSize);
+
+ /* Keep a copy of the extra message */
+
+ ACPI_STRCPY (MessageBuffer, ExtraMessage);
+ }
+
+ /* Initialize the error node */
+
+ if (Filename)
+ {
+ Enode->Filename = Filename;
+ Enode->FilenameLength = strlen (Filename);
+ if (Enode->FilenameLength < 6)
+ {
+ Enode->FilenameLength = 6;
+ }
+ }
+
+ Enode->MessageId = MessageId;
+ Enode->Level = Level;
+ Enode->LineNumber = CurrentLineNumber;
+ Enode->LogicalLineNumber = LogicalLineNumber;
+ Enode->LogicalByteOffset = LogicalByteOffset;
+ Enode->Column = Column;
+ Enode->Message = MessageBuffer;
+
+ /* Add the new node to the error node list */
+
+ AeAddToErrorLog (Enode);
+
+ if (Gbl_DebugFlag)
+ {
+ /* stderr is a file, send error to it immediately */
+
+ AePrintException (ASL_FILE_STDERR, Enode, NULL);
+ }
+
+ Gbl_ExceptionCount[Level]++;
+ if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
+ {
+ printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+
+ Gbl_SourceLine = 0;
+ Gbl_NextError = Gbl_ErrorLog;
+ CmDoOutputFiles ();
+ CmCleanupAndExit ();
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * Op - Parse node where error happened
+ * ExtraMessage - additional error message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Main error reporting routine for the ASL compiler (all code
+ * except the parser.)
+ *
+ ******************************************************************************/
+
+void
+AslError (
+ UINT8 Level,
+ UINT8 MessageId,
+ ACPI_PARSE_OBJECT *Op,
+ char *ExtraMessage)
+{
+
+ if (Op)
+ {
+ AslCommonError (Level, MessageId, Op->Asl.LineNumber,
+ Op->Asl.LogicalLineNumber,
+ Op->Asl.LogicalByteOffset,
+ Op->Asl.Column,
+ Op->Asl.Filename, ExtraMessage);
+ }
+ else
+ {
+ AslCommonError (Level, MessageId, 0,
+ 0, 0, 0, NULL, ExtraMessage);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCoreSubsystemError
+ *
+ * PARAMETERS: Op - Parse node where error happened
+ * Status - The ACPI CA Exception
+ * ExtraMessage - additional error message
+ * Abort - TRUE -> Abort compilation
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI
+ * CA core subsystem.
+ *
+ ******************************************************************************/
+
+void
+AslCoreSubsystemError (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS Status,
+ char *ExtraMessage,
+ BOOLEAN Abort)
+{
+
+ sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage);
+
+ if (Op)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber,
+ Op->Asl.LogicalLineNumber,
+ Op->Asl.LogicalByteOffset,
+ Op->Asl.Column,
+ Op->Asl.Filename, MsgBuffer);
+ }
+ else
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0,
+ 0, 0, 0, NULL, MsgBuffer);
+ }
+
+ if (Abort)
+ {
+ AslAbort ();
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCompilererror
+ *
+ * PARAMETERS: CompilerMessage - Error message from the parser
+ *
+ * RETURN: Status?
+ *
+ * DESCRIPTION: Report an error situation discovered in a production
+ * NOTE: don't change the name of this function.
+ *
+ ******************************************************************************/
+
+int
+AslCompilererror (
+ char *CompilerMessage)
+{
+
+ AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
+ Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
+ Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
+ CompilerMessage);
+
+ return 0;
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c
new file mode 100644
index 0000000..35c3122
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -0,0 +1,839 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslfiles - file I/O suppoert
+ * $Revision: 46 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "aslcompiler.h"
+#include "acapps.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslfiles")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslAbort
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
+ * I/O errors
+ *
+ ******************************************************************************/
+
+void
+AslAbort (void)
+{
+
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ if (Gbl_DebugFlag)
+ {
+ /* Print error summary to the debug file */
+
+ AePrintErrorLog (ASL_FILE_STDERR);
+ }
+
+ exit (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenLocalFile
+ *
+ * PARAMETERS: LocalName - Single filename (not a pathname)
+ * Mode - Open mode for fopen
+ *
+ * RETURN: File descriptor
+ *
+ * DESCRIPTION: Build a complete pathname for the input filename and open
+ * the file.
+ *
+ ******************************************************************************/
+
+FILE *
+FlOpenLocalFile (
+ char *LocalName,
+ char *Mode)
+{
+
+ strcpy (StringBuffer, Gbl_DirectoryPath);
+ strcat (StringBuffer, LocalName);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer);
+ return (fopen (StringBuffer, (const char *) Mode));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlFileError
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * ErrorId - Index into error message array
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode errno to an error message and add the entire error
+ * to the error log.
+ *
+ ******************************************************************************/
+
+void
+FlFileError (
+ UINT32 FileId,
+ UINT8 ErrorId)
+{
+
+ sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, strerror (errno));
+ AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * Filename - file pathname to open
+ * Mode - Open mode for fopen
+ *
+ * RETURN: File descriptor
+ *
+ * DESCRIPTION: Open a file.
+ * NOTE: Aborts compiler on any error.
+ *
+ ******************************************************************************/
+
+void
+FlOpenFile (
+ UINT32 FileId,
+ char *Filename,
+ char *Mode)
+{
+ FILE *File;
+
+
+ File = fopen (Filename, Mode);
+
+ Gbl_Files[FileId].Filename = Filename;
+ Gbl_Files[FileId].Handle = File;
+
+ if (!File)
+ {
+ FlFileError (FileId, ASL_MSG_OPEN);
+ AslAbort ();
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlReadFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * Buffer - Where to place the data
+ * Length - Amount to read
+ *
+ * RETURN: Status. AE_ERROR indicates EOF.
+ *
+ * DESCRIPTION: Read data from an open file.
+ * NOTE: Aborts compiler on any error.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlReadFile (
+ UINT32 FileId,
+ void *Buffer,
+ UINT32 Length)
+{
+ UINT32 Actual;
+
+
+ /* Read and check for error */
+
+ Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle);
+ if (Actual != Length)
+ {
+ if (feof (Gbl_Files[FileId].Handle))
+ {
+ /* End-of-file, just return error */
+
+ return (AE_ERROR);
+ }
+
+ FlFileError (FileId, ASL_MSG_READ);
+ AslAbort ();
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlWriteFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * Buffer - Data to write
+ * Length - Amount of data to write
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Write data to an open file.
+ * NOTE: Aborts compiler on any error.
+ *
+ ******************************************************************************/
+
+void
+FlWriteFile (
+ UINT32 FileId,
+ void *Buffer,
+ UINT32 Length)
+{
+ UINT32 Actual;
+
+
+ /* Write and check for error */
+
+ Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle);
+ if (Actual != Length)
+ {
+ FlFileError (FileId, ASL_MSG_WRITE);
+ AslAbort ();
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlPrintFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * Format - Printf format string
+ * ... - Printf arguments
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Formatted write to an open file.
+ * NOTE: Aborts compiler on any error.
+ *
+ ******************************************************************************/
+
+void
+FlPrintFile (
+ UINT32 FileId,
+ char *Format,
+ ...)
+{
+ INT32 Actual;
+ va_list Args;
+
+
+ va_start (Args, Format);
+
+ Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
+ if (Actual == -1)
+ {
+ FlFileError (FileId, ASL_MSG_WRITE);
+ AslAbort ();
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSeekFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ * Offset - Absolute byte offset in file
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Seek to absolute offset
+ * NOTE: Aborts compiler on any error.
+ *
+ ******************************************************************************/
+
+void
+FlSeekFile (
+ UINT32 FileId,
+ long Offset)
+{
+ int Error;
+
+
+ Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET);
+ if (Error)
+ {
+ FlFileError (FileId, ASL_MSG_SEEK);
+ AslAbort ();
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlCloseFile
+ *
+ * PARAMETERS: FileId - Index into file info array
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Close an open file. Aborts compiler on error
+ *
+ ******************************************************************************/
+
+void
+FlCloseFile (
+ UINT32 FileId)
+{
+ int Error;
+
+
+ if (!Gbl_Files[FileId].Handle)
+ {
+ return;
+ }
+
+ Error = fclose (Gbl_Files[FileId].Handle);
+ Gbl_Files[FileId].Handle = NULL;
+
+ if (Error)
+ {
+ FlFileError (FileId, ASL_MSG_CLOSE);
+ AslAbort ();
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSetLineNumber
+ *
+ * PARAMETERS: Op - Parse node for the LINE asl statement
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Set the current line number
+ *
+ ******************************************************************************/
+
+void
+FlSetLineNumber (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ Gbl_CurrentLineNumber = (UINT32) Op->Asl.Value.Integer;
+ Gbl_LogicalLineNumber = (UINT32) Op->Asl.Value.Integer;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenIncludeFile
+ *
+ * PARAMETERS: Op - Parse node for the INCLUDE ASL statement
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Open an include file and push it on the input file stack.
+ *
+ ******************************************************************************/
+
+void
+FlOpenIncludeFile (
+ ACPI_PARSE_OBJECT *Op)
+{
+ FILE *IncFile;
+
+
+ /* Op must be valid */
+
+ if (!Op)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node");
+
+ return;
+ }
+
+ /*
+ * Flush out the "include ()" statement on this line, start
+ * the actual include file on the next line
+ */
+ ResetCurrentLineBuffer ();
+ FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
+ Gbl_CurrentLineOffset++;
+
+ /* Prepend the directory pathname and open the include file */
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", Op->Asl.Value.String);
+ IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r");
+ if (!IncFile)
+ {
+ sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno));
+ AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
+ return;
+ }
+
+ /* Push the include file on the open input file stack */
+
+ AslPushInputFileStack (IncFile, Op->Asl.Value.String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlParseInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlParseInputPathname (
+ char *InputFilename)
+{
+ char *Substring;
+
+
+ if (!InputFilename)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ Gbl_DirectoryPath = strdup (InputFilename);
+ if (!Gbl_DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (Gbl_DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (Gbl_DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (Gbl_DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ Gbl_DirectoryPath[0] = 0;
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = strdup (InputFilename);
+ }
+ }
+ else
+ {
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = strdup (Substring + 1);
+ }
+ *(Substring+1) = 0;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenInputFile
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Open the specified input file, and save the directory path to
+ * the file so that include files can be opened in
+ * the same directory.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlOpenInputFile (
+ char *InputFilename)
+{
+
+
+ /* Open the input ASL file, text mode */
+
+ FlOpenFile (ASL_FILE_INPUT, InputFilename, "r");
+ AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle;
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenAmlOutputFile
+ *
+ * PARAMETERS: FilenamePrefix - The user-specified ASL source file
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create the output filename (*.AML) and open the file. The file
+ * is created in the same directory as the parent input file.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlOpenAmlOutputFile (
+ char *FilenamePrefix)
+{
+ char *Filename;
+
+
+ /* Output filename usually comes from the ASL itself */
+
+ Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename;
+ if (!Filename)
+ {
+ /* Create the output AML filename */
+
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+ }
+
+ /* Open the output AML file in binary mode */
+
+ FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlOpenMiscOutputFiles
+ *
+ * PARAMETERS: FilenamePrefix - The user-specified ASL source file
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create and open the various output files needed, depending on
+ * the command line options
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlOpenMiscOutputFiles (
+ char *FilenamePrefix)
+{
+ char *Filename;
+
+
+ /* Create/Open a combined source output file */
+
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /*
+ * Open the source output file, binary mode (so that LF does not get
+ * expanded to CR/LF on some systems, messing up our seek
+ * calculations.)
+ */
+ FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b");
+
+ /* Create/Open a listing output file if asked */
+
+ if (Gbl_ListingFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the listing file, text mode */
+
+ FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_LISTING_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
+ }
+
+ /* Create/Open a assembly code source output file if asked */
+
+ if (Gbl_AsmOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the assembly code source file, text mode */
+
+ FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT);
+ }
+
+ /* Create/Open a C code source output file if asked */
+
+ if (Gbl_C_OutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the C code source file, text mode */
+
+ FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+");
+
+ FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n");
+ AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT);
+ }
+
+ /* Create/Open a assembly include output file if asked */
+
+ if (Gbl_AsmIncludeOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the assembly include file, text mode */
+
+ FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT);
+ }
+
+ /* Create/Open a C include output file if asked */
+
+ if (Gbl_C_IncludeOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the C include file, text mode */
+
+ FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+");
+
+ FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n");
+ AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT);
+ }
+
+ /* Create/Open a hex output file if asked */
+
+ if (Gbl_HexOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the hex file, text mode */
+
+ FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
+ }
+
+ /* Create a namespace output file if asked */
+
+ if (Gbl_NsOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the namespace file, text mode */
+
+ FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
+ }
+
+ /* Create/Open a debug output file if asked */
+
+ if (Gbl_DebugFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the debug file as STDERR, text mode */
+
+ /* TBD: hide this behind a FlReopenFile function */
+
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr);
+
+ AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
+ }
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c
new file mode 100644
index 0000000..3dbcf59
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslfold.c
@@ -0,0 +1,532 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslfold - Constant folding
+ * $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+#include "acdispat.h"
+#include "acparser.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslfold")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlEvaluationWalk1
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for AML execution of constant subtrees
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlEvaluationWalk1 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = Context;
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *OutOp;
+
+
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Copy child pointer to Arg for compatibility with Interpreter */
+
+ if (Op->Asl.Child)
+ {
+ Op->Common.Value.Arg = Op->Asl.Child;
+ }
+
+ /* Call AML dispatcher */
+
+ Status = AcpiDsExecBeginOp (WalkState, &OutOp);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Constant interpretation failed - %s\n",
+ AcpiFormatException (Status));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlEvaluationWalk2
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for AML execution of constant subtrees
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlEvaluationWalk2 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = Context;
+ ACPI_STATUS Status;
+
+
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Copy child pointer to Arg for compatibility with Interpreter */
+
+ if (Op->Asl.Child)
+ {
+ Op->Common.Value.Arg = Op->Asl.Child;
+ }
+
+ /* Call AML dispatcher */
+
+ Status = AcpiDsExecEndOp (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Constant interpretation failed - %s\n",
+ AcpiFormatException (Status));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlCheckForConstant
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlCheckForConstant (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = Context;
+
+
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ",
+ Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName);
+
+ if (!(WalkState->OpInfo->Flags & AML_CONSTANT))
+ {
+ /* The opcode is not a Type 3/4/5 opcode */
+
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, "**** Valid Target, cannot reduce ****\n");
+ }
+ else
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, "**** Not a Type 3/4/5 opcode ****\n");
+ }
+
+ if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL)
+ {
+ /*
+ * We are looking at at normal expression to see if it can be
+ * reduced. It can't. No error
+ */
+ return (AE_TYPE);
+ }
+
+ /*
+ * This is an expression that MUST reduce to a constant, and it
+ * can't be reduced. This is an error
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, Op->Asl.ParseOpName);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, Op->Asl.ParseOpName);
+ }
+
+ return (AE_TYPE);
+ }
+
+ /* Debug output */
+
+ DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345");
+
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, " TARGET");
+ }
+ if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, " TERMARG");
+ }
+ DbgPrint (ASL_PARSE_OUTPUT, "\n");
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlConstantWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Reduce an Op and its subtree to a constant if possible
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlConstantWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_PARSE_OBJECT *RootOp;
+ ACPI_PARSE_OBJECT *OriginalParentOp;
+ UINT8 WalkType;
+
+
+ /*
+ * Only interested in subtrees that could possibly contain
+ * expressions that can be evaluated at this time
+ */
+ if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) ||
+ (Op->Asl.CompileFlags & NODE_IS_TARGET))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Set the walk type based on the reduction used for this op
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
+ {
+ /* Op is a TermArg, constant folding is merely optional */
+
+ if (!Gbl_FoldConstants)
+ {
+ return (AE_CTRL_DEPTH);
+ }
+
+ WalkType = ACPI_WALK_CONST_OPTIONAL;
+ }
+ else
+ {
+ /* Op is a DataObject, the expression MUST reduced to a constant */
+
+ WalkType = ACPI_WALK_CONST_REQUIRED;
+ }
+
+ /* Create a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ WalkState->NextOp = NULL;
+ WalkState->Params = NULL;
+ WalkState->CallerReturnDesc = &ObjDesc;
+ WalkState->WalkType = WalkType;
+
+ /* Examine the entire subtree -- all nodes must be constants or type 3/4/5 opcodes */
+
+ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
+ OpcAmlCheckForConstant, NULL, WalkState);
+
+ /*
+ * Did we find an entire subtree that contains all constants and type 3/4/5
+ * opcodes? (Only AE_OK or AE_TYPE returned from above)
+ */
+ if (Status == AE_TYPE)
+ {
+ /* Subtree cannot be reduced to a constant */
+
+ if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL)
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return (AE_OK);
+ }
+
+ /* Don't descend any further, and use a default "constant" value */
+
+ Status = AE_CTRL_DEPTH;
+ }
+ else
+ {
+ /* Subtree can be reduced */
+
+ /* Allocate a new temporary root for this subtree */
+
+ RootOp = TrAllocateNode (PARSEOP_INTEGER);
+ if (!RootOp)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP;
+
+ OriginalParentOp = Op->Common.Parent;
+ Op->Common.Parent = RootOp;
+
+ /*
+ * Hand off the subtree to the AML interpreter
+ */
+ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
+ Op->Common.Parent = OriginalParentOp;
+
+ /* TBD: we really *should* release the RootOp node */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ TotalFolds++;
+
+ /* Get the final result */
+
+ Status = AcpiDsResultPop (&ObjDesc, WalkState);
+ }
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* We could not resolve the subtree for some reason */
+
+ AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, Op->Asl.ParseOpName);
+
+ /* Set the subtree value to ZERO anyway. Eliminates further errors */
+
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Common.Value.Integer = 0;
+ OpcSetOptimalIntegerSize (Op);
+ }
+ else
+ {
+ AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName);
+
+ /*
+ * Because we know we executed type 3/4/5 opcodes above, we know that
+ * the result must be either an Integer, String, or Buffer.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Common.Value.Integer = ObjDesc->Integer.Value;
+ OpcSetOptimalIntegerSize (Op);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
+ Op->Common.AmlOpcode = AML_STRING_OP;
+ Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
+ Op->Common.Value.String = ObjDesc->String.Pointer;
+
+ DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (STRING) %s\n",
+ Op->Common.Value.String);
+
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+ Op->Common.AmlOpcode = AML_BUFFER_OP;
+ UtSetParseOpName (Op);
+
+ /* Child node is the buffer length */
+
+ RootOp = TrAllocateNode (PARSEOP_INTEGER);
+
+ RootOp->Asl.AmlOpcode = AML_DWORD_OP;
+ RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
+ RootOp->Asl.Parent = Op;
+
+ (void) OpcSetOptimalIntegerSize (RootOp);
+
+ Op->Asl.Child = RootOp;
+ Op = RootOp;
+ UtSetParseOpName (Op);
+
+ /* Peer to the child is the raw buffer data */
+
+ RootOp = TrAllocateNode (PARSEOP_RAW_DATA);
+ RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
+ RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
+ RootOp->Asl.Parent = Op->Asl.Parent;
+
+ Op->Asl.Next = RootOp;
+ Op = RootOp;
+
+ DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (BUFFER) length %X\n",
+ ObjDesc->Buffer.Length);
+ break;
+
+
+ default:
+ printf ("Unsupported return type: %s\n",
+ AcpiUtGetObjectTypeName (ObjDesc));
+ break;
+ }
+ }
+
+ UtSetParseOpName (Op);
+ Op->Asl.Child = NULL;
+
+ AcpiDsDeleteWalkState (WalkState);
+
+ return (AE_CTRL_DEPTH);
+}
+
diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h
new file mode 100644
index 0000000..4ffd5c5
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslglobal.h
@@ -0,0 +1,267 @@
+
+
+/******************************************************************************
+ *
+ * Module Name: aslglobal.h - Global variable definitions
+ * $Revision: 42 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ASLGLOBAL_H
+#define __ASLGLOBAL_H
+
+
+/*
+ * Global variables. Defined in aslmain.c only, externed in all other files
+ */
+
+#ifdef _DECLARE_GLOBALS
+#define ASL_EXTERN
+#define ASL_INIT_GLOBAL(a,b) (a)=(b)
+#else
+#define ASL_EXTERN extern
+#define ASL_INIT_GLOBAL(a,b) (a)
+#endif
+
+
+/*
+ * Parser and other externals
+ */
+extern int yydebug;
+extern FILE *AslCompilerin;
+extern int AslCompilerdebug;
+extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
+extern char *AslCompilertext;
+extern char hex[];
+
+#define ASL_LINE_BUFFER_SIZE 512
+#define ASL_MSG_BUFFER_SIZE (ASL_LINE_BUFFER_SIZE * 2)
+#define HEX_TABLE_LINE_SIZE 8
+#define HEX_LISTING_LINE_SIZE 16
+
+
+/* Source code buffers and pointers for error reporting */
+
+ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE];
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer);
+
+
+/* Exception reporting */
+
+ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL);
+ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL);
+extern UINT32 Gbl_ExceptionCount[];
+
+
+/* Option flags */
+
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GenerateExternals, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
+
+#define HEX_OUTPUT_NONE 0
+#define HEX_OUTPUT_C 1
+#define HEX_OUTPUT_ASM 2
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
+
+
+/* Files */
+
+ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES];
+
+ASL_EXTERN char *Gbl_DirectoryPath;
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
+ASL_EXTERN char *Gbl_CurrentInputFilename;
+
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
+
+
+/* Statistics */
+
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0);
+
+
+/* Misc */
+
+ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0);
+ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL);
+ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL);
+ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TempCount, 0);
+ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
+
+
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0);
+ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG");
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID");
+ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */
+
+
+/* Static structures */
+
+ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo;
+ASL_EXTERN ACPI_TABLE_HEADER TableHeader;
+extern const ASL_RESERVED_INFO ReservedMethods[];
+ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[21];
+
+
+/* Scratch buffers */
+
+ASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE];
+ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE];
+ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE];
+ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE];
+
+#endif /* __ASLGLOBAL_H */
+
diff --git a/sys/contrib/dev/acpica/compiler/asllength.c b/sys/contrib/dev/acpica/compiler/asllength.c
new file mode 100644
index 0000000..5bf81ef
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asllength.c
@@ -0,0 +1,504 @@
+
+/******************************************************************************
+ *
+ * Module Name: asllength - Tree walk to determine package and opcode lengths
+ * $Revision: 30 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asllength")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LnInitLengthsWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk callback to initialize (and re-initialize) the node
+ * subtree length(s) to zero. The Subtree lengths are bubbled
+ * up to the root node in order to get a total AML length.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LnInitLengthsWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ Op->Asl.AmlSubtreeLength = 0;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LnPackageLengthWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk callback to calculate the total AML length.
+ * 1) Calculate the AML lengths (opcode, package length, etc.) for
+ * THIS node.
+ * 2) Bubbble up all of these lengths to the parent node by summing
+ * them all into the parent subtree length.
+ *
+ * Note: The SubtreeLength represents the total AML length of all child nodes
+ * in all subtrees under a given node. Therefore, once this walk is
+ * complete, the Root Node subtree length is the AML length of the entire
+ * tree (and thus, the entire ACPI table)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LnPackageLengthWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ /* Generate the AML lengths for this node */
+
+ CgGenerateAmlLengths (Op);
+
+ /* Bubble up all lengths (this node and all below it) to the parent */
+
+ if ((Op->Asl.Parent) &&
+ (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength +
+ Op->Asl.AmlOpcodeLength +
+ Op->Asl.AmlPkgLenBytes +
+ Op->Asl.AmlSubtreeLength);
+ }
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LnAdjustLengthToRoot
+ *
+ * PARAMETERS: Op - Node whose Length was changed
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Change the Subtree length of the given node, and bubble the
+ * change all the way up to the root node. This allows for
+ * last second changes to a package length (for example, if the
+ * package length encoding gets shorter or longer.)
+ *
+ ******************************************************************************/
+
+void
+LnAdjustLengthToRoot (
+ ACPI_PARSE_OBJECT *SubtreeOp,
+ UINT32 LengthDelta)
+{
+ ACPI_PARSE_OBJECT *Op;
+
+
+ /* Adjust all subtree lengths up to the root */
+
+ Op = SubtreeOp->Asl.Parent;
+ while (Op)
+ {
+ Op->Asl.AmlSubtreeLength -= LengthDelta;
+ Op = Op->Asl.Parent;
+ }
+
+ /* Adjust the global table length */
+
+ Gbl_TableLength -= LengthDelta;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgGetPackageLenByteCount
+ *
+ * PARAMETERS: Op - Parse node
+ * PackageLength - Length to be encoded
+ *
+ * RETURN: Required length of the package length encoding
+ *
+ * DESCRIPTION: Calculate the number of bytes required to encode the given
+ * package length.
+ *
+ ******************************************************************************/
+
+UINT8
+CgGetPackageLenByteCount (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 PackageLength)
+{
+
+ /*
+ * Determine the number of bytes required to encode the package length
+ * Note: the package length includes the number of bytes used to encode
+ * the package length, so we must account for this also.
+ */
+ if (PackageLength <= (0x0000003F - 1))
+ {
+ return (1);
+ }
+ else if (PackageLength <= (0x00000FFF - 2))
+ {
+ return (2);
+ }
+ else if (PackageLength <= (0x000FFFFF - 3))
+ {
+ return (3);
+ }
+ else if (PackageLength <= (0x0FFFFFFF - 4))
+ {
+ return (4);
+ }
+ else
+ {
+ /* Fatal error - the package length is too large to encode */
+
+ AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL);
+ }
+
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgGenerateAmlOpcodeLength
+ *
+ * PARAMETERS: Op - Parse node whose AML opcode lengths will be
+ * calculated
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength
+ * fields for this node.
+ *
+ ******************************************************************************/
+
+void
+CgGenerateAmlOpcodeLength (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ /* Check for two-byte opcode */
+
+ if (Op->Asl.AmlOpcode > 0x00FF)
+ {
+ Op->Asl.AmlOpcodeLength = 2;
+ }
+ else
+ {
+ Op->Asl.AmlOpcodeLength = 1;
+ }
+
+ /* Does this opcode have an associated "PackageLength" field? */
+
+ Op->Asl.AmlPkgLenBytes = 0;
+ if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
+ {
+ Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, Op->Asl.AmlSubtreeLength);
+ }
+
+ /* Data opcode lengths are easy */
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_BYTE_OP:
+
+ Op->Asl.AmlLength = 1;
+ break;
+
+ case AML_WORD_OP:
+
+ Op->Asl.AmlLength = 2;
+ break;
+
+ case AML_DWORD_OP:
+
+ Op->Asl.AmlLength = 4;
+ break;
+
+ case AML_QWORD_OP:
+
+ Op->Asl.AmlLength = 8;
+ break;
+
+ default:
+ /* All data opcodes must be above */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgGenerateAmlLengths
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Generate internal length fields based on the AML opcode or
+ * parse opcode.
+ *
+ ******************************************************************************/
+
+void
+CgGenerateAmlLengths (
+ ACPI_PARSE_OBJECT *Op)
+{
+ char *Buffer;
+ ACPI_STATUS Status;
+
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_RAW_DATA_BYTE:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlLength = 1;
+ return;
+
+ case AML_RAW_DATA_WORD:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlLength = 2;
+ return;
+
+ case AML_RAW_DATA_DWORD:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlLength = 4;
+ return;
+
+ case AML_RAW_DATA_QWORD:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlLength = 8;
+ return;
+
+ case AML_RAW_DATA_BUFFER:
+
+ /* Aml length is/was set by creator */
+
+ Op->Asl.AmlOpcodeLength = 0;
+ return;
+
+ case AML_RAW_DATA_CHAIN:
+
+ /* Aml length is/was set by creator */
+
+ Op->Asl.AmlOpcodeLength = 0;
+ return;
+
+ default:
+ break;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+
+ Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
+ break;
+
+ case PARSEOP_NAMESEG:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlLength = 4;
+ Op->Asl.ExternalName = Op->Asl.Value.String;
+ break;
+
+ case PARSEOP_NAMESTRING:
+ case PARSEOP_METHODCALL:
+
+ if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED)
+ {
+ break;
+ }
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Status = UtInternalizeName (Op->Asl.Value.String, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "Failure from internalize name %X\n", Status);
+ break;
+ }
+
+ Op->Asl.ExternalName = Op->Asl.Value.String;
+ Op->Asl.Value.String = Buffer;
+ Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED;
+
+ Op->Asl.AmlLength = strlen (Buffer);
+
+ /*
+ * Check for single backslash reference to root,
+ * make it a null terminated string in the AML
+ */
+ if (Op->Asl.AmlLength == 1)
+ {
+ Op->Asl.AmlLength = 2;
+ }
+ break;
+
+ case PARSEOP_STRING_LITERAL:
+
+ Op->Asl.AmlOpcodeLength = 1;
+ Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; /* Get null terminator */
+ break;
+
+ case PARSEOP_PACKAGE_LENGTH:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, (UINT32) Op->Asl.Value.Integer);
+ break;
+
+ case PARSEOP_RAW_DATA:
+
+ Op->Asl.AmlOpcodeLength = 0;
+ break;
+
+ case PARSEOP_DEFAULT_ARG:
+ case PARSEOP_EXTERNAL:
+ case PARSEOP_INCLUDE:
+ case PARSEOP_INCLUDE_END:
+
+ /* Ignore the "default arg" nodes, they are extraneous at this point */
+
+ break;
+
+ default:
+
+ CgGenerateAmlOpcodeLength (Op);
+ break;
+ }
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c
new file mode 100644
index 0000000..8d3d09c
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asllisting.c
@@ -0,0 +1,1319 @@
+
+/******************************************************************************
+ *
+ * Module Name: asllisting - Listing file generation
+ * $Revision: 50 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslisting")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDumpAscii
+ *
+ * PARAMETERS: FileId - ID of current listing file
+ * Count - Number of bytes to convert
+ * Buffer - Buffer of bytes to convert
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Convert hex bytes to ascii
+ *
+ ******************************************************************************/
+
+void
+LsDumpAscii (
+ UINT32 FileId,
+ UINT32 Count,
+ UINT8 *Buffer)
+{
+ UINT8 BufChar;
+ UINT32 i;
+
+
+ FlPrintFile (FileId, " \"");
+ for (i = 0; i < Count; i++)
+ {
+ BufChar = Buffer[i];
+ if (isprint (BufChar))
+ {
+ FlPrintFile (FileId, "%c", BufChar);
+ }
+ else
+ {
+ /* Not a printable character, just put out a dot */
+
+ FlPrintFile (FileId, ".");
+ }
+ }
+ FlPrintFile (FileId, "\"");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDumpAsciiInComment
+ *
+ * PARAMETERS: FileId - ID of current listing file
+ * Count - Number of bytes to convert
+ * Buffer - Buffer of bytes to convert
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Convert hex bytes to ascii
+ *
+ ******************************************************************************/
+
+void
+LsDumpAsciiInComment (
+ UINT32 FileId,
+ UINT32 Count,
+ UINT8 *Buffer)
+{
+ UINT8 BufChar = 0;
+ UINT8 LastChar;
+ UINT32 i;
+
+
+ FlPrintFile (FileId, " \"");
+ for (i = 0; i < Count; i++)
+ {
+ LastChar = BufChar;
+ BufChar = Buffer[i];
+
+ if (isprint (BufChar))
+ {
+ /* Handle embedded C comment sequences */
+
+ if (((LastChar == '*') && (BufChar == '/')) ||
+ ((LastChar == '/') && (BufChar == '*')))
+ {
+ /* Insert a space to break the sequence */
+
+ FlPrintFile (FileId, ".", BufChar);
+ }
+
+ FlPrintFile (FileId, "%c", BufChar);
+ }
+ else
+ {
+ /* Not a printable character, just put out a dot */
+
+ FlPrintFile (FileId, ".");
+ }
+ }
+ FlPrintFile (FileId, "\"");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsAmlListingWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Process one node during a listing file generation.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsAmlListingWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ UINT8 FileByte;
+ UINT32 i;
+ UINT32 FileId = (UINT32) Context;
+
+
+ LsWriteNodeToListing (Op, FileId);
+
+ /* Write the hex bytes to the listing file(s) (if requested) */
+
+ for (i = 0; i < Op->Asl.FinalAmlLength; i++)
+ {
+ if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1)))
+ {
+ FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
+ AslAbort ();
+ }
+ LsWriteListingHexBytes (&FileByte, 1, FileId);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsGenerateListing
+ *
+ * PARAMETERS: FileId - ID of listing file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generate a listing file. This can be one of the several types
+ * of "listings" supported.
+ *
+ ******************************************************************************/
+
+void
+LsGenerateListing (
+ UINT32 FileId)
+{
+
+ /* Start at the beginning of both the source and AML files */
+
+ FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
+ FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+ Gbl_SourceLine = 0;
+ Gbl_CurrentHexColumn = 0;
+ LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename);
+
+ /* Process all parse nodes */
+
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk,
+ NULL, (void *) ACPI_TO_POINTER (FileId));
+
+ /* Final processing */
+
+ LsFinishSourceListing (FileId);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoListings
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generate all requested listing files.
+ *
+ ******************************************************************************/
+
+void
+LsDoListings (void)
+{
+
+ if (Gbl_C_OutputFlag)
+ {
+ LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT);
+ }
+
+ if (Gbl_ListingFlag)
+ {
+ LsGenerateListing (ASL_FILE_LISTING_OUTPUT);
+ }
+
+ if (Gbl_AsmOutputFlag)
+ {
+ LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT);
+ }
+
+ if (Gbl_C_IncludeOutputFlag)
+ {
+ LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT);
+ }
+
+ if (Gbl_AsmIncludeOutputFlag)
+ {
+ LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsPushNode
+ *
+ * PARAMETERS: Filename - Pointer to the include filename
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push a listing node on the listing/include file stack. This
+ * stack enables tracking of include files (infinitely nested)
+ * and resumption of the listing of the parent file when the
+ * include file is finished.
+ *
+ ******************************************************************************/
+
+void
+LsPushNode (
+ char *Filename)
+{
+ ASL_LISTING_NODE *Lnode;
+
+
+ /* Create a new node */
+
+ Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE));
+
+ /* Initialize */
+
+ Lnode->Filename = Filename;
+ Lnode->LineNumber = 0;
+
+ /* Link (push) */
+
+ Lnode->Next = Gbl_ListingNode;
+ Gbl_ListingNode = Lnode;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsPopNode
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: List head after current head is popped off
+ *
+ * DESCRIPTION: Pop the current head of the list, free it, and return the
+ * next node on the stack (the new current node).
+ *
+ ******************************************************************************/
+
+ASL_LISTING_NODE *
+LsPopNode (void)
+{
+ ASL_LISTING_NODE *Lnode;
+
+
+ /* Just grab the node at the head of the list */
+
+ Lnode = Gbl_ListingNode;
+ if ((!Lnode) ||
+ (!Lnode->Next))
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "Could not pop empty listing stack");
+ return Gbl_ListingNode;
+ }
+
+ Gbl_ListingNode = Lnode->Next;
+ ACPI_MEM_FREE (Lnode);
+
+ /* New "Current" node is the new head */
+
+ return (Gbl_ListingNode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsCheckException
+ *
+ * PARAMETERS: LineNumber - Current logical (cumulative) line #
+ * FileId - ID of output listing file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check if there is an exception for this line, and if there is,
+ * put it in the listing immediately. Handles multiple errors
+ * per line. Gbl_NextError points to the next error in the
+ * sorted (by line #) list of compile errors/warnings.
+ *
+ ******************************************************************************/
+
+void
+LsCheckException (
+ UINT32 LineNumber,
+ UINT32 FileId)
+{
+
+ if ((!Gbl_NextError) ||
+ (LineNumber < Gbl_NextError->LogicalLineNumber ))
+ {
+ return;
+ }
+
+ /* Handle multiple errors per line */
+
+ if (FileId == ASL_FILE_LISTING_OUTPUT)
+ {
+ while (Gbl_NextError &&
+ (LineNumber >= Gbl_NextError->LogicalLineNumber))
+ {
+ AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n");
+
+ Gbl_NextError = Gbl_NextError->Next;
+ }
+
+ FlPrintFile (FileId, "\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsFlushListingBuffer
+ *
+ * PARAMETERS: FileId - ID of the listing file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code
+ * buffer. Usually called at the termination of a single line
+ * of source code or when the buffer is full.
+ *
+ ******************************************************************************/
+
+void
+LsFlushListingBuffer (
+ UINT32 FileId)
+{
+ UINT32 i;
+
+
+ if (Gbl_CurrentHexColumn == 0)
+ {
+ return;
+ }
+
+ /* Write the hex bytes */
+
+ switch (FileId)
+ {
+ case ASL_FILE_LISTING_OUTPUT:
+
+ for (i = 0; i < Gbl_CurrentHexColumn; i++)
+ {
+ FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]);
+ }
+
+ for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++)
+ {
+ FlWriteFile (FileId, ".", 1);
+ }
+
+ /* Write the ASCII character associated with each of the bytes */
+
+ LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
+ break;
+
+
+ case ASL_FILE_ASM_SOURCE_OUTPUT:
+
+ for (i = 0; i < Gbl_CurrentHexColumn; i++)
+ {
+ if (i > 0)
+ {
+ FlPrintFile (FileId, ",");
+ }
+ FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]);
+ }
+
+ for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
+ {
+ FlWriteFile (FileId, " ", 1);
+ }
+
+ FlPrintFile (FileId, " ;%8.8X", Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
+
+ /* Write the ASCII character associated with each of the bytes */
+
+ LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
+ break;
+
+
+ case ASL_FILE_C_SOURCE_OUTPUT:
+
+ for (i = 0; i < Gbl_CurrentHexColumn; i++)
+ {
+ FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]);
+ }
+
+ for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
+ {
+ FlWriteFile (FileId, " ", 1);
+ }
+
+ FlPrintFile (FileId, " /* %8.8X", Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
+
+ /* Write the ASCII character associated with each of the bytes */
+
+ LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
+ FlPrintFile (FileId, " */");
+ break;
+
+ default:
+ /* No other types supported */
+ return;
+ }
+
+ FlPrintFile (FileId, "\n");
+
+ Gbl_CurrentHexColumn = 0;
+ Gbl_HexBytesWereWritten = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsWriteListingHexBytes
+ *
+ * PARAMETERS: Buffer - AML code buffer
+ * Length - Number of AML bytes to write
+ * FileId - ID of current listing file.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write the contents of the AML buffer to the listing file via
+ * the listing buffer. The listing buffer is flushed every 16
+ * AML bytes.
+ *
+ ******************************************************************************/
+
+void
+LsWriteListingHexBytes (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 FileId)
+{
+ UINT32 i;
+
+
+ /* Transfer all requested bytes */
+
+ for (i = 0; i < Length; i++)
+ {
+ /* Print line header when buffer is empty */
+
+ if (Gbl_CurrentHexColumn == 0)
+ {
+ if (Gbl_HasIncludeFiles)
+ {
+ FlPrintFile (FileId, "%*s", 10, " ");
+ }
+
+ switch (FileId)
+ {
+ case ASL_FILE_LISTING_OUTPUT:
+
+ FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset);
+ break;
+
+ case ASL_FILE_ASM_SOURCE_OUTPUT:
+
+ FlPrintFile (FileId, " db ");
+ break;
+
+ case ASL_FILE_C_SOURCE_OUTPUT:
+
+ FlPrintFile (FileId, " ");
+ break;
+
+ default:
+ /* No other types supported */
+ return;
+ }
+ }
+
+ /* Transfer AML byte and update counts */
+
+ Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i];
+
+ Gbl_CurrentHexColumn++;
+ Gbl_CurrentAmlOffset++;
+
+ /* Flush buffer when it is full */
+
+ if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE)
+ {
+ LsFlushListingBuffer (FileId);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsWriteOneSourceLine
+ *
+ * PARAMETERS: FileID - ID of current listing file
+ *
+ * RETURN: FALSE on EOF (input source file), TRUE otherwise
+ *
+ * DESCRIPTION: Read one line from the input source file and echo it to the
+ * listing file, prefixed with the line number, and if the source
+ * file contains include files, prefixed with the current filename
+ *
+ ******************************************************************************/
+
+UINT32
+LsWriteOneSourceLine (
+ UINT32 FileId)
+{
+ UINT8 FileByte;
+
+
+ Gbl_SourceLine++;
+ Gbl_ListingNode->LineNumber++;
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " *");
+ }
+ if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, "; ");
+ }
+
+ if (Gbl_HasIncludeFiles)
+ {
+ /*
+ * This file contains "include" statements, print the current
+ * filename and line number within the current file
+ */
+ FlPrintFile (FileId, "%12s %5d....",
+ Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber);
+ }
+ else
+ {
+ /* No include files, just print the line number */
+
+ FlPrintFile (FileId, "%8d....", Gbl_SourceLine);
+ }
+
+ /* Read one line (up to a newline or EOF) */
+
+ while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK)
+ {
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ if (FileByte == '/')
+ {
+ FileByte = '*';
+ }
+ }
+
+ FlWriteFile (FileId, &FileByte, 1);
+ if (FileByte == '\n')
+ {
+ /*
+ * Check if an error occurred on this source line during the compile.
+ * If so, we print the error message after the source line.
+ */
+ LsCheckException (Gbl_SourceLine, FileId);
+ return (1);
+ }
+ }
+
+ /* EOF on the input file was reached */
+
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsFinishSourceListing
+ *
+ * PARAMETERS: FileId - ID of current listing file.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML
+ * listing buffer, and flush out any remaining lines in the
+ * source input file.
+ *
+ ******************************************************************************/
+
+void
+LsFinishSourceListing (
+ UINT32 FileId)
+{
+
+ if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
+ (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
+ {
+ return;
+ }
+
+ LsFlushListingBuffer (FileId);
+ Gbl_CurrentAmlOffset = 0;
+
+ /* Flush any remaining text in the source file */
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " /*\n");
+ }
+
+ while (LsWriteOneSourceLine (FileId))
+ { ; }
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, "\n */\n };\n");
+ }
+
+ FlPrintFile (FileId, "\n");
+
+ if (FileId == ASL_FILE_LISTING_OUTPUT)
+ {
+ /* Print a summary of the compile exceptions */
+
+ FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n");
+ AePrintErrorLog (FileId);
+ FlPrintFile (FileId, "\n\n");
+ UtDisplaySummary (FileId);
+ FlPrintFile (FileId, "\n\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsWriteSourceLines
+ *
+ * PARAMETERS: ToLineNumber -
+ * ToLogicalLineNumber - Write up to this source line number
+ * FileId - ID of current listing file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Read then write source lines to the listing file until we have
+ * reached the specified logical (cumulative) line number. This
+ * automatically echos out comment blocks and other non-AML
+ * generating text until we get to the actual AML-generating line
+ * of ASL code specified by the logical line number.
+ *
+ ******************************************************************************/
+
+void
+LsWriteSourceLines (
+ UINT32 ToLineNumber,
+ UINT32 ToLogicalLineNumber,
+ UINT32 FileId)
+{
+
+ if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
+ (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
+ {
+ return;
+ }
+
+ Gbl_CurrentLine = ToLogicalLineNumber;
+
+ /* Flush any hex bytes remaining from the last opcode */
+
+ LsFlushListingBuffer (FileId);
+
+ /*
+ * Read lines and write them as long as we are not caught up
+ */
+ if (Gbl_SourceLine < Gbl_CurrentLine)
+ {
+ /*
+ * If we just completed writing some AML hex bytes, output a linefeed
+ * to add some whitespace for readability.
+ */
+ if (Gbl_HexBytesWereWritten)
+ {
+ FlPrintFile (FileId, "\n");
+ Gbl_HexBytesWereWritten = FALSE;
+ }
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " /*\n");
+ }
+
+ /*
+ * Write one line at a time until we have reached the target line #
+ */
+ while ((Gbl_SourceLine < Gbl_CurrentLine) &&
+ LsWriteOneSourceLine (FileId))
+ { ; }
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " */");
+ }
+ FlPrintFile (FileId, "\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsWriteNodeToListing
+ *
+ * PARAMETERS: Op - Parse node to write to the listing file.
+ * FileId - ID of current listing file
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Write "a node" to the listing file. This means to
+ * 1) Write out all of the source text associated with the node
+ * 2) Write out all of the AML bytes associated with the node
+ * 3) Write any compiler exceptions associated with the node
+ *
+ ******************************************************************************/
+
+void
+LsWriteNodeToListing (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 FileId)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 OpClass;
+ char *Pathname;
+ UINT32 Length;
+ UINT32 i;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ OpClass = OpInfo->Class;
+
+ /* TBD: clean this up with a single flag that says: I start a named output block */
+
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+ case PARSEOP_METHODCALL:
+ case PARSEOP_INCLUDE:
+ case PARSEOP_INCLUDE_END:
+ case PARSEOP_DEFAULT_ARG:
+
+ break;
+
+ default:
+ switch (OpClass)
+ {
+ case AML_CLASS_NAMED_OBJECT:
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_SCOPE_OP:
+ case AML_ALIAS_OP:
+ break;
+
+ default:
+ if (Op->Asl.ExternalName)
+ {
+ LsFlushListingBuffer (FileId);
+ FlPrintFile (FileId, " };\n");
+ }
+ break;
+ }
+ break;
+
+ default:
+ /* Don't care about other objects */
+ break;
+ }
+ break;
+ }
+ }
+
+
+ /* These cases do not have a corresponding AML opcode */
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+
+ LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
+
+ /* Use the table Signature and TableId to build a unique name */
+
+ if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, "%s_%s_Header \\\n",
+ Gbl_TableSignature, Gbl_TableId);
+ }
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " unsigned char %s_%s_Header [] = \n {\n",
+ Gbl_TableSignature, Gbl_TableId);
+ }
+ if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
+ {
+ FlPrintFile (FileId, "extrn %s_%s_Header : byte\n",
+ Gbl_TableSignature, Gbl_TableId);
+ }
+ if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
+ {
+ FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n",
+ Gbl_TableSignature, Gbl_TableId);
+ }
+ return;
+
+
+ case PARSEOP_METHODCALL:
+
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ return;
+
+
+ case PARSEOP_INCLUDE:
+
+ /*
+ * Flush everything up to and including the include source line
+ */
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+
+ /*
+ * Create a new listing node and push it
+ */
+ LsPushNode (Op->Asl.Child->Asl.Value.String);
+ return;
+
+
+ case PARSEOP_INCLUDE_END:
+
+ /*
+ * Flush out the rest of the include file
+ */
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+
+ /*
+ * Pop off this listing node and go back to the parent file
+ */
+ LsPopNode ();
+ return;
+
+
+ case PARSEOP_DEFAULT_ARG:
+ return;
+
+
+ default:
+ /* All other opcodes have an AML opcode */
+ break;
+ }
+
+ /*
+ * Otherwise, we look at the AML opcode because we can
+ * switch on the opcode type, getting an entire class
+ * at once
+ */
+ switch (OpClass)
+ {
+ case AML_CLASS_ARGUMENT: /* argument type only */
+ case AML_CLASS_INTERNAL:
+
+ break;
+
+
+ case AML_CLASS_NAMED_OBJECT:
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+ case AML_NAME_OP:
+
+ /* For fields, we want to dump all the AML after the entire definition */
+
+ LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
+ break;
+
+ default:
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ break;
+ }
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_SCOPE_OP:
+ case AML_ALIAS_OP:
+
+ /* These opcodes do not declare a new object, ignore them */
+
+ break;
+
+ default:
+
+ /* All other named object opcodes come here */
+
+ switch (FileId)
+ {
+ case ASL_FILE_ASM_SOURCE_OUTPUT:
+ case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_ASM_INCLUDE_OUTPUT:
+ case ASL_FILE_C_INCLUDE_OUTPUT:
+
+ /*
+ * For named objects, we will create a valid symbol so that the
+ * AML code can be referenced from C or ASM
+ */
+ if (Op->Asl.ExternalName)
+ {
+ /* Get the full pathname associated with this node */
+
+ Pathname = AcpiNsGetExternalPathname (Op->Asl.Node);
+ Length = strlen (Pathname);
+ if (Length >= 4)
+ {
+ /* Convert all dots in the path to underscores */
+
+ for (i = 0; i < Length; i++)
+ {
+ if (Pathname[i] == '.')
+ {
+ Pathname[i] = '_';
+ }
+ }
+
+ /* Create the appropriate symbol in the output file */
+
+ if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, "%s_%s_%s \\\n",
+ Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
+ }
+ if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
+ {
+ FlPrintFile (FileId, " unsigned char %s_%s_%s [] = \n {\n",
+ Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
+ }
+ if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
+ {
+ FlPrintFile (FileId, "extrn %s_%s_%s : byte\n",
+ Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
+ }
+ if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
+ {
+ FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n",
+ Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
+ }
+ }
+ ACPI_MEM_FREE (Pathname);
+ }
+ break;
+
+ default:
+ /* Nothing to do for listing file */
+ break;
+ }
+ }
+ break;
+
+ case AML_CLASS_EXECUTE:
+ case AML_CLASS_CREATE:
+ default:
+
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ break;
+
+ case AML_CLASS_UNKNOWN:
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoHexOutput
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create the hex output file.
+ *
+ ******************************************************************************/
+
+void
+LsDoHexOutput (void)
+{
+
+ switch (Gbl_HexOutputFlag)
+ {
+ case HEX_OUTPUT_C:
+
+ LsDoHexOutputC ();
+ break;
+
+ case HEX_OUTPUT_ASM:
+
+ LsDoHexOutputAsm ();
+ break;
+
+ default:
+ /* No other output types supported */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoHexOutputC
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create the hex output file. This is the same data as the AML
+ * output file, but formatted into hex/ascii bytes suitable for
+ * inclusion into a C source file.
+ *
+ ******************************************************************************/
+
+void
+LsDoHexOutputC (void)
+{
+ UINT32 j;
+ UINT8 FileByte[HEX_TABLE_LINE_SIZE];
+ UINT8 Buffer[4];
+ UINT32 Offset = 0;
+
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] = \n{\n");
+
+ /* Start at the beginning of the AML file */
+
+ FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+
+ /* Process all AML bytes in the AML file */
+
+ j = 0;
+ while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
+ {
+ if (j == 0)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+ }
+
+ /*
+ * Convert each AML byte to hex
+ */
+ UtConvertByteToHex (FileByte[j], Buffer);
+ FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+
+ /* An occasional linefeed improves readability */
+
+ Offset++;
+ j++;
+
+ if (j >= HEX_TABLE_LINE_SIZE)
+ {
+ /* End of line, emit the ascii dump of the entire line */
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
+
+ /* Write the ASCII character associated with each of the bytes */
+
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n");
+
+ /* Start new line */
+
+ j = 0;
+ }
+
+ }
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n");
+ FlCloseFile (ASL_FILE_HEX_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoHexOutputAsm
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create the hex output file. This is the same data as the AML
+ * output file, but formatted into hex/ascii bytes suitable for
+ * inclusion into a ASM source file.
+ *
+ ******************************************************************************/
+
+void
+LsDoHexOutputAsm (
+ void)
+{
+ UINT32 j;
+ UINT8 FileByte[HEX_TABLE_LINE_SIZE];
+ UINT8 Buffer[4];
+ UINT32 Offset = 0;
+ BOOLEAN DoComma = FALSE;
+
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n");
+
+ /* Start at the beginning of the AML file */
+
+ FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+
+ /* Process all AML bytes in the AML file */
+
+ j = 0;
+ while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
+ {
+ if (j == 0)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
+ }
+ else if (DoComma)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ DoComma = FALSE;
+ }
+
+ /*
+ * Convert each AML byte to hex
+ */
+ UtConvertByteToAsmHex (FileByte[j], Buffer);
+ FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
+
+ /* An occasional linefeed improves readability */
+
+ Offset++;
+ j++;
+ if (j >= HEX_TABLE_LINE_SIZE)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
+
+ /* Write the ASCII character associated with each of the bytes */
+
+ LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
+ j = 0;
+ }
+ else
+ {
+ DoComma = TRUE;
+ }
+ }
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
+ FlCloseFile (ASL_FILE_HEX_OUTPUT);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c
new file mode 100644
index 0000000..cafbbfb
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslload.c
@@ -0,0 +1,691 @@
+/******************************************************************************
+ *
+ * Module Name: dswload - Dispatcher namespace load callbacks
+ * $Revision: 59 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __ASLLOAD_C__
+
+#include "aslcompiler.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslload")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdLoadNamespace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
+ * named ASL/AML objects into the namespace. The namespace is
+ * constructed in order to resolve named references and references
+ * to named fields within resource templates/descriptors.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LdLoadNamespace (
+ ACPI_PARSE_OBJECT *RootOp)
+{
+ ACPI_WALK_STATE *WalkState;
+
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
+
+ /* Create a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ /* Perform the walk of the parse tree */
+
+ TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
+ LdNamespace1End, WalkState);
+
+ /* Dump the namespace if debug is enabled */
+
+ AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX);
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdLoadFieldElements
+ *
+ * PARAMETERS: Op - Parent node (Field)
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter the named elements of the field (children of the parent)
+ * into the namespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LdLoadFieldElements (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Child = NULL;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Get the first named field element */
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_BANK_FIELD_OP:
+
+ Child = UtGetArg (Op, 6);
+ break;
+
+ case AML_INDEX_FIELD_OP:
+
+ Child = UtGetArg (Op, 5);
+ break;
+
+ case AML_FIELD_OP:
+
+ Child = UtGetArg (Op, 4);
+ break;
+
+ default:
+ /* No other opcodes should arrive here */
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Enter all elements into the namespace */
+
+ while (Child)
+ {
+ switch (Child->Asl.AmlOpcode)
+ {
+ case AML_INT_RESERVEDFIELD_OP:
+ case AML_INT_ACCESSFIELD_OP:
+
+ break;
+
+ default:
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Asl.Value.String,
+ ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
+ NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status != AE_ALREADY_EXISTS)
+ {
+ return (Status);
+ }
+
+ /*
+ * The name already exists in this scope
+ * But continue processing the elements
+ */
+ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, Child->Asl.Value.String);
+ }
+ else
+ {
+ Child->Asl.Node = Node;
+ Node->Object = (ACPI_OPERAND_OBJECT *) Child;
+ }
+ break;
+ }
+ Child = Child->Asl.Next;
+ }
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdLoadResourceElements
+ *
+ * PARAMETERS: Op - Parent node (Resource Descriptor)
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter the named elements of the resource descriptor (children
+ * of the parent) into the namespace.
+ *
+ * NOTE: In the real AML namespace, these named elements never exist. But
+ * we simply use the namespace here as a symbol table so we can look
+ * them up as they are referenced.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LdLoadResourceElements (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *InitializerOp = NULL;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /*
+ * Enter the resouce name into the namespace
+ * This opens a scope
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
+ ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
+ WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * Now enter the predefined fields, for easy lookup when referenced
+ * by the source ASL
+ */
+ InitializerOp = ASL_GET_CHILD_NODE (Op);
+ while (InitializerOp)
+ {
+
+ if (InitializerOp->Asl.ExternalName)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ InitializerOp->Asl.ExternalName,
+ ACPI_TYPE_LOCAL_RESOURCE_FIELD,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
+ NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * Store the field offset in the namespace node so it
+ * can be used when the field is referenced
+ */
+ Node->OwnerId = (UINT16) InitializerOp->Asl.Value.Integer;
+ InitializerOp->Asl.Node = Node;
+ Node->Object = (ACPI_OPERAND_OBJECT *) InitializerOp;
+
+ /* Pass thru the field type (Bitfield or Bytefield) */
+
+ if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
+ {
+ Node->Flags |= ANOBJ_IS_BIT_OFFSET;
+ }
+ }
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdNamespace1Begin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during the parse tree walk. If this
+ * is a named AML opcode, enter into the namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LdNamespace1Begin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY;
+ char *Path;
+ UINT32 Flags = ACPI_NS_NO_UPSEARCH;
+ ACPI_PARSE_OBJECT *Arg;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_NAME ("LdNamespace1Begin");
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
+ Op, Op->Asl.ParseOpName));
+
+
+ /*
+ * We are only interested in opcodes that have an associated name
+ * (or multiple names)
+ */
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_BANK_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+ case AML_FIELD_OP:
+
+ Status = LdLoadFieldElements (Op, WalkState);
+ return (Status);
+
+ default:
+
+ /* All other opcodes go below */
+ break;
+ }
+
+ /* Check if this object has already been installed in the namespace */
+
+ if (Op->Asl.Node)
+ {
+ return (AE_OK);
+ }
+
+ Path = Op->Asl.Namepath;
+ if (!Path)
+ {
+ return (AE_OK);
+ }
+
+ /* Map the raw opcode into an internal object type */
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_NAME:
+
+ Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */
+ Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */
+
+ /* Get the data type associated with the named object, not the name itself */
+
+ /* Log2 loop to convert from Btype (binary) to Etype (encoded) */
+
+ ObjectType = 1;
+ for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2)
+ {
+ ObjectType++;
+ }
+ break;
+
+
+ case PARSEOP_EXTERNAL:
+
+ /*
+ * "External" simply enters a name and type into the namespace.
+ * We must be careful to not open a new scope, however, no matter
+ * what type the external name refers to (e.g., a method)
+ *
+ * first child is name, next child is ObjectType
+ */
+ ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
+ ObjectType = ACPI_TYPE_ANY;
+ break;
+
+
+ case PARSEOP_DEFAULT_ARG:
+
+ if(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
+ {
+ Status = LdLoadResourceElements (Op, WalkState);
+ goto Exit;
+ }
+
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+ break;
+
+
+ case PARSEOP_SCOPE:
+
+ /*
+ * The name referenced by Scope(Name) must already exist at this point.
+ * In other words, forward references for Scope() are not supported.
+ * The only real reason for this is that the MS interpreter cannot
+ * handle this case. Perhaps someday this case can go away.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ /* The name was not found, go ahead and create it */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_LOCAL_SCOPE,
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+
+ /*
+ * However, this is an error -- primarily because the MS
+ * interpreter can't handle a forward reference from the
+ * Scope() operator.
+ */
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, Op->Asl.ExternalName);
+ goto FinishNode;
+ }
+
+ AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE);
+ goto Exit;
+ }
+
+ /* We found a node with this name, now check the type */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_LOCAL_SCOPE:
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* These are acceptable types - they all open a new scope */
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * These types we will allow, but we will change the type. This
+ * enables some existing code of the form:
+ *
+ * Name (DEB, 0)
+ * Scope (DEB) { ... }
+ *
+ * Which is used to workaround the fact that the MS interpreter
+ * does not allow Scope() forward references.
+ */
+ sprintf (MsgBuffer, "%s, %s, Changing type to (Scope)",
+ Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
+ AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
+
+ /*
+ * Switch the type
+ */
+ Node->Type = ACPI_TYPE_ANY;
+ break;
+
+ default:
+
+ /*
+ * All other types are an error
+ */
+ sprintf (MsgBuffer, "%s, %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
+ AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
+
+ /*
+ * However, switch the type to be an actual scope so
+ * that compilation can continue without generating a whole
+ * cascade of additional errors.
+ */
+ Node->Type = ACPI_TYPE_ANY;
+ break;
+ }
+
+ Status = AE_OK;
+ goto FinishNode;
+
+
+ default:
+
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+ break;
+ }
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
+ Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
+
+ /* The name must not already exist */
+
+ Flags |= ACPI_NS_ERROR_IF_FOUND;
+
+ /*
+ * Enter the named type into the internal namespace. We enter the name
+ * as we go downward in the parse tree. Any necessary subobjects that involve
+ * arguments to the opcode must be created as we go back up the parse tree later.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ /* The name already exists in this scope */
+
+ if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
+ {
+ Node->Type = (UINT8) ObjectType;
+ Status = AE_OK;
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, Op->Asl.ExternalName);
+ Status = AE_OK;
+ goto Exit;
+ }
+ }
+ else
+ {
+ AslCoreSubsystemError (Op, Status, "Failure from lookup %s\n", FALSE);
+ goto Exit;
+ }
+ }
+
+
+FinishNode:
+ /*
+ * Point the parse node to the new namespace node, and point
+ * the Node back to the original Parse node
+ */
+ Op->Asl.Node = Node;
+ Node->Object = (ACPI_OPERAND_OBJECT *) Op;
+
+ /* Set the actual data type if appropriate (EXTERNAL term only) */
+
+ if (ActualObjectType != ACPI_TYPE_ANY)
+ {
+ Node->Type = (UINT8) ActualObjectType;
+ Node->OwnerId = ASL_EXTERNAL_METHOD;
+ }
+
+ if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
+ {
+ /*
+ * Get the method argument count from "Extra" and store
+ * it in the OwnerId field of the namespace node
+ */
+ Node->OwnerId = (UINT16) Op->Asl.Extra;
+ }
+
+Exit:
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdNamespace1End
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during the loading of the namespace,
+ * We only need to worry about managing the scope stack here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LdNamespace1End (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
+ ACPI_OBJECT_TYPE ObjectType;
+
+
+ ACPI_FUNCTION_NAME ("LdNamespace1End");
+
+
+ /* We are only interested in opcodes that have an associated name */
+
+ if (!Op->Asl.Namepath)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the type to determine if we should pop the scope */
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
+ (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
+ {
+ /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */
+
+ ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
+ }
+ else
+ {
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+ }
+
+ /* Pop the scope stack */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "(%s): Popping scope for Op [%s] %p\n",
+ AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));
+
+ AcpiDsScopeStackPop (WalkState);
+ }
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c
new file mode 100644
index 0000000..1981012
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asllookup.c
@@ -0,0 +1,974 @@
+/******************************************************************************
+ *
+ * Module Name: asllookup- Namespace lookup
+ * $Revision: 82 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asllookup")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoOneNamespaceObject
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Dump a namespace object to the namespace output file.
+ * Called during the walk of the namespace to dump all objects.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsDoOneNamespaceObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_PARSE_OBJECT *Op;
+
+
+ Gbl_NumNamespaceObjects++;
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
+ Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
+ &Node->Name,
+ AcpiUtGetTypeName (Node->Type));
+
+ Op = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+
+ if (Op)
+ {
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
+ Op = Op->Asl.Child;
+ }
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_INTEGER:
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
+ {
+ Op = Op->Asl.Next;
+ }
+
+ if (Op->Asl.Value.Integer > ACPI_UINT32_MAX)
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X%X]",
+ ACPI_HIDWORD (Op->Asl.Value.Integer64), (UINT32) Op->Asl.Value.Integer);
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X]",
+ (UINT32) Op->Asl.Value.Integer);
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
+ {
+ Op = Op->Asl.Next;
+ }
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = \"%s\"]",
+ Op->Asl.Value.String);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
+ {
+ Op = Op->Asl.Child;
+ }
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Offset 0x%02X, Length 0x%02X]",
+ Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
+ break;
+
+
+ default:
+ /* Nothing to do for other types */
+ break;
+ }
+ }
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsDisplayNamespace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Walk the namespace an display information about each node
+ * in the tree. Information is written to the optional
+ * namespace output file.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsDisplayNamespace (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ if (!Gbl_NsOutputFlag)
+ {
+ return (AE_OK);
+ }
+
+ /* File header */
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n");
+
+ /* Walk entire namespace from the root */
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
+ NULL, NULL);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsCompareOneNamespaceObject
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compare name of one object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsCompareOneNamespaceObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+
+
+ /* Simply check the name */
+
+ if (*((UINT32 *) (Context)) == Node->Name.Integer)
+ {
+ /* Abort walk if we found one instance */
+
+ return (AE_CTRL_TRUE);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkObjectExists
+ *
+ * PARAMETERS: Name - 4 char ACPI name
+ *
+ * RETURN: TRUE if name exists in namespace
+ *
+ * DESCRIPTION: Walk the namespace to find an object
+ *
+ ******************************************************************************/
+
+BOOLEAN
+LkObjectExists (
+ char *Name)
+{
+ ACPI_STATUS Status;
+
+
+ /* Walk entire namespace from the supplied root */
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject,
+ Name, NULL);
+ if (Status == AE_CTRL_TRUE)
+ {
+ /* At least one instance of the name was found */
+
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkCrossReferenceNamespace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform a cross reference check of the parse tree against the
+ * namespace. Every named referenced within the parse tree
+ * should be get resolved with a namespace lookup. If not, the
+ * original reference in the ASL code is invalid -- i.e., refers
+ * to a non-existent object.
+ *
+ * NOTE: The ASL "External" operator causes the name to be inserted into the
+ * namespace so that references to the external name will be resolved
+ * correctly here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LkCrossReferenceNamespace (
+ void)
+{
+ ACPI_WALK_STATE *WalkState;
+
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
+
+ /*
+ * Create a new walk state for use when looking up names
+ * within the namespace (Passed as context to the callbacks)
+ */
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ /* Walk the entire parse tree */
+
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,
+ LkNamespaceLocateEnd, WalkState);
+ return AE_OK;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkCheckFieldRange
+ *
+ * PARAMETERS: RegionBitLength - Length of entire parent region
+ * FieldBitOffset - Start of the field unit (within region)
+ * FieldBitLength - Entire length of field unit
+ * AccessBitWidth - Access width of the field unit
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check one field unit to make sure it fits in the parent
+ * op region.
+ *
+ * Note: AccessBitWidth must be either 8,16,32, or 64
+ *
+ ******************************************************************************/
+
+void
+LkCheckFieldRange (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 RegionBitLength,
+ UINT32 FieldBitOffset,
+ UINT32 FieldBitLength,
+ UINT32 AccessBitWidth)
+{
+ UINT32 FieldEndBitOffset;
+
+ /*
+ * Check each field unit against the region size. The entire
+ * field unit (start offset plus length) must fit within the
+ * region.
+ */
+ FieldEndBitOffset = FieldBitOffset + FieldBitLength;
+
+ if (FieldEndBitOffset > RegionBitLength)
+ {
+ /* Field definition itself is beyond the end-of-region */
+
+ AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
+ return;
+ }
+
+ /*
+ * Now check that the field plus AccessWidth doesn't go beyond
+ * the end-of-region. Assumes AccessBitWidth is a power of 2
+ */
+ FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
+
+ if (FieldEndBitOffset > RegionBitLength)
+ {
+ /* Field definition combined with the access is beyond EOR */
+
+ AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkNamespaceLocateBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during cross-reference. For named
+ * object references, attempt to locate the name in the
+ * namespace.
+ *
+ * NOTE: ASL references to named fields within resource descriptors are
+ * resolved to integer values here. Therefore, this step is an
+ * important part of the code generation. We don't know that the
+ * name refers to a resource descriptor until now.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LkNamespaceLocateBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ char *Path;
+ UINT8 PassedArgs;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *OwningOp;
+ ACPI_PARSE_OBJECT *SpaceIdOp;
+ UINT32 MinimumLength;
+ UINT32 Temp;
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 Flags;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("LkNamespaceLocateBegin", Op);
+
+ /*
+ * If this node is the actual declaration of a name
+ * [such as the XXXX name in "Method (XXXX)"],
+ * we are not interested in it here. We only care about names that are
+ * references to other objects within the namespace and the parent objects
+ * of name declarations
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
+ {
+ return (AE_OK);
+ }
+
+ /* We are only interested in opcodes that have an associated name */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+ if ((!(OpInfo->Flags & AML_NAMED)) &&
+ (!(OpInfo->Flags & AML_CREATE)) &&
+ (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
+ (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
+ (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * We must enable the "search-to-root" for single NameSegs, but
+ * we have to be very careful about opening up scopes
+ */
+ Flags = ACPI_NS_SEARCH_PARENT;
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
+ {
+ /*
+ * These are name references, do not push the scope stack
+ * for them.
+ */
+ Flags |= ACPI_NS_DONT_OPEN_SCOPE;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For all NAMED operators, the name reference is the first child */
+
+ Path = Op->Asl.Child->Asl.Value.String;
+ if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
+ {
+ /*
+ * ALIAS is the only oddball opcode, the name declaration
+ * (alias name) is the second operand
+ */
+ Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Name must appear as the last parameter */
+
+ NextOp = Op->Asl.Child;
+ while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
+ {
+ NextOp = NextOp->Asl.Next;
+ }
+ Path = NextOp->Asl.Value.String;
+ }
+ else
+ {
+ Path = Op->Asl.Value.String;
+ }
+
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
+
+ /*
+ * Lookup the name in the namespace. Name must exist at this point, or it
+ * is an invalid reference.
+ *
+ * The namespace is also used as a lookup table for references to resource
+ * descriptors and the fields within them.
+ */
+ Gbl_NsLookupCount++;
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ /*
+ * We didn't find the name reference by path -- we can qualify this
+ * a little better before we print an error message
+ */
+ if (strlen (Path) == ACPI_NAME_SIZE)
+ {
+ /* A simple, one-segment ACPI name */
+
+ if (LkObjectExists (Path))
+ {
+ /* There exists such a name, but we couldn't get to it from this scope */
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName);
+ }
+ else
+ {
+ /* The name doesn't exist, period */
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
+ }
+ }
+ else
+ {
+ /* Check for a fully qualified path */
+
+ if (Path[0] == AML_ROOT_PREFIX)
+ {
+ /* Gave full path, the object does not exist */
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
+ }
+ else
+ {
+ /* We can't tell whether it doesn't exist or just can't be reached. */
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
+ }
+ }
+
+ Status = AE_OK;
+ }
+ return (Status);
+ }
+
+ /* Attempt to optimize the NamePath */
+
+ OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
+
+ /*
+ * Dereference an alias. (A name reference that is an alias.)
+ * Aliases are not nested; The alias always points to the final object
+ */
+ if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
+ {
+ /* This node points back to the original PARSEOP_ALIAS */
+
+ NextOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+
+ /* The first child is the alias target op */
+
+ NextOp = NextOp->Asl.Child;
+
+ /* Who in turn points back to original target alias node */
+
+ if (NextOp->Asl.Node)
+ {
+ Node = NextOp->Asl.Node;
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "Missing alias link");
+ }
+ }
+
+ /* 1) Check for a reference to a resource descriptor */
+
+ else if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
+ (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
+ {
+ /*
+ * This was a reference to a field within a resource descriptor. Extract
+ * the associated field offset (either a bit or byte offset depending on
+ * the field type) and change the named reference into an integer for
+ * AML code generation
+ */
+ Temp = (UINT32) Node->OwnerId;
+ if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
+ {
+ Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
+ }
+
+ /* Perform BitOffset <--> ByteOffset conversion if necessary */
+
+ switch (Op->Asl.Parent->Asl.AmlOpcode)
+ {
+ case AML_CREATE_FIELD_OP:
+
+ /* We allow a Byte offset to Bit Offset conversion for this op */
+
+ if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
+ {
+ /* Simply multiply byte offset times 8 to get bit offset */
+
+ Temp = ACPI_MUL_8 (Temp);
+ }
+ break;
+
+
+ case AML_CREATE_BIT_FIELD_OP:
+
+ /* This op requires a Bit Offset */
+
+ if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
+ {
+ AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
+ }
+ break;
+
+
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_CREATE_WORD_FIELD_OP:
+ case AML_CREATE_DWORD_FIELD_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+ case AML_INDEX_OP:
+
+ /* These Ops require Byte offsets */
+
+ if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
+ {
+ AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
+ }
+ break;
+
+
+ default:
+ /* Nothing to do for other opcodes */
+ break;
+ }
+
+ /* Now convert this node to an integer whose value is the field offset */
+
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Asl.Value.Integer = (UINT64) Temp;
+ Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
+
+ OpcGenerateAmlOpcode (Op);
+ Op->Asl.AmlLength = OpcSetOptimalIntegerSize (Op);
+ }
+
+ /* 2) Check for a method invocation */
+
+ else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
+ (Node->Type == ACPI_TYPE_METHOD) &&
+ (Op->Asl.Parent) &&
+ (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) ||
+
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
+ {
+
+ /*
+ * There are two types of method invocation:
+ * 1) Invocation with arguments -- the parser recognizes this as a METHODCALL
+ * 2) Invocation with no arguments --the parser cannot determine that this is a method
+ * invocation, therefore we have to figure it out here.
+ */
+ if (Node->Type != ACPI_TYPE_METHOD)
+ {
+ sprintf (MsgBuffer, "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
+ return (AE_OK);
+ }
+
+ /* Save the method node in the caller's op */
+
+ Op->Asl.Node = Node;
+ if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * This is a method invocation, with or without arguments.
+ * Count the number of arguments, each appears as a child
+ * under the parent node
+ */
+ Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
+ UtSetParseOpName (Op);
+
+ PassedArgs = 0;
+ NextOp = Op->Asl.Child;
+
+ while (NextOp)
+ {
+ PassedArgs++;
+ NextOp = NextOp->Asl.Next;
+ }
+
+ if (Node->OwnerId != ASL_EXTERNAL_METHOD)
+ {
+ /*
+ * Check the parsed arguments with the number expected by the
+ * method declaration itself
+ */
+ if (PassedArgs != Node->OwnerId)
+ {
+ sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
+ Node->OwnerId);
+
+ if (PassedArgs < Node->OwnerId)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
+ }
+ }
+ }
+ }
+
+ /*
+ * 3) Check for an ASL Field definition
+ */
+ else if ((Op->Asl.Parent) &&
+ ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
+ (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
+ {
+ /*
+ * Offset checking for fields. If the parent operation region has a
+ * constant length (known at compile time), we can check fields
+ * defined in that region against the region length. This will catch
+ * fields and field units that cannot possibly fit within the region.
+ *
+ * Note: Index fields do not directly reference an operation region,
+ * thus they are not included in this check.
+ */
+ if (Op == Op->Asl.Parent->Asl.Child)
+ {
+ /*
+ * This is the first child of the field node, which is
+ * the name of the region. Get the parse node for the
+ * region -- which contains the length of the region.
+ */
+ OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ Op->Asl.Parent->Asl.ExtraValue = ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
+
+ /* Examine the field access width */
+
+ switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer)
+ {
+ case AML_FIELD_ACCESS_ANY:
+ case AML_FIELD_ACCESS_BYTE:
+ case AML_FIELD_ACCESS_BUFFER:
+ default:
+ MinimumLength = 1;
+ break;
+
+ case AML_FIELD_ACCESS_WORD:
+ MinimumLength = 2;
+ break;
+
+ case AML_FIELD_ACCESS_DWORD:
+ MinimumLength = 4;
+ break;
+
+ case AML_FIELD_ACCESS_QWORD:
+ MinimumLength = 8;
+ break;
+ }
+
+ /*
+ * Is the region at least as big as the access width?
+ * Note: DataTableRegions have 0 length
+ */
+ if (((UINT32) OwningOp->Asl.Value.Integer) &&
+ ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength))
+ {
+ AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
+ }
+
+ /*
+ * Check EC/CMOS/SMBUS fields to make sure that the correct
+ * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
+ */
+ SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
+ switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
+ {
+ case REGION_EC:
+ case REGION_CMOS:
+
+ if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
+ {
+ AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
+ }
+ break;
+
+ case REGION_SMBUS:
+
+ if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
+ {
+ AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
+ }
+ break;
+
+ default:
+
+ /* Nothing to do for other address spaces */
+ break;
+ }
+ }
+ else
+ {
+ /*
+ * This is one element of the field list. Check to make sure
+ * that it does not go beyond the end of the parent operation region.
+ *
+ * In the code below:
+ * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits)
+ * Op->Asl.ExtraValue - Field start offset (bits)
+ * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits)
+ * Op->Asl.Child->Asl.ExtraValue - Field access width (bits)
+ */
+ if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
+ {
+ LkCheckFieldRange (Op,
+ Op->Asl.Parent->Asl.ExtraValue,
+ Op->Asl.ExtraValue,
+ (UINT32) Op->Asl.Child->Asl.Value.Integer,
+ Op->Asl.Child->Asl.ExtraValue);
+ }
+ }
+ }
+
+ Op->Asl.Node = Node;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkNamespaceLocateEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during cross reference. We only
+ * need to worry about scope management here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LkNamespaceLocateEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_TRACE ("LkNamespaceLocateEnd");
+
+
+ /* We are only interested in opcodes that have an associated name */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (!(OpInfo->Flags & AML_NAMED))
+ {
+ return (AE_OK);
+ }
+
+ /* Not interested in name references, we did not open a scope for them */
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
+ {
+ return (AE_OK);
+ }
+
+ /* Pop the scope stack if necessary */
+
+ if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
+ {
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "%s: Popping scope for Op %p\n",
+ AcpiUtGetTypeName (OpInfo->ObjectType), Op));
+
+ AcpiDsScopeStackPop (WalkState);
+ }
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
new file mode 100644
index 0000000..37fb5a0
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -0,0 +1,794 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslmain - compiler main and utilities
+ * $Revision: 75 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define _DECLARE_GLOBALS
+
+#include "aslcompiler.h"
+#include "acnamesp.h"
+#include "acapps.h"
+
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslmain")
+
+BOOLEAN AslToFile = TRUE;
+BOOLEAN DoCompile = TRUE;
+BOOLEAN DoSignon = TRUE;
+
+char hex[] = {'0','1','2','3','4','5','6','7',
+ '8','9','A','B','C','D','E','F'};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Options
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display option help message
+ *
+ ******************************************************************************/
+
+void
+Options (
+ void)
+{
+
+ printf ("General Output:\n");
+ printf (" -p <prefix> Specify filename prefix for all output files (including .aml)\n");
+ printf (" -vi Less verbose errors and warnings for use with IDEs\n");
+ printf (" -vo Enable optimization comments\n");
+ printf (" -vr Disable remarks\n");
+ printf (" -vs Disable signon\n");
+
+ printf ("\nAML Output:\n");
+ printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
+ printf (" -i<a|c> Create assembler or C include file (*.inc or *.h)\n");
+ printf (" -t<a|c> Create AML in assembler or C hex table (*.hex)\n");
+
+ printf ("\nAML Optimization:\n");
+ printf (" -oa Disable all optimizations (compatibility mode)\n");
+ printf (" -of Disable constant folding\n");
+ printf (" -oi Disable integer optimization to Zero/One/Ones\n");
+ printf (" -on Disable named reference string optimization\n");
+
+ printf ("\nListings:\n");
+ printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n");
+ printf (" -ln Create namespace file (*.nsp)\n");
+ printf (" -ls Create combined source file (expanded includes) (*.src)\n");
+
+ printf ("\nAML Disassembler:\n");
+ printf (" -d [file] Disassemble AML to ASL source code file (*.dsl)\n");
+ printf (" -dc [file] Disassemble AML and immediately compile it\n");
+ printf (" (Obtain DSDT from current system if no input file)\n");
+ printf (" -e Generate External() statements for unresolved symbols\n");
+ printf (" -g Get ACPI tables and write to files (*.dat)\n");
+
+ printf ("\nHelp:\n");
+ printf (" -h Additional help and compiler debug options\n");
+ printf (" -hc Display operators allowed in constant expressions\n");
+ printf (" -hr Display ACPI reserved method names\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Usage
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display help message
+ *
+ ******************************************************************************/
+
+void
+HelpMessage (
+ void)
+{
+
+ printf ("AML output filename generation:\n");
+ printf (" Output filenames are generated by appending an extension to a common\n");
+ printf (" filename prefix. The filename prefix is obtained via one of the\n");
+ printf (" following methods (in priority order):\n");
+ printf (" 1) The -p option specifies the prefix\n");
+ printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n");
+ printf (" 3) The prefix of the input filename\n");
+ printf ("\n");
+
+ Options ();
+
+ printf ("\nCompiler Debug Options:\n");
+ printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
+ printf (" Types: Parse/Tree/Both\n");
+ printf (" -f Ignore errors, force creation of AML output file(s)\n");
+ printf (" -c Parse only, no output generation\n");
+ printf (" -ot Display compile times\n");
+ printf (" -x<level> Set debug level for trace output\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Usage
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display usage and option message
+ *
+ ******************************************************************************/
+
+void
+Usage (
+ void)
+{
+
+ printf ("Usage: %s [Options] [InputFile]\n\n", CompilerName);
+ Options ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize compiler globals
+ *
+ ******************************************************************************/
+
+void
+AslInitialize (void)
+{
+ UINT32 i;
+
+
+#ifdef _DEBUG
+ _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0));
+#endif
+
+ AcpiDbgLevel = 0;
+
+ for (i = 0; i < ASL_NUM_FILES; i++)
+ {
+ Gbl_Files[i].Handle = NULL;
+ Gbl_Files[i].Filename = NULL;
+ }
+
+ Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
+ Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+
+ Gbl_Files[ASL_FILE_STDERR].Handle = stderr;
+ Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCommandLine
+ *
+ * PARAMETERS: argc/argv
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Command line processing
+ *
+ ******************************************************************************/
+
+void
+AslCommandLine (
+ int argc,
+ char **argv)
+{
+ BOOLEAN BadCommandLine = FALSE;
+ ACPI_NATIVE_UINT j;
+
+
+ /* Minimum command line contains at least one option or an input file */
+
+ if (argc < 2)
+ {
+ AslCompilerSignon (ASL_FILE_STDOUT);
+ Usage ();
+ exit (1);
+ }
+
+ /* Get the command line options */
+
+ while ((j = AcpiGetopt (argc, argv, "b:cd^efgh^i^l^o:p:rs:t:v:x:")) != EOF) switch (j)
+ {
+ case 'b':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'b':
+ AslCompilerdebug = 1; /* same as yydebug */
+ break;
+
+ case 'p':
+ AslCompilerdebug = 1; /* same as yydebug */
+ break;
+
+ case 't':
+ break;
+
+ default:
+ printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+
+ /* Produce debug output file */
+
+ Gbl_DebugFlag = TRUE;
+ break;
+
+
+ case 'c':
+
+ /* Parse only */
+
+ Gbl_ParseOnlyFlag = TRUE;
+ break;
+
+
+ case 'd':
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^':
+ DoCompile = FALSE;
+ break;
+
+ case 'c':
+ break;
+
+ default:
+ printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+
+ Gbl_DisasmFlag = TRUE;
+ break;
+
+
+ case 'e':
+
+ /* Generate external statements for unresolved symbols */
+
+ Gbl_GenerateExternals = TRUE;
+ break;
+
+
+ case 'f':
+
+ /* Ignore errors and force creation of aml file */
+
+ Gbl_IgnoreErrors = TRUE;
+ break;
+
+
+ case 'g':
+
+ /* Get all ACPI tables */
+
+ Gbl_GetAllTables = TRUE;
+ DoCompile = FALSE;
+ break;
+
+
+ case 'h':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^':
+ HelpMessage ();
+ exit (0);
+
+ case 'c':
+ UtDisplayConstantOpcodes ();
+ exit (0);
+
+ case 'r':
+ /* reserved names */
+
+ MpDisplayReservedNames ();
+ exit (0);
+
+ default:
+ printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'i':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'a':
+
+ /* Produce assembly code include file */
+
+ Gbl_AsmIncludeOutputFlag = TRUE;
+ break;
+
+ case 'c':
+
+ /* Produce C include file */
+
+ Gbl_C_IncludeOutputFlag = TRUE;
+ break;
+
+ default:
+ printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'l':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^':
+ /* Produce listing file (Mixed source/aml) */
+
+ Gbl_ListingFlag = TRUE;
+ break;
+
+ case 'n':
+ /* Produce namespace file */
+
+ Gbl_NsOutputFlag = TRUE;
+ break;
+
+ case 's':
+ /* Produce combined source file */
+
+ Gbl_SourceOutputFlag = TRUE;
+ break;
+
+ default:
+ printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'o':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'a':
+
+ /* Disable all optimizations */
+
+ Gbl_FoldConstants = FALSE;
+ Gbl_IntegerOptimizationFlag = FALSE;
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ break;
+
+ case 'f':
+
+ /* Disable folding on "normal" expressions */
+
+ Gbl_FoldConstants = FALSE;
+ break;
+
+ case 'i':
+
+ /* Disable integer optimization to constants */
+
+ Gbl_IntegerOptimizationFlag = FALSE;
+ break;
+
+ case 'n':
+
+ /* Disable named reference optimization */
+
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ break;
+
+ case 't':
+
+ /* Display compile time(s) */
+
+ Gbl_CompileTimesFlag = TRUE;
+ break;
+
+ default:
+ printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'p':
+
+ /* Override default AML output filename */
+
+ Gbl_OutputFilenamePrefix = AcpiGbl_Optarg;
+ Gbl_UseDefaultAmlFilename = FALSE;
+ break;
+
+
+ case 'r':
+ AslToFile = FALSE;
+ break;
+
+
+ case 's':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'a':
+
+ /* Produce assembly code output file */
+
+ Gbl_AsmOutputFlag = TRUE;
+ break;
+
+ case 'c':
+
+ /* Produce C hex output file */
+
+ Gbl_C_OutputFlag = TRUE;
+ break;
+
+ default:
+ printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 't':
+
+ /* Produce hex table output file */
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'a':
+ Gbl_HexOutputFlag = HEX_OUTPUT_ASM;
+ break;
+
+ case 'c':
+ Gbl_HexOutputFlag = HEX_OUTPUT_C;
+ break;
+
+ default:
+ printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'v':
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'i':
+ /* Less verbose error messages */
+
+ Gbl_VerboseErrors = FALSE;
+ break;
+
+ case 'o':
+ Gbl_DisplayOptimizations = TRUE;
+ break;
+
+ case 'r':
+ Gbl_DisplayRemarks = FALSE;
+ break;
+
+ case 's':
+ DoSignon = FALSE;
+ break;
+
+ default:
+ printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
+ case 'x':
+
+ AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
+ break;
+
+
+ default:
+
+ BadCommandLine = TRUE;
+ break;
+ }
+
+ /* Next parameter must be the input filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind];
+ if (!Gbl_Files[ASL_FILE_INPUT].Filename && !Gbl_DisasmFlag && !Gbl_GetAllTables)
+ {
+ printf ("Missing input filename\n");
+ BadCommandLine = TRUE;
+ }
+
+ if (DoSignon)
+ {
+ AslCompilerSignon (ASL_FILE_STDOUT);
+ }
+
+ /* Abort if anything went wrong on the command line */
+
+ if (BadCommandLine)
+ {
+ printf ("\n");
+ Usage ();
+ exit (1);
+ }
+
+ if ((AcpiGbl_Optind + 1) < argc)
+ {
+ printf ("Warning: extra arguments (%d) after input filename are ignored\n\n",
+ argc - AcpiGbl_Optind - 1);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: main
+ *
+ * PARAMETERS: Standard argc/argv
+ *
+ * RETURN: Program termination code
+ *
+ * DESCRIPTION: C main routine for the Asl Compiler. Handle command line
+ * options and begin the compile.
+ *
+ ******************************************************************************/
+
+int ACPI_SYSTEM_XFACE
+main (
+ int argc,
+ char **argv)
+{
+ ACPI_STATUS Status;
+ char *Prefix;
+
+
+ /* Init and command line */
+
+ AslInitialize ();
+ AslCommandLine (argc, argv);
+
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ &Gbl_DirectoryPath, &Prefix);
+
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = Prefix;
+ }
+
+ /*
+ * AML Disassembly (Optional)
+ */
+ if (Gbl_DisasmFlag || Gbl_GetAllTables)
+ {
+ /* ACPI CA subsystem initialization */
+
+ Status = AcpiOsInitialize ();
+ AcpiUtInitGlobals ();
+ Status = AcpiUtMutexInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ /* This is where the disassembly happens */
+
+ AcpiGbl_DbOpt_disasm = TRUE;
+ Status = AdAmlDisassemble (AslToFile,
+ Gbl_Files[ASL_FILE_INPUT].Filename,
+ Gbl_OutputFilenamePrefix,
+ &Gbl_Files[ASL_FILE_INPUT].Filename,
+ Gbl_GetAllTables);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ /*
+ * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
+ * .DSL disassembly file, which can now be compiled if requested
+ */
+ if (DoCompile)
+ {
+ AcpiOsPrintf ("\nCompiling \"%s\"\n",
+ Gbl_Files[ASL_FILE_INPUT].Filename);
+ }
+ }
+
+ /*
+ * ASL Compilation (Optional)
+ */
+ if (DoCompile)
+ {
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ &Gbl_DirectoryPath, &Prefix);
+
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = Prefix;
+ }
+
+ /* ACPI CA subsystem initialization (Must be re-initialized) */
+
+ Status = AcpiOsInitialize ();
+ AcpiUtInitGlobals ();
+ Status = AcpiUtMutexInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+
+ Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
+ Status = CmDoCompile ();
+ }
+
+ return (0);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c
new file mode 100644
index 0000000..a770c39
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslmap.c
@@ -0,0 +1,687 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslmap - parser to AML opcode mapping table
+ * $Revision: 70 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "amlcode.h"
+#include "acparser.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslmap")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslMapNamedOpcodeToDataType
+ *
+ * PARAMETERS: Opcode - The Named AML opcode to map
+ *
+ * RETURN: The ACPI type associated with the named opcode
+ *
+ * DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
+ * Named opcodes are a subset of the AML opcodes.
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE
+AslMapNamedOpcodeToDataType (
+ UINT16 Opcode)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ /*
+ * There are some differences from the opcode table types, we
+ * catch them here.
+ */
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+
+ if (Opcode == AML_INT_NAMEPATH_OP)
+ {
+ return (ACPI_TYPE_ANY);
+ }
+
+ if (Opcode == AML_INT_METHODCALL_OP)
+ {
+ return (ACPI_TYPE_ANY);
+ }
+
+ if (OpInfo->Flags & AML_NSOBJECT)
+ {
+ return (OpInfo->ObjectType);
+ }
+
+ return (ACPI_TYPE_ANY);
+}
+
+
+/*******************************************************************************
+ *
+ * DATA STRUCTURE: ReservedMethods
+ *
+ * DESCRIPTION: Contains all reserved methods and names as defined in the
+ * ACPI specification. Used during the analysis phase to
+ * ensure that reserved methods have the required number of
+ * arguments and the proper return type.
+ *
+ * Each entry in the table contains the following items:
+ *
+ * Name - The ACPI reserved name
+ * Args - Number of arguments to the method
+ * Flags - Whether this method must return a value or not
+ *
+ ******************************************************************************/
+
+const ASL_RESERVED_INFO ReservedMethods[] = {
+ {"_AC0", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC1", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC3", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC4", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC5", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC6", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC7", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC8", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AC9", 0, ASL_RSVD_RETURN_VALUE},
+ {"_ADR", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL0", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL1", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL3", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL4", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL5", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL6", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL7", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL8", 0, ASL_RSVD_RETURN_VALUE},
+ {"_AL9", 0, ASL_RSVD_RETURN_VALUE},
+ {"_ALN", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_ASI", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_BAS", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_BBN", 0, ASL_RSVD_RETURN_VALUE},
+ {"_BCL", 0, ASL_RSVD_RETURN_VALUE},
+ {"_BCM", 1, 0},
+ {"_BDN", 0, ASL_RSVD_RETURN_VALUE},
+ {"_BFS", 1, 0},
+ {"_BIF", 0, ASL_RSVD_RETURN_VALUE},
+ {"_BM_", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_BST", 0, ASL_RSVD_RETURN_VALUE},
+ {"_BTP", 1, 0},
+ {"_CID", 0, ASL_RSVD_RETURN_VALUE},
+ {"_CRS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_CRT", 0, ASL_RSVD_RETURN_VALUE},
+ {"_CST", 0, ASL_RSVD_RETURN_VALUE},
+ {"_DCK", 1, ASL_RSVD_RETURN_VALUE},
+ {"_DCS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_DDC", 1, ASL_RSVD_RETURN_VALUE},
+ {"_DDN", 0, 0},
+ {"_DEC", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_DGS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_DIS", 0, 0},
+ {"_DMA", 0, ASL_RSVD_RETURN_VALUE},
+ {"_DOD", 0, ASL_RSVD_RETURN_VALUE},
+ {"_DOS", 1, 0},
+ {"_DSS", 1, 0},
+ {"_EC_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_EDL", 0, ASL_RSVD_RETURN_VALUE},
+ {"_EJ0", 1, 0},
+ {"_EJ1", 1, 0},
+ {"_EJ2", 1, 0},
+ {"_EJ3", 1, 0},
+ {"_EJ4", 1, 0},
+ {"_EJD", 0, ASL_RSVD_RETURN_VALUE},
+ {"_FDE", 0, ASL_RSVD_RETURN_VALUE},
+ {"_FDI", 0, ASL_RSVD_RETURN_VALUE},
+ {"_FDM", 1, 0},
+ {"_FIX", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GL_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GLK", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GPD", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GPE", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GRA", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_GTF", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GTM", 0, ASL_RSVD_RETURN_VALUE},
+ {"_GTS", 1, 0},
+ {"_HE_", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_HID", 0, ASL_RSVD_RETURN_VALUE},
+ {"_HOT", 0, ASL_RSVD_RETURN_VALUE},
+ {"_HPP", 0, ASL_RSVD_RETURN_VALUE},
+ {"_INI", 0, 0},
+ {"_INT", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_IRC", 0, 0},
+ {"_LCK", 1, 0},
+ {"_LEN", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_LID", 0, ASL_RSVD_RETURN_VALUE},
+ {"_LL_", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MAF", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MAT", 0, ASL_RSVD_RETURN_VALUE},
+ {"_MAX", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MEM", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MIF", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MIN", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_MSG", 1, 0},
+ {"_OFF", 0, 0},
+ {"_ON_", 0, 0},
+ {"_OS_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_OSI", 1, ASL_RSVD_RETURN_VALUE},
+ {"_PCL", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PCT", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PDC", 1, 0},
+ {"_PIC", 1, 0},
+ {"_PPC", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PR0", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PR1", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PR2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PRS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PRT", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PRW", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PS0", 0, 0},
+ {"_PS1", 0, 0},
+ {"_PS2", 0, 0},
+ {"_PS3", 0, 0},
+ {"_PSC", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PSL", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PSR", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PSS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PSV", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PSW", 1, 0},
+ {"_PTC", 0, ASL_RSVD_RETURN_VALUE},
+ {"_PTS", 1, 0},
+ {"_PXM", 0, ASL_RSVD_RETURN_VALUE},
+ {"_RBO", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_RBW", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_REG", 2, 0},
+ {"_REV", 0, ASL_RSVD_RETURN_VALUE},
+ {"_RMV", 0, ASL_RSVD_RETURN_VALUE},
+ {"_RNG", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_ROM", 2, ASL_RSVD_RETURN_VALUE},
+ {"_RW_", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_S0_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S1_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S2_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S3_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S4_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S5_", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S1D", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S2D", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S3D", 0, ASL_RSVD_RETURN_VALUE},
+ {"_S4D", 0, ASL_RSVD_RETURN_VALUE},
+ {"_SB_", 0, ASL_RSVD_SCOPE},
+ {"_SBS", 0, ASL_RSVD_RETURN_VALUE},
+ {"_SCP", 1, 0},
+ {"_SEG", 0, ASL_RSVD_RETURN_VALUE},
+ {"_SHR", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_SI_", 0, ASL_RSVD_SCOPE},
+ {"_SIZ", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_SPD", 1, ASL_RSVD_RETURN_VALUE},
+ {"_SRS", 1, 0},
+ {"_SST", 1, 0},
+ {"_STA", 0, ASL_RSVD_RETURN_VALUE},
+ {"_STM", 3, 0},
+ {"_STR", 0, ASL_RSVD_RETURN_VALUE},
+ {"_SUN", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TC1", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TC2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TMP", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TRA", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_TRS", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_TSP", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TTP", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_TYP", 0, ASL_RSVD_RESOURCE_NAME},
+ {"_TZ_", 0, ASL_RSVD_SCOPE},
+ {"_TZD", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TZP", 0, ASL_RSVD_RETURN_VALUE},
+ {"_UID", 0, ASL_RSVD_RETURN_VALUE},
+ {"_VPO", 0, ASL_RSVD_RETURN_VALUE},
+ {"_WAK", 1, ASL_RSVD_RETURN_VALUE},
+ {NULL, 0, 0},
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: MpDisplayReservedNames
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the table above
+ *
+ ******************************************************************************/
+
+void
+MpDisplayReservedNames (
+ void)
+{
+ UINT32 i;
+
+ printf ("Reserved name information\n\n");
+
+ for (i = 0; ReservedMethods[i].Name; i++)
+ {
+ printf ("%s ", ReservedMethods[i].Name);
+
+ if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
+ {
+ printf ("Reserved scope name\n");
+ }
+ else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
+ {
+ printf ("Resource data type reserved field name\n");
+ }
+ else
+ {
+ printf ("Method with %d arguments, ", ReservedMethods[i].NumArguments);
+ if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
+ {
+ printf ("must return a value\n");
+ }
+ else
+ {
+ printf ("no return value\n");
+ }
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * DATA STRUCTURE: AslKeywordMapping
+ *
+ * DESCRIPTION: Maps the ParseOpcode to the actual AML opcode. The parse
+ * opcodes are generated from Bison, and this table must
+ * track any additions to them.
+ *
+ * Each entry in the table contains the following items:
+ *
+ * AML opcode - Opcode that is written to the AML file
+ * Value - Value of the object to be written (if applicable)
+ * Flags - 1) Whether this opcode opens an AML "package".
+ *
+ ******************************************************************************/
+/*
+ * TBD:
+ * AccessAttrib
+ * AccessType
+ * AMlop for DMA?
+ * ObjectType keywords
+ * Register
+ */
+
+const ASL_MAPPING_ENTRY AslKeywordMapping [] =
+{
+/*! [Begin] no source code translation (keep the table structure) */
+
+
+/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0),
+/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK, 0, 0),
+/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK_CALL,0, 0),
+/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BYTE, 0, 0),
+/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD_CALL, 0, 0),
+/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_QUICK, 0, 0),
+/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_SEND_RCV, 0, 0),
+/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD, 0, 0),
+/* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0),
+/* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0),
+/* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0),
+/* ACCESSTYPE_DWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_DWORD, 0, 0),
+/* ACCESSTYPE_QWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_QWORD, 0, 0),
+/* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0),
+/* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0),
+/* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* ADDRESSTYPE_RESERVED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* ALIAS */ OP_TABLE_ENTRY (AML_ALIAS_OP, 0, 0, 0),
+/* AND */ OP_TABLE_ENTRY (AML_BIT_AND_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ARG0 */ OP_TABLE_ENTRY (AML_ARG0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG1 */ OP_TABLE_ENTRY (AML_ARG1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG2 */ OP_TABLE_ENTRY (AML_ARG2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG3 */ OP_TABLE_ENTRY (AML_ARG3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG4 */ OP_TABLE_ENTRY (AML_ARG4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG5 */ OP_TABLE_ENTRY (AML_ARG5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* ARG6 */ OP_TABLE_ENTRY (AML_ARG6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* BANKFIELD */ OP_TABLE_ENTRY (AML_BANK_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
+/* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0),
+/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0),
+/* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER),
+/* BUSMASTERTYPE_MASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* BYTECONST */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, 0, 0, ACPI_BTYPE_INTEGER),
+/* CASE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA),
+/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER),
+/* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0),
+/* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
+/* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0),
+/* CREATEBYTEFIELD */ OP_TABLE_ENTRY (AML_CREATE_BYTE_FIELD_OP, 0, 0, 0),
+/* CREATEDWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_DWORD_FIELD_OP, 0, 0, 0),
+/* CREATEFIELD */ OP_TABLE_ENTRY (AML_CREATE_FIELD_OP, 0, 0, 0),
+/* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0),
+/* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0),
+/* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0),
+/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT),
+/* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* DECODETYPE_SUB */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* DECREMENT */ OP_TABLE_ENTRY (AML_DECREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* DEFAULT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* DEFAULT_ARG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* DEFINITIONBLOCK */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* DEREFOF */ OP_TABLE_ENTRY (AML_DEREF_OF_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_STRING),
+/* DEVICE */ OP_TABLE_ENTRY (AML_DEVICE_OP, 0, NODE_AML_PACKAGE, 0),
+/* DIVIDE */ OP_TABLE_ENTRY (AML_DIVIDE_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* DMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* DMATYPE_A */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* DMATYPE_COMPATIBILITY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* DMATYPE_B */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* DMATYPE_F */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* DWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_DWORD, 0, 0, ACPI_BTYPE_INTEGER),
+/* DWORDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* DWORDMEMORY */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0),
+/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0),
+/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0),
+/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0),
+/* EXTERNAL */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* FATAL */ OP_TABLE_ENTRY (AML_FATAL_OP, 0, 0, 0),
+/* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
+/* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0),
+/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE),
+/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
+/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* INTTYPE_LEVEL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LNOTEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0),
+/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE),
+/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL1 */ OP_TABLE_ENTRY (AML_LOCAL1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL2 */ OP_TABLE_ENTRY (AML_LOCAL2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL3 */ OP_TABLE_ENTRY (AML_LOCAL3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL4 */ OP_TABLE_ENTRY (AML_LOCAL4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL5 */ OP_TABLE_ENTRY (AML_LOCAL5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL6 */ OP_TABLE_ENTRY (AML_LOCAL6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCAL7 */ OP_TABLE_ENTRY (AML_LOCAL7, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* LOCKRULE_LOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_ALWAYS, 0, 0),
+/* LOCKRULE_NOLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_NEVER, 0, 0),
+/* LOR */ OP_TABLE_ENTRY (AML_LOR_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* MATCH */ OP_TABLE_ENTRY (AML_MATCH_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MEQ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MEQ, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MGE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGE, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MGT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGT, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MLE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLE, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MLT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLT, 0, ACPI_BTYPE_INTEGER),
+/* MATCHTYPE_MTR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MTR, 0, ACPI_BTYPE_INTEGER),
+/* MAXTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* MAXTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* MEMORY24 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* MEMORY32 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* MEMORY32FIXED */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* MEMTYPE_CACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* MEMTYPE_NONCACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* MEMTYPE_PREFETCHABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* MEMTYPE_WRITECOMBINING */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* METHOD */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0),
+/* METHODCALL */ OP_TABLE_ENTRY (AML_INT_METHODCALL_OP, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
+/* MID */ OP_TABLE_ENTRY (AML_MID_OP, 0, 0, ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER),
+/* MINTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* MINTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* MOD */ OP_TABLE_ENTRY (AML_MOD_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* MULTIPLY */ OP_TABLE_ENTRY (AML_MULTIPLY_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* MUTEX */ OP_TABLE_ENTRY (AML_MUTEX_OP, 0, 0, 0),
+/* NAME */ OP_TABLE_ENTRY (AML_NAME_OP, 0, 0, 0),
+/* NAMESEG */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0),
+/* NAMESTRING */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0),
+/* NAND */ OP_TABLE_ENTRY (AML_BIT_NAND_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* NOOP */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0),
+/* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0),
+/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0),
+/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0),
+/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0),
+/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0),
+/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0),
+/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0),
+/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0),
+/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0),
+/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0),
+/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0),
+/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0),
+/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0),
+/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0),
+/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0),
+/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0),
+/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),
+/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* OPERATIONREGION */ OP_TABLE_ENTRY (AML_REGION_OP, 0, 0, 0),
+/* OR */ OP_TABLE_ENTRY (AML_BIT_OR_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* PACKAGE */ OP_TABLE_ENTRY (AML_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE),
+/* PACKAGEP_LENGTH */ OP_TABLE_ENTRY (AML_PACKAGE_LENGTH, 0, NODE_AML_PACKAGE, 0),
+/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0),
+/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0),
+/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER),
+/* QWORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* QWORDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* RANGE_TYPE_ENTIRE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* RANGE_TYPE_ISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* RANGE_TYPE_NONISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE),
+/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0),
+/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0),
+/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0),
+/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0),
+/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0),
+/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0),
+/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0),
+/* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0),
+/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),
+/* RESET */ OP_TABLE_ENTRY (AML_RESET_OP, 0, 0, 0),
+/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER),
+/* RESOURCETYPE_CONSUMER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* RESOURCETYPE_PRODUCER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* RETURN */ OP_TABLE_ENTRY (AML_RETURN_OP, 0, 0, 0),
+/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* SCOPE */ OP_TABLE_ENTRY (AML_SCOPE_OP, 0, NODE_AML_PACKAGE, 0),
+/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0),
+/* SIZEOF */ OP_TABLE_ENTRY (AML_SIZE_OF_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0),
+/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0),
+/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
+/* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* SWITCH */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* THERMALZONE */ OP_TABLE_ENTRY (AML_THERMAL_ZONE_OP, 0, NODE_AML_PACKAGE, 0),
+/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA),
+/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* TOSTRING */ OP_TABLE_ENTRY (AML_TO_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* TRANSLATIONTYPE_DENSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0),
+/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0),
+/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0),
+/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0),
+/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ZEROS,0, 0),
+/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE),
+/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* WHILE */ OP_TABLE_ENTRY (AML_WHILE_OP, 0, NODE_AML_PACKAGE, 0),
+/* WORDBUSNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* WORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_WORD, 0, 0, ACPI_BTYPE_INTEGER),
+/* WORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* XFERTYPE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* XFERTYPE_8_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* XOR */ OP_TABLE_ENTRY (AML_BIT_XOR_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* ZERO */ OP_TABLE_ENTRY (AML_ZERO_OP, 0, 0, ACPI_BTYPE_INTEGER),
+
+/*! [End] no source code translation !*/
+
+};
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c
new file mode 100644
index 0000000..c9581e6
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c
@@ -0,0 +1,620 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslopcode - AML opcode generation
+ * $Revision: 54 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslopcodes")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlOpcodeWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML
+ * operands.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlOpcodeWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ TotalParseNodes++;
+
+ OpcGenerateAmlOpcode (Op);
+ OpnGenerateAmlOperands (Op);
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcGetIntegerWidth
+ *
+ * PARAMETERS: Op - DEFINITION BLOCK op
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Extract integer width from the table revision
+ *
+ ******************************************************************************/
+
+void
+OpcGetIntegerWidth (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child;
+
+ if (!Op)
+ {
+ return;
+ }
+
+ Child = Op->Asl.Child;
+ Child = Child->Asl.Next;
+ Child = Child->Asl.Next;
+
+ /* Use the revision to set the integer width */
+
+ AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcSetOptimalIntegerSize
+ *
+ * PARAMETERS: Op - A parse tree node
+ *
+ * RETURN: Integer width, in bytes. Also sets the node AML opcode to the
+ * optimal integer AML prefix opcode.
+ *
+ * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading
+ * zeros can be truncated to squeeze the integer into the
+ * minimal number of AML bytes.
+ *
+ ******************************************************************************/
+
+UINT32
+OpcSetOptimalIntegerSize (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ /*
+ * Check for the special AML integers first - Zero, One, Ones.
+ * These are single-byte opcodes that are the smallest possible
+ * representation of an integer.
+ *
+ * This optimization is optional.
+ */
+ if (Gbl_IntegerOptimizationFlag)
+ {
+ switch (Op->Asl.Value.Integer)
+ {
+ case 0:
+
+ Op->Asl.AmlOpcode = AML_ZERO_OP;
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Zero");
+ return 1;
+
+ case 1:
+
+ Op->Asl.AmlOpcode = AML_ONE_OP;
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "One");
+ return 1;
+
+ case ACPI_UINT32_MAX:
+
+ /* Check for table integer width (32 or 64) */
+
+ if (AcpiGbl_IntegerByteWidth == 4)
+ {
+ Op->Asl.AmlOpcode = AML_ONES_OP;
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
+ return 1;
+ }
+ break;
+
+ case ACPI_INTEGER_MAX:
+
+ /* Check for table integer width (32 or 64) */
+
+ if (AcpiGbl_IntegerByteWidth == 8)
+ {
+ Op->Asl.AmlOpcode = AML_ONES_OP;
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
+ return 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Find the best fit using the various AML integer prefixes */
+
+ if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX)
+ {
+ Op->Asl.AmlOpcode = AML_BYTE_OP;
+ return 1;
+ }
+ if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)
+ {
+ Op->Asl.AmlOpcode = AML_WORD_OP;
+ return 2;
+ }
+ if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)
+ {
+ Op->Asl.AmlOpcode = AML_DWORD_OP;
+ return 4;
+ }
+ else
+ {
+ Op->Asl.AmlOpcode = AML_QWORD_OP;
+ return 8;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcDoAccessAs
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Implement the ACCESS_AS ASL keyword.
+ *
+ ******************************************************************************/
+
+void
+OpcDoAccessAs (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ Op->Asl.AmlOpcodeLength = 1;
+ Next = Op->Asl.Child;
+
+ /* First child is the access type */
+
+ Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+
+ /* Second child is the optional access attribute */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ Next->Asl.Value.Integer = 0;
+ }
+ Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcDoUnicode
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Implement the UNICODE ASL "macro". Convert the input string
+ * to a unicode buffer. There is no Unicode AML opcode.
+ *
+ * Note: The Unicode string is 16 bits per character, no leading signature,
+ * with a 16-bit terminating NULL.
+ *
+ ******************************************************************************/
+
+void
+OpcDoUnicode (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *InitializerOp;
+ UINT32 Length;
+ UINT32 Count;
+ UINT32 i;
+ UINT8 *AsciiString;
+ UINT16 *UnicodeString;
+ ACPI_PARSE_OBJECT *BufferLengthOp;
+
+
+ /* Change op into a buffer object */
+
+ Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
+ Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+ UtSetParseOpName (Op);
+
+ /* Buffer Length is first, followed by the string */
+
+ BufferLengthOp = Op->Asl.Child;
+ InitializerOp = BufferLengthOp->Asl.Next;
+
+ AsciiString = (UINT8 *) InitializerOp->Asl.Value.String;
+
+ /* Create a new buffer for the Unicode string */
+
+ Count = strlen (InitializerOp->Asl.Value.String) + 1;
+ Length = Count * sizeof (UINT16);
+ UnicodeString = UtLocalCalloc (Length);
+
+ /* Convert to Unicode string (including null terminator) */
+
+ for (i = 0; i < Count; i++)
+ {
+ UnicodeString[i] = (UINT16) AsciiString[i];
+ }
+
+ /*
+ * Just set the buffer size node to be the buffer length, regardless
+ * of whether it was previously an integer or a default_arg placeholder
+ */
+ BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
+ BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
+ BufferLengthOp->Asl.Value.Integer = Length;
+ UtSetParseOpName (BufferLengthOp);
+
+ (void) OpcSetOptimalIntegerSize (BufferLengthOp);
+
+ /* The Unicode string is a raw data buffer */
+
+ InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString;
+ InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ InitializerOp->Asl.AmlLength = Length;
+ InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+ InitializerOp->Asl.Child = NULL;
+ UtSetParseOpName (InitializerOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcDoEisaId
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ *
+ * DESCRIPTION: Convert a string EISA ID to numeric representation. See the
+ * Pnp BIOS Specification for details. Here is an excerpt:
+ *
+ * A seven character ASCII representation of the product
+ * identifier compressed into a 32-bit identifier. The seven
+ * character ID consists of a three character manufacturer code,
+ * a three character hexadecimal product identifier, and a one
+ * character hexadecimal revision number. The manufacturer code
+ * is a 3 uppercase character code that is compressed into 3 5-bit
+ * values as follows:
+ * 1) Find hex ASCII value for each letter
+ * 2) Subtract 40h from each ASCII value
+ * 3) Retain 5 least signficant bits for each letter by
+ * discarding upper 3 bits because they are always 0.
+ * 4) Compressed code = concatenate 0 and the 3 5-bit values
+ *
+ * The format of the compressed product identifier is as follows:
+ * Byte 0: Bit 7 - Reserved (0)
+ * Bits 6-2: - 1st character of compressed mfg code
+ * Bits 1-0 - Upper 2 bits of 2nd character of mfg code
+ * Byte 1: Bits 7-5 - Lower 3 bits of 2nd character of mfg code
+ * Bits 4-0 - 3rd character of mfg code
+ * Byte 2: Bits 7-4 - 1st hex digit of product number
+ * Bits 3-0 - 2nd hex digit of product number
+ * Byte 3: Bits 7-4 - 3st hex digit of product number
+ * Bits 3-0 - Hex digit of the revision number
+ *
+ ******************************************************************************/
+
+void
+OpcDoEisaId (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 EisaId = 0;
+ UINT32 BigEndianId;
+ char *InString;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_NATIVE_UINT i;
+
+
+ InString = (char *) Op->Asl.Value.String;
+
+ /*
+ * The EISAID string must be exactly 7 characters and of the form
+ * "LLLXXXX" -- 3 letters and 4 hex digits (e.g., "PNP0001")
+ */
+ if (ACPI_STRLEN (InString) != 7)
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ else
+ {
+ /* Check all 7 characters for correct format */
+
+ for (i = 0; i < 7; i++)
+ {
+ /* First 3 characters must be letters */
+
+ if (i < 3)
+ {
+ if (!isalpha (InString[i]))
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ }
+
+ /* Last 4 characters must be hex digits */
+
+ else if (!isxdigit (InString[i]))
+ {
+ Status = AE_BAD_PARAMETER;
+ }
+ }
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String);
+ }
+ else
+ {
+ /* Create ID big-endian first (bits are contiguous) */
+
+ BigEndianId = (UINT32) (InString[0] - 0x40) << 26 |
+ (UINT32) (InString[1] - 0x40) << 21 |
+ (UINT32) (InString[2] - 0x40) << 16 |
+
+ (UtHexCharToValue (InString[3])) << 12 |
+ (UtHexCharToValue (InString[4])) << 8 |
+ (UtHexCharToValue (InString[5])) << 4 |
+ UtHexCharToValue (InString[6]);
+
+ /* Swap to little-endian to get final ID (see function header) */
+
+ EisaId = AcpiUtDwordByteSwap (BigEndianId);
+ }
+
+ /*
+ * Morph the Op into an integer, regardless of whether there
+ * was an error in the EISAID string
+ */
+ Op->Asl.Value.Integer = EisaId;
+
+ Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ (void) OpcSetOptimalIntegerSize (Op);
+
+ /* Op is now an integer */
+
+ UtSetParseOpName (Op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcGenerateAmlOpcode
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generate the AML opcode associated with the node and its
+ * parse (lex/flex) keyword opcode. Essentially implements
+ * a mapping between the parse opcodes and the actual AML opcodes.
+ *
+ ******************************************************************************/
+
+void
+OpcGenerateAmlOpcode (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ UINT16 Index;
+
+
+ Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE);
+
+ Op->Asl.AmlOpcode = AslKeywordMapping[Index].AmlOpcode;
+ Op->Asl.AcpiBtype = AslKeywordMapping[Index].AcpiBtype;
+ Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags;
+
+ if (!Op->Asl.Value.Integer)
+ {
+ Op->Asl.Value.Integer = AslKeywordMapping[Index].Value;
+ }
+
+ /* Special handling for some opcodes */
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_INTEGER:
+ /*
+ * Set the opcode based on the size of the integer
+ */
+ (void) OpcSetOptimalIntegerSize (Op);
+ break;
+
+ case PARSEOP_OFFSET:
+
+ Op->Asl.AmlOpcodeLength = 1;
+ break;
+
+ case PARSEOP_ACCESSAS:
+
+ OpcDoAccessAs (Op);
+ break;
+
+ case PARSEOP_EISAID:
+
+ OpcDoEisaId (Op);
+ break;
+
+ case PARSEOP_UNICODE:
+
+ OpcDoUnicode (Op);
+ break;
+
+ case PARSEOP_INCLUDE:
+
+ Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ Gbl_HasIncludeFiles = TRUE;
+ break;
+
+ case PARSEOP_EXTERNAL:
+
+ Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ break;
+
+ case PARSEOP_PACKAGE:
+ /*
+ * The variable-length package has a different opcode
+ */
+ if ((Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_BYTECONST))
+ {
+ Op->Asl.AmlOpcode = AML_VAR_PACKAGE_OP;
+ }
+ break;
+
+ default:
+ /* Nothing to do for other opcodes */
+ break;
+ }
+
+ return;
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c
new file mode 100644
index 0000000..a92d0cc
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asloperands.c
@@ -0,0 +1,1112 @@
+
+/******************************************************************************
+ *
+ * Module Name: asloperands - AML operand processing
+ * $Revision: 45 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asloperands")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoMethod
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the operands for the METHOD ASL keyword.
+ *
+ ******************************************************************************/
+
+void
+OpnDoMethod (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+ /* Optional arguments for this opcode with defaults */
+
+ UINT8 NumArgs = 0;
+ UINT8 Serialized = 0;
+ UINT8 Concurrency = 0;
+ UINT8 MethodFlags;
+
+
+ /* Opcode and package length first */
+ /* Method name */
+
+ Next = Op->Asl.Child;
+
+ /* Num args */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ NumArgs = (UINT8) Next->Asl.Value.Integer;
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ }
+
+ /* Serialized Flag */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Serialized = (UINT8) Next->Asl.Value.Integer;
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ }
+
+ /* Concurrency value (0-15 valid) */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Concurrency = (UINT8) Next->Asl.Value.Integer;
+ }
+
+ /* Put the bits in their proper places */
+
+ MethodFlags = (UINT8) ((NumArgs & 0x7) |
+ ((Serialized & 0x1) << 3) |
+ ((Concurrency & 0xF) << 4));
+
+ /* Use the last node for the combined flags byte */
+
+ Next->Asl.Value.Integer = MethodFlags;
+ Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ Next->Asl.AmlLength = 1;
+ Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+
+ /* Save the arg count in the first node */
+
+ Op->Asl.Extra = NumArgs;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoFieldCommon
+ *
+ * PARAMETERS: FieldOp - Node for an ASL field
+ * Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the various field keywords,
+ * FIELD, BANKFIELD, INDEXFIELD
+ *
+ ******************************************************************************/
+
+void
+OpnDoFieldCommon (
+ ACPI_PARSE_OBJECT *FieldOp,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_PARSE_OBJECT *PkgLengthNode;
+ UINT32 CurrentBitOffset;
+ UINT32 NewBitOffset;
+ UINT8 AccessType;
+ UINT8 LockRule;
+ UINT8 UpdateRule;
+ UINT8 FieldFlags;
+ UINT32 MinimumLength;
+
+
+ /* AccessType -- not optional, so no need to check for DEFAULT_ARG */
+
+ AccessType = (UINT8) Op->Asl.Value.Integer;
+ Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* Set the access type in the parent (field) node for use later */
+
+ FieldOp->Asl.Value.Integer = AccessType;
+
+ /* LockRule -- not optional, so no need to check for DEFAULT_ARG */
+
+ Next = Op->Asl.Next;
+ LockRule = (UINT8) Next->Asl.Value.Integer;
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */
+
+ Next = Next->Asl.Next;
+ UpdateRule = (UINT8) Next->Asl.Value.Integer;
+
+ /*
+ * Generate the flags byte. The various fields are already
+ * in the right bit position via translation from the
+ * keywords by the parser.
+ */
+ FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule);
+
+ /* Use the previous node to be the FieldFlags node */
+
+ /* Set the node to RAW_DATA */
+
+ Next->Asl.Value.Integer = FieldFlags;
+ Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ Next->Asl.AmlLength = 1;
+ Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+
+ /* Process the FieldUnitList */
+
+ Next = Next->Asl.Next;
+ CurrentBitOffset = 0;
+
+ while (Next)
+ {
+ /* Save the offset of this field unit */
+
+ Next->Asl.ExtraValue = CurrentBitOffset;
+
+ switch (Next->Asl.ParseOpcode)
+ {
+ case PARSEOP_ACCESSAS:
+
+ PkgLengthNode = Next->Asl.Child;
+ AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer;
+
+ /* Nothing additional to do */
+ break;
+
+
+ case PARSEOP_OFFSET:
+
+ /* New offset into the field */
+
+ PkgLengthNode = Next->Asl.Child;
+ NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8;
+
+ /*
+ * Examine the specified offset in relation to the
+ * current offset counter.
+ */
+ if (NewBitOffset < CurrentBitOffset)
+ {
+ /*
+ * Not allowed to specify a backwards offset!
+ * Issue error and ignore this node.
+ */
+ AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, NULL);
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ }
+ else if (NewBitOffset == CurrentBitOffset)
+ {
+ /*
+ * Offset is redundant; we don't need to output an
+ * offset opcode. Just set these nodes to default
+ */
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ }
+ else
+ {
+ /*
+ * Valid new offset - set the value to be inserted into the AML
+ * and update the offset counter.
+ */
+ PkgLengthNode->Asl.Value.Integer = NewBitOffset - CurrentBitOffset;
+ CurrentBitOffset = NewBitOffset;
+ }
+ break;
+
+
+ case PARSEOP_NAMESEG:
+ case PARSEOP_RESERVED_BYTES:
+
+ /* Named or reserved field entry */
+
+ PkgLengthNode = Next->Asl.Child;
+ NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
+ CurrentBitOffset += NewBitOffset;
+
+ /* Save the current AccessAs value for error checking later */
+
+ switch (AccessType)
+ {
+ case AML_FIELD_ACCESS_ANY:
+ case AML_FIELD_ACCESS_BYTE:
+ case AML_FIELD_ACCESS_BUFFER:
+ default:
+ MinimumLength = 8;
+ break;
+
+ case AML_FIELD_ACCESS_WORD:
+ MinimumLength = 16;
+ break;
+
+ case AML_FIELD_ACCESS_DWORD:
+ MinimumLength = 32;
+ break;
+
+ case AML_FIELD_ACCESS_QWORD:
+ MinimumLength = 64;
+ break;
+ }
+
+ PkgLengthNode->Asl.ExtraValue = MinimumLength;
+ break;
+
+ default:
+ /* All supported field opcodes must appear above */
+ break;
+ }
+
+ /* Move on to next entry in the field list */
+
+ Next = Next->Asl.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoField
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword
+ *
+ ******************************************************************************/
+
+void
+OpnDoField (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /* Opcode is parent node */
+ /* First child is field name */
+
+ Next = Op->Asl.Child;
+
+ /* Second child is the AccessType */
+
+ OpnDoFieldCommon (Op, Next->Asl.Next);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoIndexField
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword
+ *
+ ******************************************************************************/
+
+void
+OpnDoIndexField (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /* Opcode is parent node */
+ /* First child is the index name */
+
+ Next = Op->Asl.Child;
+
+ /* Second child is the data name */
+
+ Next = Next->Asl.Next;
+
+ /* Third child is the AccessType */
+
+ OpnDoFieldCommon (Op, Next->Asl.Next);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoBankField
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword
+ *
+ ******************************************************************************/
+
+void
+OpnDoBankField (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /* Opcode is parent node */
+ /* First child is the region name */
+
+ Next = Op->Asl.Child;
+
+ /* Second child is the bank name */
+
+ Next = Next->Asl.Next;
+
+ /* Third child is the bank value */
+
+ Next = Next->Asl.Next;
+
+ /* Fourth child is the AccessType */
+
+ OpnDoFieldCommon (Op, Next->Asl.Next);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoRegion
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Tries to get the length of the region. Can only do this at
+ * compile time if the length is a constant.
+ *
+ ******************************************************************************/
+
+void
+OpnDoRegion (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /* Opcode is parent node */
+ /* First child is the region name */
+
+ Next = Op->Asl.Child;
+
+ /* Second child is the space ID*/
+
+ Next = Next->Asl.Next;
+
+ /* Third child is the region offset */
+
+ Next = Next->Asl.Next;
+
+ /* Fourth child is the region length */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode == PARSEOP_INTEGER)
+ {
+ Op->Asl.Value.Integer = Next->Asl.Value.Integer;
+ }
+ else
+ {
+ Op->Asl.Value.Integer = ACPI_INTEGER_MAX;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoBuffer
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We
+ * build a single raw byte buffer from the initialization nodes,
+ * each parse node contains a buffer byte.
+ *
+ ******************************************************************************/
+
+void
+OpnDoBuffer (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferLengthOp;
+
+ /* Optional arguments for this opcode with defaults */
+
+ UINT32 BufferLength = 0;
+
+
+ /* Opcode and package length first */
+ /* Buffer Length is next, followed by the initializer list */
+
+ BufferLengthOp = Op->Asl.Child;
+ InitializerOp = BufferLengthOp->Asl.Next;
+
+ /*
+ * If the BufferLength is not an INTEGER or was not specified in the ASL
+ * (DEFAULT_ARG), it is a TermArg that is
+ * evaluated at run-time, and we are therefore finished.
+ */
+ if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) &&
+ (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ return;
+ }
+
+ /*
+ * We want to count the number of items in the initializer list, because if
+ * it is larger than the buffer length, we will define the buffer size
+ * to be the size of the initializer list (as per the ACPI Specification)
+ */
+ switch (InitializerOp->Asl.ParseOpcode)
+ {
+ case PARSEOP_INTEGER:
+ case PARSEOP_BYTECONST:
+ case PARSEOP_WORDCONST:
+ case PARSEOP_DWORDCONST:
+
+ /* The peer list contains the byte list (if any...) */
+
+ while (InitializerOp)
+ {
+ /* For buffers, this is a list of raw bytes */
+
+ InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ InitializerOp->Asl.AmlLength = 1;
+ InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+
+ BufferLength++;
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ }
+ break;
+
+
+ case PARSEOP_STRING_LITERAL:
+
+ /*
+ * Only one initializer, the string. Buffer must be big enough to hold
+ * the string plus the null termination byte
+ */
+ BufferLength = strlen (InitializerOp->Asl.Value.String) + 1;
+
+ InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ InitializerOp->Asl.AmlLength = BufferLength;
+ InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+ break;
+
+
+ case PARSEOP_RAW_DATA:
+
+ /* Buffer nodes are already initialized (e.g. Unicode operator) */
+ return;
+
+
+ case PARSEOP_DEFAULT_ARG:
+ break;
+
+
+ default:
+ AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp,
+ "Unknown buffer initializer opcode");
+ printf ("Unknown buffer initializer opcode [%s]\n",
+ UtGetOpName (InitializerOp->Asl.ParseOpcode));
+ return;
+ }
+
+ /* Check if initializer list is longer than the buffer length */
+
+ if (BufferLengthOp->Asl.Value.Integer > BufferLength)
+ {
+ BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer;
+ }
+
+ if (!BufferLength)
+ {
+ /* No length AND no items -- issue a warning */
+
+ AslError (ASL_WARNING, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL);
+
+ /* But go ahead and put the buffer length of zero into the AML */
+ }
+
+ /*
+ * Just set the buffer size node to be the buffer length, regardless
+ * of whether it was previously an integer or a default_arg placeholder
+ */
+ BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
+ BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
+ BufferLengthOp->Asl.Value.Integer = BufferLength;
+
+ (void) OpcSetOptimalIntegerSize (BufferLengthOp);
+
+ /* Remaining nodes are handled via the tree walk */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoPackage
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword.
+ *
+ ******************************************************************************/
+
+void
+OpnDoPackage (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *PackageLengthOp;
+
+ /* Optional arguments for this opcode with defaults */
+
+ UINT32 PackageLength = 0;
+
+
+ /* Opcode and package length first */
+ /* Buffer Length is next, followed by the initializer list */
+
+ PackageLengthOp = Op->Asl.Child;
+ InitializerOp = PackageLengthOp->Asl.Next;
+
+ /*
+ * We always count the number of items in the initializer list, because if
+ * it is larger than the buffer length, we will define the buffer size
+ * to be the size of the initializer list (Per ACPI Spec)
+ */
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* The peer list contains the byte list (if any...) */
+
+ while (InitializerOp)
+ {
+ PackageLength++;
+ InitializerOp = InitializerOp->Asl.Next;
+ }
+ }
+
+ /* Check if initializer list is longer than the buffer length */
+
+ if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
+ (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST))
+ {
+ if (PackageLengthOp->Asl.Value.Integer > PackageLength)
+ {
+ PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer;
+ }
+ }
+
+ /*
+ * If not a variable-length package, check for a zero
+ * package length
+ */
+ if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
+ (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
+ (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG))
+ {
+ if (!PackageLength)
+ {
+ /* No length AND no items -- issue a warning */
+
+ AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthOp, NULL);
+
+ /* But go ahead and put the buffer length of zero into the AML */
+ }
+ }
+
+ /*
+ * Just set the buffer size node to be the buffer length, regardless
+ * of whether it was previously an integer or a default_arg placeholder
+ */
+ PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ PackageLengthOp->Asl.AmlLength = 1;
+ PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+ PackageLengthOp->Asl.Value.Integer = PackageLength;
+
+ /* Remaining nodes are handled via the tree walk */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoLoadTable
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword.
+ *
+ ******************************************************************************/
+
+void
+OpnDoLoadTable (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ /* Opcode is parent node */
+ /* First child is the table signature */
+
+ Next = Op->Asl.Child;
+
+ /* Second child is the OEM ID*/
+
+ Next = Next->Asl.Next;
+
+ /* Third child is the OEM table ID */
+
+ Next = Next->Asl.Next;
+
+ /* Fourth child is the RootPath string */
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
+ Next->Asl.Value.String = "\\";
+ Next->Asl.AmlLength = 2;
+ OpcGenerateAmlOpcode (Next);
+ }
+
+ /* Fifth child is the [optional] ParameterPathString */
+ /* Sixth child is the [optional] ParameterData */
+
+/*
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode == DEFAULT_ARG)
+ {
+ Next->Asl.AmlLength = 1;
+ Next->Asl.ParseOpcode = ZERO;
+ OpcGenerateAmlOpcode (Next);
+ }
+
+
+ Next = Next->Asl.Next;
+ if (Next->Asl.ParseOpcode == DEFAULT_ARG)
+ {
+ Next->Asl.AmlLength = 1;
+ Next->Asl.ParseOpcode = ZERO;
+ OpcGenerateAmlOpcode (Next);
+ }
+ */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoDefinitionBlock
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword
+ *
+ ******************************************************************************/
+
+void
+OpnDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child;
+ ACPI_SIZE Length;
+ ACPI_NATIVE_UINT i;
+
+
+ /*
+ * These nodes get stuffed into the table header. They are special
+ * cased when the table is written to the output file.
+ *
+ * Mark all of these nodes as non-usable so they won't get output
+ * as AML opcodes!
+ */
+
+ /* AML filename */
+
+ Child = Op->Asl.Child;
+ if ((Child->Asl.Value.Buffer) && (Gbl_UseDefaultAmlFilename))
+ {
+ Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;
+ }
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* Signature */
+
+ Child = Child->Asl.Next;
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ if (Child->Asl.Value.String)
+ {
+ Gbl_TableSignature = Child->Asl.Value.String;
+ if (ACPI_STRLEN (Gbl_TableSignature) != 4)
+ {
+ AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length not exactly 4");
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ if (!isalnum (Gbl_TableSignature[i]))
+ {
+ AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters");
+ }
+ }
+ }
+
+ /* Revision */
+
+ Child = Child->Asl.Next;
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* Use the revision to set the integer width */
+
+ AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+
+ /* OEMID */
+
+ Child = Child->Asl.Next;
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* OEM TableID */
+
+ Child = Child->Asl.Next;
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ if (Child->Asl.Value.String)
+ {
+ Length = ACPI_STRLEN (Child->Asl.Value.String);
+ Gbl_TableId = AcpiOsAllocate (Length + 1);
+ ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);
+
+ for (i = 0; i < Length; i++)
+ {
+ if (Gbl_TableId[i] == ' ')
+ {
+ Gbl_TableId[i] = 0;
+ break;
+ }
+ }
+ }
+
+ /* OEM Revision */
+
+ Child = Child->Asl.Next;
+ Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtGetArg
+ *
+ * PARAMETERS: Op - Get an argument for this op
+ * Argn - Nth argument to get
+ *
+ * RETURN: The argument (as an Op object). NULL if argument does not exist
+ *
+ * DESCRIPTION: Get the specified op's argument (peer)
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+UtGetArg (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Argn)
+{
+ ACPI_PARSE_OBJECT *Arg = NULL;
+
+
+ /* Get the requested argument object */
+
+ Arg = Op->Asl.Child;
+ while (Arg && Argn)
+ {
+ Argn--;
+ Arg = Arg->Asl.Next;
+ }
+
+ return (Arg);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnAttachNameToNode
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: For the named ASL/AML operators, get the actual name from the
+ * argument list and attach it to the parent node so that we
+ * can get to it quickly later.
+ *
+ ******************************************************************************/
+
+void
+OpnAttachNameToNode (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child = NULL;
+
+
+ if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
+ {
+ Child = UtGetArg (Op, 0);
+ }
+ else switch (Op->Asl.AmlOpcode)
+ {
+ case AML_DATA_REGION_OP:
+ case AML_DEVICE_OP:
+ case AML_EVENT_OP:
+ case AML_METHOD_OP:
+ case AML_MUTEX_OP:
+ case AML_REGION_OP:
+ case AML_POWER_RES_OP:
+ case AML_PROCESSOR_OP:
+ case AML_THERMAL_ZONE_OP:
+ case AML_NAME_OP:
+ case AML_SCOPE_OP:
+
+ Child = UtGetArg (Op, 0);
+ break;
+
+ case AML_ALIAS_OP:
+
+ Child = UtGetArg (Op, 1);
+ break;
+
+ case AML_CREATE_BIT_FIELD_OP:
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_CREATE_WORD_FIELD_OP:
+ case AML_CREATE_DWORD_FIELD_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+
+ Child = UtGetArg (Op, 2);
+ break;
+
+ case AML_CREATE_FIELD_OP:
+
+ Child = UtGetArg (Op, 3);
+ break;
+
+ case AML_BANK_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+ case AML_FIELD_OP:
+
+ return;
+
+ default:
+ return;
+ }
+
+ if (Child)
+ {
+ UtAttachNamepathToOwner (Op, Child);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnGenerateAmlOperands
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more
+ * complex AML opcodes require processing of the child nodes
+ * (arguments/operands).
+ *
+ ******************************************************************************/
+
+void
+OpnGenerateAmlOperands (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
+ {
+ return;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+ OpnDoDefinitionBlock (Op);
+ break;
+
+ case PARSEOP_METHOD:
+ OpnDoMethod (Op);
+ break;
+
+ case PARSEOP_FIELD:
+ OpnDoField (Op);
+ break;
+
+ case PARSEOP_INDEXFIELD:
+ OpnDoIndexField (Op);
+ break;
+
+ case PARSEOP_BANKFIELD:
+ OpnDoBankField (Op);
+ break;
+
+ case PARSEOP_BUFFER:
+ OpnDoBuffer (Op);
+ break;
+
+ case PARSEOP_LOADTABLE:
+ OpnDoLoadTable (Op);
+ break;
+
+ case PARSEOP_PACKAGE:
+ OpnDoPackage (Op);
+ break;
+
+ case PARSEOP_OPERATIONREGION:
+ OpnDoRegion (Op);
+ break;
+
+ case PARSEOP_RESOURCETEMPLATE:
+ RsDoResourceTemplate (Op);
+ break;
+
+ case PARSEOP_NAMESEG:
+ case PARSEOP_NAMESTRING:
+ case PARSEOP_METHODCALL:
+ case PARSEOP_STRING_LITERAL:
+ break;
+
+ default:
+ break;
+ }
+
+ /* TBD: move */
+
+ OpnAttachNameToNode (Op);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c
new file mode 100644
index 0000000..73435c5
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslopt.c
@@ -0,0 +1,800 @@
+/******************************************************************************
+ *
+ * Module Name: aslopt- Compiler optimizations
+ * $Revision: 12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslopt")
+
+
+UINT32 OptTotal = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OptSearchToRoot
+ *
+ * PARAMETERS: Op - Current parser op
+ * WalkState - Current state
+ * CurrentNode - Where we are in the namespace
+ * TargetNode - Node to which we are referring
+ * TargetPath - External full path to the target node
+ * NewPath - Where the optimized path is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI
+ * name utilizing the search-to-root name resolution algorithm
+ * that is used by AML interpreters.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OptSearchToRoot (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ ACPI_BUFFER *TargetPath,
+ char **NewPath)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_STATUS Status;
+ char *Path;
+
+
+ ACPI_FUNCTION_NAME ("OptSearchToRoot");
+
+
+ /*
+ * Check if search-to-root can be utilized. Use the last NameSeg of
+ * the NamePath and 1) See if can be found and 2) If found, make
+ * sure that it is the same node that we want. If there is another
+ * name in the search path before the one we want, the nodes will
+ * not match, and we cannot use this optimization.
+ */
+ Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - ACPI_NAME_SIZE]),
+ ScopeInfo.Scope.Node = CurrentNode;
+
+ /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
+
+ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * We found the name, but we must check to make sure that the node
+ * matches. Otherwise, there is another identical name in the search
+ * path that precludes the use of this optimization.
+ */
+ if (Node != TargetNode)
+ {
+ /*
+ * This means that another object with the same name was found first,
+ * and we cannot use this optimization.
+ */
+ return (AE_NOT_FOUND);
+ }
+
+ /* Found the node, we can use this optimization */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ "NAMESEG: %-24s", Path));
+
+ /* We must allocate a new string for the name (TargetPath gets deleted) */
+
+ *NewPath = ACPI_MEM_CALLOCATE (ACPI_NAME_SIZE + 1);
+ ACPI_STRCPY (*NewPath, Path);
+
+ AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op,
+ *NewPath);
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OptBuildShortestPath
+ *
+ * PARAMETERS: Op - Current parser op
+ * WalkState - Current state
+ * CurrentNode - Where we are in the namespace
+ * TargetNode - Node to which we are referring
+ * CurrentPath - External full path to the current node
+ * TargetPath - External full path to the target node
+ * AmlNameStringLength - Length of the original namepath
+ * IsDeclaration - TRUE for declaration, FALSE for reference
+ * ReturnNewPath - Where the optimized path is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Build an optimal NamePath using carats
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OptBuildShortestPath (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ ACPI_BUFFER *CurrentPath,
+ ACPI_BUFFER *TargetPath,
+ ACPI_SIZE AmlNameStringLength,
+ UINT8 IsDeclaration,
+ char **ReturnNewPath)
+{
+ UINT32 NumCommonSegments;
+ UINT32 MaxCommonSegments;
+ ACPI_NATIVE_UINT Index;
+ UINT32 NumCarats;
+ ACPI_NATIVE_UINT i;
+ char *NewPath;
+ char *NewPathExternal;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_STATUS Status;
+ BOOLEAN SubPath = FALSE;
+
+
+ ACPI_FUNCTION_NAME ("OptBuildShortestPath");
+
+
+ ScopeInfo.Scope.Node = CurrentNode;
+
+ /*
+ * Determine the maximum number of NameSegs that the Target and Current paths
+ * can possibly have in common. (To optimize, we have to have at least 1)
+ *
+ * Note: The external NamePath string lengths are always a multiple of 5
+ * (ACPI_NAME_SIZE + separator)
+ */
+ MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH;
+ if (CurrentPath->Length < TargetPath->Length)
+ {
+ MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH;
+ }
+
+ /*
+ * Determine how many NameSegs the two paths have in common.
+ * (Starting from the root)
+ */
+ for (NumCommonSegments = 0;
+ NumCommonSegments < MaxCommonSegments;
+ NumCommonSegments++)
+ {
+ /* Compare two single NameSegs */
+
+ if (ACPI_STRNCMP (
+ &((char *) TargetPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1],
+ &((char *) CurrentPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1],
+ ACPI_NAME_SIZE))
+ {
+ /* Mismatch */
+
+ break;
+ }
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d", NumCommonSegments));
+
+ /* There must be at least 1 common NameSeg in order to optimize */
+
+ if (NumCommonSegments == 0)
+ {
+ return (AE_NOT_FOUND);
+ }
+
+ if (NumCommonSegments == MaxCommonSegments)
+ {
+ if (CurrentPath->Length == TargetPath->Length)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH"));
+ return (AE_NOT_FOUND);
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH"));
+ SubPath = TRUE;
+ }
+ }
+
+ /* Determine how many prefix Carats are required */
+
+ NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - NumCommonSegments;
+
+ /*
+ * Construct a new target string
+ */
+ NewPathExternal = ACPI_MEM_CALLOCATE (TargetPath->Length + NumCarats);
+
+ /* Insert the Carats into the Target string */
+
+ for (i = 0; i < NumCarats; i++)
+ {
+ NewPathExternal[i] = '^';
+ }
+
+ /* Copy only the necessary (optimal) segments from the original target string */
+
+ Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1;
+
+ /* Special handling for exact subpath in a name declaration */
+
+ if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length))
+ {
+ /*
+ * The current path is longer than the target, and the target is a subpath
+ * of the current path. We must include one more NameSeg of the target path
+ */
+ Index -= ACPI_PATH_SEGMENT_LENGTH;
+ }
+
+ ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal));
+
+ /*
+ * Internalize the new target string and check it against the original string
+ * to make sure that this is in fact an optimization. If the original string
+ * is already optimal, there is no point in continuing.
+ */
+ Status = AcpiNsInternalizeName (NewPathExternal, &NewPath);
+
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT);
+ ACPI_MEM_FREE (NewPathExternal);
+ return (Status);
+ }
+
+ if (ACPI_STRLEN (NewPath) >= AmlNameStringLength)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %d old %d)",
+ ACPI_STRLEN (NewPath), AmlNameStringLength));
+ ACPI_MEM_FREE (NewPathExternal);
+ return (AE_NOT_FOUND);
+ }
+
+ /*
+ * Check to make sure that the optimization finds the node we are
+ * looking for. This is simply a sanity check on the new
+ * path that has been created.
+ */
+ Status = AcpiNsLookup (&ScopeInfo, NewPath,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Found the namepath, but make sure the node is correct */
+
+ if (Node == TargetNode)
+ {
+ /* The lookup matched the node, accept this optimization */
+
+ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION,
+ Op, NewPathExternal);
+ *ReturnNewPath = NewPath;
+ }
+ else
+ {
+ /* Node is not correct, do not use this optimization */
+
+ Status = AE_NOT_FOUND;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE"));
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
+ "Not using optimized name - found wrong node");
+ }
+ }
+ else
+ {
+ /* The lookup failed, we obviously cannot use this optimization */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND"));
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
+ "Not using optimized name - did not find node");
+ }
+
+ ACPI_MEM_FREE (NewPathExternal);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OptOptimizeNameDeclaration
+ *
+ * PARAMETERS: Op - Current parser op
+ * WalkState - Current state
+ * CurrentNode - Where we are in the namespace
+ * AmlNameString - Unoptimized namepath
+ * NewPath - Where the optimized path is returned
+ *
+ * RETURN: Status. AE_OK If path is optimized
+ *
+ * DESCRIPTION: Perform a simple optimization of removing an extraneous
+ * backslash prefix if we are already at the root scope.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OptOptimizeNameDeclaration (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ char *AmlNameString,
+ char **NewPath)
+{
+ ACPI_STATUS Status;
+ char *NewPathExternal;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE ("OptOptimizeNameDeclaration");
+
+
+ if (((CurrentNode == AcpiGbl_RootNode) ||
+ (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) &&
+ (AmlNameString[0] == '\\'))
+ {
+ /*
+ * The current scope is the root, and the namepath has a root prefix
+ * that is therefore extraneous. Remove it.
+ */
+ *NewPath = &AmlNameString[1];
+
+ /* Debug output */
+
+ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath,
+ NULL, &NewPathExternal);
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT);
+ return (Status);
+ }
+
+ /*
+ * Check to make sure that the optimization finds the node we are
+ * looking for. This is simply a sanity check on the new
+ * path that has been created.
+ */
+ ScopeInfo.Scope.Node = CurrentNode;
+ Status = AcpiNsLookup (&ScopeInfo, *NewPath,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Found the namepath, but make sure the node is correct */
+
+ if (Node == TargetNode)
+ {
+ /* The lookup matched the node, accept this optimization */
+
+ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION,
+ Op, NewPathExternal);
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ "AT ROOT: %-24s", NewPathExternal));
+ }
+ else
+ {
+ /* Node is not correct, do not use this optimization */
+
+ Status = AE_NOT_FOUND;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE"));
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
+ "Not using optimized name - found wrong node");
+ }
+ }
+ else
+ {
+ /* The lookup failed, we obviously cannot use this optimization */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND"));
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
+ "Not using optimized name - did not find node");
+ }
+
+ ACPI_MEM_FREE (NewPathExternal);
+ return (Status);
+ }
+
+ /* Could not optimize */
+
+ return (AE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OptOptimizeNamePath
+ *
+ * PARAMETERS: Op - Current parser op
+ * Flags - Opcode info flags
+ * WalkState - Current state
+ * AmlNameString - Unoptimized namepath
+ * TargetNode - Node to which AmlNameString refers
+ *
+ * RETURN: None. If path is optimized, the Op is updated with new path
+ *
+ * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length.
+ * Must take into account both the current location in the
+ * namespace and the actual reference path.
+ *
+ ******************************************************************************/
+
+void
+OptOptimizeNamePath (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Flags,
+ ACPI_WALK_STATE *WalkState,
+ char *AmlNameString,
+ ACPI_NAMESPACE_NODE *TargetNode)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER TargetPath;
+ ACPI_BUFFER CurrentPath;
+ ACPI_SIZE AmlNameStringLength;
+ ACPI_NAMESPACE_NODE *CurrentNode;
+ char *ExternalNameString;
+ char *NewPath = NULL;
+ ACPI_SIZE HowMuchShorter;
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ ACPI_FUNCTION_TRACE ("OptOptimizeNamePath");
+
+
+ /* This is an optional optimization */
+
+ if (!Gbl_ReferenceOptimizationFlag)
+ {
+ return_VOID;
+ }
+
+ /* Various required items */
+
+ if (!TargetNode || !WalkState || !Op->Common.Parent)
+ {
+ return_VOID;
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ",
+ Op->Asl.LogicalLineNumber,
+ AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode),
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
+
+ if (!(Flags & (AML_NAMED | AML_CREATE)))
+ {
+ if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
+ {
+ /* We don't want to fuss with actual name declaration nodes here */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ "******* NAME DECLARATION\n"));
+ return_VOID;
+ }
+ }
+
+ /*
+ * The original path must be longer than one NameSeg (4 chars) for there
+ * to be any possibility that it can be optimized to a shorter string
+ */
+ AmlNameStringLength = ACPI_STRLEN (AmlNameString);
+ if (AmlNameStringLength <= ACPI_NAME_SIZE)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ "NAMESEG %4.4s\n", AmlNameString));
+ return_VOID;
+ }
+
+ /*
+ * We need to obtain the node that represents the current scope -- where
+ * we are right now in the namespace. We will compare this path
+ * against the Namepath, looking for commonality.
+ */
+ CurrentNode = AcpiGbl_RootNode;
+ if (WalkState->ScopeInfo)
+ {
+ CurrentNode = WalkState->ScopeInfo->Scope.Node;
+ }
+
+ if (Flags & (AML_NAMED | AML_CREATE))
+ {
+ /* This is the declaration of a new name */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME"));
+
+ /* The node of interest is the parent of this node (the containing scope) */
+
+ CurrentNode = Op->Asl.Parent->Asl.Node;
+ if (!CurrentNode)
+ {
+ CurrentNode = AcpiGbl_RootNode;
+ }
+ }
+ else
+ {
+ /* This is a reference to an existing named object */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF "));
+ }
+
+ /*
+ * Obtain the full paths to the two nodes that we are interested in
+ * (Target and current namespace location) in external
+ * format -- something we can easily manipulate
+ */
+ TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (TargetNode, &TargetPath);
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status, "Getting Target NamePath", ASL_NO_ABORT);
+ return_VOID;
+ }
+ TargetPath.Length--; /* Subtract one for null terminator */
+
+ /* CurrentPath is the path to this scope (where we are in the namespace) */
+
+ CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath);
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status, "Getting Current NamePath", ASL_NO_ABORT);
+ return_VOID;
+ }
+ CurrentPath.Length--; /* Subtract one for null terminator */
+
+ /* Debug output only */
+
+ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString,
+ NULL, &ExternalNameString);
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT);
+ return_VOID;
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ "%37s (%2d) ==> %-32s(%2d) %-32s",
+ (char *) CurrentPath.Pointer, CurrentPath.Length,
+ (char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString));
+
+ ACPI_MEM_FREE (ExternalNameString);
+
+ /*
+ * Attempt an optmization depending on the type of namepath
+ */
+ if (Flags & (AML_NAMED | AML_CREATE))
+ {
+ /*
+ * This is a named opcode and the namepath is a name declaration, not
+ * a reference.
+ */
+ Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode,
+ TargetNode, AmlNameString, &NewPath);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * 2) now attempt to
+ * optimize the namestring with carats (up-arrow)
+ */
+ Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
+ TargetNode, &CurrentPath, &TargetPath,
+ AmlNameStringLength, 1, &NewPath);
+ }
+ }
+ else
+ {
+ /*
+ * This is a reference to an existing named object
+ *
+ * 1) Check if search-to-root can be utilized using the last
+ * NameSeg of the NamePath
+ */
+ Status = OptSearchToRoot (Op, WalkState, CurrentNode,
+ TargetNode, &TargetPath, &NewPath);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * 2) Search-to-root could not be used, now attempt to
+ * optimize the namestring with carats (up-arrow)
+ */
+ Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
+ TargetNode, &CurrentPath, &TargetPath,
+ AmlNameStringLength, 0, &NewPath);
+ }
+ }
+
+ /*
+ * Success from above indicates that the NamePath was successfully
+ * optimized. We need to update the parse op with the new name
+ */
+ if (ACPI_SUCCESS (Status))
+ {
+ HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath));
+ OptTotal += HowMuchShorter;
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2d (%d)",
+ HowMuchShorter, OptTotal));
+
+ if (Flags & AML_NAMED)
+ {
+ if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
+ {
+ /*
+ * ALIAS is the only oddball opcode, the name declaration
+ * (alias name) is the second operand
+ */
+ Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath;
+ Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath);
+ }
+ else
+ {
+ Op->Asl.Child->Asl.Value.String = NewPath;
+ Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath);
+ }
+ }
+ else if (Flags & AML_CREATE)
+ {
+ /* Name must appear as the last parameter */
+
+ NextOp = Op->Asl.Child;
+ while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
+ {
+ NextOp = NextOp->Asl.Next;
+ }
+ /* Update the parse node with the new NamePath */
+
+ NextOp->Asl.Value.String = NewPath;
+ NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath);
+ }
+ else
+ {
+ /* Update the parse node with the new NamePath */
+
+ Op->Asl.Value.String = NewPath;
+ Op->Asl.AmlLength = ACPI_STRLEN (NewPath);
+ }
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL"));
+ }
+
+ /* Cleanup path buffers */
+
+ ACPI_MEM_FREE (TargetPath.Pointer);
+ ACPI_MEM_FREE (CurrentPath.Pointer);
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n"));
+ return_VOID;
+}
+
diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c
new file mode 100644
index 0000000..36d8070
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslresource.c
@@ -0,0 +1,632 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslresource - Resource templates and descriptors
+ * $Revision: 31 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslresource")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsAllocateResourceNode
+ *
+ * PARAMETERS: Size - Size of node in bytes
+ *
+ * RETURN: The allocated node - aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate a resource description node and the resource
+ * descriptor itself (the nodes are used to link descriptors).
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsAllocateResourceNode (
+ UINT32 Size)
+{
+ ASL_RESOURCE_NODE *Rnode;
+
+
+ /* Allocate the node */
+
+ Rnode = UtLocalCalloc (sizeof (ASL_RESOURCE_NODE));
+
+ /* Allocate the resource descriptor itself */
+
+ Rnode->Buffer = UtLocalCalloc (Size);
+ Rnode->BufferLength = Size;
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsCreateBitField
+ *
+ * PARAMETERS: Op - Resource field node
+ * Name - Name of the field (Used only to reference
+ * the field in the ASL, not in the AML)
+ * ByteOffset - Offset from the field start
+ * BitOffset - Additional bit offset
+ *
+ * RETURN: None, sets fields within the input node
+ *
+ * DESCRIPTION: Utility function to generate a named bit field within a
+ * resource descriptor. Mark a node as 1) a field in a resource
+ * descriptor, and 2) set the value to be a BIT offset
+ *
+ ******************************************************************************/
+
+void
+RsCreateBitField (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name,
+ UINT32 ByteOffset,
+ UINT32 BitOffset)
+{
+
+ Op->Asl.ExternalName = Name;
+ Op->Asl.Value.Integer = (ByteOffset * 8) + BitOffset;
+ Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsCreateByteField
+ *
+ * PARAMETERS: Op - Resource field node
+ * Name - Name of the field (Used only to reference
+ * the field in the ASL, not in the AML)
+ * ByteOffset - Offset from the field start
+ *
+ * RETURN: None, sets fields within the input node
+ *
+ * DESCRIPTION: Utility function to generate a named byte field within a
+ * resource descriptor. Mark a node as 1) a field in a resource
+ * descriptor, and 2) set the value to be a BYTE offset
+ *
+ ******************************************************************************/
+
+void
+RsCreateByteField (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name,
+ UINT32 ByteOffset)
+{
+
+ Op->Asl.ExternalName = Name;
+ Op->Asl.Value.Integer = ByteOffset;
+ Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsSetFlagBits
+ *
+ * PARAMETERS: *Flags - Pointer to the flag byte
+ * Op - Flag initialization node
+ * Position - Bit position within the flag byte
+ * Default - Used if the node is DEFAULT.
+ *
+ * RETURN: Sets bits within the *Flags output byte.
+ *
+ * DESCRIPTION: Set a bit in a cumulative flags word from an initialization
+ * node. Will use a default value if the node is DEFAULT, meaning
+ * that no value was specified in the ASL. Used to merge multiple
+ * keywords into a single flags byte.
+ *
+ ******************************************************************************/
+
+void
+RsSetFlagBits (
+ UINT8 *Flags,
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 Position,
+ UINT8 DefaultBit)
+{
+
+ if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ /* Use the default bit */
+
+ *Flags |= (DefaultBit << Position);
+ }
+ else
+ {
+ /* Use the bit specified in the initialization node */
+
+ *Flags |= (((UINT8) Op->Asl.Value.Integer) << Position);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsCompleteNodeAndGetNext
+ *
+ * PARAMETERS: Op - Resource node to be completed
+ *
+ * RETURN: The next peer to the input node.
+ *
+ * DESCRIPTION: Mark the current node completed and return the next peer.
+ * The node ParseOpcode is set to DEFAULT_ARG, meaning that
+ * this node is to be ignored from now on.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+RsCompleteNodeAndGetNext (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ /* Mark this node unused */
+
+ Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ /* Move on to the next peer node in the initializer list */
+
+ return (ASL_GET_PEER_NODE (Op));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoOneResourceDescriptor
+ *
+ * PARAMETERS: DescriptorTypeOp - Parent parse node of the descriptor
+ * CurrentByteOffset - Offset in the resource descriptor
+ * buffer.
+ *
+ * RETURN: A valid resource node for the descriptor
+ *
+ * DESCRIPTION: Dispatches the processing of one resource descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoOneResourceDescriptor (
+ ACPI_PARSE_OBJECT *DescriptorTypeOp,
+ UINT32 CurrentByteOffset,
+ UINT8 *State)
+{
+ ASL_RESOURCE_NODE *Rnode = NULL;
+
+
+ /* Determine type of resource */
+
+ switch (DescriptorTypeOp->Asl.ParseOpcode)
+ {
+ case PARSEOP_DMA:
+ Rnode = RsDoDmaDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_DWORDIO:
+ Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_DWORDMEMORY:
+ Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_ENDDEPENDENTFN:
+ switch (*State)
+ {
+ case ACPI_RSTATE_NORMAL:
+ AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, DescriptorTypeOp, NULL);
+ break;
+
+ case ACPI_RSTATE_START_DEPENDENT:
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ break;
+
+ case ACPI_RSTATE_DEPENDENT_LIST:
+ default:
+ break;
+ }
+
+ *State = ACPI_RSTATE_NORMAL;
+ Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_FIXEDIO:
+ Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_INTERRUPT:
+ Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_IO:
+ Rnode = RsDoIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_IRQ:
+ Rnode = RsDoIrqDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_IRQNOFLAGS:
+ Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_MEMORY24:
+ Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_MEMORY32:
+ Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_MEMORY32FIXED:
+ Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_QWORDIO:
+ Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_QWORDMEMORY:
+ Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_REGISTER:
+ Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_STARTDEPENDENTFN:
+ switch (*State)
+ {
+ case ACPI_RSTATE_START_DEPENDENT:
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ break;
+
+ case ACPI_RSTATE_NORMAL:
+ case ACPI_RSTATE_DEPENDENT_LIST:
+ default:
+ break;
+ }
+
+ *State = ACPI_RSTATE_START_DEPENDENT;
+ Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ *State = ACPI_RSTATE_DEPENDENT_LIST;
+ break;
+
+ case PARSEOP_STARTDEPENDENTFN_NOPRI:
+ switch (*State)
+ {
+ case ACPI_RSTATE_START_DEPENDENT:
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ break;
+
+ case ACPI_RSTATE_NORMAL:
+ case ACPI_RSTATE_DEPENDENT_LIST:
+ default:
+ break;
+ }
+
+ *State = ACPI_RSTATE_START_DEPENDENT;
+ Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ *State = ACPI_RSTATE_DEPENDENT_LIST;
+ break;
+
+ case PARSEOP_VENDORLONG:
+ Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_VENDORSHORT:
+ Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_WORDBUSNUMBER:
+ Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_WORDIO:
+ Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ break;
+
+ case PARSEOP_DEFAULT_ARG:
+ /* Just ignore any of these, they are used as fillers/placeholders */
+ break;
+
+ default:
+ printf ("Unknown resource descriptor type [%s]\n",
+ DescriptorTypeOp->Asl.ParseOpName);
+ break;
+ }
+
+ /*
+ * Mark original node as unused, but head of a resource descriptor.
+ * This allows the resource to be installed in the namespace so that
+ * references to the descriptor can be resolved.
+ */
+ DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsLinkDescriptorChain
+ *
+ * PARAMETERS: PreviousRnode - Pointer to the node that will be previous
+ * to the linked node, At exit, set to the
+ * last node in the new chain.
+ * Rnode - Resource node to link into the list
+ *
+ * RETURN: Cumulative buffer byte offset of the new segment of chain
+ *
+ * DESCRIPTION: Link a descriptor chain at the end of an existing chain.
+ *
+ ******************************************************************************/
+
+UINT32
+RsLinkDescriptorChain (
+ ASL_RESOURCE_NODE **PreviousRnode,
+ ASL_RESOURCE_NODE *Rnode)
+{
+ ASL_RESOURCE_NODE *LastRnode;
+ UINT32 CurrentByteOffset;
+
+
+ /* Anything to do? */
+
+ if (!Rnode)
+ {
+ return 0;
+ }
+
+ /* Point the previous node to the new node */
+
+ (*PreviousRnode)->Next = Rnode;
+ CurrentByteOffset = Rnode->BufferLength;
+
+ /* Walk to the end of the chain headed by Rnode */
+
+ LastRnode = Rnode;
+ while (LastRnode->Next)
+ {
+ LastRnode = LastRnode->Next;
+ CurrentByteOffset += LastRnode->BufferLength;
+ }
+
+ /* Previous node becomes the last node in the chain */
+
+ *PreviousRnode = LastRnode;
+ return CurrentByteOffset;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoResourceTemplate
+ *
+ * PARAMETERS: Op - Parent of a resource template list
+ *
+ * RETURN: None. Sets input node to point to a list of AML code
+ *
+ * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer,
+ * in preparation for output to the AML output file.
+ *
+ ******************************************************************************/
+
+void
+RsDoResourceTemplate (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *BufferLengthOp;
+ ACPI_PARSE_OBJECT *BufferOp;
+ ACPI_PARSE_OBJECT *DescriptorTypeOp;
+ ACPI_PARSE_OBJECT *LastOp = NULL;
+ ASL_RESOURCE_DESC *Descriptor;
+ UINT32 CurrentByteOffset = 0;
+ ASL_RESOURCE_NODE HeadRnode;
+ ASL_RESOURCE_NODE *PreviousRnode;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT8 State;
+
+
+ /* ResourceTemplate Opcode is first (Op) */
+ /* Buffer Length node is first child */
+
+ BufferLengthOp = ASL_GET_CHILD_NODE (Op);
+
+ /* Buffer Op is first peer */
+
+ BufferOp = ASL_GET_PEER_NODE (BufferLengthOp);
+
+ /* First Descriptor type is next */
+
+ DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp);
+
+ /* Process all resource descriptors in the list */
+
+ State = ACPI_RSTATE_NORMAL;
+ PreviousRnode = &HeadRnode;
+ while (DescriptorTypeOp)
+ {
+ Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, &State);
+
+ /*
+ * Update current byte offset to indicate the number of bytes from the
+ * start of the buffer. Buffer can include multiple descriptors, we
+ * must keep track of the offset of not only each descriptor, but each
+ * element (field) within each descriptor as well.
+ */
+ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode);
+
+ /* Get the next descriptor in the list */
+
+ LastOp = DescriptorTypeOp;
+ DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp);
+ }
+
+ if (State == ACPI_RSTATE_DEPENDENT_LIST)
+ {
+ if (LastOp)
+ {
+ LastOp = LastOp->Asl.Parent;
+ }
+ AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL);
+ }
+
+ /*
+ * Insert the EndTag descriptor after all other descriptors have been processed
+ */
+ Rnode = RsAllocateResourceNode (sizeof (ASL_END_TAG_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Et.DescriptorType = ACPI_RDESC_TYPE_END_TAG |
+ ASL_RDESC_END_TAG_SIZE;
+ Descriptor->Et.Checksum = 0;
+
+ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode);
+
+ /*
+ * Transform the nodes into the following
+ *
+ * Op -> AML_BUFFER_OP
+ * First Child -> BufferLength
+ * Second Child -> Descriptor Buffer (raw byte data)
+ */
+ Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+ Op->Asl.AmlOpcode = AML_BUFFER_OP;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE;
+
+ BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
+ BufferLengthOp->Asl.Value.Integer = CurrentByteOffset;
+
+ (void) OpcSetOptimalIntegerSize (BufferLengthOp);
+
+ BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+ BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN;
+ BufferOp->Asl.AmlOpcodeLength = 0;
+ BufferOp->Asl.AmlLength = CurrentByteOffset;
+ BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next;
+
+ return;
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c
new file mode 100644
index 0000000..33193f6
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslrestype1.c
@@ -0,0 +1,1041 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
+ * $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype1")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDmaDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "DMA" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDmaDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+ UINT8 DmaChannelMask = 0;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_DMA_FORMAT_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Dma.DescriptorType = ACPI_RDESC_TYPE_DMA_FORMAT |
+ ASL_RDESC_DMA_SIZE;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* DMA type */
+
+ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
+ break;
+
+ case 1: /* Bus Master */
+
+ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
+ break;
+
+ case 2: /* Xfer Type (transfer width) */
+
+ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
+ break;
+
+ case 3: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* All DMA channel bytes are handled here, after the flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ DmaChannelMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
+ }
+
+ if (i == 4) /* case 4: First DMA byte */
+ {
+ RsCreateByteField (InitializerOp, ASL_RESNAME_DMA,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
+ }
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the channel mask */
+
+ Descriptor->Dma.DmaChannelMask = DmaChannelMask;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoEndDependentDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "EndDependentFn" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoEndDependentDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ASL_RESOURCE_NODE *Rnode;
+
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_END_DEPENDENT_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->End.DescriptorType = ACPI_RDESC_TYPE_END_DEPENDENT |
+ ASL_RDESC_END_DEPEND_SIZE;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoFixedIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "FixedIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoFixedIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_IO_PORT_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_FIXED_IO_PORT |
+ ASL_RDESC_FIXED_IO_SIZE;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Base Address */
+
+ Descriptor->Fio.BaseAddress = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.BaseAddress));
+ break;
+
+ case 1: /* Length */
+
+ Descriptor->Fio.Length = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.Length));
+ break;
+
+ case 2: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "IO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_IO_PORT_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_IO_PORT |
+ ASL_RDESC_IO_SIZE;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Decode size */
+
+ RsSetFlagBits (&Descriptor->Iop.Information, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Information), 0);
+ break;
+
+ case 1: /* Min Address */
+
+ Descriptor->Iop.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMin));
+ break;
+
+ case 2: /* Max Address */
+
+ Descriptor->Iop.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMax));
+ break;
+
+ case 3: /* Alignment */
+
+ Descriptor->Iop.Alignment = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Alignment));
+ break;
+
+ case 4: /* Length */
+
+ Descriptor->Iop.Length = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Length));
+ break;
+
+ case 5: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIrqDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "IRQ" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIrqDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+ UINT16 IrqMask = 0;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_FORMAT_DESC));
+
+ /* Length = 3 (with flag byte) */
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT |
+ (ASL_RDESC_IRQ_SIZE + 0x01);
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Interrupt Type (or Mode - edge/level) */
+
+ RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
+ break;
+
+ case 1: /* Interrupt Level (or Polarity - Active high/low) */
+
+ RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
+ break;
+
+ case 2: /* Share Type - Default: exclusive (0) */
+
+ RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
+ break;
+
+ case 3: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* All IRQ bytes are handled here, after the flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
+ }
+
+ if (i == 4) /* case 4: First IRQ byte */
+ {
+ RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
+ }
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the channel mask */
+
+ Descriptor->Irq.IrqMask = IrqMask;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIrqNoFlagsDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIrqNoFlagsDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+ UINT16 IrqMask = 0;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_NOFLAGS_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT |
+ ASL_RDESC_IRQ_SIZE;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* IRQ bytes are handled here, after the flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
+ }
+
+ if (i == 1) /* case 1: First IRQ byte */
+ {
+ RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
+ }
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the interrupt mask */
+
+ Descriptor->Irq.IrqMask = IrqMask;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoMemory24Descriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "Memory24" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoMemory24Descriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_24_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->M24.DescriptorType = ACPI_RDESC_TYPE_MEMORY_24;
+ Descriptor->M24.Length = 9;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Read/Write type */
+
+ RsSetFlagBits (&Descriptor->M24.Information, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Information), 0);
+ break;
+
+ case 1: /* Min Address */
+
+ Descriptor->M24.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMin));
+ break;
+
+ case 2: /* Max Address */
+
+ Descriptor->M24.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMax));
+ break;
+
+ case 3: /* Alignment */
+
+ Descriptor->M24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Alignment));
+ break;
+
+ case 4: /* Length */
+
+ Descriptor->M24.RangeLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M24.RangeLength));
+ break;
+
+ case 5: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoMemory32Descriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "Memory32" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoMemory32Descriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_32_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->M32.DescriptorType = ACPI_RDESC_TYPE_MEMORY_32;
+ Descriptor->M32.Length = 17;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Read/Write type */
+
+ RsSetFlagBits (&Descriptor->M32.Information, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Information), 0);
+ break;
+
+ case 1: /* Min Address */
+
+ Descriptor->M32.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMin));
+ break;
+
+ case 2: /* Max Address */
+
+ Descriptor->M32.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMax));
+ break;
+
+ case 3: /* Alignment */
+
+ Descriptor->M32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Alignment));
+ break;
+
+ case 4: /* Length */
+
+ Descriptor->M32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (M32.RangeLength));
+ break;
+
+ case 5: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoMemory32FixedDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoMemory32FixedDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_MEMORY_32_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->F32.DescriptorType = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
+ Descriptor->F32.Length = 9;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Read/Write type */
+
+ RsSetFlagBits (&Descriptor->F32.Information, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (F32.Information), 0);
+ break;
+
+ case 1: /* Address */
+
+ Descriptor->F32.BaseAddress = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (F32.BaseAddress));
+ break;
+
+ case 2: /* Length */
+
+ Descriptor->F32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (F32.RangeLength));
+ break;
+
+ case 3: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoStartDependentDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "StartDependentFn" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoStartDependentDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ ASL_RESOURCE_NODE *PreviousRnode;
+ ASL_RESOURCE_NODE *NextRnode;
+ UINT32 i;
+ UINT8 State;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_DESC));
+
+ PreviousRnode = Rnode;
+ Descriptor = Rnode->Buffer;
+
+ /* Descriptor has priority byte */
+
+ Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT |
+ (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
+
+ /*
+ * Process all child initialization nodes
+ */
+ State = ACPI_RSTATE_START_DEPENDENT;
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Compatibility Priority */
+
+ if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerOp, NULL);
+ }
+
+ RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 0, 0);
+ break;
+
+ case 1: /* Performance/Robustness Priority */
+
+ if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerOp, NULL);
+ }
+
+ RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 2, 0);
+ break;
+
+ default:
+ NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State);
+
+ /*
+ * Update current byte offset to indicate the number of bytes from the
+ * start of the buffer. Buffer can include multiple descriptors, we
+ * must keep track of the offset of not only each descriptor, but each
+ * element (field) within each descriptor as well.
+ */
+
+ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoStartDependentNoPriDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoStartDependentNoPriDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ ASL_RESOURCE_NODE *PreviousRnode;
+ ASL_RESOURCE_NODE *NextRnode;
+ UINT8 State;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_NOPRIO_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT |
+ ASL_RDESC_ST_DEPEND_SIZE;
+ PreviousRnode = Rnode;
+
+ /*
+ * Process all child initialization nodes
+ */
+ State = ACPI_RSTATE_START_DEPENDENT;
+ while (InitializerOp)
+ {
+ NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State);
+
+ /*
+ * Update current byte offset to indicate the number of bytes from the
+ * start of the buffer. Buffer can include multiple descriptors, we
+ * must keep track of the offset of not only each descriptor, but each
+ * element (field) within each descriptor as well.
+ */
+
+ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoVendorSmallDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "VendorShort" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoVendorSmallDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_SMALL_VENDOR_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Smv.DescriptorType = ACPI_RDESC_TYPE_SMALL_VENDOR;
+
+ /*
+ * Process all child initialization nodes
+ */
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ for (i = 0; (InitializerOp && (i < 7)); i++)
+ {
+ Descriptor->Smv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
+
+ Rnode->BufferLength -= (7 - i);
+
+ /* Set the length in the Type Tag */
+
+ Descriptor->Smv.DescriptorType |= (UINT8) i;
+ return (Rnode);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2.c b/sys/contrib/dev/acpica/compiler/aslrestype2.c
new file mode 100644
index 0000000..a8818a7
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslrestype2.c
@@ -0,0 +1,1536 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype2 - Long (type2) resource templates and descriptors
+ * $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype2")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsGetStringDataLength
+ *
+ * PARAMETERS: InitializerOp - Start of a subtree of init nodes
+ *
+ * RETURN: Valid string length if a string node is found
+ *
+ * DESCRIPTION: In a list of peer nodes, find the first one that contains a
+ * string and return the length of the string.
+ *
+ ******************************************************************************/
+
+UINT32
+RsGetStringDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp)
+{
+
+ while (InitializerOp)
+ {
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
+ {
+ return (strlen (InitializerOp->Asl.Value.String) + 1);
+ }
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ }
+
+ return 0;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDwordIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "DwordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
+ Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Das.ResourceType));
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Das.Length++;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
+
+ strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ case 13: /* Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Das.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDwordMemoryDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "DwordMemory" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
+ Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Das.ResourceType));
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
+ break;
+
+ case 2: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
+ break;
+
+ case 3: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
+ break;
+
+ case 4: /* Memory Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 1);
+ break;
+
+ case 5: /* Read/Write Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Das.Length++;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
+
+ strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 13: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+
+ case 14: /* Address Range */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 3);
+ break;
+
+ case 15: /* Type */
+
+ RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Das.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoQwordIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "QwordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoQwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
+ Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Qas.ResourceType));
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Qas.Length++;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
+
+ strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ case 13: /* Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Qas.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoQwordMemoryDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "QwordMemory" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoQwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
+ Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Qas.ResourceType));
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
+ break;
+
+ case 2: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
+ break;
+
+ case 3: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
+ break;
+
+ case 4: /* Memory Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 1);
+ break;
+
+ case 5: /* Read/Write Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Qas.Length++;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
+
+ strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 13: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+
+ case 14: /* Address Range */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 3);
+ break;
+
+ case 15: /* Type */
+
+ RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Qas.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoWordIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "WordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoWordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
+ Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Was.ResourceType));
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Was.Length++;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length +StringLength);
+
+ strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ case 13: /* Type */
+
+ RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Was.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoWordBusNumberDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "WordBusNumber" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoWordBusNumberDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
+ StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
+ Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Was.ResourceType));
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
+ break;
+
+ case 4: /* Address Granularity */
+
+ Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
+ break;
+
+ case 5: /* Min Address */
+
+ Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
+ break;
+
+ case 6: /* Max Address */
+
+ Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
+ break;
+
+ case 7: /* Translation Offset */
+
+ Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
+ break;
+
+ case 8: /* Address Length */
+
+ Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
+ break;
+
+ case 9: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Was.Length++;
+ }
+ break;
+
+ case 10: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length + StringLength);
+
+ strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+ }
+ }
+ break;
+
+ case 11: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
+ ASL_RESDESC_OFFSET (Was.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoInterruptDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "Interrupt" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoInterruptDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ASL_RESOURCE_DESC *Rover = NULL;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+ BOOLEAN HasResSourceIndex = FALSE;
+ UINT8 ResSourceIndex = 0;
+ UINT8 *ResSourceString = NULL;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+ if (StringLength)
+ {
+ /* Make room for the ResourceSourceIndex */
+
+ OptionIndex++;
+ }
+
+ /* Count the interrupt numbers */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ if (i <= 6)
+ {
+ continue;
+ }
+
+ OptionIndex += 4;
+ }
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_EXTENDED_XRUPT_DESC) +
+ OptionIndex + StringLength);
+ Descriptor = Rnode->Buffer;
+ Descriptor->Exx.DescriptorType = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ Descriptor->Exx.Length = 2; /* Flags and table length byte */
+ Descriptor->Exx.TableLength = 0;
+
+ Rover = ACPI_CAST_PTR (ASL_RESOURCE_DESC, (&(Descriptor->Exx.InterruptNumber[0])));
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type (Default: consumer (1) */
+
+ RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* Interrupt Type (or Mode - edge/level) */
+
+ RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 0);
+ break;
+
+ case 2: /* Interrupt Level (or Polarity - Active high/low) */
+
+ RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 2);
+ break;
+
+ case 3: /* Share Type - Default: exclusive (0) */
+
+ RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 3);
+ break;
+
+ case 4: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ HasResSourceIndex = TRUE;
+ ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
+ }
+ break;
+
+ case 5: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
+ }
+ }
+ break;
+
+ case 6: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+ /*
+ * Interrupt Numbers come through here, repeatedly.
+ * Store the integer and move pointer to the next one.
+ */
+ Rover->U32Item = (UINT32) InitializerOp->Asl.Value.Integer;
+ Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U32Item), 4);
+
+ Descriptor->Exx.TableLength++;
+ Descriptor->Exx.Length += 4;
+
+ if (i == 7) /* case 7: First interrupt number */
+ {
+ RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]));
+ }
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /*
+ * Add optional ResSourceIndex if present
+ */
+ if (HasResSourceIndex)
+ {
+ Rover->U8Item = ResSourceIndex;
+ Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), 1);
+ Descriptor->Exx.Length += 1;
+ }
+
+ /*
+ * Add optional ResSource string if present
+ */
+ if (StringLength && ResSourceString)
+ {
+
+ strcpy ((char *) Rover, (char *) ResSourceString);
+ Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), StringLength);
+ Descriptor->Exx.Length = (UINT16) (Descriptor->Exx.Length + StringLength);
+ }
+
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]) -
+ ASL_RESDESC_OFFSET (Exx.DescriptorType))
+ + OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoVendorLargeDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "VendorLong" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoVendorLargeDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ /* Count the number of data bytes */
+
+ InitializerOp = Op->Asl.Child;
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+
+ for (i = 0; InitializerOp; i++)
+ {
+ InitializerOp = InitializerOp->Asl.Next;
+ }
+
+ InitializerOp = Op->Asl.Child;
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ Rnode = RsAllocateResourceNode (sizeof (ASL_LARGE_VENDOR_DESC) + (i - 1));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Lgv.DescriptorType = ACPI_RDESC_TYPE_LARGE_VENDOR;
+ Descriptor->Lgv.Length = (UINT16) i;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ Descriptor->Lgv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoGeneralRegisterDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "Register" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoGeneralRegisterDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ ASL_RESOURCE_DESC *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (ASL_GENERAL_REGISTER_DESC));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Grg.DescriptorType = ACPI_RDESC_TYPE_GENERAL_REGISTER;
+ Descriptor->Grg.Length = 12;
+
+ /*
+ * Process all child initialization nodes
+ */
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Address space */
+
+ Descriptor->Grg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.AddressSpaceId));
+ break;
+
+ case 1: /* Register Bit Width */
+
+ Descriptor->Grg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitWidth));
+ break;
+
+ case 2: /* Register Bit Offset */
+
+ Descriptor->Grg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitOffset));
+ break;
+
+ case 3: /* Register Address */
+
+ Descriptor->Grg.Address = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.Address));
+ break;
+
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+ return (Rnode);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c
new file mode 100644
index 0000000..1224c19
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslstubs.c
@@ -0,0 +1,266 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslstubs - Stubs used to link to Aml interpreter
+ * $Revision: 11 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <stdio.h>
+#include "aslcompiler.h"
+#include "acdispat.h"
+#include "actables.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslstubs")
+
+
+/*
+ * Stubs to simplify linkage to the ACPI CA core subsystem.
+ * Things like Events, Global Lock, etc. are not used
+ * by the compiler, so they are stubbed out here.
+ */
+ACPI_STATUS
+AeLocalGetRootPointer (
+ UINT32 Flags,
+ ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+{
+ return AE_ERROR;
+}
+
+ACPI_STATUS
+AcpiDsMethodDataGetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **DestDesc)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiDsMethodDataGetNode (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE **Node)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiDsStoreObjectToLocal (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *SrcDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiEvDeleteGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiEvQueueNotifyRequest (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 NotifyValue)
+{
+ return (AE_OK);
+}
+
+BOOLEAN
+AcpiEvIsNotifyObject (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ return (FALSE);
+}
+
+ACPI_STATUS
+AcpiEvAcquireGlobalLock(
+ UINT32 Timeout)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiEvReleaseGlobalLock(
+ void)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiEvInitializeRegion (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsLocked)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiExReadDataFromField (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **RetBufferDesc)
+{
+ return (AE_SUPPORT);
+}
+
+ACPI_STATUS
+AcpiExWriteDataToField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc)
+{
+ return (AE_SUPPORT);
+}
+
+ACPI_STATUS
+AcpiExLoadTableOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **ReturnDesc)
+{
+ return (AE_SUPPORT);
+}
+
+
+ACPI_STATUS
+AcpiExUnloadTable (
+ ACPI_OPERAND_OBJECT *DdbHandle)
+{
+ return (AE_SUPPORT);
+}
+
+ACPI_STATUS
+AcpiExLoadOp (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *Target,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (AE_SUPPORT);
+}
+
+ACPI_STATUS
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_TABLE_HEADER **TablePtr)
+{
+ return (AE_SUPPORT);
+}
+
diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c
new file mode 100644
index 0000000..ca5225d
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asltransform.c
@@ -0,0 +1,623 @@
+
+/******************************************************************************
+ *
+ * Module Name: asltransform - Parse tree transforms
+ * $Revision: 19 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asltransform")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlGetNextTempName
+ *
+ * PARAMETERS: NamePath - Where a pointer to the temp name is returned
+ *
+ * RETURN: A pointer to the second character of the name
+ *
+ * DESCRIPTION: Generate an ACPI name of the form _Txx. These names are
+ * reserved for use by the ASL compiler.
+ *
+ ******************************************************************************/
+
+char *
+TrAmlGetNextTempName (
+ char **NamePath)
+{
+ char *TempName;
+
+
+ if (Gbl_TempCount > 255)
+ {
+ /* Too many temps */
+ /* TBD: issue eror message */
+ *NamePath = "ERROR";
+ return ("Error");
+ }
+
+ TempName = UtLocalCalloc (6);
+ UtConvertByteToHex ((UINT8) Gbl_TempCount, (UINT8 *) &TempName [1]);
+ Gbl_TempCount++;
+
+ /* First three characters are always "\_T" */
+
+ TempName[0] = '\\';
+ TempName[1] = '_';
+ TempName[2] = 'T';
+
+ *NamePath = TempName;
+ return (&TempName[1]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlInitLineNumbers
+ *
+ * PARAMETERS: Op - Op to be initialized
+ * Neighbor - Op used for initialization values
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialized the various line numbers for a parse node.
+ *
+ ******************************************************************************/
+
+void
+TrAmlInitLineNumbers (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *Neighbor)
+{
+
+ Op->Asl.EndLine = Neighbor->Asl.EndLine;
+ Op->Asl.EndLogicalLine = Neighbor->Asl.EndLogicalLine;
+ Op->Asl.LineNumber = Neighbor->Asl.LineNumber;
+ Op->Asl.LogicalByteOffset = Neighbor->Asl.LogicalByteOffset;
+ Op->Asl.LogicalLineNumber = Neighbor->Asl.LogicalLineNumber;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlInitNode
+ *
+ * PARAMETERS: Op - Op to be initialized
+ * ParseOpcode - Opcode for this node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a node with the parse opcode and opcode name.
+ *
+ ******************************************************************************/
+
+void
+TrAmlInitNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT16 ParseOpcode)
+{
+
+ Op->Asl.ParseOpcode = ParseOpcode;
+ UtSetParseOpName (Op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlSetSubtreeParent
+ *
+ * PARAMETERS: Op - First node in a list of peer nodes
+ * Parent - Parent of the subtree
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the parent for all peer nodes in a subtree
+ *
+ ******************************************************************************/
+
+void
+TrAmlSetSubtreeParent (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *Parent)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ Next = Op;
+ while (Next)
+ {
+ Next->Asl.Parent = Parent;
+ Next = Next->Asl.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlInsertPeer
+ *
+ * PARAMETERS: Op - First node in a list of peer nodes
+ * NewPeer - Peer node to insert
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert a new peer node into a list of peers.
+ *
+ ******************************************************************************/
+
+void
+TrAmlInsertPeer (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *NewPeer)
+{
+
+ NewPeer->Asl.Next = Op->Asl.Next;
+ Op->Asl.Next = NewPeer;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAmlTransformWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML
+ * operands.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+TrAmlTransformWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ TrTransformSubtree (Op);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrTransformSubtree
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more
+ * complex AML opcodes require processing of the child nodes
+ * (arguments/operands).
+ *
+ ******************************************************************************/
+
+void
+TrTransformSubtree (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
+ {
+ return;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+ TrDoDefinitionBlock (Op);
+ break;
+
+ case PARSEOP_ELSEIF:
+ TrDoElseif (Op);
+ break;
+
+ case PARSEOP_SWITCH:
+ TrDoSwitch (Op);
+ break;
+
+ default:
+ /* Nothing to do here for other opcodes */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrDoDefinitionBlock
+ *
+ * PARAMETERS: Op - Parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Find the end of the definition block and set a global to this
+ * node. It is used by the compiler to insert compiler-generated
+ * names at the root level of the namespace.
+ *
+ ******************************************************************************/
+
+void
+TrDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+ UINT32 i;
+
+
+ Next = Op->Asl.Child;
+ for (i = 0; i < 5; i++)
+ {
+ Next = Next->Asl.Next;
+ }
+
+ Gbl_FirstLevelInsertionNode = Next;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrDoElseif
+ *
+ * PARAMETERS: Op - Parse node for ELSEIF
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Transform an Elseif into an Else and If AML opcode pair.
+ * There is no AML opcode for ELSEIF -- it must be simulated
+ * with an if/else pair.
+ *
+ ******************************************************************************/
+
+void
+TrDoElseif (
+ ACPI_PARSE_OBJECT *ElseNode)
+{
+ ACPI_PARSE_OBJECT *IfNode = NULL;
+ ACPI_PARSE_OBJECT *NextNode;
+
+
+ /* Change the ELSEIF into an ELSE */
+
+ TrAmlInitNode (ElseNode, PARSEOP_ELSE);
+
+ /* Create a new IF node */
+
+ IfNode = TrCreateLeafNode (PARSEOP_IF);
+ IfNode->Asl.Parent = ElseNode;
+ TrAmlInitLineNumbers (IfNode, ElseNode);
+
+ /* Insert the the IF node first in the ELSE child list */
+
+ IfNode->Asl.Child = ElseNode->Asl.Child;
+ ElseNode->Asl.Child = IfNode;
+
+ /* Go to the end of the IF <Predicate><TermList> block */
+
+ NextNode = IfNode->Asl.Child; /* Next = Predicate */
+ NextNode = NextNode->Asl.Next; /* Nest = TermList */
+
+ /* Make the next node after the IF the rest of the original tree */
+
+ IfNode->Asl.Next = NextNode->Asl.Next;
+
+ /* Terminate the IF subtree and set IF node as the parent for all nodes */
+
+ NextNode->Asl.Next = NULL;
+ TrAmlSetSubtreeParent (IfNode->Asl.Child, IfNode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrDoSwitch
+ *
+ * PARAMETERS: StartNode - Parse node for SWITCH
+ *
+ * RETURN: None
+ *
+ *
+ * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is
+ * no actual AML opcode for SWITCH -- it must be simulated.
+ *
+ ******************************************************************************/
+
+void
+TrDoSwitch (
+ ACPI_PARSE_OBJECT *StartNode)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_PARSE_OBJECT *CaseOp = NULL;
+ ACPI_PARSE_OBJECT *CaseBlock = NULL;
+ ACPI_PARSE_OBJECT *DefaultOp = NULL;
+ ACPI_PARSE_OBJECT *CurrentParentNode;
+ ACPI_PARSE_OBJECT *Conditional = NULL;
+ ACPI_PARSE_OBJECT *Predicate;
+ ACPI_PARSE_OBJECT *Peer;
+ ACPI_PARSE_OBJECT *NewOp;
+ ACPI_PARSE_OBJECT *NewOp2;
+ char *PredicateValueName;
+ char *PredicateValuePath;
+
+
+ CurrentParentNode = StartNode;
+ PredicateValueName = TrAmlGetNextTempName (&PredicateValuePath);
+
+ /* First child is the predicate */
+
+ Next = StartNode->Asl.Child;
+ Peer = Next->Asl.Next;
+
+ /* CASE statements start at next child */
+
+ while (Peer)
+ {
+ Next = Peer;
+ Peer = Next->Asl.Next;
+
+ if (Next->Asl.ParseOpcode == PARSEOP_CASE)
+ {
+ if (CaseOp)
+ {
+ /* Add an ELSE to complete the previous CASE */
+
+ NewOp = TrCreateLeafNode (PARSEOP_ELSE);
+ NewOp->Asl.Parent = Conditional->Asl.Parent;
+ TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent);
+
+ /* Link ELSE node as a peer to the previous IF */
+
+ TrAmlInsertPeer (Conditional, NewOp);
+ CurrentParentNode = NewOp;
+ }
+
+ CaseOp = Next;
+ Conditional = CaseOp;
+ CaseBlock = CaseOp->Asl.Child->Asl.Next;
+ Conditional->Asl.Child->Asl.Next = NULL;
+
+ /*
+ * change CaseOp() to: If (PredicateValue == CaseValue) {...}
+ * CaseOp->Child is the case value
+ * CaseOp->Child->Peer is the beginning of the case block
+ */
+ NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath));
+
+ Predicate = CaseOp->Asl.Child;
+ Predicate->Asl.Next = NewOp;
+ TrAmlInitLineNumbers (NewOp, Predicate);
+
+ NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL);
+ NewOp2->Asl.Parent = Conditional;
+ NewOp2->Asl.Child = Predicate;
+ TrAmlInitLineNumbers (NewOp2, Conditional);
+
+ TrAmlSetSubtreeParent (Predicate, NewOp2);
+
+ Predicate = NewOp2;
+ Predicate->Asl.Next = CaseBlock;
+
+ TrAmlSetSubtreeParent (Predicate, Conditional);
+
+ /* Reinitialize the CASE node to an IF node */
+
+ Conditional->Asl.Child = Predicate;
+ TrAmlInitNode (Conditional, PARSEOP_IF);
+
+ /*
+ * The first CASE(IF) is not nested under an ELSE.
+ * All other CASEs are children of a parent ELSE.
+ */
+ if (CurrentParentNode == StartNode)
+ {
+ Conditional->Asl.Parent = CurrentParentNode->Asl.Parent;
+
+ /* Link IF into the peer list */
+
+ TrAmlInsertPeer (CurrentParentNode, Conditional);
+ }
+ else
+ {
+ /*
+ * The IF is a child of previous IF/ELSE. It
+ * is therefore without peer.
+ */
+ CurrentParentNode->Asl.Child = Conditional;
+ Conditional->Asl.Parent = CurrentParentNode;
+ Conditional->Asl.Next = NULL;
+ }
+ }
+ else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT)
+ {
+ if (DefaultOp)
+ {
+ /* More than one Default */
+ }
+
+ /* Save the DEFAULT node for later, after CASEs */
+
+ DefaultOp = Next;
+ }
+ else
+ {
+ /* Unkown peer opcode */
+
+ printf ("Unknown parse opcode for switch statement: %s (%d)\n",
+ Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
+ }
+ }
+
+ /*
+ * Add the default at the end of the if/else construct
+ */
+ if (DefaultOp)
+ {
+ if (CaseOp)
+ {
+ /* Add an ELSE first */
+
+ TrAmlInitNode (DefaultOp, PARSEOP_ELSE);
+ DefaultOp->Asl.Parent = Conditional->Asl.Parent;
+ }
+ else
+ {
+ /* There were no CASE statements, no ELSE needed */
+
+ TrAmlInsertPeer (CurrentParentNode, DefaultOp->Asl.Child);
+ }
+ }
+
+ /*
+ * Add a NAME node for the temp integer
+ */
+ NewOp = TrCreateLeafNode (PARSEOP_NAME);
+ NewOp->Asl.Parent = Gbl_FirstLevelInsertionNode->Asl.Parent;
+
+ NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
+ NewOp->Asl.Child = NewOp2;
+ NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_INTEGER, (ACPI_INTEGER) 0);
+
+ TrAmlSetSubtreeParent (NewOp2, NewOp);
+
+ /* Insert this node at the global level of the ASL */
+
+ TrAmlInsertPeer (Gbl_FirstLevelInsertionNode, NewOp);
+ TrAmlInitLineNumbers (NewOp, Gbl_FirstLevelInsertionNode);
+ TrAmlInitLineNumbers (NewOp2, Gbl_FirstLevelInsertionNode);
+ TrAmlInitLineNumbers (NewOp2->Asl.Next, Gbl_FirstLevelInsertionNode);
+
+ /*
+ * Change the SWITCH node to a STORE (predicate value, _Txx)
+ */
+ TrAmlInitNode (StartNode, PARSEOP_STORE);
+
+ Predicate = StartNode->Asl.Child;
+ Predicate->Asl.Child = NULL;
+
+ NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath));
+ NewOp->Asl.Parent = StartNode;
+ Predicate->Asl.Next = NewOp;
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c
new file mode 100644
index 0000000..0518303
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asltree.c
@@ -0,0 +1,1182 @@
+
+/******************************************************************************
+ *
+ * Module Name: asltree - parse tree management
+ * $Revision: 53 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asltree")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrGetNextNode
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: New parse node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
+ * dynamic memory manager for performance reasons (This has a
+ * major impact on the speed of the compiler.)
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrGetNextNode (void)
+{
+
+ if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
+ {
+ Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) * ASL_NODE_CACHE_SIZE);
+ Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
+ }
+
+ return (Gbl_NodeCacheNext++);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrAllocateNode
+ *
+ * PARAMETERS: ParseOpcode - Opcode to be assigned to the node
+ *
+ * RETURN: New parse node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate and initialize a new parse node for the parse tree
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrAllocateNode (
+ UINT32 ParseOpcode)
+{
+ ACPI_PARSE_OBJECT *Op;
+
+
+ Op = TrGetNextNode ();
+
+ Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
+ Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
+ Op->Asl.LineNumber = Gbl_CurrentLineNumber;
+ Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber;
+ Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset;
+ Op->Asl.Column = Gbl_CurrentColumn;
+
+ UtSetParseOpName (Op);
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrReleaseNode
+ *
+ * PARAMETERS: Op - Op to be released
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: "release" a node. In truth, nothing is done since the node
+ * is part of a larger buffer
+ *
+ ******************************************************************************/
+
+void
+TrReleaseNode (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrUpdateNode
+ *
+ * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
+ * Op - An existing parse node
+ *
+ * RETURN: The updated node
+ *
+ * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
+ * change an opcode to DEFAULT_ARG so that the node is ignored
+ * during the code generation. Also used to set generic integers
+ * to a specific size (8, 16, 32, or 64 bits)
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrUpdateNode (
+ UINT32 ParseOpcode,
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if (!Op)
+ {
+ return NULL;
+ }
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nUpdateNode: Old - %s, New - %s\n\n",
+ UtGetOpName (Op->Asl.ParseOpcode),
+ UtGetOpName (ParseOpcode));
+
+ /* Assign new opcode and name */
+
+ if (Op->Asl.ParseOpcode == PARSEOP_ONES)
+ {
+ switch (ParseOpcode)
+ {
+ case PARSEOP_BYTECONST:
+ Op->Asl.Value.Integer = 0xFF;
+ break;
+
+ case PARSEOP_WORDCONST:
+ Op->Asl.Value.Integer = 0xFFFF;
+ break;
+
+ case PARSEOP_DWORDCONST:
+ Op->Asl.Value.Integer = 0xFFFFFFFF;
+ break;
+
+ default:
+ /* Don't care about others, don't need to check QWORD */
+ break;
+ }
+ }
+
+ Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
+ UtSetParseOpName (Op);
+
+ /*
+ * For the BYTE, WORD, and DWORD constants, make sure that the integer
+ * that was passed in will actually fit into the data type
+ */
+ switch (ParseOpcode)
+ {
+ case PARSEOP_BYTECONST:
+ Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
+ break;
+
+ case PARSEOP_WORDCONST:
+ Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
+ break;
+
+ case PARSEOP_DWORDCONST:
+ Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
+ break;
+
+ default:
+ /* Don't care about others, don't need to check QWORD */
+ break;
+ }
+
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrGetNodeFlagName
+ *
+ * PARAMETERS: Flags - Flags word to be decoded
+ *
+ * RETURN: Name string
+ *
+ * DESCRIPTION: Decode a flags word
+ *
+ ******************************************************************************/
+
+char *
+TrGetNodeFlagName (
+ UINT32 Flags)
+{
+
+ switch (Flags)
+ {
+ case NODE_VISITED:
+ return ("NODE_VISITED");
+
+ case NODE_AML_PACKAGE:
+ return ("NODE_AML_PACKAGE");
+
+ case NODE_IS_TARGET:
+ return ("NODE_IS_TARGET");
+
+ case NODE_IS_RESOURCE_DESC:
+ return ("NODE_IS_RESOURCE_DESC");
+
+ case NODE_IS_RESOURCE_FIELD:
+ return ("NODE_IS_RESOURCE_FIELD");
+
+ case NODE_HAS_NO_EXIT:
+ return ("NODE_HAS_NO_EXIT");
+
+ case NODE_IF_HAS_NO_EXIT:
+ return ("NODE_IF_HAS_NO_EXIT");
+
+ case NODE_NAME_INTERNALIZED:
+ return ("NODE_NAME_INTERNALIZED");
+
+ case NODE_METHOD_NO_RETVAL:
+ return ("NODE_METHOD_NO_RETVAL");
+
+ case NODE_METHOD_SOME_NO_RETVAL:
+ return ("NODE_METHOD_SOME_NO_RETVAL");
+
+ case NODE_RESULT_NOT_USED:
+ return ("NODE_RESULT_NOT_USED");
+
+ case NODE_METHOD_TYPED:
+ return ("NODE_METHOD_TYPED");
+
+ case NODE_IS_BIT_OFFSET:
+ return ("NODE_IS_BIT_OFFSET");
+
+ case NODE_COMPILE_TIME_CONST:
+ return ("NODE_COMPILE_TIME_CONST");
+
+ case NODE_IS_TERM_ARG:
+ return ("NODE_IS_TERM_ARG");
+
+ case NODE_WAS_ONES_OP:
+ return ("NODE_WAS_ONES_OP");
+
+ case NODE_IS_NAME_DECLARATION:
+ return ("NODE_IS_NAME_DECLARATION");
+
+ default:
+ return ("Multiple Flags (or unknown flag) set");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrSetNodeFlags
+ *
+ * PARAMETERS: Op - An existing parse node
+ * Flags - New flags word
+ *
+ * RETURN: The updated node
+ *
+ * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrSetNodeFlags (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Flags)
+{
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, TrGetNodeFlagName (Flags));
+
+ if (!Op)
+ {
+ return NULL;
+ }
+
+ Op->Asl.CompileFlags |= Flags;
+
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrSetEndLineNumber
+ *
+ * PARAMETERS: Op - An existing parse node
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Set the ending line numbers (file line and logical line) of a
+ * parse node to the current line numbers.
+ *
+ ******************************************************************************/
+
+void
+TrSetEndLineNumber (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ /* If the end line # is already set, just return */
+
+ if (Op->Asl.EndLine)
+ {
+ return;
+ }
+
+ Op->Asl.EndLine = Gbl_CurrentLineNumber;
+ Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrCreateLeafNode
+ *
+ * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
+ *
+ * RETURN: Pointer to the new node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Create a simple leaf node (no children or peers, and no value
+ * assigned to the node)
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrCreateLeafNode (
+ UINT32 ParseOpcode)
+{
+ ACPI_PARSE_OBJECT *Op;
+
+
+ Op = TrAllocateNode (ParseOpcode);
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nCreateLeafNode Line %d NewNode %p Op %s\n\n",
+ Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode));
+
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrCreateValuedLeafNode
+ *
+ * PARAMETERS: ParseOpcode - New opcode to be assigned to the node
+ * Value - Value to be assigned to the node
+ *
+ * RETURN: Pointer to the new node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Create a leaf node (no children or peers) with a value
+ * assigned to it
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrCreateValuedLeafNode (
+ UINT32 ParseOpcode,
+ ACPI_INTEGER Value)
+{
+ ACPI_PARSE_OBJECT *Op;
+
+
+ Op = TrAllocateNode (ParseOpcode);
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ",
+ Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode),
+ ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
+ Op->Asl.Value.Integer = Value;
+
+ switch (ParseOpcode)
+ {
+ case PARSEOP_STRING_LITERAL:
+ DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
+ break;
+
+ case PARSEOP_NAMESEG:
+ DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
+ break;
+
+ case PARSEOP_NAMESTRING:
+ DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
+ break;
+
+ case PARSEOP_EISAID:
+ DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
+ break;
+
+ case PARSEOP_METHOD:
+ DbgPrint (ASL_PARSE_OUTPUT, "METHOD");
+ break;
+
+ case PARSEOP_INTEGER:
+ DbgPrint (ASL_PARSE_OUTPUT, "INTEGER");
+ break;
+
+ default:
+ break;
+ }
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrCreateNode
+ *
+ * PARAMETERS: ParseOpcode - Opcode to be assigned to the node
+ * NumChildren - Number of children to follow
+ * ... - A list of child nodes to link to the new
+ * node. NumChildren long.
+ *
+ * RETURN: Pointer to the new node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Create a new parse node and link together a list of child
+ * nodes underneath the new node.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrCreateNode (
+ UINT32 ParseOpcode,
+ UINT32 NumChildren,
+ ...)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_PARSE_OBJECT *Child;
+ ACPI_PARSE_OBJECT *PrevChild;
+ va_list ap;
+ UINT32 i;
+ BOOLEAN FirstChild;
+
+
+ va_start (ap, NumChildren);
+
+ /* Allocate one new node */
+
+ Op = TrAllocateNode (ParseOpcode);
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nCreateNode Line %d NewParent %p Child %d Op %s ",
+ Op->Asl.LineNumber, Op, NumChildren, UtGetOpName(ParseOpcode));
+
+ /* Some extra debug output based on the parse opcode */
+
+ switch (ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+ RootNode = Op;
+ DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
+ break;
+
+ case PARSEOP_OPERATIONREGION:
+ DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");
+ break;
+
+ case PARSEOP_OR:
+ DbgPrint (ASL_PARSE_OUTPUT, "OR->");
+ break;
+
+ default:
+ /* Nothing to do for other opcodes */
+ break;
+ }
+
+ /* Link the new node to its children */
+
+ PrevChild = NULL;
+ FirstChild = TRUE;
+ for (i = 0; i < NumChildren; i++)
+ {
+ /* Get the next child */
+
+ Child = va_arg (ap, ACPI_PARSE_OBJECT *);
+ DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
+
+ /*
+ * If child is NULL, this means that an optional argument
+ * was omitted. We must create a placeholder with a special
+ * opcode (DEFAULT_ARG) so that the code generator will know
+ * that it must emit the correct default for this argument
+ */
+ if (!Child)
+ {
+ Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);
+ }
+
+ /* Link first child to parent */
+
+ if (FirstChild)
+ {
+ FirstChild = FALSE;
+ Op->Asl.Child = Child;
+ }
+
+ /* Point all children to parent */
+
+ Child->Asl.Parent = Op;
+
+ /* Link children in a peer list */
+
+ if (PrevChild)
+ {
+ PrevChild->Asl.Next = Child;
+ };
+
+ /*
+ * This child might be a list, point all nodes in the list
+ * to the same parent
+ */
+ while (Child->Asl.Next)
+ {
+ Child = Child->Asl.Next;
+ Child->Asl.Parent = Op;
+ }
+
+ PrevChild = Child;
+ }
+ va_end(ap);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrLinkChildren
+ *
+ * PARAMETERS: Op - An existing parse node
+ * NumChildren - Number of children to follow
+ * ... - A list of child nodes to link to the new
+ * node. NumChildren long.
+ *
+ * RETURN: The updated (linked) node
+ *
+ * DESCRIPTION: Link a group of nodes to an existing parse node
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrLinkChildren (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 NumChildren,
+ ...)
+{
+ ACPI_PARSE_OBJECT *Child;
+ ACPI_PARSE_OBJECT *PrevChild;
+ va_list ap;
+ UINT32 i;
+ BOOLEAN FirstChild;
+
+
+ va_start (ap, NumChildren);
+
+
+ TrSetEndLineNumber (Op);
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ",
+ Op->Asl.LineNumber, Op->Asl.EndLine,
+ Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode));
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_DEFINITIONBLOCK:
+ RootNode = Op;
+ DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
+ break;
+
+ case PARSEOP_OPERATIONREGION:
+ DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");
+ break;
+
+ case PARSEOP_OR:
+ DbgPrint (ASL_PARSE_OUTPUT, "OR->");
+ break;
+
+ default:
+ /* Nothing to do for other opcodes */
+ break;
+ }
+
+ /* Link the new node to it's children */
+
+ PrevChild = NULL;
+ FirstChild = TRUE;
+ for (i = 0; i < NumChildren; i++)
+ {
+ Child = va_arg (ap, ACPI_PARSE_OBJECT *);
+
+ if ((Child == PrevChild) && (Child != NULL))
+ {
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid");
+ return Op;
+ }
+
+ DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
+
+ /*
+ * If child is NULL, this means that an optional argument
+ * was omitted. We must create a placeholder with a special
+ * opcode (DEFAULT_ARG) so that the code generator will know
+ * that it must emit the correct default for this argument
+ */
+ if (!Child)
+ {
+ Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);
+ }
+
+ /* Link first child to parent */
+
+ if (FirstChild)
+ {
+ FirstChild = FALSE;
+ Op->Asl.Child = Child;
+ }
+
+ /* Point all children to parent */
+
+ Child->Asl.Parent = Op;
+
+ /* Link children in a peer list */
+
+ if (PrevChild)
+ {
+ PrevChild->Asl.Next = Child;
+ };
+
+ /*
+ * This child might be a list, point all nodes in the list
+ * to the same parent
+ */
+ while (Child->Asl.Next)
+ {
+ Child = Child->Asl.Next;
+ Child->Asl.Parent = Op;
+ }
+ PrevChild = Child;
+ }
+ va_end(ap);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrLinkPeerNode
+ *
+ * PARAMETERS: Op1 - First peer
+ * Op2 - Second peer
+ *
+ * RETURN: Op1 or the non-null node.
+ *
+ * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrLinkPeerNode (
+ ACPI_PARSE_OBJECT *Op1,
+ ACPI_PARSE_OBJECT *Op2)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n",
+ Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL,
+ Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL);
+
+
+ if ((!Op1) && (!Op2))
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n");
+ return Op1;
+ }
+
+ /* If one of the nodes is null, just return the non-null node */
+
+ if (!Op2)
+ {
+ return Op1;
+ }
+
+ if (!Op1)
+ {
+ return Op2;
+ }
+
+ if (Op1 == Op2)
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "\n\n************* Internal error, linking node to itself %p\n\n\n", Op1);
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, "Linking node to itself");
+ return Op1;
+ }
+
+ Op1->Asl.Parent = Op2->Asl.Parent;
+
+ /*
+ * Op 1 may already have a peer list (such as an IF/ELSE pair),
+ * so we must walk to the end of the list and attach the new
+ * peer at the end
+ */
+ Next = Op1;
+ while (Next->Asl.Next)
+ {
+ Next = Next->Asl.Next;
+ }
+
+ Next->Asl.Next = Op2;
+ return Op1;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrLinkPeerNodes
+ *
+ * PARAMETERS: NumPeers - The number of nodes in the list to follow
+ * ... - A list of nodes to link together as peers
+ *
+ * RETURN: The first node in the list (head of the peer list)
+ *
+ * DESCRIPTION: Link together an arbitrary number of peer nodes.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrLinkPeerNodes (
+ UINT32 NumPeers,
+ ...)
+{
+ ACPI_PARSE_OBJECT *This;
+ ACPI_PARSE_OBJECT *Next;
+ va_list ap;
+ UINT32 i;
+ ACPI_PARSE_OBJECT *Start;
+
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nLinkPeerNodes: (%d) ", NumPeers);
+
+ va_start (ap, NumPeers);
+ This = va_arg (ap, ACPI_PARSE_OBJECT *);
+ Start = This;
+
+ /*
+ * Link all peers
+ */
+ for (i = 0; i < (NumPeers -1); i++)
+ {
+ DbgPrint (ASL_PARSE_OUTPUT, "%d=%p ", (i+1), This);
+
+ while (This->Asl.Next)
+ {
+ This = This->Asl.Next;
+ }
+
+ /* Get another peer node */
+
+ Next = va_arg (ap, ACPI_PARSE_OBJECT *);
+ if (!Next)
+ {
+ Next = TrAllocateNode (PARSEOP_DEFAULT_ARG);
+ }
+
+ /* link new node to the current node */
+
+ This->Asl.Next = Next;
+ This = Next;
+ }
+
+ DbgPrint (ASL_PARSE_OUTPUT,"\n\n");
+ return (Start);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrLinkChildNode
+ *
+ * PARAMETERS: Op1 - Parent node
+ * Op2 - Op to become a child
+ *
+ * RETURN: The parent node
+ *
+ * DESCRIPTION: Link two nodes together as a parent and child
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrLinkChildNode (
+ ACPI_PARSE_OBJECT *Op1,
+ ACPI_PARSE_OBJECT *Op2)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n",
+ Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL,
+ Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL);
+
+ if (!Op1 || !Op2)
+ {
+ return Op1;
+ }
+
+ Op1->Asl.Child = Op2;
+
+ /* Set the child and all peers of the child to point to the parent */
+
+ Next = Op2;
+ while (Next)
+ {
+ Next->Asl.Parent = Op1;
+ Next = Next->Asl.Next;
+ }
+
+ return Op1;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrWalkParseTree
+ *
+ * PARAMETERS: Visitation - Type of walk
+ * DescendingCallback - Called during tree descent
+ * AscendingCallback - Called during tree ascent
+ * Context - To be passed to the callbacks
+ *
+ * RETURN: Status from callback(s)
+ *
+ * DESCRIPTION: Walk the entire parse tree.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+TrWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Visitation,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context)
+{
+ UINT32 Level;
+ BOOLEAN NodePreviouslyVisited;
+ ACPI_PARSE_OBJECT *StartOp = Op;
+ ACPI_STATUS Status;
+
+
+ if (!RootNode)
+ {
+ return (AE_OK);
+ }
+
+ Level = 0;
+ NodePreviouslyVisited = FALSE;
+
+ switch (Visitation)
+ {
+ case ASL_WALK_VISIT_DOWNWARD:
+
+ while (Op)
+ {
+ if (!NodePreviouslyVisited)
+ {
+ /*
+ * Let the callback process the node.
+ */
+ Status = DescendingCallback (Op, Level, Context);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Visit children first, once */
+
+ if (Op->Asl.Child)
+ {
+ Level++;
+ Op = Op->Asl.Child;
+ continue;
+ }
+ }
+ else if (Status != AE_CTRL_DEPTH)
+ {
+ /* Exit immediately on any error */
+
+ return (Status);
+ }
+ }
+
+ /* Terminate walk at start op */
+
+ if (Op == StartOp)
+ {
+ break;
+ }
+
+ /* No more children, visit peers */
+
+ if (Op->Asl.Next)
+ {
+ Op = Op->Asl.Next;
+ NodePreviouslyVisited = FALSE;
+ }
+ else
+ {
+ /* No children or peers, re-visit parent */
+
+ if (Level != 0 )
+ {
+ Level--;
+ }
+ Op = Op->Asl.Parent;
+ NodePreviouslyVisited = TRUE;
+ }
+ }
+ break;
+
+
+ case ASL_WALK_VISIT_UPWARD:
+
+ while (Op)
+ {
+ /* Visit leaf node (no children) or parent node on return trip */
+
+ if ((!Op->Asl.Child) ||
+ (NodePreviouslyVisited))
+ {
+ /*
+ * Let the callback process the node.
+ *
+ */
+ Status = AscendingCallback (Op, Level, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ else
+ {
+ /* Visit children first, once */
+
+ Level++;
+ Op = Op->Asl.Child;
+ continue;
+ }
+
+ /* Terminate walk at start op */
+
+ if (Op == StartOp)
+ {
+ break;
+ }
+
+ /* No more children, visit peers */
+
+ if (Op->Asl.Next)
+ {
+ Op = Op->Asl.Next;
+ NodePreviouslyVisited = FALSE;
+ }
+ else
+ {
+ /* No children or peers, re-visit parent */
+
+ if (Level != 0 )
+ {
+ Level--;
+ }
+ Op = Op->Asl.Parent;
+ NodePreviouslyVisited = TRUE;
+ }
+ }
+ break;
+
+
+ case ASL_WALK_VISIT_TWICE:
+
+ while (Op)
+ {
+ if (NodePreviouslyVisited)
+ {
+ Status = AscendingCallback (Op, Level, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ else
+ {
+ /*
+ * Let the callback process the node.
+ */
+ Status = DescendingCallback (Op, Level, Context);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Visit children first, once */
+
+ if (Op->Asl.Child)
+ {
+ Level++;
+ Op = Op->Asl.Child;
+ continue;
+ }
+ }
+ else if (Status != AE_CTRL_DEPTH)
+ {
+ /* Exit immediately on any error */
+
+ return (Status);
+ }
+ }
+
+ /* Terminate walk at start op */
+
+ if (Op == StartOp)
+ {
+ break;
+ }
+
+ /* No more children, visit peers */
+
+ if (Op->Asl.Next)
+ {
+ Op = Op->Asl.Next;
+ NodePreviouslyVisited = FALSE;
+ }
+ else
+ {
+ /* No children or peers, re-visit parent */
+
+ if (Level != 0 )
+ {
+ Level--;
+ }
+ Op = Op->Asl.Parent;
+ NodePreviouslyVisited = TRUE;
+ }
+ }
+ break;
+
+ default:
+ /* No other types supported */
+ break;
+ }
+
+ /* If we get here, the walk completed with no errors */
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h
new file mode 100644
index 0000000..8881ba5
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/asltypes.h
@@ -0,0 +1,496 @@
+
+/******************************************************************************
+ *
+ * Module Name: asltypes.h - compiler data types and struct definitions
+ * $Revision: 59 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ASLTYPES_H
+#define __ASLTYPES_H
+
+
+#include <time.h>
+
+
+/*******************************************************************************
+ *
+ * Structure definitions
+ *
+ ******************************************************************************/
+
+
+/* Op flags for the ACPI_PARSE_OBJECT */
+
+#define NODE_VISITED 0x00000001
+#define NODE_AML_PACKAGE 0x00000002
+#define NODE_IS_TARGET 0x00000004
+#define NODE_IS_RESOURCE_DESC 0x00000008
+#define NODE_IS_RESOURCE_FIELD 0x00000010
+#define NODE_HAS_NO_EXIT 0x00000020
+#define NODE_IF_HAS_NO_EXIT 0x00000040
+#define NODE_NAME_INTERNALIZED 0x00000080
+#define NODE_METHOD_NO_RETVAL 0x00000100
+#define NODE_METHOD_SOME_NO_RETVAL 0x00000200
+#define NODE_RESULT_NOT_USED 0x00000400
+#define NODE_METHOD_TYPED 0x00000800
+#define NODE_IS_BIT_OFFSET 0x00001000
+#define NODE_COMPILE_TIME_CONST 0x00002000
+#define NODE_IS_TERM_ARG 0x00004000
+#define NODE_WAS_ONES_OP 0x00008000
+#define NODE_IS_NAME_DECLARATION 0x00010000
+
+/* Keeps information about individual control methods */
+
+typedef struct asl_method_info
+{
+ UINT8 NumArguments;
+ UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS];
+ UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS];
+ UINT32 NumReturnNoValue;
+ UINT32 NumReturnWithValue;
+ ACPI_PARSE_OBJECT *Op;
+ struct asl_method_info *Next;
+ UINT8 HasBeenTyped;
+
+} ASL_METHOD_INFO;
+
+
+/* Parse tree walk info for control method analysis */
+
+typedef struct asl_analysis_walk_info
+{
+ ASL_METHOD_INFO *MethodStack;
+
+} ASL_ANALYSIS_WALK_INFO;
+
+
+/* An entry in the ParseOpcode to AmlOpcode mapping table */
+
+typedef struct asl_mapping_entry
+{
+ UINT32 Value;
+ UINT32 AcpiBtype; /* Object type or return type */
+ UINT16 AmlOpcode;
+ UINT8 Flags;
+
+} ASL_MAPPING_ENTRY;
+
+
+/* An entry in the Reserved Name information table */
+
+#define ASL_RSVD_RETURN_VALUE 0x01
+#define ASL_RSVD_RESOURCE_NAME 0x02
+#define ASL_RSVD_SCOPE 0x04
+
+typedef struct asl_reserved_info
+{
+ char *Name;
+ UINT8 NumArguments;
+ UINT8 Flags;
+
+} ASL_RESERVED_INFO;
+
+
+/* Parse tree walk info structure */
+
+typedef struct asl_walk_info
+{
+ ACPI_PARSE_OBJECT **NodePtr;
+ UINT32 *LevelPtr;
+
+} ASL_WALK_INFO;
+
+
+/* File info */
+
+typedef struct asl_file_info
+{
+ FILE *Handle;
+ char *Filename;
+
+} ASL_FILE_INFO;
+
+
+/* File types */
+
+typedef enum
+{
+ ASL_FILE_STDOUT = 0,
+ ASL_FILE_STDERR,
+ ASL_FILE_INPUT,
+ ASL_FILE_AML_OUTPUT,
+ ASL_FILE_SOURCE_OUTPUT,
+ ASL_FILE_LISTING_OUTPUT,
+ ASL_FILE_HEX_OUTPUT,
+ ASL_FILE_NAMESPACE_OUTPUT,
+ ASL_FILE_DEBUG_OUTPUT,
+ ASL_FILE_ASM_SOURCE_OUTPUT,
+ ASL_FILE_C_SOURCE_OUTPUT,
+ ASL_FILE_ASM_INCLUDE_OUTPUT,
+ ASL_FILE_C_INCLUDE_OUTPUT
+
+} ASL_FILE_TYPES;
+
+
+#define ASL_MAX_FILE_TYPE 12
+#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1)
+
+
+/* An entry in the exception list, one for each error/warning */
+
+typedef struct asl_error_msg
+{
+ UINT32 LineNumber;
+ UINT32 LogicalLineNumber;
+ UINT32 LogicalByteOffset;
+ UINT32 Column;
+ char *Message;
+ struct asl_error_msg *Next;
+ char *Filename;
+ UINT32 FilenameLength;
+ UINT8 MessageId;
+ UINT8 Level;
+
+} ASL_ERROR_MSG;
+
+
+/* An entry in the listing file stack (for include files) */
+
+typedef struct asl_listing_node
+{
+ char *Filename;
+ UINT32 LineNumber;
+ struct asl_listing_node *Next;
+
+} ASL_LISTING_NODE;
+
+
+/* Callback interface for a parse tree walk */
+
+typedef
+ACPI_STATUS (*ASL_WALK_CALLBACK) (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+typedef struct asl_event_info
+{
+ time_t StartTime;
+ time_t EndTime;
+ char *EventName;
+ BOOLEAN Valid;
+
+} ASL_EVENT_INFO;
+
+
+#define ASL_ERROR 0
+#define ASL_WARNING 1
+#define ASL_REMARK 2
+#define ASL_OPTIMIZATION 3
+#define ASL_NUM_REPORT_LEVELS 4
+
+
+typedef enum
+{
+ ASL_MSG_NULL = 0,
+ ASL_MSG_MEMORY_ALLOCATION,
+ ASL_MSG_INPUT_FILE_OPEN,
+ ASL_MSG_OUTPUT_FILENAME,
+ ASL_MSG_OUTPUT_FILE_OPEN,
+ ASL_MSG_LISTING_FILENAME,
+ ASL_MSG_LISTING_FILE_OPEN,
+ ASL_MSG_DEBUG_FILENAME,
+ ASL_MSG_DEBUG_FILE_OPEN,
+ ASL_MSG_INCLUDE_FILE_OPEN,
+ ASL_MSG_ENCODING_LENGTH,
+ ASL_MSG_INVALID_PRIORITY,
+ ASL_MSG_INVALID_PERFORMANCE,
+ ASL_MSG_LOCAL_INIT,
+ ASL_MSG_ARG_INIT,
+ ASL_MSG_UNSUPPORTED,
+ ASL_MSG_RESERVED_WORD,
+ ASL_MSG_BUFFER_LENGTH,
+ ASL_MSG_PACKAGE_LENGTH,
+ ASL_MSG_RETURN_TYPES,
+ ASL_MSG_NOT_FOUND,
+ ASL_MSG_NOT_REACHABLE,
+ ASL_MSG_NOT_EXIST,
+ ASL_MSG_NESTED_COMMENT,
+ ASL_MSG_RESERVED_ARG_COUNT_HI,
+ ASL_MSG_RESERVED_ARG_COUNT_LO,
+ ASL_MSG_RESERVED_RETURN_VALUE,
+ ASL_MSG_ARG_COUNT_HI,
+ ASL_MSG_ARG_COUNT_LO,
+ ASL_MSG_NO_RETVAL,
+ ASL_MSG_SOME_NO_RETVAL,
+ ASL_MSG_COMPILER_INTERNAL,
+ ASL_MSG_BACKWARDS_OFFSET,
+ ASL_MSG_UNKNOWN_RESERVED_NAME,
+ ASL_MSG_NAME_EXISTS,
+ ASL_MSG_INVALID_TYPE,
+ ASL_MSG_MULTIPLE_TYPES,
+ ASL_MSG_SYNTAX,
+ ASL_MSG_NOT_METHOD,
+ ASL_MSG_LONG_LINE,
+ ASL_MSG_RECURSION,
+ ASL_MSG_NOT_PARAMETER,
+ ASL_MSG_OPEN,
+ ASL_MSG_READ,
+ ASL_MSG_WRITE,
+ ASL_MSG_SEEK,
+ ASL_MSG_CLOSE,
+ ASL_MSG_FIELD_ACCESS_WIDTH,
+ ASL_MSG_REGION_BYTE_ACCESS,
+ ASL_MSG_REGION_BUFFER_ACCESS,
+ ASL_MSG_FIELD_UNIT_OFFSET,
+ ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
+ ASL_MSG_RESOURCE_FIELD,
+ ASL_MSG_BYTES_TO_BITS,
+ ASL_MSG_BITS_TO_BYTES,
+ ASL_MSG_AML_NOT_IMPLEMENTED,
+ ASL_MSG_NO_WHILE,
+ ASL_MSG_INVALID_ESCAPE,
+ ASL_MSG_INVALID_STRING,
+ ASL_MSG_TABLE_SIGNATURE,
+ ASL_MSG_RESOURCE_LIST,
+ ASL_MSG_INVALID_TARGET,
+ ASL_MSG_INVALID_CONSTANT_OP,
+ ASL_MSG_CONSTANT_EVALUATION,
+ ASL_MSG_CONSTANT_FOLDED,
+ ASL_MSG_INVALID_EISAID,
+ ASL_MSG_RESERVED_OPERAND_TYPE,
+ ASL_MSG_RESERVED_METHOD,
+ ASL_MSG_ALPHANUMERIC_STRING,
+ ASL_MSG_RESERVED_USE,
+ ASL_MSG_INVALID_OPERAND,
+ ASL_MSG_MISSING_ENDDEPENDENT,
+ ASL_MSG_MISSING_STARTDEPENDENT,
+ ASL_MSG_DEPENDENT_NESTING,
+ ASL_MSG_NAME_OPTIMIZATION,
+ ASL_MSG_SINGLE_NAME_OPTIMIZATION,
+ ASL_MSG_INTEGER_OPTIMIZATION,
+ ASL_MSG_SCOPE_TYPE,
+ ASL_MSG_CORE_EXCEPTION,
+ ASL_MSG_UNREACHABLE_CODE,
+ ASL_MSG_EARLY_EOF,
+ ASL_MSG_SCOPE_FWD_REF
+
+} ASL_MESSAGE_IDS;
+
+#ifdef ASL_EXCEPTIONS
+
+char *AslMessages [] = {
+/* ASL_MSG_NULL */ NULL,
+/* ASL_MSG_MEMORY_ALLOCATION, */ "Memory allocation failure",
+/* ASL_MSG_INPUT_FILE_OPEN, */ "Could not open input file",
+/* ASL_MSG_OUTPUT_FILENAME, */ "Could not create output filename",
+/* ASL_MSG_OUTPUT_FILE_OPEN, */ "Could not open output AML file",
+/* ASL_MSG_LISTING_FILENAME, */ "Could not create listing filename",
+/* ASL_MSG_LISTING_FILE_OPEN, */ "Could not open listing file",
+/* ASL_MSG_DEBUG_FILENAME, */ "Could not create debug filename",
+/* ASL_MSG_DEBUG_FILE_OPEN, */ "Could not open debug file",
+/* ASL_MSG_INCLUDE_FILE_OPEN, */ "Could not open include file",
+/* ASL_MSG_ENCODING_LENGTH, */ "Package length too long to encode",
+/* ASL_MSG_INVALID_PRIORITY, */ "Invalid priority value",
+/* ASL_MSG_INVALID_PERFORMANCE, */ "Invalid performance/robustness value",
+/* ASL_MSG_LOCAL_INIT, */ "Method local variable is not initialized",
+/* ASL_MSG_ARG_INIT, */ "Method argument is not initialized",
+/* ASL_MSG_UNSUPPORTED, */ "Unsupported feature",
+/* ASL_MSG_RESERVED_WORD, */ "Use of reserved word",
+/* ASL_MSG_BUFFER_LENGTH, */ "Effective AML buffer length is zero",
+/* ASL_MSG_PACKAGE_LENGTH, */ "Effective AML package length is zero",
+/* ASL_MSG_RETURN_TYPES, */ "Not all control paths return a value",
+/* ASL_MSG_NOT_FOUND, */ "Object not found or not accessible from scope",
+/* ASL_MSG_NOT_REACHABLE, */ "Object not accessible from this scope",
+/* ASL_MSG_NOT_EXIST, */ "Object does not exist",
+/* ASL_MSG_NESTED_COMMENT, */ "Nested comment found",
+/* ASL_MSG_RESERVED_ARG_COUNT_HI, */ "Reserved method has too many arguments",
+/* ASL_MSG_RESERVED_ARG_COUNT_LO, */ "Reserved method has too few arguments",
+/* ASL_MSG_RESERVED_RETURN_VALUE, */ "Reserved method must return a value",
+/* ASL_MSG_ARG_COUNT_HI, */ "Too many arguments",
+/* ASL_MSG_ARG_COUNT_LO, */ "Too few arguments",
+/* ASL_MSG_NO_RETVAL, */ "Called method returns no value",
+/* ASL_MSG_SOME_NO_RETVAL, */ "Called method may not always return a value",
+/* ASL_MSG_COMPILER_INTERNAL, */ "Internal compiler error",
+/* ASL_MSG_BACKWARDS_OFFSET, */ "Invalid backwards offset",
+/* ASL_MSG_UNKNOWN_RESERVED_NAME, */ "Unknown reserved name",
+/* ASL_MSG_NAME_EXISTS, */ "Name already exists in scope",
+/* ASL_MSG_INVALID_TYPE, */ "Invalid type",
+/* ASL_MSG_MULTIPLE_TYPES, */ "Multiple types",
+/* ASL_MSG_SYNTAX, */ "",
+/* ASL_MSG_NOT_METHOD, */ "Not a control method, cannot invoke",
+/* ASL_MSG_LONG_LINE, */ "Splitting long input line",
+/* ASL_MSG_RECURSION, */ "Recursive method call",
+/* ASL_MSG_NOT_PARAMETER, */ "Not a parameter, used as local only",
+/* ASL_MSG_OPEN, */ "Could not open file",
+/* ASL_MSG_READ, */ "Could not read file",
+/* ASL_MSG_WRITE, */ "Could not write file",
+/* ASL_MSG_SEEK, */ "Could not seek file",
+/* ASL_MSG_CLOSE, */ "Could not close file",
+/* ASL_MSG_FIELD_ACCESS_WIDTH, */ "Access width is greater than region size",
+/* ASL_MSG_REGION_BYTE_ACCESS, */ "Host Operation Region requires ByteAcc access",
+/* ASL_MSG_REGION_BUFFER_ACCESS, */ "Host Operation Region requires BufferAcc access",
+/* ASL_MSG_FIELD_UNIT_OFFSET, */ "Field Unit extends beyond region limit",
+/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, */ "Access width of Field Unit extends beyond region limit",
+/* ASL_MSG_RESOURCE_FIELD, */ "Resource field name cannot be used as a target",
+/* ASL_MSG_BYTES_TO_BITS, */ "Field offset is in bytes, but a bit offset is required",
+/* ASL_MSG_BITS_TO_BYTES, */ "Field offset is in bits, but a byte offset is required",
+/* ASL_MSG_AML_NOT_IMPLEMENTED, */ "Opcode is not implemented in compiler AML code generator",
+/* ASL_MSG_NO_WHILE, */ "No enclosing While statement",
+/* ASL_MSG_INVALID_ESCAPE, */ "Invalid or unknown escape sequence",
+/* ASL_MSG_INVALID_STRING, */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
+/* ASL_MSG_TABLE_SIGNATURE, */ "Invalid Table Signature",
+/* ASL_MSG_RESOURCE_LIST, */ "Too many resource items (internal error)",
+/* ASL_MSG_INVALID_TARGET, */ "Target operand not allowed in constant expression",
+/* ASL_MSG_INVALID_CONSTANT_OP, */ "Invalid operator in constant expression (not type 3/4/5)",
+/* ASL_MSG_CONSTANT_EVALUATION, */ "Could not evaluate constant expression",
+/* ASL_MSG_CONSTANT_FOLDED, */ "Constant expression evaluated and reduced",
+/* ASL_MSG_INVALID_EISAID, */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
+/* ASL_MSG_RESERVED_OPERAND_TYPE, */ "Invalid operand type for reserved name, must be",
+/* ASL_MSG_RESERVED_METHOD, */ "Reserved name must be a control method",
+/* ASL_MSG_ALPHANUMERIC_STRING, */ "String must be entirely alphanumeric",
+/* ASL_MSG_RESERVED_USE, */ "Invalid use of reserved name",
+/* ASL_MSG_INVALID_OPERAND, */ "Invalid operand",
+/* ASL_MSG_MISSING_ENDDEPENDENT, */ "Missing EndDependentFn() macro in dependent resource list",
+/* ASL_MSG_MISSING_STARTDEPENDENT, */ "Missing StartDependentFn() macro in dependent resource list",
+/* ASL_MSG_DEPENDENT_NESTING, */ "Dependent function macros cannot be nested",\
+/* ASL_MSG_NAME_OPTIMIZATION, */ "NamePath optimized",
+/* ASL_MSG_SINGLE_NAME_OPTIMIZATION, */ "NamePath optimized to NameSeg (uses run-time search path)",
+/* ASL_MSG_INTEGER_OPTIMIZATION, */ "Integer optimized to single-byte AML opcode",
+/* ASL_MSG_SCOPE_TYPE, */ "Existing object has invalid type for Scope operator",
+/* ASL_MSG_CORE_EXCEPTION, */ "From ACPI CA Subsystem",
+/* ASL_MSG_UNREACHABLE_CODE, */ "Statement is unreachable",
+/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
+/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed"
+};
+
+
+char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
+ "Error ",
+ "Warning ",
+ "Remark ",
+ "Optimize"
+};
+
+#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */
+
+/* Exception counters */
+
+UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0};
+
+#endif
+
+
+#endif /* __ASLTYPES_H */
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c
new file mode 100644
index 0000000..18d0ec8
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslutils.c
@@ -0,0 +1,1015 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslutils -- compiler utilities
+ * $Revision: 56 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslutils")
+
+#ifdef _USE_BERKELEY_YACC
+extern const char * const AslCompilername[];
+static const char * const *yytname = &AslCompilername[254];
+#else
+extern const char * const yytname[];
+#endif
+
+
+void
+AslOptimizeNamepath (
+ char *Buffer)
+{
+ printf ("NamePath: %s\n", Buffer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsDisplayConstantOpcodes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print AML opcodes that can be used in constant expressions.
+ *
+ ******************************************************************************/
+
+void
+UtDisplayConstantOpcodes (
+ void)
+{
+ UINT32 i;
+
+ printf ("Constant expression opcode information\n\n");
+
+ for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++)
+ {
+ if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT)
+ {
+ printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtLocalCalloc
+ *
+ * PARAMETERS: Size - Bytes to be allocated
+ *
+ * RETURN: Pointer to the allocated memory. Guaranteed to be valid.
+ *
+ * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an
+ * allocation failure, on the assumption that nothing more can be
+ * accomplished.
+ *
+ ******************************************************************************/
+
+void *
+UtLocalCalloc (
+ UINT32 Size)
+{
+ void *Allocated;
+
+
+ Allocated = ACPI_MEM_CALLOCATE (Size);
+ if (!Allocated)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ exit (1);
+ }
+
+ TotalAllocations++;
+ TotalAllocated += Size;
+ return Allocated;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtBeginEvent
+ *
+ * PARAMETERS: Event - Event number (integer index)
+ * Name - Ascii name of this event
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Saves the current time with this event
+ *
+ ******************************************************************************/
+
+void
+UtBeginEvent (
+ UINT32 Event,
+ char *Name)
+{
+
+ AslGbl_Events[Event].StartTime = (time_t) AcpiOsGetTimer();
+ AslGbl_Events[Event].EventName = Name;
+ AslGbl_Events[Event].Valid = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtEndEvent
+ *
+ * PARAMETERS: Event - Event number (integer index)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Saves the current time (end time) with this event
+ *
+ ******************************************************************************/
+
+void
+UtEndEvent (
+ UINT32 Event)
+{
+
+ AslGbl_Events[Event].EndTime = (time_t) AcpiOsGetTimer();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtHexCharToValue
+ *
+ * PARAMETERS: hc - Hex character in Ascii
+ *
+ * RETURN: The binary value of the hex character
+ *
+ * DESCRIPTION: Perform ascii-to-hex translation
+ *
+ ******************************************************************************/
+
+UINT8
+UtHexCharToValue (
+ int hc)
+{
+
+ if (hc <= 0x39)
+ {
+ return ((UINT8) (hc - 0x30));
+ }
+
+ if (hc <= 0x46)
+ {
+ return ((UINT8) (hc - 0x37));
+ }
+
+ return ((UINT8) (hc - 0x57));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtConvertByteToHex
+ *
+ * PARAMETERS: RawByte - Binary data
+ * *Buffer - Pointer to where the hex bytes will be stored
+ *
+ * RETURN: Ascii hex byte is stored in Buffer.
+ *
+ * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
+ * with "0x"
+ *
+ ******************************************************************************/
+
+void
+UtConvertByteToHex (
+ UINT8 RawByte,
+ UINT8 *Buffer)
+{
+
+ Buffer[0] = '0';
+ Buffer[1] = 'x';
+
+ Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF];
+ Buffer[3] = (UINT8) hex[RawByte & 0xF];
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtConvertByteToAsmHex
+ *
+ * PARAMETERS: RawByte - Binary data
+ * *Buffer - Pointer to where the hex bytes will be stored
+ *
+ * RETURN: Ascii hex byte is stored in Buffer.
+ *
+ * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
+ * with "0x"
+ *
+ ******************************************************************************/
+
+void
+UtConvertByteToAsmHex (
+ UINT8 RawByte,
+ UINT8 *Buffer)
+{
+
+ Buffer[0] = '0';
+
+ Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF];
+ Buffer[2] = (UINT8) hex[RawByte & 0xF];
+ Buffer[3] = 'h';
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: DbgPrint
+ *
+ * PARAMETERS: Fmt - Printf format string
+ * ... - variable printf list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Conditional print statement. Prints to stderr only if the
+ * debug flag is set.
+ *
+ ******************************************************************************/
+
+void
+DbgPrint (
+ UINT32 Type,
+ char *Fmt,
+ ...)
+{
+ va_list Args;
+
+
+ va_start (Args, Fmt);
+
+ if (!Gbl_DebugFlag)
+ {
+ return;
+ }
+
+ if ((Type == ASL_PARSE_OUTPUT) &&
+ (!(AslCompilerdebug)))
+ {
+ return;
+ }
+
+ (void) vfprintf (stderr, Fmt, Args);
+ va_end (Args);
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtPrintFormattedName
+ *
+ * PARAMETERS: ParseOpcode - Parser keyword ID
+ * Level - Indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the ascii name of the parse opcode.
+ *
+ ******************************************************************************/
+
+#define TEXT_OFFSET 10
+
+void
+UtPrintFormattedName (
+ UINT16 ParseOpcode,
+ UINT32 Level)
+{
+
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s %-16.16s", (3 * Level), " ",
+ UtGetOpName (ParseOpcode));
+
+ if (Level < TEXT_OFFSET)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s", (TEXT_OFFSET - Level) * 3, " ");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtSetParseOpName
+ *
+ * PARAMETERS: Op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert the ascii name of the parse opcode
+ *
+ ******************************************************************************/
+
+void
+UtSetParseOpName (
+ ACPI_PARSE_OBJECT *Op)
+{
+ strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtGetOpName
+ *
+ * PARAMETERS: ParseOpcode - Parser keyword ID
+ *
+ * RETURN: Pointer to the opcode name
+ *
+ * DESCRIPTION: Get the ascii name of the parse opcode
+ *
+ ******************************************************************************/
+
+char *
+UtGetOpName (
+ UINT32 ParseOpcode)
+{
+
+ /*
+ * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
+ * Ignore first 8 characters of the name
+ */
+ return ((char *) yytname [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtDisplaySummary
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display compilation statistics
+ *
+ ******************************************************************************/
+
+void
+UtDisplaySummary (
+ UINT32 FileId)
+{
+
+ if (FileId != ASL_FILE_STDOUT)
+ {
+ /* Compiler name and version number */
+
+ FlPrintFile (FileId, "%s version %X [%s]\n",
+ CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__);
+ }
+
+ /* Input/Output summary */
+
+ FlPrintFile (FileId,
+ "ASL Input: %s - %d lines, %d bytes, %d keywords\n",
+ Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
+ Gbl_InputByteCount, TotalKeywords);
+
+ /* AML summary */
+
+ if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
+ {
+ FlPrintFile (FileId,
+ "AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n",
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
+ TotalNamedObjects, TotalExecutableOpcodes);
+ }
+
+ /* Error summary */
+
+ FlPrintFile (FileId,
+ "Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n",
+ Gbl_ExceptionCount[ASL_ERROR],
+ Gbl_ExceptionCount[ASL_WARNING],
+ Gbl_ExceptionCount[ASL_REMARK],
+ Gbl_ExceptionCount[ASL_OPTIMIZATION]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtDisplaySummary
+ *
+ * PARAMETERS: Op - Integer parse node
+ * LowValue - Smallest allowed value
+ * HighValue - Largest allowed value
+ *
+ * RETURN: Op if OK, otherwise NULL
+ *
+ * DESCRIPTION: Check integer for an allowable range
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+UtCheckIntegerRange (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 LowValue,
+ UINT32 HighValue)
+{
+ char *ParseError = NULL;
+ char Buffer[64];
+
+
+ if (!Op)
+ {
+ return NULL;
+ }
+
+ if (Op->Asl.Value.Integer < LowValue)
+ {
+ ParseError = "Value below valid range";
+ Op->Asl.Value.Integer = LowValue;
+ }
+
+ if (Op->Asl.Value.Integer > HighValue)
+ {
+ ParseError = "Value above valid range";
+ Op->Asl.Value.Integer = HighValue;
+ }
+
+ if (ParseError)
+ {
+ sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
+ AslCompilererror (Buffer);
+
+ return NULL;
+ }
+
+ return Op;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtGetStringBuffer
+ *
+ * PARAMETERS: Length - Size of buffer requested
+ *
+ * RETURN: Pointer to the buffer. Aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate a string buffer. Bypass the local
+ * dynamic memory manager for performance reasons (This has a
+ * major impact on the speed of the compiler.)
+ *
+ ******************************************************************************/
+
+char *
+UtGetStringBuffer (
+ UINT32 Length)
+{
+ char *Buffer;
+
+
+ if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
+ {
+ Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
+ Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + Length;
+ }
+
+ Buffer = Gbl_StringCacheNext;
+ Gbl_StringCacheNext += Length;
+
+ return (Buffer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtInternalizeName
+ *
+ * PARAMETERS: ExternalName - Name to convert
+ * ConvertedName - Where the converted name is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an external (ASL) name to an internal (AML) name
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+UtInternalizeName (
+ char *ExternalName,
+ char **ConvertedName)
+{
+ ACPI_NAMESTRING_INFO Info;
+ ACPI_STATUS Status;
+
+
+ if (!ExternalName)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the length of the new internal name */
+
+ Info.ExternalName = ExternalName;
+ AcpiNsGetInternalNameLength (&Info);
+
+ /* We need a segment to store the internal name */
+
+ Info.InternalName = UtGetStringBuffer (Info.Length);
+ if (!Info.InternalName)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Build the name */
+
+ Status = AcpiNsBuildInternalName (&Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ *ConvertedName = Info.InternalName;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtPadNameWithUnderscores
+ *
+ * PARAMETERS: NameSeg - Input nameseg
+ * PaddedNameSeg - Output padded nameseg
+ *
+ * RETURN: Padded nameseg.
+ *
+ * DESCRIPTION: Pads a NameSeg with underscores if necessary to form a full
+ * ACPI_NAME.
+ *
+ ******************************************************************************/
+
+void
+UtPadNameWithUnderscores (
+ char *NameSeg,
+ char *PaddedNameSeg)
+{
+ UINT32 i;
+
+
+ for (i = 0; (i < ACPI_NAME_SIZE); i++)
+ {
+ if (*NameSeg)
+ {
+ *PaddedNameSeg = *NameSeg;
+ NameSeg++;
+ }
+ else
+ {
+ *PaddedNameSeg = '_';
+ }
+ PaddedNameSeg++;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtAttachNameseg
+ *
+ * PARAMETERS: Op - Parent parse node
+ * Name - Full ExternalName
+ *
+ * RETURN: Sets the NameSeg field in parent node
+ *
+ * DESCRIPTION: Extract the last nameseg of the ExternalName and store it
+ * in the NameSeg field of the Op.
+ *
+ ******************************************************************************/
+
+void
+UtAttachNameseg (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name)
+{
+ char *NameSeg;
+ char PaddedNameSeg[4];
+
+
+ if (!Name)
+ {
+ return;
+ }
+
+ /* Look for the last dot in the namepath */
+
+ NameSeg = strrchr (Name, '.');
+ if (NameSeg)
+ {
+ /* Found last dot, we have also found the final nameseg */
+
+ NameSeg++;
+ UtPadNameWithUnderscores (NameSeg, PaddedNameSeg);
+ }
+ else
+ {
+ /* No dots in the namepath, there is only a single nameseg. */
+ /* Handle prefixes */
+
+ while ((*Name == '\\') || (*Name == '^'))
+ {
+ Name++;
+ }
+
+ /* Remaing string should be one single nameseg */
+
+ UtPadNameWithUnderscores (Name, PaddedNameSeg);
+ }
+
+ strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtAttachNamepathToOwner
+ *
+ * PARAMETERS: Op - Parent parse node
+ * NameOp - Node that contains the name
+ *
+ * RETURN: Sets the ExternalName and Namepath in the parent node
+ *
+ * DESCRIPTION: Store the name in two forms in the parent node: The original
+ * (external) name, and the internalized name that is used within
+ * the ACPI namespace manager.
+ *
+ ******************************************************************************/
+
+void
+UtAttachNamepathToOwner (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *NameOp)
+{
+ ACPI_STATUS Status;
+
+
+ /* Full external path */
+
+ Op->Asl.ExternalName = NameOp->Asl.Value.String;
+
+ /* Last nameseg of the path */
+
+ UtAttachNameseg (Op, Op->Asl.ExternalName);
+
+ /* Create internalized path */
+
+ Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath);
+ if (ACPI_FAILURE (Status))
+ {
+ /* TBD: abort on no memory */
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtDoConstant
+ *
+ * PARAMETERS: String - Hex, Octal, or Decimal string
+ *
+ * RETURN: Converted Integer
+ *
+ * DESCRIPTION: Convert a string to an integer. With error checking.
+ *
+ ******************************************************************************/
+
+ACPI_INTEGER
+UtDoConstant (
+ char *String)
+{
+ ACPI_STATUS Status;
+ ACPI_INTEGER Converted;
+ char ErrBuf[64];
+
+
+ Status = UtStrtoul64 (String, 0, &Converted);
+ if (ACPI_FAILURE (Status))
+ {
+ sprintf (ErrBuf, "%s %s\n", "Conversion error:", AcpiFormatException (Status));
+ AslCompilererror (ErrBuf);
+ }
+
+ return (Converted);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: UtStrtoul64
+ *
+ * PARAMETERS: String - Null terminated string
+ * Terminater - Where a pointer to the terminating byte is returned
+ * Base - Radix of the string
+ *
+ * RETURN: Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value.
+ *
+ ******************************************************************************/
+#define NEGATIVE 1
+#define POSITIVE 0
+
+ACPI_STATUS
+UtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger)
+{
+ UINT32 Index;
+ UINT32 Sign;
+ ACPI_INTEGER ReturnValue = 0;
+ ACPI_STATUS Status = AE_OK;
+
+
+ *RetInteger = 0;
+
+ switch (Base)
+ {
+ case 0:
+ case 8:
+ case 10:
+ case 16:
+ break;
+
+ default:
+ /*
+ * The specified Base parameter is not in the domain of
+ * this function:
+ */
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * skip over any white space in the buffer:
+ */
+ while (isspace (*String) || *String == '\t')
+ {
+ ++String;
+ }
+
+ /*
+ * The buffer may contain an optional plus or minus sign.
+ * If it does, then skip over it but remember what is was:
+ */
+ if (*String == '-')
+ {
+ Sign = NEGATIVE;
+ ++String;
+ }
+ else if (*String == '+')
+ {
+ ++String;
+ Sign = POSITIVE;
+ }
+ else
+ {
+ Sign = POSITIVE;
+ }
+
+ /*
+ * If the input parameter Base is zero, then we need to
+ * determine if it is octal, decimal, or hexadecimal:
+ */
+ if (Base == 0)
+ {
+ if (*String == '0')
+ {
+ if (tolower (*(++String)) == 'x')
+ {
+ Base = 16;
+ ++String;
+ }
+ else
+ {
+ Base = 8;
+ }
+ }
+ else
+ {
+ Base = 10;
+ }
+ }
+
+ /*
+ * For octal and hexadecimal bases, skip over the leading
+ * 0 or 0x, if they are present.
+ */
+ if (Base == 8 && *String == '0')
+ {
+ String++;
+ }
+
+ if (Base == 16 &&
+ *String == '0' &&
+ tolower (*(++String)) == 'x')
+ {
+ String++;
+ }
+
+ /* Main loop: convert the string to an unsigned long */
+
+ while (*String)
+ {
+ if (isdigit (*String))
+ {
+ Index = ((UINT8) *String) - '0';
+ }
+ else
+ {
+ Index = (UINT8) toupper (*String);
+ if (isupper ((char) Index))
+ {
+ Index = Index - 'A' + 10;
+ }
+ else
+ {
+ goto ErrorExit;
+ }
+ }
+
+ if (Index >= Base)
+ {
+ goto ErrorExit;
+ }
+
+ /* Check to see if value is out of range: */
+
+ if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) Index) /
+ (ACPI_INTEGER) Base))
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ ReturnValue *= Base;
+ ReturnValue += Index;
+ }
+
+ ++String;
+ }
+
+
+ /*
+ * If a minus sign was present, then "the conversion is negated":
+ */
+ if (Sign == NEGATIVE)
+ {
+ ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
+ }
+
+ *RetInteger = ReturnValue;
+ return (Status);
+
+
+ErrorExit:
+ switch (Base)
+ {
+ case 8:
+ Status = AE_BAD_OCTAL_CONSTANT;
+ break;
+
+ case 10:
+ Status = AE_BAD_DECIMAL_CONSTANT;
+ break;
+
+ case 16:
+ Status = AE_BAD_HEX_CONSTANT;
+ break;
+
+ default:
+ /* Base validated above */
+ break;
+ }
+
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c
new file mode 100644
index 0000000..7907319
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbcmds.c
@@ -0,0 +1,1305 @@
+/*******************************************************************************
+ *
+ * Module Name: dbcmds - debug commands and output routines
+ * $Revision: 105 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acdebug.h"
+#include "acresrc.h"
+#include "acdisasm.h"
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbcmds")
+
+
+/*
+ * Arguments for the Objects command
+ * These object types map directly to the ACPI_TYPES
+ */
+
+static ARGUMENT_INFO AcpiDbObjectTypes [] =
+{
+ {"ANY"},
+ {"NUMBERS"},
+ {"STRINGS"},
+ {"BUFFERS"},
+ {"PACKAGES"},
+ {"FIELDS"},
+ {"DEVICES"},
+ {"EVENTS"},
+ {"METHODS"},
+ {"MUTEXES"},
+ {"REGIONS"},
+ {"POWERRESOURCES"},
+ {"PROCESSORS"},
+ {"THERMALZONES"},
+ {"BUFFERFIELDS"},
+ {"DDBHANDLES"},
+ {NULL} /* Must be null terminated */
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForReferences
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check if this namespace object refers to the target object
+ * that is passed in as the context value.
+ *
+ * Note: Currently doesn't check subobjects within the Node's object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbWalkForReferences (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+
+
+ /* Check for match against the namespace node itself */
+
+ if (Node == (void *) ObjDesc)
+ {
+ AcpiOsPrintf ("Object is a Node [%4.4s]\n", Node->Name.Ascii);
+ }
+
+ /* Check for match against the object attached to the node */
+
+ if (AcpiNsGetAttachedObject (Node) == ObjDesc)
+ {
+ AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, Node->Name.Ascii);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbFindReferences
+ *
+ * PARAMETERS: ObjectArg - String with hex value of the object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Search namespace for all references to the input object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbFindReferences (
+ char *ObjectArg)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ /* Convert string to object pointer */
+
+ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForReferences, (void *) ObjDesc, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayLocks
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about internal mutexes.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayLocks (void)
+{
+ UINT32 i;
+
+
+ for (i = 0; i < MAX_MUTEX; i++)
+ {
+ AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
+ AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
+ ? "Locked" : "Unlocked");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayTableInfo
+ *
+ * PARAMETERS: TableArg - String with name of table to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about loaded tables. Current
+ * implementation displays all loaded tables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayTableInfo (
+ char *TableArg)
+{
+ UINT32 i;
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ TableDesc = AcpiGbl_TableLists[i].Next;
+ while (TableDesc)
+ {
+ AcpiOsPrintf ( "%s at %p length %.5X",
+ AcpiGbl_TableData[i].Name, TableDesc->Pointer,
+ (UINT32) TableDesc->Length);
+
+ if (i != ACPI_TABLE_FACS)
+ {
+ AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X",
+ TableDesc->Pointer->OemId,
+ TableDesc->Pointer->OemTableId,
+ TableDesc->Pointer->OemRevision);
+ }
+ AcpiOsPrintf ("\n");
+
+ TableDesc = TableDesc->Next;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbUnloadAcpiTable
+ *
+ * PARAMETERS: TableArg - Name of the table to be unloaded
+ * InstanceArg - Which instance of the table to unload (if
+ * there are multiple tables of the same type)
+ *
+ * RETURN: Nonde
+ *
+ * DESCRIPTION: Unload an ACPI table.
+ * Instance is not implemented
+ *
+ ******************************************************************************/
+
+void
+AcpiDbUnloadAcpiTable (
+ char *TableArg,
+ char *InstanceArg)
+{
+ UINT32 i;
+ ACPI_STATUS Status;
+
+
+ /* Search all tables for the target type */
+
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
+ AcpiGbl_TableData[i].SigLength))
+ {
+ /* Found the table, unload it */
+
+ Status = AcpiUnloadTable (i);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);
+ }
+ else
+ {
+ AcpiOsPrintf ("%s, while unloading [%s]\n",
+ AcpiFormatException (Status), TableArg);
+ }
+
+ return;
+ }
+ }
+
+ AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodBreakpoint
+ *
+ * PARAMETERS: Location - AML offset of breakpoint
+ * WalkState - Current walk info
+ * Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ * AML offset
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodBreakpoint (
+ char *Location,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Address;
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ /* Get and verify the breakpoint address */
+
+ Address = ACPI_STRTOUL (Location, NULL, 16);
+ if (Address <= Op->Common.AmlOffset)
+ {
+ AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset);
+ }
+
+ /* Save breakpoint in current walk */
+
+ WalkState->UserBreakpoint = Address;
+ AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodCallBreakpoint
+ *
+ * PARAMETERS: Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ * AML offset
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodCallBreakpoint (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ AcpiGbl_StepToNextCall = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisassembleAml
+ *
+ * PARAMETERS: Statements - Number of statements to disassemble
+ * Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
+ * of statements specified.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisassembleAml (
+ char *Statements,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 NumStatements = 8;
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ if (Statements)
+ {
+ NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
+ }
+
+#ifdef ACPI_DISASSEMBLER
+ AcpiDmDisassemble (NULL, Op, NumStatements);
+#endif
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpNamespace
+ *
+ * PARAMETERS: StartArg - Node to begin namespace dump
+ * DepthArg - Maximum tree depth to be dumped
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
+ * with type and other information.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespace (
+ char *StartArg,
+ char *DepthArg)
+{
+ ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
+ UINT32 MaxDepth = ACPI_UINT32_MAX;
+
+
+ /* No argument given, just start at the root and dump entire namespace */
+
+ if (StartArg)
+ {
+ /* Check if numeric argument, must be a Node */
+
+ if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39))
+ {
+ SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16));
+ if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE)))
+ {
+ AcpiOsPrintf ("Address %p is invalid in this address space\n", SubtreeEntry);
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiOsPrintf ("Address %p is not a valid Named object\n", SubtreeEntry);
+ return;
+ }
+ }
+ else
+ {
+ /* Alpha argument */
+ /* The parameter is a name string that must be resolved to a Named obj*/
+
+ SubtreeEntry = AcpiDbLocalNsLookup (StartArg);
+ if (!SubtreeEntry)
+ {
+ SubtreeEntry = AcpiGbl_RootNode;
+ }
+ }
+
+ /* Now we can check for the depth argument */
+
+ if (DepthArg)
+ {
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ }
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry);
+
+ /* Display the subtree */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, ACPI_UINT32_MAX, SubtreeEntry);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpNamespaceByOwner
+ *
+ * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
+ * DepthArg - Maximum tree depth to be dumped
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespaceByOwner (
+ char *OwnerArg,
+ char *DepthArg)
+{
+ ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
+ UINT32 MaxDepth = ACPI_UINT32_MAX;
+ UINT16 OwnerId;
+
+
+ OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0);
+
+ /* Now we can check for the depth argument */
+
+ if (DepthArg)
+ {
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
+
+ /* Display the subtree */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSendNotify
+ *
+ * PARAMETERS: Name - Name of ACPI object to send the notify to
+ * Value - Value of the notify to send.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
+ * named object as an ACPI notify.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSendNotify (
+ char *Name,
+ UINT32 Value)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Translate name to an Named object */
+
+ Node = AcpiDbLocalNsLookup (Name);
+ if (!Node)
+ {
+ return;
+ }
+
+ /* Decode Named object type */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+
+ /* Send the notify */
+
+ Status = AcpiEvQueueNotifyRequest (Node, Value);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not queue notify\n");
+ }
+ break;
+
+ default:
+ AcpiOsPrintf ("Named object is not a device or a thermal object\n");
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodData
+ *
+ * PARAMETERS: TypeArg - L for local, A for argument
+ * IndexArg - which one
+ * ValueArg - Value to set.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a local or argument for the running control method.
+ * NOTE: only object supported is Number.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodData (
+ char *TypeArg,
+ char *IndexArg,
+ char *ValueArg)
+{
+ char Type;
+ UINT32 Index;
+ UINT32 Value;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ /* Validate TypeArg */
+
+ ACPI_STRUPR (TypeArg);
+ Type = TypeArg[0];
+ if ((Type != 'L') &&
+ (Type != 'A'))
+ {
+ AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
+ return;
+ }
+
+ /* Get the index and value */
+
+ Index = ACPI_STRTOUL (IndexArg, NULL, 16);
+ Value = ACPI_STRTOUL (ValueArg, NULL, 16);
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ /* Create and initialize the new object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("Could not create an internal object\n");
+ return;
+ }
+
+ ObjDesc->Integer.Value = Value;
+
+ /* Store the new object into the target */
+
+ switch (Type)
+ {
+ case 'A':
+
+ /* Set a method argument */
+
+ if (Index > ACPI_METHOD_MAX_ARG)
+ {
+ AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
+ return;
+ }
+
+ Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ ObjDesc = WalkState->Arguments[Index].Object;
+
+ AcpiOsPrintf ("Arg%d: ", Index);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ break;
+
+ case 'L':
+
+ /* Set a method local */
+
+ if (Index > ACPI_METHOD_MAX_LOCAL)
+ {
+ AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
+ return;
+ }
+
+ Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ ObjDesc = WalkState->LocalVariables[Index].Object;
+
+ AcpiOsPrintf ("Local%d: ", Index);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForSpecificObjects
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display short info about objects in the namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbWalkForSpecificObjects (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+
+
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle);
+
+ /* Get and display the full pathname to this object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ return (AE_OK);
+ }
+
+ AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ ACPI_MEM_FREE (Buffer.Pointer);
+
+ /* Display short information about the object */
+
+ if (ObjDesc)
+ {
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_METHOD:
+ AcpiOsPrintf (" #Args %d Concurrency %X",
+ ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency);
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ AcpiOsPrintf (" Value %8.8X%8.8X",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+ case ACPI_TYPE_STRING:
+ AcpiOsPrintf (" \"%s\"", ObjDesc->String.Pointer);
+ break;
+
+ case ACPI_TYPE_REGION:
+ AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X",
+ ObjDesc->Region.SpaceId,
+ ObjDesc->Region.Length,
+ ACPI_HIDWORD (ObjDesc->Region.Address),
+ ACPI_LODWORD (ObjDesc->Region.Address));
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ AcpiOsPrintf (" #Elements %X", ObjDesc->Package.Count);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length);
+ break;
+
+ default:
+ /* Ignore other object types */
+ break;
+ }
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayObjects
+ *
+ * PARAMETERS: ObjTypeArg - Type of object to display
+ * DisplayCountArg - Max depth to display
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display objects in the namespace of the requested type
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbDisplayObjects (
+ char *ObjTypeArg,
+ char *DisplayCountArg)
+{
+ ACPI_OBJECT_TYPE Type;
+
+
+ /* Get the object type */
+
+ Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
+ if (Type == ACPI_TYPE_NOT_FOUND)
+ {
+ AcpiOsPrintf ("Invalid or unsupported argument\n");
+ return (AE_OK);
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n",
+ AcpiUtGetTypeName (Type));
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+
+ /* Walk the namespace from the root */
+
+ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForSpecificObjects, (void *) &Type, NULL);
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkAndMatchName
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
+ * are supported -- '?' matches any character.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbWalkAndMatchName (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+ char *RequestedName = (char *) Context;
+ UINT32 i;
+ ACPI_BUFFER Buffer;
+
+
+ /* Check for a name match */
+
+ for (i = 0; i < 4; i++)
+ {
+ /* Wildcard support */
+
+ if ((RequestedName[i] != '?') &&
+ (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
+ {
+ /* No match, just exit */
+
+ return (AE_OK);
+ }
+ }
+
+ /* Get the full pathname to this object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ }
+ else
+ {
+ AcpiOsPrintf ("%32s (%p) - %s\n", (char *) Buffer.Pointer, ObjHandle,
+ AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type));
+ ACPI_MEM_FREE (Buffer.Pointer);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbFindNameInNamespace
+ *
+ * PARAMETERS: NameArg - The 4-character ACPI name to find.
+ * wildcards are supported.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Search the namespace for a given name (with wildcards)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbFindNameInNamespace (
+ char *NameArg)
+{
+
+ if (ACPI_STRLEN (NameArg) > 4)
+ {
+ AcpiOsPrintf ("Name must be no longer than 4 characters\n");
+ return (AE_OK);
+ }
+
+ /* Walk the namespace from the root */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkAndMatchName, NameArg, NULL);
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetScope
+ *
+ * PARAMETERS: Name - New scope path
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Set the "current scope" as maintained by this utility.
+ * The scope is used as a prefix to ACPI paths.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetScope (
+ char *Name)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ if (!Name || Name[0] == 0)
+ {
+ AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
+ return;
+ }
+
+ AcpiDbPrepNamestring (Name);
+
+ if (Name[0] == '\\')
+ {
+ /* Validate new scope from the root */
+
+ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ }
+ else
+ {
+ /* Validate new scope relative to old scope */
+
+ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ }
+
+ AcpiGbl_DbScopeNode = Node;
+ AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
+ return;
+
+ErrorExit:
+
+ AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayResources
+ *
+ * PARAMETERS: ObjectArg - String with hex value of the object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the resource objects associated with a device.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayResources (
+ char *ObjectArg)
+{
+#if ACPI_MACHINE_WIDTH != 16
+
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_BUFFER ReturnObj;
+
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiDbgLevel |= ACPI_LV_RESOURCES;
+
+ /* Convert string to object pointer */
+
+ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+
+ /* Prepare for a return object of arbitrary size */
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ /* _PRT */
+
+ AcpiOsPrintf ("Evaluating _PRT\n");
+
+ Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiFormatException (Status));
+ goto GetCrs;
+ }
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status));
+ }
+ else
+ {
+ AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
+ }
+
+
+ /* _CRS */
+
+GetCrs:
+ AcpiOsPrintf ("Evaluating _CRS\n");
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiFormatException (Status));
+ goto GetPrs;
+ }
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ goto GetPrs;
+ }
+ else
+ {
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
+ }
+
+ Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ goto GetPrs;
+ }
+
+
+ /* _PRS */
+
+GetPrs:
+ AcpiOsPrintf ("Evaluating _PRS\n");
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status));
+ }
+ else
+ {
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
+ }
+
+Cleanup:
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return;
+#endif
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbIntegrityWalk
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine one NS node for valid values.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbIntegrityWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ Info->Nodes++;
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiOsPrintf ("Invalid Descriptor Type for Node %p, Type = %X\n",
+ Node, ACPI_GET_DESCRIPTOR_TYPE (Node));
+ }
+
+ if (Node->Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
+ Node, Node->Type);
+ }
+
+ if (!AcpiUtValidAcpiName (Node->Name.Integer))
+ {
+ AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
+ }
+
+ Object = AcpiNsGetAttachedObject (Node);
+ if (Object)
+ {
+ Info->Objects++;
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf ("Invalid Descriptor Type for Object %p, Type = %X\n",
+ Object, ACPI_GET_DESCRIPTOR_TYPE (Object));
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCheckIntegrity
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check entire namespace for data structure integrity
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCheckIntegrity (void)
+{
+ ACPI_INTEGRITY_INFO Info = {0,0};
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbIntegrityWalk, (void *) &Info, NULL);
+
+ AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGenerateGpe
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generate a GPE
+ *
+ ******************************************************************************/
+
+void
+AcpiDbGenerateGpe (
+ char *GpeArg,
+ char *BlockArg)
+{
+ UINT32 BlockNumber;
+ UINT32 GpeNumber;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
+ BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
+
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo ((void *)(uintptr_t) BlockNumber, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ AcpiOsPrintf ("Invalid GPE\n");
+ return;
+ }
+
+ AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
+}
+
+#endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c
new file mode 100644
index 0000000..11f6930
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbdisply.c
@@ -0,0 +1,809 @@
+/*******************************************************************************
+ *
+ * Module Name: dbdisply - debug display commands
+ * $Revision: 95 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acdebug.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbdisply")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetPointer
+ *
+ * PARAMETERS: Target - Pointer to string to be converted
+ *
+ * RETURN: Converted pointer
+ *
+ * DESCRIPTION: Convert an ascii pointer value to a real value
+ *
+ *****************************************************************************/
+
+void *
+AcpiDbGetPointer (
+ void *Target)
+{
+ void *ObjPtr;
+
+
+#if ACPI_MACHINE_WIDTH == 16
+#include <stdio.h>
+
+ /* Have to handle 16-bit pointers of the form segment:offset */
+
+ if (!sscanf (Target, "%p", &ObjPtr))
+ {
+ AcpiOsPrintf ("Invalid pointer: %s\n", Target);
+ return (NULL);
+ }
+
+#else
+
+ /* Simple flat pointer */
+
+ ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
+#endif
+
+ return (ObjPtr);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpParserDescriptor
+ *
+ * PARAMETERS: Op - A parser Op descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display a formatted parser object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpParserDescriptor (
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *Info;
+
+
+ Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ AcpiOsPrintf ("Parser Op Descriptor:\n");
+ AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
+
+ ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
+
+ AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
+ AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
+ AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDecodeAndDisplayObject
+ *
+ * PARAMETERS: Target - String with object to be displayed. Names
+ * and hex pointers are supported.
+ * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display a formatted ACPI object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDecodeAndDisplayObject (
+ char *Target,
+ char *OutputType)
+{
+ void *ObjPtr;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 Display = DB_BYTE_DISPLAY;
+ char Buffer[80];
+ ACPI_BUFFER RetBuf;
+ ACPI_STATUS Status;
+ UINT32 Size;
+
+
+ if (!Target)
+ {
+ return;
+ }
+
+ /* Decode the output type */
+
+ if (OutputType)
+ {
+ ACPI_STRUPR (OutputType);
+ if (OutputType[0] == 'W')
+ {
+ Display = DB_WORD_DISPLAY;
+ }
+ else if (OutputType[0] == 'D')
+ {
+ Display = DB_DWORD_DISPLAY;
+ }
+ else if (OutputType[0] == 'Q')
+ {
+ Display = DB_QWORD_DISPLAY;
+ }
+ }
+
+ RetBuf.Length = sizeof (Buffer);
+ RetBuf.Pointer = Buffer;
+
+ /* Differentiate between a number and a name */
+
+ if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
+ {
+ ObjPtr = AcpiDbGetPointer (Target);
+ if (!AcpiOsReadable (ObjPtr, 16))
+ {
+ AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
+ return;
+ }
+
+ /* Decode the object type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+
+ /* This is a namespace Node */
+
+ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
+ {
+ AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
+ return;
+ }
+
+ Node = ObjPtr;
+ goto DumpNte;
+
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ /* This is a ACPI OPERAND OBJECT */
+
+ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
+ {
+ AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
+ return;
+ }
+
+ AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiExDumpObjectDescriptor (ObjPtr, 1);
+ break;
+
+
+ case ACPI_DESC_TYPE_PARSER:
+
+ /* This is a Parser Op object */
+
+ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
+ {
+ AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
+ return;
+ }
+
+ AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
+ break;
+
+
+ default:
+
+ /* Is not a recognizeable object */
+
+ Size = 16;
+ if (AcpiOsReadable (ObjPtr, 64))
+ {
+ Size = 64;
+ }
+
+ /* Just dump some memory */
+
+ AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
+ break;
+ }
+
+ return;
+ }
+
+ /* The parameter is a name string that must be resolved to a Named obj */
+
+ Node = AcpiDbLocalNsLookup (Target);
+ if (!Node)
+ {
+ return;
+ }
+
+
+DumpNte:
+ /* Now dump the Named obj */
+
+ Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not convert name to pathname\n");
+ }
+
+ else
+ {
+ AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer);
+ }
+
+ if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
+ {
+ AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
+ return;
+ }
+
+ AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
+ AcpiExDumpNode (Node, 1);
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
+ if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
+ {
+ AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc);
+ return;
+ }
+
+ AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiExDumpObjectDescriptor (ObjDesc, 1);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayMethodInfo
+ *
+ * PARAMETERS: StartOp - Root of the control method parse tree
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about the current method
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayMethodInfo (
+ ACPI_PARSE_OBJECT *StartOp)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *RootOp;
+ ACPI_PARSE_OBJECT *Op;
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 NumOps = 0;
+ UINT32 NumOperands = 0;
+ UINT32 NumOperators = 0;
+ UINT32 NumRemainingOps = 0;
+ UINT32 NumRemainingOperands = 0;
+ UINT32 NumRemainingOperators = 0;
+ UINT32 NumArgs;
+ UINT32 Concurrency;
+ BOOLEAN CountRemaining = FALSE;
+
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+
+ NumArgs = ObjDesc->Method.ParamCount;
+ Concurrency = ObjDesc->Method.Concurrency;
+
+ AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii);
+ AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency);
+
+
+ RootOp = StartOp;
+ while (RootOp->Common.Parent)
+ {
+ RootOp = RootOp->Common.Parent;
+ }
+
+ Op = RootOp;
+
+ while (Op)
+ {
+ if (Op == StartOp)
+ {
+ CountRemaining = TRUE;
+ }
+
+ NumOps++;
+ if (CountRemaining)
+ {
+ NumRemainingOps++;
+ }
+
+ /* Decode the opcode */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ switch (OpInfo->Class)
+ {
+ case AML_CLASS_ARGUMENT:
+ if (CountRemaining)
+ {
+ NumRemainingOperands++;
+ }
+
+ NumOperands++;
+ break;
+
+ case AML_CLASS_UNKNOWN:
+ /* Bad opcode or ASCII character */
+
+ continue;
+
+ default:
+ if (CountRemaining)
+ {
+ NumRemainingOperators++;
+ }
+
+ NumOperators++;
+ break;
+ }
+
+ Op = AcpiPsGetDepthNext (StartOp, Op);
+ }
+
+ AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
+ NumOps, NumOperators, NumOperands);
+
+ AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
+ NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayLocals
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all locals for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayLocals (void)
+{
+ ACPI_WALK_STATE *WalkState;
+
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ AcpiDmDisplayLocals (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayArguments
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all arguments for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayArguments (void)
+{
+ ACPI_WALK_STATE *WalkState;
+
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ AcpiDmDisplayArguments (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayResults
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display current contents of a method result stack
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayResults (void)
+{
+ UINT32 i;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 NumResults = 0;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+
+ if (WalkState->Results)
+ {
+ NumResults = WalkState->Results->Results.NumResults;
+ }
+
+ AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
+ Node->Name.Ascii, NumResults);
+
+ for (i = 0; i < NumResults; i++)
+ {
+ ObjDesc = WalkState->Results->Results.ObjDesc[i];
+ AcpiOsPrintf ("Result%d: ", i);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayCallingTree
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display current calling tree of nested control methods
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayCallingTree (void)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ Node = WalkState->MethodNode;
+ AcpiOsPrintf ("Current Control Method Call Tree\n");
+
+ while (WalkState)
+ {
+ Node = WalkState->MethodNode;
+
+ AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii);
+
+ WalkState = WalkState->Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayObjectType
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display current calling tree of nested control methods
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayObjectType (
+ char *ObjectArg)
+{
+ ACPI_HANDLE Handle;
+ ACPI_BUFFER Buffer;
+ ACPI_DEVICE_INFO *Info;
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT i;
+
+
+ Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiGetObjectInfo (Handle, &Buffer);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info = Buffer.Pointer;
+ AcpiOsPrintf ("HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
+ &Info->HardwareId,
+ ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address),
+ Info->CurrentStatus);
+
+ if (Info->Valid & ACPI_VALID_CID)
+ {
+ for (i = 0; i < Info->CompatibilityId.Count; i++)
+ {
+ AcpiOsPrintf ("CID #%d: %s\n", i, &Info->CompatibilityId.Id[i]);
+ }
+ }
+
+ ACPI_MEM_FREE (Info);
+ }
+ else
+ {
+ AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
+ }
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayResultObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ * WalkState - Current walk state
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the result of an AML opcode
+ *
+ * Note: Curently only displays the result object if we are single stepping.
+ * However, this output may be useful in other contexts and could be enabled
+ * to do so if needed.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayResultObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+
+ /* Only display if single stepping */
+
+ if (!AcpiGbl_CmSingleStep)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("ResultObj: ");
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayArgumentObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ * WalkState - Current walk state
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the result of an AML opcode
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayArgumentObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+
+ if (!AcpiGbl_CmSingleStep)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("ArgObj: ");
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayGpes
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the GPE structures
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayGpes (void)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ UINT32 i = 0;
+
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ AcpiOsPrintf ("Block %d - %p\n", i, GpeBlock);
+ AcpiOsPrintf (" Registers: %d\n", GpeBlock->RegisterCount);
+ AcpiOsPrintf (" GPE range: %d to %d\n", GpeBlock->BlockBaseNumber,
+ GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8) -1);
+ AcpiOsPrintf (" RegisterInfo: %p\n", GpeBlock->RegisterInfo);
+ AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
+ i++;
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
+ }
+}
+
+
+#endif /* ACPI_DEBUGGER */
+
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c
new file mode 100644
index 0000000..309fe78
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbexec.c
@@ -0,0 +1,601 @@
+/*******************************************************************************
+ *
+ * Module Name: dbexec - debugger control method execution
+ * $Revision: 54 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdebug.h"
+#include "acnamesp.h"
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbexec")
+
+
+static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbExecuteMethod
+ *
+ * PARAMETERS: Info - Valid info segment
+ * ReturnObj - Where to put return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a control method.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbExecuteMethod (
+ ACPI_DB_METHOD_INFO *Info,
+ ACPI_BUFFER *ReturnObj)
+{
+ ACPI_STATUS Status;
+ ACPI_OBJECT_LIST ParamObjects;
+ ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
+ UINT32 i;
+
+
+ if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel)
+ {
+ AcpiOsPrintf ("Warning: debug output is not enabled!\n");
+ }
+
+ /* Are there arguments to the method? */
+
+ if (Info->Args && Info->Args[0])
+ {
+ for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++)
+ {
+ Params[i].Type = ACPI_TYPE_INTEGER;
+ Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
+ }
+
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = i;
+ }
+ else
+ {
+ /* Setup default parameters */
+
+ Params[0].Type = ACPI_TYPE_INTEGER;
+ Params[0].Integer.Value = 0x01020304;
+
+ Params[1].Type = ACPI_TYPE_STRING;
+ Params[1].String.Length = 12;
+ Params[1].String.Pointer = "AML Debugger";
+
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = 2;
+ }
+
+ /* Prepare for a return object of arbitrary size */
+
+ ReturnObj->Pointer = AcpiGbl_DbBuffer;
+ ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ /* Do the actual method execution */
+
+ AcpiGbl_MethodExecuting = TRUE;
+ Status = AcpiEvaluateObject (NULL, Info->Pathname, &ParamObjects, ReturnObj);
+
+ AcpiGbl_CmSingleStep = FALSE;
+ AcpiGbl_MethodExecuting = FALSE;
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbExecuteSetup
+ *
+ * PARAMETERS: Info - Valid method info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Setup info segment prior to method execution
+ *
+ ******************************************************************************/
+
+void
+AcpiDbExecuteSetup (
+ ACPI_DB_METHOD_INFO *Info)
+{
+
+ /* Catenate the current scope to the supplied name */
+
+ Info->Pathname[0] = 0;
+ if ((Info->Name[0] != '\\') &&
+ (Info->Name[0] != '/'))
+ {
+ ACPI_STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf);
+ }
+
+ ACPI_STRCAT (Info->Pathname, Info->Name);
+ AcpiDbPrepNamestring (Info->Pathname);
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("Executing %s\n", Info->Pathname);
+
+ if (Info->Flags & EX_SINGLE_STEP)
+ {
+ AcpiGbl_CmSingleStep = TRUE;
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ }
+
+ else
+ {
+ /* No single step, allow redirection to a file */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetOutstandingAllocations
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Current global allocation count minus cache entries
+ *
+ * DESCRIPTION: Determine the current number of "outstanding" allocations --
+ * those allocations that have not been freed and also are not
+ * in one of the various object caches.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDbGetOutstandingAllocations (
+ void)
+{
+ UINT32 Outstanding = 0;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 i;
+
+
+ for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++)
+ {
+ Outstanding += (AcpiGbl_MemoryLists[i].TotalAllocated -
+ AcpiGbl_MemoryLists[i].TotalFreed -
+ AcpiGbl_MemoryLists[i].CacheDepth);
+ }
+#endif
+
+ return (Outstanding);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbExecutionWalk
+ *
+ * PARAMETERS: WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a control method. Name is relative to the current
+ * scope.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbExecutionWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_BUFFER ReturnObj;
+ ACPI_STATUS Status;
+
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc->Method.ParamCount)
+ {
+ return (AE_OK);
+ }
+
+ ReturnObj.Pointer = NULL;
+ ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+ AcpiNsPrintNodePathname (Node, "Execute");
+
+ /* Do the actual method execution */
+
+ AcpiOsPrintf ("\n");
+ AcpiGbl_MethodExecuting = TRUE;
+
+ Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj);
+
+ AcpiOsPrintf ("[%4.4s] returned %s\n", Node->Name.Ascii,
+ AcpiFormatException (Status));
+ AcpiGbl_MethodExecuting = FALSE;
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbExecute
+ *
+ * PARAMETERS: Name - Name of method to execute
+ * Args - Parameters to the method
+ * Flags - single step/no single step
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a control method. Name is relative to the current
+ * scope.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbExecute (
+ char *Name,
+ char **Args,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER ReturnObj;
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+ UINT32 PreviousAllocations;
+ UINT32 Allocations;
+
+
+ /* Memory allocation tracking */
+
+ PreviousAllocations = AcpiDbGetOutstandingAllocations ();
+#endif
+
+ if (*Name == '*')
+ {
+ (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbExecutionWalk, NULL, NULL);
+ return;
+ }
+ else
+ {
+ AcpiGbl_DbMethodInfo.Name = Name;
+ AcpiGbl_DbMethodInfo.Args = Args;
+ AcpiGbl_DbMethodInfo.Flags = Flags;
+
+ ReturnObj.Pointer = NULL;
+ ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+ AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
+ }
+
+ /*
+ * Allow any handlers in separate threads to complete.
+ * (Such as Notify handlers invoked from AML executed above).
+ */
+ AcpiOsSleep (0, 10);
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+ /* Memory allocation tracking */
+
+ Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations;
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+
+ if (Allocations > 0)
+ {
+ AcpiOsPrintf ("Outstanding: %ld allocations after execution\n",
+ Allocations);
+ }
+#endif
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Execution of %s failed with status %s\n",
+ AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status));
+ }
+
+ else
+ {
+ /* Display a return object, if any */
+
+ if (ReturnObj.Length)
+ {
+ AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
+ AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer,
+ (UINT32) ReturnObj.Length);
+ AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ }
+ else
+ {
+ AcpiOsPrintf ("No return object from execution of %s\n",
+ AcpiGbl_DbMethodInfo.Pathname);
+ }
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbMethodThread
+ *
+ * PARAMETERS: Context - Execution info segment
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Debugger execute thread. Waits for a command line, then
+ * simply dispatches it.
+ *
+ ******************************************************************************/
+
+void ACPI_SYSTEM_XFACE
+AcpiDbMethodThread (
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_DB_METHOD_INFO *Info = Context;
+ UINT32 i;
+ ACPI_BUFFER ReturnObj;
+
+
+ for (i = 0; i < Info->NumLoops; i++)
+ {
+#if 0
+ if (i == 0xEFDC)
+ {
+ AcpiDbgLevel = 0x00FFFFFF;
+ }
+#endif
+
+ Status = AcpiDbExecuteMethod (Info, &ReturnObj);
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("%s During execution of %s at iteration %X\n",
+ AcpiFormatException (Status), Info->Pathname, i);
+ break;
+ }
+
+ if ((i % 1000) == 0)
+ {
+ AcpiOsPrintf ("%d executions\n", i);
+ }
+
+#if 0
+ if (ReturnObj.Length)
+ {
+ AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
+ Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
+ AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ }
+#endif
+ }
+
+ /* Signal our completion */
+
+ Status = AcpiOsSignalSemaphore (Info->ThreadGate, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not signal debugger semaphore\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCreateExecutionThreads
+ *
+ * PARAMETERS: NumThreadsArg - Number of threads to create
+ * NumLoopsArg - Loop count for the thread(s)
+ * MethodNameArg - Control method to execute
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create threads to execute method(s)
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCreateExecutionThreads (
+ char *NumThreadsArg,
+ char *NumLoopsArg,
+ char *MethodNameArg)
+{
+ ACPI_STATUS Status;
+ UINT32 NumThreads;
+ UINT32 NumLoops;
+ UINT32 i;
+ ACPI_HANDLE ThreadGate;
+
+
+ /* Get the arguments */
+
+ NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0);
+ NumLoops = ACPI_STRTOUL (NumLoopsArg, NULL, 0);
+
+ if (!NumThreads || !NumLoops)
+ {
+ AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", NumThreads, NumLoops);
+ return;
+ }
+
+ /* Create the synchronization semaphore */
+
+ Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiFormatException (Status));
+ return;
+ }
+
+ /* Setup the context to be passed to each thread */
+
+ AcpiGbl_DbMethodInfo.Name = MethodNameArg;
+ AcpiGbl_DbMethodInfo.Args = NULL;
+ AcpiGbl_DbMethodInfo.Flags = 0;
+ AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
+ AcpiGbl_DbMethodInfo.ThreadGate = ThreadGate;
+
+ AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+
+ /* Create the threads */
+
+ AcpiOsPrintf ("Creating %X threads to execute %X times each\n", NumThreads, NumLoops);
+
+ for (i = 0; i < (NumThreads); i++)
+ {
+ Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+
+ /* Wait for all threads to complete */
+
+ i = NumThreads;
+ while (i) /* Brain damage for OSD implementations that only support wait of 1 unit */
+ {
+ Status = AcpiOsWaitSemaphore (ThreadGate, 1, ACPI_WAIT_FOREVER);
+ i--;
+ }
+
+ /* Cleanup and exit */
+
+ (void) AcpiOsDeleteSemaphore (ThreadGate);
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+#endif /* ACPI_DEBUGGER */
+
+
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
new file mode 100644
index 0000000..a0dd713
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -0,0 +1,564 @@
+/*******************************************************************************
+ *
+ * Module Name: dbfileio - Debugger file I/O commands. These can't usually
+ * be used when running the debugger in Ring 0 (Kernel mode)
+ * $Revision: 74 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdebug.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbfileio")
+
+
+/*
+ * NOTE: this is here for lack of a better place. It is used in all
+ * flavors of the debugger, need LCD file
+ */
+#ifdef ACPI_APPLICATION
+#include <stdio.h>
+FILE *AcpiGbl_DebugFile = NULL;
+#endif
+
+
+#ifdef ACPI_DEBUGGER
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCloseDebugFile
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: If open, close the current debug output file
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCloseDebugFile (
+ void)
+{
+
+#ifdef ACPI_APPLICATION
+
+ if (AcpiGbl_DebugFile)
+ {
+ fclose (AcpiGbl_DebugFile);
+ AcpiGbl_DebugFile = NULL;
+ AcpiGbl_DbOutputToFile = FALSE;
+ AcpiOsPrintf ("Debug output file %s closed\n", AcpiGbl_DbDebugFilename);
+ }
+#endif
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbOpenDebugFile
+ *
+ * PARAMETERS: Name - Filename to open
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Open a file where debug output will be directed.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbOpenDebugFile (
+ char *Name)
+{
+
+#ifdef ACPI_APPLICATION
+
+ AcpiDbCloseDebugFile ();
+ AcpiGbl_DebugFile = fopen (Name, "w+");
+ if (AcpiGbl_DebugFile)
+ {
+ AcpiOsPrintf ("Debug output file %s opened\n", Name);
+ ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
+ AcpiGbl_DbOutputToFile = TRUE;
+ }
+ else
+ {
+ AcpiOsPrintf ("Could not open debug file %s\n", Name);
+ }
+
+#endif
+}
+#endif
+
+
+#ifdef ACPI_APPLICATION
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCheckTextModeCorruption
+ *
+ * PARAMETERS: Table - Table buffer
+ * TableLength - Length of table from the table header
+ * FileLength - Length of the file that contains the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check table for text mode file corruption where all linefeed
+ * characters (LF) have been replaced by carriage return linefeed
+ * pairs (CR/LF).
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbCheckTextModeCorruption (
+ UINT8 *Table,
+ UINT32 TableLength,
+ UINT32 FileLength)
+{
+ UINT32 i;
+ UINT32 Pairs = 0;
+
+
+ if (TableLength != FileLength)
+ {
+ ACPI_REPORT_WARNING (("File length (0x%X) is not the same as the table length (0x%X)\n",
+ FileLength, TableLength));
+ }
+
+ /* Scan entire table to determine if each LF has been prefixed with a CR */
+
+ for (i = 1; i < FileLength; i++)
+ {
+ if (Table[i] == 0x0A)
+ {
+ if (Table[i - 1] != 0x0D)
+ {
+ /* the LF does not have a preceeding CR, table is not corrupted */
+
+ return (AE_OK);
+ }
+ else
+ {
+ /* Found a CR/LF pair */
+
+ Pairs++;
+ }
+ i++;
+ }
+ }
+
+ /*
+ * Entire table scanned, each CR is part of a CR/LF pair --
+ * meaning that the table was treated as a text file somewhere.
+ *
+ * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
+ * original table are left untouched by the text conversion process --
+ * meaning that we cannot simply replace CR/LF pairs with LFs.
+ */
+ AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
+ AcpiOsPrintf ("All LFs (%d) were changed to CR/LF pairs\n", Pairs);
+ AcpiOsPrintf ("Table cannot be repaired!\n");
+ return (AE_BAD_VALUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbReadTable
+ *
+ * PARAMETERS: fp - File that contains table
+ * Table - Return value, buffer with table
+ * TableLength - Return value, length of table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the DSDT from the file pointer
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbReadTable (
+ FILE *fp,
+ ACPI_TABLE_HEADER **Table,
+ UINT32 *TableLength)
+{
+ ACPI_TABLE_HEADER TableHeader;
+ UINT32 Actual;
+ ACPI_STATUS Status;
+ UINT32 FileSize;
+
+
+ fseek (fp, 0, SEEK_END);
+ FileSize = ftell (fp);
+ fseek (fp, 0, SEEK_SET);
+
+ /* Read the table header */
+
+ if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != sizeof (ACPI_TABLE_HEADER))
+ {
+ AcpiOsPrintf ("Couldn't read the table header\n");
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Validate the table header/length */
+
+ Status = AcpiTbValidateTableHeader (&TableHeader);
+ if ((ACPI_FAILURE (Status)) ||
+ (TableHeader.Length > 0x800000)) /* 8 Mbyte should be enough */
+ {
+ AcpiOsPrintf ("Table header is invalid!\n");
+ return (AE_ERROR);
+ }
+
+ /* We only support a limited number of table types */
+
+ if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
+ {
+ AcpiOsPrintf ("Table signature is invalid\n");
+ ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_ERROR);
+ }
+
+ /* Allocate a buffer for the table */
+
+ *TableLength = TableHeader.Length;
+ *Table = AcpiOsAllocate ((size_t) (FileSize));
+ if (!*Table)
+ {
+ AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
+ TableHeader.Signature, TableHeader.Length);
+ return (AE_NO_MEMORY);
+ }
+
+ /* Get the rest of the table */
+
+ fseek (fp, 0, SEEK_SET);
+ Actual = fread (*Table, 1, (size_t) FileSize, fp);
+ if (Actual == FileSize)
+ {
+ /* Now validate the checksum */
+
+ Status = AcpiTbVerifyTableChecksum (*Table);
+
+ if (Status == AE_BAD_CHECKSUM)
+ {
+ Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
+ FileSize, (*Table)->Length);
+ return (Status);
+ }
+ return (AE_OK);
+ }
+
+ if (Actual > 0)
+ {
+ AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n",
+ FileSize, Actual);
+ return (AE_OK);
+ }
+
+ AcpiOsPrintf ("Error - could not read the table file\n");
+ AcpiOsFree (*Table);
+ *Table = NULL;
+ *TableLength = 0;
+
+ return (AE_ERROR);
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AeLocalLoadTable
+ *
+ * PARAMETERS: Table - pointer to a buffer containing the entire
+ * table to be loaded
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to load a table from the caller's
+ * buffer. The buffer must contain an entire ACPI Table including
+ * a valid header. The header fields will be verified, and if it
+ * is determined that the table is invalid, the call will fail.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AeLocalLoadTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC TableInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
+
+
+ if (!Table)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ TableInfo.Pointer = Table;
+ Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the new table into the local data structures */
+
+ Status = AcpiTbInstallTable (&TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Free table allocated by AcpiTbGetTable */
+
+ AcpiTbDeleteSingleTable (&TableInfo);
+ return_ACPI_STATUS (Status);
+ }
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Uninstall table and free the buffer */
+
+ AcpiTbDeleteTablesByType (ACPI_TABLE_DSDT);
+ return_ACPI_STATUS (Status);
+ }
+#endif
+
+ return_ACPI_STATUS (Status);
+}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbReadTableFromFile
+ *
+ * PARAMETERS: Filename - File where table is located
+ * Table - Where a pointer to the table is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an ACPI table from a file
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbReadTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table)
+{
+ FILE *fp;
+ UINT32 TableLength;
+ ACPI_STATUS Status;
+
+
+ /* Open the file */
+
+ fp = fopen (Filename, "rb");
+ if (!fp)
+ {
+ AcpiOsPrintf ("Could not open input file %s\n", Filename);
+ return (AE_ERROR);
+ }
+
+ /* Get the entire file */
+
+ fprintf (stderr, "Loading Acpi table from file %s\n", Filename);
+ Status = AcpiDbReadTable (fp, Table, &TableLength);
+ fclose(fp);
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Couldn't get table from the file\n");
+ return (Status);
+ }
+
+ return (AE_OK);
+ }
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetTableFromFile
+ *
+ * PARAMETERS: Filename - File where table is located
+ * Table - Where a pointer to the table is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table from a file
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbGetTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **ReturnTable)
+{
+#ifdef ACPI_APPLICATION
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *Table;
+
+
+ Status = AcpiDbReadTableFromFile (Filename, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Attempt to recognize and install the table */
+
+ Status = AeLocalLoadTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ AcpiOsPrintf ("Table %4.4s is already installed\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("Could not install table, %s\n",
+ AcpiFormatException (Status));
+ }
+
+ return (Status);
+ }
+
+ fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
+ Table->Signature);
+
+ AcpiGbl_AcpiHardwarePresent = FALSE;
+ if (ReturnTable)
+ {
+ *ReturnTable = Table;
+ }
+
+
+#endif /* ACPI_APPLICATION */
+ return (AE_OK);
+}
+
+#endif /* ACPI_DEBUGGER */
+
diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/dbhistry.c
new file mode 100644
index 0000000..bbdaa25
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbhistry.c
@@ -0,0 +1,291 @@
+/******************************************************************************
+ *
+ * Module Name: dbhistry - debugger HISTORY command
+ * $Revision: 28 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdebug.h"
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbhistry")
+
+
+#define HI_NO_HISTORY 0
+#define HI_RECORD_HISTORY 1
+#define HISTORY_SIZE 20
+
+
+typedef struct HistoryInfo
+{
+ char Command[80];
+ UINT32 CmdNum;
+
+} HISTORY_INFO;
+
+
+static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE];
+static UINT16 AcpiGbl_LoHistory = 0;
+static UINT16 AcpiGbl_NumHistory = 0;
+static UINT16 AcpiGbl_NextHistoryIndex = 0;
+static UINT32 AcpiGbl_NextCmdNum = 1;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbAddToHistory
+ *
+ * PARAMETERS: CommandLine - Command to add
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add a command line to the history buffer.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbAddToHistory (
+ char *CommandLine)
+{
+
+ /* Put command into the next available slot */
+
+ ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine);
+
+ AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum;
+
+ /* Adjust indexes */
+
+ if ((AcpiGbl_NumHistory == HISTORY_SIZE) &&
+ (AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory))
+ {
+ AcpiGbl_LoHistory++;
+ if (AcpiGbl_LoHistory >= HISTORY_SIZE)
+ {
+ AcpiGbl_LoHistory = 0;
+ }
+ }
+
+ AcpiGbl_NextHistoryIndex++;
+ if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE)
+ {
+ AcpiGbl_NextHistoryIndex = 0;
+ }
+
+ AcpiGbl_NextCmdNum++;
+ if (AcpiGbl_NumHistory < HISTORY_SIZE)
+ {
+ AcpiGbl_NumHistory++;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayHistory
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the contents of the history buffer
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayHistory (void)
+{
+ ACPI_NATIVE_UINT i;
+ UINT16 HistoryIndex;
+
+
+ HistoryIndex = AcpiGbl_LoHistory;
+
+ /* Dump entire history buffer */
+
+ for (i = 0; i < AcpiGbl_NumHistory; i++)
+ {
+ AcpiOsPrintf ("%ld %s\n", AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum,
+ AcpiGbl_HistoryBuffer[HistoryIndex].Command);
+
+ HistoryIndex++;
+ if (HistoryIndex >= HISTORY_SIZE)
+ {
+ HistoryIndex = 0;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetFromHistory
+ *
+ * PARAMETERS: CommandNumArg - String containing the number of the
+ * command to be retrieved
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get a command from the history buffer
+ *
+ ******************************************************************************/
+
+char *
+AcpiDbGetFromHistory (
+ char *CommandNumArg)
+{
+ ACPI_NATIVE_UINT i;
+ UINT16 HistoryIndex;
+ UINT32 CmdNum;
+
+
+ if (CommandNumArg == NULL)
+ {
+ CmdNum = AcpiGbl_NextCmdNum - 1;
+ }
+
+ else
+ {
+ CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0);
+ }
+
+ /* Search history buffer */
+
+ HistoryIndex = AcpiGbl_LoHistory;
+ for (i = 0; i < AcpiGbl_NumHistory; i++)
+ {
+ if (AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum == CmdNum)
+ {
+ /* Found the commnad, return it */
+
+ return (AcpiGbl_HistoryBuffer[HistoryIndex].Command);
+ }
+
+
+ HistoryIndex++;
+ if (HistoryIndex >= HISTORY_SIZE)
+ {
+ HistoryIndex = 0;
+ }
+ }
+
+ AcpiOsPrintf ("Invalid history number: %d\n", HistoryIndex);
+ return (NULL);
+}
+
+
+#endif /* ACPI_DEBUGGER */
+
diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c
new file mode 100644
index 0000000..66c4c08
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbinput.c
@@ -0,0 +1,1001 @@
+/*******************************************************************************
+ *
+ * Module Name: dbinput - user front-end to the AML debugger
+ * $Revision: 97 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdebug.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbinput")
+
+
+/*
+ * Top-level debugger commands.
+ *
+ * This list of commands must match the string table below it
+ */
+enum AcpiExDebuggerCommands
+{
+ CMD_NOT_FOUND = 0,
+ CMD_NULL,
+ CMD_ALLOCATIONS,
+ CMD_ARGS,
+ CMD_ARGUMENTS,
+ CMD_BREAKPOINT,
+ CMD_CALL,
+ CMD_CLOSE,
+ CMD_DEBUG,
+ CMD_DUMP,
+ CMD_ENABLEACPI,
+ CMD_EVENT,
+ CMD_EXECUTE,
+ CMD_EXIT,
+ CMD_FIND,
+ CMD_GO,
+ CMD_GPE,
+ CMD_GPES,
+ CMD_HELP,
+ CMD_HELP2,
+ CMD_HISTORY,
+ CMD_HISTORY_EXE,
+ CMD_HISTORY_LAST,
+ CMD_INFORMATION,
+ CMD_INTEGRITY,
+ CMD_INTO,
+ CMD_LEVEL,
+ CMD_LIST,
+ CMD_LOAD,
+ CMD_LOCALS,
+ CMD_LOCKS,
+ CMD_METHODS,
+ CMD_NAMESPACE,
+ CMD_NOTIFY,
+ CMD_OBJECT,
+ CMD_OPEN,
+ CMD_OWNER,
+ CMD_PREFIX,
+ CMD_QUIT,
+ CMD_REFERENCES,
+ CMD_RESOURCES,
+ CMD_RESULTS,
+ CMD_SET,
+ CMD_STATS,
+ CMD_STOP,
+ CMD_TABLES,
+ CMD_TERMINATE,
+ CMD_THREADS,
+ CMD_TREE,
+ CMD_TYPE,
+ CMD_UNLOAD
+};
+
+#define CMD_FIRST_VALID 2
+
+
+static const COMMAND_INFO AcpiGbl_DbCommands[] =
+{
+ {"<NOT FOUND>", 0},
+ {"<NULL>", 0},
+ {"ALLOCATIONS", 0},
+ {"ARGS", 0},
+ {"ARGUMENTS", 0},
+ {"BREAKPOINT", 1},
+ {"CALL", 0},
+ {"CLOSE", 0},
+ {"DEBUG", 1},
+ {"DUMP", 1},
+ {"ENABLEACPI", 0},
+ {"EVENT", 1},
+ {"EXECUTE", 1},
+ {"EXIT", 0},
+ {"FIND", 1},
+ {"GO", 0},
+ {"GPE", 2},
+ {"GPES", 0},
+ {"HELP", 0},
+ {"?", 0},
+ {"HISTORY", 0},
+ {"!", 1},
+ {"!!", 0},
+ {"INFORMATION", 0},
+ {"INTEGRITY", 0},
+ {"INTO", 0},
+ {"LEVEL", 0},
+ {"LIST", 0},
+ {"LOAD", 1},
+ {"LOCALS", 0},
+ {"LOCKS", 0},
+ {"METHODS", 0},
+ {"NAMESPACE", 0},
+ {"NOTIFY", 2},
+ {"OBJECT", 1},
+ {"OPEN", 1},
+ {"OWNER", 1},
+ {"PREFIX", 0},
+ {"QUIT", 0},
+ {"REFERENCES", 1},
+ {"RESOURCES", 1},
+ {"RESULTS", 0},
+ {"SET", 3},
+ {"STATS", 0},
+ {"STOP", 0},
+ {"TABLES", 0},
+ {"TERMINATE", 0},
+ {"THREADS", 3},
+ {"TREE", 0},
+ {"TYPE", 1},
+ {"UNLOAD", 1},
+ {NULL, 0}
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayHelp
+ *
+ * PARAMETERS: HelpType - Subcommand (optional)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print a usage message.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayHelp (
+ char *HelpType)
+{
+
+
+ /* No parameter, just give the overview */
+
+ if (!HelpType)
+ {
+ AcpiOsPrintf ("ACPI CA Debugger Commands\n\n");
+ AcpiOsPrintf ("The following classes of commands are available. Help is available for\n");
+ AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n");
+ AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n");
+ AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n");
+ AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n");
+ AcpiOsPrintf (" [FILE] File I/O Commands\n");
+ return;
+ }
+
+ /*
+ * Parameter is the command class
+ *
+ * The idea here is to keep each class of commands smaller than a screenful
+ */
+ switch (HelpType[0])
+ {
+ case 'G':
+ AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n");
+ AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
+ AcpiOsPrintf ("Dump <Address>|<Namepath>\n");
+ AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
+ AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
+ AcpiOsPrintf ("Help This help screen\n");
+ AcpiOsPrintf ("History Display command history buffer\n");
+ AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
+ AcpiOsPrintf ("Locks Current status of internal mutexes\n");
+ AcpiOsPrintf ("Quit or Exit Exit this command\n");
+ AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n");
+ AcpiOsPrintf (" |Objects|Tables] Display namespace and memory statistics\n");
+ AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n");
+ AcpiOsPrintf ("Unload <TableSig> [Instance] Unload an ACPI table\n");
+ AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n");
+ AcpiOsPrintf ("!! Execute last command again\n");
+ return;
+
+ case 'N':
+ AcpiOsPrintf ("\nNamespace Access Commands\n\n");
+ AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
+ AcpiOsPrintf ("Find <Name> (? is wildcard) Find ACPI name(s) with wildcards\n");
+ AcpiOsPrintf ("Method Display list of loaded control methods\n");
+ AcpiOsPrintf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
+ AcpiOsPrintf ("Notify <NamePath> <Value> Send a notification\n");
+ AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
+ AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
+ AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
+ AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
+ AcpiOsPrintf ("Resources xxx Get and display resources\n");
+ AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
+ AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
+ return;
+
+ case 'M':
+ AcpiOsPrintf ("\nControl Method Execution Commands\n\n");
+ AcpiOsPrintf ("Arguments (or Args) Display method arguments\n");
+ AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
+ AcpiOsPrintf ("Call Run to next control method invocation\n");
+ AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
+ AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
+ AcpiOsPrintf ("Go Allow method to run to completion\n");
+ AcpiOsPrintf ("Information Display info about the current method\n");
+ AcpiOsPrintf ("Into Step into (not over) a method call\n");
+ AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n");
+ AcpiOsPrintf ("Locals Display method local variables\n");
+ AcpiOsPrintf ("Results Display method result stack\n");
+ AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
+ AcpiOsPrintf ("Stop Terminate control method\n");
+ AcpiOsPrintf ("Tree Display control method calling tree\n");
+ AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
+ return;
+
+ case 'F':
+ AcpiOsPrintf ("\nFile I/O Commands\n\n");
+ AcpiOsPrintf ("Close Close debug output file\n");
+ AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n");
+ AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n");
+ return;
+
+ default:
+ AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType);
+ return;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetNextToken
+ *
+ * PARAMETERS: String - Command buffer
+ * Next - Return value, end of next token
+ *
+ * RETURN: Pointer to the start of the next token.
+ *
+ * DESCRIPTION: Command line parsing. Get the next token on the command line
+ *
+ ******************************************************************************/
+
+char *
+AcpiDbGetNextToken (
+ char *String,
+ char **Next)
+{
+ char *Start;
+
+
+ /* At end of buffer? */
+
+ if (!String || !(*String))
+ {
+ return (NULL);
+ }
+
+ /* Get rid of any spaces at the beginning */
+
+ if (*String == ' ')
+ {
+ while (*String && (*String == ' '))
+ {
+ String++;
+ }
+
+ if (!(*String))
+ {
+ return (NULL);
+ }
+ }
+
+ Start = String;
+
+ /* Find end of token */
+
+ while (*String && (*String != ' '))
+ {
+ String++;
+ }
+
+ if (!(*String))
+ {
+ *Next = NULL;
+ }
+ else
+ {
+ *String = 0;
+ *Next = String + 1;
+ }
+
+ return (Start);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetLine
+ *
+ * PARAMETERS: InputBuffer - Command line buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get the next command line from the user. Gets entire line
+ * up to the next newline
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDbGetLine (
+ char *InputBuffer)
+{
+ UINT32 i;
+ UINT32 Count;
+ char *Next;
+ char *This;
+
+
+ ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
+ ACPI_STRUPR (AcpiGbl_DbParsedBuf);
+
+ This = AcpiGbl_DbParsedBuf;
+ for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
+ {
+ AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next);
+ if (!AcpiGbl_DbArgs[i])
+ {
+ break;
+ }
+
+ This = Next;
+ }
+
+ /* Uppercase the actual command */
+
+ if (AcpiGbl_DbArgs[0])
+ {
+ ACPI_STRUPR (AcpiGbl_DbArgs[0]);
+ }
+
+ Count = i;
+ if (Count)
+ {
+ Count--; /* Number of args only */
+ }
+
+ return (Count);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbMatchCommand
+ *
+ * PARAMETERS: UserCommand - User command line
+ *
+ * RETURN: Index into command array, -1 if not found
+ *
+ * DESCRIPTION: Search command array for a command match
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDbMatchCommand (
+ char *UserCommand)
+{
+ UINT32 i;
+
+
+ if (!UserCommand || UserCommand[0] == 0)
+ {
+ return (CMD_NULL);
+ }
+
+ for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
+ {
+ if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
+ AcpiGbl_DbCommands[i].Name)
+ {
+ return (i);
+ }
+ }
+
+ /* Command not recognized */
+
+ return (CMD_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCommandDispatch
+ *
+ * PARAMETERS: InputBuffer - Command line buffer
+ * WalkState - Current walk
+ * Op - Current (executing) parse op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Command dispatcher. Called from two places:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbCommandDispatch (
+ char *InputBuffer,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Temp;
+ UINT32 CommandIndex;
+ UINT32 ParamCount;
+ char *CommandLine;
+ ACPI_STATUS Status = AE_CTRL_TRUE;
+
+
+ /* If AcpiTerminate has been called, terminate this thread */
+
+ if (AcpiGbl_DbTerminateThreads)
+ {
+ return (AE_CTRL_TERMINATE);
+ }
+
+ ParamCount = AcpiDbGetLine (InputBuffer);
+ CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
+ Temp = 0;
+
+ /* Verify that we have the minimum number of params */
+
+ if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
+ {
+ AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n",
+ ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs);
+ return (AE_CTRL_TRUE);
+ }
+
+ /* Decode and dispatch the command */
+
+ switch (CommandIndex)
+ {
+ case CMD_NULL:
+ if (Op)
+ {
+ return (AE_OK);
+ }
+ break;
+
+ case CMD_ALLOCATIONS:
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiUtDumpAllocations ((UINT32) -1, NULL);
+#endif
+ break;
+
+ case CMD_ARGS:
+ case CMD_ARGUMENTS:
+ AcpiDbDisplayArguments ();
+ break;
+
+ case CMD_BREAKPOINT:
+ AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
+ break;
+
+ case CMD_CALL:
+ AcpiDbSetMethodCallBreakpoint (Op);
+ Status = AE_OK;
+ break;
+
+ case CMD_CLOSE:
+ AcpiDbCloseDebugFile ();
+ break;
+
+ case CMD_DEBUG:
+ AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP);
+ break;
+
+ case CMD_DUMP:
+ AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_ENABLEACPI:
+ Status = AcpiEnable();
+ if (ACPI_FAILURE(Status))
+ {
+ AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
+ return (Status);
+ }
+ break;
+
+ case CMD_EVENT:
+ AcpiOsPrintf ("Event command not implemented\n");
+ break;
+
+ case CMD_EXECUTE:
+ AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP);
+ break;
+
+ case CMD_FIND:
+ AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_GO:
+ AcpiGbl_CmSingleStep = FALSE;
+ return (AE_OK);
+
+ case CMD_GPE:
+ AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_GPES:
+ AcpiDbDisplayGpes ();
+ break;
+
+ case CMD_HELP:
+ case CMD_HELP2:
+ AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_HISTORY:
+ AcpiDbDisplayHistory ();
+ break;
+
+ case CMD_HISTORY_EXE:
+ CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
+ if (!CommandLine)
+ {
+ return (AE_CTRL_TRUE);
+ }
+
+ Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AE_CTRL_TRUE;
+ }
+ return (Status);
+
+ case CMD_HISTORY_LAST:
+ CommandLine = AcpiDbGetFromHistory (NULL);
+ if (!CommandLine)
+ {
+ return (AE_CTRL_TRUE);
+ }
+
+ Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AE_CTRL_TRUE;
+ }
+ return (Status);
+
+ case CMD_INFORMATION:
+ AcpiDbDisplayMethodInfo (Op);
+ break;
+
+ case CMD_INTEGRITY:
+ AcpiDbCheckIntegrity ();
+ break;
+
+ case CMD_INTO:
+ if (Op)
+ {
+ AcpiGbl_CmSingleStep = TRUE;
+ return (AE_OK);
+ }
+ break;
+
+ case CMD_LEVEL:
+ if (ParamCount == 0)
+ {
+ AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel);
+ AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel);
+ }
+ else if (ParamCount == 2)
+ {
+ Temp = AcpiGbl_DbConsoleDebugLevel;
+ AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
+ }
+ else
+ {
+ Temp = AcpiGbl_DbDebugLevel;
+ AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
+ }
+ break;
+
+ case CMD_LIST:
+ AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
+ break;
+
+ case CMD_LOAD:
+ Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ break;
+
+ case CMD_LOCKS:
+ AcpiDbDisplayLocks ();
+ break;
+
+ case CMD_LOCALS:
+ AcpiDbDisplayLocals ();
+ break;
+
+ case CMD_METHODS:
+ AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_NAMESPACE:
+ AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_NOTIFY:
+ Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
+ AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
+ break;
+
+ case CMD_OBJECT:
+ ACPI_STRUPR (AcpiGbl_DbArgs[1]);
+ AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_OPEN:
+ AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_OWNER:
+ AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_PREFIX:
+ AcpiDbSetScope (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_REFERENCES:
+ AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_RESOURCES:
+ AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_RESULTS:
+ AcpiDbDisplayResults ();
+ break;
+
+ case CMD_SET:
+ AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
+ break;
+
+ case CMD_STATS:
+ AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_STOP:
+ return (AE_NOT_IMPLEMENTED);
+
+ case CMD_TABLES:
+ AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_TERMINATE:
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiUtSubsystemShutdown ();
+
+ /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
+
+ /* AcpiInitialize (NULL); */
+ break;
+
+ case CMD_THREADS:
+ AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
+ break;
+
+ case CMD_TREE:
+ AcpiDbDisplayCallingTree ();
+ break;
+
+ case CMD_TYPE:
+ AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
+ break;
+
+ case CMD_UNLOAD:
+ AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_EXIT:
+ case CMD_QUIT:
+ if (Op)
+ {
+ AcpiOsPrintf ("Method execution terminated\n");
+ return (AE_CTRL_TERMINATE);
+ }
+
+ if (!AcpiGbl_DbOutputToFile)
+ {
+ AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
+ }
+
+ /* Shutdown */
+
+ /* AcpiUtSubsystemShutdown (); */
+ AcpiDbCloseDebugFile ();
+
+ AcpiGbl_DbTerminateThreads = TRUE;
+
+ return (AE_CTRL_TERMINATE);
+
+ case CMD_NOT_FOUND:
+ default:
+ AcpiOsPrintf ("Unknown Command\n");
+ return (AE_CTRL_TRUE);
+ }
+
+
+ /* Add all commands that come here to the history buffer */
+
+ AcpiDbAddToHistory (InputBuffer);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbExecuteThread
+ *
+ * PARAMETERS: Context - Not used
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Debugger execute thread. Waits for a command line, then
+ * simply dispatches it.
+ *
+ ******************************************************************************/
+
+void ACPI_SYSTEM_XFACE
+AcpiDbExecuteThread (
+ void *Context)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS MStatus;
+
+
+ while (Status != AE_CTRL_TERMINATE)
+ {
+ AcpiGbl_MethodExecuting = FALSE;
+ AcpiGbl_StepToNextCall = FALSE;
+
+ MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
+
+ Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
+
+ MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSingleThread
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Debugger execute thread. Waits for a command line, then
+ * simply dispatches it.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSingleThread (
+ void)
+{
+
+ AcpiGbl_MethodExecuting = FALSE;
+ AcpiGbl_StepToNextCall = FALSE;
+
+ (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbUserCommands
+ *
+ * PARAMETERS: Prompt - User prompt (depends on mode)
+ * Op - Current executing parse op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Command line execution for the AML debugger. Commands are
+ * matched and dispatched here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbUserCommands (
+ char Prompt,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ /* TBD: [Restructure] Need a separate command line buffer for step mode */
+
+ while (!AcpiGbl_DbTerminateThreads)
+ {
+ /* Force output to console until a command is entered */
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+ /* Different prompt if method is executing */
+
+ if (!AcpiGbl_MethodExecuting)
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+ }
+ else
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ }
+
+ /* Get the user input line */
+
+ (void) AcpiOsGetLine (AcpiGbl_DbLineBuf);
+
+ /* Check for single or multithreaded debug */
+
+ if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
+ {
+ /*
+ * Signal the debug thread that we have a command to execute,
+ * and wait for the command to complete.
+ */
+ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ else
+ {
+ /* Just call to the command line interpreter */
+
+ AcpiDbSingleThread ();
+ }
+ }
+
+ /*
+ * Only this thread (the original thread) should actually terminate the subsystem,
+ * because all the semaphores are deleted during termination
+ */
+ Status = AcpiTerminate ();
+ return (Status);
+}
+
+
+#endif /* ACPI_DEBUGGER */
+
diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c
new file mode 100644
index 0000000..68c68df
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbstats.c
@@ -0,0 +1,558 @@
+/*******************************************************************************
+ *
+ * Module Name: dbstats - Generation and display of ACPI table statistics
+ * $Revision: 68 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdebug.h"
+#include "acnamesp.h"
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbstats")
+
+/*
+ * Statistics subcommands
+ */
+static ARGUMENT_INFO AcpiDbStatTypes [] =
+{
+ {"ALLOCATIONS"},
+ {"OBJECTS"},
+ {"MEMORY"},
+ {"MISC"},
+ {"TABLES"},
+ {"SIZES"},
+ {"STACK"},
+ {NULL} /* Must be null terminated */
+};
+
+#define CMD_STAT_ALLOCATIONS 0
+#define CMD_STAT_OBJECTS 1
+#define CMD_STAT_MEMORY 2
+#define CMD_STAT_MISC 3
+#define CMD_STAT_TABLES 4
+#define CMD_STAT_SIZES 5
+#define CMD_STAT_STACK 6
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbEnumerateObject
+ *
+ * PARAMETERS: ObjDesc - Object to be counted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add this object to the global counts, by object type.
+ * Limited recursion handles subobjects and packages, and this
+ * is probably acceptable within the AML debugger only.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbEnumerateObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT32 i;
+
+
+ if (!ObjDesc)
+ {
+ return;
+ }
+
+
+ /* Enumerate this object first */
+
+ AcpiGbl_NumObjects++;
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX)
+ {
+ AcpiGbl_ObjTypeCountMisc++;
+ }
+ else
+ {
+ AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
+ }
+
+ /* Count the sub-objects */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_PACKAGE:
+
+ for (i = 0; i < ObjDesc->Package.Count; i++)
+ {
+ AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
+ }
+ break;
+
+ case ACPI_TYPE_DEVICE:
+
+ AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.AddressSpace);
+ break;
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ if (AcpiNsGetSecondaryObject (ObjDesc))
+ {
+ AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
+ }
+ break;
+
+ case ACPI_TYPE_REGION:
+
+ AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
+ AcpiDbEnumerateObject (ObjDesc->Region.AddressSpace);
+ break;
+
+ case ACPI_TYPE_POWER:
+
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
+ break;
+
+ case ACPI_TYPE_PROCESSOR:
+
+ AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.AddressSpace);
+ break;
+
+ case ACPI_TYPE_THERMAL:
+
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddressSpace);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbClassifyOneObject
+ *
+ * PARAMETERS: Callback for WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
+ * the parent namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbClassifyOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 Type;
+
+
+ AcpiGbl_NumNodes++;
+
+ Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+
+ AcpiDbEnumerateObject (ObjDesc);
+
+ Type = Node->Type;
+ if (Type > ACPI_TYPE_NS_NODE_MAX)
+ {
+ AcpiGbl_NodeTypeCountMisc++;
+ }
+
+ else
+ {
+ AcpiGbl_NodeTypeCount [Type]++;
+ }
+
+ return AE_OK;
+
+
+ /* TBD: These need to be counted during the initial parsing phase */
+ /*
+ if (AcpiPsIsNamedOp (Op->Opcode))
+ {
+ NumNodes++;
+ }
+
+ if (IsMethod)
+ {
+ NumMethodElements++;
+ }
+
+ NumGrammarElements++;
+ Op = AcpiPsGetDepthNext (Root, Op);
+
+ SizeOfParseTree = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
+ SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
+
+ */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCountNamespaceObjects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Count and classify the entire namespace, including all
+ * namespace nodes and attached objects.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCountNamespaceObjects (
+ void)
+{
+ UINT32 i;
+
+
+ AcpiGbl_NumNodes = 0;
+ AcpiGbl_NumObjects = 0;
+
+ AcpiGbl_ObjTypeCountMisc = 0;
+ for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
+ {
+ AcpiGbl_ObjTypeCount [i] = 0;
+ AcpiGbl_NodeTypeCount [i] = 0;
+ }
+
+ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ FALSE, AcpiDbClassifyOneObject, NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayStatistics
+ *
+ * PARAMETERS: TypeArg - Subcommand
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display various statistics
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbDisplayStatistics (
+ char *TypeArg)
+{
+ UINT32 i;
+ UINT32 Type;
+ UINT32 Size;
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Outstanding;
+#endif
+
+
+ if (!AcpiGbl_DSDT)
+ {
+ AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n");
+ }
+
+ if (!TypeArg)
+ {
+ AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
+ return (AE_OK);
+ }
+
+ ACPI_STRUPR (TypeArg);
+ Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
+ if (Type == (UINT32) -1)
+ {
+ AcpiOsPrintf ("Invalid or unsupported argument\n");
+ return (AE_OK);
+ }
+
+
+ switch (Type)
+ {
+ case CMD_STAT_ALLOCATIONS:
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiUtDumpAllocationInfo ();
+#endif
+ break;
+
+ case CMD_STAT_TABLES:
+
+ AcpiOsPrintf ("ACPI Table Information:\n\n");
+ if (AcpiGbl_DSDT)
+ {
+ AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
+ }
+ break;
+
+ case CMD_STAT_OBJECTS:
+
+ AcpiDbCountNamespaceObjects ();
+
+ AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
+
+ AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
+
+ for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
+ {
+ AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
+ AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
+ }
+ AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
+ AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
+
+ AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
+ AcpiGbl_NumNodes, AcpiGbl_NumObjects);
+ break;
+
+ case CMD_STAT_MEMORY:
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
+
+ for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
+ {
+ AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
+
+ if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
+ {
+ AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
+ AcpiGbl_MemoryLists[i].CacheDepth,
+ AcpiGbl_MemoryLists[i].MaxCacheDepth,
+ AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
+ (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
+
+ AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
+ AcpiGbl_MemoryLists[i].CacheRequests,
+ AcpiGbl_MemoryLists[i].CacheHits,
+ AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
+ AcpiGbl_MemoryLists[i].ObjectSize);
+ }
+
+ Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
+ AcpiGbl_MemoryLists[i].TotalFreed -
+ AcpiGbl_MemoryLists[i].CacheDepth;
+
+ if (AcpiGbl_MemoryLists[i].ObjectSize)
+ {
+ Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
+ }
+ else
+ {
+ Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
+ }
+
+ AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
+ AcpiGbl_MemoryLists[i].TotalAllocated,
+ AcpiGbl_MemoryLists[i].TotalFreed,
+ Outstanding, Size);
+ }
+#endif
+
+ break;
+
+ case CMD_STAT_MISC:
+
+ AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
+ AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount);
+ AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
+
+ AcpiOsPrintf ("\n");
+
+ AcpiOsPrintf ("Mutex usage:\n\n");
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
+ }
+ break;
+
+
+ case CMD_STAT_SIZES:
+
+ AcpiOsPrintf ("\nInternal object sizes:\n\n");
+
+ AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
+ AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
+ AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
+ AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
+ AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
+ AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
+ AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
+ AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
+ AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
+ AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX));
+ AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION));
+ AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
+ AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
+ AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
+ AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
+ AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
+ AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
+ AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
+ AcpiOsPrintf ("Notify %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
+ AcpiOsPrintf ("AddressSpace %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
+ AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
+ AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
+
+ AcpiOsPrintf ("\n");
+
+ AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
+ AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
+ AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
+ AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
+ AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
+
+ break;
+
+
+ case CMD_STAT_STACK:
+#if defined(ACPI_DEBUG_OUTPUT)
+
+ Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
+
+ AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
+ AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
+ AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
+ AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
+ AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
+#endif
+ break;
+
+ default:
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+#endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c
new file mode 100644
index 0000000..70c84fa
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbutils.c
@@ -0,0 +1,541 @@
+/*******************************************************************************
+ *
+ * Module Name: dbutils - AML debugger utilities
+ * $Revision: 64 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+#include "acdispat.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbMatchArgument
+ *
+ * PARAMETERS: UserArgument - User command line
+ * Arguments - Array of commands to match against
+ *
+ * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found
+ *
+ * DESCRIPTION: Search command array for a command match
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE
+AcpiDbMatchArgument (
+ char *UserArgument,
+ ARGUMENT_INFO *Arguments)
+{
+ UINT32 i;
+
+
+ if (!UserArgument || UserArgument[0] == 0)
+ {
+ return (ACPI_TYPE_NOT_FOUND);
+ }
+
+ for (i = 0; Arguments[i].Name; i++)
+ {
+ if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name)
+ {
+ return (i);
+ }
+ }
+
+ /* Argument not recognized */
+
+ return (ACPI_TYPE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetOutputDestination
+ *
+ * PARAMETERS: OutputFlags - Current flags word
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the current destination for debugger output. Alos sets
+ * the debug output level accordingly.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetOutputDestination (
+ UINT32 OutputFlags)
+{
+
+ AcpiGbl_DbOutputFlags = (UINT8) OutputFlags;
+
+ if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile)
+ {
+ AcpiDbgLevel = AcpiGbl_DbDebugLevel;
+ }
+ else
+ {
+ AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpBuffer
+ *
+ * PARAMETERS: Address - Pointer to the buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print a portion of a buffer
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpBuffer (
+ UINT32 Address)
+{
+
+ AcpiOsPrintf ("\nLocation %X:\n", Address);
+
+ AcpiDbgLevel |= ACPI_LV_TABLES;
+ AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,
+ ACPI_UINT32_MAX);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpObject
+ *
+ * PARAMETERS: ObjDesc - External ACPI object to dump
+ * Level - Nesting level.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the contents of an ACPI external object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpObject (
+ ACPI_OBJECT *ObjDesc,
+ UINT32 Level)
+{
+ UINT32 i;
+
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("[Null Object]\n");
+ return;
+ }
+
+ for (i = 0; i < Level; i++)
+ {
+ AcpiOsPrintf (" ");
+ }
+
+ switch (ObjDesc->Type)
+ {
+ case ACPI_TYPE_ANY:
+
+ AcpiOsPrintf ("[Object Reference] = %p\n", ObjDesc->Reference.Handle);
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("[String] Value: ");
+ for (i = 0; i < ObjDesc->String.Length; i++)
+ {
+ AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
+ if (ObjDesc->Buffer.Length)
+ {
+ AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiOsPrintf ("[Package] Contains %d Elements: \n",
+ ObjDesc->Package.Count);
+
+ for (i = 0; i < ObjDesc->Package.Count; i++)
+ {
+ AcpiDbDumpObject (&ObjDesc->Package.Elements[i], Level+1);
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ AcpiOsPrintf ("[Object Reference] = %p\n", ObjDesc->Reference.Handle);
+ break;
+
+
+ case ACPI_TYPE_PROCESSOR:
+
+ AcpiOsPrintf ("[Processor]\n");
+ break;
+
+
+ case ACPI_TYPE_POWER:
+
+ AcpiOsPrintf ("[Power Resource]\n");
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("[Unknown Type] %X \n", ObjDesc->Type);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbPrepNamestring
+ *
+ * PARAMETERS: Name - String to prepare
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Translate all forward slashes and dots to backslashes.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbPrepNamestring (
+ char *Name)
+{
+
+
+ if (!Name)
+ {
+ return;
+ }
+
+ ACPI_STRUPR (Name);
+
+ /* Convert a leading forward slash to a backslash */
+
+ if (*Name == '/')
+ {
+ *Name = '\\';
+ }
+
+ /* Ignore a leading backslash, this is the root prefix */
+
+ if (*Name == '\\')
+ {
+ Name++;
+ }
+
+ /* Convert all slash path separators to dots */
+
+ while (*Name)
+ {
+ if ((*Name == '/') ||
+ (*Name == '\\'))
+ {
+ *Name = '.';
+ }
+
+ Name++;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSecondPassParse
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until
+ * second pass to parse the control methods
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbSecondPassParse (
+ ACPI_PARSE_OBJECT *Root)
+{
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_PARSE_OBJECT *Method;
+ ACPI_PARSE_OBJECT *SearchOp;
+ ACPI_PARSE_OBJECT *StartOp;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 BaseAmlOffset;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Pass two parse ....\n");
+
+ while (Op)
+ {
+ if (Op->Common.AmlOpcode == AML_METHOD_OP)
+ {
+ Method = Op;
+
+ /* Create a new walk state for the parse */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Init the Walk State */
+
+ WalkState->ParserState.Aml =
+ WalkState->ParserState.AmlStart = Method->Named.Data;
+ WalkState->ParserState.AmlEnd =
+ WalkState->ParserState.PkgEnd = Method->Named.Data + Method->Named.Length;
+ WalkState->ParserState.StartScope = Op;
+
+ WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
+ WalkState->AscendingCallback = AcpiDsLoad1EndOp;
+
+ /* Perform the AML parse */
+
+ Status = AcpiPsParseAml (WalkState);
+
+ BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1;
+ StartOp = (Method->Common.Value.Arg)->Common.Next;
+ SearchOp = StartOp;
+
+ while (SearchOp)
+ {
+ SearchOp->Common.AmlOffset += BaseAmlOffset;
+ SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
+ }
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /* TBD: [Investigate] this isn't quite the right thing to do! */
+ /*
+ *
+ * Method = (ACPI_DEFERRED_OP *) Op;
+ * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
+ */
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbLocalNsLookup
+ *
+ * PARAMETERS: Name - Name to lookup
+ *
+ * RETURN: Pointer to a namespace node
+ *
+ * DESCRIPTION: Lookup a name in the ACPI namespace
+ *
+ * Note: Currently begins search from the root. Could be enhanced to use
+ * the current prefix (scope) node as the search beginning point.
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiDbLocalNsLookup (
+ char *Name)
+{
+ char *InternalPath;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = NULL;
+
+
+ AcpiDbPrepNamestring (Name);
+
+ /* Build an internal namestring */
+
+ Status = AcpiNsInternalizeName (Name, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Invalid namestring: %s\n", Name);
+ return (NULL);
+ }
+
+ /*
+ * Lookup the name.
+ * (Uses root node as the search starting point)
+ */
+ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not locate name: %s %s\n",
+ Name, AcpiFormatException (Status));
+ }
+
+ ACPI_MEM_FREE (InternalPath);
+ return (Node);
+}
+
+
+#endif /* ACPI_DEBUGGER */
+
+
diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c
new file mode 100644
index 0000000..6eeb117
--- /dev/null
+++ b/sys/contrib/dev/acpica/dbxface.c
@@ -0,0 +1,588 @@
+/*******************************************************************************
+ *
+ * Module Name: dbxface - AML Debugger external interfaces
+ * $Revision: 70 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdebug.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbStartCommand
+ *
+ * PARAMETERS: WalkState - Current walk
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter debugger command loop
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbStartCommand (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+
+
+ /* TBD: [Investigate] what are the namespace locking issues here */
+
+ /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */
+
+ /* Go into the command loop and await next user command */
+
+
+ AcpiGbl_MethodExecuting = TRUE;
+ Status = AE_CTRL_TRUE;
+ while (Status == AE_CTRL_TRUE)
+ {
+ if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+ {
+ /* Handshake with the front-end that gets user command lines */
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ else
+ {
+ /* Single threaded, we must get a command line ourselves */
+
+ /* Force output to console until a command is entered */
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+ /* Different prompt if method is executing */
+
+ if (!AcpiGbl_MethodExecuting)
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+ }
+ else
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ }
+
+ /* Get the user input line */
+
+ (void) AcpiOsGetLine (AcpiGbl_DbLineBuf);
+ }
+
+ Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op);
+ }
+
+ /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbMethodEnd
+ *
+ * PARAMETERS: WalkState - Current walk
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+void
+AcpiDbMethodEnd (
+ ACPI_WALK_STATE *WalkState)
+{
+
+ if (!AcpiGbl_CmSingleStep)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("<Method Terminating>\n");
+
+ AcpiDbStartCommand (WalkState, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSingleStep
+ *
+ * PARAMETERS: WalkState - Current walk
+ * Op - Current executing op
+ * OpcodeClass - Class of the current AML Opcode
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Called just before execution of an AML opcode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbSingleStep (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 OpcodeClass)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 OriginalDebugLevel;
+ ACPI_PARSE_OBJECT *DisplayOp;
+ ACPI_PARSE_OBJECT *ParentOp;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Check the abort flag */
+
+ if (AcpiGbl_AbortMethod)
+ {
+ AcpiGbl_AbortMethod = FALSE;
+ return (AE_ABORT_METHOD);
+ }
+
+ /* Check for single-step breakpoint */
+
+ if (WalkState->MethodBreakpoint &&
+ (WalkState->MethodBreakpoint <= Op->Common.AmlOffset))
+ {
+ /* Check if the breakpoint has been reached or passed */
+ /* Hit the breakpoint, resume single step, reset breakpoint */
+
+ AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset);
+ AcpiGbl_CmSingleStep = TRUE;
+ AcpiGbl_StepToNextCall = FALSE;
+ WalkState->MethodBreakpoint = 0;
+ }
+
+ /* Check for user breakpoint (Must be on exact Aml offset) */
+
+ else if (WalkState->UserBreakpoint &&
+ (WalkState->UserBreakpoint == Op->Common.AmlOffset))
+ {
+ AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->Common.AmlOffset);
+ AcpiGbl_CmSingleStep = TRUE;
+ AcpiGbl_StepToNextCall = FALSE;
+ WalkState->MethodBreakpoint = 0;
+ }
+
+ /*
+ * Check if this is an opcode that we are interested in --
+ * namely, opcodes that have arguments
+ */
+ if (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
+ {
+ return (AE_OK);
+ }
+
+ switch (OpcodeClass)
+ {
+ case AML_CLASS_UNKNOWN:
+ case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
+ return (AE_OK);
+
+ default:
+ /* All other opcodes -- continue */
+ break;
+ }
+
+ /*
+ * Under certain debug conditions, display this opcode and its operands
+ */
+ if ((AcpiGbl_DbOutputToFile) ||
+ (AcpiGbl_CmSingleStep) ||
+ (AcpiDbgLevel & ACPI_LV_PARSE))
+ {
+ if ((AcpiGbl_DbOutputToFile) ||
+ (AcpiDbgLevel & ACPI_LV_PARSE))
+ {
+ AcpiOsPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n");
+ }
+
+ /*
+ * Display this op (and only this op - zero out the NEXT field temporarily,
+ * and disable parser trace output for the duration of the display because
+ * we don't want the extraneous debug output)
+ */
+ OriginalDebugLevel = AcpiDbgLevel;
+ AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
+ Next = Op->Common.Next;
+ Op->Common.Next = NULL;
+
+
+ DisplayOp = Op;
+ ParentOp = Op->Common.Parent;
+ if (ParentOp)
+ {
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING))
+ {
+ /*
+ * We are executing the predicate of an IF or WHILE statement
+ * Search upwards for the containing IF or WHILE so that the
+ * entire predicate can be displayed.
+ */
+ while (ParentOp)
+ {
+ if ((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_WHILE_OP))
+ {
+ DisplayOp = ParentOp;
+ break;
+ }
+ ParentOp = ParentOp->Common.Parent;
+ }
+ }
+ else
+ {
+ while (ParentOp)
+ {
+ if ((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_ELSE_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_SCOPE_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_METHOD_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_WHILE_OP))
+ {
+ break;
+ }
+ DisplayOp = ParentOp;
+ ParentOp = ParentOp->Common.Parent;
+ }
+ }
+ }
+
+ /* Now we can display it */
+
+#ifdef ACPI_DISASSEMBLER
+ AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
+#endif
+
+ if ((Op->Common.AmlOpcode == AML_IF_OP) ||
+ (Op->Common.AmlOpcode == AML_WHILE_OP))
+ {
+ if (WalkState->ControlState->Common.Value)
+ {
+ AcpiOsPrintf ("Predicate = [True], IF block was executed\n");
+ }
+ else
+ {
+ AcpiOsPrintf ("Predicate = [False], Skipping IF block\n");
+ }
+ }
+ else if (Op->Common.AmlOpcode == AML_ELSE_OP)
+ {
+ AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n");
+ }
+
+ /* Restore everything */
+
+ Op->Common.Next = Next;
+ AcpiOsPrintf ("\n");
+ if ((AcpiGbl_DbOutputToFile) ||
+ (AcpiDbgLevel & ACPI_LV_PARSE))
+ {
+ AcpiOsPrintf ("\n");
+ }
+ AcpiDbgLevel = OriginalDebugLevel;
+ }
+
+ /* If we are not single stepping, just continue executing the method */
+
+ if (!AcpiGbl_CmSingleStep)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * If we are executing a step-to-call command,
+ * Check if this is a method call.
+ */
+ if (AcpiGbl_StepToNextCall)
+ {
+ if (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)
+ {
+ /* Not a method call, just keep executing */
+
+ return (AE_OK);
+ }
+
+ /* Found a method call, stop executing */
+
+ AcpiGbl_StepToNextCall = FALSE;
+ }
+
+ /*
+ * If the next opcode is a method call, we will "step over" it
+ * by default.
+ */
+ if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP)
+ {
+ AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */
+
+ /* Set the breakpoint on/before the call, it will stop execution as soon as we return */
+
+ WalkState->MethodBreakpoint = 1; /* Must be non-zero! */
+ }
+
+
+ Status = AcpiDbStartCommand (WalkState, Op);
+
+ /* User commands complete, continue execution of the interrupted method */
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Init and start debugger
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbInitialize (void)
+{
+ ACPI_STATUS Status;
+
+
+ /* Init globals */
+
+ AcpiGbl_DbBuffer = NULL;
+ AcpiGbl_DbFilename = NULL;
+ AcpiGbl_DbOutputToFile = FALSE;
+
+ AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2;
+ AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES;
+ AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
+
+ AcpiGbl_DbOpt_tables = FALSE;
+ AcpiGbl_DbOpt_stats = FALSE;
+#ifdef ACPI_DISASSEMBLER
+ AcpiGbl_DbOpt_disasm = FALSE;
+ AcpiGbl_DbOpt_verbose = TRUE;
+#endif
+ AcpiGbl_DbOpt_ini_methods = TRUE;
+
+ AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE);
+ if (!AcpiGbl_DbBuffer)
+ {
+ return (AE_NO_MEMORY);
+ }
+ ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE);
+
+ /* Initial scope is the root */
+
+ AcpiGbl_DbScopeBuf [0] = '\\';
+ AcpiGbl_DbScopeBuf [1] = 0;
+ AcpiGbl_DbScopeNode = AcpiGbl_RootNode;
+
+ /*
+ * If configured for multi-thread support, the debug executor runs in
+ * a separate thread so that the front end can be in another address
+ * space, environment, or even another machine.
+ */
+ if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
+ {
+ /* These were created with one unit, grab it */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get debugger mutex\n");
+ return (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get debugger mutex\n");
+ return (Status);
+ }
+
+ /* Create the debug execution thread to execute commands */
+
+ Status = AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not start debugger thread\n");
+ return (Status);
+ }
+ }
+
+#ifdef ACPI_DISASSEMBLER
+ if (!AcpiGbl_DbOpt_verbose)
+ {
+ AcpiGbl_DbOpt_disasm = TRUE;
+ AcpiGbl_DbOpt_stats = FALSE;
+ }
+#endif
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbTerminate
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Stop debugger
+ *
+ ******************************************************************************/
+
+void
+AcpiDbTerminate (void)
+{
+
+ if (AcpiGbl_DbTablePtr)
+ {
+ AcpiOsFree (AcpiGbl_DbTablePtr);
+ }
+ if (AcpiGbl_DbBuffer)
+ {
+ AcpiOsFree (AcpiGbl_DbBuffer);
+ }
+}
+
+
+#endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/dmbuffer.c b/sys/contrib/dev/acpica/dmbuffer.c
new file mode 100644
index 0000000..e78b6ce
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmbuffer.c
@@ -0,0 +1,537 @@
+/*******************************************************************************
+ *
+ * Module Name: dmbuffer - AML disassembler, buffer and string support
+ * $Revision: 12 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdisasm.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmbuffer")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisasmByteList
+ *
+ * PARAMETERS: Level - Current source code indentation level
+ * ByteData - Pointer to the byte list
+ * ByteCount - Length of the byte list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a list of bytes in Hex format
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisasmByteList (
+ UINT32 Level,
+ UINT8 *ByteData,
+ UINT32 ByteCount)
+{
+ UINT32 i;
+
+
+ AcpiDmIndent (Level);
+
+ /* Dump the byte list */
+
+ for (i = 0; i < ByteCount; i++)
+ {
+ AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]);
+
+ /* Add comma if there are more bytes to display */
+
+ if (i < (ByteCount -1))
+ {
+ AcpiOsPrintf (", ");
+ }
+
+ /* New line every 8 bytes */
+
+ if ((((i+1) % 8) == 0) && ((i+1) < ByteCount))
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level);
+ }
+ }
+
+ if (Level)
+ {
+ AcpiOsPrintf ("\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmByteList
+ *
+ * PARAMETERS: Info - Parse tree walk info
+ * Op - Byte list op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a buffer byte list, handling the various types of buffers.
+ * Buffer type must be already set in the Op DisasmOpcode.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmByteList (
+ ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT8 *ByteData;
+ UINT32 ByteCount;
+
+
+ ByteData = Op->Named.Data;
+ ByteCount = (UINT32) Op->Common.Value.Integer;
+
+ /*
+ * The byte list belongs to a buffer, and can be produced by either
+ * a ResourceTemplate, Unicode, quoted string, or a plain byte list.
+ */
+ switch (Op->Common.Parent->Common.DisasmOpcode)
+ {
+ case ACPI_DASM_RESOURCE:
+
+ AcpiDmResourceDescriptor (Info, ByteData, ByteCount);
+ break;
+
+ case ACPI_DASM_STRING:
+
+ AcpiDmIndent (Info->Level);
+ AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DASM_UNICODE:
+
+ AcpiDmUnicode (Op);
+ break;
+
+ case ACPI_DASM_BUFFER:
+ default:
+
+ /*
+ * Not a resource, string, or unicode string.
+ * Just dump the buffer
+ */
+ AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsUnicodeBuffer
+ *
+ * PARAMETERS: Op - Buffer Object to be examined
+ *
+ * RETURN: TRUE if buffer contains a UNICODE string
+ *
+ * DESCRIPTION: Determine if a buffer Op contains a Unicode string
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmIsUnicodeBuffer (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT8 *ByteData;
+ UINT32 ByteCount;
+ UINT32 WordCount;
+ ACPI_PARSE_OBJECT *SizeOp;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NATIVE_UINT i;
+
+
+ /* Buffer size is the buffer argument */
+
+ SizeOp = Op->Common.Value.Arg;
+
+ /* Next, the initializer byte list to examine */
+
+ NextOp = SizeOp->Common.Next;
+ if (!NextOp)
+ {
+ return (FALSE);
+ }
+
+ /* Extract the byte list info */
+
+ ByteData = NextOp->Named.Data;
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
+ WordCount = ACPI_DIV_2 (ByteCount);
+
+ /*
+ * Unicode string must have an even number of bytes and last
+ * word must be zero
+ */
+ if ((!ByteCount) ||
+ (ByteCount < 4) ||
+ (ByteCount & 1) ||
+ ((UINT16 *) (void *) ByteData)[WordCount - 1] != 0)
+ {
+ return (FALSE);
+ }
+
+ /* For each word, 1st byte must be ascii, 2nd byte must be zero */
+
+ for (i = 0; i < (ByteCount - 2); i += 2)
+ {
+ if ((!ACPI_IS_PRINT (ByteData[i])) ||
+ (ByteData[i + 1] != 0))
+ {
+ return (FALSE);
+ }
+ }
+
+ /* Ignore the Size argument in the disassembly of this buffer op */
+
+ SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsStringBuffer
+ *
+ * PARAMETERS: Op - Buffer Object to be examined
+ *
+ * RETURN: TRUE if buffer contains a ASCII string
+ *
+ * DESCRIPTION: Determine if a buffer Op contains a ASCII string
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmIsStringBuffer (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT8 *ByteData;
+ UINT32 ByteCount;
+ ACPI_PARSE_OBJECT *SizeOp;
+ ACPI_PARSE_OBJECT *NextOp;
+ UINT32 i;
+
+
+ /* Buffer size is the buffer argument */
+
+ SizeOp = Op->Common.Value.Arg;
+
+ /* Next, the initializer byte list to examine */
+
+ NextOp = SizeOp->Common.Next;
+ if (!NextOp)
+ {
+ return (FALSE);
+ }
+
+ /* Extract the byte list info */
+
+ ByteData = NextOp->Named.Data;
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
+
+ /* Last byte must be the null terminator */
+
+ if ((!ByteCount) ||
+ (ByteCount < 2) ||
+ (ByteData[ByteCount-1] != 0))
+ {
+ return (FALSE);
+ }
+
+ for (i = 0; i < (ByteCount - 1); i++)
+ {
+ /* TBD: allow some escapes (non-ascii chars).
+ * they will be handled in the string output routine
+ */
+
+ if (!ACPI_IS_PRINT (ByteData[i]))
+ {
+ return (FALSE);
+ }
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUnicode
+ *
+ * PARAMETERS: Op - Byte List op containing Unicode string
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump Unicode string as a standard ASCII string. (Remove
+ * the extra zero bytes).
+ *
+ ******************************************************************************/
+
+void
+AcpiDmUnicode (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT16 *WordData;
+ UINT32 WordCount;
+ UINT32 i;
+
+
+ /* Extract the buffer info as a WORD buffer */
+
+ WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
+ WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
+
+
+ AcpiOsPrintf ("\"");
+
+ /* Write every other byte as an ASCII character */
+
+ for (i = 0; i < (WordCount - 1); i++)
+ {
+ AcpiOsPrintf ("%c", (int) WordData[i]);
+ }
+
+ AcpiOsPrintf ("\")");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiIsEisaId
+ *
+ * PARAMETERS: Op - Op to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Determine if an Op can be converted to an EisaId.
+ *
+ ******************************************************************************/
+
+void
+AcpiIsEisaId (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Name;
+ UINT32 BigEndianId;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NATIVE_UINT i;
+ UINT32 Prefix[3];
+
+
+ /* Get the NameSegment */
+
+ Name = AcpiPsGetName (Op);
+ if (!Name)
+ {
+ return;
+ }
+
+ /* We are looking for _HID */
+
+ if (ACPI_STRNCMP ((char *) &Name, METHOD_NAME__HID, 4))
+ {
+ return;
+ }
+
+ /* The parameter must be either a word or a dword */
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ if ((NextOp->Common.AmlOpcode != AML_DWORD_OP) &&
+ (NextOp->Common.AmlOpcode != AML_WORD_OP))
+ {
+ return;
+ }
+
+ /* Swap from little-endian to big-endian to simplify conversion */
+
+ BigEndianId = AcpiUtDwordByteSwap ((UINT32) NextOp->Common.Value.Integer);
+
+ /* Create the 3 leading ASCII letters */
+
+ Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
+ Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
+ Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
+
+ /* Verify that all 3 are ascii and alpha */
+
+ for (i = 0; i < 3; i++)
+ {
+ if (!ACPI_IS_ASCII (Prefix[i]) ||
+ !ACPI_IS_ALPHA (Prefix[i]))
+ {
+ return;
+ }
+ }
+
+ /* OK - mark this node as convertable to an EISA ID */
+
+ NextOp->Common.DisasmOpcode = ACPI_DASM_EISAID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmEisaId
+ *
+ * PARAMETERS: EncodedId - Raw encoded EISA ID.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmEisaId (
+ UINT32 EncodedId)
+{
+ UINT32 BigEndianId;
+
+
+ /* Swap from little-endian to big-endian to simplify conversion */
+
+ BigEndianId = AcpiUtDwordByteSwap (EncodedId);
+
+
+ /* Split to form "AAANNNN" string */
+
+ AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")",
+
+ /* Three Alpha characters (AAA), 5 bits each */
+
+ (int) ((BigEndianId >> 26) & 0x1F) + 0x40,
+ (int) ((BigEndianId >> 21) & 0x1F) + 0x40,
+ (int) ((BigEndianId >> 16) & 0x1F) + 0x40,
+
+ /* Numeric part (NNNN) is simply the lower 16 bits */
+
+ (UINT32) (BigEndianId & 0xFFFF));
+}
+
+#endif
diff --git a/sys/contrib/dev/acpica/dmnames.c b/sys/contrib/dev/acpica/dmnames.c
new file mode 100644
index 0000000..c9a0069
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmnames.c
@@ -0,0 +1,499 @@
+/*******************************************************************************
+ *
+ * Module Name: dmnames - AML disassembler, names, namestrings, pathnames
+ * $Revision: 6 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmnames")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmValidateName
+ *
+ * PARAMETERS: Name - 4 character ACPI name
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Lookup the name
+ *
+ ******************************************************************************/
+
+void
+AcpiDmValidateName (
+ char *Name,
+ ACPI_PARSE_OBJECT *Op)
+{
+
+#if 0
+ if ((!Name) ||
+ (!Op->Common.Parent))
+ {
+ return;
+ }
+
+ if (!Op->Common.Node)
+ {
+ AcpiOsPrintf (" /**** Name not found or not accessible from this scope ****/ ");
+ }
+
+ ACPI_PARSE_OBJECT *TargetOp;
+
+
+ if ((!Name) ||
+ (!Op->Common.Parent))
+ {
+ return;
+ }
+
+ TargetOp = AcpiPsFind (Op, Name, 0, 0);
+ if (!TargetOp)
+ {
+ /*
+ * Didn't find the name in the parse tree. This may be
+ * a problem, or it may simply be one of the predefined names
+ * (such as _OS_). Rather than worry about looking up all
+ * the predefined names, just display the name as given
+ */
+ AcpiOsPrintf (" /**** Name not found or not accessible from this scope ****/ ");
+ }
+#endif
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpName
+ *
+ * PARAMETERS: Name - 4 character ACPI name
+ *
+ * RETURN: Final length of name
+ *
+ * DESCRIPTION: Dump an ACPI name, minus any trailing underscores.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmDumpName (
+ char *Name)
+{
+ UINT32 i;
+ UINT32 Length;
+ char *End = Name + ACPI_NAME_SIZE;
+
+
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ if (Name[i] != '_')
+ {
+ End = &Name[i];
+ }
+ }
+
+ Length = (UINT32)(End - Name) + 1;
+ for (i = 0; i < Length; i++)
+ {
+ AcpiOsPrintf ("%c", Name[i]);
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsDisplayObjectPathname
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Op - Object whose pathname is to be obtained
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Diplay the pathname associated with a named object. Two
+ * versions. One searches the parse tree (for parser-only
+ * applications suchas AcpiDump), and the other searches the
+ * ACPI namespace (the parse tree is probably deleted)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsDisplayObjectPathname (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_BUFFER Buffer;
+ UINT32 DebugLevel;
+
+
+ /* Save current debug level so we don't get extraneous debug output */
+
+ DebugLevel = AcpiDbgLevel;
+ AcpiDbgLevel = 0;
+
+ /* Just get the Node out of the Op object */
+
+ Node = Op->Common.Node;
+ if (!Node)
+ {
+ /* Node not defined in this scope, look it up */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * We can't get the pathname since the object
+ * is not in the namespace. This can happen during single
+ * stepping where a dynamic named object is *about* to be created.
+ */
+ AcpiOsPrintf (" [Path not found]");
+ goto Exit;
+ }
+
+ /* Save it for next time. */
+
+ Op->Common.Node = Node;
+ }
+
+ /* Convert NamedDesc/handle to a full pathname */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (Node, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("****Could not get pathname****)");
+ goto Exit;
+ }
+
+ AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer);
+ ACPI_MEM_FREE (Buffer.Pointer);
+
+
+Exit:
+ /* Restore the debug level */
+
+ AcpiDbgLevel = DebugLevel;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmNamestring
+ *
+ * PARAMETERS: Name - ACPI Name string to store
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode an ACPI namestring. Handles prefix characters
+ *
+ ******************************************************************************/
+
+void
+AcpiDmNamestring (
+ char *Name)
+{
+ UINT32 SegCount;
+
+
+ if (!Name)
+ {
+ return;
+ }
+
+ /* Handle all Scope Prefix operators */
+
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))
+ {
+ /* Append prefix character */
+
+ AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
+ Name++;
+ }
+
+ switch (ACPI_GET8 (Name))
+ {
+ case 0:
+ SegCount = 0;
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+ SegCount = 2;
+ Name++;
+ break;
+
+ case AML_MULTI_NAME_PREFIX_OP:
+ SegCount = (UINT32) ACPI_GET8 (Name + 1);
+ Name += 2;
+ break;
+
+ default:
+ SegCount = 1;
+ break;
+ }
+
+ while (SegCount)
+ {
+ /* Append Name segment */
+
+ AcpiDmDumpName ((char *) Name);
+
+ SegCount--;
+ if (SegCount)
+ {
+ /* Not last name, append dot separator */
+
+ AcpiOsPrintf (".");
+ }
+ Name += ACPI_NAME_SIZE;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayPath
+ *
+ * PARAMETERS: Op - Named Op whose path is to be constructed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Walk backwards from current scope and display the name
+ * of each previous level of scope up to the root scope
+ * (like "pwd" does with file systems)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayPath (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Prev;
+ ACPI_PARSE_OBJECT *Search;
+ UINT32 Name;
+ BOOLEAN DoDot = FALSE;
+ ACPI_PARSE_OBJECT *NamePath;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ /* We are only interested in named objects */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (!(OpInfo->Flags & AML_NSNODE))
+ {
+ return;
+ }
+
+ if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Field creation - check for a fully qualified namepath */
+
+ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ NamePath = AcpiPsGetArg (Op, 3);
+ }
+ else
+ {
+ NamePath = AcpiPsGetArg (Op, 2);
+ }
+
+ if ((NamePath) &&
+ (NamePath->Common.Value.String) &&
+ (NamePath->Common.Value.String[0] == '\\'))
+ {
+ AcpiDmNamestring (NamePath->Common.Value.String);
+ return;
+ }
+ }
+
+ Prev = NULL; /* Start with Root Node */
+
+ while (Prev != Op)
+ {
+ /* Search upwards in the tree to find scope with "prev" as its parent */
+
+ Search = Op;
+ for (; ;)
+ {
+ if (Search->Common.Parent == Prev)
+ {
+ break;
+ }
+
+ /* Go up one level */
+
+ Search = Search->Common.Parent;
+ }
+
+ if (Prev)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode);
+ if (!(OpInfo->Flags & AML_FIELD))
+ {
+ /* Below root scope, append scope name */
+
+ if (DoDot)
+ {
+ /* Append dot */
+
+ AcpiOsPrintf (".");
+ }
+
+ if (OpInfo->Flags & AML_CREATE)
+ {
+ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ NamePath = AcpiPsGetArg (Op, 3);
+ }
+ else
+ {
+ NamePath = AcpiPsGetArg (Op, 2);
+ }
+
+ if ((NamePath) &&
+ (NamePath->Common.Value.String))
+ {
+ AcpiDmDumpName (NamePath->Common.Value.String);
+ }
+ }
+ else
+ {
+ Name = AcpiPsGetName (Search);
+ AcpiDmDumpName ((char *) &Name);
+ }
+
+ DoDot = TRUE;
+ }
+ }
+ Prev = Search;
+ }
+}
+
+#endif
+
+
diff --git a/sys/contrib/dev/acpica/dmobject.c b/sys/contrib/dev/acpica/dmobject.c
new file mode 100644
index 0000000..692e7c6
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmobject.c
@@ -0,0 +1,580 @@
+/*******************************************************************************
+ *
+ * Module Name: dmobject - ACPI object decode and display
+ * $Revision: 1 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmnames")
+
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMethodInfo
+ *
+ * PARAMETERS: Status - Method execution status
+ * WalkState - Current state of the parse tree walk
+ * Op - Executing parse op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Called when a method has been aborted because of an error.
+ * Dumps the method execution stack, and the method locals/args,
+ * and disassembles the AML opcode that failed.
+ *
+ ****************************************************************************/
+
+void
+AcpiDmDumpMethodInfo (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_THREAD_STATE *Thread;
+ ACPI_WALK_STATE *NextWalkState;
+ ACPI_NAMESPACE_NODE *PreviousMethod = NULL;
+
+
+ /* Ignore control codes, they are not errors */
+
+ if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
+ {
+ return;
+ }
+
+ /* Display exception and method name */
+
+ AcpiOsPrintf ("\n**** Exception %s during execution of method ",
+ AcpiFormatException (Status));
+ AcpiNsPrintNodePathname (WalkState->MethodNode, NULL);
+
+ /* Display stack of executing methods */
+
+ AcpiOsPrintf ("\n\nMethod Execution Stack:\n");
+ Thread = WalkState->Thread;
+ NextWalkState = Thread->WalkStateList;
+
+ /* Walk list of linked walk states */
+
+ while (NextWalkState)
+ {
+ AcpiOsPrintf (" Method [%4.4s] executing: ",
+ NextWalkState->MethodNode->Name.Ascii);
+
+ /* First method is the currently executing method */
+
+ if (NextWalkState == WalkState)
+ {
+ /* Display currently executing ASL statement */
+
+ Next = Op->Common.Next;
+ Op->Common.Next = NULL;
+
+ AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+ Op->Common.Next = Next;
+ }
+ else
+ {
+ /*
+ * This method has called another method
+ * NOTE: the method call parse subtree is already deleted at this
+ * point, so we cannot disassemble the method invocation.
+ */
+ AcpiOsPrintf ("Call to method ");
+ AcpiNsPrintNodePathname (PreviousMethod, NULL);
+ }
+
+ PreviousMethod = NextWalkState->MethodNode;
+ NextWalkState = NextWalkState->Next;
+ AcpiOsPrintf ("\n");
+ }
+
+ /* Display the method locals and arguments */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDisplayLocals (WalkState);
+ AcpiOsPrintf ("\n");
+ AcpiDmDisplayArguments (WalkState);
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDecodeInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object. Numbers and Strings.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDecodeInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT32 i;
+
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf (" Uninitialized");
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf (" %p", ObjDesc);
+ return;
+ }
+
+ AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("(%d) \"%.24s",
+ ObjDesc->String.Length, ObjDesc->String.Pointer);
+
+ if (ObjDesc->String.Length > 24)
+ {
+ AcpiOsPrintf ("...");
+ }
+ else
+ {
+ AcpiOsPrintf ("\"");
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
+ for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
+ {
+ AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf (" %p", ObjDesc);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDecodeNode
+ *
+ * PARAMETERS: Node - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of a namespace node
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDecodeNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+
+
+ AcpiOsPrintf ("<Node> Name %4.4s",
+ Node->Name.Ascii);
+
+ if (Node->Flags & ANOBJ_METHOD_ARG)
+ {
+ AcpiOsPrintf (" [Method Arg]");
+ }
+ if (Node->Flags & ANOBJ_METHOD_LOCAL)
+ {
+ AcpiOsPrintf (" [Method Local]");
+ }
+
+ AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ * WalkState - Current walk state
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT8 Type;
+
+
+ AcpiOsPrintf ("%p ", ObjDesc);
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("<NullObj>\n");
+ return;
+ }
+
+ /* Decode the object type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_PARSER:
+
+ AcpiOsPrintf ("<Parser> ");
+ break;
+
+
+ case ACPI_DESC_TYPE_NAMED:
+
+ AcpiDmDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ break;
+
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
+ return;
+ }
+
+ /* Decode the ACPI object type */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+
+ AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDmDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+
+ case AML_ARG_OP:
+
+ AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDmDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ AcpiOsPrintf ("[Debug] ");
+ break;
+
+
+ case AML_INDEX_OP:
+
+ AcpiOsPrintf ("[Index] ");
+ if (!ObjDesc->Reference.Where)
+ {
+ AcpiOsPrintf ("Uninitialized WHERE ptr");
+ }
+ else
+ {
+ AcpiDmDecodeInternalObject (*(ObjDesc->Reference.Where));
+ }
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ AcpiOsPrintf ("[RefOf] ");
+
+ /* Reference can be to a Node or an Operand object */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiDmDecodeNode (ObjDesc->Reference.Object);
+ break;
+
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("Unknown Reference opcode %X\n",
+ ObjDesc->Reference.Opcode);
+ break;
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("<Obj> ");
+ AcpiOsPrintf (" ");
+ AcpiDmDecodeInternalObject (ObjDesc);
+ break;
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayLocals
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all locals for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayLocals (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii);
+
+ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
+ {
+ ObjDesc = WalkState->LocalVariables[i].Object;
+ AcpiOsPrintf (" Local%X: ", i);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayArguments
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all arguments for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayArguments (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 NumArgs;
+ UINT32 Concurrency;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ NumArgs = ObjDesc->Method.ParamCount;
+ Concurrency = ObjDesc->Method.Concurrency;
+
+ AcpiOsPrintf ("Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
+ Node->Name.Ascii, NumArgs, Concurrency);
+
+ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
+ {
+ ObjDesc = WalkState->Arguments[i].Object;
+ AcpiOsPrintf (" Arg%d: ", i);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+#endif
+
+
+
+
+
+
diff --git a/sys/contrib/dev/acpica/dmopcode.c b/sys/contrib/dev/acpica/dmopcode.c
new file mode 100644
index 0000000..3b6b6f1
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmopcode.c
@@ -0,0 +1,600 @@
+/*******************************************************************************
+ *
+ * Module Name: dmopcode - AML disassembler, specific AML opcodes
+ * $Revision: 84 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdisasm.h"
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmopcode")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMethodFlags
+ *
+ * PARAMETERS: Op - Method Object to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode control method flags
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMethodFlags (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Flags;
+ UINT32 Args;
+
+
+ /* The next Op contains the flags */
+
+ Op = AcpiPsGetDepthNext (NULL, Op);
+ Flags = (UINT8) Op->Common.Value.Integer;
+ Args = Flags & 0x07;
+
+ /* Mark the Op as completed */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ /* 1) Method argument count */
+
+ AcpiOsPrintf (", %d, ", Args);
+
+ /* 2) Serialize rule */
+
+ if (!(Flags & 0x08))
+ {
+ AcpiOsPrintf ("Not");
+ }
+
+ AcpiOsPrintf ("Serialized");
+
+ /* 3) SyncLevel */
+
+ if (Flags & 0xF0)
+ {
+ AcpiOsPrintf (", %d", Flags >> 4);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFieldFlags
+ *
+ * PARAMETERS: Op - Field Object to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode Field definition flags
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFieldFlags (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Flags;
+
+
+ /* The next Op contains the flags */
+
+ Op = AcpiPsGetDepthNext (NULL, Op);
+ Flags = (UINT8) Op->Common.Value.Integer;
+
+ /* Mark the Op as completed */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x0F]);
+ AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
+ AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddressSpace
+ *
+ * PARAMETERS: SpaceId - ID to be translated
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword
+ *
+ ******************************************************************************/
+
+void
+AcpiDmAddressSpace (
+ UINT8 SpaceId)
+{
+
+ if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
+ {
+ if (SpaceId == 0x7F)
+ {
+ AcpiOsPrintf ("FFixedHW, ");
+ }
+ else
+ {
+ AcpiOsPrintf ("0x%.2X, ", SpaceId);
+ }
+ }
+ else
+ {
+ AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmRegionFlags
+ *
+ * PARAMETERS: Op - Object to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode OperationRegion flags
+ *
+ ******************************************************************************/
+
+void
+AcpiDmRegionFlags (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ /* The next Op contains the SpaceId */
+
+ Op = AcpiPsGetDepthNext (NULL, Op);
+
+ /* Mark the Op as completed */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ AcpiOsPrintf (", ");
+ AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMatchOp
+ *
+ * PARAMETERS: Op - Match Object to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode Match opcode operands
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMatchOp (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ NextOp = NextOp->Common.Next;
+
+ if (!NextOp)
+ {
+ /* Handle partial tree during single-step */
+
+ return;
+ }
+
+ /* Mark the two nodes that contain the encoding for the match keywords */
+
+ NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
+
+ NextOp = NextOp->Common.Next;
+ NextOp = NextOp->Common.Next;
+ NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMatchKeyword
+ *
+ * PARAMETERS: Op - Match Object to be examined
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode Match opcode operands
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMatchKeyword (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ if (((UINT32) Op->Common.Value.Integer) >= ACPI_NUM_MATCH_OPS)
+ {
+ AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
+ }
+ else
+ {
+ AcpiOsPrintf ("%s", (char *) AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisassembleOneOp
+ *
+ * PARAMETERS: WalkState - Current walk info
+ * Info - Parse tree walk info
+ * Op - Op that is to be printed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disassemble a single AML opcode
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisassembleOneOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo = NULL;
+ UINT32 Offset;
+ UINT32 Length;
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("<NULL OP PTR>");
+ return;
+ }
+
+ switch (Op->Common.DisasmOpcode)
+ {
+ case ACPI_DASM_MATCHOP:
+
+ AcpiDmMatchKeyword (Op);
+ return;
+
+ default:
+ break;
+ }
+
+ /* The op and arguments */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_ZERO_OP:
+
+ AcpiOsPrintf ("Zero");
+ break;
+
+
+ case AML_ONE_OP:
+
+ AcpiOsPrintf ("One");
+ break;
+
+
+ case AML_ONES_OP:
+
+ AcpiOsPrintf ("Ones");
+ break;
+
+
+ case AML_REVISION_OP:
+
+ AcpiOsPrintf ("Revision");
+ break;
+
+
+ case AML_BYTE_OP:
+
+ AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
+ break;
+
+
+ case AML_WORD_OP:
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
+ {
+ AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
+ }
+ else
+ {
+ AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
+ }
+ break;
+
+
+ case AML_DWORD_OP:
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
+ {
+ AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
+ }
+ else
+ {
+ AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
+ }
+ break;
+
+
+ case AML_QWORD_OP:
+
+ AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi,
+ Op->Common.Value.Integer64.Lo);
+ break;
+
+
+ case AML_STRING_OP:
+
+ AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX);
+ break;
+
+
+ case AML_BUFFER_OP:
+
+ /*
+ * Determine the type of buffer. We can have one of the following:
+ *
+ * 1) ResourceTemplate containing Resource Descriptors.
+ * 2) Unicode String buffer
+ * 3) ASCII String buffer
+ * 4) Raw data buffer (if none of the above)
+ *
+ * Since there are no special AML opcodes to differentiate these
+ * types of buffers, we have to closely look at the data in the
+ * buffer to determine the type.
+ */
+ if (AcpiDmIsResourceDescriptor (Op))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiOsPrintf ("ResourceTemplate");
+ }
+ else if (AcpiDmIsUnicodeBuffer (Op))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
+ AcpiOsPrintf ("Unicode (");
+ }
+ else if (AcpiDmIsStringBuffer (Op))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_STRING;
+ AcpiOsPrintf ("Buffer");
+ }
+ else
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
+ AcpiOsPrintf ("Buffer");
+ }
+ break;
+
+
+ case AML_INT_STATICSTRING_OP:
+
+ if (Op->Common.Value.String)
+ {
+ AcpiOsPrintf ("%s", Op->Common.Value.String);
+ }
+ else
+ {
+ AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\"");
+ }
+ break;
+
+
+ case AML_INT_NAMEPATH_OP:
+
+ AcpiDmNamestring (Op->Common.Value.Name);
+ AcpiDmValidateName (Op->Common.Value.Name, Op);
+ break;
+
+
+ case AML_INT_NAMEDFIELD_OP:
+
+ Length = AcpiDmDumpName ((char *) &Op->Named.Name);
+ AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", (UINT32) Op->Common.Value.Integer);
+ AcpiDmCommaIfFieldMember (Op);
+
+ Info->BitOffset += (UINT32) Op->Common.Value.Integer;
+ break;
+
+
+ case AML_INT_RESERVEDFIELD_OP:
+
+ /* Offset() -- Must account for previous offsets */
+
+ Offset = (UINT32) Op->Common.Value.Integer;
+ Info->BitOffset += Offset;
+
+ if (Info->BitOffset % 8 == 0)
+ {
+ AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
+ }
+ else
+ {
+ AcpiOsPrintf (" , %d", Offset);
+ }
+
+ AcpiDmCommaIfFieldMember (Op);
+ break;
+
+
+ case AML_INT_ACCESSFIELD_OP:
+
+ AcpiOsPrintf ("AccessAs (%s, ",
+ AcpiGbl_AccessTypes [(UINT32) Op->Common.Value.Integer >> 8]);
+
+ AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
+ AcpiOsPrintf (")");
+ AcpiDmCommaIfFieldMember (Op);
+ break;
+
+
+ case AML_INT_BYTELIST_OP:
+
+ AcpiDmByteList (Info, Op);
+ break;
+
+
+ case AML_INT_METHODCALL_OP:
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ Op = AcpiPsGetDepthNext (NULL, Op);
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ AcpiDmNamestring (Op->Common.Value.Name);
+ break;
+
+
+ default:
+
+ /* Just get the opcode name and print it */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ AcpiOsPrintf ("%s", OpInfo->Name);
+
+
+#ifdef ACPI_DEBUGGER
+
+ if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
+ (WalkState) &&
+ (WalkState->Results) &&
+ (WalkState->Results->Results.NumResults))
+ {
+ AcpiDmDecodeInternalObject (
+ WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]);
+ }
+#endif
+ break;
+ }
+}
+
+#endif /* ACPI_DISASSEMBLER */
diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/dmresrc.c
new file mode 100644
index 0000000..0fb4cb5
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmresrc.c
@@ -0,0 +1,528 @@
+/*******************************************************************************
+ *
+ * Module Name: dmresrc.c - Resource Descriptor disassembly
+ * $Revision: 8 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdisasm.h"
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbresrc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmBitList
+ *
+ * PARAMETERS: Mask - 16-bit value corresponding to 16 interrupt
+ * or DMA values
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a bit mask as a list of individual interrupt/dma levels.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmBitList (
+ UINT16 Mask)
+{
+ UINT32 i;
+ BOOLEAN Previous = FALSE;
+
+
+ /* Open the initializer list */
+
+ AcpiOsPrintf (") {");
+
+ /* Examine each bit */
+
+ for (i = 0; i < 16; i++)
+ {
+ /* Only interested in bits that are set to 1 */
+
+ if (Mask & 1)
+ {
+ if (Previous)
+ {
+ AcpiOsPrintf (",");
+ }
+ Previous = TRUE;
+ AcpiOsPrintf ("%d", i);
+ }
+
+ Mask >>= 1;
+ }
+
+ /* Close list */
+
+ AcpiOsPrintf ("}\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmResourceDescriptor
+ *
+ * PARAMETERS: Info - Curent parse tree walk info
+ * ByteData - Pointer to the byte list data
+ * ByteCount - Length of the byte list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the contents of one ResourceTemplate descriptor.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmResourceDescriptor (
+ ACPI_OP_WALK_INFO *Info,
+ UINT8 *ByteData,
+ UINT32 ByteCount)
+{
+ ACPI_NATIVE_UINT CurrentByteOffset;
+ UINT8 CurrentByte;
+ UINT8 DescriptorId;
+ UINT32 Length;
+ void *DescriptorBody;
+ UINT32 Level;
+ BOOLEAN DependentFns = FALSE;
+
+
+ Level = Info->Level;
+
+ for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
+ {
+ CurrentByte = ByteData[CurrentByteOffset];
+ DescriptorBody = &ByteData[CurrentByteOffset];
+
+ if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
+ {
+ DescriptorId = CurrentByte;
+ Length = (* (ACPI_CAST_PTR (UINT16, &ByteData[CurrentByteOffset + 1])));
+ CurrentByteOffset += 3;
+ }
+ else
+ {
+ DescriptorId = (UINT8) (CurrentByte & 0xF8);
+ Length = (ByteData[CurrentByteOffset] & 0x7);
+ CurrentByteOffset += 1;
+ }
+
+ CurrentByteOffset += (ACPI_NATIVE_UINT) Length;
+
+ /* Determine type of resource */
+
+ switch (DescriptorId)
+ {
+ /*
+ * "Small" type descriptors
+ */
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
+
+ AcpiDmIrqDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
+
+ AcpiDmDmaDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
+
+ /* Finish a previous StartDependentFns */
+
+ if (DependentFns)
+ {
+ Level--;
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}\n");
+ }
+
+ AcpiDmStartDependentDescriptor (DescriptorBody, Length, Level);
+ DependentFns = TRUE;
+ Level++;
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
+
+ Level--;
+ DependentFns = FALSE;
+ AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_IO_PORT:
+
+ AcpiDmIoDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
+
+ AcpiDmFixedIoDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
+
+ AcpiDmVendorSmallDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_TAG:
+
+ if (DependentFns)
+ {
+ /*
+ * Close an open StartDependentDescriptor. This indicates a missing
+ * EndDependentDescriptor.
+ */
+ Level--;
+ DependentFns = FALSE;
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}\n");
+ AcpiDmIndent (Level);
+
+ AcpiOsPrintf ("/*** Missing EndDependentFunctions descriptor */");
+
+ /*
+ * We could fix the problem, but then the ASL would not match the AML
+ * So, we don't do this:
+ * AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
+ */
+ }
+ return;
+
+
+ /*
+ * "Large" type descriptors
+ */
+ case ACPI_RDESC_TYPE_MEMORY_24:
+
+ AcpiDmMemory24Descriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_GENERAL_REGISTER:
+
+ AcpiDmGenericRegisterDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
+
+ AcpiDmVendorLargeDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_MEMORY_32:
+
+ AcpiDmMemory32Descriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
+
+ AcpiDmFixedMem32Descriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+
+ AcpiDmDwordDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+
+ AcpiDmWordDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+
+ AcpiDmInterruptDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+
+ AcpiDmQwordDescriptor (DescriptorBody, Length, Level);
+ break;
+
+
+ default:
+ /*
+ * Anything else is unrecognized.
+ *
+ * Since the entire resource buffer has been already walked and
+ * validated, this is a very serious error indicating that someone
+ * overwrote the buffer.
+ */
+ AcpiOsPrintf ("/* Unknown Resource type (%X) */\n", DescriptorId);
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsResourceDescriptor
+ *
+ * PARAMETERS: Op - Buffer Op to be examined
+ *
+ * RETURN: TRUE if this Buffer Op contains a valid resource
+ * descriptor.
+ *
+ * DESCRIPTION: Walk a byte list to determine if it consists of a valid set
+ * of resource descriptors. Nothing is output.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmIsResourceDescriptor (
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT8 *ByteData;
+ UINT32 ByteCount;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NATIVE_UINT CurrentByteOffset;
+ UINT8 CurrentByte;
+ UINT8 DescriptorId;
+ UINT32 Length;
+
+
+ /* This op must be a buffer */
+
+ if (Op->Common.AmlOpcode != AML_BUFFER_OP)
+ {
+ return FALSE;
+ }
+
+ /* Get to the ByteData list */
+
+ NextOp = Op->Common.Value.Arg;
+ NextOp = NextOp->Common.Next;
+ if (!NextOp)
+ {
+ return (FALSE);
+ }
+
+ /* Extract the data pointer and data length */
+
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
+ ByteData = NextOp->Named.Data;
+
+ /* The list must have a valid END_TAG */
+
+ if (ByteData[ByteCount-2] != (ACPI_RDESC_TYPE_END_TAG | 1))
+ {
+ return FALSE;
+ }
+
+ /*
+ * Walk the byte list. Abort on any invalid descriptor ID or
+ * or length
+ */
+ for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
+ {
+ CurrentByte = ByteData[CurrentByteOffset];
+
+ /* Large or small resource? */
+
+ if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
+ {
+ DescriptorId = CurrentByte;
+ Length = (* (ACPI_CAST_PTR (UINT16, (&ByteData[CurrentByteOffset + 1]))));
+ CurrentByteOffset += 3;
+ }
+ else
+ {
+ DescriptorId = (UINT8) (CurrentByte & 0xF8);
+ Length = (ByteData[CurrentByteOffset] & 0x7);
+ CurrentByteOffset += 1;
+ }
+
+ CurrentByteOffset += (ACPI_NATIVE_UINT) Length;
+
+ /* Determine type of resource */
+
+ switch (DescriptorId)
+ {
+ /*
+ * "Small" type descriptors
+ */
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
+ case ACPI_RDESC_TYPE_IO_PORT:
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ /*
+ * "Large" type descriptors
+ */
+ case ACPI_RDESC_TYPE_MEMORY_24:
+ case ACPI_RDESC_TYPE_GENERAL_REGISTER:
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
+ case ACPI_RDESC_TYPE_MEMORY_32:
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+
+ /* Valid descriptor ID, keep going */
+
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_TAG:
+
+ /* We must be at the end of the ByteList */
+
+ if (CurrentByteOffset != ByteCount)
+ {
+ return (FALSE);
+ }
+
+ /* All descriptors/lengths valid, this is a valid descriptor */
+
+ return (TRUE);
+
+
+ default:
+
+ /* Bad descriptor, abort */
+
+ return (FALSE);
+ }
+ }
+
+ /* Did not find an END_TAG, something seriously wrong */
+
+ return (FALSE);
+}
+
+
+#endif
diff --git a/sys/contrib/dev/acpica/dmresrcl.c b/sys/contrib/dev/acpica/dmresrcl.c
new file mode 100644
index 0000000..34993ed
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmresrcl.c
@@ -0,0 +1,619 @@
+/*******************************************************************************
+ *
+ * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
+ * $Revision: 10 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbresrcl")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIoFlags
+ *
+ * PARAMETERS: Flags - Flag byte to be decoded
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode the flags specific to IO Address space descriptors
+ *
+ ******************************************************************************/
+
+void
+AcpiDmIoFlags (
+ UINT8 Flags)
+{
+ AcpiOsPrintf ("%s, %s, %s, %s,",
+ AcpiGbl_ConsumeDecode [(Flags & 1)],
+ AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
+ AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
+ AcpiGbl_DECDecode [(Flags & 0x2) >> 1]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMemoryFlags
+ *
+ * PARAMETERS: Flags - Flag byte to be decoded
+ * SpecificFlags - "Specific" flag byte to be decoded
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMemoryFlags (
+ UINT8 Flags,
+ UINT8 SpecificFlags)
+{
+ AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
+ AcpiGbl_ConsumeDecode [(Flags & 1)],
+ AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
+ AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
+ AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
+ AcpiGbl_MEMDecode [(SpecificFlags & 0x6) >> 1],
+ AcpiGbl_RWDecode [(SpecificFlags & 0x1)]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmWordDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Word Address Space descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmWordDescriptor (
+ ASL_WORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("%s (",
+ AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+
+ AcpiDmIoFlags (Resource->Flags);
+
+ if ((Resource->ResourceType & 0x3) == 1)
+ {
+ AcpiOsPrintf (" %s,",
+ AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
+ }
+
+ /* The WORD values */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X,\n",
+ (UINT32) Resource->Granularity);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X,\n",
+ (UINT32) Resource->AddressMin);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X,\n",
+ (UINT32) Resource->AddressMax);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X,\n",
+ (UINT32) Resource->TranslationOffset);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X",
+ (UINT32) Resource->AddressLength);
+
+ /* Optional fields */
+
+ if (Length > 13)
+ {
+ AcpiOsPrintf (", 0x%2.2X",
+ (UINT32) Resource->OptionalFields[0]);
+ }
+
+ if (Length > 14)
+ {
+ AcpiOsPrintf (", %s",
+ &Resource->OptionalFields[1]);
+ }
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDwordDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a DWord Address Space descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDwordDescriptor (
+ ASL_DWORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("D%s (",
+ AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+
+ if ((Resource->ResourceType & 0x3) == 1)
+ {
+ AcpiDmIoFlags (Resource->Flags);
+ AcpiOsPrintf (" %s,",
+ AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
+ }
+ else
+ {
+ AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
+ }
+
+ /* The DWORD values */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X,\n",
+ Resource->Granularity);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X,\n",
+ Resource->AddressMin);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X,\n",
+ Resource->AddressMax);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X,\n",
+ Resource->TranslationOffset);
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X",
+ Resource->AddressLength);
+
+ /* Optional fields */
+
+ if (Length > 23)
+ {
+ AcpiOsPrintf (", 0x%2.2X",
+ Resource->OptionalFields[0]);
+ }
+ if (Length > 24)
+ {
+ AcpiOsPrintf (", %s",
+ &Resource->OptionalFields[1]);
+ }
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmQwordDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a QWord Address Space descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmQwordDescriptor (
+ ASL_QWORD_ADDRESS_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Q%s (",
+ AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+
+ if ((Resource->ResourceType & 0x3) == 1)
+ {
+ AcpiDmIoFlags (Resource->Flags);
+ AcpiOsPrintf (" %s,",
+ AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
+ }
+ else
+ {
+ AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
+ }
+
+ /* The QWORD values */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X%8.8X,\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Granularity)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Granularity)));
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X%8.8X,\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMin)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMin)));
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X%8.8X,\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMax)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMax)));
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X%8.8X,\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset)));
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X%8.8X",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressLength)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressLength)));
+
+ /* Optional fields */
+
+ if (Length > 43)
+ {
+ AcpiOsPrintf (", 0x%2.2X",
+ Resource->OptionalFields[0]);
+ }
+ if (Length > 44)
+ {
+ AcpiOsPrintf (", %s",
+ &Resource->OptionalFields[1]);
+ }
+
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMemory24Descriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Memory24 descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMemory24Descriptor (
+ ASL_MEMORY_24_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Memory24 (%s, 0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X)\n",
+ AcpiGbl_RWDecode [Resource->Information & 1],
+ (UINT32) Resource->AddressMin,
+ (UINT32) Resource->AddressMax,
+ (UINT32) Resource->Alignment,
+ (UINT32) Resource->RangeLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMemory32Descriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Memory32 descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmMemory32Descriptor (
+ ASL_MEMORY_32_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Memory32 (%s, 0x%8.8X, 0x%8.8X, 0x%8.8X, 0x%8.8X)\n",
+ AcpiGbl_RWDecode [Resource->Information & 1],
+ Resource->AddressMin,
+ Resource->AddressMax,
+ Resource->Alignment,
+ Resource->RangeLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFixedMem32Descriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Fixed Memory32 descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFixedMem32Descriptor (
+ ASL_FIXED_MEMORY_32_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Memory32Fixed (%s, 0x%8.8X, 0x%8.8X)\n",
+ AcpiGbl_RWDecode [Resource->Information & 1],
+ Resource->BaseAddress,
+ Resource->RangeLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGenericRegisterDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Generic Register descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmGenericRegisterDescriptor (
+ ASL_GENERAL_REGISTER_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Register (");
+
+ AcpiDmAddressSpace (Resource->AddressSpaceId);
+
+ AcpiOsPrintf ("0x%2.2X, 0x%2.2X, 0x%8.8X%8.8X)\n",
+ (UINT32) Resource->BitWidth,
+ (UINT32) Resource->BitOffset,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Address)));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmInterruptDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a extended Interrupt descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmInterruptDescriptor (
+ ASL_EXTENDED_XRUPT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT32 i;
+ UINT8 *Rover;
+
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Interrupt (%s, %s, %s, %s",
+ AcpiGbl_ConsumeDecode [(Resource->Flags & 1)],
+ AcpiGbl_HEDecode [(Resource->Flags >> 1) & 1],
+ AcpiGbl_LLDecode [(Resource->Flags >> 2) & 1],
+ AcpiGbl_SHRDecode [(Resource->Flags >> 3) & 1]);
+
+ /* Resource Index/Source, optional -- at end of descriptor */
+
+ if (Resource->Length > (UINT16) (4 * Resource->TableLength) + 2)
+ {
+ /* Get a pointer past the interrupt values */
+
+ Rover = ((UINT8 *) Resource) + ((4 * Resource->TableLength) + 5);
+
+ /* Resource Index */
+ /* Resource Source */
+
+ AcpiOsPrintf (", 0x%X, \"%s\"", (UINT32) Rover[0], (char *) &Rover[1]);
+ }
+
+ AcpiOsPrintf (")\n");
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("{\n");
+ for (i = 0; i < Resource->TableLength; i++)
+ {
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%8.8X,\n", (UINT32) Resource->InterruptNumber[i]);
+ }
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmVendorLargeDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Vendor Large descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmVendorLargeDescriptor (
+ ASL_LARGE_VENDOR_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("VendorLong ()\n");
+ AcpiDmIndent (Level);
+
+ AcpiOsPrintf ("{\n");
+
+ AcpiDmDisasmByteList (Level + 1, (UINT8 *) Resource->VendorDefined, Length);
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}\n");
+}
+
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/dmresrcs.c b/sys/contrib/dev/acpica/dmresrcs.c
new file mode 100644
index 0000000..3c12a37
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmresrcs.c
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ *
+ * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
+ * $Revision: 4 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbresrcs")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIrqDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a IRQ descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmIrqDescriptor (
+ ASL_IRQ_FORMAT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("%s (",
+ AcpiGbl_IrqDecode [Length & 1]);
+
+ if (Length & 1)
+ {
+ AcpiOsPrintf ("%s, %s, %s",
+ AcpiGbl_HEDecode [Resource->Flags & 1],
+ AcpiGbl_LLDecode [(Resource->Flags >> 3) & 1],
+ AcpiGbl_SHRDecode [(Resource->Flags >> 4) & 1]);
+ }
+
+ AcpiDmBitList (Resource->IrqMask);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDmaDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a DMA descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDmaDescriptor (
+ ASL_DMA_FORMAT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("DMA (%s, %s, %s",
+ AcpiGbl_TYPDecode [(Resource->Flags >> 5) & 3],
+ AcpiGbl_BMDecode [(Resource->Flags >> 2) & 1],
+ AcpiGbl_SIZDecode [(Resource->Flags >> 0) & 3]);
+
+ AcpiDmBitList (Resource->DmaChannelMask);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIoDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode an IO descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmIoDescriptor (
+ ASL_IO_PORT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("IO (%s, 0x%4.4X, 0x%4.4X, 0x%2.2X, 0x%2.2X)\n",
+ AcpiGbl_IoDecode [(Resource->Information & 1)],
+ (UINT32) Resource->AddressMin,
+ (UINT32) Resource->AddressMax,
+ (UINT32) Resource->Alignment,
+ (UINT32) Resource->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFixedIoDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Fixed IO descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFixedIoDescriptor (
+ ASL_FIXED_IO_PORT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("FixedIO (0x%4.4X, 0x%2.2X)\n",
+ (UINT32) Resource->BaseAddress,
+ (UINT32) Resource->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmStartDependentDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Start Dependendent functions descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmStartDependentDescriptor (
+ ASL_START_DEPENDENT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+
+ if (Length & 1)
+ {
+ AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
+ (UINT32) Resource->Flags & 3,
+ (UINT32) (Resource->Flags >> 2) & 3);
+ }
+ else
+ {
+ AcpiOsPrintf ("StartDependentFnNoPri ()\n");
+ }
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("{\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmEndDependentDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode an End Dependent functions descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmEndDependentDescriptor (
+ ASL_START_DEPENDENT_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}\n");
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("EndDependentFn ()\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmVendorSmallDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Vendor Small Descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmVendorSmallDescriptor (
+ ASL_SMALL_VENDOR_DESC *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("VendorShort () {");
+
+ AcpiDmDisasmByteList (0, (UINT8 *) Resource->VendorDefined, Length);
+ AcpiOsPrintf ("}\n");
+}
+
+#endif
+
+
diff --git a/sys/contrib/dev/acpica/dmutils.c b/sys/contrib/dev/acpica/dmutils.c
new file mode 100644
index 0000000..02d2072
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmutils.c
@@ -0,0 +1,464 @@
+/*******************************************************************************
+ *
+ * Module Name: dmutils - AML disassembler utilities
+ * $Revision: 8 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmutils")
+
+
+/* Data used in keeping track of fields */
+#if 0
+const char *AcpiGbl_FENames[ACPI_NUM_FIELD_NAMES] =
+{
+ "skip",
+ "?access?"
+}; /* FE = Field Element */
+#endif
+
+
+const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS] =
+{
+ "MTR",
+ "MEQ",
+ "MLE",
+ "MLT",
+ "MGE",
+ "MGT"
+};
+
+
+/* Access type decoding */
+
+const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES] =
+{
+ "AnyAcc",
+ "ByteAcc",
+ "WordAcc",
+ "DWordAcc",
+ "QWordAcc",
+ "BufferAcc",
+};
+
+
+/* Lock rule decoding */
+
+const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES] =
+{
+ "NoLock",
+ "Lock"
+};
+
+/* Update rule decoding */
+
+const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES] =
+{
+ "Preserve",
+ "WriteAsOnes",
+ "WriteAsZeros"
+};
+
+/*
+ * Strings used to decode resource descriptors
+ */
+const char *AcpiGbl_IoDecode[2] =
+{
+ "Decode10",
+ "Decode16"
+};
+
+const char *AcpiGbl_WordDecode[4] =
+{
+ "WordMemory",
+ "WordIO",
+ "WordBusNumber",
+ "Unknown-resource-type"
+};
+
+const char *AcpiGbl_ConsumeDecode[2] =
+{
+ "ResourceProducer",
+ "ResourceConsumer"
+};
+
+const char *AcpiGbl_MinDecode[2] =
+{
+ "MinNotFixed",
+ "MinFixed"
+};
+
+const char *AcpiGbl_MaxDecode[2] =
+{
+ "MaxNotFixed",
+ "MaxFixed"
+};
+
+const char *AcpiGbl_DECDecode[2] =
+{
+ "PosDecode",
+ "SubDecode"
+};
+
+const char *AcpiGbl_RNGDecode[4] =
+{
+ "InvalidRanges",
+ "NonISAOnlyRanges",
+ "ISAOnlyRanges",
+ "EntireRange"
+};
+
+const char *AcpiGbl_MEMDecode[4] =
+{
+ "NonCacheable",
+ "Cacheable",
+ "WriteCombining",
+ "Prefetchable"
+};
+
+const char *AcpiGbl_RWDecode[2] =
+{
+ "ReadOnly",
+ "ReadWrite"
+};
+
+const char *AcpiGbl_IrqDecode[2] =
+{
+ "IRQNoFlags",
+ "IRQ"
+};
+
+const char *AcpiGbl_HEDecode[2] =
+{
+ "Level",
+ "Edge"
+};
+
+const char *AcpiGbl_LLDecode[2] =
+{
+ "ActiveHigh",
+ "ActiveLow"
+};
+
+const char *AcpiGbl_SHRDecode[2] =
+{
+ "Exclusive",
+ "Shared"
+};
+
+const char *AcpiGbl_TYPDecode[4] =
+{
+ "Compatibility",
+ "TypeA",
+ "TypeB",
+ "TypeF"
+};
+
+const char *AcpiGbl_BMDecode[2] =
+{
+ "NotBusMaster",
+ "BusMaster"
+};
+
+const char *AcpiGbl_SIZDecode[4] =
+{
+ "Transfer8",
+ "Transfer8_16",
+ "Transfer16",
+ "InvalidSize"
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDecodeAttribute
+ *
+ * PARAMETERS: Attribute - Attribute field of AccessAs keyword
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus stuff)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDecodeAttribute (
+ UINT8 Attribute)
+{
+
+ switch (Attribute)
+ {
+ case AML_FIELD_ATTRIB_SMB_QUICK:
+
+ AcpiOsPrintf ("SMBQuick");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_SEND_RCV:
+
+ AcpiOsPrintf ("SMBSendReceive");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_BYTE:
+
+ AcpiOsPrintf ("SMBByte");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_WORD:
+
+ AcpiOsPrintf ("SMBWord");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_WORD_CALL:
+
+ AcpiOsPrintf ("SMBProcessCall");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_BLOCK:
+
+ AcpiOsPrintf ("SMBBlock");
+ break;
+
+ case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
+
+ AcpiOsPrintf ("SMBBlockProcessCall");
+ break;
+
+ default:
+
+ AcpiOsPrintf ("0x%.2X", Attribute);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIndent
+ *
+ * PARAMETERS: Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Indent 4 spaces per indentation level.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmIndent (
+ UINT32 Level)
+{
+
+ if (!Level)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " ");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCommaIfListMember
+ *
+ * PARAMETERS: Op - Current operator/operand
+ *
+ * RETURN: TRUE if a comma was inserted
+ *
+ * DESCRIPTION: Insert a comma if this Op is a member of an argument list.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmCommaIfListMember (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if (!Op->Common.Next)
+ {
+ return FALSE;
+ }
+
+ if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
+ {
+ /* Check for a NULL target operand */
+
+ if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ (!Op->Common.Next->Common.Value.String))
+ {
+ /*
+ * To handle the Divide() case where there are two optional
+ * targets, look ahead one more op. If null, this null target
+ * is the one and only target -- no comma needed. Otherwise,
+ * we need a comma to prepare for the next target.
+ */
+ if (!Op->Common.Next->Common.Next)
+ {
+ return FALSE;
+ }
+ }
+
+ if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
+ (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
+ {
+ return FALSE;
+ }
+
+ AcpiOsPrintf (", ");
+ return (TRUE);
+ }
+
+ else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
+ (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ {
+ AcpiOsPrintf (", ");
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCommaIfFieldMember
+ *
+ * PARAMETERS: Op - Current operator/operand
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert a comma if this Op is a member of a Field argument list.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCommaIfFieldMember (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if (Op->Common.Next)
+ {
+ AcpiOsPrintf (", ");
+ }
+}
+
+
+#endif
diff --git a/sys/contrib/dev/acpica/dmwalk.c b/sys/contrib/dev/acpica/dmwalk.c
new file mode 100644
index 0000000..23dec95
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmwalk.c
@@ -0,0 +1,917 @@
+/*******************************************************************************
+ *
+ * Module Name: dmwalk - AML disassembly tree walk
+ * $Revision: 10 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdisasm.h"
+#include "acdebug.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmwalk")
+
+
+#define DB_FULL_OP_INFO "%5.5X #%4.4hX "
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisassemble
+ *
+ * PARAMETERS: Origin - Starting object
+ * NumOpcodes - Max number of opcodes to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disassemble parser object and its children. This is the
+ * main entry point of the disassembler.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisassemble (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Origin,
+ UINT32 NumOpcodes)
+{
+ ACPI_PARSE_OBJECT *Op = Origin;
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Op)
+ {
+ return;
+ }
+
+ Info.Level = 0;
+ AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmWalkParseTree
+ *
+ * PARAMETERS: DescendingCallback - Called during tree descent
+ * AscendingCallback - Called during tree ascent
+ * Context - To be passed to the callbacks
+ *
+ * RETURN: Status from callback(s)
+ *
+ * DESCRIPTION: Walk the entire parse tree.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context)
+{
+ BOOLEAN NodePreviouslyVisited;
+ ACPI_PARSE_OBJECT *StartOp = Op;
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_OP_WALK_INFO *Info = Context;
+
+
+ Info->Level = 0;
+ NodePreviouslyVisited = FALSE;
+
+ while (Op)
+ {
+ if (NodePreviouslyVisited)
+ {
+ Status = AscendingCallback (Op, Info->Level, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+ }
+ else
+ {
+ /* Let the callback process the node */
+
+ Status = DescendingCallback (Op, Info->Level, Context);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Visit children first, once */
+
+ Next = AcpiPsGetArg (Op, 0);
+ if (Next)
+ {
+ Info->Level++;
+ Op = Next;
+ continue;
+ }
+ }
+ else if (Status != AE_CTRL_DEPTH)
+ {
+ /* Exit immediately on any error */
+
+ return;
+ }
+ }
+
+ /* Terminate walk at start op */
+
+ if (Op == StartOp)
+ {
+ break;
+ }
+
+ /* No more children, re-visit this node */
+
+ if (!NodePreviouslyVisited)
+ {
+ NodePreviouslyVisited = TRUE;
+ continue;
+ }
+
+ /* No more children, visit peers */
+
+ if (Op->Common.Next)
+ {
+ Op = Op->Common.Next;
+ NodePreviouslyVisited = FALSE;
+ }
+ else
+ {
+ /* No peers, re-visit parent */
+
+ if (Info->Level != 0 )
+ {
+ Info->Level--;
+ }
+
+ Op = Op->Common.Parent;
+ NodePreviouslyVisited = TRUE;
+ }
+ }
+
+ /* If we get here, the walk completed with no errors */
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmBlockType
+ *
+ * PARAMETERS: Op - Object to be examined
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Type of block for this op (parens or braces)
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmBlockType (
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ if (!Op)
+ {
+ return (BLOCK_NONE);
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_ELSE_OP:
+
+ return (BLOCK_BRACE);
+
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_SCOPE_OP:
+ case AML_PROCESSOR_OP:
+ case AML_POWER_RES_OP:
+ case AML_THERMAL_ZONE_OP:
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+
+ return (BLOCK_PAREN | BLOCK_BRACE);
+
+ case AML_BUFFER_OP:
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE)
+ {
+ return (BLOCK_NONE);
+ }
+
+ /*lint -fallthrough */
+
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ return (BLOCK_PAREN | BLOCK_BRACE);
+
+ case AML_EVENT_OP:
+
+ return (BLOCK_PAREN);
+
+ default:
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Flags & AML_HAS_ARGS)
+ {
+ return (BLOCK_PAREN);
+ }
+
+ return (BLOCK_NONE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmListType
+ *
+ * PARAMETERS: Op - Object to be examined
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Type of block for this op (parens or braces)
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmListType (
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ if (!Op)
+ {
+ return (BLOCK_NONE);
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+
+ case AML_ELSE_OP:
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_SCOPE_OP:
+ case AML_POWER_RES_OP:
+ case AML_PROCESSOR_OP:
+ case AML_THERMAL_ZONE_OP:
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+
+ return (0);
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ return (BLOCK_COMMA_LIST);
+
+ default:
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Flags & AML_HAS_ARGS)
+ {
+ return (BLOCK_COMMA_LIST);
+ }
+
+ return (BLOCK_NONE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: First visitation of a parse object during tree descent.
+ * Decode opcode name and begin parameter list(s), if any.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDmDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 Name;
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
+ {
+ /* Ignore this op -- it was handled elsewhere */
+
+ return (AE_CTRL_DEPTH);
+ }
+
+
+ if (Level == 0)
+ {
+ /* In verbose mode, print the AML offset, opcode and depth count */
+
+ VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset,
+ Op->Common.AmlOpcode));
+
+ if (Op->Common.AmlOpcode == AML_SCOPE_OP)
+ {
+ AcpiOsPrintf ("{\n");
+ return (AE_OK);
+ }
+ }
+ else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ {
+ /* This is a first-level element of a term list, indent a new line */
+
+ AcpiDmIndent (Level);
+ }
+
+ /* Print the opcode name */
+
+ AcpiDmDisassembleOneOp (NULL, Info, Op);
+
+ if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
+ (Op->Common.AmlOpcode == AML_RETURN_OP))
+ {
+ Info->Level--;
+ }
+
+ /* Start the opcode argument list if necessary */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ if ((OpInfo->Flags & AML_HAS_ARGS) ||
+ (Op->Common.AmlOpcode == AML_EVENT_OP))
+ {
+ /* This opcode has an argument list */
+
+ if (AcpiDmBlockType (Op) & BLOCK_PAREN)
+ {
+ AcpiOsPrintf (" (");
+ }
+
+ /* If this is a named opcode, print the associated name value */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_ALIAS_OP:
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ AcpiDmNamestring (NextOp->Common.Value.Name);
+ AcpiOsPrintf (", ");
+
+ /*lint -fallthrough */
+
+ default:
+
+ Name = AcpiPsGetName (Op);
+ if (Op->Named.Path)
+ {
+ AcpiDmNamestring ((char *) Op->Named.Path);
+ }
+ else
+ {
+ AcpiDmDumpName ((char *) &Name);
+ }
+
+
+ if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
+ {
+ AcpiDmValidateName ((char *) &Name, Op);
+ if (AcpiGbl_DbOpt_verbose)
+ {
+ (void) AcpiPsDisplayObjectPathname (NULL, Op);
+ }
+ }
+ break;
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+
+ AcpiDmMethodFlags (Op);
+ AcpiOsPrintf (")");
+ break;
+
+
+ case AML_NAME_OP:
+
+ /* Check for _HID and related EISAID() */
+
+ AcpiIsEisaId (Op);
+ AcpiOsPrintf (", ");
+ break;
+
+
+ case AML_REGION_OP:
+
+ AcpiDmRegionFlags (Op);
+ break;
+
+
+ case AML_POWER_RES_OP:
+
+ /* Mark the next two Ops as part of the parameter list */
+
+ AcpiOsPrintf (", ");
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+
+ NextOp = NextOp->Common.Next;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ return (AE_OK);
+
+
+ case AML_PROCESSOR_OP:
+
+ /* Mark the next three Ops as part of the parameter list */
+
+ AcpiOsPrintf (", ");
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+
+ NextOp = NextOp->Common.Next;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+
+ NextOp = NextOp->Common.Next;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ return (AE_OK);
+
+
+ case AML_MUTEX_OP:
+
+ AcpiOsPrintf (", ");
+ return (AE_OK);
+
+
+ case AML_EVENT_OP:
+ case AML_ALIAS_OP:
+
+ return (AE_OK);
+
+
+ case AML_SCOPE_OP:
+ case AML_DEVICE_OP:
+ case AML_THERMAL_ZONE_OP:
+
+ AcpiOsPrintf (")");
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("*** Unhandled named opcode\n");
+ break;
+ }
+ }
+
+ else switch (Op->Common.AmlOpcode)
+ {
+ case AML_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+
+ Info->BitOffset = 0;
+
+ /* Name of the parent OperationRegion */
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ AcpiDmNamestring (NextOp->Common.Value.Name);
+ AcpiOsPrintf (", ");
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BANK_FIELD_OP:
+
+ /* Namestring */
+
+ NextOp = AcpiPsGetDepthNext (NULL, NextOp);
+ AcpiDmNamestring (NextOp->Common.Value.Name);
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ AcpiOsPrintf (", ");
+
+
+ NextOp = NextOp->Common.Next;
+ AcpiDmDisassembleOneOp (NULL, Info, NextOp);
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ AcpiOsPrintf (", ");
+ break;
+
+ case AML_INDEX_FIELD_OP:
+
+ /* Namestring */
+
+ NextOp = AcpiPsGetDepthNext (NULL, NextOp);
+ AcpiDmNamestring (NextOp->Common.Value.Name);
+ AcpiOsPrintf (", ");
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ break;
+
+ default:
+
+ break;
+ }
+
+ AcpiDmFieldFlags (NextOp);
+ break;
+
+
+ case AML_BUFFER_OP:
+
+ /* The next op is the size parameter */
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ if (!NextOp)
+ {
+ /* Single-step support */
+
+ return (AE_OK);
+ }
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
+ {
+ /*
+ * We have a resource list. Don't need to output
+ * the buffer size Op. Open up a new block
+ */
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ NextOp = NextOp->Common.Next;
+ AcpiOsPrintf (")\n");
+ AcpiDmIndent (Info->Level);
+ AcpiOsPrintf ("{\n");
+ return (AE_OK);
+ }
+
+ /* Normal Buffer, mark size as in the parameter list */
+
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ return (AE_OK);
+
+
+ case AML_VAR_PACKAGE_OP:
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+
+ /* The next op is the size or predicate parameter */
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ if (NextOp)
+ {
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ }
+ return (AE_OK);
+
+
+ case AML_PACKAGE_OP:
+
+ /* The next op is the size or predicate parameter */
+
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ if (NextOp)
+ {
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ }
+ return (AE_OK);
+
+
+ case AML_MATCH_OP:
+
+ AcpiDmMatchOp (Op);
+ break;
+
+
+ default:
+
+ break;
+ }
+
+ if (AcpiDmBlockType (Op) & BLOCK_BRACE)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("{\n");
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAscendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Second visitation of a parse object, during ascent of parse
+ * tree. Close out any parameter lists and complete the opcode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDmAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+
+
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
+ {
+ /* Ignore this op -- it was handled elsewhere */
+
+ return (AE_OK);
+ }
+
+ if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
+ {
+ /* Indicates the end of the current descriptor block (table) */
+
+ AcpiOsPrintf ("}\n\n");
+ return (AE_OK);
+ }
+
+ switch (AcpiDmBlockType (Op))
+ {
+ case BLOCK_PAREN:
+
+ /* Completed an op that has arguments, add closing paren */
+
+ AcpiOsPrintf (")");
+
+ /* Could be a nested operator, check if comma required */
+
+ if (!AcpiDmCommaIfListMember (Op))
+ {
+ if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ {
+ /* This is a first-level element of a term list, start a new line */
+
+ AcpiOsPrintf ("\n");
+ }
+ }
+ break;
+
+
+ case BLOCK_BRACE:
+ case (BLOCK_BRACE | BLOCK_PAREN):
+
+ /* Completed an op that has a term list, add closing brace */
+
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
+ {
+ AcpiOsPrintf ("}");
+ }
+ else
+ {
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("}");
+ }
+
+ AcpiDmCommaIfListMember (Op);
+
+ if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
+ {
+ AcpiOsPrintf ("\n");
+ if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
+ {
+ if ((Op->Common.AmlOpcode == AML_IF_OP) &&
+ (Op->Common.Next) &&
+ (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
+ {
+ break;
+ }
+
+ if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
+ (!Op->Common.Next))
+ {
+ break;
+ }
+ AcpiOsPrintf ("\n");
+ }
+ }
+ break;
+
+
+ case BLOCK_NONE:
+ default:
+
+ /* Could be a nested operator, check if comma required */
+
+ if (!AcpiDmCommaIfListMember (Op))
+ {
+ if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ {
+ /* This is a first-level element of a term list, start a new line */
+
+ AcpiOsPrintf ("\n");
+ }
+ }
+ else if (Op->Common.Parent)
+ {
+ switch (Op->Common.Parent->Common.AmlOpcode)
+ {
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ {
+ AcpiOsPrintf ("\n");
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ break;
+ }
+
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
+ {
+ if ((Op->Common.Next) &&
+ (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Just completed a parameter node for something like "Buffer (param)".
+ * Close the paren and open up the term list block with a brace
+ */
+ if (Op->Common.Next)
+ {
+ AcpiOsPrintf (")\n");
+ AcpiDmIndent (Level - 1);
+ AcpiOsPrintf ("{\n");
+ }
+ else
+ {
+ Op->Common.Parent->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
+ AcpiOsPrintf (") {");
+ }
+ }
+
+ if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
+ (Op->Common.AmlOpcode == AML_RETURN_OP))
+ {
+ Info->Level++;
+ }
+ return (AE_OK);
+}
+
+
+#endif /* ACPI_DISASSEMBLER */
diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c
new file mode 100644
index 0000000..aef5bc2
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsfield.c
@@ -0,0 +1,698 @@
+/******************************************************************************
+ *
+ * Module Name: dsfield - Dispatcher field routines
+ * $Revision: 72 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSFIELD_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acparser.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsfield")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateBufferField
+ *
+ * PARAMETERS: Opcode - The opcode to be executed
+ * Operands - List of operands for the opcode
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute the CreateField operators:
+ * CreateBitFieldOp,
+ * CreateByteFieldOp,
+ * CreateWordFieldOp,
+ * CreateDWordFieldOp,
+ * CreateQWordFieldOp,
+ * CreateFieldOp (all of which define fields in buffers)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateBufferField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *SecondDesc = NULL;
+ UINT32 Flags;
+
+
+ ACPI_FUNCTION_TRACE ("DsCreateBufferField");
+
+
+ /* Get the NameString argument */
+
+ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ Arg = AcpiPsGetArg (Op, 3);
+ }
+ else
+ {
+ /* Create Bit/Byte/Word/Dword field */
+
+ Arg = AcpiPsGetArg (Op, 2);
+ }
+
+ if (!Arg)
+ {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /*
+ * During the load phase, we want to enter the name of the field into
+ * the namespace. During the execute phase (when we evaluate the size
+ * operand), we want to lookup the name
+ */
+ if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE)
+ {
+ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
+ }
+ else
+ {
+ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND;
+ }
+
+ /*
+ * Enter the NameString into the namespace
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
+ Flags, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* We could put the returned object (Node) on the object stack for later, but
+ * for now, we will put it in the "op" object that the parser uses, so we
+ * can get it again at the end of this scope
+ */
+ Op->Common.Node = Node;
+
+ /*
+ * If there is no object attached to the node, this node was just created and
+ * we need to create the field object. Otherwise, this was a lookup of an
+ * existing node and we don't want to create the field object again.
+ */
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * The Field definition is not fully parsed at this time.
+ * (We must save the address of the AML for the buffer and index operands)
+ */
+
+ /* Create the buffer field object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Remember location in AML stream of the field unit
+ * opcode and operands -- since the buffer and index
+ * operands must be evaluated.
+ */
+ SecondDesc = ObjDesc->Common.NextObject;
+ SecondDesc->Extra.AmlStart = Op->Named.Data;
+ SecondDesc->Extra.AmlLength = Op->Named.Length;
+ ObjDesc->BufferField.Node = Node;
+
+ /* Attach constructed field descriptors to parent node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+
+Cleanup:
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetFieldNames
+ *
+ * PARAMETERS: Info - CreateField info structure
+ * ` WalkState - Current method state
+ * Arg - First parser arg for the field name list
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Process all named fields in a field declaration. Names are
+ * entered into the namespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetFieldNames (
+ ACPI_CREATE_FIELD_INFO *Info,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Arg)
+{
+ ACPI_STATUS Status;
+ ACPI_INTEGER Position;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
+
+
+ /* First field starts at bit zero */
+
+ Info->FieldBitPosition = 0;
+
+ /* Process all elements in the field list (of parse nodes) */
+
+ while (Arg)
+ {
+ /*
+ * Three types of field elements are handled:
+ * 1) Offset - specifies a bit offset
+ * 2) AccessAs - changes the access mode
+ * 3) Name - Enters a new named field into the namespace
+ */
+ switch (Arg->Common.AmlOpcode)
+ {
+ case AML_INT_RESERVEDFIELD_OP:
+
+ Position = (ACPI_INTEGER) Info->FieldBitPosition
+ + (ACPI_INTEGER) Arg->Common.Value.Size;
+
+ if (Position > ACPI_UINT32_MAX)
+ {
+ ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+ Info->FieldBitPosition = (UINT32) Position;
+ break;
+
+
+ case AML_INT_ACCESSFIELD_OP:
+
+ /*
+ * Get a new AccessType and AccessAttribute -- to be used for all
+ * field units that follow, until field end or another AccessAs keyword.
+ *
+ * In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits
+ */
+ Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
+ ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
+
+ Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
+ break;
+
+
+ case AML_INT_NAMEDFIELD_OP:
+
+ /* Lookup the name */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ (char *) &Arg->Named.Name,
+ Info->FieldType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Info->FieldNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ if (Status != AE_ALREADY_EXISTS)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Already exists, ignore error */
+ }
+ else
+ {
+ Arg->Common.Node = Info->FieldNode;
+ Info->FieldBitLength = Arg->Common.Value.Size;
+
+ /* Create and initialize an object for the new Field Node */
+
+ Status = AcpiExPrepFieldValue (Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Keep track of bit position for the next field */
+
+ Position = (ACPI_INTEGER) Info->FieldBitPosition
+ + (ACPI_INTEGER) Arg->Common.Value.Size;
+
+ if (Position > ACPI_UINT32_MAX)
+ {
+ ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
+ (char *) &Info->FieldNode->Name));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+ Info->FieldBitPosition += Info->FieldBitLength;
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
+ Arg->Common.AmlOpcode));
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+ }
+
+ Arg = Arg->Common.Next;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateField
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * RegionNode - Object for the containing Operation Region
+ * ` WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new field in the specified operation region
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_CREATE_FIELD_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op);
+
+
+ /* First arg is the name of the parent OpRegion (must already exist) */
+
+ Arg = Op->Common.Value.Arg;
+ if (!RegionNode)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Second arg is the field flags */
+
+ Arg = Arg->Common.Next;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
+ Info.Attribute = 0;
+
+ /* Each remaining arg is a Named Field */
+
+ Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD;
+ Info.RegionNode = RegionNode;
+
+ Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsInitFieldObjects
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * ` WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: For each "Field Unit" name in the argument list that is
+ * part of the field declaration, enter the name into the
+ * namespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitFieldObjects (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Arg = NULL;
+ ACPI_NAMESPACE_NODE *Node;
+ UINT8 Type = 0;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_FIELD_OP:
+ Arg = AcpiPsGetArg (Op, 2);
+ Type = ACPI_TYPE_LOCAL_REGION_FIELD;
+ break;
+
+ case AML_BANK_FIELD_OP:
+ Arg = AcpiPsGetArg (Op, 4);
+ Type = ACPI_TYPE_LOCAL_BANK_FIELD;
+ break;
+
+ case AML_INDEX_FIELD_OP:
+ Arg = AcpiPsGetArg (Op, 3);
+ Type = ACPI_TYPE_LOCAL_INDEX_FIELD;
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Walk the list of entries in the FieldList
+ */
+ while (Arg)
+ {
+ /* Ignore OFFSET and ACCESSAS terms here */
+
+ if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ (char *) &Arg->Named.Name,
+ Type, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
+ WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ if (Status != AE_ALREADY_EXISTS)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Name already exists, just ignore this error */
+
+ Status = AE_OK;
+ }
+
+ Arg->Common.Node = Node;
+ }
+
+ /* Move to next field in the list */
+
+ Arg = Arg->Common.Next;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateBankField
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * RegionNode - Object for the containing Operation Region
+ * ` WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new bank field in the specified operation region
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateBankField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_CREATE_FIELD_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
+
+
+ /* First arg is the name of the parent OpRegion (must already exist) */
+
+ Arg = Op->Common.Value.Arg;
+ if (!RegionNode)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Second arg is the Bank Register (Field) (must already exist) */
+
+ Arg = Arg->Common.Next;
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Third arg is the BankValue */
+
+ Arg = Arg->Common.Next;
+ Info.BankValue = (UINT32) Arg->Common.Value.Integer;
+
+ /* Fourth arg is the field flags */
+
+ Arg = Arg->Common.Next;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
+
+ /* Each remaining arg is a Named Field */
+
+ Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
+ Info.RegionNode = RegionNode;
+
+ Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateIndexField
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * RegionNode - Object for the containing Operation Region
+ * ` WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new index field in the specified operation region
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateIndexField (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *RegionNode,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_CREATE_FIELD_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
+
+
+ /* First arg is the name of the Index register (must already exist) */
+
+ Arg = Op->Common.Value.Arg;
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Second arg is the data register (must already exist) */
+
+ Arg = Arg->Common.Next;
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Next arg is the field flags */
+
+ Arg = Arg->Common.Next;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
+
+ /* Each remaining arg is a Named Field */
+
+ Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
+ Info.RegionNode = RegionNode;
+
+ Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dsinit.c b/sys/contrib/dev/acpica/dsinit.c
new file mode 100644
index 0000000..2045bf2
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsinit.c
@@ -0,0 +1,316 @@
+/******************************************************************************
+ *
+ * Module Name: dsinit - Object initialization namespace walk
+ * $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSINIT_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsinit")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsInitOneObject
+ *
+ * PARAMETERS: ObjHandle - Node
+ * Level - Current nesting level
+ * Context - Points to a init info struct
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
+ * within the namespace.
+ *
+ * Currently, the only objects that require initialization are:
+ * 1) Methods
+ * 2) Operation Regions
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OBJECT_TYPE Type;
+ ACPI_STATUS Status;
+ ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
+
+
+ ACPI_FUNCTION_NAME ("DsInitOneObject");
+
+
+ /*
+ * We are only interested in objects owned by the table that
+ * was just loaded
+ */
+ if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
+ Info->TableDesc->TableId)
+ {
+ return (AE_OK);
+ }
+
+ Info->ObjectCount++;
+
+ /* And even then, we are only interested in a few object types */
+
+ Type = AcpiNsGetType (ObjHandle);
+
+ switch (Type)
+ {
+ case ACPI_TYPE_REGION:
+
+ Status = AcpiDsInitializeRegion (ObjHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
+ ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii,
+ AcpiFormatException (Status)));
+ }
+
+ Info->OpRegionCount++;
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ Info->MethodCount++;
+
+ /* Print a dot for each method unless we are going to print the entire pathname */
+
+ if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ }
+
+ /*
+ * Set the execution data width (32 or 64) based upon the
+ * revision number of the parent ACPI table.
+ * TBD: This is really for possible future support of integer width
+ * on a per-table basis. Currently, we just use a global for the width.
+ */
+ if (Info->TableDesc->Pointer->Revision == 1)
+ {
+ ((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
+ }
+
+ /*
+ * Always parse methods to detect errors, we may delete
+ * the parse tree below
+ */
+ Status = AcpiDsParseMethod (ObjHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
+ ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii,
+ AcpiFormatException (Status)));
+
+ /* This parse failed, but we will continue parsing more methods */
+
+ break;
+ }
+
+ /*
+ * Delete the parse tree. We simple re-parse the method
+ * for every execution since there isn't much overhead
+ */
+ AcpiNsDeleteNamespaceSubtree (ObjHandle);
+ AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
+ break;
+
+
+ case ACPI_TYPE_DEVICE:
+
+ Info->DeviceCount++;
+ break;
+
+
+ default:
+ break;
+ }
+
+ /*
+ * We ignore errors from above, and always return OK, since
+ * we don't want to abort the walk on a single error.
+ */
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsInitializeObjects
+ *
+ * PARAMETERS: TableDesc - Descriptor for parent ACPI table
+ * StartNode - Root of subtree to be initialized.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
+ * necessary initialization on the objects found therein
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitializeObjects (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *StartNode)
+{
+ ACPI_STATUS Status;
+ ACPI_INIT_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE ("DsInitializeObjects");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "**** Starting initialization of namespace objects ****\n"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
+
+ Info.MethodCount = 0;
+ Info.OpRegionCount = 0;
+ Info.ObjectCount = 0;
+ Info.DeviceCount = 0;
+ Info.TableDesc = TableDesc;
+
+ /* Walk entire namespace from the supplied root */
+
+ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
+ AcpiDsInitOneObject, &Info, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n",
+ AcpiFormatException (Status)));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+ "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
+ TableDesc->Pointer->Signature, TableDesc->TableId, Info.ObjectCount,
+ Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c
new file mode 100644
index 0000000..83968c4
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsmethod.c
@@ -0,0 +1,651 @@
+/******************************************************************************
+ *
+ * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
+ * $Revision: 91 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSMETHOD_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsmethod")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsParseMethod
+ *
+ * PARAMETERS: ObjHandle - Node of the method
+ * Level - Current nesting level
+ * Context - Points to a method counter
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Call the parser and parse the AML that is
+ * associated with the method.
+ *
+ * MUTEX: Assumes parser is locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsParseMethod (
+ ACPI_HANDLE ObjHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OWNER_ID OwnerId;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle);
+
+
+ /* Parameter Validation */
+
+ if (!ObjHandle)
+ {
+ return_ACPI_STATUS (AE_NULL_ENTRY);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n",
+ ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle));
+
+ /* Extract the method object from the method Node */
+
+ Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Create a mutex for the method if there is a concurrency limit */
+
+ if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) &&
+ (!ObjDesc->Method.Semaphore))
+ {
+ Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency,
+ ObjDesc->Method.Concurrency,
+ &ObjDesc->Method.Semaphore);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Allocate a new parser op to be the root of the parsed
+ * method tree
+ */
+ Op = AcpiPsAllocOp (AML_METHOD_OP);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Init new op with the method name and pointer back to the Node */
+
+ AcpiPsSetName (Op, Node->Name.Integer);
+ Op->Common.Node = Node;
+
+ /*
+ * Get a new OwnerId for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ OwnerId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+ ObjDesc->Method.OwningId = OwnerId;
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength, NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Parse the method, first pass
+ *
+ * The first pass load is where newly declared named objects are
+ * added into the namespace. Actual evaluation of
+ * the named objects (what would be called a "second
+ * pass") happens during the actual execution of the
+ * method so that operands to the named objects can
+ * take on dynamic run-time values.
+ */
+ Status = AcpiPsParseAml (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
+ ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle, Op));
+
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsBeginMethodExecution
+ *
+ * PARAMETERS: MethodNode - Node of the method
+ * ObjDesc - The method object
+ * CallingMethodNode - Caller of this method (if non-null)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
+ * increments the thread count, and waits at the method semaphore
+ * for clearance to execute.
+ *
+ * MUTEX: Locks/unlocks parser.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsBeginMethodExecution (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_NAMESPACE_NODE *CallingMethodNode)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
+
+
+ if (!MethodNode)
+ {
+ return_ACPI_STATUS (AE_NULL_ENTRY);
+ }
+
+ /*
+ * If there is a concurrency limit on this method, we need to
+ * obtain a unit from the method semaphore.
+ */
+ if (ObjDesc->Method.Semaphore)
+ {
+ /*
+ * Allow recursive method calls, up to the reentrancy/concurrency
+ * limit imposed by the SERIALIZED rule and the SyncLevel method
+ * parameter.
+ *
+ * The point of this code is to avoid permanently blocking a
+ * thread that is making recursive method calls.
+ */
+ if (MethodNode == CallingMethodNode)
+ {
+ if (ObjDesc->Method.ThreadCount >= ObjDesc->Method.Concurrency)
+ {
+ return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+ }
+ }
+
+ /*
+ * Get a unit from the method semaphore. This releases the
+ * interpreter if we block
+ */
+ Status = AcpiExSystemWaitSemaphore (ObjDesc->Method.Semaphore,
+ ACPI_WAIT_FOREVER);
+ }
+
+ /*
+ * Increment the method parse tree thread count since it has been
+ * reentered one more time (even if it is the same thread)
+ */
+ ObjDesc->Method.ThreadCount++;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCallControlMethod
+ *
+ * PARAMETERS: WalkState - Current state of the walk
+ * Op - Current Op to be walked
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Transfer execution to a called control method
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCallControlMethod (
+ ACPI_THREAD_STATE *Thread,
+ ACPI_WALK_STATE *ThisWalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *MethodNode;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_WALK_STATE *NextWalkState;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
+ ThisWalkState->PrevOp, ThisWalkState));
+
+ /*
+ * Get the namespace entry for the control method we are about to call
+ */
+ MethodNode = ThisWalkState->MethodCallNode;
+ if (!MethodNode)
+ {
+ return_ACPI_STATUS (AE_NULL_ENTRY);
+ }
+
+ ObjDesc = AcpiNsGetAttachedObject (MethodNode);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+
+ /* Init for new method, wait on concurrency semaphore */
+
+ Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
+ ThisWalkState->MethodNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* 1) Parse: Create a new walk state for the preempting walk */
+
+ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ Op, ObjDesc, NULL);
+ if (!NextWalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Create and init a Root Node */
+
+ Op = AcpiPsCreateScopeOp ();
+ if (!Op)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
+ NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (NextWalkState);
+ goto Cleanup;
+ }
+
+ /* Begin AML parse */
+
+ Status = AcpiPsParseAml (NextWalkState);
+ AcpiPsDeleteParseTree (Op);
+
+ /* 2) Execute: Create a new state for the preempting walk */
+
+ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ NULL, ObjDesc, Thread);
+ if (!NextWalkState)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * The resolved arguments were put on the previous walk state's operand
+ * stack. Operands on the previous walk state stack always
+ * start at index 0.
+ * Null terminate the list of arguments
+ */
+ ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
+
+ Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
+ &ThisWalkState->Operands[0], NULL, 3);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Delete the operands on the previous walkstate operand stack
+ * (they were copied to new objects)
+ */
+ for (i = 0; i < ObjDesc->Method.ParamCount; i++)
+ {
+ AcpiUtRemoveReference (ThisWalkState->Operands [i]);
+ ThisWalkState->Operands [i] = NULL;
+ }
+
+ /* Clear the operand stack */
+
+ ThisWalkState->NumOperands = 0;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Starting nested execution, newstate=%p\n", NextWalkState));
+
+ return_ACPI_STATUS (AE_OK);
+
+
+ /* On error, we must delete the new walk state */
+
+Cleanup:
+ (void) AcpiDsTerminateControlMethod (NextWalkState);
+ AcpiDsDeleteWalkState (NextWalkState);
+ return_ACPI_STATUS (Status);
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsRestartControlMethod
+ *
+ * PARAMETERS: WalkState - State of the method when it was preempted
+ * Op - Pointer to new current op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Restart a method that was preempted
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsRestartControlMethod (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ReturnDesc)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
+
+
+ if (ReturnDesc)
+ {
+ if (WalkState->ReturnUsed)
+ {
+ /*
+ * Get the return value (if any) from the previous method.
+ * NULL if no return value
+ */
+ Status = AcpiDsResultPush (ReturnDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ /*
+ * Delete the return value if it will not be used by the
+ * calling method
+ */
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Method=%p Return=%p ReturnUsed?=%X ResStack=%p State=%p\n",
+ WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed,
+ WalkState->Results, WalkState));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsTerminateControlMethod
+ *
+ * PARAMETERS: WalkState - State of the method
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Terminate a control method. Delete everything that the method
+ * created, delete all locals and arguments, and delete the parse
+ * tree if requested.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsTerminateControlMethod (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *MethodNode;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
+
+
+ if (!WalkState)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* The current method object was saved in the walk state */
+
+ ObjDesc = WalkState->MethodDesc;
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Delete all arguments and locals */
+
+ AcpiDsMethodDataDeleteAll (WalkState);
+
+ /*
+ * Lock the parser while we terminate this method.
+ * If this is the last thread executing the method,
+ * we have additional cleanup to perform
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Signal completion of the execution of this method if necessary */
+
+ if (WalkState->MethodDesc->Method.Semaphore)
+ {
+ Status = AcpiOsSignalSemaphore (
+ WalkState->MethodDesc->Method.Semaphore, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
+ Status = AE_OK;
+
+ /* Ignore error and continue cleanup */
+ }
+ }
+
+ /* Decrement the thread count on the method parse tree */
+
+ WalkState->MethodDesc->Method.ThreadCount--;
+ if (!WalkState->MethodDesc->Method.ThreadCount)
+ {
+ /*
+ * There are no more threads executing this method. Perform
+ * additional cleanup.
+ *
+ * The method Node is stored in the walk state
+ */
+ MethodNode = WalkState->MethodNode;
+
+ /*
+ * Delete any namespace entries created immediately underneath
+ * the method
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (MethodNode->Child)
+ {
+ AcpiNsDeleteNamespaceSubtree (MethodNode);
+ }
+
+ /*
+ * Delete any namespace entries created anywhere else within
+ * the namespace
+ */
+ AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_PARSER);
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c
new file mode 100644
index 0000000..ed3d14e
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsmthdat.c
@@ -0,0 +1,787 @@
+/*******************************************************************************
+ *
+ * Module Name: dsmthdat - control method arguments and local variables
+ * $Revision: 71 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSMTHDAT_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsmthdat")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataInit
+ *
+ * PARAMETERS: WalkState - Current walk state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the data structures that hold the method's arguments
+ * and locals. The data struct is an array of NTEs for each.
+ * This allows RefOf and DeRefOf to work properly for these
+ * special data types.
+ *
+ * NOTES: WalkState fields are initialized to zero by the
+ * ACPI_MEM_CALLOCATE().
+ *
+ * A pseudo-Namespace Node is assigned to each argument and local
+ * so that RefOf() can return a pointer to the Node.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsMethodDataInit (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataInit");
+
+
+ /* Init the method arguments */
+
+ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
+ {
+ ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
+ NAMEOF_ARG_NTE);
+ WalkState->Arguments[i].Name.Integer |= (i << 24);
+ WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
+ WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
+ WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
+ }
+
+ /* Init the method locals */
+
+ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
+ {
+ ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
+ NAMEOF_LOCAL_NTE);
+
+ WalkState->LocalVariables[i].Name.Integer |= (i << 24);
+ WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
+ WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
+ WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataDeleteAll
+ *
+ * PARAMETERS: WalkState - Current walk state object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete method locals and arguments. Arguments are only
+ * deleted if this method was called from another method.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsMethodDataDeleteAll (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 Index;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
+
+
+ /* Detach the locals */
+
+ for (Index = 0; Index < ACPI_METHOD_NUM_LOCALS; Index++)
+ {
+ if (WalkState->LocalVariables[Index].Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
+ Index, WalkState->LocalVariables[Index].Object));
+
+ /* Detach object (if present) and remove a reference */
+
+ AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
+ }
+ }
+
+ /* Detach the arguments */
+
+ for (Index = 0; Index < ACPI_METHOD_NUM_ARGS; Index++)
+ {
+ if (WalkState->Arguments[Index].Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
+ Index, WalkState->Arguments[Index].Object));
+
+ /* Detach object (if present) and remove a reference */
+
+ AcpiNsDetachObject (&WalkState->Arguments[Index]);
+ }
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataInitArgs
+ *
+ * PARAMETERS: *Params - Pointer to a parameter list for the method
+ * MaxParamCount - The arg count for this method
+ * WalkState - Current walk state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
+ * of ACPI operand objects, either null terminated or whose length
+ * is defined by MaxParamCount.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsMethodDataInitArgs (
+ ACPI_OPERAND_OBJECT **Params,
+ UINT32 MaxParamCount,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ UINT32 Index = 0;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
+
+
+ if (!Params)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Copy passed parameters into the new method stack frame */
+
+ while ((Index < ACPI_METHOD_NUM_ARGS) && (Index < MaxParamCount) && Params[Index])
+ {
+ /*
+ * A valid parameter.
+ * Store the argument in the method/walk descriptor
+ */
+ Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, Params[Index],
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Index++;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataGetNode
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument whose type
+ * to get
+ * WalkState - Current walk state object
+ *
+ * RETURN: Get the Node associated with a local or arg.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsMethodDataGetNode (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE **Node)
+{
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
+
+
+ /*
+ * Method Locals and Arguments are supported
+ */
+ switch (Opcode)
+ {
+ case AML_LOCAL_OP:
+
+ if (Index > ACPI_METHOD_MAX_LOCAL)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
+ Index, ACPI_METHOD_MAX_LOCAL));
+ return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+ }
+
+ /* Return a pointer to the pseudo-node */
+
+ *Node = &WalkState->LocalVariables[Index];
+ break;
+
+ case AML_ARG_OP:
+
+ if (Index > ACPI_METHOD_MAX_ARG)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
+ Index, ACPI_METHOD_MAX_ARG));
+ return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+ }
+
+ /* Return a pointer to the pseudo-node */
+
+ *Node = &WalkState->Arguments[Index];
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataSetValue
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument to get
+ * Object - Object to be inserted into the stack entry
+ * WalkState - Current walk state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
+ * Note: There is no "implicit conversion" for locals.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsMethodDataSetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *NewDesc = Object;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "obj %p op %X, ref count = %d [%s]\n", Object,
+ Opcode, Object->Common.ReferenceCount,
+ AcpiUtGetTypeName (Object->Common.Type)));
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * If the object has just been created and is not attached to anything,
+ * (the reference count is 1), then we can just store it directly into
+ * the arg/local. Otherwise, we must copy it.
+ */
+ if (Object->Common.ReferenceCount > 1)
+ {
+ Status = AcpiUtCopyIobjectToIobject (Object, &NewDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
+ Object, NewDesc));
+ }
+ else
+ {
+ /* Increment ref count so object can't be deleted while installed */
+
+ AcpiUtAddReference (NewDesc);
+ }
+
+ /* Install the object */
+
+ Node->Object = NewDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataGetType
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument whose type
+ * to get
+ * WalkState - Current walk state object
+ *
+ * RETURN: Data type of current value of the selected Arg or Local
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE
+AcpiDsMethodDataGetType (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
+
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VALUE ((ACPI_TYPE_NOT_FOUND));
+ }
+
+ /* Get the object */
+
+ Object = AcpiNsGetAttachedObject (Node);
+ if (!Object)
+ {
+ /* Uninitialized local/arg, return TYPE_ANY */
+
+ return_VALUE (ACPI_TYPE_ANY);
+ }
+
+ /* Get the object type */
+
+ return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataGetValue
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument to get
+ * WalkState - Current walk state object
+ * *DestDesc - Ptr to Descriptor into which selected Arg
+ * or Local value should be copied
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame
+ * at the current top of the method stack.
+ * Used only in AcpiExResolveToValue().
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsMethodDataGetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **DestDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
+
+
+ /* Validate the object descriptor */
+
+ if (!DestDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the object from the node */
+
+ Object = Node->Object;
+
+ /* Examine the returned object, it must be valid. */
+
+ if (!Object)
+ {
+ /*
+ * Index points to uninitialized object.
+ * This means that either 1) The expected argument was
+ * not passed to the method, or 2) A local variable
+ * was referenced by the method (via the ASL)
+ * before it was initialized. Either case is an error.
+ */
+ switch (Opcode)
+ {
+ case AML_ARG_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n",
+ Index, Node));
+
+ return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
+
+ case AML_LOCAL_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
+ Index, Node));
+
+ return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
+
+ default:
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+ }
+
+ /*
+ * The Index points to an initialized and valid object.
+ * Return an additional reference to the object
+ */
+ *DestDesc = Object;
+ AcpiUtAddReference (Object);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataDeleteValue
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument to delete
+ * WalkState - Current walk state object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
+ * a null into the stack slot after the object is deleted.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsMethodDataDeleteValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
+
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ /* Get the associated object */
+
+ Object = AcpiNsGetAttachedObject (Node);
+
+ /*
+ * Undefine the Arg or Local by setting its descriptor
+ * pointer to NULL. Locals/Args can contain both
+ * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
+ */
+ Node->Object = NULL;
+
+ if ((Object) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_OPERAND))
+ {
+ /*
+ * There is a valid object.
+ * Decrement the reference count by one to balance the
+ * increment when the object was stored.
+ */
+ AcpiUtRemoveReference (Object);
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsStoreObjectToLocal
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which localVar or argument to set
+ * ObjDesc - Value to be stored
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Store a value in an Arg or Local. The ObjDesc is installed
+ * as the new value for the Arg or Local and the reference count
+ * for ObjDesc is incremented.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsStoreObjectToLocal (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *CurrentObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n",
+ Opcode, Index, ObjDesc));
+
+
+ /* Parameter validation */
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ CurrentObjDesc = AcpiNsGetAttachedObject (Node);
+ if (CurrentObjDesc == ObjDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
+ ObjDesc));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * If there is an object already in this slot, we either
+ * have to delete it, or if this is an argument and there
+ * is an object reference stored there, we have to do
+ * an indirect store!
+ */
+ if (CurrentObjDesc)
+ {
+ /*
+ * Check for an indirect store if an argument
+ * contains an object reference (stored as an Node).
+ * We don't allow this automatic dereferencing for
+ * locals, since a store to a local should overwrite
+ * anything there, including an object reference.
+ *
+ * If both Arg0 and Local0 contain RefOf (Local4):
+ *
+ * Store (1, Arg0) - Causes indirect store to local4
+ * Store (1, Local0) - Stores 1 in local0, overwriting
+ * the reference to local4
+ * Store (1, DeRefof (Local0)) - Causes indirect store to local4
+ *
+ * Weird, but true.
+ */
+ if (Opcode == AML_ARG_OP)
+ {
+ /*
+ * Make sure that the object is the correct type. This may be overkill, but
+ * it is here because references were NS nodes in the past. Now they are
+ * operand objects of type Reference.
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: %X\n",
+ CurrentObjDesc->Common.Type));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /*
+ * If we have a valid reference object that came from RefOf(), do the
+ * indirect store
+ */
+ if ((CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
+ (CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Arg (%p) is an ObjRef(Node), storing in node %p\n",
+ ObjDesc, CurrentObjDesc));
+
+ /*
+ * Store this object to the Node
+ * (perform the indirect store)
+ */
+ Status = AcpiExStoreObjectToNode (ObjDesc,
+ CurrentObjDesc->Reference.Object, WalkState);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Delete the existing object
+ * before storing the new one
+ */
+ AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState);
+ }
+
+ /*
+ * Install the ObjStack descriptor (*ObjDesc) into
+ * the descriptor for the Arg or Local.
+ * Install the new object in the stack entry
+ * (increments the object reference count by one)
+ */
+ Status = AcpiDsMethodDataSetValue (Opcode, Index, ObjDesc, WalkState);
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c
new file mode 100644
index 0000000..0f91fcd
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsobject.c
@@ -0,0 +1,721 @@
+/******************************************************************************
+ *
+ * Module Name: dsobject - Dispatcher object management routines
+ * $Revision: 117 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSOBJECT_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsobject")
+
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsBuildInternalObject
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Op - Parser object to be translated
+ * ObjDescPtr - Where the ACPI internal object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
+ * Simple objects are any objects other than a package object!
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsBuildInternalObject (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT **ObjDescPtr)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
+
+
+ *ObjDescPtr = NULL;
+ if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ /*
+ * This is an named object reference. If this name was
+ * previously looked up in the namespace, it was stored in this op.
+ * Otherwise, go ahead and look it up now
+ */
+ if (!Op->Common.Node)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ (ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+
+ /* Create and init the internal ACPI object */
+
+ ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+ }
+
+ *ObjDescPtr = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsBuildInternalBufferObj
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Op - Parser object to be translated
+ * BufferLength - Length of the buffer
+ * ObjDescPtr - Where the ACPI internal object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a parser Op package object to the equivalent
+ * namespace object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsBuildInternalBufferObj (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 BufferLength,
+ ACPI_OPERAND_OBJECT **ObjDescPtr)
+{
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_PARSE_OBJECT *ByteList;
+ UINT32 ByteListLength = 0;
+
+
+ ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
+
+
+ ObjDesc = *ObjDescPtr;
+ if (ObjDesc)
+ {
+ /*
+ * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
+ * The buffer object already exists (from the NS node)
+ */
+ }
+ else
+ {
+ /* Create a new buffer object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ *ObjDescPtr = ObjDesc;
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ }
+
+ /*
+ * Second arg is the buffer data (optional) ByteList can be either
+ * individual bytes or a string initializer. In either case, a
+ * ByteList appears in the AML.
+ */
+ Arg = Op->Common.Value.Arg; /* skip first arg */
+
+ ByteList = Arg->Named.Next;
+ if (ByteList)
+ {
+ if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Expecting bytelist, got AML opcode %X in op %p\n",
+ ByteList->Common.AmlOpcode, ByteList));
+
+ AcpiUtRemoveReference (ObjDesc);
+ return (AE_TYPE);
+ }
+
+ ByteListLength = (UINT32) ByteList->Common.Value.Integer;
+ }
+
+ /*
+ * The buffer length (number of bytes) will be the larger of:
+ * 1) The specified buffer length and
+ * 2) The length of the initializer byte list
+ */
+ ObjDesc->Buffer.Length = BufferLength;
+ if (ByteListLength > BufferLength)
+ {
+ ObjDesc->Buffer.Length = ByteListLength;
+ }
+
+ /* Allocate the buffer */
+
+ if (ObjDesc->Buffer.Length == 0)
+ {
+ ObjDesc->Buffer.Pointer = NULL;
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Buffer defined with zero length in AML, creating\n"));
+ }
+ else
+ {
+ ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
+ ObjDesc->Buffer.Length);
+ if (!ObjDesc->Buffer.Pointer)
+ {
+ AcpiUtDeleteObjectDesc (ObjDesc);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize buffer from the ByteList (if present) */
+
+ if (ByteList)
+ {
+ ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
+ ByteListLength);
+ }
+ }
+
+ ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
+ Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsBuildInternalPackageObj
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Op - Parser object to be translated
+ * PackageLength - Number of elements in the package
+ * ObjDescPtr - Where the ACPI internal object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a parser Op package object to the equivalent
+ * namespace object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsBuildInternalPackageObj (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 PackageLength,
+ ACPI_OPERAND_OBJECT **ObjDescPtr)
+{
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_PARSE_OBJECT *Parent;
+ ACPI_OPERAND_OBJECT *ObjDesc = NULL;
+ UINT32 PackageListLength;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
+
+
+ /* Find the parent of a possibly nested package */
+
+ Parent = Op->Common.Parent;
+ while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ Parent = Parent->Common.Parent;
+ }
+
+ ObjDesc = *ObjDescPtr;
+ if (ObjDesc)
+ {
+ /*
+ * We are evaluating a Named package object "Name (xxxx, Package)".
+ * Get the existing package object from the NS node
+ */
+ }
+ else
+ {
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
+ *ObjDescPtr = ObjDesc;
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ ObjDesc->Package.Node = Parent->Common.Node;
+ }
+
+ ObjDesc->Package.Count = PackageLength;
+
+ /* Count the number of items in the package list */
+
+ PackageListLength = 0;
+ Arg = Op->Common.Value.Arg;
+ Arg = Arg->Common.Next;
+ while (Arg)
+ {
+ PackageListLength++;
+ Arg = Arg->Common.Next;
+ }
+
+ /*
+ * The package length (number of elements) will be the greater
+ * of the specified length and the length of the initializer list
+ */
+ if (PackageListLength > PackageLength)
+ {
+ ObjDesc->Package.Count = PackageListLength;
+ }
+
+ /*
+ * Allocate the pointer array (array of pointers to the
+ * individual objects). Add an extra pointer slot so
+ * that the list is always null terminated.
+ */
+ ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
+ ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
+
+ if (!ObjDesc->Package.Elements)
+ {
+ AcpiUtDeleteObjectDesc (ObjDesc);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Now init the elements of the package
+ */
+ i = 0;
+ Arg = Op->Common.Value.Arg;
+ Arg = Arg->Common.Next;
+ while (Arg)
+ {
+ if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
+ {
+ /* Object (package or buffer) is already built */
+
+ ObjDesc->Package.Elements[i] = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
+ }
+ else
+ {
+ Status = AcpiDsBuildInternalObject (WalkState, Arg,
+ &ObjDesc->Package.Elements[i]);
+ }
+
+ i++;
+ Arg = Arg->Common.Next;
+ }
+
+ ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
+ Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateNode
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Node - NS Node to be initialized
+ * Op - Parser object to be translated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create the object to be associated with a namespace node
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateNode (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
+
+
+ /*
+ * Because of the execution pass through the non-control-method
+ * parts of the table, we can arrive here twice. Only init
+ * the named object node the first time through
+ */
+ if (AcpiNsGetAttachedObject (Node))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (!Op->Common.Value.Arg)
+ {
+ /* No arguments, there is nothing to do */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Build an internal object for the argument(s) */
+
+ Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Re-type the object according to its argument */
+
+ Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+
+ /* Attach obj to node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsInitObjectFromOp
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * Op - Parser op used to init the internal object
+ * Opcode - AML opcode associated with the object
+ * RetObjDesc - Namespace object to be initialized
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize a namespace object from a parser Op and its
+ * associated arguments. The namespace object is a more compact
+ * representation of the Op and its arguments.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitObjectFromOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT16 Opcode,
+ ACPI_OPERAND_OBJECT **RetObjDesc)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
+
+
+ ObjDesc = *RetObjDesc;
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+ if (OpInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ /* Unknown opcode */
+
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /* Perform per-object initialization */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * Defer evaluation of Buffer TermArg operand
+ */
+ ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+ ObjDesc->Buffer.AmlStart = Op->Named.Data;
+ ObjDesc->Buffer.AmlLength = Op->Named.Length;
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ /*
+ * Defer evaluation of Package TermArg operand
+ */
+ ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+ ObjDesc->Package.AmlStart = Op->Named.Data;
+ ObjDesc->Package.AmlLength = Op->Named.Length;
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ switch (OpInfo->Type)
+ {
+ case AML_TYPE_CONSTANT:
+ /*
+ * Resolve AML Constants here - AND ONLY HERE!
+ * All constants are integers.
+ * We mark the integer with a flag that indicates that it started life
+ * as a constant -- so that stores to constants will perform as expected (noop).
+ * (ZeroOp is used as a placeholder for optional target operands.)
+ */
+ ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
+
+ switch (Opcode)
+ {
+ case AML_ZERO_OP:
+
+ ObjDesc->Integer.Value = 0;
+ break;
+
+ case AML_ONE_OP:
+
+ ObjDesc->Integer.Value = 1;
+ break;
+
+ case AML_ONES_OP:
+
+ ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
+
+ /* Truncate value if we are executing from a 32-bit ACPI table */
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+ AcpiExTruncateFor32bitTable (ObjDesc);
+#endif
+ break;
+
+ case AML_REVISION_OP:
+
+ ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode));
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ break;
+
+
+ case AML_TYPE_LITERAL:
+
+ ObjDesc->Integer.Value = Op->Common.Value.Integer;
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type));
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ ObjDesc->String.Pointer = Op->Common.Value.String;
+ ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String);
+
+ /*
+ * The string is contained in the ACPI table, don't ever try
+ * to delete it
+ */
+ ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ switch (OpInfo->Type)
+ {
+ case AML_TYPE_LOCAL_VARIABLE:
+
+ /* Split the opcode into a base opcode + offset */
+
+ ObjDesc->Reference.Opcode = AML_LOCAL_OP;
+ ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+ Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP, ObjDesc->Reference.Offset,
+ WalkState, (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
+#endif
+ break;
+
+
+ case AML_TYPE_METHOD_ARGUMENT:
+
+ /* Split the opcode into a base opcode + offset */
+
+ ObjDesc->Reference.Opcode = AML_ARG_OP;
+ ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
+ break;
+
+ default: /* Other literals, etc.. */
+
+ if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ /* Node was saved in Op */
+
+ ObjDesc->Reference.Node = Op->Common.Node;
+ }
+
+ ObjDesc->Reference.Opcode = Opcode;
+ break;
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
+ ACPI_GET_OBJECT_TYPE (ObjDesc)));
+
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c
new file mode 100644
index 0000000..62d14f4
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsopcode.c
@@ -0,0 +1,1263 @@
+/******************************************************************************
+ *
+ * Module Name: dsopcode - Dispatcher Op Region support and handling of
+ * "control" opcodes
+ * $Revision: 87 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSOPCODE_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsopcode")
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsExecuteArguments
+ *
+ * PARAMETERS: Node - Parent NS node
+ * AmlLength - Length of executable AML
+ * AmlStart - Pointer to the AML
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Late execution of region or field arguments
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecuteArguments (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ScopeNode,
+ UINT32 AmlLength,
+ UINT8 *AmlStart)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_PARSE_OBJECT *Arg;
+
+
+ ACPI_FUNCTION_TRACE ("DsExecuteArguments");
+
+
+ /*
+ * Allocate a new parser op to be the root of the parsed tree
+ */
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Save the Node for use in AcpiPsParseAml */
+
+ Op->Common.Node = ScopeNode;
+
+ /* Create and initialize a new parser state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
+ AmlLength, NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
+
+ /* Pass1: Parse the entire declaration */
+
+ Status = AcpiPsParseAml (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get and init the Op created above */
+
+ Arg = Op->Common.Value.Arg;
+ Op->Common.Node = Node;
+ Arg->Common.Node = Node;
+ AcpiPsDeleteParseTree (Op);
+
+ /* Evaluate the address and length arguments for the Buffer Field */
+
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Op->Common.Node = ScopeNode;
+
+ /* Create and initialize a new parser state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
+ AmlLength, NULL, NULL, 3);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiPsParseAml (WalkState);
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsGetBufferFieldArguments
+ *
+ * PARAMETERS: ObjDesc - A valid BufferField object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
+ * evaluation of these field attributes.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetBufferFieldArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_OPERAND_OBJECT *ExtraDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the AML pointer (method object) and BufferField node */
+
+ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
+ Node = ObjDesc->BufferField.Node;
+
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
+ Node->Name.Ascii));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
+ ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsGetBufferArguments
+ *
+ * PARAMETERS: ObjDesc - A valid Bufferobject
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get Buffer length and initializer byte list. This implements
+ * the late evaluation of these attributes.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetBufferArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetBufferArguments", ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the Buffer node */
+
+ Node = ObjDesc->Buffer.Node;
+ if (!Node)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No pointer back to NS node in buffer %p\n", ObjDesc));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer JIT Init\n"));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node,
+ ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsGetPackageArguments
+ *
+ * PARAMETERS: ObjDesc - A valid Packageobject
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get Package length and initializer byte list. This implements
+ * the late evaluation of these attributes.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetPackageArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetPackageArguments", ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the Package node */
+
+ Node = ObjDesc->Package.Node;
+ if (!Node)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No pointer back to NS node in package %p\n", ObjDesc));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package JIT Init\n"));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node,
+ ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsGetRegionArguments
+ *
+ * PARAMETERS: ObjDesc - A valid region object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get region address and length. This implements the late
+ * evaluation of these region attributes.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetRegionArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ExtraDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
+
+
+ if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
+ if (!ExtraDesc)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Get the Region node */
+
+ Node = ObjDesc->Region.Node;
+
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
+ Node->Name.Ascii, ExtraDesc->Extra.AmlStart));
+
+
+ Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
+ ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsInitializeRegion
+ *
+ * PARAMETERS: Op - A valid region Op object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Front end to EvInitializeRegion
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitializeRegion (
+ ACPI_HANDLE ObjHandle)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
+
+ /* Namespace is NOT locked */
+
+ Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
+ return (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsInitBufferField
+ *
+ * PARAMETERS: AmlOpcode - CreateXxxField
+ * ObjDesc - BufferField object
+ * BufferDesc - Host Buffer
+ * OffsetDesc - Offset into buffer
+ * Length - Length of field (CREATE_FIELD_OP only)
+ * Result - Where to store the result
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform actual initialization of a buffer field
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitBufferField (
+ UINT16 AmlOpcode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *BufferDesc,
+ ACPI_OPERAND_OBJECT *OffsetDesc,
+ ACPI_OPERAND_OBJECT *LengthDesc,
+ ACPI_OPERAND_OBJECT *ResultDesc)
+{
+ UINT32 Offset;
+ UINT32 BitOffset;
+ UINT32 BitCount;
+ UINT8 FieldFlags;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsInitBufferField", ObjDesc);
+
+
+ /* Host object must be a Buffer */
+
+ if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Target of Create Field is not a Buffer object - %s\n",
+ AcpiUtGetObjectTypeName (BufferDesc)));
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ /*
+ * The last parameter to all of these opcodes (ResultDesc) started
+ * out as a NameString, and should therefore now be a NS node
+ * after resolution in AcpiExResolveOperands().
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n",
+ AcpiPsGetOpcodeName (AmlOpcode)));
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ Offset = (UINT32) OffsetDesc->Integer.Value;
+
+ /*
+ * Setup the Bit offsets and counts, according to the opcode
+ */
+ switch (AmlOpcode)
+ {
+ case AML_CREATE_FIELD_OP:
+
+ /* Offset is in bits, count is in bits */
+
+ BitOffset = Offset;
+ BitCount = (UINT32) LengthDesc->Integer.Value;
+ FieldFlags = AML_FIELD_ACCESS_BYTE;
+ break;
+
+ case AML_CREATE_BIT_FIELD_OP:
+
+ /* Offset is in bits, Field is one bit */
+
+ BitOffset = Offset;
+ BitCount = 1;
+ FieldFlags = AML_FIELD_ACCESS_BYTE;
+ break;
+
+ case AML_CREATE_BYTE_FIELD_OP:
+
+ /* Offset is in bytes, field is one byte */
+
+ BitOffset = 8 * Offset;
+ BitCount = 8;
+ FieldFlags = AML_FIELD_ACCESS_BYTE;
+ break;
+
+ case AML_CREATE_WORD_FIELD_OP:
+
+ /* Offset is in bytes, field is one word */
+
+ BitOffset = 8 * Offset;
+ BitCount = 16;
+ FieldFlags = AML_FIELD_ACCESS_WORD;
+ break;
+
+ case AML_CREATE_DWORD_FIELD_OP:
+
+ /* Offset is in bytes, field is one dword */
+
+ BitOffset = 8 * Offset;
+ BitCount = 32;
+ FieldFlags = AML_FIELD_ACCESS_DWORD;
+ break;
+
+ case AML_CREATE_QWORD_FIELD_OP:
+
+ /* Offset is in bytes, field is one qword */
+
+ BitOffset = 8 * Offset;
+ BitCount = 64;
+ FieldFlags = AML_FIELD_ACCESS_QWORD;
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown field creation opcode %02x\n",
+ AmlOpcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ /* Entire field must fit within the current length of the buffer */
+
+ if ((BitOffset + BitCount) >
+ (8 * (UINT32) BufferDesc->Buffer.Length))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Field size %d exceeds Buffer size %d (bits)\n",
+ BitOffset + BitCount, 8 * (UINT32) BufferDesc->Buffer.Length));
+ Status = AE_AML_BUFFER_LIMIT;
+ goto Cleanup;
+ }
+
+ /*
+ * Initialize areas of the field object that are common to all fields
+ * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
+ */
+ Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0,
+ BitOffset, BitCount);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ ObjDesc->BufferField.BufferObj = BufferDesc;
+
+ /* Reference count for BufferDesc inherits ObjDesc count */
+
+ BufferDesc->Common.ReferenceCount = (UINT16) (BufferDesc->Common.ReferenceCount +
+ ObjDesc->Common.ReferenceCount);
+
+
+Cleanup:
+
+ /* Always delete the operands */
+
+ AcpiUtRemoveReference (OffsetDesc);
+ AcpiUtRemoveReference (BufferDesc);
+
+ if (AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ AcpiUtRemoveReference (LengthDesc);
+ }
+
+ /* On failure, delete the result descriptor */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
+ }
+ else
+ {
+ /* Now the address and length are valid for this BufferField */
+
+ ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsEvalBufferFieldOperands
+ *
+ * PARAMETERS: WalkState - Current walk
+ * Op - A valid BufferField Op object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get BufferField Buffer and Index
+ * Called from AcpiDsExecEndOp during BufferField parse tree walk
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsEvalBufferFieldOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
+
+
+ /*
+ * This is where we evaluate the address and length fields of the
+ * CreateXxxField declaration
+ */
+ Node = Op->Common.Node;
+
+ /* NextOp points to the op that holds the Buffer */
+
+ NextOp = Op->Common.Value.Arg;
+
+ /* Evaluate/create the address and length operands */
+
+ Status = AcpiDsCreateOperands (WalkState, NextOp);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Resolve the operands */
+
+ Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
+ ACPI_WALK_OPERANDS, WalkState);
+
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ WalkState->NumOperands, "after AcpiExResolveOperands");
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Initialize the Buffer Field */
+
+ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ /* NOTE: Slightly different operands for this opcode */
+
+ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
+ WalkState->Operands[0], WalkState->Operands[1],
+ WalkState->Operands[2], WalkState->Operands[3]);
+ }
+ else
+ {
+ /* All other, CreateXxxField opcodes */
+
+ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
+ WalkState->Operands[0], WalkState->Operands[1],
+ NULL, WalkState->Operands[2]);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsEvalRegionOperands
+ *
+ * PARAMETERS: WalkState - Current walk
+ * Op - A valid region Op object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get region address and length
+ * Called from AcpiDsExecEndOp during OpRegion parse tree walk
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsEvalRegionOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *OperandDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
+
+
+ /*
+ * This is where we evaluate the address and length fields of the OpRegion declaration
+ */
+ Node = Op->Common.Node;
+
+ /* NextOp points to the op that holds the SpaceID */
+
+ NextOp = Op->Common.Value.Arg;
+
+ /* NextOp points to address op */
+
+ NextOp = NextOp->Common.Next;
+
+ /* Evaluate/create the address and length operands */
+
+ Status = AcpiDsCreateOperands (WalkState, NextOp);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Resolve the length and address operands to numbers */
+
+ Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ 1, "after AcpiExResolveOperands");
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /*
+ * Get the length operand and save it
+ * (at Top of stack)
+ */
+ OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
+
+ ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
+ AcpiUtRemoveReference (OperandDesc);
+
+ /*
+ * Get the address and save it
+ * (at top of stack - 1)
+ */
+ OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
+
+ ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value;
+ AcpiUtRemoveReference (OperandDesc);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
+ ObjDesc,
+ ACPI_HIDWORD (ObjDesc->Region.Address), ACPI_LODWORD (ObjDesc->Region.Address),
+ ObjDesc->Region.Length));
+
+ /* Now the address and length are valid for this opregion */
+
+ ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsEvalDataObjectOperands
+ *
+ * PARAMETERS: WalkState - Current walk
+ * Op - A valid DataObject Op object
+ * ObjDesc - DataObject
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the operands and complete the following data objec types:
+ * Buffer
+ * Package
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsEvalDataObjectOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ArgDesc;
+ UINT32 Length;
+
+
+ ACPI_FUNCTION_TRACE ("DsEvalDataObjectOperands");
+
+
+ /* The first operand (for all of these data objects) is the length */
+
+ Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiExResolveOperands (WalkState->Opcode,
+ &(WalkState->Operands [WalkState->NumOperands -1]),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Extract length operand */
+
+ ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
+ Length = (UINT32) ArgDesc->Integer.Value;
+
+ /* Cleanup for length operand */
+
+ Status = AcpiDsObjStackPop (1, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ AcpiUtRemoveReference (ArgDesc);
+
+ /*
+ * Create the actual data object
+ */
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BUFFER_OP:
+
+ Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
+ break;
+
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+ }
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Return the object in the WalkState, unless the parent is a package --
+ * in this case, the return object will be stored in the parse tree
+ * for the package.
+ */
+ if ((!Op->Common.Parent) ||
+ ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
+ (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
+ (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
+ {
+ WalkState->ResultObj = ObjDesc;
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsExecBeginControlOp
+ *
+ * PARAMETERS: WalkList - The list that owns the walk stack
+ * Op - The control Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handles all control ops encountered during control method
+ * execution.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecBeginControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *ControlState;
+
+
+ ACPI_FUNCTION_NAME ("DsExecBeginControlOp");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
+ Op->Common.AmlOpcode, WalkState));
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+
+ /*
+ * IF/WHILE: Create a new control state to manage these
+ * constructs. We need to manage these as a stack, in order
+ * to handle nesting.
+ */
+ ControlState = AcpiUtCreateControlState ();
+ if (!ControlState)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+ /*
+ * Save a pointer to the predicate for multiple executions
+ * of a loop
+ */
+ ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
+ ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
+ ControlState->Control.Opcode = Op->Common.AmlOpcode;
+
+
+ /* Push the control state on this walk's control stack */
+
+ AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
+ break;
+
+ case AML_ELSE_OP:
+
+ /* Predicate is in the state object */
+ /* If predicate is true, the IF was executed, ignore ELSE part */
+
+ if (WalkState->LastPredicate)
+ {
+ Status = AE_CTRL_TRUE;
+ }
+
+ break;
+
+ case AML_RETURN_OP:
+
+ break;
+
+ default:
+ break;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsExecEndControlOp
+ *
+ * PARAMETERS: WalkList - The list that owns the walk stack
+ * Op - The control Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handles all control ops encountered during control method
+ * execution.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecEndControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *ControlState;
+
+
+ ACPI_FUNCTION_NAME ("DsExecEndControlOp");
+
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_IF_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
+
+ /*
+ * Save the result of the predicate in case there is an
+ * ELSE to come
+ */
+ WalkState->LastPredicate =
+ (BOOLEAN) WalkState->ControlState->Common.Value;
+
+ /*
+ * Pop the control state that was created at the start
+ * of the IF and free it
+ */
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ break;
+
+
+ case AML_ELSE_OP:
+
+ break;
+
+
+ case AML_WHILE_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
+
+ if (WalkState->ControlState->Common.Value)
+ {
+ /* Predicate was true, go back and evaluate it again! */
+
+ Status = AE_CTRL_PENDING;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", Op));
+
+ /* Pop this control state and free it */
+
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+
+ WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
+ AcpiUtDeleteGenericState (ControlState);
+ break;
+
+
+ case AML_RETURN_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
+
+ /*
+ * One optional operand -- the return value
+ * It can be either an immediate operand or a result that
+ * has been bubbled up the tree
+ */
+ if (Op->Common.Value.Arg)
+ {
+ /* Return statement has an immediate operand */
+
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * If value being returned is a Reference (such as
+ * an arg or local), resolve it now because it may
+ * cease to exist at the end of the method.
+ */
+ Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * Get the return value and save as the last result
+ * value. This is the only place where WalkState->ReturnDesc
+ * is set to anything other than zero!
+ */
+ WalkState->ReturnDesc = WalkState->Operands[0];
+ }
+ else if ((WalkState->Results) &&
+ (WalkState->Results->Results.NumResults > 0))
+ {
+ /*
+ * The return value has come from a previous calculation.
+ *
+ * If value being returned is a Reference (such as
+ * an arg or local), resolve it now because it may
+ * cease to exist at the end of the method.
+ *
+ * Allow references created by the Index operator to return unchanged.
+ */
+ if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
+ (ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
+ ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
+ {
+ Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
+ }
+ else
+ {
+ /* No return operand */
+
+ if (WalkState->NumOperands)
+ {
+ AcpiUtRemoveReference (WalkState->Operands [0]);
+ }
+
+ WalkState->Operands [0] = NULL;
+ WalkState->NumOperands = 0;
+ WalkState->ReturnDesc = NULL;
+ }
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Completed RETURN_OP State=%p, RetVal=%p\n",
+ WalkState, WalkState->ReturnDesc));
+
+ /* End the control method execution right now */
+
+ Status = AE_CTRL_TERMINATE;
+ break;
+
+
+ case AML_NOOP_OP:
+
+ /* Just do nothing! */
+ break;
+
+
+ case AML_BREAK_POINT_OP:
+
+ /* Call up to the OS service layer to handle this */
+
+ Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
+
+ /* If and when it returns, all done. */
+
+ break;
+
+
+ case AML_BREAK_OP:
+ case AML_CONTINUE_OP: /* ACPI 2.0 */
+
+
+ /* Pop and delete control states until we find a while */
+
+ while (WalkState->ControlState &&
+ (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
+ {
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ }
+
+ /* No while found? */
+
+ if (!WalkState->ControlState)
+ {
+ return (AE_AML_NO_WHILE);
+ }
+
+ /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
+
+ WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
+
+ /* Return status depending on opcode */
+
+ if (Op->Common.AmlOpcode == AML_BREAK_OP)
+ {
+ Status = AE_CTRL_BREAK;
+ }
+ else
+ {
+ Status = AE_CTRL_CONTINUE;
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
+ Op->Common.AmlOpcode, Op));
+
+ Status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+ return (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c
new file mode 100644
index 0000000..11a140a
--- /dev/null
+++ b/sys/contrib/dev/acpica/dsutils.c
@@ -0,0 +1,720 @@
+/*******************************************************************************
+ *
+ * Module Name: dsutils - Dispatcher utilities
+ * $Revision: 99 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSUTILS_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsutils")
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsIsResultUsed
+ *
+ * PARAMETERS: Op
+ * ResultObj
+ * WalkState
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check if a result object will be used by the parent
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDsIsResultUsed (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ const ACPI_OPCODE_INFO *ParentInfo;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
+
+
+ /* Must have both an Op and a Result Object */
+
+ if (!Op)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+ return_VALUE (TRUE);
+ }
+
+ /*
+ * If there is no parent, the result can't possibly be used!
+ * (An executing method typically has no parent, since each
+ * method is parsed separately) However, a method that is
+ * invoked from another method has a parent.
+ */
+ if (!Op->Common.Parent)
+ {
+ return_VALUE (FALSE);
+ }
+
+ /*
+ * Get info on the parent. The root Op is AML_SCOPE
+ */
+ ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
+ if (ParentInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op));
+ return_VALUE (FALSE);
+ }
+
+ /*
+ * Decide what to do with the result based on the parent. If
+ * the parent opcode will not use the result, delete the object.
+ * Otherwise leave it as is, it will be deleted when it is used
+ * as an operand later.
+ */
+ switch (ParentInfo->Class)
+ {
+ case AML_CLASS_CONTROL:
+
+ switch (Op->Common.Parent->Common.AmlOpcode)
+ {
+ case AML_RETURN_OP:
+
+ /* Never delete the return value associated with a return opcode */
+
+ goto ResultUsed;
+
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+
+ /*
+ * If we are executing the predicate AND this is the predicate op,
+ * we will use the return value
+ */
+ if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&
+ (WalkState->ControlState->Control.PredicateOp == Op))
+ {
+ goto ResultUsed;
+ }
+ break;
+
+ default:
+ /* Ignore other control opcodes */
+ break;
+ }
+
+ /* The general control opcode returns no result */
+
+ goto ResultNotUsed;
+
+
+ case AML_CLASS_CREATE:
+
+ /*
+ * These opcodes allow TermArg(s) as operands and therefore
+ * the operands can be method calls. The result is used.
+ */
+ goto ResultUsed;
+
+
+ case AML_CLASS_NAMED_OBJECT:
+
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP))
+ {
+ /*
+ * These opcodes allow TermArg(s) as operands and therefore
+ * the operands can be method calls. The result is used.
+ */
+ goto ResultUsed;
+ }
+
+ goto ResultNotUsed;
+
+
+ default:
+
+ /*
+ * In all other cases. the parent will actually use the return
+ * object, so keep it.
+ */
+ goto ResultUsed;
+ }
+
+
+ResultUsed:
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
+
+ return_VALUE (TRUE);
+
+
+ResultNotUsed:
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
+
+ return_VALUE (FALSE);
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsDeleteResultIfNotUsed
+ *
+ * PARAMETERS: Op
+ * ResultObj
+ * WalkState
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
+ * result descriptor, check if the parent opcode will actually use
+ * this result. If not, delete the result now so that it will
+ * not become orphaned.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsDeleteResultIfNotUsed (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT *ResultObj,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
+
+
+ if (!Op)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+ return_VOID;
+ }
+
+ if (!ResultObj)
+ {
+ return_VOID;
+ }
+
+
+ if (!AcpiDsIsResultUsed (Op, WalkState))
+ {
+ /*
+ * Must pop the result stack (ObjDesc should be equal to ResultObj)
+ */
+ Status = AcpiDsResultPop (&ObjDesc, WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiUtRemoveReference (ResultObj);
+ }
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResolveOperands
+ *
+ * PARAMETERS: WalkState - Current walk state with operands on stack
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Resolve all operands to their values. Used to prepare
+ * arguments to a control method invocation (a call from one
+ * method to another.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResolveOperands (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
+
+
+ /*
+ * Attempt to resolve each of the valid operands
+ * Method arguments are passed by value, not by reference
+ */
+ for (i = 0; i < WalkState->NumOperands; i++)
+ {
+ Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsClearOperands
+ *
+ * PARAMETERS: WalkState - Current walk state with operands on stack
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Clear all operands on the current walk state operand stack.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsClearOperands (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("AcpiDsClearOperands", WalkState);
+
+
+ /*
+ * Remove a reference on each operand on the stack
+ */
+ for (i = 0; i < WalkState->NumOperands; i++)
+ {
+ /*
+ * Remove a reference to all operands, including both
+ * "Arguments" and "Targets".
+ */
+ AcpiUtRemoveReference (WalkState->Operands[i]);
+ WalkState->Operands[i] = NULL;
+ }
+
+ WalkState->NumOperands = 0;
+ return_VOID;
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateOperand
+ *
+ * PARAMETERS: WalkState
+ * Arg
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a parse tree object that is an argument to an AML
+ * opcode to the equivalent interpreter object. This may include
+ * looking up a name or entering a new name into the internal
+ * namespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateOperand (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Arg,
+ UINT32 ArgIndex)
+{
+ ACPI_STATUS Status = AE_OK;
+ char *NameString;
+ UINT32 NameLength;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_PARSE_OBJECT *ParentOp;
+ UINT16 Opcode;
+ ACPI_INTERPRETER_MODE InterpreterMode;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
+
+
+ /* A valid name must be looked up in the namespace */
+
+ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ (Arg->Common.Value.String))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
+
+ /* Get the entire name string from the AML stream */
+
+ Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer,
+ &NameString, &NameLength);
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * All prefixes have been handled, and the name is
+ * in NameString
+ */
+
+ /*
+ * Differentiate between a namespace "create" operation
+ * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
+ * IMODE_EXECUTE) in order to support the creation of
+ * namespace objects during the execution of control methods.
+ */
+ ParentOp = Arg->Common.Parent;
+ OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
+ if ((OpInfo->Flags & AML_NSNODE) &&
+ (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
+ (ParentOp->Common.AmlOpcode != AML_REGION_OP) &&
+ (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+ {
+ /* Enter name into namespace if not found */
+
+ InterpreterMode = ACPI_IMODE_LOAD_PASS2;
+ }
+
+ else
+ {
+ /* Return a failure if name not found */
+
+ InterpreterMode = ACPI_IMODE_EXECUTE;
+ }
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
+ ACPI_TYPE_ANY, InterpreterMode,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState,
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));
+ /*
+ * The only case where we pass through (ignore) a NOT_FOUND
+ * error is for the CondRefOf opcode.
+ */
+ if (Status == AE_NOT_FOUND)
+ {
+ if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)
+ {
+ /*
+ * For the Conditional Reference op, it's OK if
+ * the name is not found; We just need a way to
+ * indicate this to the interpreter, set the
+ * object to the root
+ */
+ ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
+ Status = AE_OK;
+ }
+
+ else
+ {
+ /*
+ * We just plain didn't find it -- which is a
+ * very serious error at this point
+ */
+ Status = AE_AML_NAME_NOT_FOUND;
+ }
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (NameString, Status);
+ }
+
+ /* Free the namestring created above */
+
+ ACPI_MEM_FREE (NameString);
+
+ /* Check status from the lookup */
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Put the resulting object onto the current object stack */
+
+ Status = AcpiDsObjStackPush (ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
+ }
+
+
+ else
+ {
+ /* Check for null name case */
+
+ if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ /*
+ * If the name is null, this means that this is an
+ * optional result parameter that was not specified
+ * in the original ASL. Create a Zero Constant for a
+ * placeholder. (Store to a constant is a Noop.)
+ */
+ Opcode = AML_ZERO_OP; /* Has no arguments! */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg));
+ }
+
+ else
+ {
+ Opcode = Arg->Common.AmlOpcode;
+ }
+
+ /* Get the object type of the argument */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+ if (OpInfo->ObjectType == ACPI_TYPE_INVALID)
+ {
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+ }
+
+ if (OpInfo->Flags & AML_HAS_RETVAL)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Argument previously created, already stacked \n"));
+
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
+ WalkState->Operands [WalkState->NumOperands - 1], WalkState));
+
+ /*
+ * Use value that was already previously returned
+ * by the evaluation of this argument
+ */
+ Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * Only error is underflow, and this indicates
+ * a missing or null operand!
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ /* Create an ACPI_INTERNAL_OBJECT for the argument */
+
+ ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize the new object */
+
+ Status = AcpiDsInitObjectFromOp (WalkState, Arg,
+ Opcode, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteObjectDesc (ObjDesc);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Put the operand object on the object stack */
+
+ Status = AcpiDsObjStackPush (ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateOperands
+ *
+ * PARAMETERS: FirstArg - First argument of a parser argument tree
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an operator's arguments from a parse tree format to
+ * namespace objects and place those argument object on the object
+ * stack in preparation for evaluation by the interpreter.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsCreateOperands (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *FirstArg)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Arg;
+ UINT32 ArgCount = 0;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
+
+
+ /* For all arguments in the list... */
+
+ Arg = FirstArg;
+ while (Arg)
+ {
+ Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
+ ArgCount, Arg, FirstArg));
+
+ /* Move on to next argument, if any */
+
+ Arg = Arg->Common.Next;
+ ArgCount++;
+ }
+
+ return_ACPI_STATUS (Status);
+
+
+Cleanup:
+ /*
+ * We must undo everything done above; meaning that we must
+ * pop everything off of the operand stack and delete those
+ * objects
+ */
+ (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
+ (ArgCount + 1), AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c
new file mode 100644
index 0000000..6466788
--- /dev/null
+++ b/sys/contrib/dev/acpica/dswexec.c
@@ -0,0 +1,792 @@
+/******************************************************************************
+ *
+ * Module Name: dswexec - Dispatcher method execution callbacks;
+ * dispatch to interpreter.
+ * $Revision: 103 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSWEXEC_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+#include "acdisasm.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dswexec")
+
+/*
+ * Dispatch table for opcode classes
+ */
+static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
+ AcpiExOpcode_1A_0T_0R,
+ AcpiExOpcode_1A_0T_1R,
+ AcpiExOpcode_1A_1T_0R,
+ AcpiExOpcode_1A_1T_1R,
+ AcpiExOpcode_2A_0T_0R,
+ AcpiExOpcode_2A_0T_1R,
+ AcpiExOpcode_2A_1T_1R,
+ AcpiExOpcode_2A_2T_1R,
+ AcpiExOpcode_3A_0T_0R,
+ AcpiExOpcode_3A_1T_1R,
+ AcpiExOpcode_6A_0T_1R};
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsGetPredicateValue
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the result of a predicate evaluation
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetPredicateValue (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ResultObj)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
+
+
+ WalkState->ControlState->Common.State = 0;
+
+ if (ResultObj)
+ {
+ Status = AcpiDsResultPop (&ObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not get result from predicate evaluation, %s\n",
+ AcpiFormatException (Status)));
+
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ObjDesc = WalkState->Operands [0];
+ }
+
+ if (!ObjDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate ObjDesc=%p State=%p\n",
+ ObjDesc, WalkState));
+
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /*
+ * Result of predicate evaluation currently must
+ * be a number
+ */
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Bad predicate (not a number) ObjDesc=%p State=%p Type=%X\n",
+ ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ /* Truncate the predicate to 32-bits if necessary */
+
+ AcpiExTruncateFor32bitTable (ObjDesc);
+
+ /*
+ * Save the result of the predicate evaluation on
+ * the control stack
+ */
+ if (ObjDesc->Integer.Value)
+ {
+ WalkState->ControlState->Common.Value = TRUE;
+ }
+ else
+ {
+ /*
+ * Predicate is FALSE, we will just toss the
+ * rest of the package
+ */
+ WalkState->ControlState->Common.Value = FALSE;
+ Status = AE_CTRL_FALSE;
+ }
+
+
+Cleanup:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
+ WalkState->ControlState->Common.Value, WalkState->Op));
+
+ /* Break to debugger to display result */
+
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
+
+ /*
+ * Delete the predicate result object (we know that
+ * we don't need it anymore)
+ */
+ AcpiUtRemoveReference (ObjDesc);
+
+ WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsExecBeginOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * OutOp - Return op if a new one is created
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during the execution of control
+ * methods. This is where most operators and operands are
+ * dispatched to the interpreter.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecBeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 OpcodeClass;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
+
+
+ Op = WalkState->Op;
+ if (!Op)
+ {
+ Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Op = *OutOp;
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
+
+ Status = AcpiDsScopeStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+
+ if (Op == WalkState->Origin)
+ {
+ if (OutOp)
+ {
+ *OutOp = Op;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * If the previous opcode was a conditional, this opcode
+ * must be the beginning of the associated predicate.
+ * Save this knowledge in the current scope descriptor
+ */
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_CONDITIONAL_EXECUTING))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
+ Op, WalkState));
+
+ WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING;
+
+ /* Save start of predicate */
+
+ WalkState->ControlState->Control.PredicateOp = Op;
+ }
+
+
+ OpcodeClass = WalkState->OpInfo->Class;
+
+ /* We want to send namepaths to the load code */
+
+ if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ OpcodeClass = AML_CLASS_NAMED_OBJECT;
+ }
+
+ /*
+ * Handle the opcode based upon the opcode type
+ */
+ switch (OpcodeClass)
+ {
+ case AML_CLASS_CONTROL:
+
+ Status = AcpiDsResultStackPush (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiDsExecBeginControlOp (WalkState, Op);
+ break;
+
+
+ case AML_CLASS_NAMED_OBJECT:
+
+ if (WalkState->WalkType == ACPI_WALK_METHOD)
+ {
+ /*
+ * Found a named object declaration during method
+ * execution; we must enter this object into the
+ * namespace. The created object is temporary and
+ * will be deleted upon completion of the execution
+ * of this method.
+ */
+ Status = AcpiDsLoad2BeginOp (WalkState, NULL);
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ Status = AcpiDsResultStackPush (WalkState);
+ }
+ break;
+
+
+ case AML_CLASS_EXECUTE:
+ case AML_CLASS_CREATE:
+
+ /* most operators with arguments */
+ /* Start a new result/operand state */
+
+ Status = AcpiDsResultStackPush (WalkState);
+ break;
+
+
+ default:
+ break;
+ }
+
+ /* Nothing to do here during method execution */
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsExecEndOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * Op - Op that has been just been completed in the
+ * walk; Arguments have now been evaluated.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during the execution of control
+ * methods. The only thing we really need to do here is to
+ * notice the beginning of IF, ELSE, and WHILE blocks.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecEndOp (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 OpType;
+ UINT32 OpClass;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *FirstArg;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
+
+
+ Op = WalkState->Op;
+ OpType = WalkState->OpInfo->Type;
+ OpClass = WalkState->OpInfo->Class;
+
+ if (OpClass == AML_CLASS_UNKNOWN)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Common.AmlOpcode));
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+ }
+
+ FirstArg = Op->Common.Value.Arg;
+
+ /* Init the walk state */
+
+ WalkState->NumOperands = 0;
+ WalkState->ReturnDesc = NULL;
+ WalkState->ResultObj = NULL;
+
+ /* Call debugger for single step support (DEBUG build only) */
+
+ ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
+ ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
+
+ /* Decode the Opcode Class */
+
+ switch (OpClass)
+ {
+ case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
+ break;
+
+
+ case AML_CLASS_EXECUTE: /* most operators with arguments */
+
+ /* Build resolved operand stack */
+
+ Status = AcpiDsCreateOperands (WalkState, FirstArg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Done with this result state (Now that operand stack is built) */
+
+ Status = AcpiDsResultStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Resolve all operands */
+
+ Status = AcpiExResolveOperands (WalkState->Opcode,
+ &(WalkState->Operands [WalkState->NumOperands -1]),
+ WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ AcpiPsGetOpcodeName (WalkState->Opcode),
+ WalkState->NumOperands, "after ExResolveOperands");
+
+ /*
+ * Dispatch the request to the appropriate interpreter handler
+ * routine. There is one routine per opcode "type" based upon the
+ * number of opcode arguments and return type.
+ */
+ Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState);
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "[%s]: Could not resolve operands, %s\n",
+ AcpiPsGetOpcodeName (WalkState->Opcode),
+ AcpiFormatException (Status)));
+ }
+
+ /* Always delete the argument objects and clear the operand stack */
+
+ AcpiDsClearOperands (WalkState);
+
+ /*
+ * If a result object was returned from above, push it on the
+ * current result stack
+ */
+ if (ACPI_SUCCESS (Status) &&
+ WalkState->ResultObj)
+ {
+ Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
+ }
+
+ break;
+
+
+ default:
+
+ switch (OpType)
+ {
+ case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
+
+ /* 1 Operand, 0 ExternalResult, 0 InternalResult */
+
+ Status = AcpiDsExecEndControlOp (WalkState, Op);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ Status = AcpiDsResultStackPop (WalkState);
+ break;
+
+
+ case AML_TYPE_METHOD_CALL:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
+
+ /*
+ * (AML_METHODCALL) Op->Value->Arg->Node contains
+ * the method Node pointer
+ */
+ /* NextOp points to the op that holds the method name */
+
+ NextOp = FirstArg;
+
+ /* NextOp points to first argument op */
+
+ NextOp = NextOp->Common.Next;
+
+ /*
+ * Get the method's arguments and put them on the operand stack
+ */
+ Status = AcpiDsCreateOperands (WalkState, NextOp);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ /*
+ * Since the operands will be passed to another control method,
+ * we must resolve all local references here (Local variables,
+ * arguments to *this* method, etc.)
+ */
+ Status = AcpiDsResolveOperands (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ /* On error, clear all resolved operands */
+
+ AcpiDsClearOperands (WalkState);
+ break;
+ }
+
+ /*
+ * Tell the walk loop to preempt this running method and
+ * execute the new method
+ */
+ Status = AE_CTRL_TRANSFER;
+
+ /*
+ * Return now; we don't want to disturb anything,
+ * especially the operand count!
+ */
+ return_ACPI_STATUS (Status);
+
+
+ case AML_TYPE_CREATE_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Executing CreateField Buffer/Index Op=%p\n", Op));
+
+ Status = AcpiDsLoad2EndOp (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
+ break;
+
+
+ case AML_TYPE_CREATE_OBJECT:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Executing CreateObject (Buffer/Package) Op=%p\n", Op));
+
+ switch (Op->Common.Parent->Common.AmlOpcode)
+ {
+ case AML_NAME_OP:
+
+ /*
+ * Put the Node on the object stack (Contains the ACPI Name of
+ * this object)
+ */
+ WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
+ WalkState->NumOperands = 1;
+
+ Status = AcpiDsCreateNode (WalkState, Op->Common.Parent->Common.Node, Op->Common.Parent);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ /* Fall through */
+ /*lint -fallthrough */
+
+ case AML_INT_EVAL_SUBTREE_OP:
+
+ Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
+ AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
+ break;
+
+ default:
+
+ Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
+ break;
+ }
+
+ /*
+ * If a result object was returned from above, push it on the
+ * current result stack
+ */
+ if (ACPI_SUCCESS (Status) &&
+ WalkState->ResultObj)
+ {
+ Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
+ }
+ break;
+
+
+ case AML_TYPE_NAMED_FIELD:
+ case AML_TYPE_NAMED_COMPLEX:
+ case AML_TYPE_NAMED_SIMPLE:
+ case AML_TYPE_NAMED_NO_OBJ:
+
+ Status = AcpiDsLoad2EndOp (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Executing OpRegion Address/Length Op=%p\n", Op));
+
+ Status = AcpiDsEvalRegionOperands (WalkState, Op);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ Status = AcpiDsResultStackPop (WalkState);
+ }
+
+ break;
+
+
+ case AML_TYPE_UNDEFINED:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", Op));
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+
+
+ case AML_TYPE_BOGUS:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Internal opcode=%X type Op=%p\n",
+ WalkState->Opcode, Op));
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+ OpClass, OpType, Op->Common.AmlOpcode, Op));
+
+ Status = AE_NOT_IMPLEMENTED;
+ break;
+ }
+ }
+
+ /*
+ * ACPI 2.0 support for 64-bit integers: Truncate numeric
+ * result value if we are executing from a 32-bit ACPI table
+ */
+ AcpiExTruncateFor32bitTable (WalkState->ResultObj);
+
+ /*
+ * Check if we just completed the evaluation of a
+ * conditional predicate
+ */
+
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_PREDICATE_EXECUTING) &&
+ (WalkState->ControlState->Control.PredicateOp == Op))
+ {
+ Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
+ WalkState->ResultObj = NULL;
+ }
+
+
+Cleanup:
+ if (WalkState->ResultObj)
+ {
+ /* Break to debugger to display result */
+
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
+
+ /*
+ * Delete the result op if and only if:
+ * Parent will not use the result -- such as any
+ * non-nested type2 op in a method (parent will be method)
+ */
+ AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
+ }
+
+#ifdef _UNDER_DEVELOPMENT
+
+ if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
+ {
+ AcpiDbMethodEnd (WalkState);
+ }
+#endif
+
+ /* Always clear the object stack */
+
+ WalkState->NumOperands = 0;
+
+#ifdef ACPI_DISASSEMBLER
+
+ /* On error, display method locals/args */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDmDumpMethodInfo (Status, WalkState, Op);
+ }
+#endif
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c
new file mode 100644
index 0000000..bc9a308
--- /dev/null
+++ b/sys/contrib/dev/acpica/dswload.c
@@ -0,0 +1,1063 @@
+/******************************************************************************
+ *
+ * Module Name: dswload - Dispatcher namespace load callbacks
+ * $Revision: 83 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSWLOAD_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dswload")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsInitCallbacks
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * PassNumber - 1, 2, or 3
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Init walk state callbacks
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitCallbacks (
+ ACPI_WALK_STATE *WalkState,
+ UINT32 PassNumber)
+{
+
+ switch (PassNumber)
+ {
+ case 1:
+ WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
+ WalkState->AscendingCallback = AcpiDsLoad1EndOp;
+ break;
+
+ case 2:
+ WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
+ WalkState->AscendingCallback = AcpiDsLoad2EndOp;
+ break;
+
+ case 3:
+#ifndef ACPI_NO_METHOD_EXECUTION
+ WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
+ WalkState->DescendingCallback = AcpiDsExecBeginOp;
+ WalkState->AscendingCallback = AcpiDsExecEndOp;
+#endif
+ break;
+
+ default:
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad1BeginOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * Op - Op that has been just been reached in the
+ * walk; Arguments have not been evaluated yet.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during the loading of ACPI tables.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad1BeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ char *Path;
+ UINT32 Flags;
+
+
+ ACPI_FUNCTION_NAME ("DsLoad1BeginOp");
+
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
+
+ /* We are only interested in opcodes that have an associated name */
+
+ if (Op)
+ {
+ if (!(WalkState->OpInfo->Flags & AML_NAMED))
+ {
+#if 0
+ if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
+ (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
+ {
+ AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n", WalkState->OpInfo->Name);
+ *OutOp = Op;
+ return (AE_CTRL_SKIP);
+ }
+#endif
+ *OutOp = Op;
+ return (AE_OK);
+ }
+
+ /* Check if this object has already been installed in the namespace */
+
+ if (Op->Common.Node)
+ {
+ *OutOp = Op;
+ return (AE_OK);
+ }
+ }
+
+ Path = AcpiPsGetNextNamestring (&WalkState->ParserState);
+
+ /* Map the raw opcode into an internal object type */
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "State=%p Op=%p [%s] ", WalkState, Op, AcpiUtGetTypeName (ObjectType)));
+
+ switch (WalkState->Opcode)
+ {
+ case AML_SCOPE_OP:
+
+ /*
+ * The target name of the Scope() operator must exist at this point so
+ * that we can actually open the scope to enter new names underneath it.
+ * Allow search-to-root for single namesegs.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Path, Status);
+ return (Status);
+ }
+
+ /*
+ * Check to make sure that the target is
+ * one of the opcodes that actually opens a scope
+ */
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* These are acceptable types */
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * These types we will allow, but we will change the type. This
+ * enables some existing code of the form:
+ *
+ * Name (DEB, 0)
+ * Scope (DEB) { ... }
+ *
+ * Note: silently change the type here. On the second pass, we will report a warning
+ */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+ Path, AcpiUtGetTypeName (Node->Type)));
+
+ Node->Type = ACPI_TYPE_ANY;
+ WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
+ break;
+
+ default:
+
+ /* All other types are an error */
+
+ ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
+ AcpiUtGetTypeName (Node->Type), Path));
+
+ return (AE_AML_OPERAND_TYPE);
+ }
+ break;
+
+
+ default:
+
+ /*
+ * For all other named opcodes, we will enter the name into the namespace.
+ *
+ * Setup the search flags.
+ * Since we are entering a name into the namespace, we do not want to
+ * enable the search-to-root upsearch.
+ *
+ * There are only two conditions where it is acceptable that the name
+ * already exists:
+ * 1) the Scope() operator can reopen a scoping object that was
+ * previously defined (Scope, Method, Device, etc.)
+ * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
+ * BufferField, or Package), the name of the object is already
+ * in the namespace.
+ */
+ Flags = ACPI_NS_NO_UPSEARCH;
+ if ((WalkState->Opcode != AML_SCOPE_OP) &&
+ (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
+ {
+ Flags |= ACPI_NS_ERROR_IF_FOUND;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n"));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n"));
+ }
+
+ /*
+ * Enter the named type into the internal namespace. We enter the name
+ * as we go downward in the parse tree. Any necessary subobjects that involve
+ * arguments to the opcode must be created as we go back up the parse tree later.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (Path, Status);
+ return (Status);
+ }
+ break;
+ }
+
+
+ /* Common exit */
+
+ if (!Op)
+ {
+ /* Create a new op */
+
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ return (AE_NO_MEMORY);
+ }
+ }
+
+ /* Initialize */
+
+ Op->Named.Name = Node->Name.Integer;
+
+#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
+ Op->Named.Path = (UINT8 *) Path;
+#endif
+
+
+ /*
+ * Put the Node in the "op" object that the parser uses, so we
+ * can get it again quickly when this scope is closed
+ */
+ Op->Common.Node = Node;
+ AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
+
+ *OutOp = Op;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad1EndOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * Op - Op that has been just been completed in the
+ * walk; Arguments have now been evaluated.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during the loading of the namespace,
+ * both control methods and everything else.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad1EndOp (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_NAME ("DsLoad1EndOp");
+
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
+
+ /* We are only interested in opcodes that have an associated name */
+
+ if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
+ {
+ return (AE_OK);
+ }
+
+ /* Get the object type to determine if we should pop the scope */
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+ if (WalkState->OpInfo->Flags & AML_FIELD)
+ {
+ if (WalkState->Opcode == AML_FIELD_OP ||
+ WalkState->Opcode == AML_BANK_FIELD_OP ||
+ WalkState->Opcode == AML_INDEX_FIELD_OP)
+ {
+ Status = AcpiDsInitFieldObjects (Op, WalkState);
+ }
+ return (Status);
+ }
+
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+#endif
+
+ if (Op->Common.AmlOpcode == AML_NAME_OP)
+ {
+ /* For Name opcode, get the object type from the argument */
+
+ if (Op->Common.Value.Arg)
+ {
+ ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
+ Op->Common.Node->Type = (UINT8) ObjectType;
+ }
+ }
+
+ if (Op->Common.AmlOpcode == AML_METHOD_OP)
+ {
+ /*
+ * MethodOp PkgLength NameString MethodFlags TermList
+ *
+ * Note: We must create the method node/object pair as soon as we
+ * see the method declaration. This allows later pass1 parsing
+ * of invocations of the method (need to know the number of
+ * arguments.)
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Op->Named.Node));
+
+ if (!AcpiNsGetAttachedObject (Op->Named.Node))
+ {
+ WalkState->Operands[0] = (void *) Op->Named.Node;
+ WalkState->NumOperands = 1;
+
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExCreateMethod (Op->Named.Data,
+ Op->Named.Length, WalkState);
+ }
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ /* Pop the scope stack */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
+ AcpiUtGetTypeName (ObjectType), Op));
+
+ Status = AcpiDsScopeStackPop (WalkState);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad2BeginOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * Op - Op that has been just been reached in the
+ * walk; Arguments have not been evaluated yet.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during the loading of ACPI tables.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad2BeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ char *BufferPtr;
+
+
+ ACPI_FUNCTION_TRACE ("DsLoad2BeginOp");
+
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
+
+ if (Op)
+ {
+ /* We only care about Namespace opcodes here */
+
+ if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
+ (!(WalkState->OpInfo->Flags & AML_NAMED)))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Get the name we are going to enter or lookup in the namespace
+ */
+ if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
+ {
+ /* For Namepath op, get the path string */
+
+ BufferPtr = Op->Common.Value.String;
+ if (!BufferPtr)
+ {
+ /* No name, just exit */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+ else
+ {
+ /* Get name from the op */
+
+ BufferPtr = (char *) &Op->Named.Name;
+ }
+ }
+ else
+ {
+ /* Get the namestring from the raw AML */
+
+ BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
+ }
+
+ /* Map the opcode into an internal object type */
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+
+ Node = NULL;
+ Status = AE_OK;
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+
+ /*
+ * The NamePath is an object reference to an existing object. Don't enter the
+ * name into the namespace, but look it up for use later
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ break;
+
+ case AML_SCOPE_OP:
+
+ /*
+ * The Path is an object reference to an existing object. Don't enter the
+ * name into the namespace, but look it up for use later
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (BufferPtr, Status);
+ return_ACPI_STATUS (Status);
+ }
+ /*
+ * We must check to make sure that the target is
+ * one of the opcodes that actually opens a scope
+ */
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* These are acceptable types */
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * These types we will allow, but we will change the type. This
+ * enables some existing code of the form:
+ *
+ * Name (DEB, 0)
+ * Scope (DEB) { ... }
+ */
+
+ ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+ BufferPtr, AcpiUtGetTypeName (Node->Type)));
+
+ Node->Type = ACPI_TYPE_ANY;
+ WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
+ break;
+
+ default:
+
+ /* All other types are an error */
+
+ ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
+ AcpiUtGetTypeName (Node->Type), BufferPtr));
+
+ return (AE_AML_OPERAND_TYPE);
+ }
+ break;
+
+ default:
+
+ /* All other opcodes */
+
+ if (Op && Op->Common.Node)
+ {
+ /* This op/node was previously entered into the namespace */
+
+ Node = Op->Common.Node;
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ }
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Enter the named type into the internal namespace. We enter the name
+ * as we go downward in the parse tree. Any necessary subobjects that involve
+ * arguments to the opcode must be created as we go back up the parse tree later.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node));
+ break;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_NSERROR (BufferPtr, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+
+ if (!Op)
+ {
+ /* Create a new op */
+
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize the new op */
+
+ if (Node)
+ {
+ Op->Named.Name = Node->Name.Integer;
+ }
+ if (OutOp)
+ {
+ *OutOp = Op;
+ }
+ }
+
+ /*
+ * Put the Node in the "op" object that the parser uses, so we
+ * can get it again quickly when this scope is closed
+ */
+ Op->Common.Node = Node;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad2EndOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * Op - Op that has been just been completed in the
+ * walk; Arguments have now been evaluated.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during the loading of the namespace,
+ * both control methods and everything else.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad2EndOp (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_NAMESPACE_NODE *NewNode;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ UINT32 i;
+#endif
+
+
+ ACPI_FUNCTION_TRACE ("DsLoad2EndOp");
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
+ WalkState->OpInfo->Name, Op, WalkState));
+
+ /* Only interested in opcodes that have namespace objects */
+
+ if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (Op->Common.AmlOpcode == AML_SCOPE_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Ending scope Op=%p State=%p\n", Op, WalkState));
+ }
+
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+ /*
+ * Get the Node/name from the earlier lookup
+ * (It was saved in the *op structure)
+ */
+ Node = Op->Common.Node;
+
+ /*
+ * Put the Node on the object stack (Contains the ACPI Name of
+ * this object)
+ */
+ WalkState->Operands[0] = (void *) Node;
+ WalkState->NumOperands = 1;
+
+ /* Pop the scope stack */
+
+ if (AcpiNsOpensScope (ObjectType) && (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ AcpiUtGetTypeName (ObjectType), Op));
+
+ Status = AcpiDsScopeStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
+
+ /*
+ * Named operations are as follows:
+ *
+ * AML_ALIAS
+ * AML_BANKFIELD
+ * AML_CREATEBITFIELD
+ * AML_CREATEBYTEFIELD
+ * AML_CREATEDWORDFIELD
+ * AML_CREATEFIELD
+ * AML_CREATEQWORDFIELD
+ * AML_CREATEWORDFIELD
+ * AML_DATA_REGION
+ * AML_DEVICE
+ * AML_EVENT
+ * AML_FIELD
+ * AML_INDEXFIELD
+ * AML_METHOD
+ * AML_METHODCALL
+ * AML_MUTEX
+ * AML_NAME
+ * AML_NAMEDFIELD
+ * AML_OPREGION
+ * AML_POWERRES
+ * AML_PROCESSOR
+ * AML_SCOPE
+ * AML_THERMALZONE
+ */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
+
+ /* Decode the opcode */
+
+ Arg = Op->Common.Value.Arg;
+
+ switch (WalkState->OpInfo->Type)
+ {
+#ifndef ACPI_NO_METHOD_EXECUTION
+
+ case AML_TYPE_CREATE_FIELD:
+
+ /*
+ * Create the field object, but the field buffer and index must
+ * be evaluated later during the execution phase
+ */
+ Status = AcpiDsCreateBufferField (Op, WalkState);
+ break;
+
+
+ case AML_TYPE_NAMED_FIELD:
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_INDEX_FIELD_OP:
+
+ Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
+ WalkState);
+ break;
+
+ case AML_BANK_FIELD_OP:
+
+ Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
+ break;
+
+ case AML_FIELD_OP:
+
+ Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
+ break;
+
+ default:
+ /* All NAMED_FIELD opcodes must be handled above */
+ break;
+ }
+ break;
+
+
+ case AML_TYPE_NAMED_SIMPLE:
+
+ Status = AcpiDsCreateOperands (WalkState, Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_PROCESSOR_OP:
+
+ Status = AcpiExCreateProcessor (WalkState);
+ break;
+
+ case AML_POWER_RES_OP:
+
+ Status = AcpiExCreatePowerResource (WalkState);
+ break;
+
+ case AML_MUTEX_OP:
+
+ Status = AcpiExCreateMutex (WalkState);
+ break;
+
+ case AML_EVENT_OP:
+
+ Status = AcpiExCreateEvent (WalkState);
+ break;
+
+ case AML_DATA_REGION_OP:
+
+ Status = AcpiExCreateTableRegion (WalkState);
+ break;
+
+ case AML_ALIAS_OP:
+
+ Status = AcpiExCreateAlias (WalkState);
+ break;
+
+ default:
+ /* Unknown opcode */
+
+ Status = AE_OK;
+ goto Cleanup;
+ }
+
+ /* Delete operands */
+
+ for (i = 1; i < WalkState->NumOperands; i++)
+ {
+ AcpiUtRemoveReference (WalkState->Operands[i]);
+ WalkState->Operands[i] = NULL;
+ }
+
+ break;
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
+ case AML_TYPE_NAMED_COMPLEX:
+
+ switch (Op->Common.AmlOpcode)
+ {
+#ifndef ACPI_NO_METHOD_EXECUTION
+ case AML_REGION_OP:
+ /*
+ * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
+ * (We must save the address of the AML of the address and length operands)
+ */
+ /*
+ * If we have a valid region, initialize it
+ * Namespace is NOT locked at this point.
+ */
+ Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * If AE_NOT_EXIST is returned, it is not fatal
+ * because many regions get created before a handler
+ * is installed for said region.
+ */
+ if (AE_NOT_EXIST == Status)
+ {
+ Status = AE_OK;
+ }
+ }
+ break;
+
+
+ case AML_NAME_OP:
+
+ Status = AcpiDsCreateNode (WalkState, Node, Op);
+ break;
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
+
+ default:
+ /* All NAMED_COMPLEX opcodes must be handled above */
+ /* Note: Method objects were already created in Pass 1 */
+ break;
+ }
+ break;
+
+
+ case AML_CLASS_INTERNAL:
+
+ /* case AML_INT_NAMEPATH_OP: */
+ break;
+
+
+ case AML_CLASS_METHOD_CALL:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Node));
+
+ /*
+ * Lookup the method name and save the Node
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &(NewNode));
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Make sure that what we found is indeed a method
+ * We didn't search for a method on purpose, to see if the name would resolve
+ */
+ if (NewNode->Type != ACPI_TYPE_METHOD)
+ {
+ Status = AE_AML_OPERAND_TYPE;
+ }
+
+ /* We could put the returned object (Node) on the object stack for later, but
+ * for now, we will put it in the "op" object that the parser uses, so we
+ * can get it again at the end of this scope
+ */
+ Op->Common.Node = NewNode;
+ }
+ else
+ {
+ ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+Cleanup:
+
+ /* Remove the Node pushed at the very beginning */
+
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c
new file mode 100644
index 0000000..fb6f579
--- /dev/null
+++ b/sys/contrib/dev/acpica/dswscope.c
@@ -0,0 +1,315 @@
+/******************************************************************************
+ *
+ * Module Name: dswscope - Scope stack manipulation
+ * $Revision: 57 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __DSWSCOPE_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dswscope")
+
+
+#define STACK_POP(head) head
+
+
+/****************************************************************************
+ *
+ * FUNCTION: AcpiDsScopeStackClear
+ *
+ * PARAMETERS: None
+ *
+ * DESCRIPTION: Pop (and free) everything on the scope stack except the
+ * root scope object (which remains at the stack top.)
+ *
+ ***************************************************************************/
+
+void
+AcpiDsScopeStackClear (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *ScopeInfo;
+
+ ACPI_FUNCTION_NAME ("DsScopeStackClear");
+
+
+ while (WalkState->ScopeInfo)
+ {
+ /* Pop a scope off the stack */
+
+ ScopeInfo = WalkState->ScopeInfo;
+ WalkState->ScopeInfo = ScopeInfo->Scope.Next;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value)));
+ AcpiUtDeleteGenericState (ScopeInfo);
+ }
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: AcpiDsScopeStackPush
+ *
+ * PARAMETERS: *Node, - Name to be made current
+ * Type, - Type of frame being pushed
+ *
+ * DESCRIPTION: Push the current scope on the scope stack, and make the
+ * passed Node current.
+ *
+ ***************************************************************************/
+
+ACPI_STATUS
+AcpiDsScopeStackPush (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *ScopeInfo;
+ ACPI_GENERIC_STATE *OldScopeInfo;
+
+
+ ACPI_FUNCTION_TRACE ("DsScopeStackPush");
+
+
+ if (!Node)
+ {
+ /* Invalid scope */
+
+ ACPI_REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Make sure object type is valid */
+
+ if (!AcpiUtValidObjectType (Type))
+ {
+ ACPI_REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
+ }
+
+
+ /* Allocate a new scope object */
+
+ ScopeInfo = AcpiUtCreateGenericState ();
+ if (!ScopeInfo)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Init new scope object */
+
+ ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE;
+ ScopeInfo->Scope.Node = Node;
+ ScopeInfo->Common.Value = (UINT16) Type;
+
+ WalkState->ScopeDepth++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[%.2d] Pushed scope ", (UINT32) WalkState->ScopeDepth));
+
+ OldScopeInfo = WalkState->ScopeInfo;
+ if (OldScopeInfo)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
+ "[%4.4s] (%10s)",
+ OldScopeInfo->Scope.Node->Name.Ascii,
+ AcpiUtGetTypeName (OldScopeInfo->Common.Value)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
+ "[\\___] (%10s)", "ROOT"));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
+ ", New scope -> [%4.4s] (%s)\n",
+ ScopeInfo->Scope.Node->Name.Ascii,
+ AcpiUtGetTypeName (ScopeInfo->Common.Value)));
+
+ /* Push new scope object onto stack */
+
+ AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: AcpiDsScopeStackPop
+ *
+ * PARAMETERS: Type - The type of frame to be found
+ *
+ * DESCRIPTION: Pop the scope stack until a frame of the requested type
+ * is found.
+ *
+ * RETURN: Count of frames popped. If no frame of the requested type
+ * was found, the count is returned as a negative number and
+ * the scope stack is emptied (which sets the current scope
+ * to the root). If the scope stack was empty at entry, the
+ * function is a no-op and returns 0.
+ *
+ ***************************************************************************/
+
+ACPI_STATUS
+AcpiDsScopeStackPop (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *ScopeInfo;
+ ACPI_GENERIC_STATE *NewScopeInfo;
+
+
+ ACPI_FUNCTION_TRACE ("DsScopeStackPop");
+
+
+ /*
+ * Pop scope info object off the stack.
+ */
+ ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo);
+ if (!ScopeInfo)
+ {
+ return_ACPI_STATUS (AE_STACK_UNDERFLOW);
+ }
+
+ WalkState->ScopeDepth--;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[%.2d] Popped scope [%4.4s] (%10s), New scope -> ",
+ (UINT32) WalkState->ScopeDepth,
+ ScopeInfo->Scope.Node->Name.Ascii,
+ AcpiUtGetTypeName (ScopeInfo->Common.Value)));
+
+ NewScopeInfo = WalkState->ScopeInfo;
+ if (NewScopeInfo)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
+ "[%4.4s] (%s)\n",
+ NewScopeInfo->Scope.Node->Name.Ascii,
+ AcpiUtGetTypeName (NewScopeInfo->Common.Value)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
+ "[\\___] (ROOT)\n"));
+ }
+
+ AcpiUtDeleteGenericState (ScopeInfo);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c
new file mode 100644
index 0000000..783dcab
--- /dev/null
+++ b/sys/contrib/dev/acpica/dswstate.c
@@ -0,0 +1,1200 @@
+/******************************************************************************
+ *
+ * Module Name: dswstate - Dispatcher parse tree walk management routines
+ * $Revision: 75 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __DSWSTATE_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dswstate")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultInsert
+ *
+ * PARAMETERS: Object - Object to push
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push an object onto this walk's result stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultInsert (
+ void *Object,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_NAME ("DsResultInsert");
+
+
+ State = WalkState->Results;
+ if (!State)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
+ WalkState));
+ return (AE_NOT_EXIST);
+ }
+
+ if (Index >= ACPI_OBJ_NUM_OPERANDS)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Index out of range: %X Obj=%p State=%p Num=%X\n",
+ Index, Object, WalkState, State->Results.NumResults));
+ return (AE_BAD_PARAMETER);
+ }
+
+ if (!Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
+ Index, Object, WalkState, State->Results.NumResults));
+ return (AE_BAD_PARAMETER);
+ }
+
+ State->Results.ObjDesc [Index] = Object;
+ State->Results.NumResults++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+ Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
+ WalkState, State->Results.NumResults, WalkState->CurrentResult));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultRemove
+ *
+ * PARAMETERS: Object - Where to return the popped object
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
+ * other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultRemove (
+ ACPI_OPERAND_OBJECT **Object,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_NAME ("DsResultRemove");
+
+
+ State = WalkState->Results;
+ if (!State)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
+ WalkState));
+ return (AE_NOT_EXIST);
+ }
+
+ if (Index >= ACPI_OBJ_MAX_OPERAND)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Index out of range: %X State=%p Num=%X\n",
+ Index, WalkState, State->Results.NumResults));
+ }
+
+ /* Check for a valid result object */
+
+ if (!State->Results.ObjDesc [Index])
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Null operand! State=%p #Ops=%X, Index=%X\n",
+ WalkState, State->Results.NumResults, Index));
+ return (AE_AML_NO_RETURN_VALUE);
+ }
+
+ /* Remove the object */
+
+ State->Results.NumResults--;
+
+ *Object = State->Results.ObjDesc [Index];
+ State->Results.ObjDesc [Index] = NULL;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+ *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
+ Index, WalkState, State->Results.NumResults));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultPop
+ *
+ * PARAMETERS: Object - Where to return the popped object
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
+ * other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultPop (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_NATIVE_UINT Index;
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_NAME ("DsResultPop");
+
+
+ State = WalkState->Results;
+ if (!State)
+ {
+ return (AE_OK);
+ }
+
+ if (!State->Results.NumResults)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
+ WalkState));
+ return (AE_AML_NO_RETURN_VALUE);
+ }
+
+ /* Remove top element */
+
+ State->Results.NumResults--;
+
+ for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
+ {
+ /* Check for a valid result object */
+
+ if (State->Results.ObjDesc [Index -1])
+ {
+ *Object = State->Results.ObjDesc [Index -1];
+ State->Results.ObjDesc [Index -1] = NULL;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+ *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
+ (UINT32) Index -1, WalkState, State->Results.NumResults));
+
+ return (AE_OK);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
+ return (AE_AML_NO_RETURN_VALUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultPopFromBottom
+ *
+ * PARAMETERS: Object - Where to return the popped object
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
+ * other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultPopFromBottom (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_NATIVE_UINT Index;
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
+
+
+ State = WalkState->Results;
+ if (!State)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Warning: No result object pushed! State=%p\n", WalkState));
+ return (AE_NOT_EXIST);
+ }
+
+ if (!State->Results.NumResults)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
+ return (AE_AML_NO_RETURN_VALUE);
+ }
+
+ /* Remove Bottom element */
+
+ *Object = State->Results.ObjDesc [0];
+
+ /* Push entire stack down one element */
+
+ for (Index = 0; Index < State->Results.NumResults; Index++)
+ {
+ State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
+ }
+
+ State->Results.NumResults--;
+
+ /* Check for a valid result object */
+
+ if (!*Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
+ WalkState, State->Results.NumResults, (UINT32) Index));
+ return (AE_AML_NO_RETURN_VALUE);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
+ *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
+ State, WalkState));
+
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultPush
+ *
+ * PARAMETERS: Object - Where to return the popped object
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push an object onto the current result stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultPush (
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_NAME ("DsResultPush");
+
+
+ State = WalkState->Results;
+ if (!State)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n"));
+ return (AE_AML_INTERNAL);
+ }
+
+ if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Result stack overflow: Obj=%p State=%p Num=%X\n",
+ Object, WalkState, State->Results.NumResults));
+ return (AE_STACK_OVERFLOW);
+ }
+
+ if (!Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n",
+ Object, WalkState, State->Results.NumResults));
+ return (AE_BAD_PARAMETER);
+ }
+
+ State->Results.ObjDesc [State->Results.NumResults] = Object;
+ State->Results.NumResults++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+ Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
+ WalkState, State->Results.NumResults, WalkState->CurrentResult));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultStackPush
+ *
+ * PARAMETERS: Object - Object to push
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push an object onto the WalkState result stack.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultStackPush (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+ ACPI_FUNCTION_NAME ("DsResultStackPush");
+
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT;
+ AcpiUtPushGenericState (&WalkState->Results, State);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
+ State, WalkState));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsResultStackPop
+ *
+ * PARAMETERS: WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop an object off of the WalkState result stack.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsResultStackPop (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+ ACPI_FUNCTION_NAME ("DsResultStackPop");
+
+
+ /* Check for stack underflow */
+
+ if (WalkState->Results == NULL)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
+ WalkState));
+ return (AE_AML_NO_OPERAND);
+ }
+
+
+ State = AcpiUtPopGenericState (&WalkState->Results);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Result=%p RemainingResults=%X State=%p\n",
+ State, State->Results.NumResults, WalkState));
+
+ AcpiUtDeleteGenericState (State);
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackDeleteAll
+ *
+ * PARAMETERS: WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
+ * Should be used with great care, if at all!
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsObjStackDeleteAll (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
+
+
+ /* The stack size is configurable, but fixed */
+
+ for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
+ {
+ if (WalkState->Operands[i])
+ {
+ AcpiUtRemoveReference (WalkState->Operands[i]);
+ WalkState->Operands[i] = NULL;
+ }
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackPush
+ *
+ * PARAMETERS: Object - Object to push
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push an object onto this walk's object/operand stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsObjStackPush (
+ void *Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_FUNCTION_NAME ("DsObjStackPush");
+
+
+ /* Check for stack overflow */
+
+ if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "overflow! Obj=%p State=%p #Ops=%X\n",
+ Object, WalkState, WalkState->NumOperands));
+ return (AE_STACK_OVERFLOW);
+ }
+
+ /* Put the object onto the stack */
+
+ WalkState->Operands [WalkState->NumOperands] = Object;
+ WalkState->NumOperands++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+ Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
+ WalkState, WalkState->NumOperands));
+
+ return (AE_OK);
+}
+
+
+#if 0
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackPopObject
+ *
+ * PARAMETERS: PopCount - Number of objects/entries to pop
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
+ * deleted by this routine.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsObjStackPopObject (
+ ACPI_OPERAND_OBJECT **Object,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_FUNCTION_NAME ("DsObjStackPopObject");
+
+
+ /* Check for stack underflow */
+
+ if (WalkState->NumOperands == 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Missing operand/stack empty! State=%p #Ops=%X\n",
+ WalkState, WalkState->NumOperands));
+ *Object = NULL;
+ return (AE_AML_NO_OPERAND);
+ }
+
+ /* Pop the stack */
+
+ WalkState->NumOperands--;
+
+ /* Check for a valid operand */
+
+ if (!WalkState->Operands [WalkState->NumOperands])
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Null operand! State=%p #Ops=%X\n",
+ WalkState, WalkState->NumOperands));
+ *Object = NULL;
+ return (AE_AML_NO_OPERAND);
+ }
+
+ /* Get operand and set stack entry to null */
+
+ *Object = WalkState->Operands [WalkState->NumOperands];
+ WalkState->Operands [WalkState->NumOperands] = NULL;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+ *Object, AcpiUtGetObjectTypeName (*Object),
+ WalkState, WalkState->NumOperands));
+
+ return (AE_OK);
+}
+#endif
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackPop
+ *
+ * PARAMETERS: PopCount - Number of objects/entries to pop
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
+ * deleted by this routine.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsObjStackPop (
+ UINT32 PopCount,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+
+ ACPI_FUNCTION_NAME ("DsObjStackPop");
+
+
+ for (i = 0; i < PopCount; i++)
+ {
+ /* Check for stack underflow */
+
+ if (WalkState->NumOperands == 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Underflow! Count=%X State=%p #Ops=%X\n",
+ PopCount, WalkState, WalkState->NumOperands));
+ return (AE_STACK_UNDERFLOW);
+ }
+
+ /* Just set the stack entry to null */
+
+ WalkState->NumOperands--;
+ WalkState->Operands [WalkState->NumOperands] = NULL;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+ PopCount, WalkState, WalkState->NumOperands));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackPopAndDelete
+ *
+ * PARAMETERS: PopCount - Number of objects/entries to pop
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop this walk's object stack and delete each object that is
+ * popped off.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsObjStackPopAndDelete (
+ UINT32 PopCount,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+ ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
+
+
+ for (i = 0; i < PopCount; i++)
+ {
+ /* Check for stack underflow */
+
+ if (WalkState->NumOperands == 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Underflow! Count=%X State=%p #Ops=%X\n",
+ PopCount, WalkState, WalkState->NumOperands));
+ return (AE_STACK_UNDERFLOW);
+ }
+
+ /* Pop the stack and delete an object if present in this stack entry */
+
+ WalkState->NumOperands--;
+ ObjDesc = WalkState->Operands [WalkState->NumOperands];
+ if (ObjDesc)
+ {
+ AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
+ WalkState->Operands [WalkState->NumOperands] = NULL;
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+ PopCount, WalkState, WalkState->NumOperands));
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsObjStackGetValue
+ *
+ * PARAMETERS: Index - Stack index whose value is desired. Based
+ * on the top of the stack (index=0 == top)
+ * WalkState - Current Walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieve an object from this walk's object stack. Index must
+ * be within the range of the current stack pointer.
+ *
+ ******************************************************************************/
+
+void *
+AcpiDsObjStackGetValue (
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+
+ ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
+
+
+ /* Can't do it if the stack is empty */
+
+ if (WalkState->NumOperands == 0)
+ {
+ return_PTR (NULL);
+ }
+
+ /* or if the index is past the top of the stack */
+
+ if (Index > (WalkState->NumOperands - (UINT32) 1))
+ {
+ return_PTR (NULL);
+ }
+
+ return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) -
+ Index]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetCurrentWalkState
+ *
+ * PARAMETERS: Thread - Get current active state for this Thread
+ *
+ * RETURN: Pointer to the current walk state
+ *
+ * DESCRIPTION: Get the walk state that is at the head of the list (the "current"
+ * walk state.)
+ *
+ ******************************************************************************/
+
+ACPI_WALK_STATE *
+AcpiDsGetCurrentWalkState (
+ ACPI_THREAD_STATE *Thread)
+
+{
+ ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
+
+
+ if (!Thread)
+ {
+ return (NULL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current WalkState %p\n",
+ Thread->WalkStateList));
+
+ return (Thread->WalkStateList);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsPushWalkState
+ *
+ * PARAMETERS: WalkState - State to push
+ * WalkList - The list that owns the walk stack
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Place the WalkState at the head of the state list.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsPushWalkState (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_THREAD_STATE *Thread)
+{
+ ACPI_FUNCTION_TRACE ("DsPushWalkState");
+
+
+ WalkState->Next = Thread->WalkStateList;
+ Thread->WalkStateList = WalkState;
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsPopWalkState
+ *
+ * PARAMETERS: WalkList - The list that owns the walk stack
+ *
+ * RETURN: A WalkState object popped from the stack
+ *
+ * DESCRIPTION: Remove and return the walkstate object that is at the head of
+ * the walk stack for the given walk list. NULL indicates that
+ * the list is empty.
+ *
+ ******************************************************************************/
+
+ACPI_WALK_STATE *
+AcpiDsPopWalkState (
+ ACPI_THREAD_STATE *Thread)
+{
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE ("DsPopWalkState");
+
+
+ WalkState = Thread->WalkStateList;
+
+ if (WalkState)
+ {
+ /* Next walk state becomes the current walk state */
+
+ Thread->WalkStateList = WalkState->Next;
+
+ /*
+ * Don't clear the NEXT field, this serves as an indicator
+ * that there is a parent WALK STATE
+ * NO: WalkState->Next = NULL;
+ */
+ }
+
+ return_PTR (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateWalkState
+ *
+ * PARAMETERS: Origin - Starting point for this walk
+ * Thread - Current thread state
+ *
+ * RETURN: Pointer to the new walk state.
+ *
+ * DESCRIPTION: Allocate and initialize a new walk state. The current walk
+ * state is set to this new state.
+ *
+ ******************************************************************************/
+
+ACPI_WALK_STATE *
+AcpiDsCreateWalkState (
+ ACPI_OWNER_ID OwnerId,
+ ACPI_PARSE_OBJECT *Origin,
+ ACPI_OPERAND_OBJECT *MthDesc,
+ ACPI_THREAD_STATE *Thread)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("DsCreateWalkState");
+
+
+ WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
+ if (!WalkState)
+ {
+ return_PTR (NULL);
+ }
+
+ WalkState->DataType = ACPI_DESC_TYPE_WALK;
+ WalkState->OwnerId = OwnerId;
+ WalkState->Origin = Origin;
+ WalkState->MethodDesc = MthDesc;
+ WalkState->Thread = Thread;
+
+ WalkState->ParserState.StartOp = Origin;
+
+ /* Init the method args/local */
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+ AcpiDsMethodDataInit (WalkState);
+#endif
+
+ /* Create an initial result stack entry */
+
+ Status = AcpiDsResultStackPush (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_PTR (NULL);
+ }
+
+ /* Put the new state at the head of the walk list */
+
+ if (Thread)
+ {
+ AcpiDsPushWalkState (WalkState, Thread);
+ }
+
+ return_PTR (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsInitAmlWalk
+ *
+ * PARAMETERS: WalkState - New state to be initialized
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsInitAmlWalk (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_NAMESPACE_NODE *MethodNode,
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc,
+ UINT32 PassNumber)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
+ ACPI_PARSE_OBJECT *ExtraOp;
+
+
+ ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
+
+
+ WalkState->ParserState.Aml =
+ WalkState->ParserState.AmlStart = AmlStart;
+ WalkState->ParserState.AmlEnd =
+ WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
+
+ /* The NextOp of the NextWalk will be the beginning of the method */
+
+ WalkState->NextOp = NULL;
+ WalkState->Params = Params;
+ WalkState->CallerReturnDesc = ReturnObjDesc;
+
+ Status = AcpiPsInitScope (&WalkState->ParserState, Op);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (MethodNode)
+ {
+ WalkState->ParserState.StartNode = MethodNode;
+ WalkState->WalkType = ACPI_WALK_METHOD;
+ WalkState->MethodNode = MethodNode;
+ WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
+
+ /* Push start scope on scope stack and make it current */
+
+ Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Init the method arguments */
+
+ Status = AcpiDsMethodDataInitArgs (Params, ACPI_METHOD_NUM_ARGS, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ /*
+ * Setup the current scope.
+ * Find a Named Op that has a namespace node associated with it.
+ * search upwards from this Op. Current scope is the first
+ * Op with a namespace node.
+ */
+ ExtraOp = ParserState->StartOp;
+ while (ExtraOp && !ExtraOp->Common.Node)
+ {
+ ExtraOp = ExtraOp->Common.Parent;
+ }
+ if (!ExtraOp)
+ {
+ ParserState->StartNode = NULL;
+ }
+ else
+ {
+ ParserState->StartNode = ExtraOp->Common.Node;
+ }
+
+ if (ParserState->StartNode)
+ {
+ /* Push start scope on scope stack and make it current */
+
+ Status = AcpiDsScopeStackPush (ParserState->StartNode,
+ ParserState->StartNode->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+
+ Status = AcpiDsInitCallbacks (WalkState, PassNumber);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsDeleteWalkState
+ *
+ * PARAMETERS: WalkState - State to delete
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete a walk state including all internal data structures
+ *
+ ******************************************************************************/
+
+void
+AcpiDsDeleteWalkState (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
+
+
+ if (!WalkState)
+ {
+ return;
+ }
+
+ if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", WalkState));
+ return;
+ }
+
+ if (WalkState->ParserState.Scope)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState));
+ }
+
+ /* Always must free any linked control states */
+
+ while (WalkState->ControlState)
+ {
+ State = WalkState->ControlState;
+ WalkState->ControlState = State->Common.Next;
+
+ AcpiUtDeleteGenericState (State);
+ }
+
+ /* Always must free any linked parse states */
+
+ while (WalkState->ScopeInfo)
+ {
+ State = WalkState->ScopeInfo;
+ WalkState->ScopeInfo = State->Common.Next;
+
+ AcpiUtDeleteGenericState (State);
+ }
+
+ /* Always must free any stacked result states */
+
+ while (WalkState->Results)
+ {
+ State = WalkState->Results;
+ WalkState->Results = State->Common.Next;
+
+ AcpiUtDeleteGenericState (State);
+ }
+
+ AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
+ return_VOID;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiDsDeleteWalkStateCache
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Purge the global state object cache. Used during subsystem
+ * termination.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsDeleteWalkStateCache (
+ void)
+{
+ ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
+
+
+ AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c
new file mode 100644
index 0000000..f2a852f
--- /dev/null
+++ b/sys/contrib/dev/acpica/evevent.c
@@ -0,0 +1,381 @@
+/******************************************************************************
+ *
+ * Module Name: evevent - Fixed Event handling and dispatch
+ * $Revision: 111 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evevent")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize global data structures for events.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitialize (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInitialize");
+
+
+ /* Make sure we have ACPI tables */
+
+ if (!AcpiGbl_DSDT)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /*
+ * Initialize the Fixed and General Purpose Events. This is
+ * done prior to enabling SCIs to prevent interrupts from
+ * occurring before handers are installed.
+ */
+ Status = AcpiEvFixedEventInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Unable to initialize fixed events, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiEvGpeInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Unable to initialize general purpose events, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvHandlerInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install interrupt handlers for the SCI and Global Lock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvHandlerInitialize (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvHandlerInitialize");
+
+
+ /* Install the SCI handler */
+
+ Status = AcpiEvInstallSciHandler ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Unable to install System Control Interrupt Handler, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the handler for the Global Lock */
+
+ Status = AcpiEvInitGlobalLockHandler ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Unable to initialize Global Lock handler, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ AcpiGbl_EventsInitialized = TRUE;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvFixedEventInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install the fixed event handlers and enable the fixed events.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvFixedEventInitialize (
+ void)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status;
+
+
+ /*
+ * Initialize the structure that keeps track of fixed event handlers
+ * and enable the fixed events.
+ */
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ AcpiGbl_FixedEventHandlers[i].Handler = NULL;
+ AcpiGbl_FixedEventHandlers[i].Context = NULL;
+
+ /* Enable the fixed event */
+
+ if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
+ {
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[i].EnableRegisterId,
+ 0, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvFixedEventDetect
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
+ *
+ * DESCRIPTION: Checks the PM status register for fixed events
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvFixedEventDetect (
+ void)
+{
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+ UINT32 FixedStatus;
+ UINT32 FixedEnable;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_NAME ("EvFixedEventDetect");
+
+
+ /*
+ * Read the fixed feature status and enable registers, as all the cases
+ * depend on their values. Ignore errors here.
+ */
+ (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &FixedStatus);
+ (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+ "Fixed Event Block: Enable %08X Status %08X\n",
+ FixedEnable, FixedStatus));
+
+ /*
+ * Check for all possible Fixed Events and dispatch those that are active
+ */
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ /* Both the status and enable bits must be on for this event */
+
+ if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) &&
+ (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask))
+ {
+ /* Found an active (signalled) event */
+
+ IntStatus |= AcpiEvFixedEventDispatch ((UINT32) i);
+ }
+ }
+
+ return (IntStatus);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvFixedEventDispatch
+ *
+ * PARAMETERS: Event - Event type
+ *
+ * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
+ *
+ * DESCRIPTION: Clears the status bit for the requested event, calls the
+ * handler that previously registered for the event.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvFixedEventDispatch (
+ UINT32 Event)
+{
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Clear the status bit */
+
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ 1, ACPI_MTX_DO_NOT_LOCK);
+
+ /*
+ * Make sure we've got a handler. If not, report an error.
+ * The event is disabled to prevent further interrupts.
+ */
+ if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
+ {
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 0, ACPI_MTX_DO_NOT_LOCK);
+
+ ACPI_REPORT_ERROR (
+ ("No installed handler for fixed event [%08X]\n",
+ Event));
+
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+
+ /* Invoke the Fixed Event handler */
+
+ return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
+ AcpiGbl_FixedEventHandlers[Event].Context));
+}
+
+
diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c
new file mode 100644
index 0000000..6f6402d
--- /dev/null
+++ b/sys/contrib/dev/acpica/evgpe.c
@@ -0,0 +1,528 @@
+/******************************************************************************
+ *
+ * Module Name: evgpe - General Purpose Event handling and dispatch
+ * $Revision: 27 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evgpe")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeEventInfo
+ *
+ * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
+ * GpeNumber - Raw GPE number
+ *
+ * RETURN: A GPE EventInfo struct. NULL if not a valid GPE
+ *
+ * DESCRIPTION: Returns the EventInfo struct associated with this GPE.
+ * Validates the GpeBlock and the GpeNumber
+ *
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
+ *
+ ******************************************************************************/
+
+ACPI_GPE_EVENT_INFO *
+AcpiEvGetGpeEventInfo (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* A NULL GpeBlock means use the FADT-defined GPE block(s) */
+
+ if (!GpeDevice)
+ {
+ /* Examine GPE Block 0 and 1 (These blocks are permanent) */
+
+ for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
+ {
+ GpeBlock = AcpiGbl_GpeFadtBlocks[i];
+ if (GpeBlock)
+ {
+ if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
+ (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+ {
+ return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
+ }
+ }
+ }
+
+ /* The GpeNumber was not in the range of either FADT GPE block */
+
+ return (NULL);
+ }
+
+ /*
+ * A Non-null GpeDevice means this is a GPE Block Device.
+ */
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice);
+ if (!ObjDesc ||
+ !ObjDesc->Device.GpeBlock)
+ {
+ return (NULL);
+ }
+
+ GpeBlock = ObjDesc->Device.GpeBlock;
+
+ if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
+ (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+ {
+ return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeDetect
+ *
+ * PARAMETERS: GpeXruptList - Interrupt block for this interrupt.
+ * Can have multiple GPE blocks attached.
+ *
+ * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
+ *
+ * DESCRIPTION: Detect if any GP events have occurred. This function is
+ * executed at interrupt level.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvGpeDetect (
+ ACPI_GPE_XRUPT_INFO *GpeXruptList)
+{
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+ UINT8 EnabledStatusByte;
+ UINT8 BitMask;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT32 InValue;
+ ACPI_STATUS Status;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ UINT32 GpeNumber;
+ UINT32 i;
+ UINT32 j;
+
+
+ ACPI_FUNCTION_NAME ("EvGpeDetect");
+
+
+ /* Examine all GPE blocks attached to this interrupt level */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
+ GpeBlock = GpeXruptList->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ /*
+ * Read all of the 8-bit GPE status and enable registers
+ * in this GPE block, saving all of them.
+ * Find all currently active GP events.
+ */
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /* Get the next status/enable pair */
+
+ GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
+
+ /* Read the Status Register */
+
+ Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue,
+ &GpeRegisterInfo->StatusAddress);
+ GpeRegisterInfo->Status = (UINT8) InValue;
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Read the Enable Register */
+
+ Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue,
+ &GpeRegisterInfo->EnableAddress);
+ GpeRegisterInfo->Enable = (UINT8) InValue;
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+ "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
+ GpeRegisterInfo->Status,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)),
+ GpeRegisterInfo->Enable));
+
+ /* First check if there is anything active at all in this register */
+
+ EnabledStatusByte = (UINT8) (GpeRegisterInfo->Status &
+ GpeRegisterInfo->Enable);
+ if (!EnabledStatusByte)
+ {
+ /* No active GPEs in this register, move on */
+
+ continue;
+ }
+
+ /* Now look at the individual GPEs in this byte register */
+
+ for (j = 0, BitMask = 1; j < ACPI_GPE_REGISTER_WIDTH; j++, BitMask <<= 1)
+ {
+ /* Examine one GPE bit */
+
+ if (EnabledStatusByte & BitMask)
+ {
+ /*
+ * Found an active GPE. Dispatch the event to a handler
+ * or method.
+ */
+ GpeNumber = (i * ACPI_GPE_REGISTER_WIDTH) + j;
+
+ IntStatus |= AcpiEvGpeDispatch (
+ &GpeBlock->EventInfo[GpeNumber],
+ GpeNumber + GpeBlock->RegisterInfo[GpeNumber].BaseGpeNumber);
+ }
+ }
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+UnlockAndExit:
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
+ return (IntStatus);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvAsynchExecuteGpeMethod
+ *
+ * PARAMETERS: Context (GpeEventInfo) - Info for this GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Perform the actual execution of a GPE control method. This
+ * function is called from an invocation of AcpiOsQueueForExecution
+ * (and therefore does NOT execute at interrupt level) so that
+ * the control method itself is not executed in the context of
+ * an interrupt handler.
+ *
+ ******************************************************************************/
+
+static void ACPI_SYSTEM_XFACE
+AcpiEvAsynchExecuteGpeMethod (
+ void *Context)
+{
+ ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
+ UINT32 GpeNumber = 0;
+ ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ /* Must revalidate the GpeNumber/GpeBlock */
+
+ if (!AcpiEvValidGpeEvent (GpeEventInfo))
+ {
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_VOID;
+ }
+
+ /*
+ * Take a snapshot of the GPE info for this level - we copy the
+ * info to prevent a race condition with RemoveHandler/RemoveBlock.
+ */
+ ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo, sizeof (ACPI_GPE_EVENT_INFO));
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ if (LocalGpeEventInfo.MethodNode)
+ {
+ /*
+ * Invoke the GPE Method (_Lxx, _Exx):
+ * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
+ */
+ Status = AcpiNsEvaluateByHandle (LocalGpeEventInfo.MethodNode, NULL, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n",
+ AcpiFormatException (Status),
+ LocalGpeEventInfo.MethodNode->Name.Ascii, GpeNumber));
+ }
+ }
+
+ if (LocalGpeEventInfo.Flags & ACPI_EVENT_LEVEL_TRIGGERED)
+ {
+ /*
+ * GPE is level-triggered, we clear the GPE status bit after handling
+ * the event.
+ */
+ Status = AcpiHwClearGpe (&LocalGpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+ }
+
+ /* Enable this GPE */
+
+ (void) AcpiHwEnableGpe (&LocalGpeEventInfo);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeDispatch
+ *
+ * PARAMETERS: GpeEventInfo - info for this GPE
+ * GpeNumber - Number relative to the parent GPE block
+ *
+ * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
+ *
+ * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
+ * or method (e.g. _Lxx/_Exx) handler.
+ *
+ * This function executes at interrupt level.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvGpeDispatch (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvGpeDispatch");
+
+
+ /*
+ * If edge-triggered, clear the GPE status bit now. Note that
+ * level-triggered events are cleared after the GPE is serviced.
+ */
+ if (GpeEventInfo->Flags & ACPI_EVENT_EDGE_TRIGGERED)
+ {
+ Status = AcpiHwClearGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
+ GpeNumber));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+ }
+
+ /*
+ * Dispatch the GPE to either an installed handler, or the control
+ * method associated with this GPE (_Lxx or _Exx).
+ * If a handler exists, we invoke it and do not attempt to run the method.
+ * If there is neither a handler nor a method, we disable the level to
+ * prevent further events from coming in here.
+ */
+ if (GpeEventInfo->Handler)
+ {
+ /* Invoke the installed handler (at interrupt level) */
+
+ GpeEventInfo->Handler (GpeEventInfo->Context);
+ }
+ else if (GpeEventInfo->MethodNode)
+ {
+ /*
+ * Disable GPE, so it doesn't keep firing before the method has a
+ * chance to run.
+ */
+ Status = AcpiHwDisableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
+ GpeNumber));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+
+ /* Execute the method associated with the GPE. */
+
+ if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
+ AcpiEvAsynchExecuteGpeMethod,
+ GpeEventInfo)))
+ {
+ ACPI_REPORT_ERROR ((
+ "AcpiEvGpeDispatch: Unable to queue handler for GPE[%2X], event is disabled\n",
+ GpeNumber));
+ }
+ }
+ else
+ {
+ /* No handler or method to run! */
+
+ ACPI_REPORT_ERROR ((
+ "AcpiEvGpeDispatch: No handler or method for GPE[%2X], disabling event\n",
+ GpeNumber));
+
+ /*
+ * Disable the GPE. The GPE will remain disabled until the ACPI
+ * Core Subsystem is restarted, or the handler is reinstalled.
+ */
+ Status = AcpiHwDisableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
+ GpeNumber));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+ }
+
+ /* It is now safe to clear level-triggered events. */
+
+ if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED)
+ {
+ Status = AcpiHwClearGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
+ GpeNumber));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+ }
+
+ return_VALUE (ACPI_INTERRUPT_HANDLED);
+}
+
diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c
new file mode 100644
index 0000000..bd2fd22
--- /dev/null
+++ b/sys/contrib/dev/acpica/evgpeblk.c
@@ -0,0 +1,1032 @@
+/******************************************************************************
+ *
+ * Module Name: evgpeblk - GPE block creation and initialization.
+ * $Revision: 23 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evgpeblk")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvValidGpeEvent
+ *
+ * PARAMETERS: GpeEventInfo - Info for this GPE
+ *
+ * RETURN: TRUE if the GpeEvent is valid
+ *
+ * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* No need for spin lock since we are not changing any list elements */
+
+ /* Walk the GPE interrupt levels */
+
+ GpeXruptBlock = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptBlock)
+ {
+ GpeBlock = GpeXruptBlock->GpeBlockListHead;
+
+ /* Walk the GPE blocks on this interrupt level */
+
+ while (GpeBlock)
+ {
+ if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
+ (&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
+ {
+ return (TRUE);
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptBlock = GpeXruptBlock->Next;
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvWalkGpeList
+ *
+ * PARAMETERS: GpeWalkCallback - Routine called for each GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk the GPE lists.
+ * FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("EvWalkGpeList");
+
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
+
+ /* Walk the interrupt level descriptor list */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ /* Walk all Gpe Blocks attached to this interrupt level */
+
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ /* One callback per GPE block */
+
+ Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
+ }
+
+UnlockAndExit:
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvSaveMethodInfo
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
+ * control method under the _GPE portion of the namespace.
+ * Extract the name and GPE type from the object, saving this
+ * information for quick lookup during GPE dispatch
+ *
+ * The name of each GPE control method is of the form:
+ * "_Lnn" or "_Enn"
+ * Where:
+ * L - means that the GPE is level triggered
+ * E - means that the GPE is edge triggered
+ * nn - is the GPE number [in HEX]
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvSaveMethodInfo (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *ObjDesc,
+ void **ReturnValue)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock = (void *) ObjDesc;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ UINT32 GpeNumber;
+ char Name[ACPI_NAME_SIZE + 1];
+ UINT8 Type;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
+
+
+ /* Extract the name from the object and convert to a string */
+
+ ACPI_MOVE_32_TO_32 (Name,
+ &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
+ Name[ACPI_NAME_SIZE] = 0;
+
+ /*
+ * Edge/Level determination is based on the 2nd character
+ * of the method name
+ */
+ switch (Name[1])
+ {
+ case 'L':
+ Type = ACPI_EVENT_LEVEL_TRIGGERED;
+ break;
+
+ case 'E':
+ Type = ACPI_EVENT_EDGE_TRIGGERED;
+ break;
+
+ default:
+ /* Unknown method type, just ignore it! */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
+ Name));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Convert the last two characters of the name to the GPE Number */
+
+ GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
+ if (GpeNumber == ACPI_UINT32_MAX)
+ {
+ /* Conversion failed; invalid method, just ignore it */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not extract GPE number from name: %s (name is not of form _Lnn or _Enn)\n",
+ Name));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Ensure that we have a valid GPE number for this GPE block */
+
+ if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
+ (GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
+ {
+ /*
+ * Not valid for this GPE block, just ignore it
+ * However, it may be valid for a different GPE block, since GPE0 and GPE1
+ * methods both appear under \_GPE.
+ */
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Now we can add this information to the GpeEventInfo block
+ * for use during dispatch of this GPE.
+ */
+ GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
+
+ GpeEventInfo->Flags = Type;
+ GpeEventInfo->MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
+
+ /* Enable the GPE (SCIs should be disabled at this point) */
+
+ Status = AcpiHwEnableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Registered GPE method %s as GPE number 0x%.2X\n",
+ Name, GpeNumber));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeXruptBlock
+ *
+ * PARAMETERS: InterruptLevel - Interrupt for a GPE block
+ *
+ * RETURN: A GPE interrupt block
+ *
+ * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
+ * block per unique interrupt level used for GPEs.
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
+ *
+ ******************************************************************************/
+
+static ACPI_GPE_XRUPT_INFO *
+AcpiEvGetGpeXruptBlock (
+ UINT32 InterruptLevel)
+{
+ ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
+ ACPI_GPE_XRUPT_INFO *GpeXrupt;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
+
+
+ /* No need for spin lock since we are not changing any list elements here */
+
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt)
+ {
+ if (NextGpeXrupt->InterruptLevel == InterruptLevel)
+ {
+ return_PTR (NextGpeXrupt);
+ }
+
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ /* Not found, must allocate a new xrupt descriptor */
+
+ GpeXrupt = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_XRUPT_INFO));
+ if (!GpeXrupt)
+ {
+ return_PTR (NULL);
+ }
+
+ GpeXrupt->InterruptLevel = InterruptLevel;
+
+ /* Install new interrupt descriptor with spin lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (AcpiGbl_GpeXruptListHead)
+ {
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt->Next)
+ {
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ NextGpeXrupt->Next = GpeXrupt;
+ GpeXrupt->Previous = NextGpeXrupt;
+ }
+ else
+ {
+ AcpiGbl_GpeXruptListHead = GpeXrupt;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+ /* Install new interrupt handler if not SCI_INT */
+
+ if (InterruptLevel != AcpiGbl_FADT->SciInt)
+ {
+ Status = AcpiOsInstallInterruptHandler (InterruptLevel,
+ AcpiEvGpeXruptHandler, GpeXrupt);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not install GPE interrupt handler at level 0x%X\n",
+ InterruptLevel));
+ return_PTR (NULL);
+ }
+ }
+
+ return_PTR (GpeXrupt);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeXrupt
+ *
+ * PARAMETERS: GpeXrupt - A GPE interrupt info block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
+ * interrupt handler if not the SCI interrupt.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvDeleteGpeXrupt (
+ ACPI_GPE_XRUPT_INFO *GpeXrupt)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
+
+
+ /* We never want to remove the SCI interrupt handler */
+
+ if (GpeXrupt->InterruptLevel == AcpiGbl_FADT->SciInt)
+ {
+ GpeXrupt->GpeBlockListHead = NULL;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Disable this interrupt */
+
+ Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptLevel,
+ AcpiEvGpeXruptHandler);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Unlink the interrupt block with lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeXrupt->Previous)
+ {
+ GpeXrupt->Previous->Next = GpeXrupt->Next;
+ }
+
+ if (GpeXrupt->Next)
+ {
+ GpeXrupt->Next->Previous = GpeXrupt->Previous;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+ /* Free the block */
+
+ ACPI_MEM_FREE (GpeXrupt);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInstallGpeBlock
+ *
+ * PARAMETERS: GpeBlock - New GPE block
+ * InterruptLevel - Level to be associated with this GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install new GPE block with mutex support
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvInstallGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ UINT32 InterruptLevel)
+{
+ ACPI_GPE_BLOCK_INFO *NextGpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptLevel);
+ if (!GpeXruptBlock)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /* Install the new block at the end of the list for this interrupt with lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeXruptBlock->GpeBlockListHead)
+ {
+ NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
+ while (NextGpeBlock->Next)
+ {
+ NextGpeBlock = NextGpeBlock->Next;
+ }
+
+ NextGpeBlock->Next = GpeBlock;
+ GpeBlock->Previous = NextGpeBlock;
+ }
+ else
+ {
+ GpeXruptBlock->GpeBlockListHead = GpeBlock;
+ }
+
+ GpeBlock->XruptBlock = GpeXruptBlock;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+UnlockAndExit:
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeBlock
+ *
+ * PARAMETERS: GpeBlock - Existing GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install new GPE block with mutex support
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvDeleteGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Disable all GPEs in this block */
+
+ Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
+
+ if (!GpeBlock->Previous && !GpeBlock->Next)
+ {
+ /* This is the last GpeBlock on this interrupt */
+
+ Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+ else
+ {
+ /* Remove the block on this interrupt with lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeBlock->Previous)
+ {
+ GpeBlock->Previous->Next = GpeBlock->Next;
+ }
+ else
+ {
+ GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
+ }
+
+ if (GpeBlock->Next)
+ {
+ GpeBlock->Next->Previous = GpeBlock->Previous;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ }
+
+ /* Free the GpeBlock */
+
+ ACPI_MEM_FREE (GpeBlock->RegisterInfo);
+ ACPI_MEM_FREE (GpeBlock->EventInfo);
+ ACPI_MEM_FREE (GpeBlock);
+
+UnlockAndExit:
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvCreateGpeInfoBlocks
+ *
+ * PARAMETERS: GpeBlock - New GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvCreateGpeInfoBlocks (
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo = NULL;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL;
+ ACPI_GPE_EVENT_INFO *ThisEvent;
+ ACPI_GPE_REGISTER_INFO *ThisRegister;
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvCreateGpeInfoBlocks");
+
+
+ /* Allocate the GPE register information block */
+
+ GpeRegisterInfo = ACPI_MEM_CALLOCATE (
+ (ACPI_SIZE) GpeBlock->RegisterCount *
+ sizeof (ACPI_GPE_REGISTER_INFO));
+ if (!GpeRegisterInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not allocate the GpeRegisterInfo table\n"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Allocate the GPE EventInfo block. There are eight distinct GPEs
+ * per register. Initialization to zeros is sufficient.
+ */
+ GpeEventInfo = ACPI_MEM_CALLOCATE (
+ ((ACPI_SIZE) GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) *
+ sizeof (ACPI_GPE_EVENT_INFO));
+ if (!GpeEventInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeEventInfo table\n"));
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
+ }
+
+ /* Save the new Info arrays in the GPE block */
+
+ GpeBlock->RegisterInfo = GpeRegisterInfo;
+ GpeBlock->EventInfo = GpeEventInfo;
+
+ /*
+ * Initialize the GPE Register and Event structures. A goal of these
+ * tables is to hide the fact that there are two separate GPE register sets
+ * in a given gpe hardware block, the status registers occupy the first half,
+ * and the enable registers occupy the second half.
+ */
+ ThisRegister = GpeRegisterInfo;
+ ThisEvent = GpeEventInfo;
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /* Init the RegisterInfo for this GPE register (8 GPEs) */
+
+ ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber +
+ (i * ACPI_GPE_REGISTER_WIDTH));
+
+ ACPI_STORE_ADDRESS (ThisRegister->StatusAddress.Address,
+ (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
+ + i));
+
+ ACPI_STORE_ADDRESS (ThisRegister->EnableAddress.Address,
+ (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
+ + i
+ + GpeBlock->RegisterCount));
+
+ ThisRegister->StatusAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
+ ThisRegister->EnableAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
+ ThisRegister->StatusAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->EnableAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->StatusAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->EnableAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
+
+ /* Init the EventInfo for each GPE within this register */
+
+ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
+ {
+ ThisEvent->BitMask = AcpiGbl_DecodeTo8bit[j];
+ ThisEvent->RegisterInfo = ThisRegister;
+ ThisEvent++;
+ }
+
+ /*
+ * Clear the status/enable registers. Note that status registers
+ * are cleared by writing a '1', while enable registers are cleared
+ * by writing a '0'.
+ */
+ Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
+ &ThisRegister->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
+ &ThisRegister->StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ThisRegister++;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+
+
+ErrorExit:
+ if (GpeRegisterInfo)
+ {
+ ACPI_MEM_FREE (GpeRegisterInfo);
+ }
+ if (GpeEventInfo)
+ {
+ ACPI_MEM_FREE (GpeEventInfo);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvCreateGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE block
+ * GpeBlockAddress - Address and SpaceID
+ * RegisterCount - Number of GPE register pairs in the block
+ * GpeBlockBaseNumber - Starting GPE number for the block
+ * InterruptLevel - H/W interrupt for the block
+ * ReturnGpeBlock - Where the new block descriptor is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create and Install a block of GPE registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvCreateGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT8 GpeBlockBaseNumber,
+ UINT32 InterruptLevel,
+ ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
+
+
+ if (!RegisterCount)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Allocate a new GPE block */
+
+ GpeBlock = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_BLOCK_INFO));
+ if (!GpeBlock)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize the new GPE block */
+
+ GpeBlock->RegisterCount = RegisterCount;
+ GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
+
+ ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, sizeof (ACPI_GENERIC_ADDRESS));
+
+ /* Create the RegisterInfo and EventInfo sub-structures */
+
+ Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_MEM_FREE (GpeBlock);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the new block in the global list(s) */
+
+ Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptLevel);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_MEM_FREE (GpeBlock);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Dump info about this GPE block */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE %02d to %02d [%4.4s] %d regs at %8.8X%8.8X on int %d\n",
+ GpeBlock->BlockBaseNumber,
+ (UINT32) (GpeBlock->BlockBaseNumber +
+ ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
+ GpeDevice->Name.Ascii,
+ GpeBlock->RegisterCount,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
+ InterruptLevel));
+
+ /* Find all GPE methods (_Lxx, _Exx) for this block */
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
+ GpeBlock, NULL);
+
+ /* Return the new block */
+
+ if (ReturnGpeBlock)
+ {
+ (*ReturnGpeBlock) = GpeBlock;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the GPE data structures
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvGpeInitialize (void)
+{
+ UINT32 RegisterCount0 = 0;
+ UINT32 RegisterCount1 = 0;
+ UINT32 GpeNumberMax = 0;
+ ACPI_HANDLE GpeDevice;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvGpeInitialize");
+
+
+ /* Get a handle to the predefined _GPE object */
+
+ Status = AcpiGetHandle (NULL, "\\_GPE", &GpeDevice);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Initialize the GPE Blocks defined in the FADT
+ *
+ * Why the GPE register block lengths are divided by 2: From the ACPI Spec,
+ * section "General-Purpose Event Registers", we have:
+ *
+ * "Each register block contains two registers of equal length
+ * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+ * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+ * The length of the GPE1_STS and GPE1_EN registers is equal to
+ * half the GPE1_LEN. If a generic register block is not supported
+ * then its respective block pointer and block length values in the
+ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+ * to be the same size."
+ */
+
+ /*
+ * Determine the maximum GPE number for this machine.
+ *
+ * Note: both GPE0 and GPE1 are optional, and either can exist without
+ * the other.
+ *
+ * If EITHER the register length OR the block address are zero, then that
+ * particular block is not supported.
+ */
+ if (AcpiGbl_FADT->Gpe0BlkLen &&
+ ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address))
+ {
+ /* GPE block 0 exists (has both length and address > 0) */
+
+ RegisterCount0 = (UINT16) (AcpiGbl_FADT->Gpe0BlkLen / 2);
+
+ GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
+
+ /* Install GPE Block 0 */
+
+ Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe0Blk,
+ RegisterCount0, 0, AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not create GPE Block 0, %s\n",
+ AcpiFormatException (Status)));
+ }
+ }
+
+ if (AcpiGbl_FADT->Gpe1BlkLen &&
+ ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address))
+ {
+ /* GPE block 1 exists (has both length and address > 0) */
+
+ RegisterCount1 = (UINT16) (AcpiGbl_FADT->Gpe1BlkLen / 2);
+
+ /* Check for GPE0/GPE1 overlap (if both banks exist) */
+
+ if ((RegisterCount0) &&
+ (GpeNumberMax >= AcpiGbl_FADT->Gpe1Base))
+ {
+ ACPI_REPORT_ERROR ((
+ "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
+ GpeNumberMax, AcpiGbl_FADT->Gpe1Base,
+ AcpiGbl_FADT->Gpe1Base +
+ ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
+
+ /* Ignore GPE1 block by setting the register count to zero */
+
+ RegisterCount1 = 0;
+ }
+ else
+ {
+ /* Install GPE Block 1 */
+
+ Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe1Blk,
+ RegisterCount1, AcpiGbl_FADT->Gpe1Base,
+ AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not create GPE Block 1, %s\n",
+ AcpiFormatException (Status)));
+ }
+
+ /*
+ * GPE0 and GPE1 do not have to be contiguous in the GPE number
+ * space. However, GPE0 always starts at GPE number zero.
+ */
+ GpeNumberMax = AcpiGbl_FADT->Gpe1Base +
+ ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
+ }
+ }
+
+ /* Exit if there are no GPE registers */
+
+ if ((RegisterCount0 + RegisterCount1) == 0)
+ {
+ /* GPEs are not required by ACPI, this is OK */
+
+ ACPI_REPORT_INFO (("There are no GPE blocks defined in the FADT\n"));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Check for Max GPE number out-of-range */
+
+ if (GpeNumberMax > ACPI_GPE_MAX)
+ {
+ ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
+ GpeNumberMax));
+ return_ACPI_STATUS (AE_BAD_VALUE);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c
new file mode 100644
index 0000000..a2f08b9
--- /dev/null
+++ b/sys/contrib/dev/acpica/evmisc.c
@@ -0,0 +1,674 @@
+/******************************************************************************
+ *
+ * Module Name: evmisc - Miscellaneous event manager support functions
+ * $Revision: 68 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvIsNotifyObject
+ *
+ * PARAMETERS: Node - Node to check
+ *
+ * RETURN: TRUE if notifies allowed on this object
+ *
+ * DESCRIPTION: Check type of node for a object that supports notifies.
+ *
+ * TBD: This could be replaced by a flag bit in the node.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiEvIsNotifyObject (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_THERMAL:
+ /*
+ * These are the ONLY objects that can receive ACPI notifications
+ */
+ return (TRUE);
+
+ default:
+ return (FALSE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvQueueNotifyRequest
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Dispatch a device notification event to a previously
+ * installed handler.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvQueueNotifyRequest (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 NotifyValue)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj = NULL;
+ ACPI_GENERIC_STATE *NotifyInfo;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_NAME ("EvQueueNotifyRequest");
+
+
+ /*
+ * For value 1 (Ejection Request), some device method may need to be run.
+ * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run.
+ * For value 0x80 (Status Change) on the power button or sleep button,
+ * initiate soft-off or sleep operation?
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Dispatching Notify(%X) on node %p\n", NotifyValue, Node));
+
+ switch (NotifyValue)
+ {
+ case 0:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Re-enumerate Devices\n"));
+ break;
+
+ case 1:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Ejection Request\n"));
+ break;
+
+ case 2:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Device Wake\n"));
+ break;
+
+ case 0x80:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Status Change\n"));
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %X \n", NotifyValue));
+ break;
+ }
+
+ /*
+ * Get the notify object attached to the NS Node
+ */
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /* We have the notify object, Get the right handler */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
+ {
+ HandlerObj = ObjDesc->CommonNotify.SystemNotify;
+ }
+ else
+ {
+ HandlerObj = ObjDesc->CommonNotify.DeviceNotify;
+ }
+ break;
+
+ default:
+ /* All other types are not supported */
+ return (AE_TYPE);
+ }
+ }
+
+ /* If there is any handler to run, schedule the dispatcher */
+
+ if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
+ (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
+ HandlerObj)
+ {
+ NotifyInfo = AcpiUtCreateGenericState ();
+ if (!NotifyInfo)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ NotifyInfo->Common.DataType = ACPI_DESC_TYPE_STATE_NOTIFY;
+ NotifyInfo->Notify.Node = Node;
+ NotifyInfo->Notify.Value = (UINT16) NotifyValue;
+ NotifyInfo->Notify.HandlerObj = HandlerObj;
+
+ Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
+ AcpiEvNotifyDispatch, NotifyInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteGenericState (NotifyInfo);
+ }
+ }
+
+ if (!HandlerObj)
+ {
+ /* There is no per-device notify handler for this device */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "No notify handler for [%4.4s] node %p\n", Node->Name.Ascii, Node));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvNotifyDispatch
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Dispatch a device notification event to a previously
+ * installed handler.
+ *
+ ******************************************************************************/
+
+void ACPI_SYSTEM_XFACE
+AcpiEvNotifyDispatch (
+ void *Context)
+{
+ ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context;
+ ACPI_NOTIFY_HANDLER GlobalHandler = NULL;
+ void *GlobalContext = NULL;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * We will invoke a global notify handler if installed.
+ * This is done _before_ we invoke the per-device handler attached to the device.
+ */
+ if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
+ {
+ /* Global system notification handler */
+
+ if (AcpiGbl_SystemNotify.Handler)
+ {
+ GlobalHandler = AcpiGbl_SystemNotify.Handler;
+ GlobalContext = AcpiGbl_SystemNotify.Context;
+ }
+ }
+ else
+ {
+ /* Global driver notification handler */
+
+ if (AcpiGbl_DeviceNotify.Handler)
+ {
+ GlobalHandler = AcpiGbl_DeviceNotify.Handler;
+ GlobalContext = AcpiGbl_DeviceNotify.Context;
+ }
+ }
+
+ /* Invoke the system handler first, if present */
+
+ if (GlobalHandler)
+ {
+ GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, GlobalContext);
+ }
+
+ /* Now invoke the per-device handler, if present */
+
+ HandlerObj = NotifyInfo->Notify.HandlerObj;
+ if (HandlerObj)
+ {
+ HandlerObj->Notify.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
+ HandlerObj->Notify.Context);
+ }
+
+ /* All done with the info object */
+
+ AcpiUtDeleteGenericState (NotifyInfo);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGlobalLockThread
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the
+ * Global Lock. Simply signal all threads that are waiting
+ * for the lock.
+ *
+ ******************************************************************************/
+
+static void ACPI_SYSTEM_XFACE
+AcpiEvGlobalLockThread (
+ void *Context)
+{
+ ACPI_STATUS Status;
+
+
+ /* Signal threads that are waiting for the lock */
+
+ if (AcpiGbl_GlobalLockThreadCount)
+ {
+ /* Send sufficient units to the semaphore */
+
+ Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore,
+ AcpiGbl_GlobalLockThreadCount);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGlobalLockHandler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Invoked directly from the SCI handler when a global lock
+ * release interrupt occurs. Grab the global lock and queue
+ * the global lock thread for execution
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiEvGlobalLockHandler (
+ void *Context)
+{
+ BOOLEAN Acquired = FALSE;
+ ACPI_STATUS Status;
+
+
+ /*
+ * Attempt to get the lock
+ * If we don't get it now, it will be marked pending and we will
+ * take another interrupt when it becomes free.
+ */
+ ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ if (Acquired)
+ {
+ /* Got the lock, now wake all threads waiting for it */
+
+ AcpiGbl_GlobalLockAcquired = TRUE;
+
+ /* Run the Global Lock thread which will signal all waiting threads */
+
+ Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
+ AcpiEvGlobalLockThread, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
+ AcpiFormatException (Status)));
+
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+ }
+
+ return (ACPI_INTERRUPT_HANDLED);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitGlobalLockHandler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for the global lock release event
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitGlobalLockHandler (void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInitGlobalLockHandler");
+
+
+ AcpiGbl_GlobalLockPresent = TRUE;
+ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
+ AcpiEvGlobalLockHandler, NULL);
+
+ /*
+ * If the global lock does not exist on this platform, the attempt
+ * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
+ * Map to AE_OK, but mark global lock as not present.
+ * Any attempt to actually use the global lock will be flagged
+ * with an error.
+ */
+ if (Status == AE_NO_HARDWARE_RESPONSE)
+ {
+ AcpiGbl_GlobalLockPresent = FALSE;
+ Status = AE_OK;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEvAcquireGlobalLock
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Attempt to gain ownership of the Global Lock.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiEvAcquireGlobalLock (
+ UINT16 Timeout)
+{
+ ACPI_STATUS Status = AE_OK;
+ BOOLEAN Acquired = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("EvAcquireGlobalLock");
+
+
+#ifndef ACPI_APPLICATION
+ /* Make sure that we actually have a global lock */
+
+ if (!AcpiGbl_GlobalLockPresent)
+ {
+ return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
+ }
+#endif
+
+ /* One more thread wants the global lock */
+
+ AcpiGbl_GlobalLockThreadCount++;
+
+ /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
+
+ if (AcpiGbl_GlobalLockAcquired)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* We must acquire the actual hardware lock */
+
+ ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ if (Acquired)
+ {
+ /* We got the lock */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
+
+ AcpiGbl_GlobalLockAcquired = TRUE;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Did not get the lock. The pending bit was set above, and we must now
+ * wait until we get the global lock released interrupt.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
+
+ /*
+ * Acquire the global lock semaphore first.
+ * Since this wait will block, we must release the interpreter
+ */
+ Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
+ Timeout);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvReleaseGlobalLock
+ *
+ * DESCRIPTION: Releases ownership of the Global Lock.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvReleaseGlobalLock (void)
+{
+ BOOLEAN Pending = FALSE;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock");
+
+
+ if (!AcpiGbl_GlobalLockThreadCount)
+ {
+ ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
+ return_ACPI_STATUS (AE_NOT_ACQUIRED);
+ }
+
+ /* One fewer thread has the global lock */
+
+ AcpiGbl_GlobalLockThreadCount--;
+ if (AcpiGbl_GlobalLockThreadCount)
+ {
+ /* There are still some threads holding the lock, cannot release */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * No more threads holding lock, we can do the actual hardware
+ * release
+ */
+ ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
+ AcpiGbl_GlobalLockAcquired = FALSE;
+
+ /*
+ * If the pending bit was set, we must write GBL_RLS to the control
+ * register
+ */
+ if (Pending)
+ {
+ Status = AcpiSetRegister (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEvTerminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Disable events and free memory allocated for table storage.
+ *
+ ******************************************************************************/
+
+void
+AcpiEvTerminate (void)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvTerminate");
+
+
+ if (AcpiGbl_EventsInitialized)
+ {
+ /*
+ * Disable all event-related functionality.
+ * In all cases, on error, print a message but obviously we don't abort.
+ */
+
+ /* Disable all fixed events */
+
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ Status = AcpiDisableEvent ((UINT32) i, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (UINT32) i));
+ }
+ }
+
+ /* Disable all GPEs in all GPE blocks */
+
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
+
+ /* Remove SCI handler */
+
+ Status = AcpiEvRemoveSciHandler ();
+ if (ACPI_FAILURE(Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n"));
+ }
+ }
+
+ /* Return to original mode if necessary */
+
+ if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)
+ {
+ Status = AcpiDisable ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiDisable failed\n"));
+ }
+ }
+ return_VOID;
+}
+
diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c
new file mode 100644
index 0000000..1404b31
--- /dev/null
+++ b/sys/contrib/dev/acpica/evregion.c
@@ -0,0 +1,818 @@
+/******************************************************************************
+ *
+ * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
+ * $Revision: 141 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EVREGION_C__
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evregion")
+
+#define ACPI_NUM_DEFAULT_SPACES 4
+
+UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = {
+ ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ ACPI_ADR_SPACE_SYSTEM_IO,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_DATA_TABLE};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitAddressSpaces
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Installs the core subsystem default address space handlers.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitAddressSpaces (
+ void)
+{
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("EvInitAddressSpaces");
+
+
+ /*
+ * All address spaces (PCI Config, EC, SMBus) are scope dependent
+ * and registration must occur for a specific device.
+ *
+ * In the case of the system memory and IO address spaces there is currently
+ * no device associated with the address space. For these we use the root.
+ *
+ * We install the default PCI config space handler at the root so
+ * that this space is immediately available even though the we have
+ * not enumerated all the PCI Root Buses yet. This is to conform
+ * to the ACPI specification which states that the PCI config
+ * space must be always available -- even though we are nowhere
+ * near ready to find the PCI root buses at this point.
+ *
+ * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
+ * has already been installed (via AcpiInstallAddressSpaceHandler).
+ * Similar for AE_SAME_HANDLER.
+ */
+
+ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
+ {
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
+ AcpiGbl_DefaultAddressSpaces[i],
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ switch (Status)
+ {
+ case AE_OK:
+ case AE_SAME_HANDLER:
+ case AE_ALREADY_EXISTS:
+
+ /* These exceptions are all OK */
+
+ break;
+
+ default:
+
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvExecuteRegMethod
+ *
+ * PARAMETERS: RegionObj - Object structure
+ * Function - On (1) or Off (0)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute _REG method for a region
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvExecuteRegMethod (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ UINT32 Function)
+{
+ ACPI_OPERAND_OBJECT *Params[3];
+ ACPI_OPERAND_OBJECT *RegionObj2;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvExecuteRegMethod");
+
+
+ RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
+ if (!RegionObj2)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ if (RegionObj2->Extra.Method_REG == NULL)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * _REG method has two arguments
+ * Arg0: Integer: Operation region space ID
+ * Same value as RegionObj->Region.SpaceId
+ * Arg1: Integer: connection status
+ * 1 for connecting the handler,
+ * 0 for disconnecting the handler
+ * Passed as a parameter
+ */
+ Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Params[0])
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Params[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Params[1])
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Set up the parameter objects */
+
+ Params[0]->Integer.Value = RegionObj->Region.SpaceId;
+ Params[1]->Integer.Value = Function;
+ Params[2] = NULL;
+
+ /* Execute the method, no return value */
+
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, RegionObj2->Extra.Method_REG, NULL));
+ Status = AcpiNsEvaluateByHandle (RegionObj2->Extra.Method_REG, Params, NULL);
+
+ AcpiUtRemoveReference (Params[1]);
+
+Cleanup:
+ AcpiUtRemoveReference (Params[0]);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvAddressSpaceDispatch
+ *
+ * PARAMETERS: RegionObj - internal region object
+ * SpaceId - ID of the address space (0-255)
+ * Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, 32, or 64)
+ * Value - Pointer to in or out value
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Dispatch an address space or operation region access to
+ * a previously installed handler.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvAddressSpaceDispatch (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ void *Value)
+{
+ ACPI_STATUS Status;
+ ACPI_STATUS Status2;
+ ACPI_ADR_SPACE_HANDLER Handler;
+ ACPI_ADR_SPACE_SETUP RegionSetup;
+ ACPI_OPERAND_OBJECT *HandlerDesc;
+ ACPI_OPERAND_OBJECT *RegionObj2;
+ void *RegionContext = NULL;
+
+
+ ACPI_FUNCTION_TRACE ("EvAddressSpaceDispatch");
+
+
+ RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
+ if (!RegionObj2)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Ensure that there is a handler associated with this region */
+
+ HandlerDesc = RegionObj->Region.AddressSpace;
+ if (!HandlerDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n",
+ RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /*
+ * It may be the case that the region has never been initialized
+ * Some types of regions require special init code
+ */
+ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
+ {
+ /*
+ * This region has not been initialized yet, do it
+ */
+ RegionSetup = HandlerDesc->AddressSpace.Setup;
+ if (!RegionSetup)
+ {
+ /* No initialization routine, exit with error */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n",
+ RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /*
+ * We must exit the interpreter because the region setup will potentially
+ * execute control methods (e.g., _REG method for this region)
+ */
+ AcpiExExitInterpreter ();
+
+ Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
+ HandlerDesc->AddressSpace.Context, &RegionContext);
+
+ /* Re-enter the interpreter */
+
+ Status2 = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+
+ /* Check for failure of the Region Setup */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
+ AcpiFormatException (Status),
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Region initialization may have been completed by RegionSetup
+ */
+ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
+ {
+ RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
+
+ if (RegionObj2->Extra.RegionContext)
+ {
+ /* The handler for this region was already installed */
+
+ ACPI_MEM_FREE (RegionContext);
+ }
+ else
+ {
+ /*
+ * Save the returned context for use in all accesses to
+ * this particular region
+ */
+ RegionObj2->Extra.RegionContext = RegionContext;
+ }
+ }
+ }
+
+ /* We have everything we need, we can invoke the address space handler */
+
+ Handler = HandlerDesc->AddressSpace.Handler;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
+ &RegionObj->Region.AddressSpace->AddressSpace, Handler,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address),
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+
+ if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ {
+ /*
+ * For handlers other than the default (supplied) handlers, we must
+ * exit the interpreter because the handler *might* block -- we don't
+ * know what it will do, so we can't hold the lock on the intepreter.
+ */
+ AcpiExExitInterpreter();
+ }
+
+ /* Call the handler */
+
+ Status = Handler (Function, Address, BitWidth, Value,
+ HandlerDesc->AddressSpace.Context,
+ RegionObj2->Extra.RegionContext);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId),
+ AcpiFormatException (Status)));
+ }
+
+ if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ {
+ /*
+ * We just returned from a non-default handler, we must re-enter the
+ * interpreter
+ */
+ Status2 = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDetachRegion
+ *
+ * PARAMETERS: RegionObj - Region Object
+ * AcpiNsIsLocked - Namespace Region Already Locked?
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Break the association between the handler and the region
+ * this is a two way association.
+ *
+ ******************************************************************************/
+
+void
+AcpiEvDetachRegion(
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsIsLocked)
+{
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT **LastObjPtr;
+ ACPI_ADR_SPACE_SETUP RegionSetup;
+ void *RegionContext;
+ ACPI_OPERAND_OBJECT *RegionObj2;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvDetachRegion");
+
+
+ RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
+ if (!RegionObj2)
+ {
+ return_VOID;
+ }
+ RegionContext = RegionObj2->Extra.RegionContext;
+
+ /* Get the address handler from the region object */
+
+ HandlerObj = RegionObj->Region.AddressSpace;
+ if (!HandlerObj)
+ {
+ /* This region has no handler, all done */
+
+ return_VOID;
+ }
+
+ /* Find this region in the handler's list */
+
+ ObjDesc = HandlerObj->AddressSpace.RegionList;
+ LastObjPtr = &HandlerObj->AddressSpace.RegionList;
+
+ while (ObjDesc)
+ {
+ /* Is this the correct Region? */
+
+ if (ObjDesc == RegionObj)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Removing Region %p from address handler %p\n",
+ RegionObj, HandlerObj));
+
+ /* This is it, remove it from the handler's list */
+
+ *LastObjPtr = ObjDesc->Region.Next;
+ ObjDesc->Region.Next = NULL; /* Must clear field */
+
+ if (AcpiNsIsLocked)
+ {
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+ }
+
+ /* Now stop region accesses by executing the _REG method */
+
+ Status = AcpiEvExecuteRegMethod (RegionObj, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
+ AcpiFormatException (Status),
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ }
+
+ if (AcpiNsIsLocked)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+ }
+
+ /* Call the setup handler with the deactivate notification */
+
+ RegionSetup = HandlerObj->AddressSpace.Setup;
+ Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
+ HandlerObj->AddressSpace.Context, &RegionContext);
+
+ /* Init routine may fail, Just ignore errors */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
+ AcpiFormatException (Status),
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ }
+
+ RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
+
+ /*
+ * Remove handler reference in the region
+ *
+ * NOTE: this doesn't mean that the region goes away
+ * The region is just inaccessible as indicated to
+ * the _REG method
+ *
+ * If the region is on the handler's list
+ * this better be the region's handler
+ */
+ RegionObj->Region.AddressSpace = NULL;
+ AcpiUtRemoveReference (HandlerObj);
+
+ return_VOID;
+ }
+
+ /* Walk the linked list of handlers */
+
+ LastObjPtr = &ObjDesc->Region.Next;
+ ObjDesc = ObjDesc->Region.Next;
+ }
+
+ /* If we get here, the region was not in the handler's region list */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Cannot remove region %p from address handler %p\n",
+ RegionObj, HandlerObj));
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvAttachRegion
+ *
+ * PARAMETERS: HandlerObj - Handler Object
+ * RegionObj - Region Object
+ * AcpiNsIsLocked - Namespace Region Already Locked?
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create the association between the handler and the region
+ * this is a two way association.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvAttachRegion (
+ ACPI_OPERAND_OBJECT *HandlerObj,
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsIsLocked)
+{
+ ACPI_STATUS Status;
+ ACPI_STATUS Status2;
+
+
+ ACPI_FUNCTION_TRACE ("EvAttachRegion");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Adding Region %p to address handler %p [%s]\n",
+ RegionObj, HandlerObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+
+
+ /* Link this region to the front of the handler's list */
+
+ RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
+ HandlerObj->AddressSpace.RegionList = RegionObj;
+
+ /* Install the region's handler */
+
+ if (RegionObj->Region.AddressSpace)
+ {
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ RegionObj->Region.AddressSpace = HandlerObj;
+ AcpiUtAddReference (HandlerObj);
+
+ /*
+ * Tell all users that this region is usable by running the _REG
+ * method
+ */
+ if (AcpiNsIsLocked)
+ {
+ Status2 = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ Status = AcpiEvExecuteRegMethod (RegionObj, 1);
+
+ if (AcpiNsIsLocked)
+ {
+ Status2 = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInstallHandler
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * Level - Nesting level of the handle
+ * Context - Passed into AcpiNsWalkNamespace
+ *
+ * DESCRIPTION: This routine installs an address handler into objects that are
+ * of type Region or Device.
+ *
+ * If the Object is a Device, and the device has a handler of
+ * the same type then the search is terminated in that branch.
+ *
+ * This is because the existing handler is closer in proximity
+ * to any more regions than the one we are trying to install.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInstallHandler (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *NextHandlerObj;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME ("EvInstallHandler");
+
+
+ HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
+
+ /* Parameter validation */
+
+ if (!HandlerObj)
+ {
+ return (AE_OK);
+ }
+
+ /* Convert and validate the device handle */
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ if (!Node)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * We only care about regions.and objects
+ * that are allowed to have address space handlers
+ */
+ if ((Node->Type != ACPI_TYPE_DEVICE) &&
+ (Node->Type != ACPI_TYPE_REGION) &&
+ (Node != AcpiGbl_RootNode))
+ {
+ return (AE_OK);
+ }
+
+ /* Check for an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* No object, just exit */
+
+ return (AE_OK);
+ }
+
+ /* Devices are handled different than regions */
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE)
+ {
+ /* Check if this Device already has a handler for this address space */
+
+ NextHandlerObj = ObjDesc->Device.AddressSpace;
+ while (NextHandlerObj)
+ {
+ /* Found a handler, is it for the same address space? */
+
+ if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Found handler for region [%s] in device %p(%p) handler %p\n",
+ AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId),
+ ObjDesc, NextHandlerObj, HandlerObj));
+
+ /*
+ * Since the object we found it on was a device, then it
+ * means that someone has already installed a handler for
+ * the branch of the namespace from this device on. Just
+ * bail out telling the walk routine to not traverse this
+ * branch. This preserves the scoping rule for handlers.
+ */
+ return (AE_CTRL_DEPTH);
+ }
+
+ /* Walk the linked list of handlers attached to this device */
+
+ NextHandlerObj = NextHandlerObj->AddressSpace.Next;
+ }
+
+ /*
+ * As long as the device didn't have a handler for this
+ * space we don't care about it. We just ignore it and
+ * proceed.
+ */
+ return (AE_OK);
+ }
+
+ /* Object is a Region */
+
+ if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
+ {
+ /*
+ * This region is for a different address space
+ * -- just ignore it
+ */
+ return (AE_OK);
+ }
+
+ /*
+ * Now we have a region and it is for the handler's address
+ * space type.
+ *
+ * First disconnect region for any previous handler (if any)
+ */
+ AcpiEvDetachRegion (ObjDesc, FALSE);
+
+ /* Connect the region to the new handler */
+
+ Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE);
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c
new file mode 100644
index 0000000..12bb927
--- /dev/null
+++ b/sys/contrib/dev/acpica/evrgnini.c
@@ -0,0 +1,667 @@
+/******************************************************************************
+ *
+ * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
+ * $Revision: 69 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EVRGNINI_C__
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evrgnini")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvSystemMemoryRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling, a nop for now
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvSystemMemoryRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle;
+ ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;
+
+
+ ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup");
+
+
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ if (*RegionContext)
+ {
+ ACPI_MEM_FREE (*RegionContext);
+ *RegionContext = NULL;
+ }
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Create a new context */
+
+ LocalRegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT));
+ if (!(LocalRegionContext))
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Save the region length and address for use in the handler */
+
+ LocalRegionContext->Length = RegionDesc->Region.Length;
+ LocalRegionContext->Address = RegionDesc->Region.Address;
+
+ *RegionContext = LocalRegionContext;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvIoSpaceRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvIoSpaceRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_FUNCTION_TRACE ("EvIoSpaceRegionSetup");
+
+
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ *RegionContext = NULL;
+ }
+ else
+ {
+ *RegionContext = HandlerContext;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvPciConfigRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ * MUTEX: Assumes namespace is not locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvPciConfigRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_INTEGER PciValue;
+ ACPI_PCI_ID *PciId = *RegionContext;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *PciRootNode;
+ ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;
+ ACPI_DEVICE_ID ObjectHID;
+
+
+ ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup");
+
+
+ HandlerObj = RegionObj->Region.AddressSpace;
+ if (!HandlerObj)
+ {
+ /*
+ * No installed handler. This shouldn't happen because the dispatch
+ * routine checks before we get here, but we check again just in case.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Attempting to init a region %p, with no handler\n", RegionObj));
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ *RegionContext = NULL;
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ if (PciId)
+ {
+ ACPI_MEM_FREE (PciId);
+ }
+ return_ACPI_STATUS (Status);
+ }
+
+ ParentNode = AcpiNsGetParentNode (RegionObj->Region.Node);
+
+ /*
+ * Get the _SEG and _BBN values from the device upon which the handler
+ * is installed.
+ *
+ * We need to get the _SEG and _BBN objects relative to the PCI BUS device.
+ * This is the device the handler has been registered to handle.
+ */
+
+ /*
+ * If the AddressSpace.Node is still pointing to the root, we need
+ * to scan upward for a PCI Root bridge and re-associate the OpRegion
+ * handlers with that device.
+ */
+ if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode)
+ {
+ /* Start search from the parent object */
+
+ PciRootNode = ParentNode;
+ while (PciRootNode != AcpiGbl_RootNode)
+ {
+ Status = AcpiUtExecute_HID (PciRootNode, &ObjectHID);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Got a valid _HID, check if this is a PCI root */
+
+ if (!(ACPI_STRNCMP (ObjectHID.Value, PCI_ROOT_HID_STRING,
+ sizeof (PCI_ROOT_HID_STRING))))
+ {
+ /* Install a handler for this PCI root bridge */
+
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) PciRootNode,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_SAME_HANDLER)
+ {
+ /*
+ * It is OK if the handler is already installed on the root
+ * bridge. Still need to return a context object for the
+ * new PCI_Config operation region, however.
+ */
+ Status = AE_OK;
+ }
+ else
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not install PciConfig handler for Root Bridge %4.4s, %s\n",
+ PciRootNode->Name.Ascii, AcpiFormatException (Status)));
+ }
+ }
+ break;
+ }
+ }
+
+ PciRootNode = AcpiNsGetParentNode (PciRootNode);
+ }
+
+ /* PCI root bridge not found, use namespace root node */
+ }
+ else
+ {
+ PciRootNode = HandlerObj->AddressSpace.Node;
+ }
+
+ /*
+ * If this region is now initialized, we are done.
+ * (InstallAddressSpaceHandler could have initialized it)
+ */
+ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Region is still not initialized. Create a new context */
+
+ PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID));
+ if (!PciId)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * For PCI_Config space access, we need the segment, bus,
+ * device and function numbers. Acquire them here.
+ */
+
+ /*
+ * Get the PCI device and function numbers from the _ADR object
+ * contained in the parent's scope.
+ */
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, ParentNode, &PciValue);
+
+ /*
+ * The default is zero, and since the allocation above zeroed
+ * the data, just do nothing on failure.
+ */
+ if (ACPI_SUCCESS (Status))
+ {
+ PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue));
+ PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue));
+ }
+
+ /* The PCI segment number comes from the _SEG method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue);
+ if (ACPI_SUCCESS (Status))
+ {
+ PciId->Segment = ACPI_LOWORD (PciValue);
+ }
+
+ /* The PCI bus number comes from the _BBN method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue);
+ if (ACPI_SUCCESS (Status))
+ {
+ PciId->Bus = ACPI_LOWORD (PciValue);
+ }
+
+ /* Complete this device's PciId */
+
+ AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId);
+
+ *RegionContext = PciId;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvPciBarRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ * MUTEX: Assumes namespace is not locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvPciBarRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_FUNCTION_TRACE ("EvPciBarRegionSetup");
+
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvCmosRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ * MUTEX: Assumes namespace is not locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvCmosRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_FUNCTION_TRACE ("EvCmosRegionSetup");
+
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDefaultRegionSetup
+ *
+ * PARAMETERS: RegionObj - Region we are interested in
+ * Function - Start or stop
+ * HandlerContext - Address space handler context
+ * RegionContext - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvDefaultRegionSetup (
+ ACPI_HANDLE Handle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext)
+{
+ ACPI_FUNCTION_TRACE ("EvDefaultRegionSetup");
+
+
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ *RegionContext = NULL;
+ }
+ else
+ {
+ *RegionContext = HandlerContext;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitializeRegion
+ *
+ * PARAMETERS: RegionObj - Region we are initializing
+ * AcpiNsLocked - Is namespace locked?
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initializes the region, finds any _REG methods and saves them
+ * for execution at a later time
+ *
+ * Get the appropriate address space handler for a newly
+ * created region.
+ *
+ * This also performs address space specific initialization. For
+ * example, PCI regions must have an _ADR object that contains
+ * a PCI address in the scope of the definition. This address is
+ * required to perform an access to PCI config space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitializeRegion (
+ ACPI_OPERAND_OBJECT *RegionObj,
+ BOOLEAN AcpiNsLocked)
+{
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_ADR_SPACE_TYPE SpaceId;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *MethodNode;
+ ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG;
+ ACPI_OPERAND_OBJECT *RegionObj2;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked);
+
+
+ if (!RegionObj)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
+ if (!RegionObj2)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ Node = AcpiNsGetParentNode (RegionObj->Region.Node);
+ SpaceId = RegionObj->Region.SpaceId;
+
+ /* Setup defaults */
+
+ RegionObj->Region.AddressSpace = NULL;
+ RegionObj2->Extra.Method_REG = NULL;
+ RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
+ RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
+
+ /* Find any "_REG" method associated with this region definition */
+
+ Status = AcpiNsSearchNode (*RegNamePtr, Node,
+ ACPI_TYPE_METHOD, &MethodNode);
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * The _REG method is optional and there can be only one per region
+ * definition. This will be executed when the handler is attached
+ * or removed
+ */
+ RegionObj2->Extra.Method_REG = MethodNode;
+ }
+
+ /*
+ * The following loop depends upon the root Node having no parent
+ * ie: AcpiGbl_RootNode->ParentEntry being set to NULL
+ */
+ while (Node)
+ {
+ /* Check to see if a handler exists */
+
+ HandlerObj = NULL;
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /* Can only be a handler if the object exists */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+
+ HandlerObj = ObjDesc->Device.AddressSpace;
+ break;
+
+ case ACPI_TYPE_PROCESSOR:
+
+ HandlerObj = ObjDesc->Processor.AddressSpace;
+ break;
+
+ case ACPI_TYPE_THERMAL:
+
+ HandlerObj = ObjDesc->ThermalZone.AddressSpace;
+ break;
+
+ default:
+ /* Ignore other objects */
+ break;
+ }
+
+ while (HandlerObj)
+ {
+ /* Is this handler of the correct type? */
+
+ if (HandlerObj->AddressSpace.SpaceId == SpaceId)
+ {
+ /* Found correct handler */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Found handler %p for region %p in obj %p\n",
+ HandlerObj, RegionObj, ObjDesc));
+
+ Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
+ AcpiNsLocked);
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Try next handler in the list */
+
+ HandlerObj = HandlerObj->AddressSpace.Next;
+ }
+ }
+
+ /*
+ * This node does not have the handler we need;
+ * Pop up one level
+ */
+ Node = AcpiNsGetParentNode (Node);
+ }
+
+ /* If we get here, there is no handler for this region */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "No handler for RegionType %s(%X) (RegionObj %p)\n",
+ AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
+
+ return_ACPI_STATUS (AE_NOT_EXIST);
+}
+
diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c
new file mode 100644
index 0000000..8397fdd
--- /dev/null
+++ b/sys/contrib/dev/acpica/evsci.c
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ *
+ * Module Name: evsci - System Control Interrupt configuration and
+ * legacy to ACPI mode state transition functions
+ * $Revision: 93 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evsci")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvSciXruptHandler
+ *
+ * PARAMETERS: Context - Calling Context
+ *
+ * RETURN: Status code indicates whether interrupt was handled.
+ *
+ * DESCRIPTION: Interrupt handler that will figure out what function or
+ * control method to call to deal with a SCI.
+ *
+ ******************************************************************************/
+
+static UINT32 ACPI_SYSTEM_XFACE
+AcpiEvSciXruptHandler (
+ void *Context)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
+ UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
+
+
+ ACPI_FUNCTION_TRACE("EvSciXruptHandler");
+
+
+ /*
+ * We are guaranteed by the ACPI CA initialization/shutdown code that
+ * if this interrupt handler is installed, ACPI is enabled.
+ */
+
+ /*
+ * Fixed Events:
+ * Check for and dispatch any Fixed Events that have occurred
+ */
+ InterruptHandled |= AcpiEvFixedEventDetect ();
+
+ /*
+ * General Purpose Events:
+ * Check for and dispatch any GPEs that have occurred
+ */
+ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
+
+ return_VALUE (InterruptHandled);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeXruptHandler
+ *
+ * PARAMETERS: Context - Calling Context
+ *
+ * RETURN: Status code indicates whether interrupt was handled.
+ *
+ * DESCRIPTION: Handler for GPE Block Device interrupts
+ *
+ ******************************************************************************/
+
+UINT32 ACPI_SYSTEM_XFACE
+AcpiEvGpeXruptHandler (
+ void *Context)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
+ UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
+
+
+ ACPI_FUNCTION_TRACE("EvGpeXruptHandler");
+
+
+ /*
+ * We are guaranteed by the ACPI CA initialization/shutdown code that
+ * if this interrupt handler is installed, ACPI is enabled.
+ */
+
+ /*
+ * GPEs:
+ * Check for and dispatch any GPEs that have occurred
+ */
+ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
+
+ return_VALUE (InterruptHandled);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEvInstallSciHandler
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Installs SCI handler.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvInstallSciHandler (void)
+{
+ UINT32 Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("EvInstallSciHandler");
+
+
+ Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
+ AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEvRemoveSciHandler
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
+ * installed to begin with
+ *
+ * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
+ * taken.
+ *
+ * Note: It doesn't seem important to disable all events or set the event
+ * enable registers to their original values. The OS should disable
+ * the SCI interrupt level when the handler is removed, so no more
+ * events will come in.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvRemoveSciHandler (void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvRemoveSciHandler");
+
+
+ /* Just let the OS remove the handler and disable the level */
+
+ Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
+ AcpiEvSciXruptHandler);
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c
new file mode 100644
index 0000000..3c3db78
--- /dev/null
+++ b/sys/contrib/dev/acpica/evxface.c
@@ -0,0 +1,830 @@
+/******************************************************************************
+ *
+ * Module Name: evxface - External interfaces for ACPI events
+ * $Revision: 141 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial prton of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EVXFACE_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallFixedEventHandler
+ *
+ * PARAMETERS: Event - Event type to enable.
+ * Handler - Pointer to the handler function for the
+ * event
+ * Context - Value passed to the handler on each GPE
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Saves the pointer to the handler function and then enables the
+ * event.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallFixedEventHandler (
+ UINT32 Event,
+ ACPI_EVENT_HANDLER Handler,
+ void *Context)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
+
+
+ /* Parameter validation */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Don't allow two handlers. */
+
+ if (NULL != AcpiGbl_FixedEventHandlers[Event].Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto Cleanup;
+ }
+
+ /* Install the handler before enabling the event */
+
+ AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
+ AcpiGbl_FixedEventHandlers[Event].Context = Context;
+
+ Status = AcpiEnableEvent (Event, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+
+ /* Remove the handler */
+
+ AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
+ AcpiGbl_FixedEventHandlers[Event].Context = NULL;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Enabled fixed event %X, Handler=%p\n", Event, Handler));
+ }
+
+
+Cleanup:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveFixedEventHandler
+ *
+ * PARAMETERS: Event - Event type to disable.
+ * Handler - Address of the handler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disables the event and unregisters the event handler.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveFixedEventHandler (
+ UINT32 Event,
+ ACPI_EVENT_HANDLER Handler)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
+
+
+ /* Parameter validation */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Disable the event before removing the handler */
+
+ Status = AcpiDisableEvent (Event, 0);
+
+ /* Always Remove the handler */
+
+ AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
+ AcpiGbl_FixedEventHandlers[Event].Context = NULL;
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
+ "Could not write to fixed event enable register.\n"));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", Event));
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallNotifyHandler
+ *
+ * PARAMETERS: Device - The device for which notifies will be handled
+ * HandlerType - The type of handler:
+ * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
+ * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
+ * Handler - Address of the handler
+ * Context - Value passed to the handler on each GPE
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for notifies on an ACPI device
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler,
+ void *Context)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *NotifyObj;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallNotifyHandler");
+
+
+ /* Parameter validation */
+
+ if ((!Device) ||
+ (!Handler) ||
+ (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Convert and validate the device handle */
+
+ Node = AcpiNsMapHandleToNode (Device);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Root Object:
+ * Registering a notify handler on the root object indicates that the
+ * caller wishes to receive notifications for all objects. Note that
+ * only one <external> global handler can be regsitered (per notify type).
+ */
+ if (Device == ACPI_ROOT_OBJECT)
+ {
+ /* Make sure the handler is not already installed */
+
+ if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
+ AcpiGbl_SystemNotify.Handler) ||
+ ((HandlerType == ACPI_DEVICE_NOTIFY) &&
+ AcpiGbl_DeviceNotify.Handler))
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ if (HandlerType == ACPI_SYSTEM_NOTIFY)
+ {
+ AcpiGbl_SystemNotify.Node = Node;
+ AcpiGbl_SystemNotify.Handler = Handler;
+ AcpiGbl_SystemNotify.Context = Context;
+ }
+ else /* ACPI_DEVICE_NOTIFY */
+ {
+ AcpiGbl_DeviceNotify.Node = Node;
+ AcpiGbl_DeviceNotify.Handler = Handler;
+ AcpiGbl_DeviceNotify.Context = Context;
+ }
+
+ /* Global notify handler installed */
+ }
+
+ /*
+ * All Other Objects:
+ * Caller will only receive notifications specific to the target object.
+ * Note that only certain object types can receive notifications.
+ */
+ else
+ {
+ /* Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
+ {
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
+
+ /* Check for an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /* Object exists - make sure there's no handler */
+
+ if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
+ ObjDesc->CommonNotify.SystemNotify) ||
+ ((HandlerType == ACPI_DEVICE_NOTIFY) &&
+ ObjDesc->CommonNotify.DeviceNotify))
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+ }
+ else
+ {
+ /* Create a new object */
+
+ ObjDesc = AcpiUtCreateInternalObject (Node->Type);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /* Attach new object to the Node */
+
+ Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+
+ /* Install the handler */
+
+ NotifyObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
+ if (!NotifyObj)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ NotifyObj->Notify.Node = Node;
+ NotifyObj->Notify.Handler = Handler;
+ NotifyObj->Notify.Context = Context;
+
+ if (HandlerType == ACPI_SYSTEM_NOTIFY)
+ {
+ ObjDesc->CommonNotify.SystemNotify = NotifyObj;
+ }
+ else /* ACPI_DEVICE_NOTIFY */
+ {
+ ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
+ }
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveNotifyHandler
+ *
+ * PARAMETERS: Device - The device for which notifies will be handled
+ * HandlerType - The type of handler:
+ * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
+ * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
+ * Handler - Address of the handler
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a handler for notifies on an ACPI device
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler)
+{
+ ACPI_OPERAND_OBJECT *NotifyObj;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
+
+
+ /* Parameter validation */
+
+ if ((!Device) ||
+ (!Handler) ||
+ (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Convert and validate the device handle */
+
+ Node = AcpiNsMapHandleToNode (Device);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Root Object
+ */
+ if (Device == ACPI_ROOT_OBJECT)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
+
+ if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
+ !AcpiGbl_SystemNotify.Handler) ||
+ ((HandlerType == ACPI_DEVICE_NOTIFY) &&
+ !AcpiGbl_DeviceNotify.Handler))
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ if (HandlerType == ACPI_SYSTEM_NOTIFY)
+ {
+ AcpiGbl_SystemNotify.Node = NULL;
+ AcpiGbl_SystemNotify.Handler = NULL;
+ AcpiGbl_SystemNotify.Context = NULL;
+ }
+ else
+ {
+ AcpiGbl_DeviceNotify.Node = NULL;
+ AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_DeviceNotify.Context = NULL;
+ }
+ }
+
+ /*
+ * All Other Objects
+ */
+ else
+ {
+ /* Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
+ {
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
+
+ /* Check for an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ /* Object exists - make sure there's an existing handler */
+
+ if (HandlerType == ACPI_SYSTEM_NOTIFY)
+ {
+ NotifyObj = ObjDesc->CommonNotify.SystemNotify;
+ }
+ else
+ {
+ NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
+ }
+
+ if ((!NotifyObj) ||
+ (NotifyObj->Notify.Handler != Handler))
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Remove the handler */
+
+ if (HandlerType == ACPI_SYSTEM_NOTIFY)
+ {
+ ObjDesc->CommonNotify.SystemNotify = NULL;
+ }
+ else
+ {
+ ObjDesc->CommonNotify.DeviceNotify = NULL;
+ }
+
+ AcpiUtRemoveReference (NotifyObj);
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallGpeHandler
+ *
+ * PARAMETERS: GpeNumber - The GPE number within the GPE block
+ * GpeBlock - GPE block (NULL == FADT GPEs)
+ * Type - Whether this GPE should be treated as an
+ * edge- or level-triggered interrupt.
+ * Handler - Address of the handler
+ * Context - Value passed to the handler on each GPE
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for a General Purpose Event.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallGpeHandler (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Type,
+ ACPI_GPE_HANDLER Handler,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
+
+
+ /* Parameter validation */
+
+ if (!Handler)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Make sure that there isn't a handler there already */
+
+ if (GpeEventInfo->Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ /* Install the handler */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ GpeEventInfo->Handler = Handler;
+ GpeEventInfo->Context = Context;
+ GpeEventInfo->Flags = (UINT8) Type;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+ /* Clear the GPE (of stale events), the enable it */
+
+ Status = AcpiHwClearGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiHwEnableGpe (GpeEventInfo);
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveGpeHandler
+ *
+ * PARAMETERS: GpeNumber - The event to remove a handler
+ * GpeBlock - GPE block (NULL == FADT GPEs)
+ * Handler - Address of the handler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a handler for a General Purpose AcpiEvent.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveGpeHandler (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ ACPI_GPE_HANDLER Handler)
+{
+ ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
+
+
+ /* Parameter validation */
+
+ if (!Handler)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Disable the GPE before removing the handler */
+
+ Status = AcpiHwDisableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Make sure that the installed handler is the same */
+
+ if (GpeEventInfo->Handler != Handler)
+ {
+ (void) AcpiHwEnableGpe (GpeEventInfo);
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Remove the handler */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ GpeEventInfo->Handler = NULL;
+ GpeEventInfo->Context = NULL;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiAcquireGlobalLock
+ *
+ * PARAMETERS: Timeout - How long the caller is willing to wait
+ * OutHandle - A handle to the lock if acquired
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire the ACPI Global Lock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiAcquireGlobalLock (
+ UINT16 Timeout,
+ UINT32 *Handle)
+{
+ ACPI_STATUS Status;
+
+
+ if (!Handle)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiEvAcquireGlobalLock (Timeout);
+ AcpiExExitInterpreter ();
+
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiGbl_GlobalLockHandle++;
+ *Handle = AcpiGbl_GlobalLockHandle;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiReleaseGlobalLock
+ *
+ * PARAMETERS: Handle - Returned from AcpiAcquireGlobalLock
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release the ACPI Global Lock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiReleaseGlobalLock (
+ UINT32 Handle)
+{
+ ACPI_STATUS Status;
+
+
+ if (Handle != AcpiGbl_GlobalLockHandle)
+ {
+ return (AE_NOT_ACQUIRED);
+ }
+
+ Status = AcpiEvReleaseGlobalLock ();
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c
new file mode 100644
index 0000000..668ecfd
--- /dev/null
+++ b/sys/contrib/dev/acpica/evxfevnt.c
@@ -0,0 +1,862 @@
+/******************************************************************************
+ *
+ * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
+ * $Revision: 73 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial prton of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EVXFEVNT_C__
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evxfevnt")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnable
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Transfers the system into ACPI mode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnable (void)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnable");
+
+
+ /* Make sure we have the FADT*/
+
+ if (!AcpiGbl_FADT)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
+ }
+ else
+ {
+ /* Transition to ACPI mode */
+
+ Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n"));
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDisable
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Transfers the system into LEGACY mode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDisable (void)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiDisable");
+
+
+ if (!AcpiGbl_FADT)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n"));
+ }
+ else
+ {
+ /* Transition to LEGACY mode */
+
+ Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode"));
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnableEvent
+ *
+ * PARAMETERS: Event - The fixed eventto be enabled
+ * Flags - Reserved
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enable an ACPI event (fixed)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnableEvent (
+ UINT32 Event,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Value;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
+
+
+ /* Decode the Fixed Event */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Enable the requested fixed event (by writing a one to the
+ * enable register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 1, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Make sure that the hardware responded */
+
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ &Value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Value != 1)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not enable %s event\n", AcpiUtGetEventName (Event)));
+ return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnableGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Just enable, or also wake enable?
+ * Called from ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enable an ACPI event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnableGpe");
+
+
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Enable the requested GPE number */
+
+ Status = AcpiHwEnableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ if (Flags & ACPI_EVENT_WAKE_ENABLE)
+ {
+ AcpiHwEnableGpeForWakeup (GpeEventInfo);
+ }
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDisableEvent
+ *
+ * PARAMETERS: Event - The fixed eventto be enabled
+ * Flags - Reserved
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable an ACPI event (fixed)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDisableEvent (
+ UINT32 Event,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Value;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
+
+
+ /* Decode the Fixed Event */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Disable the requested fixed event (by writing a zero to the
+ * enable register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 0, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ &Value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Value != 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not disable %s events\n", AcpiUtGetEventName (Event)));
+ return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDisableGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Just enable, or also wake enable?
+ * Called from ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable an ACPI event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDisableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
+
+
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Only disable the requested GPE number for wake if specified.
+ * Otherwise, turn it totally off
+ */
+ if (Flags & ACPI_EVENT_WAKE_DISABLE)
+ {
+ AcpiHwDisableGpeForWakeup (GpeEventInfo);
+ }
+ else
+ {
+ Status = AcpiHwDisableGpe (GpeEventInfo);
+ }
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiClearEvent
+ *
+ * PARAMETERS: Event - The fixed event to be cleared
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear an ACPI event (fixed)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiClearEvent (
+ UINT32 Event)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiClearEvent");
+
+
+ /* Decode the Fixed Event */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Clear the requested fixed event (By writing a one to the
+ * status register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ 1, ACPI_MTX_LOCK);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiClearGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Called from an ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear an ACPI event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiClearGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiClearGpe");
+
+
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiHwClearGpe (GpeEventInfo);
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetEventStatus
+ *
+ * PARAMETERS: Event - The fixed event
+ * Event Status - Where the current status of the event will
+ * be returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Obtains and returns the current status of the event
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetEventStatus (
+ UINT32 Event,
+ ACPI_EVENT_STATUS *EventStatus)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
+
+
+ if (!EventStatus)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Decode the Fixed Event */
+
+ if (Event > ACPI_EVENT_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the status of the requested fixed event */
+
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ EventStatus, ACPI_MTX_LOCK);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetGpeStatus
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Called from an ISR or not
+ * Event Status - Where the current status of the event will
+ * be returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get status of an event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetGpeStatus (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags,
+ ACPI_EVENT_STATUS *EventStatus)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetGpeStatus");
+
+
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Obtain status on the requested GPE number */
+
+ Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
+ * GpeBlockAddress - Address and SpaceID
+ * RegisterCount - Number of GPE register pairs in the block
+ * InterruptLevel - H/W interrupt for the block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create and Install a block of GPE registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallGpeBlock (
+ ACPI_HANDLE GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT32 InterruptLevel)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallGpeBlock");
+
+
+ if ((!GpeDevice) ||
+ (!GpeBlockAddress) ||
+ (!RegisterCount))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (GpeDevice);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * For user-installed GPE Block Devices, the GpeBlockBaseNumber
+ * is always zero
+ */
+ Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
+ 0, InterruptLevel, &GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Get the DeviceObject attached to the node */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* No object, create a new one */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+
+ /* Install the GPE block in the DeviceObject */
+
+ ObjDesc->Device.GpeBlock = GpeBlock;
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a previously installed block of GPE registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveGpeBlock (
+ ACPI_HANDLE GpeDevice)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveGpeBlock");
+
+
+ if (!GpeDevice)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (GpeDevice);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Get the DeviceObject attached to the node */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc ||
+ !ObjDesc->Device.GpeBlock)
+ {
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Delete the GPE block (but not the DeviceObject) */
+
+ Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock);
+ if (ACPI_SUCCESS (Status))
+ {
+ ObjDesc->Device.GpeBlock = NULL;
+ }
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c
new file mode 100644
index 0000000..ed16c7a
--- /dev/null
+++ b/sys/contrib/dev/acpica/evxfregn.c
@@ -0,0 +1,523 @@
+/******************************************************************************
+ *
+ * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
+ * Address Spaces.
+ * $Revision: 56 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial prton of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EVXFREGN_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evxfregn")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallAddressSpaceHandler
+ *
+ * PARAMETERS: Device - Handle for the device
+ * SpaceId - The address space ID
+ * Handler - Address of the handler
+ * Setup - Address of the setup function
+ * Context - Value passed to the handler on each access
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallAddressSpaceHandler (
+ ACPI_HANDLE Device,
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_ADR_SPACE_HANDLER Handler,
+ ACPI_ADR_SPACE_SETUP Setup,
+ void *Context)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE Type;
+ UINT16 Flags = 0;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
+
+
+ /* Parameter validation */
+
+ if (!Device)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Convert and validate the device handle */
+
+ Node = AcpiNsMapHandleToNode (Device);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * This registration is valid for only the types below
+ * and the root. This is where the default handlers
+ * get placed.
+ */
+ if ((Node->Type != ACPI_TYPE_DEVICE) &&
+ (Node->Type != ACPI_TYPE_PROCESSOR) &&
+ (Node->Type != ACPI_TYPE_THERMAL) &&
+ (Node != AcpiGbl_RootNode))
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ if (Handler == ACPI_DEFAULT_HANDLER)
+ {
+ Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
+
+ switch (SpaceId)
+ {
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ Handler = AcpiExSystemMemorySpaceHandler;
+ Setup = AcpiEvSystemMemoryRegionSetup;
+ break;
+
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+ Handler = AcpiExSystemIoSpaceHandler;
+ Setup = AcpiEvIoSpaceRegionSetup;
+ break;
+
+ case ACPI_ADR_SPACE_PCI_CONFIG:
+ Handler = AcpiExPciConfigSpaceHandler;
+ Setup = AcpiEvPciConfigRegionSetup;
+ break;
+
+ case ACPI_ADR_SPACE_CMOS:
+ Handler = AcpiExCmosSpaceHandler;
+ Setup = AcpiEvCmosRegionSetup;
+ break;
+
+ case ACPI_ADR_SPACE_PCI_BAR_TARGET:
+ Handler = AcpiExPciBarSpaceHandler;
+ Setup = AcpiEvPciBarRegionSetup;
+ break;
+
+ case ACPI_ADR_SPACE_DATA_TABLE:
+ Handler = AcpiExDataTableSpaceHandler;
+ Setup = NULL;
+ break;
+
+ default:
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+ }
+
+ /* If the caller hasn't specified a setup routine, use the default */
+
+ if (!Setup)
+ {
+ Setup = AcpiEvDefaultRegionSetup;
+ }
+
+ /* Check for an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /*
+ * The attached device object already exists.
+ * Make sure the handler is not already installed.
+ */
+ HandlerObj = ObjDesc->Device.AddressSpace;
+
+ /* Walk the handler list for this device */
+
+ while (HandlerObj)
+ {
+ /* Same SpaceId indicates a handler already installed */
+
+ if(HandlerObj->AddressSpace.SpaceId == SpaceId)
+ {
+ if (HandlerObj->AddressSpace.Handler == Handler)
+ {
+ /*
+ * It is (relatively) OK to attempt to install the SAME
+ * handler twice. This can easily happen with PCI_Config space.
+ */
+ Status = AE_SAME_HANDLER;
+ goto UnlockAndExit;
+ }
+ else
+ {
+ /* A handler is already installed */
+
+ Status = AE_ALREADY_EXISTS;
+ }
+ goto UnlockAndExit;
+ }
+
+ /* Walk the linked list of handlers */
+
+ HandlerObj = HandlerObj->AddressSpace.Next;
+ }
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Creating object on Device %p while installing handler\n", Node));
+
+ /* ObjDesc does not exist, create one */
+
+ if (Node->Type == ACPI_TYPE_ANY)
+ {
+ Type = ACPI_TYPE_DEVICE;
+ }
+ else
+ {
+ Type = Node->Type;
+ }
+
+ ObjDesc = AcpiUtCreateInternalObject (Type);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /* Init new descriptor */
+
+ ObjDesc->Common.Type = (UINT8) Type;
+
+ /* Attach the new object to the Node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
+ AcpiUtGetRegionName (SpaceId), SpaceId, Node->Name.Ascii, Node, ObjDesc));
+
+ /*
+ * Install the handler
+ *
+ * At this point there is no existing handler.
+ * Just allocate the object for the handler and link it
+ * into the list.
+ */
+ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
+ if (!HandlerObj)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /* Init handler obj */
+
+ HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
+ HandlerObj->AddressSpace.Hflags = Flags;
+ HandlerObj->AddressSpace.RegionList = NULL;
+ HandlerObj->AddressSpace.Node = Node;
+ HandlerObj->AddressSpace.Handler = Handler;
+ HandlerObj->AddressSpace.Context = Context;
+ HandlerObj->AddressSpace.Setup = Setup;
+
+ /* Install at head of Device.AddressSpace list */
+
+ HandlerObj->AddressSpace.Next = ObjDesc->Device.AddressSpace;
+
+ /*
+ * The Device object is the first reference on the HandlerObj.
+ * Each region that uses the handler adds a reference.
+ */
+ ObjDesc->Device.AddressSpace = HandlerObj;
+
+ /*
+ * Walk the namespace finding all of the regions this
+ * handler will manage.
+ *
+ * Start at the device and search the branch toward
+ * the leaf nodes until either the leaf is encountered or
+ * a device is detected that has an address handler of the
+ * same type.
+ *
+ * In either case, back up and search down the remainder
+ * of the branch
+ */
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
+ HandlerObj, NULL);
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveAddressSpaceHandler
+ *
+ * PARAMETERS: Device - Handle for the device
+ * SpaceId - The address space ID
+ * Handler - Address of the handler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a previously installed handler.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveAddressSpaceHandler (
+ ACPI_HANDLE Device,
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_ADR_SPACE_HANDLER Handler)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *RegionObj;
+ ACPI_OPERAND_OBJECT **LastObjPtr;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler");
+
+
+ /* Parameter validation */
+
+ if (!Device)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Convert and validate the device handle */
+
+ Node = AcpiNsMapHandleToNode (Device);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Make sure the internal object exists */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ /* Find the address handler the user requested */
+
+ HandlerObj = ObjDesc->Device.AddressSpace;
+ LastObjPtr = &ObjDesc->Device.AddressSpace;
+ while (HandlerObj)
+ {
+ /* We have a handler, see if user requested this one */
+
+ if (HandlerObj->AddressSpace.SpaceId == SpaceId)
+ {
+ /* Matched SpaceId, first dereference this in the Regions */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
+ HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
+ Node, ObjDesc));
+
+ RegionObj = HandlerObj->AddressSpace.RegionList;
+
+ /* Walk the handler's region list */
+
+ while (RegionObj)
+ {
+ /*
+ * First disassociate the handler from the region.
+ *
+ * NOTE: this doesn't mean that the region goes away
+ * The region is just inaccessible as indicated to
+ * the _REG method
+ */
+ AcpiEvDetachRegion (RegionObj, TRUE);
+
+ /*
+ * Walk the list: Just grab the head because the
+ * DetachRegion removed the previous head.
+ */
+ RegionObj = HandlerObj->AddressSpace.RegionList;
+
+ }
+
+ /* Remove this Handler object from the list */
+
+ *LastObjPtr = HandlerObj->AddressSpace.Next;
+
+ /* Now we can delete the handler object */
+
+ AcpiUtRemoveReference (HandlerObj);
+ goto UnlockAndExit;
+ }
+
+ /* Walk the linked list of handlers */
+
+ LastObjPtr = &HandlerObj->AddressSpace.Next;
+ HandlerObj = HandlerObj->AddressSpace.Next;
+ }
+
+ /* The handler does not exist */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
+ Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc));
+
+ Status = AE_NOT_EXIST;
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c
new file mode 100644
index 0000000..77be255
--- /dev/null
+++ b/sys/contrib/dev/acpica/exconfig.c
@@ -0,0 +1,562 @@
+/******************************************************************************
+ *
+ * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
+ * $Revision: 72 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXCONFIG_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exconfig")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAddTable
+ *
+ * PARAMETERS: Table - Pointer to raw table
+ * ParentNode - Where to load the table (scope)
+ * DdbHandle - Where to return the table handle.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common function to Install and Load an ACPI table with a
+ * returned table handle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAddTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_OPERAND_OBJECT **DdbHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("ExAddTable");
+
+
+ /* Create an object to be the table handle */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Install the new table into the local data structures */
+
+ TableInfo.Pointer = Table;
+ TableInfo.Length = (ACPI_SIZE) Table->Length;
+ TableInfo.Allocation = ACPI_MEM_ALLOCATED;
+
+ Status = AcpiTbInstallTable (&TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Add the table to the namespace */
+
+ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Uninstall table on error */
+
+ (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
+ goto Cleanup;
+ }
+
+ /* Init the table handle */
+
+ ObjDesc->Reference.Opcode = AML_LOAD_OP;
+ ObjDesc->Reference.Object = TableInfo.InstalledDesc;
+ *DdbHandle = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+
+
+Cleanup:
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExLoadTableOp
+ *
+ * PARAMETERS: WalkState - Current state with operands
+ * ReturnDesc - Where to store the return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExLoadTableOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **ReturnDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_TABLE_HEADER *Table;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *StartNode;
+ ACPI_NAMESPACE_NODE *ParameterNode = NULL;
+ ACPI_OPERAND_OBJECT *DdbHandle;
+
+
+ ACPI_FUNCTION_TRACE ("ExLoadTableOp");
+
+
+#if 0
+ /*
+ * Make sure that the signature does not match one of the tables that
+ * is already loaded.
+ */
+ Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
+ if (Status == AE_OK)
+ {
+ /* Signature matched -- don't allow override */
+
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+#endif
+
+ /* Find the ACPI table */
+
+ Status = AcpiTbFindTable (Operand[0]->String.Pointer,
+ Operand[1]->String.Pointer,
+ Operand[2]->String.Pointer, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Not found, return an Integer=0 and AE_OK */
+
+ DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!DdbHandle)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ DdbHandle->Integer.Value = 0;
+ *ReturnDesc = DdbHandle;
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Default nodes */
+
+ StartNode = WalkState->ScopeInfo->Scope.Node;
+ ParentNode = AcpiGbl_RootNode;
+
+ /* RootPath (optional parameter) */
+
+ if (Operand[3]->String.Length > 0)
+ {
+ /*
+ * Find the node referenced by the RootPathString. This is the
+ * location within the namespace where the table will be loaded.
+ */
+ Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
+ ACPI_NS_SEARCH_PARENT, &ParentNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* ParameterPath (optional parameter) */
+
+ if (Operand[4]->String.Length > 0)
+ {
+ if ((Operand[4]->String.Pointer[0] != '\\') &&
+ (Operand[4]->String.Pointer[0] != '^'))
+ {
+ /*
+ * Path is not absolute, so it will be relative to the node
+ * referenced by the RootPathString (or the NS root if omitted)
+ */
+ StartNode = ParentNode;
+ }
+
+ /*
+ * Find the node referenced by the ParameterPathString
+ */
+ Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
+ ACPI_NS_SEARCH_PARENT, &ParameterNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Load the table into the namespace */
+
+ Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parameter Data (optional) */
+
+ if (ParameterNode)
+ {
+ /* Store the parameter data into the optional parameter object */
+
+ Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ (void) AcpiExUnloadTable (DdbHandle);
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExLoadOp
+ *
+ * PARAMETERS: ObjDesc - Region or Field where the table will be
+ * obtained
+ * Target - Where a handle to the table will be stored
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table from a field or operation region
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExLoadOp (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *Target,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *DdbHandle;
+ ACPI_OPERAND_OBJECT *BufferDesc = NULL;
+ ACPI_TABLE_HEADER *TablePtr = NULL;
+ UINT8 *TableDataPtr;
+ ACPI_TABLE_HEADER TableHeader;
+ UINT32 i;
+
+ ACPI_FUNCTION_TRACE ("ExLoadOp");
+
+
+ /* Object can be either an OpRegion or a Field */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_REGION:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
+ ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
+
+ /* Get the table header */
+
+ TableHeader.Length = 0;
+ for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
+ {
+ Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ ((UINT8 *) &TableHeader) + i);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Allocate a buffer for the entire table */
+
+ TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
+ if (!TablePtr)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the header to the buffer */
+
+ ACPI_MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+ TableDataPtr = ACPI_PTR_ADD (UINT8, TablePtr, sizeof (ACPI_TABLE_HEADER));
+
+ /* Get the table from the op region */
+
+ for (i = 0; i < TableHeader.Length; i++)
+ {
+ Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ ((UINT8 *) TableDataPtr + i));
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
+ ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
+
+ /*
+ * The length of the field must be at least as large as the table.
+ * Read the entire field and thus the entire table. Buffer is
+ * allocated during the read.
+ */
+ Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer);
+ break;
+
+
+ default:
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* The table must be either an SSDT or a PSDT */
+
+ if ((!ACPI_STRNCMP (TablePtr->Signature,
+ AcpiGbl_TableData[ACPI_TABLE_PSDT].Signature,
+ AcpiGbl_TableData[ACPI_TABLE_PSDT].SigLength)) &&
+ (!ACPI_STRNCMP (TablePtr->Signature,
+ AcpiGbl_TableData[ACPI_TABLE_SSDT].Signature,
+ AcpiGbl_TableData[ACPI_TABLE_SSDT].SigLength)))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
+ TablePtr->Signature));
+ Status = AE_BAD_SIGNATURE;
+ goto Cleanup;
+ }
+
+ /* Install the new table into the local data structures */
+
+ Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Store the DdbHandle into the Target operand */
+
+ Status = AcpiExStore (DdbHandle, Target, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ (void) AcpiExUnloadTable (DdbHandle);
+ }
+
+ return_ACPI_STATUS (Status);
+
+
+Cleanup:
+
+ if (BufferDesc)
+ {
+ AcpiUtRemoveReference (BufferDesc);
+ }
+ else
+ {
+ ACPI_MEM_FREE (TablePtr);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExUnloadTable
+ *
+ * PARAMETERS: DdbHandle - Handle to a previously loaded table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Unload an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExUnloadTable (
+ ACPI_OPERAND_OBJECT *DdbHandle)
+{
+ ACPI_STATUS Status = AE_NOT_IMPLEMENTED;
+ ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
+ ACPI_TABLE_DESC *TableInfo;
+
+
+ ACPI_FUNCTION_TRACE ("ExUnloadTable");
+
+
+ /*
+ * Validate the handle
+ * Although the handle is partially validated in AcpiExReconfiguration(),
+ * when it calls AcpiExResolveOperands(), the handle is more completely
+ * validated here.
+ */
+ if ((!DdbHandle) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
+ (ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the actual table descriptor from the DdbHandle */
+
+ TableInfo = (ACPI_TABLE_DESC *) TableDesc->Reference.Object;
+
+ /*
+ * Delete the entire namespace under this table Node
+ * (Offset contains the TableId)
+ */
+ AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
+
+ /* Delete the table itself */
+
+ (void) AcpiTbUninstallTable (TableInfo->InstalledDesc);
+
+ /* Delete the table descriptor (DdbHandle) */
+
+ AcpiUtRemoveReference (TableDesc);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c
new file mode 100644
index 0000000..3b175ae
--- /dev/null
+++ b/sys/contrib/dev/acpica/exconvrt.c
@@ -0,0 +1,813 @@
+/******************************************************************************
+ *
+ * Module Name: exconvrt - Object conversion routines
+ * $Revision: 49 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXCONVRT_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exconvrt")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConvertToInteger
+ *
+ * PARAMETERS: *ObjDesc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to an integer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConvertToInteger (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *RetDesc;
+ UINT32 Count;
+ UINT8 *Pointer;
+ ACPI_INTEGER Result;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
+
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ *ResultDesc = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+
+ case ACPI_TYPE_STRING:
+ Pointer = (UINT8 *) ObjDesc->String.Pointer;
+ Count = ObjDesc->String.Length;
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Pointer = ObjDesc->Buffer.Pointer;
+ Count = ObjDesc->Buffer.Length;
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /*
+ * Convert the buffer/string to an integer. Note that both buffers and
+ * strings are treated as raw data - we don't convert ascii to hex for
+ * strings.
+ *
+ * There are two terminating conditions for the loop:
+ * 1) The size of an integer has been reached, or
+ * 2) The end of the buffer or string has been reached
+ */
+ Result = 0;
+
+ /* Transfer no more than an integer's worth of data */
+
+ if (Count > AcpiGbl_IntegerByteWidth)
+ {
+ Count = AcpiGbl_IntegerByteWidth;
+ }
+
+ /*
+ * String conversion is different than Buffer conversion
+ */
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Convert string to an integer
+ * String must be hexadecimal as per the ACPI specification
+ */
+ Status = AcpiUtStrtoul64 ((char *) Pointer, 16, &Result);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * Buffer conversion - we simply grab enough raw data from the
+ * buffer to fill an integer
+ */
+ for (i = 0; i < Count; i++)
+ {
+ /*
+ * Get next byte and shift it into the Result.
+ * Little endian is used, meaning that the first byte of the buffer
+ * is the LSB of the integer
+ */
+ Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
+ }
+ break;
+
+
+ default:
+ /* No other types can get here */
+ break;
+ }
+
+ /*
+ * Create a new integer
+ */
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Save the Result */
+
+ RetDesc->Integer.Value = Result;
+
+ /*
+ * If we are about to overwrite the original object on the operand stack,
+ * we must remove a reference on the original object because we are
+ * essentially removing it from the stack.
+ */
+ if (*ResultDesc == ObjDesc)
+ {
+ if (WalkState->Opcode != AML_STORE_OP)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
+ }
+
+ *ResultDesc = RetDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConvertToBuffer
+ *
+ * PARAMETERS: *ObjDesc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to a Buffer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConvertToBuffer (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *RetDesc;
+ UINT32 i;
+ UINT8 *NewBuf;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
+
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_BUFFER:
+
+ /* No conversion necessary */
+
+ *ResultDesc = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+
+
+ case ACPI_TYPE_INTEGER:
+
+ /*
+ * Create a new Buffer object.
+ * Need enough space for one integer
+ */
+ RetDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
+ if (!RetDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the integer to the buffer */
+
+ NewBuf = RetDesc->Buffer.Pointer;
+ for (i = 0; i < AcpiGbl_IntegerByteWidth; i++)
+ {
+ NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8));
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Create a new Buffer object
+ * Size will be the string length
+ */
+ RetDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) ObjDesc->String.Length);
+ if (!RetDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the string to the buffer */
+
+ NewBuf = RetDesc->Buffer.Pointer;
+ ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
+ ObjDesc->String.Length);
+ break;
+
+
+ default:
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /* Mark buffer initialized */
+
+ RetDesc->Common.Flags |= AOPOBJ_DATA_VALID;
+
+ /*
+ * If we are about to overwrite the original object on the operand stack,
+ * we must remove a reference on the original object because we are
+ * essentially removing it from the stack.
+ */
+ if (*ResultDesc == ObjDesc)
+ {
+ if (WalkState->Opcode != AML_STORE_OP)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
+ }
+
+ *ResultDesc = RetDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConvertAscii
+ *
+ * PARAMETERS: Integer - Value to be converted
+ * Base - 10 or 16
+ * String - Where the string is returned
+ * DataWidth - Size of data item to be converted
+ *
+ * RETURN: Actual string length
+ *
+ * DESCRIPTION: Convert an ACPI Integer to a hex or decimal string
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiExConvertToAscii (
+ ACPI_INTEGER Integer,
+ UINT32 Base,
+ UINT8 *String,
+ UINT8 DataWidth)
+{
+ UINT32 i;
+ UINT32 j;
+ UINT32 k = 0;
+ char HexDigit;
+ ACPI_INTEGER Digit;
+ UINT32 Remainder;
+ UINT32 Length;
+ BOOLEAN LeadingZero;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+ if (DataWidth < sizeof (ACPI_INTEGER))
+ {
+ LeadingZero = FALSE;
+ Length = DataWidth;
+ }
+ else
+ {
+ LeadingZero = TRUE;
+ Length = sizeof (ACPI_INTEGER);
+ }
+
+
+ switch (Base)
+ {
+ case 10:
+
+ Remainder = 0;
+ for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--)
+ {
+ /* Divide by nth factor of 10 */
+
+ Digit = Integer;
+ for (j = 1; j < i; j++)
+ {
+ (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
+ }
+
+ /* Create the decimal digit */
+
+ if (Digit != 0)
+ {
+ LeadingZero = FALSE;
+ }
+
+ if (!LeadingZero)
+ {
+ String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
+ k++;
+ }
+ }
+ break;
+
+ case 16:
+
+ /* Copy the integer to the buffer */
+
+ for (i = 0, j = ((Length * 2) -1); i < (Length * 2); i++, j--)
+ {
+
+ HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
+ if (HexDigit != ACPI_ASCII_ZERO)
+ {
+ LeadingZero = FALSE;
+ }
+
+ if (!LeadingZero)
+ {
+ String[k] = (UINT8) HexDigit;
+ k++;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * Since leading zeros are supressed, we must check for the case where
+ * the integer equals 0.
+ *
+ * Finally, null terminate the string and return the length
+ */
+ if (!k)
+ {
+ String [0] = ACPI_ASCII_ZERO;
+ k = 1;
+ }
+
+ String [k] = 0;
+ return (k);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConvertToString
+ *
+ * PARAMETERS: *ObjDesc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to a string
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConvertToString (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ UINT32 Base,
+ UINT32 MaxLength,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *RetDesc;
+ UINT32 i;
+ UINT32 StringLength;
+ UINT8 *NewBuf;
+ UINT8 *Pointer;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
+
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_STRING:
+
+ if (MaxLength >= ObjDesc->String.Length)
+ {
+ *ResultDesc = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+ }
+ else
+ {
+ /* Must copy the string first and then truncate it */
+
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+ }
+
+
+ case ACPI_TYPE_INTEGER:
+
+ StringLength = AcpiGbl_IntegerByteWidth * 2;
+ if (Base == 10)
+ {
+ StringLength = ACPI_MAX_DECIMAL_DIGITS;
+ }
+
+ /*
+ * Create a new String
+ */
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
+ if (!RetDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Need enough space for one ASCII integer plus null terminator */
+
+ NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1);
+ if (!NewBuf)
+ {
+ ACPI_REPORT_ERROR
+ (("ExConvertToString: Buffer allocation failure\n"));
+ AcpiUtRemoveReference (RetDesc);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Convert */
+
+ i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf, sizeof (ACPI_INTEGER));
+
+ /* Null terminate at the correct place */
+
+ if (MaxLength < i)
+ {
+ NewBuf[MaxLength] = 0;
+ RetDesc->String.Length = MaxLength;
+ }
+ else
+ {
+ NewBuf [i] = 0;
+ RetDesc->String.Length = i;
+ }
+
+ RetDesc->Buffer.Pointer = NewBuf;
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ /* Find the string length */
+
+ Pointer = ObjDesc->Buffer.Pointer;
+ for (StringLength = 0; StringLength < ObjDesc->Buffer.Length; StringLength++)
+ {
+ /* Exit on null terminator */
+
+ if (!Pointer[StringLength])
+ {
+ break;
+ }
+ }
+
+ if (MaxLength > ACPI_MAX_STRING_CONVERSION)
+ {
+ if (StringLength > ACPI_MAX_STRING_CONVERSION)
+ {
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+ }
+ }
+
+ /*
+ * Create a new string object
+ */
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
+ if (!RetDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* String length is the lesser of the Max or the actual length */
+
+ if (MaxLength < StringLength)
+ {
+ StringLength = MaxLength;
+ }
+
+ NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1);
+ if (!NewBuf)
+ {
+ ACPI_REPORT_ERROR
+ (("ExConvertToString: Buffer allocation failure\n"));
+ AcpiUtRemoveReference (RetDesc);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the appropriate number of buffer characters */
+
+ ACPI_MEMCPY (NewBuf, Pointer, StringLength);
+
+ /* Null terminate */
+
+ NewBuf [StringLength] = 0;
+ RetDesc->Buffer.Pointer = NewBuf;
+ RetDesc->String.Length = StringLength;
+ break;
+
+
+ default:
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+
+ /*
+ * If we are about to overwrite the original object on the operand stack,
+ * we must remove a reference on the original object because we are
+ * essentially removing it from the stack.
+ */
+ if (*ResultDesc == ObjDesc)
+ {
+ if (WalkState->Opcode != AML_STORE_OP)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
+ }
+
+ *ResultDesc = RetDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConvertToTargetType
+ *
+ * PARAMETERS: DestinationType - Current type of the destination
+ * SourceDesc - Source object to be converted.
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConvertToTargetType (
+ ACPI_OBJECT_TYPE DestinationType,
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
+
+
+ /* Default behavior */
+
+ *ResultDesc = SourceDesc;
+
+ /*
+ * If required by the target,
+ * perform implicit conversion on the source before we store it.
+ */
+ switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
+ {
+ case ARGI_SIMPLE_TARGET:
+ case ARGI_FIXED_TARGET:
+ case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
+
+ switch (DestinationType)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ /*
+ * Named field can always handle conversions
+ */
+ break;
+
+ default:
+ /* No conversion allowed for these types */
+
+ if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Explicit operator, will store (%s) over existing type (%s)\n",
+ AcpiUtGetObjectTypeName (SourceDesc),
+ AcpiUtGetTypeName (DestinationType)));
+ Status = AE_TYPE;
+ }
+ }
+ break;
+
+
+ case ARGI_TARGETREF:
+
+ switch (DestinationType)
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /*
+ * These types require an Integer operand. We can convert
+ * a Buffer or a String to an Integer if necessary.
+ */
+ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, WalkState);
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * The operand must be a String. We can convert an
+ * Integer or Buffer if necessary
+ */
+ Status = AcpiExConvertToString (SourceDesc, ResultDesc, 16, ACPI_UINT32_MAX, WalkState);
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * The operand must be a Buffer. We can convert an
+ * Integer or String if necessary
+ */
+ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
+ break;
+
+
+ default:
+ Status = AE_AML_INTERNAL;
+ break;
+ }
+ break;
+
+
+ case ARGI_REFERENCE:
+ /*
+ * CreateXxxxField cases - we are storing the field object into the name
+ */
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown Target type ID 0x%X Op %s DestType %s\n",
+ GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
+ WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType)));
+
+ Status = AE_AML_INTERNAL;
+ }
+
+ /*
+ * Source-to-Target conversion semantics:
+ *
+ * If conversion to the target type cannot be performed, then simply
+ * overwrite the target with the new object and type.
+ */
+ if (Status == AE_TYPE)
+ {
+ Status = AE_OK;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c
new file mode 100644
index 0000000..f5bc176
--- /dev/null
+++ b/sys/contrib/dev/acpica/excreate.c
@@ -0,0 +1,728 @@
+/******************************************************************************
+ *
+ * Module Name: excreate - Named object creation
+ * $Revision: 99 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXCREATE_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("excreate")
+
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateAlias
+ *
+ * PARAMETERS: WalkState - Current state, contains operands
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new named alias
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateAlias (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_NAMESPACE_NODE *TargetNode;
+ ACPI_NAMESPACE_NODE *AliasNode;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExCreateAlias");
+
+
+ /* Get the source/alias operands (both namespace nodes) */
+
+ AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+ TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
+
+ if (TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS)
+ {
+ /*
+ * Dereference an existing alias so that we don't create a chain
+ * of aliases. With this code, we guarantee that an alias is
+ * always exactly one level of indirection away from the
+ * actual aliased name.
+ */
+ TargetNode = (ACPI_NAMESPACE_NODE *) TargetNode->Object;
+ }
+
+ /*
+ * For objects that can never change (i.e., the NS node will
+ * permanently point to the same object), we can simply attach
+ * the object to the new NS node. For other objects (such as
+ * Integers, buffers, etc.), we have to point the Alias node
+ * to the original Node.
+ */
+ switch (TargetNode->Type)
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /*
+ * The new alias has the type ALIAS and points to the original
+ * NS node, not the object itself. This is because for these
+ * types, the object can change dynamically via a Store.
+ */
+ AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
+ AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
+ break;
+
+ default:
+
+ /* Attach the original source object to the new Alias Node */
+
+ /*
+ * The new alias assumes the type of the target, and it points
+ * to the same object. The reference count of the object has an
+ * additional reference to prevent deletion out from under either the
+ * target node or the alias Node
+ */
+ Status = AcpiNsAttachObject (AliasNode,
+ AcpiNsGetAttachedObject (TargetNode),
+ TargetNode->Type);
+ break;
+ }
+
+ /* Since both operands are Nodes, we don't need to delete them */
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateEvent
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new event object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateEvent (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("ExCreateEvent");
+
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Create the actual OS semaphore, with zero initial units -- meaning
+ * that the event is created in an unsignalled state
+ */
+ Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
+ &ObjDesc->Event.Semaphore);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Attach object to the Node */
+
+ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
+ ObjDesc, ACPI_TYPE_EVENT);
+
+Cleanup:
+ /*
+ * Remove local reference to the object (on error, will cause deletion
+ * of both object and semaphore if present.)
+ */
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateMutex
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new mutex object
+ *
+ * Mutex (Name[0], SyncLevel[1])
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateMutex (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
+
+
+ /* Create the new mutex object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Create the actual OS semaphore.
+ * One unit max to make it a mutex, with one initial unit to allow
+ * the mutex to be acquired.
+ */
+ Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Init object and attach to NS node */
+
+ ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
+ ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+
+ Status = AcpiNsAttachObject (ObjDesc->Mutex.Node,
+ ObjDesc, ACPI_TYPE_MUTEX);
+
+
+Cleanup:
+ /*
+ * Remove local reference to the object (on error, will cause deletion
+ * of both object and semaphore if present.)
+ */
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateRegion
+ *
+ * PARAMETERS: AmlStart - Pointer to the region declaration AML
+ * AmlLength - Max length of the declaration AML
+ * Operands - List of operands for the opcode
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new operation region object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateRegion (
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ UINT8 RegionSpace,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *RegionObj2;
+
+
+ ACPI_FUNCTION_TRACE ("ExCreateRegion");
+
+
+ /* Get the Node from the object stack */
+
+ Node = WalkState->Op->Common.Node;
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (AcpiNsGetAttachedObject (Node))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Space ID must be one of the predefined IDs, or in the user-defined
+ * range
+ */
+ if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
+ (RegionSpace < ACPI_USER_REGION_BEGIN))
+ {
+ ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
+ return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
+ AcpiUtGetRegionName (RegionSpace), RegionSpace));
+
+
+ /* Create the region descriptor */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Remember location in AML stream of address & length
+ * operands since they need to be evaluated at run time.
+ */
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.AmlStart = AmlStart;
+ RegionObj2->Extra.AmlLength = AmlLength;
+
+ /* Init the region from the operands */
+
+ ObjDesc->Region.SpaceId = RegionSpace;
+ ObjDesc->Region.Address = 0;
+ ObjDesc->Region.Length = 0;
+ ObjDesc->Region.Node = Node;
+
+ /* Install the new region object in the parent Node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
+
+
+Cleanup:
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateTableRegion
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new DataTableRegion object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateTableRegion (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OPERAND_OBJECT *RegionObj2;
+
+
+ ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
+
+ /* Get the Node from the object stack */
+
+ Node = WalkState->Op->Common.Node;
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (AcpiNsGetAttachedObject (Node))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Find the ACPI table */
+
+ Status = AcpiTbFindTable (Operand[1]->String.Pointer,
+ Operand[2]->String.Pointer,
+ Operand[3]->String.Pointer, &Table);
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Create the region descriptor */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.RegionContext = NULL;
+
+ /* Init the region from the operands */
+
+ ObjDesc->Region.SpaceId = REGION_DATA_TABLE;
+ ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
+ ObjDesc->Region.Length = Table->Length;
+ ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
+
+ /* Install the new region object in the parent Node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_EXIST)
+ {
+ Status = AE_OK;
+ }
+ else
+ {
+ goto Cleanup;
+ }
+ }
+
+ ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
+
+
+Cleanup:
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateProcessor
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new processor object and populate the fields
+ *
+ * Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3])
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateProcessor (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
+
+
+ /* Create the processor object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Initialize the processor object from the operands
+ */
+ ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
+ ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
+
+ /* Install the processor object in the parent Node */
+
+ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
+ ObjDesc, ACPI_TYPE_PROCESSOR);
+
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreatePowerResource
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new PowerResource object and populate the fields
+ *
+ * PowerResource (Name[0], SystemLevel[1], ResourceOrder[2])
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreatePowerResource (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
+
+
+ /* Create the power resource object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize the power object from the operands */
+
+ ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
+
+ /* Install the power resource object in the parent Node */
+
+ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
+ ObjDesc, ACPI_TYPE_POWER);
+
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+#endif
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExCreateMethod
+ *
+ * PARAMETERS: AmlStart - First byte of the method's AML
+ * AmlLength - AML byte count for this method
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new method object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiExCreateMethod (
+ UINT8 *AmlStart,
+ UINT32 AmlLength,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ UINT8 MethodFlags;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
+
+
+ /* Create a new method object */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Save the method's AML pointer and length */
+
+ ObjDesc->Method.AmlStart = AmlStart;
+ ObjDesc->Method.AmlLength = AmlLength;
+
+ /* disassemble the method flags */
+
+ MethodFlags = (UINT8) Operand[1]->Integer.Value;
+
+ ObjDesc->Method.MethodFlags = MethodFlags;
+ ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & METHOD_FLAGS_ARG_COUNT);
+
+ /*
+ * Get the concurrency count. If required, a semaphore will be
+ * created for this method when it is parsed.
+ */
+ if (MethodFlags & METHOD_FLAGS_SERIALIZED)
+ {
+ /*
+ * ACPI 1.0: Concurrency = 1
+ * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1)
+ */
+ ObjDesc->Method.Concurrency = (UINT8)
+ (((MethodFlags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1);
+ }
+
+ else
+ {
+ ObjDesc->Method.Concurrency = INFINITE_CONCURRENCY;
+ }
+
+ /* Attach the new object to the method Node */
+
+ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
+ ObjDesc, ACPI_TYPE_METHOD);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ /* Remove a reference to the operand */
+
+ AcpiUtRemoveReference (Operand[1]);
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c
new file mode 100644
index 0000000..180c4e0
--- /dev/null
+++ b/sys/contrib/dev/acpica/exdump.c
@@ -0,0 +1,901 @@
+/******************************************************************************
+ *
+ * Module Name: exdump - Interpreter debug output routines
+ * $Revision: 167 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXDUMP_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exdump")
+
+
+/*
+ * The following routines are used for debug output only
+ */
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExDumpOperand
+ *
+ * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Dump an operand object
+ *
+ ****************************************************************************/
+
+void
+AcpiExDumpOperand (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT8 *Buf = NULL;
+ UINT32 Length;
+ ACPI_OPERAND_OBJECT **Element;
+ UINT16 ElementIndex;
+
+
+ ACPI_FUNCTION_NAME ("ExDumpOperand")
+
+
+ if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
+ {
+ return;
+ }
+
+ if (!ObjDesc)
+ {
+ /*
+ * This usually indicates that something serious is wrong --
+ * since most (if not all)
+ * code that dumps the stack expects something to be there!
+ */
+ AcpiOsPrintf ("Null stack entry ptr\n");
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", ObjDesc));
+ ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", ObjDesc));
+ ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
+ return;
+ }
+
+ /* ObjDesc is a valid object */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_DEBUG_OP:
+
+ AcpiOsPrintf ("Reference: Debug\n");
+ break;
+
+
+ case AML_NAME_OP:
+
+ ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
+ ACPI_LV_INFO, _COMPONENT);
+ ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
+ break;
+
+
+ case AML_INDEX_OP:
+
+ AcpiOsPrintf ("Reference: Index %p\n",
+ ObjDesc->Reference.Object);
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ AcpiOsPrintf ("Reference: (RefOf) %p\n",
+ ObjDesc->Reference.Object);
+ break;
+
+
+ case AML_ARG_OP:
+
+ AcpiOsPrintf ("Reference: Arg%d",
+ ObjDesc->Reference.Offset);
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ /* Value is a Number */
+
+ AcpiOsPrintf (" value is [%8.8X%8.8x]",
+ ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
+ }
+
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case AML_LOCAL_OP:
+
+ AcpiOsPrintf ("Reference: Local%d",
+ ObjDesc->Reference.Offset);
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+
+ /* Value is a Number */
+
+ AcpiOsPrintf (" value is [%8.8X%8.8x]",
+ ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
+ }
+
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case AML_INT_NAMEPATH_OP:
+
+ AcpiOsPrintf ("Reference.Node->Name %X\n",
+ ObjDesc->Reference.Node->Name.Integer);
+ break;
+
+
+ default:
+
+ /* unknown opcode */
+
+ AcpiOsPrintf ("Unknown Reference opcode=%X\n",
+ ObjDesc->Reference.Opcode);
+ break;
+
+ }
+
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("Buffer len %X @ %p \n",
+ ObjDesc->Buffer.Length,
+ ObjDesc->Buffer.Pointer);
+
+ Length = ObjDesc->Buffer.Length;
+
+ if (Length > 64)
+ {
+ Length = 64;
+ }
+
+ /* Debug only -- dump the buffer contents */
+
+ if (ObjDesc->Buffer.Pointer)
+ {
+ AcpiOsPrintf ("Buffer Contents: ");
+
+ for (Buf = ObjDesc->Buffer.Pointer; Length--; ++Buf)
+ {
+ AcpiOsPrintf (" %02x", *Buf);
+ }
+ AcpiOsPrintf ("\n");
+ }
+
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf ("Integer %8.8X%8.8X\n",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiOsPrintf ("Package count %X @ %p\n",
+ ObjDesc->Package.Count, ObjDesc->Package.Elements);
+
+ /*
+ * If elements exist, package vector pointer is valid,
+ * and debug_level exceeds 1, dump package's elements.
+ */
+ if (ObjDesc->Package.Count &&
+ ObjDesc->Package.Elements &&
+ AcpiDbgLevel > 1)
+ {
+ for (ElementIndex = 0, Element = ObjDesc->Package.Elements;
+ ElementIndex < ObjDesc->Package.Count;
+ ++ElementIndex, ++Element)
+ {
+ AcpiExDumpOperand (*Element);
+ }
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_REGION:
+
+ AcpiOsPrintf ("Region %s (%X)",
+ AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
+ ObjDesc->Region.SpaceId);
+
+ /*
+ * If the address and length have not been evaluated,
+ * don't print them.
+ */
+ if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
+ {
+ AcpiOsPrintf ("\n");
+ }
+ else
+ {
+ AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
+ ACPI_HIDWORD (ObjDesc->Region.Address),
+ ACPI_LODWORD (ObjDesc->Region.Address),
+ ObjDesc->Region.Length);
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("String length %X @ %p ",
+ ObjDesc->String.Length, ObjDesc->String.Pointer);
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+ AcpiOsPrintf ("BankField\n");
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+
+ AcpiOsPrintf (
+ "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+ ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth,
+ ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
+ ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
+ ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset);
+ ACPI_DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ AcpiOsPrintf ("IndexField\n");
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ AcpiOsPrintf (
+ "BufferField: %X bits at byte %X bit %X of \n",
+ ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset,
+ ObjDesc->BufferField.StartFieldBitOffset);
+
+ if (!ObjDesc->BufferField.BufferObj)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
+ }
+ else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != ACPI_TYPE_BUFFER)
+ {
+ AcpiOsPrintf ("*not a Buffer* \n");
+ }
+ else
+ {
+ ACPI_DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
+ }
+
+ break;
+
+
+ case ACPI_TYPE_EVENT:
+
+ AcpiOsPrintf ("Event\n");
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ AcpiOsPrintf (
+ "Method(%X) @ %p:%X\n",
+ ObjDesc->Method.ParamCount,
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength);
+ break;
+
+
+ case ACPI_TYPE_MUTEX:
+
+ AcpiOsPrintf ("Mutex\n");
+ break;
+
+
+ case ACPI_TYPE_DEVICE:
+
+ AcpiOsPrintf ("Device\n");
+ break;
+
+
+ case ACPI_TYPE_POWER:
+
+ AcpiOsPrintf ("Power\n");
+ break;
+
+
+ case ACPI_TYPE_PROCESSOR:
+
+ AcpiOsPrintf ("Processor\n");
+ break;
+
+
+ case ACPI_TYPE_THERMAL:
+
+ AcpiOsPrintf ("Thermal\n");
+ break;
+
+
+ default:
+ /* Unknown Type */
+
+ AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
+ break;
+ }
+
+ return;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExDumpOperands
+ *
+ * PARAMETERS: InterpreterMode - Load or Exec
+ * *Ident - Identification
+ * NumLevels - # of stack entries to dump above line
+ * *Note - Output notation
+ *
+ * DESCRIPTION: Dump the object stack
+ *
+ ****************************************************************************/
+
+void
+AcpiExDumpOperands (
+ ACPI_OPERAND_OBJECT **Operands,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ char *Ident,
+ UINT32 NumLevels,
+ char *Note,
+ char *ModuleName,
+ UINT32 LineNumber)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_OPERAND_OBJECT **ObjDesc;
+
+
+ ACPI_FUNCTION_NAME ("ExDumpOperands");
+
+
+ if (!Ident)
+ {
+ Ident = "?";
+ }
+
+ if (!Note)
+ {
+ Note = "?";
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
+ Ident, NumLevels));
+
+ if (NumLevels == 0)
+ {
+ NumLevels = 1;
+ }
+
+ /* Dump the operand stack starting at the top */
+
+ for (i = 0; NumLevels > 0; i--, NumLevels--)
+ {
+ ObjDesc = &Operands[i];
+ AcpiExDumpOperand (*ObjDesc);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "************* Stack dump from %s(%d), %s\n",
+ ModuleName, LineNumber, Note));
+ return;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExOut*
+ *
+ * PARAMETERS: Title - Descriptive text
+ * Value - Value to be displayed
+ *
+ * DESCRIPTION: Object dump output formatting functions. These functions
+ * reduce the number of format strings required and keeps them
+ * all in one place for easy modification.
+ *
+ ****************************************************************************/
+
+void
+AcpiExOutString (
+ char *Title,
+ char *Value)
+{
+ AcpiOsPrintf ("%20s : %s\n", Title, Value);
+}
+
+void
+AcpiExOutPointer (
+ char *Title,
+ void *Value)
+{
+ AcpiOsPrintf ("%20s : %p\n", Title, Value);
+}
+
+void
+AcpiExOutInteger (
+ char *Title,
+ UINT32 Value)
+{
+ AcpiOsPrintf ("%20s : %X\n", Title, Value);
+}
+
+void
+AcpiExOutAddress (
+ char *Title,
+ ACPI_PHYSICAL_ADDRESS Value)
+{
+
+#if ACPI_MACHINE_WIDTH == 16
+ AcpiOsPrintf ("%20s : %p\n", Title, Value);
+#else
+ AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title,
+ ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
+#endif
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExDumpNode
+ *
+ * PARAMETERS: *Node - Descriptor to dump
+ * Flags - Force display
+ *
+ * DESCRIPTION: Dumps the members of the given.Node
+ *
+ ****************************************************************************/
+
+void
+AcpiExDumpNode (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 Flags)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Flags)
+ {
+ if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
+ {
+ return;
+ }
+ }
+
+ AcpiOsPrintf ("%20s : %4.4s\n", "Name", Node->Name.Ascii);
+ AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
+ AcpiExOutInteger ("Flags", Node->Flags);
+ AcpiExOutInteger ("Owner Id", Node->OwnerId);
+ AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
+ AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
+ AcpiExOutPointer ("ChildList", Node->Child);
+ AcpiExOutPointer ("NextPeer", Node->Peer);
+ AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiExDumpObjectDescriptor
+ *
+ * PARAMETERS: *Object - Descriptor to dump
+ * Flags - Force display
+ *
+ * DESCRIPTION: Dumps the members of the object descriptor given.
+ *
+ ****************************************************************************/
+
+void
+AcpiExDumpObjectDescriptor (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Flags)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
+
+
+ if (!Flags)
+ {
+ if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
+ {
+ return_VOID;
+ }
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiExDumpNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
+ AcpiOsPrintf ("\nAttached Object (%p):\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
+ AcpiExDumpObjectDescriptor (((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc);
+ return_VOID;
+ }
+
+ /* Common Fields */
+
+ AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
+ AcpiExOutInteger ("Reference Count", ObjDesc->Common.ReferenceCount);
+ AcpiExOutInteger ("Flags", ObjDesc->Common.Flags);
+
+ /* Object-specific Fields */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiExOutInteger ("Length", ObjDesc->String.Length);
+
+ AcpiOsPrintf ("%20s : %p ", "Pointer", ObjDesc->String.Pointer);
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiExOutInteger ("Length", ObjDesc->Buffer.Length);
+ AcpiExOutPointer ("Pointer", ObjDesc->Buffer.Pointer);
+ ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiExOutInteger ("Flags", ObjDesc->Package.Flags);
+ AcpiExOutInteger ("Count", ObjDesc->Package.Count);
+ AcpiExOutPointer ("Elements", ObjDesc->Package.Elements);
+
+ /* Dump the package contents */
+
+ if (ObjDesc->Package.Count > 0)
+ {
+ AcpiOsPrintf ("\nPackage Contents:\n");
+ for (i = 0; i < ObjDesc->Package.Count; i++)
+ {
+ AcpiOsPrintf ("[%.3d] %p", i, ObjDesc->Package.Elements[i]);
+ if (ObjDesc->Package.Elements[i])
+ {
+ AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[i]));
+ }
+ AcpiOsPrintf ("\n");
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_DEVICE:
+
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Device.AddressSpace);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->Device.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->Device.DeviceNotify);
+ break;
+
+
+ case ACPI_TYPE_EVENT:
+
+ AcpiExOutPointer ("Semaphore", ObjDesc->Event.Semaphore);
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount);
+ AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency);
+ AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore);
+ AcpiExOutInteger ("OwningId", ObjDesc->Method.OwningId);
+ AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength);
+ AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart);
+ break;
+
+
+ case ACPI_TYPE_MUTEX:
+
+ AcpiExOutInteger ("SyncLevel", ObjDesc->Mutex.SyncLevel);
+ AcpiExOutPointer ("OwnerThread", ObjDesc->Mutex.OwnerThread);
+ AcpiExOutInteger ("AcquisitionDepth",ObjDesc->Mutex.AcquisitionDepth);
+ AcpiExOutPointer ("Semaphore", ObjDesc->Mutex.Semaphore);
+ break;
+
+
+ case ACPI_TYPE_REGION:
+
+ AcpiExOutInteger ("SpaceId", ObjDesc->Region.SpaceId);
+ AcpiExOutInteger ("Flags", ObjDesc->Region.Flags);
+ AcpiExOutAddress ("Address", ObjDesc->Region.Address);
+ AcpiExOutInteger ("Length", ObjDesc->Region.Length);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Region.AddressSpace);
+ AcpiExOutPointer ("Next", ObjDesc->Region.Next);
+ break;
+
+
+ case ACPI_TYPE_POWER:
+
+ AcpiExOutInteger ("SystemLevel", ObjDesc->PowerResource.SystemLevel);
+ AcpiExOutInteger ("ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->PowerResource.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->PowerResource.DeviceNotify);
+ break;
+
+
+ case ACPI_TYPE_PROCESSOR:
+
+ AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId);
+ AcpiExOutInteger ("Length", ObjDesc->Processor.Length);
+ AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->Processor.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->Processor.DeviceNotify);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Processor.AddressSpace);
+ break;
+
+
+ case ACPI_TYPE_THERMAL:
+
+ AcpiExOutPointer ("SystemNotify", ObjDesc->ThermalZone.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->ThermalZone.DeviceNotify);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->ThermalZone.AddressSpace);
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ AcpiExOutInteger ("FieldFlags", ObjDesc->CommonField.FieldFlags);
+ AcpiExOutInteger ("AccessByteWidth", ObjDesc->CommonField.AccessByteWidth);
+ AcpiExOutInteger ("BitLength", ObjDesc->CommonField.BitLength);
+ AcpiExOutInteger ("FldBitOffset", ObjDesc->CommonField.StartFieldBitOffset);
+ AcpiExOutInteger ("BaseByteOffset", ObjDesc->CommonField.BaseByteOffset);
+ AcpiExOutInteger ("DatumValidBits", ObjDesc->CommonField.DatumValidBits);
+ AcpiExOutInteger ("EndFldValidBits", ObjDesc->CommonField.EndFieldValidBits);
+ AcpiExOutInteger ("EndBufValidBits", ObjDesc->CommonField.EndBufferValidBits);
+ AcpiExOutPointer ("ParentNode", ObjDesc->CommonField.Node);
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ AcpiExOutPointer ("BufferObj", ObjDesc->BufferField.BufferObj);
+ break;
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ AcpiExOutPointer ("RegionObj", ObjDesc->Field.RegionObj);
+ break;
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ AcpiExOutInteger ("Value", ObjDesc->BankField.Value);
+ AcpiExOutPointer ("RegionObj", ObjDesc->BankField.RegionObj);
+ AcpiExOutPointer ("BankObj", ObjDesc->BankField.BankObj);
+ break;
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ AcpiExOutInteger ("Value", ObjDesc->IndexField.Value);
+ AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj);
+ AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj);
+ break;
+
+ default:
+ /* All object types covered above */
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ AcpiExOutInteger ("TargetType", ObjDesc->Reference.TargetType);
+ AcpiExOutString ("Opcode", (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
+ AcpiExOutInteger ("Offset", ObjDesc->Reference.Offset);
+ AcpiExOutPointer ("ObjDesc", ObjDesc->Reference.Object);
+ AcpiExOutPointer ("Node", ObjDesc->Reference.Node);
+ AcpiExOutPointer ("Where", ObjDesc->Reference.Where);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
+
+ AcpiExOutInteger ("SpaceId", ObjDesc->AddressSpace.SpaceId);
+ AcpiExOutPointer ("Next", ObjDesc->AddressSpace.Next);
+ AcpiExOutPointer ("RegionList", ObjDesc->AddressSpace.RegionList);
+ AcpiExOutPointer ("Node", ObjDesc->AddressSpace.Node);
+ AcpiExOutPointer ("Context", ObjDesc->AddressSpace.Context);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_NOTIFY:
+
+ AcpiExOutPointer ("Node", ObjDesc->Notify.Node);
+ AcpiExOutPointer ("Context", ObjDesc->Notify.Context);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_ALIAS:
+ case ACPI_TYPE_LOCAL_EXTRA:
+ case ACPI_TYPE_LOCAL_DATA:
+ default:
+
+ AcpiOsPrintf ("ExDumpObjectDescriptor: Display not implemented for object type %s\n",
+ AcpiUtGetObjectTypeName (ObjDesc));
+ break;
+ }
+
+ return_VOID;
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/exdyadic.c b/sys/contrib/dev/acpica/exdyadic.c
new file mode 100644
index 0000000..ef434a2
--- /dev/null
+++ b/sys/contrib/dev/acpica/exdyadic.c
@@ -0,0 +1,939 @@
+/******************************************************************************
+ *
+ * Module Name: exdyadic - ACPI AML execution for dyadic (2-operand) operators
+ * $Revision: 91 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXDYADIC_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "acevents.h"
+#include "amlcode.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ MODULE_NAME ("exdyadic")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoConcatenate
+ *
+ * PARAMETERS: *ObjDesc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDoConcatenate (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualRetDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ ACPI_INTEGER ThisInteger;
+ ACPI_OPERAND_OBJECT *RetDesc;
+ NATIVE_CHAR *NewBuf;
+ UINT32 IntegerSize = sizeof (ACPI_INTEGER);
+
+
+ FUNCTION_ENTRY ();
+
+
+ /*
+ * There are three cases to handle:
+ * 1) Two Integers concatenated to produce a buffer
+ * 2) Two Strings concatenated to produce a string
+ * 3) Two Buffers concatenated to produce a buffer
+ */
+ switch (ObjDesc->Common.Type)
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
+
+ if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
+ {
+ /*
+ * We are running a method that exists in a 32-bit ACPI table.
+ * Truncate the value to 32 bits by zeroing out the upper
+ * 32-bit field
+ */
+ IntegerSize = sizeof (UINT32);
+ }
+
+ /* Result of two integers is a buffer */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!RetDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Need enough space for two integers */
+
+ RetDesc->Buffer.Length = IntegerSize * 2;
+ NewBuf = ACPI_MEM_CALLOCATE (RetDesc->Buffer.Length);
+ if (!NewBuf)
+ {
+ REPORT_ERROR
+ (("ExDoConcatenate: Buffer allocation failure\n"));
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
+
+ /* Convert the first integer */
+
+ ThisInteger = ObjDesc->Integer.Value;
+ for (i = 0; i < IntegerSize; i++)
+ {
+ NewBuf[i] = (UINT8) ThisInteger;
+ ThisInteger >>= 8;
+ }
+
+ /* Convert the second integer */
+
+ ThisInteger = ObjDesc2->Integer.Value;
+ for (; i < (IntegerSize * 2); i++)
+ {
+ NewBuf[i] = (UINT8) ThisInteger;
+ ThisInteger >>= 8;
+ }
+
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
+ if (!RetDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Operand1 is string */
+
+ NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->String.Length +
+ ObjDesc2->String.Length + 1);
+ if (!NewBuf)
+ {
+ REPORT_ERROR
+ (("ExDoConcatenate: String allocation failure\n"));
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ STRCPY (NewBuf, ObjDesc->String.Pointer);
+ STRCPY (NewBuf + ObjDesc->String.Length,
+ ObjDesc2->String.Pointer);
+
+ /* Point the return object to the new string */
+
+ RetDesc->String.Pointer = NewBuf;
+ RetDesc->String.Length = ObjDesc->String.Length +=
+ ObjDesc2->String.Length;
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ /* Operand1 is a buffer */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!RetDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->Buffer.Length +
+ ObjDesc2->Buffer.Length);
+ if (!NewBuf)
+ {
+ REPORT_ERROR
+ (("ExDoConcatenate: Buffer allocation failure\n"));
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ MEMCPY (NewBuf, ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length);
+ MEMCPY (NewBuf + ObjDesc->Buffer.Length, ObjDesc2->Buffer.Pointer,
+ ObjDesc2->Buffer.Length);
+
+ /*
+ * Point the return object to the new buffer
+ */
+
+ RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
+ RetDesc->Buffer.Length = ObjDesc->Buffer.Length +
+ ObjDesc2->Buffer.Length;
+ break;
+
+ default:
+ Status = AE_AML_INTERNAL;
+ RetDesc = NULL;
+ }
+
+
+ *ActualRetDesc = RetDesc;
+ return (AE_OK);
+
+
+Cleanup:
+
+ AcpiUtRemoveReference (RetDesc);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDyadic1
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 1 dyadic operator with numeric operands:
+ * NotifyOp
+ *
+ * ALLOCATION: Deletes both operands
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDyadic1 (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status = AE_OK;
+
+
+ FUNCTION_TRACE_PTR ("ExDyadic1", WALK_OPERANDS);
+
+
+
+ /* Examine the opcode */
+
+ switch (WalkState->Opcode)
+ {
+
+ case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */
+
+ /* The first operand is a namespace node */
+
+ Node = (ACPI_NAMESPACE_NODE *) Operand[0];
+ Operand[0] = NULL;
+
+ /* The node must refer to a device or thermal zone */
+
+ if (Node && Operand[1])
+ {
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+
+ /*
+ * Dispatch the notify to the appropriate handler
+ * NOTE: the request is queued for execution after this method
+ * completes. The notify handlers are NOT invoked synchronously
+ * from this thread -- because handlers may in turn run other
+ * control methods.
+ */
+ Status = AcpiEvQueueNotifyRequest (Node,
+ (UINT32) Operand[1]->Integer.Value);
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
+ Node->Type));
+
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ }
+ break;
+
+ default:
+
+ REPORT_ERROR (("AcpiExDyadic1: Unknown dyadic opcode %X\n", WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ }
+
+
+ /* Always delete both operands */
+
+ AcpiUtRemoveReference (Operand[1]);
+ AcpiUtRemoveReference (Operand[0]);
+
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDyadic2R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
+ * one or two result operands.
+ *
+ * ALLOCATION: Deletes one operand descriptor -- other remains on stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDyadic2R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *RetDesc = NULL;
+ ACPI_OPERAND_OBJECT *RetDesc2 = NULL;
+ ACPI_STATUS Status = AE_OK;
+
+
+ FUNCTION_TRACE_U32 ("ExDyadic2R", WalkState->Opcode);
+
+
+ /* Create an internal return object if necessary */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_ADD_OP:
+ case AML_BIT_AND_OP:
+ case AML_BIT_NAND_OP:
+ case AML_BIT_OR_OP:
+ case AML_BIT_NOR_OP:
+ case AML_BIT_XOR_OP:
+ case AML_DIVIDE_OP:
+ case AML_MOD_OP:
+ case AML_MULTIPLY_OP:
+ case AML_SHIFT_LEFT_OP:
+ case AML_SHIFT_RIGHT_OP:
+ case AML_SUBTRACT_OP:
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ break;
+ }
+
+
+ /*
+ * Execute the opcode
+ */
+ switch (WalkState->Opcode)
+ {
+
+ case AML_ADD_OP: /* Add (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value +
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_BIT_AND_OP: /* And (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value &
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_BIT_NAND_OP: /* NAnd (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = ~(Operand[0]->Integer.Value &
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_BIT_OR_OP: /* Or (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value |
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_BIT_NOR_OP: /* NOr (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = ~(Operand[0]->Integer.Value |
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_BIT_XOR_OP: /* XOr (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value ^
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, RemainderResult QuotientRsult) */
+
+ if (!Operand[1]->Integer.Value)
+ {
+ REPORT_ERROR (("DivideOp: Divide by zero\n"));
+
+ Status = AE_AML_DIVIDE_BY_ZERO;
+ goto Cleanup;
+ }
+
+ RetDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc2)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * RetDesc2 will contain the quotient,
+ * RetDesc will contain the remainder
+ */
+ Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value,
+ &RetDesc2->Integer.Value, &RetDesc->Integer.Value);
+
+ break;
+
+
+ case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
+
+ if (!Operand[1]->Integer.Value)
+ {
+ REPORT_ERROR (("ModOp: Divide by zero\n"));
+
+ Status = AE_AML_DIVIDE_BY_ZERO;
+ goto Cleanup;
+ }
+
+ /* RetDesc will contain the remainder */
+
+ Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value,
+ NULL, &RetDesc->Integer.Value);
+
+ break;
+
+
+ case AML_MULTIPLY_OP: /* Multiply (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value *
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value <<
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value >>
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_SUBTRACT_OP: /* Subtract (Operand1, Operand2, Result) */
+
+ RetDesc->Integer.Value = Operand[0]->Integer.Value -
+ Operand[1]->Integer.Value;
+ break;
+
+
+ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+
+ /*
+ * Convert the second operand if necessary. The first operand
+ * determines the type of the second operand, (See the Data Types
+ * section of the ACPI specification.) Both object types are
+ * guaranteed to be either Integer/String/Buffer by the operand
+ * resolution mechanism above.
+ */
+ switch (Operand[0]->Common.Type)
+ {
+ case ACPI_TYPE_INTEGER:
+ Status = AcpiExConvertToInteger (Operand[1], &Operand[1], WalkState);
+ break;
+
+ case ACPI_TYPE_STRING:
+ Status = AcpiExConvertToString (Operand[1], &Operand[1], 16, ACPI_UINT32_MAX, WalkState);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Status = AcpiExConvertToBuffer (Operand[1], &Operand[1], WalkState);
+ break;
+
+ default:
+ Status = AE_AML_INTERNAL;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Both operands are now known to be the same object type
+ * (Both are Integer, String, or Buffer), and we can now perform the
+ * concatenation.
+ */
+ Status = AcpiExDoConcatenate (Operand[0], Operand[1], &RetDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ break;
+
+
+ case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
+
+ Status = AcpiExConvertToString (Operand[0], &RetDesc, 16,
+ (UINT32) Operand[1]->Integer.Value, WalkState);
+ break;
+
+
+ case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
+
+ Status = AE_NOT_IMPLEMENTED;
+ goto Cleanup;
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("AcpiExDyadic2R: Unknown dyadic opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ /*
+ * Store the result of the operation (which is now in Operand[0]) into
+ * the result descriptor, or the location pointed to by the result
+ * descriptor (Operand[2]).
+ */
+ Status = AcpiExStore (RetDesc, Operand[2], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ if (AML_DIVIDE_OP == WalkState->Opcode)
+ {
+ Status = AcpiExStore (RetDesc2, Operand[3], WalkState);
+
+ /*
+ * Since the remainder is not returned, remove a reference to
+ * the object we created earlier
+ */
+ AcpiUtRemoveReference (RetDesc);
+ WalkState->ResultObj = RetDesc2;
+ }
+
+ else
+ {
+ WalkState->ResultObj = RetDesc;
+ }
+
+
+Cleanup:
+
+ /* Always delete the operands */
+
+ AcpiUtRemoveReference (Operand[0]);
+ AcpiUtRemoveReference (Operand[1]);
+
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* On failure, delete the result ops */
+
+ AcpiUtRemoveReference (Operand[2]);
+ AcpiUtRemoveReference (Operand[3]);
+
+ if (RetDesc)
+ {
+ /* And delete the internal return object */
+
+ AcpiUtRemoveReference (RetDesc);
+ RetDesc = NULL;
+ }
+ }
+
+ /* Set the return object and exit */
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDyadic2S
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic synchronization operator
+ *
+ * ALLOCATION: Deletes one operand descriptor -- other remains on stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDyadic2S (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *RetDesc = NULL;
+ ACPI_STATUS Status;
+
+
+ FUNCTION_TRACE_PTR ("ExDyadic2S", WALK_OPERANDS);
+
+
+
+ /* Create the internal return object */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Default return value is FALSE, operation did not time out */
+
+ RetDesc->Integer.Value = 0;
+
+
+ /* Examine the opcode */
+
+ switch (WalkState->Opcode)
+ {
+
+ case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
+
+ Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
+ break;
+
+
+ case AML_WAIT_OP: /* Wait (EventObject, Timeout) */
+
+ Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("AcpiExDyadic2S: Unknown dyadic synchronization opcode %X\n", WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ /*
+ * Return a boolean indicating if operation timed out
+ * (TRUE) or not (FALSE)
+ */
+ if (Status == AE_TIME)
+ {
+ RetDesc->Integer.Value = ACPI_INTEGER_MAX; /* TRUE, op timed out */
+ Status = AE_OK;
+ }
+
+
+Cleanup:
+
+ /* Delete params */
+
+ AcpiUtRemoveReference (Operand[1]);
+ AcpiUtRemoveReference (Operand[0]);
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status) &&
+ (RetDesc))
+ {
+ AcpiUtRemoveReference (RetDesc);
+ RetDesc = NULL;
+ }
+
+
+ /* Set the return object and exit */
+
+ WalkState->ResultObj = RetDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDyadic2
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
+ * no result operands
+ *
+ * ALLOCATION: Deletes one operand descriptor -- other remains on stack
+ * containing result value
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDyadic2 (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *RetDesc = NULL;
+ ACPI_STATUS Status = AE_OK;
+ BOOLEAN Lboolean;
+
+
+ FUNCTION_TRACE_PTR ("ExDyadic2", WALK_OPERANDS);
+
+
+ /* Create the internal return object */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Execute the WalkState->Opcode
+ */
+ Lboolean = FALSE;
+ switch (WalkState->Opcode)
+ {
+
+ case AML_LAND_OP: /* LAnd (Operand1, Operand2) */
+
+ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value &&
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_LEQUAL_OP: /* LEqual (Operand1, Operand2) */
+
+ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value ==
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_LGREATER_OP: /* LGreater (Operand1, Operand2) */
+
+ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value >
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_LLESS_OP: /* LLess (Operand1, Operand2) */
+
+ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value <
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_LOR_OP: /* LOr (Operand1, Operand2) */
+
+ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value ||
+ Operand[1]->Integer.Value);
+ break;
+
+
+ case AML_COPY_OP: /* Copy (Source, Target) (ACPI 2.0) */
+
+ Status = AE_NOT_IMPLEMENTED;
+ goto Cleanup;
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("AcpiExDyadic2: Unknown dyadic opcode %X\n", WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ break;
+ }
+
+
+ /* Set return value to logical TRUE (all ones) or FALSE (zero) */
+
+ if (Lboolean)
+ {
+ RetDesc->Integer.Value = ACPI_INTEGER_MAX;
+ }
+ else
+ {
+ RetDesc->Integer.Value = 0;
+ }
+
+
+Cleanup:
+
+ /* Always delete operands */
+
+ AcpiUtRemoveReference (Operand[0]);
+ AcpiUtRemoveReference (Operand[1]);
+
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status) &&
+ (RetDesc))
+ {
+ AcpiUtRemoveReference (RetDesc);
+ RetDesc = NULL;
+ }
+
+
+ /* Set the return object and exit */
+
+ WalkState->ResultObj = RetDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c
new file mode 100644
index 0000000..2b253f3
--- /dev/null
+++ b/sys/contrib/dev/acpica/exfield.c
@@ -0,0 +1,463 @@
+/******************************************************************************
+ *
+ * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
+ * $Revision: 118 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXFIELD_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exfield")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReadDataFromField
+ *
+ * PARAMETERS: WalkState - Current execution state
+ * ObjDesc - The named field
+ * RetBufferDesc - Where the return data object is stored
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read from a named field. Returns either an Integer or a
+ * Buffer, depending on the size of the field.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExReadDataFromField (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **RetBufferDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *BufferDesc;
+ ACPI_SIZE Length;
+ void *Buffer;
+ BOOLEAN Locked;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
+
+
+ /* Parameter validation */
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+ {
+ /*
+ * If the BufferField arguments have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
+ {
+ Status = AcpiDsGetBufferFieldArguments (ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+ else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
+ (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
+ {
+ /*
+ * This is an SMBus read. We must create a buffer to hold the data
+ * and directly access the region handler.
+ */
+ BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE);
+ if (!BufferDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Lock entire transaction if requested */
+
+ Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+
+ /*
+ * Perform the read.
+ * Note: Smbus protocol value is passed in upper 16-bits of Function
+ */
+ Status = AcpiExAccessRegion (ObjDesc, 0,
+ ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
+ ACPI_READ | (ObjDesc->Field.Attribute << 16));
+ AcpiExReleaseGlobalLock (Locked);
+ goto Exit;
+ }
+
+ /*
+ * Allocate a buffer for the contents of the field.
+ *
+ * If the field is larger than the size of an ACPI_INTEGER, create
+ * a BUFFER to hold it. Otherwise, use an INTEGER. This allows
+ * the use of arithmetic operators on the returned value if the
+ * field size is equal or smaller than an Integer.
+ *
+ * Note: Field.length is in bits.
+ */
+ Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
+ if (Length > AcpiGbl_IntegerByteWidth)
+ {
+ /* Field is too large for an Integer, create a Buffer instead */
+
+ BufferDesc = AcpiUtCreateBufferObject (Length);
+ if (!BufferDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ Buffer = BufferDesc->Buffer.Pointer;
+ }
+ else
+ {
+ /* Field will fit within an Integer (normal case) */
+
+ BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!BufferDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Length = AcpiGbl_IntegerByteWidth;
+ BufferDesc->Integer.Value = 0;
+ Buffer = &BufferDesc->Integer.Value;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Obj=%p Type=%X Buf=%p Len=%X\n",
+ ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n",
+ ObjDesc->CommonField.BitLength,
+ ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.BaseByteOffset));
+
+ /* Lock entire transaction if requested */
+
+ Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+
+ /* Read from the field */
+
+ Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length);
+ AcpiExReleaseGlobalLock (Locked);
+
+
+Exit:
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (BufferDesc);
+ }
+ else if (RetBufferDesc)
+ {
+ *RetBufferDesc = BufferDesc;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExWriteDataToField
+ *
+ * PARAMETERS: SourceDesc - Contains data to write
+ * ObjDesc - The named field
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Write to a named field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExWriteDataToField (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc)
+{
+ ACPI_STATUS Status;
+ UINT32 Length;
+ UINT32 RequiredLength;
+ void *Buffer;
+ void *NewBuffer;
+ BOOLEAN Locked;
+ ACPI_OPERAND_OBJECT *BufferDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
+
+
+ /* Parameter validation */
+
+ if (!SourceDesc || !ObjDesc)
+ {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+ {
+ /*
+ * If the BufferField arguments have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
+ {
+ Status = AcpiDsGetBufferFieldArguments (ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+ else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
+ (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
+ {
+ /*
+ * This is an SMBus write. We will bypass the entire field mechanism
+ * and handoff the buffer directly to the handler.
+ *
+ * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
+ */
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
+ {
+ ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE)
+ {
+ ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n",
+ ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length));
+ return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+ }
+
+ BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE);
+ if (!BufferDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Buffer = BufferDesc->Buffer.Pointer;
+ ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, ACPI_SMBUS_BUFFER_SIZE);
+
+ /* Lock entire transaction if requested */
+
+ Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+
+ /*
+ * Perform the write (returns status and perhaps data in the same buffer)
+ * Note: SMBus protocol type is passed in upper 16-bits of Function.
+ */
+ Status = AcpiExAccessRegion (ObjDesc, 0,
+ (ACPI_INTEGER *) Buffer,
+ ACPI_WRITE | (ObjDesc->Field.Attribute << 16));
+ AcpiExReleaseGlobalLock (Locked);
+
+ *ResultDesc = BufferDesc;
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Get a pointer to the data to be written
+ */
+ switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ Buffer = &SourceDesc->Integer.Value;
+ Length = sizeof (SourceDesc->Integer.Value);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Buffer = SourceDesc->Buffer.Pointer;
+ Length = SourceDesc->Buffer.Length;
+ break;
+
+ case ACPI_TYPE_STRING:
+ Buffer = SourceDesc->String.Pointer;
+ Length = SourceDesc->String.Length;
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * We must have a buffer that is at least as long as the field
+ * we are writing to. This is because individual fields are
+ * indivisible and partial writes are not supported -- as per
+ * the ACPI specification.
+ */
+ NewBuffer = NULL;
+ RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+
+ if (Length < RequiredLength)
+ {
+ /* We need to create a new buffer */
+
+ NewBuffer = ACPI_MEM_CALLOCATE (RequiredLength);
+ if (!NewBuffer)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Copy the original data to the new buffer, starting
+ * at Byte zero. All unused (upper) bytes of the
+ * buffer will be 0.
+ */
+ ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
+ Buffer = NewBuffer;
+ Length = RequiredLength;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Obj=%p Type=%X Buf=%p Len=%X\n",
+ ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, Length));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n",
+ ObjDesc->CommonField.BitLength,
+ ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.BaseByteOffset));
+
+ /* Lock entire transaction if requested */
+
+ Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+
+ /* Write to the field */
+
+ Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length);
+ AcpiExReleaseGlobalLock (Locked);
+
+ /* Free temporary buffer if we used one */
+
+ if (NewBuffer)
+ {
+ ACPI_MEM_FREE (NewBuffer);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c
new file mode 100644
index 0000000..1eda818
--- /dev/null
+++ b/sys/contrib/dev/acpica/exfldio.c
@@ -0,0 +1,1223 @@
+/******************************************************************************
+ *
+ * Module Name: exfldio - Aml Field I/O
+ * $Revision: 96 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXFLDIO_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acevents.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exfldio")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSetupRegion
+ *
+ * PARAMETERS: *ObjDesc - Field to be read or written
+ * FieldDatumByteOffset - Byte offset of this datum within the
+ * parent field
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common processing for AcpiExExtractFromField and
+ * AcpiExInsertIntoField. Initialize the
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSetupRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *RgnDesc;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
+
+
+ RgnDesc = ObjDesc->CommonField.RegionObj;
+
+ /* We must have a valid region */
+
+ if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
+ ACPI_GET_OBJECT_TYPE (RgnDesc),
+ AcpiUtGetObjectTypeName (RgnDesc)));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * If the Region Address and Length have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID))
+ {
+ Status = AcpiDsGetRegionArguments (RgnDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
+ {
+ /* SMBus has a non-linear address space */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Validate the request. The entire request from the byte offset for a
+ * length of one field datum (access width) must fit within the region.
+ * (Region length is specified in bytes)
+ */
+ if (RgnDesc->Region.Length < (ObjDesc->CommonField.BaseByteOffset
+ + FieldDatumByteOffset
+ + ObjDesc->CommonField.AccessByteWidth))
+ {
+ if (RgnDesc->Region.Length < ObjDesc->CommonField.AccessByteWidth)
+ {
+ /*
+ * This is the case where the AccessType (AccWord, etc.) is wider
+ * than the region itself. For example, a region of length one
+ * byte, and a field with Dword access specified.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+ ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.AccessByteWidth,
+ RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length));
+ }
+
+ /*
+ * Offset rounded up to next multiple of field width
+ * exceeds region length, indicate an error
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+ ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.BaseByteOffset,
+ FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
+ RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length));
+
+#ifndef ACPICA_PEDANTIC
+ {
+ /*
+ * Allow access to the field if it is within the region size
+ * rounded up to a multiple of the access byte width. This
+ * overcomes "off-by-one" programming errors in the AML often
+ * found in Toshiba laptops. These errors were allowed by
+ * the Microsoft ASL compiler.
+ */
+ UINT32 rounded_length = ACPI_ROUND_UP(RgnDesc->Region.Length,
+ ObjDesc->CommonField.AccessByteWidth);
+
+ if (rounded_length >= (ObjDesc->CommonField.BaseByteOffset +
+ FieldDatumByteOffset +
+ ObjDesc->CommonField.AccessByteWidth)) {
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+#endif
+ return_ACPI_STATUS (AE_AML_REGION_LIMIT);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAccessRegion
+ *
+ * PARAMETERS: *ObjDesc - Field to be read
+ * FieldDatumByteOffset - Byte offset of this datum within the
+ * parent field
+ * *Value - Where to store value (must at least
+ * the size of ACPI_INTEGER)
+ * Function - Read or Write flag plus other region-
+ * dependent flags
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read or Write a single field datum to an Operation Region.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAccessRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 Function)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *RgnDesc;
+ ACPI_PHYSICAL_ADDRESS Address;
+
+
+ ACPI_FUNCTION_TRACE ("ExAccessRegion");
+
+
+ /*
+ * Ensure that the region operands are fully evaluated and verify
+ * the validity of the request
+ */
+ Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The physical address of this field datum is:
+ *
+ * 1) The base of the region, plus
+ * 2) The base offset of the field, plus
+ * 3) The current offset into the field
+ */
+ RgnDesc = ObjDesc->CommonField.RegionObj;
+ Address = RgnDesc->Region.Address
+ + ObjDesc->CommonField.BaseByteOffset
+ + FieldDatumByteOffset;
+
+ if ((Function & ACPI_IO_MASK) == ACPI_READ)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
+ " Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n",
+ AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
+ RgnDesc->Region.SpaceId,
+ ObjDesc->CommonField.AccessByteWidth,
+ ObjDesc->CommonField.BaseByteOffset,
+ FieldDatumByteOffset,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
+
+ /* Invoke the appropriate AddressSpace/OpRegion handler */
+
+ Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function,
+ Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
+
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_IMPLEMENTED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Region %s(%X) not implemented\n",
+ AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
+ RgnDesc->Region.SpaceId));
+ }
+ else if (Status == AE_NOT_EXIST)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Region %s(%X) has no handler\n",
+ AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
+ RgnDesc->Region.SpaceId));
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExRegisterOverflow
+ *
+ * PARAMETERS: *ObjDesc - Register(Field) to be written
+ * Value - Value to be stored
+ *
+ * RETURN: TRUE if value overflows the field, FALSE otherwise
+ *
+ * DESCRIPTION: Check if a value is out of range of the field being written.
+ * Used to check if the values written to Index and Bank registers
+ * are out of range. Normally, the value is simply truncated
+ * to fit the field, but this case is most likely a serious
+ * coding error in the ASL.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiExRegisterOverflow (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_INTEGER Value)
+{
+
+ if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE)
+ {
+ /*
+ * The field is large enough to hold the maximum integer, so we can
+ * never overflow it.
+ */
+ return (FALSE);
+ }
+
+ if (Value >= ((ACPI_INTEGER) 1 << ObjDesc->CommonField.BitLength))
+ {
+ /*
+ * The Value is larger than the maximum value that can fit into
+ * the register.
+ */
+ return (TRUE);
+ }
+
+ /* The Value will fit into the field with no truncation */
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExFieldDatumIo
+ *
+ * PARAMETERS: *ObjDesc - Field to be read
+ * FieldDatumByteOffset - Byte offset of this datum within the
+ * parent field
+ * *Value - Where to store value (must be 64 bits)
+ * ReadWrite - Read or Write flag
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read or Write a single datum of a field. The FieldType is
+ * demultiplexed here to handle the different types of fields
+ * (BufferField, RegionField, IndexField, BankField)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExFieldDatumIo (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 ReadWrite)
+{
+ ACPI_STATUS Status;
+ ACPI_INTEGER LocalValue;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
+
+
+ if (ReadWrite == ACPI_READ)
+ {
+ if (!Value)
+ {
+ LocalValue = 0;
+ Value = &LocalValue; /* To support reads without saving return value */
+ }
+
+ /* Clear the entire return buffer first, [Very Important!] */
+
+ *Value = 0;
+ }
+
+ /*
+ * The four types of fields are:
+ *
+ * BufferFields - Read/write from/to a Buffer
+ * RegionFields - Read/write from/to a Operation Region.
+ * BankFields - Write to a Bank Register, then read/write from/to an OpRegion
+ * IndexFields - Write to an Index Register, then read/write from/to a Data Register
+ */
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ /*
+ * If the BufferField arguments have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
+ {
+ Status = AcpiDsGetBufferFieldArguments (ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ if (ReadWrite == ACPI_READ)
+ {
+ /*
+ * Copy the data from the source buffer.
+ * Length is the field width in bytes.
+ */
+ ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ + ObjDesc->BufferField.BaseByteOffset
+ + FieldDatumByteOffset,
+ ObjDesc->CommonField.AccessByteWidth);
+ }
+ else
+ {
+ /*
+ * Copy the data to the target buffer.
+ * Length is the field width in bytes.
+ */
+ ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ + ObjDesc->BufferField.BaseByteOffset
+ + FieldDatumByteOffset,
+ Value, ObjDesc->CommonField.AccessByteWidth);
+ }
+
+ Status = AE_OK;
+ break;
+
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+ /* Ensure that the BankValue is not beyond the capacity of the register */
+
+ if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
+ (ACPI_INTEGER) ObjDesc->BankField.Value))
+ {
+ return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+ }
+
+ /*
+ * For BankFields, we must write the BankValue to the BankRegister
+ * (itself a RegionField) before we can access the data.
+ */
+ Status = AcpiExInsertIntoField (ObjDesc->BankField.BankObj,
+ &ObjDesc->BankField.Value,
+ sizeof (ObjDesc->BankField.Value));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Now that the Bank has been selected, fall through to the
+ * RegionField case and write the datum to the Operation Region
+ */
+
+ /*lint -fallthrough */
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ /*
+ * For simple RegionFields, we just directly access the owning
+ * Operation Region.
+ */
+ Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value,
+ ReadWrite);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+
+ /* Ensure that the IndexValue is not beyond the capacity of the register */
+
+ if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
+ (ACPI_INTEGER) ObjDesc->IndexField.Value))
+ {
+ return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+ }
+
+ /* Write the index value to the IndexRegister (itself a RegionField) */
+
+ Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj,
+ &ObjDesc->IndexField.Value,
+ sizeof (ObjDesc->IndexField.Value));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (ReadWrite == ACPI_READ)
+ {
+ /* Read the datum from the DataRegister */
+
+ Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
+ Value, ObjDesc->CommonField.AccessByteWidth);
+ }
+ else
+ {
+ /* Write the datum to the Data register */
+
+ Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
+ Value, ObjDesc->CommonField.AccessByteWidth);
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n",
+ ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
+ Status = AE_AML_INTERNAL;
+ break;
+ }
+
+ if (ACPI_SUCCESS (Status))
+ {
+ if (ReadWrite == ACPI_READ)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
+ ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
+ ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExWriteWithUpdateRule
+ *
+ * PARAMETERS: *ObjDesc - Field to be set
+ * Value - Value to store
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Apply the field update rule to a field write
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExWriteWithUpdateRule (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_INTEGER Mask,
+ ACPI_INTEGER FieldValue,
+ UINT32 FieldDatumByteOffset)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_INTEGER MergedValue;
+ ACPI_INTEGER CurrentValue;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
+
+
+ /* Start with the new bits */
+
+ MergedValue = FieldValue;
+
+ /* If the mask is all ones, we don't need to worry about the update rule */
+
+ if (Mask != ACPI_INTEGER_MAX)
+ {
+ /* Decode the update rule */
+
+ switch (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)
+ {
+ case AML_FIELD_UPDATE_PRESERVE:
+ /*
+ * Check if update rule needs to be applied (not if mask is all
+ * ones) The left shift drops the bits we want to ignore.
+ */
+ if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) -
+ ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
+ {
+ /*
+ * Read the current contents of the byte/word/dword containing
+ * the field, and merge with the new field value.
+ */
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
+ &CurrentValue, ACPI_READ);
+ MergedValue |= (CurrentValue & ~Mask);
+ }
+ break;
+
+ case AML_FIELD_UPDATE_WRITE_AS_ONES:
+
+ /* Set positions outside the field to all ones */
+
+ MergedValue |= ~Mask;
+ break;
+
+ case AML_FIELD_UPDATE_WRITE_AS_ZEROS:
+
+ /* Set positions outside the field to all zeros */
+
+ MergedValue &= Mask;
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "WriteWithUpdateRule: Unknown UpdateRule setting: %X\n",
+ (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+ }
+
+ /* Write the merged value */
+
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
+ &MergedValue, ACPI_WRITE);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Mask %8.8X%8.8X DatumOffset %X Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
+ ACPI_HIDWORD (Mask), ACPI_LODWORD (Mask),
+ FieldDatumByteOffset,
+ ACPI_HIDWORD (FieldValue), ACPI_LODWORD (FieldValue),
+ ACPI_HIDWORD (MergedValue),ACPI_LODWORD (MergedValue)));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetBufferDatum
+ *
+ * PARAMETERS: Datum - Where the Datum is returned
+ * Buffer - Raw field buffer
+ * BufferLength - Entire length (used for big-endian only)
+ * ByteGranularity - 1/2/4/8 Granularity of the field
+ * (aka Datum Size)
+ * BufferOffset - Datum offset into the buffer
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Get a datum from the buffer according to the buffer field
+ * byte granularity
+ *
+ ******************************************************************************/
+
+void
+AcpiExGetBufferDatum (
+ ACPI_INTEGER *Datum,
+ void *Buffer,
+ UINT32 BufferLength,
+ UINT32 ByteGranularity,
+ UINT32 BufferOffset)
+{
+ UINT32 Index;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get proper index into buffer (handles big/little endian) */
+
+ Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
+
+ /* Move the requested number of bytes */
+
+ switch (ByteGranularity)
+ {
+ case ACPI_FIELD_BYTE_GRANULARITY:
+
+ *Datum = ((UINT8 *) Buffer) [Index];
+ break;
+
+ case ACPI_FIELD_WORD_GRANULARITY:
+
+ ACPI_MOVE_16_TO_64 (Datum, &(((UINT16 *) Buffer) [Index]));
+ break;
+
+ case ACPI_FIELD_DWORD_GRANULARITY:
+
+ ACPI_MOVE_32_TO_64 (Datum, &(((UINT32 *) Buffer) [Index]));
+ break;
+
+ case ACPI_FIELD_QWORD_GRANULARITY:
+
+ ACPI_MOVE_64_TO_64 (Datum, &(((UINT64 *) Buffer) [Index]));
+ break;
+
+ default:
+ /* Should not get here */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSetBufferDatum
+ *
+ * PARAMETERS: MergedDatum - Value to store
+ * Buffer - Receiving buffer
+ * BufferLength - Entire length (used for big-endian only)
+ * ByteGranularity - 1/2/4/8 Granularity of the field
+ * (aka Datum Size)
+ * BufferOffset - Datum offset into the buffer
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Store the merged datum to the buffer according to the
+ * byte granularity
+ *
+ ******************************************************************************/
+
+void
+AcpiExSetBufferDatum (
+ ACPI_INTEGER MergedDatum,
+ void *Buffer,
+ UINT32 BufferLength,
+ UINT32 ByteGranularity,
+ UINT32 BufferOffset)
+{
+ UINT32 Index;
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get proper index into buffer (handles big/little endian) */
+
+ Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
+
+ /* Move the requested number of bytes */
+
+ switch (ByteGranularity)
+ {
+ case ACPI_FIELD_BYTE_GRANULARITY:
+
+ ((UINT8 *) Buffer) [Index] = (UINT8) MergedDatum;
+ break;
+
+ case ACPI_FIELD_WORD_GRANULARITY:
+
+ ACPI_MOVE_64_TO_16 (&(((UINT16 *) Buffer)[Index]), &MergedDatum);
+ break;
+
+ case ACPI_FIELD_DWORD_GRANULARITY:
+
+ ACPI_MOVE_64_TO_32 (&(((UINT32 *) Buffer)[Index]), &MergedDatum);
+ break;
+
+ case ACPI_FIELD_QWORD_GRANULARITY:
+
+ ACPI_MOVE_64_TO_64 (&(((UINT64 *) Buffer)[Index]), &MergedDatum);
+ break;
+
+ default:
+ /* Should not get here */
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExExtractFromField
+ *
+ * PARAMETERS: *ObjDesc - Field to be read
+ * *Value - Where to store value
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieve the value of the given field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExExtractFromField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength)
+{
+ ACPI_STATUS Status;
+ UINT32 FieldDatumByteOffset;
+ UINT32 DatumOffset;
+ ACPI_INTEGER PreviousRawDatum;
+ ACPI_INTEGER ThisRawDatum = 0;
+ ACPI_INTEGER MergedDatum = 0;
+ UINT32 ByteFieldLength;
+ UINT32 DatumCount;
+
+
+ ACPI_FUNCTION_TRACE ("ExExtractFromField");
+
+
+ /*
+ * The field must fit within the caller's buffer
+ */
+ ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ if (ByteFieldLength > BufferLength)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Field size %X (bytes) too large for buffer (%X)\n",
+ ByteFieldLength, BufferLength));
+
+ return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ }
+
+ /* Convert field byte count to datum count, round up if necessary */
+
+ DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength,
+ ObjDesc->CommonField.AccessByteWidth);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "ByteLen=%X, DatumLen=%X, ByteGran=%X\n",
+ ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth));
+
+ /*
+ * Clear the caller's buffer (the whole buffer length as given)
+ * This is very important, especially in the cases where a byte is read,
+ * but the buffer is really a UINT32 (4 bytes).
+ */
+ ACPI_MEMSET (Buffer, 0, BufferLength);
+
+ /* Read the first raw datum to prime the loop */
+
+ FieldDatumByteOffset = 0;
+ DatumOffset= 0;
+
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
+ &PreviousRawDatum, ACPI_READ);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+
+ /* We might actually be done if the request fits in one datum */
+
+ if ((DatumCount == 1) &&
+ (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
+ {
+ /* 1) Shift the valid data bits down to start at bit 0 */
+
+ MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
+
+ /* 2) Mask off any upper unused bits (bits not part of the field) */
+
+ if (ObjDesc->CommonField.EndBufferValidBits)
+ {
+ MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
+ }
+
+ /* Store the datum to the caller buffer */
+
+ AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
+ ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+
+ /* We need to get more raw data to complete one or more field data */
+
+ while (DatumOffset < DatumCount)
+ {
+ FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth;
+
+ /*
+ * If the field is aligned on a byte boundary, we don't want
+ * to perform a final read, since this would potentially read
+ * past the end of the region.
+ *
+ * We could just split the aligned and non-aligned cases since the
+ * aligned case is so very simple, but this would require more code.
+ */
+ if ((ObjDesc->CommonField.StartFieldBitOffset != 0) ||
+ ((ObjDesc->CommonField.StartFieldBitOffset == 0) &&
+ (DatumOffset < (DatumCount -1))))
+ {
+ /*
+ * Get the next raw datum, it contains some or all bits
+ * of the current field datum
+ */
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
+ &ThisRawDatum, ACPI_READ);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Create the (possibly) merged datum to be stored to the caller buffer
+ */
+ if (ObjDesc->CommonField.StartFieldBitOffset == 0)
+ {
+ /* Field is not skewed and we can just copy the datum */
+
+ MergedDatum = PreviousRawDatum;
+ }
+ else
+ {
+ /*
+ * Put together the appropriate bits of the two raw data to make a
+ * single complete field datum
+ *
+ * 1) Normalize the first datum down to bit 0
+ */
+ MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
+
+ /* 2) Insert the second datum "above" the first datum */
+
+ MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits);
+
+ if ((DatumOffset >= (DatumCount -1)))
+ {
+ /*
+ * This is the last iteration of the loop. We need to clear
+ * any unused bits (bits that are not part of this field) that
+ * came from the last raw datum before we store the final
+ * merged datum into the caller buffer.
+ */
+ if (ObjDesc->CommonField.EndBufferValidBits)
+ {
+ MergedDatum &=
+ ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
+ }
+ }
+ }
+
+ /*
+ * Store the merged field datum in the caller's buffer, according to
+ * the granularity of the field (size of each datum).
+ */
+ AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
+ ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+
+ /*
+ * Save the raw datum that was just acquired since it may contain bits
+ * of the *next* field datum. Update offsets
+ */
+ PreviousRawDatum = ThisRawDatum;
+ DatumOffset++;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExInsertIntoField
+ *
+ * PARAMETERS: *ObjDesc - Field to be set
+ * Buffer - Value to store
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Store the value into the given field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExInsertIntoField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength)
+{
+ ACPI_STATUS Status;
+ UINT32 FieldDatumByteOffset;
+ UINT32 DatumOffset;
+ ACPI_INTEGER Mask;
+ ACPI_INTEGER MergedDatum;
+ ACPI_INTEGER PreviousRawDatum;
+ ACPI_INTEGER ThisRawDatum;
+ UINT32 ByteFieldLength;
+ UINT32 DatumCount;
+
+
+ ACPI_FUNCTION_TRACE ("ExInsertIntoField");
+
+
+ /*
+ * Incoming buffer must be at least as long as the field, we do not
+ * allow "partial" field writes. We do not care if the buffer is
+ * larger than the field, this typically happens when an integer is
+ * written to a field that is actually smaller than an integer.
+ */
+ ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ if (BufferLength < ByteFieldLength)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
+ BufferLength, ByteFieldLength));
+
+ return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ }
+
+ /* Convert byte count to datum count, round up if necessary */
+
+ DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "ByteLen=%X, DatumLen=%X, ByteGran=%X\n",
+ ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth));
+
+ /*
+ * Break the request into up to three parts (similar to an I/O request):
+ * 1) non-aligned part at start
+ * 2) aligned part in middle
+ * 3) non-aligned part at the end
+ */
+ FieldDatumByteOffset = 0;
+ DatumOffset= 0;
+
+ /* Get a single datum from the caller's buffer */
+
+ AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, BufferLength,
+ ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+
+ /*
+ * Part1:
+ * Write a partial field datum if field does not begin on a datum boundary
+ * Note: The code in this section also handles the aligned case
+ *
+ * Construct Mask with 1 bits where the field is, 0 bits elsewhere
+ * (Only the bottom 5 bits of BitLength are valid for a shift operation)
+ *
+ * Mask off bits that are "below" the field (if any)
+ */
+ Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
+
+ /* If the field fits in one datum, may need to mask upper bits */
+
+ if ((ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM) &&
+ ObjDesc->CommonField.EndFieldValidBits)
+ {
+ /* There are bits above the field, mask them off also */
+
+ Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ }
+
+ /* Shift and mask the value into the field position */
+
+ MergedDatum = (PreviousRawDatum << ObjDesc->CommonField.StartFieldBitOffset);
+ MergedDatum &= Mask;
+
+ /* Apply the update rule (if necessary) and write the datum to the field */
+
+ Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
+ FieldDatumByteOffset);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* If the entire field fits within one datum, we are done. */
+
+ if ((DatumCount == 1) &&
+ (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Part2:
+ * Write the aligned data.
+ *
+ * We don't need to worry about the update rule for these data, because
+ * all of the bits in each datum are part of the field.
+ *
+ * The last datum must be special cased because it might contain bits
+ * that are not part of the field -- therefore the "update rule" must be
+ * applied in Part3 below.
+ */
+ while (DatumOffset < DatumCount)
+ {
+ DatumOffset++;
+ FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth;
+
+ /*
+ * Get the next raw buffer datum. It may contain bits of the previous
+ * field datum
+ */
+ AcpiExGetBufferDatum (&ThisRawDatum, Buffer, BufferLength,
+ ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+
+ /* Create the field datum based on the field alignment */
+
+ if (ObjDesc->CommonField.StartFieldBitOffset != 0)
+ {
+ /*
+ * Put together appropriate bits of the two raw buffer data to make
+ * a single complete field datum
+ */
+ MergedDatum =
+ (PreviousRawDatum >> ObjDesc->CommonField.DatumValidBits) |
+ (ThisRawDatum << ObjDesc->CommonField.StartFieldBitOffset);
+ }
+ else
+ {
+ /* Field began aligned on datum boundary */
+
+ MergedDatum = ThisRawDatum;
+ }
+
+ /*
+ * Special handling for the last datum if the field does NOT end on
+ * a datum boundary. Update Rule must be applied to the bits outside
+ * the field.
+ */
+ if (DatumOffset == DatumCount)
+ {
+ /*
+ * If there are dangling non-aligned bits, perform one more merged write
+ * Else - field is aligned at the end, no need for any more writes
+ */
+ if (ObjDesc->CommonField.EndFieldValidBits)
+ {
+ /*
+ * Part3:
+ * This is the last datum and the field does not end on a datum boundary.
+ * Build the partial datum and write with the update rule.
+ *
+ * Mask off the unused bits above (after) the end-of-field
+ */
+ Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ MergedDatum &= Mask;
+
+ /* Write the last datum with the update rule */
+
+ Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
+ FieldDatumByteOffset);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+ else
+ {
+ /* Normal case -- write the completed datum */
+
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
+ &MergedDatum, ACPI_WRITE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Save the most recent datum since it may contain bits of the *next*
+ * field datum. Update current byte offset.
+ */
+ PreviousRawDatum = ThisRawDatum;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c
new file mode 100644
index 0000000..2479d2d
--- /dev/null
+++ b/sys/contrib/dev/acpica/exmisc.c
@@ -0,0 +1,620 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
+ * $Revision: 115 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXMISC_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetObjectReference
+ *
+ * PARAMETERS: ObjDesc - Create a reference to this object
+ * ReturnDesc - Where to store the reference
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Obtain and return a "reference" to the target object
+ * Common code for the RefOfOp and the CondRefOfOp.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExGetObjectReference (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **ReturnDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ReferenceObj;
+ ACPI_OPERAND_OBJECT *ReferencedObj;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
+
+
+ *ReturnDesc = NULL;
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * Must be a reference to a Local or Arg
+ */
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ /* The referenced object is the pseudo-node for the local/arg */
+
+ ReferencedObj = ObjDesc->Reference.Object;
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %X\n",
+ ObjDesc->Reference.Opcode));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+ break;
+
+
+ case ACPI_DESC_TYPE_NAMED:
+
+ /*
+ * A named reference that has already been resolved to a Node
+ */
+ ReferencedObj = ObjDesc;
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type %X in %p\n",
+ ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc));
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+
+ /* Create a new reference object */
+
+ ReferenceObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
+ if (!ReferenceObj)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ ReferenceObj->Reference.Opcode = AML_REF_OF_OP;
+ ReferenceObj->Reference.Object = ReferencedObj;
+ *ReturnDesc = ReferenceObj;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
+ ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExConcatTemplate
+ *
+ * PARAMETERS: *ObjDesc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConcatTemplate (
+ ACPI_OPERAND_OBJECT *ObjDesc1,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ReturnDesc;
+ UINT8 *NewBuf;
+ UINT8 *EndTag1;
+ UINT8 *EndTag2;
+ ACPI_SIZE Length1;
+ ACPI_SIZE Length2;
+
+
+ ACPI_FUNCTION_TRACE ("ExConcatTemplate");
+
+
+ /* Find the EndTags in each resource template */
+
+ EndTag1 = AcpiUtGetResourceEndTag (ObjDesc1);
+ EndTag2 = AcpiUtGetResourceEndTag (ObjDesc2);
+ if (!EndTag1 || !EndTag2)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Compute the length of each part */
+
+ Length1 = ACPI_PTR_DIFF (EndTag1, ObjDesc1->Buffer.Pointer);
+ Length2 = ACPI_PTR_DIFF (EndTag2, ObjDesc2->Buffer.Pointer) +
+ 2; /* Size of END_TAG */
+
+ /* Create a new buffer object for the result */
+
+ ReturnDesc = AcpiUtCreateBufferObject (Length1 + Length2);
+ if (!ReturnDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the templates to the new descriptor */
+
+ NewBuf = ReturnDesc->Buffer.Pointer;
+ ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
+ ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
+
+ /* Compute the new checksum */
+
+ NewBuf[ReturnDesc->Buffer.Length - 1] =
+ AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
+ (ReturnDesc->Buffer.Length - 1));
+
+ /* Return the completed template descriptor */
+
+ *ActualReturnDesc = ReturnDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoConcatenate
+ *
+ * PARAMETERS: ObjDesc1 - First source object
+ * ObjDesc2 - Second source object
+ * ActualReturnDesc - Where to place the return object
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDoConcatenate (
+ ACPI_OPERAND_OBJECT *ObjDesc1,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ ACPI_INTEGER ThisInteger;
+ ACPI_OPERAND_OBJECT *ReturnDesc;
+ char *NewBuf;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * There are three cases to handle:
+ *
+ * 1) Two Integers concatenated to produce a new Buffer
+ * 2) Two Strings concatenated to produce a new String
+ * 3) Two Buffers concatenated to produce a new Buffer
+ */
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc1))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Result of two Integers is a Buffer */
+ /* Need enough buffer space for two integers */
+
+ ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth * 2);
+ if (!ReturnDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ NewBuf = (char *) ReturnDesc->Buffer.Pointer;
+
+ /* Convert the first integer */
+
+ ThisInteger = ObjDesc1->Integer.Value;
+ for (i = 0; i < AcpiGbl_IntegerByteWidth; i++)
+ {
+ NewBuf[i] = (char) ThisInteger;
+ ThisInteger >>= 8;
+ }
+
+ /* Convert the second integer */
+
+ ThisInteger = ObjDesc2->Integer.Value;
+ for (; i < (ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); i++)
+ {
+ NewBuf[i] = (char) ThisInteger;
+ ThisInteger >>= 8;
+ }
+
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ /* Result of two Strings is a String */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
+ if (!ReturnDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Operand0 is string */
+
+ NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) ObjDesc1->String.Length +
+ (ACPI_SIZE) ObjDesc2->String.Length + 1);
+ if (!NewBuf)
+ {
+ ACPI_REPORT_ERROR
+ (("ExDoConcatenate: String allocation failure\n"));
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Concatenate the strings */
+
+ ACPI_STRCPY (NewBuf, ObjDesc1->String.Pointer);
+ ACPI_STRCPY (NewBuf + ObjDesc1->String.Length,
+ ObjDesc2->String.Pointer);
+
+ /* Complete the String object initialization */
+
+ ReturnDesc->String.Pointer = NewBuf;
+ ReturnDesc->String.Length = ObjDesc1->String.Length +
+ ObjDesc2->String.Length;
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ /* Result of two Buffers is a Buffer */
+
+ ReturnDesc = AcpiUtCreateBufferObject (
+ (ACPI_SIZE) ObjDesc1->Buffer.Length +
+ (ACPI_SIZE) ObjDesc2->Buffer.Length);
+ if (!ReturnDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ NewBuf = (char *) ReturnDesc->Buffer.Pointer;
+
+ /* Concatenate the buffers */
+
+ ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer,
+ ObjDesc1->Buffer.Length);
+ ACPI_MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer,
+ ObjDesc2->Buffer.Length);
+
+ break;
+
+
+ default:
+
+ /* Invalid object type, should not happen here */
+
+ Status = AE_AML_INTERNAL;
+ ReturnDesc = NULL;
+ }
+
+ *ActualReturnDesc = ReturnDesc;
+ return (AE_OK);
+
+
+Cleanup:
+
+ AcpiUtRemoveReference (ReturnDesc);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoMathOp
+ *
+ * PARAMETERS: Opcode - AML opcode
+ * Operand0 - Integer operand #0
+ * Operand1 - Integer operand #1
+ *
+ * RETURN: Integer result of the operation
+ *
+ * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the
+ * math functions here is to prevent a lot of pointer dereferencing
+ * to obtain the operands.
+ *
+ ******************************************************************************/
+
+ACPI_INTEGER
+AcpiExDoMathOp (
+ UINT16 Opcode,
+ ACPI_INTEGER Operand0,
+ ACPI_INTEGER Operand1)
+{
+
+
+ switch (Opcode)
+ {
+ case AML_ADD_OP: /* Add (Operand0, Operand1, Result) */
+
+ return (Operand0 + Operand1);
+
+
+ case AML_BIT_AND_OP: /* And (Operand0, Operand1, Result) */
+
+ return (Operand0 & Operand1);
+
+
+ case AML_BIT_NAND_OP: /* NAnd (Operand0, Operand1, Result) */
+
+ return (~(Operand0 & Operand1));
+
+
+ case AML_BIT_OR_OP: /* Or (Operand0, Operand1, Result) */
+
+ return (Operand0 | Operand1);
+
+
+ case AML_BIT_NOR_OP: /* NOr (Operand0, Operand1, Result) */
+
+ return (~(Operand0 | Operand1));
+
+
+ case AML_BIT_XOR_OP: /* XOr (Operand0, Operand1, Result) */
+
+ return (Operand0 ^ Operand1);
+
+
+ case AML_MULTIPLY_OP: /* Multiply (Operand0, Operand1, Result) */
+
+ return (Operand0 * Operand1);
+
+
+ case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result) */
+
+ return (Operand0 << Operand1);
+
+
+ case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
+
+ return (Operand0 >> Operand1);
+
+
+ case AML_SUBTRACT_OP: /* Subtract (Operand0, Operand1, Result) */
+
+ return (Operand0 - Operand1);
+
+ default:
+
+ return (0);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoLogicalOp
+ *
+ * PARAMETERS: Opcode - AML opcode
+ * Operand0 - Integer operand #0
+ * Operand1 - Integer operand #1
+ *
+ * RETURN: TRUE/FALSE result of the operation
+ *
+ * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the
+ * functions here is to prevent a lot of pointer dereferencing
+ * to obtain the operands and to simplify the generation of the
+ * logical value.
+ *
+ * Note: cleanest machine code seems to be produced by the code
+ * below, rather than using statements of the form:
+ * Result = (Operand0 == Operand1);
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiExDoLogicalOp (
+ UINT16 Opcode,
+ ACPI_INTEGER Operand0,
+ ACPI_INTEGER Operand1)
+{
+
+
+ switch (Opcode)
+ {
+
+ case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
+
+ if (Operand0 && Operand1)
+ {
+ return (TRUE);
+ }
+ break;
+
+
+ case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
+
+ if (Operand0 == Operand1)
+ {
+ return (TRUE);
+ }
+ break;
+
+
+ case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
+
+ if (Operand0 > Operand1)
+ {
+ return (TRUE);
+ }
+ break;
+
+
+ case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
+
+ if (Operand0 < Operand1)
+ {
+ return (TRUE);
+ }
+ break;
+
+
+ case AML_LOR_OP: /* LOr (Operand0, Operand1) */
+
+ if (Operand0 || Operand1)
+ {
+ return (TRUE);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (FALSE);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exmonad.c b/sys/contrib/dev/acpica/exmonad.c
new file mode 100644
index 0000000..3e6a969
--- /dev/null
+++ b/sys/contrib/dev/acpica/exmonad.c
@@ -0,0 +1,1083 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmonad - ACPI AML execution for monadic (1 operand) operators
+ * $Revision: 113 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXMONAD_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ MODULE_NAME ("exmonad")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetObjectReference
+ *
+ * PARAMETERS: ObjDesc - Create a reference to this object
+ * RetDesc - Where to store the reference
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Obtain and return a "reference" to the target object
+ * Common code for the RefOfOp and the CondRefOfOp.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiExGetObjectReference (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT **RetDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
+
+
+ if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
+ {
+ if (ObjDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
+ {
+ *RetDesc = NULL;
+ Status = AE_TYPE;
+ goto Cleanup;
+ }
+
+ /*
+ * Not a Name -- an indirect name pointer would have
+ * been converted to a direct name pointer in AcpiExResolveOperands
+ */
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ *RetDesc = (void *) AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode,
+ ObjDesc->Reference.Offset, WalkState);
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
+ ObjDesc->Reference.Opcode));
+ *RetDesc = NULL;
+ Status = AE_AML_INTERNAL;
+ goto Cleanup;
+ }
+
+ }
+
+ else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ {
+ /* Must be a named object; Just return the Node */
+
+ *RetDesc = ObjDesc;
+ }
+
+ else
+ {
+ *RetDesc = NULL;
+ Status = AE_TYPE;
+ }
+
+
+Cleanup:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", ObjDesc, *RetDesc));
+ return_ACPI_STATUS (Status);
+}
+
+#define ObjDesc Operand[0]
+#define ResDesc Operand[1]
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExMonadic1
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
+ * object stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExMonadic1 (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_STATUS Status;
+
+
+ FUNCTION_TRACE_PTR ("ExMonadic1", WALK_OPERANDS);
+
+
+ /* Examine the opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_RELEASE_OP: /* Release (MutexObject) */
+
+ Status = AcpiExReleaseMutex (ObjDesc, WalkState);
+ break;
+
+
+ case AML_RESET_OP: /* Reset (EventObject) */
+
+ Status = AcpiExSystemResetEvent (ObjDesc);
+ break;
+
+
+ case AML_SIGNAL_OP: /* Signal (EventObject) */
+
+ Status = AcpiExSystemSignalEvent (ObjDesc);
+ break;
+
+
+ case AML_SLEEP_OP: /* Sleep (MsecTime) */
+
+ AcpiExSystemDoSuspend ((UINT32) ObjDesc->Integer.Value);
+ break;
+
+
+ case AML_STALL_OP: /* Stall (UsecTime) */
+
+ AcpiExSystemDoStall ((UINT32) ObjDesc->Integer.Value);
+ break;
+
+
+ default: /* Unknown opcode */
+
+ REPORT_ERROR (("AcpiExMonadic1: Unknown monadic opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+
+ /* Always delete the operand */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExMonadic2R
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 2 monadic operator with numeric operand and
+ * result operand on operand stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExMonadic2R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *RetDesc = NULL;
+ ACPI_OPERAND_OBJECT *RetDesc2 = NULL;
+ UINT32 Temp32;
+ UINT32 i;
+ UINT32 j;
+ ACPI_INTEGER Digit;
+
+
+ FUNCTION_TRACE_PTR ("ExMonadic2R", WALK_OPERANDS);
+
+
+
+
+ /* Create a return object of type NUMBER for most opcodes */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_BIT_NOT_OP:
+ case AML_FIND_SET_LEFT_BIT_OP:
+ case AML_FIND_SET_RIGHT_BIT_OP:
+ case AML_FROM_BCD_OP:
+ case AML_TO_BCD_OP:
+ case AML_COND_REF_OF_OP:
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ break;
+ }
+
+
+ switch (WalkState->Opcode)
+ {
+
+ case AML_BIT_NOT_OP: /* Not (Operand, Result) */
+
+ RetDesc->Integer.Value = ~ObjDesc->Integer.Value;
+ break;
+
+
+ case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
+
+
+ RetDesc->Integer.Value = ObjDesc->Integer.Value;
+
+ /*
+ * Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (Temp32 = 0; RetDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
+ {
+ RetDesc->Integer.Value >>= 1;
+ }
+
+ RetDesc->Integer.Value = Temp32;
+ break;
+
+
+ case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
+
+
+ RetDesc->Integer.Value = ObjDesc->Integer.Value;
+
+ /*
+ * The Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (Temp32 = 0; RetDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
+ {
+ RetDesc->Integer.Value <<= 1;
+ }
+
+ /* Since returns must be 1-based, subtract from 33 (65) */
+
+ RetDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
+ break;
+
+
+ case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
+
+ /*
+ * The 64-bit ACPI integer can hold 16 4-bit BCD integers
+ */
+ RetDesc->Integer.Value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
+ {
+ /* Get one BCD digit */
+
+ Digit = (ACPI_INTEGER) ((ObjDesc->Integer.Value >> (i * 4)) & 0xF);
+
+ /* Check the range of the digit */
+
+ if (Digit > 9)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: \n",
+ Digit));
+ Status = AE_AML_NUMERIC_OVERFLOW;
+ goto Cleanup;
+ }
+
+ if (Digit > 0)
+ {
+ /* Sum into the result with the appropriate power of 10 */
+
+ for (j = 0; j < i; j++)
+ {
+ Digit *= 10;
+ }
+
+ RetDesc->Integer.Value += Digit;
+ }
+ }
+ break;
+
+
+ case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
+
+ if (ObjDesc->Integer.Value > ACPI_MAX_BCD_VALUE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %d\n",
+ ObjDesc->Integer.Value));
+ Status = AE_AML_NUMERIC_OVERFLOW;
+ goto Cleanup;
+ }
+
+ RetDesc->Integer.Value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
+ {
+ /* Divide by nth factor of 10 */
+
+ Temp32 = 0;
+ Digit = ObjDesc->Integer.Value;
+ for (j = 0; j < i; j++)
+ {
+ AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
+ }
+
+ /* Create the BCD digit from the remainder above */
+
+ if (Digit > 0)
+ {
+ RetDesc->Integer.Value += (Temp32 << (i * 4));
+ }
+ }
+ break;
+
+
+ case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
+
+ /*
+ * This op is a little strange because the internal return value is
+ * different than the return value stored in the result descriptor
+ * (There are really two return values)
+ */
+ if ((ACPI_NAMESPACE_NODE *) ObjDesc == AcpiGbl_RootNode)
+ {
+ /*
+ * This means that the object does not exist in the namespace,
+ * return FALSE
+ */
+ RetDesc->Integer.Value = 0;
+
+ /*
+ * Must delete the result descriptor since there is no reference
+ * being returned
+ */
+ AcpiUtRemoveReference (ResDesc);
+ goto Cleanup;
+ }
+
+ /* Get the object reference and store it */
+
+ Status = AcpiExGetObjectReference (ObjDesc, &RetDesc2, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiExStore (RetDesc2, ResDesc, WalkState);
+
+ /* The object exists in the namespace, return TRUE */
+
+ RetDesc->Integer.Value = ACPI_INTEGER_MAX;
+ goto Cleanup;
+ break;
+
+
+ case AML_STORE_OP: /* Store (Source, Target) */
+
+ /*
+ * A store operand is typically a number, string, buffer or lvalue
+ * Be careful about deleting the source object,
+ * since the object itself may have been stored.
+ */
+ Temp32 = ObjDesc->Common.ReferenceCount;
+ Status = AcpiExStore (ObjDesc, ResDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ /* On failure, just delete the ObjDesc */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+ }
+
+#if 0
+ if ((ObjDesc->Common.ReferenceCount > Temp32) &&
+ (!AcpiDsIsResultUsed (WalkState->Op, WalkState)))
+ {
+ ObjDesc->Common.ReferenceCount++;
+ }
+#endif
+
+ /*
+ * Normally, we would remove a reference on the ObjDesc parameter;
+ * But since it is being used as the internal return object
+ * (meaning we would normally increment it), the two cancel out,
+ * and we simply don't do anything.
+ */
+ WalkState->ResultObj = ObjDesc;
+ return_ACPI_STATUS (Status);
+ break;
+
+
+ /*
+ * ACPI 2.0 Opcodes
+ */
+ case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */
+
+ Status = AcpiExConvertToString (ObjDesc, &RetDesc, 10, ACPI_UINT32_MAX, WalkState);
+ break;
+
+
+ case AML_TO_HEXSTRING_OP: /* ToHexString (Data, Result) */
+
+ Status = AcpiExConvertToString (ObjDesc, &RetDesc, 16, ACPI_UINT32_MAX, WalkState);
+ break;
+
+
+ case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */
+
+ Status = AcpiExConvertToBuffer (ObjDesc, &RetDesc, WalkState);
+ break;
+
+
+ case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */
+
+ Status = AcpiExConvertToInteger (ObjDesc, &RetDesc, WalkState);
+ break;
+
+
+ /*
+ * These are two obsolete opcodes
+ */
+ case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
+ case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is unimplemented\n",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
+ Status = AE_SUPPORT;
+ goto Cleanup;
+ break;
+
+
+ default: /* Unknown opcode */
+
+ REPORT_ERROR (("AcpiExMonadic2R: Unknown monadic opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ /*
+ * Store the return value computed above into the result object
+ */
+ Status = AcpiExStore (RetDesc, ResDesc, WalkState);
+
+
+Cleanup:
+ /* Always delete the operand object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ /* Delete return object(s) on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ResDesc); /* Result descriptor */
+ if (RetDesc)
+ {
+ AcpiUtRemoveReference (RetDesc);
+ RetDesc = NULL;
+ }
+ }
+
+ /* Set the return object and exit */
+
+ WalkState->ResultObj = RetDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExMonadic2
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 2 monadic operator with numeric operand:
+ * DerefOfOp, RefOfOp, SizeOfOp, TypeOp, IncrementOp,
+ * DecrementOp, LNotOp,
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExMonadic2 (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *TmpDesc;
+ ACPI_OPERAND_OBJECT *RetDesc = NULL;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Type;
+ ACPI_INTEGER Value;
+
+
+ FUNCTION_TRACE_PTR ("ExMonadic2", WALK_OPERANDS);
+
+
+
+
+ /* Get the operand and decode the opcode */
+
+ switch (WalkState->Opcode)
+ {
+
+ case AML_LNOT_OP: /* LNot (Operand) */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ RetDesc->Integer.Value = !ObjDesc->Integer.Value;
+ break;
+
+
+ case AML_DECREMENT_OP: /* Decrement (Operand) */
+ case AML_INCREMENT_OP: /* Increment (Operand) */
+
+ /*
+ * Since we are expecting an Reference on the top of the stack, it
+ * can be either an Node or an internal object.
+ *
+ * TBD: [Future] This may be the prototype code for all cases where
+ * a Reference is expected!! 10/99
+ */
+ if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ {
+ RetDesc = ObjDesc;
+ }
+
+ else
+ {
+ /*
+ * Duplicate the Reference in a new object so that we can resolve it
+ * without destroying the original Reference object
+ */
+ RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ RetDesc->Reference.Opcode = ObjDesc->Reference.Opcode;
+ RetDesc->Reference.Offset = ObjDesc->Reference.Offset;
+ RetDesc->Reference.Object = ObjDesc->Reference.Object;
+ }
+
+
+ /*
+ * Convert the RetDesc Reference to a Number
+ * (This deletes the original RetDesc object)
+ */
+ Status = AcpiExResolveOperands (AML_LNOT_OP, &RetDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
+ AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException(Status)));
+
+ goto Cleanup;
+ }
+
+ /* Do the actual increment or decrement */
+
+ if (AML_INCREMENT_OP == WalkState->Opcode)
+ {
+ RetDesc->Integer.Value++;
+ }
+ else
+ {
+ RetDesc->Integer.Value--;
+ }
+
+ /* Store the result back in the original descriptor */
+
+ Status = AcpiExStore (RetDesc, ObjDesc, WalkState);
+
+ /* Objdesc was just deleted (because it is an Reference) */
+
+ ObjDesc = NULL;
+
+ break;
+
+
+ case AML_TYPE_OP: /* ObjectType (SourceObject) */
+
+ if (INTERNAL_TYPE_REFERENCE == ObjDesc->Common.Type)
+ {
+ /*
+ * Not a Name -- an indirect name pointer would have
+ * been converted to a direct name pointer in ResolveOperands
+ */
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_ZERO_OP:
+ case AML_ONE_OP:
+ case AML_ONES_OP:
+ case AML_REVISION_OP:
+
+ /* Constants are of type Number */
+
+ Type = ACPI_TYPE_INTEGER;
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ /* Per 1.0b spec, Debug object is of type "DebugObject" */
+
+ Type = ACPI_TYPE_DEBUG_OBJECT;
+ break;
+
+
+ case AML_INDEX_OP:
+
+ /* Get the type of this reference (index into another object) */
+
+ Type = ObjDesc->Reference.TargetType;
+ if (Type == ACPI_TYPE_PACKAGE)
+ {
+ /*
+ * The main object is a package, we want to get the type
+ * of the individual package element that is referenced by
+ * the index.
+ */
+ Type = (*(ObjDesc->Reference.Where))->Common.Type;
+ }
+
+ break;
+
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ Type = AcpiDsMethodDataGetType (ObjDesc->Reference.Opcode,
+ ObjDesc->Reference.Offset, WalkState);
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("AcpiExMonadic2/TypeOp: Internal error - Unknown Reference subtype %X\n",
+ ObjDesc->Reference.Opcode));
+ Status = AE_AML_INTERNAL;
+ goto Cleanup;
+ }
+ }
+
+ else
+ {
+ /*
+ * It's not a Reference, so it must be a direct name pointer.
+ */
+ Type = AcpiNsGetType ((ACPI_NAMESPACE_NODE *) ObjDesc);
+
+ /* Convert internal types to external types */
+
+ switch (Type)
+ {
+ case INTERNAL_TYPE_REGION_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
+
+ Type = ACPI_TYPE_FIELD_UNIT;
+ }
+
+ }
+
+ /* Allocate a descriptor to hold the type. */
+
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ RetDesc->Integer.Value = Type;
+ break;
+
+
+ case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
+
+ if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ {
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ }
+
+ if (!ObjDesc)
+ {
+ Value = 0;
+ }
+
+ else
+ {
+ switch (ObjDesc->Common.Type)
+ {
+
+ case ACPI_TYPE_BUFFER:
+
+ Value = ObjDesc->Buffer.Length;
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ Value = ObjDesc->String.Length;
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ Value = ObjDesc->Package.Count;
+ break;
+
+ case INTERNAL_TYPE_REFERENCE:
+
+ Value = 4;
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
+ ObjDesc->Common.Type));
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+
+ /*
+ * Now that we have the size of the object, create a result
+ * object to hold the value
+ */
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ RetDesc->Integer.Value = Value;
+ break;
+
+
+ case AML_REF_OF_OP: /* RefOf (SourceObject) */
+
+ Status = AcpiExGetObjectReference (ObjDesc, &RetDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ break;
+
+
+ case AML_DEREF_OF_OP: /* DerefOf (ObjReference) */
+
+ /* Check for a method local or argument */
+
+ if (!VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ {
+ /*
+ * Must resolve/dereference the local/arg reference first
+ */
+ switch (ObjDesc->Reference.Opcode)
+ {
+ /* Set ObjDesc to the value of the local/arg */
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode,
+ ObjDesc->Reference.Offset, WalkState, &TmpDesc);
+
+ /*
+ * Delete our reference to the input object and
+ * point to the object just retrieved
+ */
+ AcpiUtRemoveReference (ObjDesc);
+ ObjDesc = TmpDesc;
+ break;
+
+ default:
+
+ /* Index op - handled below */
+ break;
+ }
+ }
+
+
+ /* ObjDesc may have changed from the code above */
+
+ if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ {
+ /* Get the actual object from the Node (This is the dereference) */
+
+ RetDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object;
+
+ /* Returning a pointer to the object, add another reference! */
+
+ AcpiUtAddReference (RetDesc);
+ }
+
+ else
+ {
+ /*
+ * This must be a reference object produced by the Index
+ * ASL operation -- check internal opcode
+ */
+ if ((ObjDesc->Reference.Opcode != AML_INDEX_OP) &&
+ (ObjDesc->Reference.Opcode != AML_REF_OF_OP))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+ ObjDesc, ObjDesc->Reference.Opcode));
+
+ Status = AE_TYPE;
+ goto Cleanup;
+ }
+
+
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_INDEX_OP:
+
+ /*
+ * Supported target types for the Index operator are
+ * 1) A Buffer
+ * 2) A Package
+ */
+ if (ObjDesc->Reference.TargetType == ACPI_TYPE_BUFFER_FIELD)
+ {
+ /*
+ * The target is a buffer, we must create a new object that
+ * contains one element of the buffer, the element pointed
+ * to by the index.
+ *
+ * NOTE: index into a buffer is NOT a pointer to a
+ * sub-buffer of the main buffer, it is only a pointer to a
+ * single element (byte) of the buffer!
+ */
+ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!RetDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ TmpDesc = ObjDesc->Reference.Object;
+ RetDesc->Integer.Value =
+ TmpDesc->Buffer.Pointer[ObjDesc->Reference.Offset];
+
+ /* TBD: [Investigate] (see below) Don't add an additional
+ * ref!
+ */
+ }
+
+ else if (ObjDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
+ {
+ /*
+ * The target is a package, we want to return the referenced
+ * element of the package. We must add another reference to
+ * this object, however.
+ */
+ RetDesc = *(ObjDesc->Reference.Where);
+ if (!RetDesc)
+ {
+ /*
+ * We can't return a NULL dereferenced value. This is
+ * an uninitialized package element and is thus a
+ * severe error.
+ */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
+ ObjDesc));
+ Status = AE_AML_UNINITIALIZED_ELEMENT;
+ goto Cleanup;
+ }
+
+ AcpiUtAddReference (RetDesc);
+ }
+
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown TargetType %X in obj %p\n",
+ ObjDesc->Reference.TargetType, ObjDesc));
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ RetDesc = ObjDesc->Reference.Object;
+
+ /* Add another reference to the object! */
+
+ AcpiUtAddReference (RetDesc);
+ break;
+ }
+ }
+
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("AcpiExMonadic2: Unknown monadic opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+Cleanup:
+
+ if (ObjDesc)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status) &&
+ (RetDesc))
+ {
+ AcpiUtRemoveReference (RetDesc);
+ RetDesc = NULL;
+ }
+
+ WalkState->ResultObj = RetDesc;
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c
new file mode 100644
index 0000000..6b87cc5
--- /dev/null
+++ b/sys/contrib/dev/acpica/exmutex.c
@@ -0,0 +1,445 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmutex - ASL Mutex Acquire/Release functions
+ * $Revision: 18 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXMUTEX_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exmutex")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExUnlinkMutex
+ *
+ * PARAMETERS: *ObjDesc - The mutex to be unlinked
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
+ *
+ ******************************************************************************/
+
+void
+AcpiExUnlinkMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_THREAD_STATE *Thread = ObjDesc->Mutex.OwnerThread;
+
+
+ if (!Thread)
+ {
+ return;
+ }
+
+ if (ObjDesc->Mutex.Next)
+ {
+ (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev;
+ }
+
+ if (ObjDesc->Mutex.Prev)
+ {
+ (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
+ }
+ else
+ {
+ Thread->AcquiredMutexList = ObjDesc->Mutex.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExLinkMutex
+ *
+ * PARAMETERS: *ObjDesc - The mutex to be linked
+ * *ListHead - head of the "AcquiredMutex" list
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
+ *
+ ******************************************************************************/
+
+void
+AcpiExLinkMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_STATE *Thread)
+{
+ ACPI_OPERAND_OBJECT *ListHead;
+
+
+ ListHead = Thread->AcquiredMutexList;
+
+ /* This object will be the first object in the list */
+
+ ObjDesc->Mutex.Prev = NULL;
+ ObjDesc->Mutex.Next = ListHead;
+
+ /* Update old first object to point back to this object */
+
+ if (ListHead)
+ {
+ ListHead->Mutex.Prev = ObjDesc;
+ }
+
+ /* Update list head */
+
+ Thread->AcquiredMutexList = ObjDesc;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAcquireMutex
+ *
+ * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
+ * *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire an AML mutex
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAcquireMutex (
+ ACPI_OPERAND_OBJECT *TimeDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Sanity check -- we must have a valid thread ID */
+
+ if (!WalkState->Thread)
+ {
+ ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
+ ObjDesc->Mutex.Node->Name.Ascii));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /*
+ * Current Sync must be less than or equal to the sync level of the
+ * mutex. This mechanism provides some deadlock prevention
+ */
+ if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
+ {
+ ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect SyncLevel\n",
+ ObjDesc->Mutex.Node->Name.Ascii));
+ return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+ }
+
+ /*
+ * Support for multiple acquires by the owning thread
+ */
+
+ if ((ObjDesc->Mutex.OwnerThread) &&
+ (ObjDesc->Mutex.OwnerThread->ThreadId == WalkState->Thread->ThreadId))
+ {
+ /*
+ * The mutex is already owned by this thread,
+ * just increment the acquisition depth
+ */
+ ObjDesc->Mutex.AcquisitionDepth++;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Acquire the mutex, wait if necessary */
+
+ Status = AcpiExSystemAcquireMutex (TimeDesc, ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Includes failure from a timeout on TimeDesc */
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Have the mutex, update mutex and walk info */
+
+ ObjDesc->Mutex.OwnerThread = WalkState->Thread;
+ ObjDesc->Mutex.AcquisitionDepth = 1;
+
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+
+ /* Link the mutex to the current thread for force-unlock at method exit */
+
+ AcpiExLinkMutex (ObjDesc, WalkState->Thread);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReleaseMutex
+ *
+ * PARAMETERS: *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release a previously acquired Mutex.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExReleaseMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("ExReleaseMutex");
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* The mutex must have been previously acquired in order to release it */
+
+ if (!ObjDesc->Mutex.OwnerThread)
+ {
+ ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
+ ObjDesc->Mutex.Node->Name.Ascii));
+ return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
+ }
+
+ /* Sanity check -- we must have a valid thread ID */
+
+ if (!WalkState->Thread)
+ {
+ ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
+ ObjDesc->Mutex.Node->Name.Ascii));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /* The Mutex is owned, but this thread must be the owner */
+
+ if (ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId)
+ {
+ ACPI_REPORT_ERROR ((
+ "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
+ WalkState->Thread->ThreadId,
+ ObjDesc->Mutex.Node->Name.Ascii,
+ ObjDesc->Mutex.OwnerThread->ThreadId));
+ return_ACPI_STATUS (AE_AML_NOT_OWNER);
+ }
+
+ /*
+ * The sync level of the mutex must be less than or
+ * equal to the current sync level
+ */
+ if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
+ {
+ ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect SyncLevel\n",
+ ObjDesc->Mutex.Node->Name.Ascii));
+ return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+ }
+
+ /*
+ * Match multiple Acquires with multiple Releases
+ */
+ ObjDesc->Mutex.AcquisitionDepth--;
+ if (ObjDesc->Mutex.AcquisitionDepth != 0)
+ {
+ /* Just decrement the depth and return */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Unlink the mutex from the owner's list */
+
+ AcpiExUnlinkMutex (ObjDesc);
+
+ /* Release the mutex */
+
+ Status = AcpiExSystemReleaseMutex (ObjDesc);
+
+ /* Update the mutex and walk state */
+
+ ObjDesc->Mutex.OwnerThread = NULL;
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReleaseAllMutexes
+ *
+ * PARAMETERS: *MutexList - Head of the mutex list
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release all mutexes in the list
+ *
+ ******************************************************************************/
+
+void
+AcpiExReleaseAllMutexes (
+ ACPI_THREAD_STATE *Thread)
+{
+ ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList;
+ ACPI_OPERAND_OBJECT *This;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Traverse the list of owned mutexes, releasing each one.
+ */
+ while (Next)
+ {
+ This = Next;
+ Next = This->Mutex.Next;
+
+ This->Mutex.AcquisitionDepth = 1;
+ This->Mutex.Prev = NULL;
+ This->Mutex.Next = NULL;
+
+ /* Release the mutex */
+
+ Status = AcpiExSystemReleaseMutex (This);
+ if (ACPI_FAILURE (Status))
+ {
+ continue;
+ }
+
+ /* Mark mutex unowned */
+
+ This->Mutex.OwnerThread = NULL;
+ }
+}
+
+
diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c
new file mode 100644
index 0000000..7eb8e4f
--- /dev/null
+++ b/sys/contrib/dev/acpica/exnames.c
@@ -0,0 +1,531 @@
+
+/******************************************************************************
+ *
+ * Module Name: exnames - interpreter/scanner name load/execute
+ * $Revision: 94 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXNAMES_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exnames")
+
+
+/* AML Package Length encodings */
+
+#define ACPI_AML_PACKAGE_TYPE1 0x40
+#define ACPI_AML_PACKAGE_TYPE2 0x4000
+#define ACPI_AML_PACKAGE_TYPE3 0x400000
+#define ACPI_AML_PACKAGE_TYPE4 0x40000000
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAllocateNameString
+ *
+ * PARAMETERS: PrefixCount - Count of parent levels. Special cases:
+ * (-1) = root, 0 = none
+ * NumNameSegs - count of 4-character name segments
+ *
+ * RETURN: A pointer to the allocated string segment. This segment must
+ * be deleted by the caller.
+ *
+ * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
+ * string is long enough, and set up prefix if any.
+ *
+ ******************************************************************************/
+
+char *
+AcpiExAllocateNameString (
+ UINT32 PrefixCount,
+ UINT32 NumNameSegs)
+{
+ char *TempPtr;
+ char *NameString;
+ UINT32 SizeNeeded;
+
+ ACPI_FUNCTION_TRACE ("ExAllocateNameString");
+
+
+ /*
+ * Allow room for all \ and ^ prefixes, all segments, and a MultiNamePrefix.
+ * Also, one byte for the null terminator.
+ * This may actually be somewhat longer than needed.
+ */
+ if (PrefixCount == ACPI_UINT32_MAX)
+ {
+ /* Special case for root */
+
+ SizeNeeded = 1 + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
+ }
+ else
+ {
+ SizeNeeded = PrefixCount + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
+ }
+
+ /*
+ * Allocate a buffer for the name.
+ * This buffer must be deleted by the caller!
+ */
+ NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
+ if (!NameString)
+ {
+ ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
+ return_PTR (NULL);
+ }
+
+ TempPtr = NameString;
+
+ /* Set up Root or Parent prefixes if needed */
+
+ if (PrefixCount == ACPI_UINT32_MAX)
+ {
+ *TempPtr++ = AML_ROOT_PREFIX;
+ }
+ else
+ {
+ while (PrefixCount--)
+ {
+ *TempPtr++ = AML_PARENT_PREFIX;
+ }
+ }
+
+
+ /* Set up Dual or Multi prefixes if needed */
+
+ if (NumNameSegs > 2)
+ {
+ /* Set up multi prefixes */
+
+ *TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
+ *TempPtr++ = (char) NumNameSegs;
+ }
+ else if (2 == NumNameSegs)
+ {
+ /* Set up dual prefixes */
+
+ *TempPtr++ = AML_DUAL_NAME_PREFIX;
+ }
+
+ /*
+ * Terminate string following prefixes. AcpiExNameSegment() will
+ * append the segment(s)
+ */
+ *TempPtr = 0;
+
+ return_PTR (NameString);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExNameSegment
+ *
+ * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a name segment (4 bytes)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExNameSegment (
+ UINT8 **InAmlAddress,
+ char *NameString)
+{
+ char *AmlAddress = (void *) *InAmlAddress;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Index;
+ char CharBuf[5];
+
+
+ ACPI_FUNCTION_TRACE ("ExNameSegment");
+
+
+ /*
+ * If first character is a digit, then we know that we aren't looking at a
+ * valid name segment
+ */
+ CharBuf[0] = *AmlAddress;
+
+ if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
+ return_ACPI_STATUS (AE_CTRL_PENDING);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
+
+ for (Index = 0;
+ (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
+ Index++)
+ {
+ CharBuf[Index] = *AmlAddress++;
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[Index]));
+ }
+
+
+ /* Valid name segment */
+
+ if (Index == 4)
+ {
+ /* Found 4 valid characters */
+
+ CharBuf[4] = '\0';
+
+ if (NameString)
+ {
+ ACPI_STRCAT (NameString, CharBuf);
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Appended to - %s \n", NameString));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "No Name string - %s \n", CharBuf));
+ }
+ }
+ else if (Index == 0)
+ {
+ /*
+ * First character was not a valid name character,
+ * so we are looking at something other than a name.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Leading character is not alpha: %02Xh (not a name)\n",
+ CharBuf[0]));
+ Status = AE_CTRL_PENDING;
+ }
+ else
+ {
+ /* Segment started with one or more valid characters, but fewer than 4 */
+
+ Status = AE_AML_BAD_NAME;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
+ *AmlAddress, AmlAddress));
+ }
+
+ *InAmlAddress = (UINT8 *) AmlAddress;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetNameString
+ *
+ * PARAMETERS: DataType - Data type to be associated with this name
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get a name, including any prefixes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExGetNameString (
+ ACPI_OBJECT_TYPE DataType,
+ UINT8 *InAmlAddress,
+ char **OutNameString,
+ UINT32 *OutNameLength)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT8 *AmlAddress = InAmlAddress;
+ char *NameString = NULL;
+ UINT32 NumSegments;
+ UINT32 PrefixCount = 0;
+ BOOLEAN HasPrefix = FALSE;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
+
+
+ if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType ||
+ ACPI_TYPE_LOCAL_BANK_FIELD == DataType ||
+ ACPI_TYPE_LOCAL_INDEX_FIELD == DataType)
+ {
+ /* Disallow prefixes for types associated with FieldUnit names */
+
+ NameString = AcpiExAllocateNameString (0, 1);
+ if (!NameString)
+ {
+ Status = AE_NO_MEMORY;
+ }
+ else
+ {
+ Status = AcpiExNameSegment (&AmlAddress, NameString);
+ }
+ }
+ else
+ {
+ /*
+ * DataType is not a field name.
+ * Examine first character of name for root or parent prefix operators
+ */
+ switch (*AmlAddress)
+ {
+ case AML_ROOT_PREFIX:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
+
+ /*
+ * Remember that we have a RootPrefix --
+ * see comment in AcpiExAllocateNameString()
+ */
+ AmlAddress++;
+ PrefixCount = ACPI_UINT32_MAX;
+ HasPrefix = TRUE;
+ break;
+
+
+ case AML_PARENT_PREFIX:
+
+ /* Increment past possibly multiple parent prefixes */
+
+ do
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
+
+ AmlAddress++;
+ PrefixCount++;
+
+ } while (*AmlAddress == AML_PARENT_PREFIX);
+
+ HasPrefix = TRUE;
+ break;
+
+
+ default:
+
+ /* Not a prefix character */
+
+ break;
+ }
+
+
+ /* Examine first character of name for name segment prefix operator */
+
+ switch (*AmlAddress)
+ {
+ case AML_DUAL_NAME_PREFIX:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
+
+ AmlAddress++;
+ NameString = AcpiExAllocateNameString (PrefixCount, 2);
+ if (!NameString)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+
+ /* Indicate that we processed a prefix */
+
+ HasPrefix = TRUE;
+
+ Status = AcpiExNameSegment (&AmlAddress, NameString);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExNameSegment (&AmlAddress, NameString);
+ }
+ break;
+
+
+ case AML_MULTI_NAME_PREFIX_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
+
+ /* Fetch count of segments remaining in name path */
+
+ AmlAddress++;
+ NumSegments = *AmlAddress;
+
+ NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
+ if (!NameString)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+
+ /* Indicate that we processed a prefix */
+
+ AmlAddress++;
+ HasPrefix = TRUE;
+
+ while (NumSegments &&
+ (Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
+ {
+ NumSegments--;
+ }
+
+ break;
+
+
+ case 0:
+
+ /* NullName valid as of 8-12-98 ASL/AML Grammar Update */
+
+ if (PrefixCount == ACPI_UINT32_MAX)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
+ }
+
+ /* Consume the NULL byte */
+
+ AmlAddress++;
+ NameString = AcpiExAllocateNameString (PrefixCount, 0);
+ if (!NameString)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+
+ break;
+
+
+ default:
+
+ /* Name segment string */
+
+ NameString = AcpiExAllocateNameString (PrefixCount, 1);
+ if (!NameString)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+
+ Status = AcpiExNameSegment (&AmlAddress, NameString);
+ break;
+ }
+ }
+
+ if (AE_CTRL_PENDING == Status && HasPrefix)
+ {
+ /* Ran out of segments after processing a prefix */
+
+ ACPI_REPORT_ERROR (
+ ("ExDoName: Malformed Name at %p\n", NameString));
+ Status = AE_AML_BAD_NAME;
+ }
+
+ *OutNameString = NameString;
+ *OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c
new file mode 100644
index 0000000..46a149b
--- /dev/null
+++ b/sys/contrib/dev/acpica/exoparg1.c
@@ -0,0 +1,989 @@
+
+/******************************************************************************
+ *
+ * Module Name: exoparg1 - AML execution - opcodes with 1 argument
+ * $Revision: 148 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXOPARG1_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exoparg1")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_1A_0T_0R
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
+ * object stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_1A_0T_0R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Examine the AML opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_RELEASE_OP: /* Release (MutexObject) */
+
+ Status = AcpiExReleaseMutex (Operand[0], WalkState);
+ break;
+
+
+ case AML_RESET_OP: /* Reset (EventObject) */
+
+ Status = AcpiExSystemResetEvent (Operand[0]);
+ break;
+
+
+ case AML_SIGNAL_OP: /* Signal (EventObject) */
+
+ Status = AcpiExSystemSignalEvent (Operand[0]);
+ break;
+
+
+ case AML_SLEEP_OP: /* Sleep (MsecTime) */
+
+ Status = AcpiExSystemDoSuspend ((UINT32) Operand[0]->Integer.Value);
+ break;
+
+
+ case AML_STALL_OP: /* Stall (UsecTime) */
+
+ Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
+ break;
+
+
+ case AML_UNLOAD_OP: /* Unload (Handle) */
+
+ Status = AcpiExUnloadTable (Operand[0]);
+ break;
+
+
+ default: /* Unknown opcode */
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_1A_1T_0R
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, one target, and no
+ * return value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_1A_1T_0R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Examine the AML opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_LOAD_OP:
+
+ Status = AcpiExLoadOp (Operand[0], Operand[1], WalkState);
+ break;
+
+ default: /* Unknown opcode */
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+Cleanup:
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_1A_1T_1R
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, one target, and a
+ * return value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_1A_1T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
+ UINT32 Temp32;
+ UINT32 i;
+ UINT32 PowerOfTen;
+ ACPI_INTEGER Digit;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Examine the AML opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_BIT_NOT_OP:
+ case AML_FIND_SET_LEFT_BIT_OP:
+ case AML_FIND_SET_RIGHT_BIT_OP:
+ case AML_FROM_BCD_OP:
+ case AML_TO_BCD_OP:
+ case AML_COND_REF_OF_OP:
+
+ /* Create a return object of type Integer for these opcodes */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ switch (WalkState->Opcode)
+ {
+ case AML_BIT_NOT_OP: /* Not (Operand, Result) */
+
+ ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value;
+ break;
+
+
+ case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
+
+ ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
+
+ /*
+ * Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
+ {
+ ReturnDesc->Integer.Value >>= 1;
+ }
+
+ ReturnDesc->Integer.Value = Temp32;
+ break;
+
+
+ case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
+
+ ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
+
+ /*
+ * The Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
+ {
+ ReturnDesc->Integer.Value <<= 1;
+ }
+
+ /* Since the bit position is one-based, subtract from 33 (65) */
+
+ ReturnDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
+ break;
+
+
+ case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
+
+ /*
+ * The 64-bit ACPI integer can hold 16 4-bit BCD characters
+ * (if table is 32-bit, integer can hold 8 BCD characters)
+ * Convert each 4-bit BCD value
+ */
+ PowerOfTen = 1;
+ ReturnDesc->Integer.Value = 0;
+ Digit = Operand[0]->Integer.Value;
+
+ /* Convert each BCD digit (each is one nybble wide) */
+
+ for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
+ {
+ /* Get the least significant 4-bit BCD digit */
+
+ Temp32 = ((UINT32) Digit) & 0xF;
+
+ /* Check the range of the digit */
+
+ if (Temp32 > 9)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "BCD digit too large (not decimal): 0x%X\n",
+ Temp32));
+
+ Status = AE_AML_NUMERIC_OVERFLOW;
+ goto Cleanup;
+ }
+
+ /* Sum the digit into the result with the current power of 10 */
+
+ ReturnDesc->Integer.Value += (((ACPI_INTEGER) Temp32) * PowerOfTen);
+
+ /* Shift to next BCD digit */
+
+ Digit >>= 4;
+
+ /* Next power of 10 */
+
+ PowerOfTen *= 10;
+ }
+ break;
+
+
+ case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
+
+ ReturnDesc->Integer.Value = 0;
+ Digit = Operand[0]->Integer.Value;
+
+ /* Each BCD digit is one nybble wide */
+
+ for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
+ {
+ (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
+
+ /* Insert the BCD digit that resides in the remainder from above */
+
+ ReturnDesc->Integer.Value |= (((ACPI_INTEGER) Temp32) << (i * 4));
+ }
+
+ /* Overflow if there is any data left in Digit */
+
+ if (Digit > 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n",
+ ACPI_HIDWORD(Operand[0]->Integer.Value),
+ ACPI_LODWORD(Operand[0]->Integer.Value)));
+ Status = AE_AML_NUMERIC_OVERFLOW;
+ goto Cleanup;
+ }
+ break;
+
+
+ case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
+
+ /*
+ * This op is a little strange because the internal return value is
+ * different than the return value stored in the result descriptor
+ * (There are really two return values)
+ */
+ if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode)
+ {
+ /*
+ * This means that the object does not exist in the namespace,
+ * return FALSE
+ */
+ ReturnDesc->Integer.Value = 0;
+ goto Cleanup;
+ }
+
+ /* Get the object reference, store it, and remove our reference */
+
+ Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
+ AcpiUtRemoveReference (ReturnDesc2);
+
+ /* The object exists in the namespace, return TRUE */
+
+ ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
+ goto Cleanup;
+
+
+ default:
+ /* No other opcodes get here */
+ break;
+ }
+ break;
+
+
+ case AML_STORE_OP: /* Store (Source, Target) */
+
+ /*
+ * A store operand is typically a number, string, buffer or lvalue
+ * Be careful about deleting the source object,
+ * since the object itself may have been stored.
+ */
+ Status = AcpiExStore (Operand[0], Operand[1], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* It is possible that the Store already produced a return object */
+
+ if (!WalkState->ResultObj)
+ {
+ /*
+ * Normally, we would remove a reference on the Operand[0] parameter;
+ * But since it is being used as the internal return object
+ * (meaning we would normally increment it), the two cancel out,
+ * and we simply don't do anything.
+ */
+ WalkState->ResultObj = Operand[0];
+ WalkState->Operands[0] = NULL; /* Prevent deletion */
+ }
+ return_ACPI_STATUS (Status);
+
+
+ /*
+ * ACPI 2.0 Opcodes
+ */
+ case AML_COPY_OP: /* Copy (Source, Target) */
+
+ Status = AcpiUtCopyIobjectToIobject (Operand[0], &ReturnDesc, WalkState);
+ break;
+
+
+ case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */
+
+ Status = AcpiExConvertToString (Operand[0], &ReturnDesc, 10, ACPI_UINT32_MAX, WalkState);
+ break;
+
+
+ case AML_TO_HEXSTRING_OP: /* ToHexString (Data, Result) */
+
+ Status = AcpiExConvertToString (Operand[0], &ReturnDesc, 16, ACPI_UINT32_MAX, WalkState);
+ break;
+
+
+ case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */
+
+ Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc, WalkState);
+ break;
+
+
+ case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */
+
+ Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, WalkState);
+ break;
+
+
+ case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
+ case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
+
+ /*
+ * These are two obsolete opcodes
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
+ Status = AE_SUPPORT;
+ goto Cleanup;
+
+
+ default: /* Unknown opcode */
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+ /*
+ * Store the return value computed above into the target object
+ */
+ Status = AcpiExStore (ReturnDesc, Operand[1], WalkState);
+
+
+Cleanup:
+
+ if (!WalkState->ResultObj)
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_1A_0T_1R
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, no target, and a return value
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_1A_0T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *TempDesc;
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Type;
+ ACPI_INTEGER Value;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Examine the AML opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_LNOT_OP: /* LNot (Operand) */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Integer.Value = !Operand[0]->Integer.Value;
+ break;
+
+
+ case AML_DECREMENT_OP: /* Decrement (Operand) */
+ case AML_INCREMENT_OP: /* Increment (Operand) */
+
+ /*
+ * Since we are expecting a Reference operand, it
+ * can be either a NS Node or an internal object.
+ */
+ ReturnDesc = Operand[0];
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_OPERAND)
+ {
+ /* Internal reference object - prevent deletion */
+
+ AcpiUtAddReference (ReturnDesc);
+ }
+
+ /*
+ * Convert the ReturnDesc Reference to a Number
+ * (This removes a reference on the ReturnDesc object)
+ */
+ Status = AcpiExResolveOperands (AML_LNOT_OP, &ReturnDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
+ AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException(Status)));
+
+ goto Cleanup;
+ }
+
+ /*
+ * ReturnDesc is now guaranteed to be an Integer object
+ * Do the actual increment or decrement
+ */
+ if (AML_INCREMENT_OP == WalkState->Opcode)
+ {
+ ReturnDesc->Integer.Value++;
+ }
+ else
+ {
+ ReturnDesc->Integer.Value--;
+ }
+
+ /* Store the result back in the original descriptor */
+
+ Status = AcpiExStore (ReturnDesc, Operand[0], WalkState);
+ break;
+
+
+ case AML_TYPE_OP: /* ObjectType (SourceObject) */
+
+ /* Get the type of the base object */
+
+ Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Allocate a descriptor to hold the type. */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Integer.Value = Type;
+ break;
+
+
+ case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
+
+ /* Get the base object */
+
+ Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, &TempDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Type is guaranteed to be a buffer, string, or package at this
+ * point (even if the original operand was an object reference, it
+ * will be resolved and typechecked during operand resolution.)
+ */
+ switch (Type)
+ {
+ case ACPI_TYPE_BUFFER:
+ Value = TempDesc->Buffer.Length;
+ break;
+
+ case ACPI_TYPE_STRING:
+ Value = TempDesc->String.Length;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ Value = TempDesc->Package.Count;
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "SizeOf, Not Buf/Str/Pkg - found type %s\n",
+ AcpiUtGetTypeName (Type)));
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ /*
+ * Now that we have the size of the object, create a result
+ * object to hold the value
+ */
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Integer.Value = Value;
+ break;
+
+
+ case AML_REF_OF_OP: /* RefOf (SourceObject) */
+
+ Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ break;
+
+
+ case AML_DEREF_OF_OP: /* DerefOf (ObjReference | String) */
+
+ /* Check for a method local or argument, or standalone String */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
+ {
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ /*
+ * This is a DerefOf (LocalX | ArgX)
+ *
+ * Must resolve/dereference the local/arg reference first
+ */
+ switch (Operand[0]->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ /* Set Operand[0] to the value of the local/arg */
+
+ Status = AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
+ Operand[0]->Reference.Offset, WalkState, &TempDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Delete our reference to the input object and
+ * point to the object just retrieved
+ */
+ AcpiUtRemoveReference (Operand[0]);
+ Operand[0] = TempDesc;
+ break;
+
+ case AML_REF_OF_OP:
+
+ /* Get the object to which the reference refers */
+
+ TempDesc = Operand[0]->Reference.Object;
+ AcpiUtRemoveReference (Operand[0]);
+ Operand[0] = TempDesc;
+ break;
+
+ default:
+
+ /* Must be an Index op - handled below */
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * This is a DerefOf (String). The string is a reference to a named ACPI object.
+ *
+ * 1) Find the owning Node
+ * 2) Dereference the node to an actual object. Could be a Field, so we nee
+ * to resolve the node to a value.
+ */
+ Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer,
+ WalkState->ScopeInfo->Scope.Node, ACPI_NS_SEARCH_PARENT,
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc));
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiExResolveNodeToValue (
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc), WalkState);
+ goto Cleanup;
+
+
+ default:
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+
+ /* Operand[0] may have changed from the code above */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
+ {
+ /*
+ * This is a DerefOf (ObjectReference)
+ * Get the actual object from the Node (This is the dereference).
+ * -- This case may only happen when a LocalX or ArgX is dereferenced above.
+ */
+ ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
+ }
+ else
+ {
+ /*
+ * This must be a reference object produced by either the Index() or
+ * RefOf() operator
+ */
+ switch (Operand[0]->Reference.Opcode)
+ {
+ case AML_INDEX_OP:
+
+ /*
+ * The target type for the Index operator must be
+ * either a Buffer or a Package
+ */
+ switch (Operand[0]->Reference.TargetType)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ TempDesc = Operand[0]->Reference.Object;
+
+ /*
+ * Create a new object that contains one element of the
+ * buffer -- the element pointed to by the index.
+ *
+ * NOTE: index into a buffer is NOT a pointer to a
+ * sub-buffer of the main buffer, it is only a pointer to a
+ * single element (byte) of the buffer!
+ */
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Since we are returning the value of the buffer at the
+ * indexed location, we don't need to add an additional
+ * reference to the buffer itself.
+ */
+ ReturnDesc->Integer.Value =
+ TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ /*
+ * Return the referenced element of the package. We must add
+ * another reference to the referenced object, however.
+ */
+ ReturnDesc = *(Operand[0]->Reference.Where);
+ if (!ReturnDesc)
+ {
+ /*
+ * We can't return a NULL dereferenced value. This is
+ * an uninitialized package element and is thus a
+ * severe error.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
+ Operand[0]));
+ Status = AE_AML_UNINITIALIZED_ELEMENT;
+ goto Cleanup;
+ }
+
+ AcpiUtAddReference (ReturnDesc);
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index TargetType %X in obj %p\n",
+ Operand[0]->Reference.TargetType, Operand[0]));
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ ReturnDesc = Operand[0]->Reference.Object;
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+
+ ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ReturnDesc);
+ }
+
+ /* Add another reference to the object! */
+
+ AcpiUtAddReference (ReturnDesc);
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+ Operand[0], Operand[0]->Reference.Opcode));
+
+ Status = AE_TYPE;
+ goto Cleanup;
+ }
+ }
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+Cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ WalkState->ResultObj = ReturnDesc;
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c
new file mode 100644
index 0000000..624470a
--- /dev/null
+++ b/sys/contrib/dev/acpica/exoparg2.c
@@ -0,0 +1,716 @@
+/******************************************************************************
+ *
+ * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
+ * $Revision: 117 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXOPARG2_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acevents.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exoparg2")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_2A_0T_0R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with two arguments, no target, and no return
+ * value.
+ *
+ * ALLOCATION: Deletes both operands
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_2A_0T_0R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R",
+ AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Examine the opcode */
+
+ switch (WalkState->Opcode)
+ {
+ case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */
+
+ /* The first operand is a namespace node */
+
+ Node = (ACPI_NAMESPACE_NODE *) Operand[0];
+
+ /* Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type [%s]\n",
+ AcpiUtGetTypeName (Node->Type)));
+
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+
+ /*
+ * Dispatch the notify to the appropriate handler
+ * NOTE: the request is queued for execution after this method
+ * completes. The notify handlers are NOT invoked synchronously
+ * from this thread -- because handlers may in turn run other
+ * control methods.
+ */
+ Status = AcpiEvQueueNotifyRequest (Node,
+ (UINT32) Operand[1]->Integer.Value);
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_2A_2T_1R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets
+ * and one implicit return value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_2A_2T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc1 = NULL;
+ ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /*
+ * Execute the opcode
+ */
+ switch (WalkState->Opcode)
+ {
+ case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
+
+ ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc1)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc2)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */
+
+ Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value,
+ &ReturnDesc1->Integer.Value, &ReturnDesc2->Integer.Value);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ /* Store the results to the target reference operands */
+
+ Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Return the remainder */
+
+ WalkState->ResultObj = ReturnDesc1;
+
+
+Cleanup:
+ /*
+ * Since the remainder is not returned indirectly, remove a reference to
+ * it. Only the quotient is returned indirectly.
+ */
+ AcpiUtRemoveReference (ReturnDesc2);
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* Delete the return object */
+
+ AcpiUtRemoveReference (ReturnDesc1);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_2A_1T_1R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with two arguments, one target, and a return
+ * value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_2A_1T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ ACPI_OPERAND_OBJECT *TempDesc = NULL;
+ UINT32 Index;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_SIZE Length;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /*
+ * Execute the opcode
+ */
+ if (WalkState->OpInfo->Flags & AML_MATH)
+ {
+ /* All simple math opcodes (add, etc.) */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode,
+ Operand[0]->Integer.Value,
+ Operand[1]->Integer.Value);
+ goto StoreResultToTarget;
+ }
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* ReturnDesc will contain the remainder */
+
+ Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value,
+ NULL, &ReturnDesc->Integer.Value);
+ break;
+
+
+ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+
+ /*
+ * Convert the second operand if necessary. The first operand
+ * determines the type of the second operand, (See the Data Types
+ * section of the ACPI specification.) Both object types are
+ * guaranteed to be either Integer/String/Buffer by the operand
+ * resolution mechanism above.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+ {
+ case ACPI_TYPE_INTEGER:
+ Status = AcpiExConvertToInteger (Operand[1], &TempDesc, WalkState);
+ break;
+
+ case ACPI_TYPE_STRING:
+ Status = AcpiExConvertToString (Operand[1], &TempDesc, 16, ACPI_UINT32_MAX, WalkState);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Status = AcpiExConvertToBuffer (Operand[1], &TempDesc, WalkState);
+ break;
+
+ default:
+ Status = AE_AML_INTERNAL;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Both operands are now known to be the same object type
+ * (Both are Integer, String, or Buffer), and we can now perform the
+ * concatenation.
+ */
+ Status = AcpiExDoConcatenate (Operand[0], TempDesc, &ReturnDesc, WalkState);
+ if (TempDesc != Operand[1])
+ {
+ AcpiUtRemoveReference (TempDesc);
+ }
+ break;
+
+
+ case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
+
+ /*
+ * Input object is guaranteed to be a buffer at this point (it may have
+ * been converted.) Copy the raw buffer data to a new object of type String.
+ */
+
+ /* Get the length of the new string */
+
+ Length = 0;
+ if (Operand[1]->Integer.Value == 0)
+ {
+ /* Handle optional length value */
+
+ Operand[1]->Integer.Value = ACPI_INTEGER_MAX;
+ }
+
+ while ((Length < Operand[0]->Buffer.Length) &&
+ (Length < Operand[1]->Integer.Value) &&
+ (Operand[0]->Buffer.Pointer[Length]))
+ {
+ Length++;
+ }
+
+ if (Length > ACPI_MAX_STRING_CONVERSION)
+ {
+ Status = AE_AML_STRING_LIMIT;
+ goto Cleanup;
+ }
+
+ /* Create the internal return object */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Allocate a new string buffer (Length + 1 for null terminator) */
+
+ ReturnDesc->String.Pointer = ACPI_MEM_CALLOCATE (Length + 1);
+ if (!ReturnDesc->String.Pointer)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Copy the raw buffer data with no transform */
+
+ ACPI_MEMCPY (ReturnDesc->String.Pointer, Operand[0]->Buffer.Pointer, Length);
+
+ /* Set the string length */
+
+ ReturnDesc->String.Length = (UINT32) Length;
+ break;
+
+
+ case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
+
+ Status = AcpiExConcatTemplate (Operand[0], Operand[1], &ReturnDesc, WalkState);
+ break;
+
+
+ case AML_INDEX_OP: /* Index (Source Index Result) */
+
+ /* Create the internal return object */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Index = (UINT32) Operand[1]->Integer.Value;
+
+ /*
+ * At this point, the Source operand is either a Package or a Buffer
+ */
+ if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_PACKAGE)
+ {
+ /* Object to be indexed is a Package */
+
+ if (Index >= Operand[0]->Package.Count)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond package end (%X)\n",
+ Index, Operand[0]->Package.Count));
+ Status = AE_AML_PACKAGE_LIMIT;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
+ ReturnDesc->Reference.Object = Operand[0]->Package.Elements [Index];
+ ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
+ }
+ else
+ {
+ /* Object to be indexed is a Buffer */
+
+ if (Index >= Operand[0]->Buffer.Length)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond end of buffer (%X)\n",
+ Index, Operand[0]->Buffer.Length));
+ Status = AE_AML_BUFFER_LIMIT;
+ goto Cleanup;
+ }
+
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
+ ReturnDesc->Reference.Object = Operand[0];
+ }
+
+ /* Complete the Index reference object */
+
+ ReturnDesc->Reference.Opcode = AML_INDEX_OP;
+ ReturnDesc->Reference.Offset = Index;
+
+ /* Store the reference to the Target */
+
+ Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
+
+ /* Return the reference */
+
+ WalkState->ResultObj = ReturnDesc;
+ goto Cleanup;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+
+StoreResultToTarget:
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Store the result of the operation (which is now in ReturnDesc) into
+ * the Target descriptor.
+ */
+ Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ if (!WalkState->ResultObj)
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+ }
+
+
+Cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_2A_0T_1R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with 2 arguments, no target, and a return value
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_2A_0T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ ACPI_STATUS Status = AE_OK;
+ BOOLEAN LogicalResult = FALSE;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ /* Create the internal return object */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /*
+ * Execute the Opcode
+ */
+ if (WalkState->OpInfo->Flags & AML_LOGICAL) /* LogicalOp (Operand0, Operand1) */
+ {
+ LogicalResult = AcpiExDoLogicalOp (WalkState->Opcode,
+ Operand[0]->Integer.Value,
+ Operand[1]->Integer.Value);
+ goto StoreLogicalResult;
+ }
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
+
+ Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
+ if (Status == AE_TIME)
+ {
+ LogicalResult = TRUE; /* TRUE = Acquire timed out */
+ Status = AE_OK;
+ }
+ break;
+
+
+ case AML_WAIT_OP: /* Wait (EventObject, Timeout) */
+
+ Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
+ if (Status == AE_TIME)
+ {
+ LogicalResult = TRUE; /* TRUE, Wait timed out */
+ Status = AE_OK;
+ }
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+StoreLogicalResult:
+ /*
+ * Set return value to according to LogicalResult. logical TRUE (all ones)
+ * Default is FALSE (zero)
+ */
+ if (LogicalResult)
+ {
+ ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
+ }
+
+ WalkState->ResultObj = ReturnDesc;
+
+
+Cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c
new file mode 100644
index 0000000..1953ec2
--- /dev/null
+++ b/sys/contrib/dev/acpica/exoparg3.c
@@ -0,0 +1,337 @@
+
+/******************************************************************************
+ *
+ * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
+ * $Revision: 17 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXOPARG3_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exoparg3")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_3A_0T_0R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Triadic operator (3 operands)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_3A_0T_0R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_SIGNAL_FATAL_INFO *Fatal;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ switch (WalkState->Opcode)
+ {
+
+ case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+ (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value,
+ (UINT32) Operand[2]->Integer.Value));
+
+
+ Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
+ if (Fatal)
+ {
+ Fatal->Type = (UINT32) Operand[0]->Integer.Value;
+ Fatal->Code = (UINT32) Operand[1]->Integer.Value;
+ Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
+ }
+
+ /*
+ * Always signal the OS!
+ */
+ Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
+
+ /* Might return while OS is shutting down, just continue */
+
+ ACPI_MEM_FREE (Fatal);
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+Cleanup:
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_3A_1T_1R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Triadic operator (3 operands)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_3A_1T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ char *Buffer;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_NATIVE_UINT Index;
+ ACPI_SIZE Length;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
+
+ /*
+ * Create the return object. The Source operand is guaranteed to be
+ * either a String or a Buffer, so just use its type.
+ */
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (Operand[0]));
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Get the Integer values from the objects */
+
+ Index = (ACPI_NATIVE_UINT) Operand[1]->Integer.Value;
+ Length = (ACPI_SIZE) Operand[2]->Integer.Value;
+
+ /*
+ * If the index is beyond the length of the String/Buffer, or if the
+ * requested length is zero, return a zero-length String/Buffer
+ */
+ if ((Index < Operand[0]->String.Length) &&
+ (Length > 0))
+ {
+ /* Truncate request if larger than the actual String/Buffer */
+
+ if ((Index + Length) >
+ Operand[0]->String.Length)
+ {
+ Length = (ACPI_SIZE) Operand[0]->String.Length - Index;
+ }
+
+ /* Allocate a new buffer for the String/Buffer */
+
+ Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
+ if (!Buffer)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Copy the portion requested */
+
+ ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
+ Length);
+
+ /* Set the length of the new String/Buffer */
+
+ ReturnDesc->String.Pointer = Buffer;
+ ReturnDesc->String.Length = (UINT32) Length;
+ }
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+ /* Store the result in the target */
+
+ Status = AcpiExStore (ReturnDesc, Operand[3], WalkState);
+
+Cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ /* Set the return object and exit */
+
+ if (!WalkState->ResultObj)
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/exoparg6.c
new file mode 100644
index 0000000..5676835
--- /dev/null
+++ b/sys/contrib/dev/acpica/exoparg6.c
@@ -0,0 +1,377 @@
+
+/******************************************************************************
+ *
+ * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
+ * $Revision: 12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXOPARG6_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exoparg6")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoMatch
+ *
+ * PARAMETERS: MatchOp - The AML match operand
+ * PackageValue - Value from the target package
+ * MatchValue - Value to be matched
+ *
+ * RETURN: TRUE if the match is successful, FALSE otherwise
+ *
+ * DESCRIPTION: Implements the low-level match for the ASL Match operator
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiExDoMatch (
+ UINT32 MatchOp,
+ ACPI_INTEGER PackageValue,
+ ACPI_INTEGER MatchValue)
+{
+
+ switch (MatchOp)
+ {
+ case MATCH_MTR: /* always true */
+
+ break;
+
+
+ case MATCH_MEQ: /* true if equal */
+
+ if (PackageValue != MatchValue)
+ {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MLE: /* true if less than or equal */
+
+ if (PackageValue > MatchValue)
+ {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MLT: /* true if less than */
+
+ if (PackageValue >= MatchValue)
+ {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MGE: /* true if greater than or equal */
+
+ if (PackageValue < MatchValue)
+ {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MGT: /* true if greater than */
+
+ if (PackageValue <= MatchValue)
+ {
+ return (FALSE);
+ }
+ break;
+
+
+ default: /* undefined */
+
+ return (FALSE);
+ }
+
+
+ return TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExOpcode_6A_0T_1R
+ *
+ * PARAMETERS: WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExOpcode_6A_0T_1R (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Index;
+ ACPI_OPERAND_OBJECT *ThisElement;
+
+
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_6A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+
+
+ switch (WalkState->Opcode)
+ {
+ case AML_MATCH_OP:
+ /*
+ * Match (SearchPackage[0], MatchOp1[1], MatchObject1[2],
+ * MatchOp2[3], MatchObject2[4], StartIndex[5])
+ */
+
+ /* Validate match comparison sub-opcodes */
+
+ if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) ||
+ (Operand[3]->Integer.Value > MAX_MATCH_OPERATOR))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
+ Status = AE_AML_OPERAND_VALUE;
+ goto Cleanup;
+ }
+
+ Index = (UINT32) Operand[5]->Integer.Value;
+ if (Index >= (UINT32) Operand[0]->Package.Count)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n"));
+ Status = AE_AML_PACKAGE_LIMIT;
+ goto Cleanup;
+ }
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!ReturnDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+
+ }
+
+ /* Default return value if no match found */
+
+ ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
+
+ /*
+ * Examine each element until a match is found. Within the loop,
+ * "continue" signifies that the current element does not match
+ * and the next should be examined.
+ *
+ * Upon finding a match, the loop will terminate via "break" at
+ * the bottom. If it terminates "normally", MatchValue will be -1
+ * (its initial value) indicating that no match was found. When
+ * returned as a Number, this will produce the Ones value as specified.
+ */
+ for ( ; Index < Operand[0]->Package.Count; Index++)
+ {
+ ThisElement = Operand[0]->Package.Elements[Index];
+
+ /*
+ * Treat any NULL or non-numeric elements as non-matching.
+ */
+ if (!ThisElement ||
+ ACPI_GET_OBJECT_TYPE (ThisElement) != ACPI_TYPE_INTEGER)
+ {
+ continue;
+ }
+
+ /*
+ * "continue" (proceed to next iteration of enclosing
+ * "for" loop) signifies a non-match.
+ */
+ if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
+ ThisElement->Integer.Value, Operand[2]->Integer.Value))
+ {
+ continue;
+ }
+
+ if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
+ ThisElement->Integer.Value, Operand[4]->Integer.Value))
+ {
+ continue;
+ }
+
+ /* Match found: Index is the return value */
+
+ ReturnDesc->Integer.Value = Index;
+ break;
+ }
+
+ break;
+
+
+ case AML_LOAD_TABLE_OP:
+
+ Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ WalkState->Opcode));
+ Status = AE_AML_BAD_OPCODE;
+ goto Cleanup;
+ }
+
+
+ WalkState->ResultObj = ReturnDesc;
+
+
+Cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ReturnDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c
new file mode 100644
index 0000000..6071e0d
--- /dev/null
+++ b/sys/contrib/dev/acpica/exprep.c
@@ -0,0 +1,538 @@
+
+/******************************************************************************
+ *
+ * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
+ * $Revision: 122 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXPREP_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exprep")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDecodeFieldAccess
+ *
+ * PARAMETERS: Access - Encoded field access bits
+ * Length - Field length.
+ *
+ * RETURN: Field granularity (8, 16, 32 or 64) and
+ * ByteAlignment (1, 2, 3, or 4)
+ *
+ * DESCRIPTION: Decode the AccessType bits of a field definition.
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiExDecodeFieldAccess (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 FieldFlags,
+ UINT32 *ReturnByteAlignment)
+{
+ UINT32 Access;
+ UINT8 ByteAlignment;
+ UINT8 BitLength;
+/* UINT32 Length; */
+
+
+ ACPI_FUNCTION_NAME ("ExDecodeFieldAccess");
+
+
+ Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
+
+ switch (Access)
+ {
+ case AML_FIELD_ACCESS_ANY:
+
+ ByteAlignment = 1;
+ BitLength = 8;
+
+#if 0
+ /*
+ * TBD: optimize
+ *
+ * Any attempt to optimize the access size to the size of the field
+ * must take into consideration the length of the region and take
+ * care that an access to the field will not attempt to access
+ * beyond the end of the region.
+ */
+
+ /* Use the length to set the access type */
+
+ Length = ObjDesc->CommonField.BitLength;
+
+ if (Length <= 8)
+ {
+ BitLength = 8;
+ }
+ else if (Length <= 16)
+ {
+ BitLength = 16;
+ }
+ else if (Length <= 32)
+ {
+ BitLength = 32;
+ }
+ else if (Length <= 64)
+ {
+ BitLength = 64;
+ }
+ else
+ {
+ /* Larger than Qword - just use byte-size chunks */
+
+ BitLength = 8;
+ }
+#endif
+ break;
+
+ case AML_FIELD_ACCESS_BYTE:
+ case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
+ ByteAlignment = 1;
+ BitLength = 8;
+ break;
+
+ case AML_FIELD_ACCESS_WORD:
+ ByteAlignment = 2;
+ BitLength = 16;
+ break;
+
+ case AML_FIELD_ACCESS_DWORD:
+ ByteAlignment = 4;
+ BitLength = 32;
+ break;
+
+ case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
+ ByteAlignment = 8;
+ BitLength = 64;
+ break;
+
+ default:
+ /* Invalid field access type */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown field access type %X\n",
+ Access));
+ return (0);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+ {
+ /*
+ * BufferField access can be on any byte boundary, so the
+ * ByteAlignment is always 1 byte -- regardless of any ByteAlignment
+ * implied by the field access type.
+ */
+ ByteAlignment = 1;
+ }
+
+ *ReturnByteAlignment = ByteAlignment;
+ return (BitLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExPrepCommonFieldObject
+ *
+ * PARAMETERS: ObjDesc - The field object
+ * FieldFlags - Access, LockRule, and UpdateRule.
+ * The format of a FieldFlag is described
+ * in the ACPI specification
+ * FieldBitPosition - Field start position
+ * FieldBitLength - Field length in number of bits
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the areas of the field object that are common
+ * to the various types of fields. Note: This is very "sensitive"
+ * code because we are solving the general case for field
+ * alignment.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExPrepCommonFieldObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 FieldFlags,
+ UINT8 FieldAttribute,
+ UINT32 FieldBitPosition,
+ UINT32 FieldBitLength)
+{
+ UINT32 AccessBitWidth;
+ UINT32 ByteAlignment;
+ UINT32 NearestByteAddress;
+
+
+ ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject");
+
+
+ /*
+ * Note: the structure being initialized is the
+ * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
+ * area are initialized by this procedure.
+ */
+ ObjDesc->CommonField.FieldFlags = FieldFlags;
+ ObjDesc->CommonField.Attribute = FieldAttribute;
+ ObjDesc->CommonField.BitLength = FieldBitLength;
+
+ /*
+ * Decode the access type so we can compute offsets. The access type gives
+ * two pieces of information - the width of each field access and the
+ * necessary ByteAlignment (address granularity) of the access.
+ *
+ * For AnyAcc, the AccessBitWidth is the largest width that is both
+ * necessary and possible in an attempt to access the whole field in one
+ * I/O operation. However, for AnyAcc, the ByteAlignment is always one
+ * byte.
+ *
+ * For all Buffer Fields, the ByteAlignment is always one byte.
+ *
+ * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
+ * the same (equivalent) as the ByteAlignment.
+ */
+ AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
+ &ByteAlignment);
+ if (!AccessBitWidth)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+
+ /* Setup width (access granularity) fields */
+
+ ObjDesc->CommonField.AccessByteWidth = (UINT8)
+ ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
+
+ /*
+ * BaseByteOffset is the address of the start of the field within the
+ * region. It is the byte address of the first *datum* (field-width data
+ * unit) of the field. (i.e., the first datum that contains at least the
+ * first *bit* of the field.)
+ *
+ * Note: ByteAlignment is always either equal to the AccessBitWidth or 8
+ * (Byte access), and it defines the addressing granularity of the parent
+ * region or buffer.
+ */
+ NearestByteAddress =
+ ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
+ ObjDesc->CommonField.BaseByteOffset =
+ ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
+
+ /*
+ * StartFieldBitOffset is the offset of the first bit of the field within
+ * a field datum.
+ */
+ ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
+ (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
+
+ /*
+ * Valid bits -- the number of bits that compose a partial datum,
+ * 1) At the end of the field within the region (arbitrary starting bit
+ * offset)
+ * 2) At the end of a buffer used to contain the field (starting offset
+ * always zero)
+ */
+ ObjDesc->CommonField.EndFieldValidBits = (UINT8)
+ ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) %
+ AccessBitWidth);
+ /* StartBufferBitOffset always = 0 */
+
+ ObjDesc->CommonField.EndBufferValidBits = (UINT8)
+ (FieldBitLength % AccessBitWidth);
+
+ /*
+ * DatumValidBits is the number of valid field bits in the first
+ * field datum.
+ */
+ ObjDesc->CommonField.DatumValidBits = (UINT8)
+ (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
+
+ /*
+ * Does the entire field fit within a single field access element? (datum)
+ * (i.e., without crossing a datum boundary)
+ */
+ if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <=
+ (UINT16) AccessBitWidth)
+ {
+ ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExPrepFieldValue
+ *
+ * PARAMETERS: Node - Owning Node
+ * RegionNode - Region in which field is being defined
+ * FieldFlags - Access, LockRule, and UpdateRule.
+ * FieldBitPosition - Field start position
+ * FieldBitLength - Field length in number of bits
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and
+ * connect it to the parent Node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExPrepFieldValue (
+ ACPI_CREATE_FIELD_INFO *Info)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 Type;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("ExPrepFieldValue");
+
+
+ /* Parameter validation */
+
+ if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD)
+ {
+ if (!Info->RegionNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null RegionNode\n"));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ Type = AcpiNsGetType (Info->RegionNode);
+ if (Type != ACPI_TYPE_REGION)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed Region, found type %X %s\n",
+ Type, AcpiUtGetTypeName (Type)));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ }
+
+ /* Allocate a new field object */
+
+ ObjDesc = AcpiUtCreateInternalObject (Info->FieldType);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize areas of the object that are common to all fields */
+
+ ObjDesc->CommonField.Node = Info->FieldNode;
+ Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags,
+ Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteObjectDesc (ObjDesc);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Initialize areas of the object that are specific to the field type */
+
+ switch (Info->FieldType)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+
+ ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
+
+ /* An additional reference for the container */
+
+ AcpiUtAddReference (ObjDesc->Field.RegionObj);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n",
+ ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
+ ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
+ break;
+
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+ ObjDesc->BankField.Value = Info->BankValue;
+ ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
+ ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (Info->RegisterNode);
+
+ /* An additional reference for the attached objects */
+
+ AcpiUtAddReference (ObjDesc->BankField.RegionObj);
+ AcpiUtAddReference (ObjDesc->BankField.BankObj);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n",
+ ObjDesc->BankField.StartFieldBitOffset,
+ ObjDesc->BankField.BaseByteOffset,
+ ObjDesc->Field.AccessByteWidth,
+ ObjDesc->BankField.RegionObj,
+ ObjDesc->BankField.BankObj));
+ break;
+
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (Info->RegisterNode);
+ ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (Info->DataRegisterNode);
+ ObjDesc->IndexField.Value = (UINT32)
+ (Info->FieldBitPosition / ACPI_MUL_8 (ObjDesc->Field.AccessByteWidth));
+
+ if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n"));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /* An additional reference for the attached objects */
+
+ AcpiUtAddReference (ObjDesc->IndexField.DataObj);
+ AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "IndexField: bitoff=%X off=%X gran=%X Index %p Data %p\n",
+ ObjDesc->IndexField.StartFieldBitOffset,
+ ObjDesc->IndexField.BaseByteOffset,
+ ObjDesc->Field.AccessByteWidth,
+ ObjDesc->IndexField.IndexObj,
+ ObjDesc->IndexField.DataObj));
+ break;
+
+ default:
+ /* No other types should get here */
+ break;
+ }
+
+ /*
+ * Store the constructed descriptor (ObjDesc) into the parent Node,
+ * preserving the current type of that NamedObj.
+ */
+ Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
+ AcpiNsGetType (Info->FieldNode));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set NamedObj %p (%4.4s) val = %p\n",
+ Info->FieldNode, Info->FieldNode->Name.Ascii, ObjDesc));
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c
new file mode 100644
index 0000000..4136305
--- /dev/null
+++ b/sys/contrib/dev/acpica/exregion.c
@@ -0,0 +1,616 @@
+
+/******************************************************************************
+ *
+ * Module Name: exregion - ACPI default OpRegion (address space) handlers
+ * $Revision: 84 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __EXREGION_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exregion")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemMemorySpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the System Memory address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemMemorySpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ void *LogicalAddrPtr = NULL;
+ ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
+ UINT32 Length;
+ ACPI_SIZE WindowSize;
+#ifndef ACPI_MISALIGNED_TRANSFERS
+ UINT32 Remainder;
+#endif
+
+ ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
+
+
+ /* Validate and translate the bit width */
+
+ switch (BitWidth)
+ {
+ case 8:
+ Length = 1;
+ break;
+
+ case 16:
+ Length = 2;
+ break;
+
+ case 32:
+ Length = 4;
+ break;
+
+ case 64:
+ Length = 8;
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid SystemMemory width %d\n",
+ BitWidth));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+
+
+#ifndef ACPI_MISALIGNED_TRANSFERS
+ /*
+ * Hardware does not support non-aligned data transfers, we must verify
+ * the request.
+ */
+ (void) AcpiUtShortDivide ((ACPI_INTEGER *) &Address, Length, NULL, &Remainder);
+ if (Remainder != 0)
+ {
+ return_ACPI_STATUS (AE_AML_ALIGNMENT);
+ }
+#endif
+
+ /*
+ * Does the request fit into the cached memory mapping?
+ * Is 1) Address below the current mapping? OR
+ * 2) Address beyond the current mapping?
+ */
+ if ((Address < MemInfo->MappedPhysicalAddress) ||
+ (((ACPI_INTEGER) Address + Length) >
+ ((ACPI_INTEGER) MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
+ {
+ /*
+ * The request cannot be resolved by the current memory mapping;
+ * Delete the existing mapping and create a new one.
+ */
+ if (MemInfo->MappedLength)
+ {
+ /* Valid mapping, delete it */
+
+ AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
+ MemInfo->MappedLength);
+ }
+
+ /*
+ * Don't attempt to map memory beyond the end of the region, and
+ * constrain the maximum mapping size to something reasonable.
+ */
+ WindowSize = (ACPI_SIZE) ((MemInfo->Address + MemInfo->Length) - Address);
+ if (WindowSize > ACPI_SYSMEM_REGION_WINDOW_SIZE)
+ {
+ WindowSize = ACPI_SYSMEM_REGION_WINDOW_SIZE;
+ }
+
+ /* Create a new mapping starting at the address given */
+
+ Status = AcpiOsMapMemory (Address, WindowSize,
+ (void **) &MemInfo->MappedLogicalAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n",
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address), (UINT32) WindowSize));
+ MemInfo->MappedLength = 0;
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Save the physical address and mapping size */
+
+ MemInfo->MappedPhysicalAddress = Address;
+ MemInfo->MappedLength = WindowSize;
+ }
+
+ /*
+ * Generate a logical pointer corresponding to the address we want to
+ * access
+ */
+ LogicalAddrPtr = MemInfo->MappedLogicalAddress +
+ ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
+
+ /*
+ * Perform the memory read or write
+ *
+ * Note: For machines that do not support non-aligned transfers, the target
+ * address was checked for alignment above. We do not attempt to break the
+ * transfer up into smaller (byte-size) chunks because the AML specifically
+ * asked for a transfer width that the hardware may require.
+ */
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ *Value = 0;
+ switch (BitWidth)
+ {
+ case 8:
+ *Value = (ACPI_INTEGER) *((UINT8 *) LogicalAddrPtr);
+ break;
+
+ case 16:
+ *Value = (ACPI_INTEGER) *((UINT16 *) LogicalAddrPtr);
+ break;
+
+ case 32:
+ *Value = (ACPI_INTEGER) *((UINT32 *) LogicalAddrPtr);
+ break;
+
+#if ACPI_MACHINE_WIDTH != 16
+ case 64:
+ *Value = (ACPI_INTEGER) *((UINT64 *) LogicalAddrPtr);
+ break;
+#endif
+ default:
+ /* BitWidth was already validated */
+ break;
+ }
+ break;
+
+ case ACPI_WRITE:
+
+ switch (BitWidth)
+ {
+ case 8:
+ *(UINT8 *) LogicalAddrPtr = (UINT8) *Value;
+ break;
+
+ case 16:
+ *(UINT16 *) LogicalAddrPtr = (UINT16) *Value;
+ break;
+
+ case 32:
+ *(UINT32 *) LogicalAddrPtr = (UINT32) *Value;
+ break;
+
+#if ACPI_MACHINE_WIDTH != 16
+ case 64:
+ *(UINT64 *) LogicalAddrPtr = (UINT64) *Value;
+ break;
+#endif
+
+ default:
+ /* BitWidth was already validated */
+ break;
+ }
+ break;
+
+ default:
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemIoSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the System IO address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemIoSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Value32;
+
+
+ ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
+
+ /* Decode the function parameter */
+
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, &Value32, BitWidth);
+ *Value = Value32;
+ break;
+
+ case ACPI_WRITE:
+
+ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, (UINT32) *Value, BitWidth);
+ break;
+
+ default:
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExPciConfigSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the PCI Config address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExPciConfigSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PCI_ID *PciId;
+ UINT16 PciRegister;
+
+
+ ACPI_FUNCTION_TRACE ("ExPciConfigSpaceHandler");
+
+
+ /*
+ * The arguments to AcpiOs(Read|Write)PciConfiguration are:
+ *
+ * PciSegment is the PCI bus segment range 0-31
+ * PciBus is the PCI bus number range 0-255
+ * PciDevice is the PCI device number range 0-31
+ * PciFunction is the PCI device function number
+ * PciRegister is the Config space register range 0-255 bytes
+ *
+ * Value - input value for write, output address for read
+ *
+ */
+ PciId = (ACPI_PCI_ID *) RegionContext;
+ PciRegister = (UINT16) (UINT32) Address;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "PciConfig %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+ Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
+ PciId->Function, PciRegister));
+
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ *Value = 0;
+ Status = AcpiOsReadPciConfiguration (PciId, PciRegister, Value, BitWidth);
+ break;
+
+ case ACPI_WRITE:
+
+ Status = AcpiOsWritePciConfiguration (PciId, PciRegister, *Value, BitWidth);
+ break;
+
+ default:
+
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExCmosSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the CMOS address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExCmosSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExCmosSpaceHandler");
+
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExPciBarSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExPciBarSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExPciBarSpaceHandler");
+
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDataTableSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the Data Table address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDataTableSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 ByteWidth = ACPI_DIV_8 (BitWidth);
+ UINT32 i;
+ char *LogicalAddrPtr;
+
+
+ ACPI_FUNCTION_TRACE ("ExDataTableSpaceHandler");
+
+
+ LogicalAddrPtr = ACPI_PHYSADDR_TO_PTR (Address);
+
+
+ /* Perform the memory read or write */
+
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ for (i = 0; i < ByteWidth; i++)
+ {
+ ((char *) Value) [i] = LogicalAddrPtr[i];
+ }
+ break;
+
+ case ACPI_WRITE:
+ default:
+
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c
new file mode 100644
index 0000000..5e450dd
--- /dev/null
+++ b/sys/contrib/dev/acpica/exresnte.c
@@ -0,0 +1,356 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresnte - AML Interpreter object resolution
+ * $Revision: 62 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXRESNTE_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exresnte")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveNodeToValue
+ *
+ * PARAMETERS: ObjectPtr - Pointer to a location that contains
+ * a pointer to a NS node, and will receive a
+ * pointer to the resolved object.
+ * WalkState - Current state. Valid only if executing AML
+ * code. NULL if simply resolving an object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Resolve a Namespace node to a valued object
+ *
+ * Note: for some of the data types, the pointer attached to the Node
+ * can be either a pointer to an actual internal object or a pointer into the
+ * AML stream itself. These types are currently:
+ *
+ * ACPI_TYPE_INTEGER
+ * ACPI_TYPE_STRING
+ * ACPI_TYPE_BUFFER
+ * ACPI_TYPE_MUTEX
+ * ACPI_TYPE_PACKAGE
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveNodeToValue (
+ ACPI_NAMESPACE_NODE **ObjectPtr,
+ ACPI_WALK_STATE *WalkState)
+
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *SourceDesc;
+ ACPI_OPERAND_OBJECT *ObjDesc = NULL;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OBJECT_TYPE EntryType;
+
+
+ ACPI_FUNCTION_TRACE ("ExResolveNodeToValue");
+
+
+ /*
+ * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the
+ * object that is attached to the Node.
+ */
+ Node = *ObjectPtr;
+ SourceDesc = AcpiNsGetAttachedObject (Node);
+ EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
+ Node, SourceDesc, AcpiUtGetTypeName (EntryType)));
+
+ if (EntryType == ACPI_TYPE_LOCAL_ALIAS)
+ {
+ /* There is always exactly one level of indirection */
+
+ Node = (ACPI_NAMESPACE_NODE *) Node->Object;
+ SourceDesc = AcpiNsGetAttachedObject (Node);
+ EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
+ *ObjectPtr = Node;
+ }
+
+ /*
+ * Several object types require no further processing:
+ * 1) Devices rarely have an attached object, return the Node
+ * 2) Method locals and arguments have a pseudo-Node
+ */
+ if (EntryType == ACPI_TYPE_DEVICE ||
+ (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (!SourceDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
+ Node));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /*
+ * Action is based on the type of the Node, which indicates the type
+ * of the attached object or pointer
+ */
+ switch (EntryType)
+ {
+ case ACPI_TYPE_PACKAGE:
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ Status = AcpiDsGetPackageArguments (SourceDesc);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Return an additional reference to the object */
+
+ ObjDesc = SourceDesc;
+ AcpiUtAddReference (ObjDesc);
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ Status = AcpiDsGetBufferArguments (SourceDesc);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Return an additional reference to the object */
+
+ ObjDesc = SourceDesc;
+ AcpiUtAddReference (ObjDesc);
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Return an additional reference to the object */
+
+ ObjDesc = SourceDesc;
+ AcpiUtAddReference (ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Return an additional reference to the object */
+
+ ObjDesc = SourceDesc;
+ AcpiUtAddReference (ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead Node=%p SourceDesc=%p Type=%X\n",
+ Node, SourceDesc, EntryType));
+
+ Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
+ break;
+
+ /*
+ * For these objects, just return the object attached to the Node
+ */
+ case ACPI_TYPE_MUTEX:
+ case ACPI_TYPE_METHOD:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_EVENT:
+ case ACPI_TYPE_REGION:
+
+ /* Return an additional reference to the object */
+
+ ObjDesc = SourceDesc;
+ AcpiUtAddReference (ObjDesc);
+ break;
+
+
+ /* TYPE_ANY is untyped, and thus there is no object associated with it */
+
+ case ACPI_TYPE_ANY:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n",
+ Node));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ /* No named references are allowed here */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n",
+ SourceDesc->Reference.Opcode));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+
+
+ /* Default case is for unknown types */
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n",
+ Node, EntryType));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+
+ } /* switch (EntryType) */
+
+
+ /* Put the object descriptor on the stack */
+
+ *ObjectPtr = (void *) ObjDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c
new file mode 100644
index 0000000..fb673e0
--- /dev/null
+++ b/sys/contrib/dev/acpica/exresolv.c
@@ -0,0 +1,570 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresolv - AML Interpreter object resolution
+ * $Revision: 119 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXRESOLV_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exresolv")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveToValue
+ *
+ * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can
+ * be either an (ACPI_OPERAND_OBJECT *)
+ * or an ACPI_HANDLE.
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert Reference objects to values
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveToValue (
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
+
+
+ if (!StackPtr || !*StackPtr)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /*
+ * The entity pointed to by the StackPtr can be either
+ * 1) A valid ACPI_OPERAND_OBJECT, or
+ * 2) A ACPI_NAMESPACE_NODE (NamedObj)
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_OPERAND)
+ {
+ Status = AcpiExResolveObjectToValue (StackPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Object on the stack may have changed if AcpiExResolveObjectToValue()
+ * was called (i.e., we can't use an _else_ here.)
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED)
+ {
+ Status = AcpiExResolveNodeToValue (
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *StackPtr));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveObjectToValue
+ *
+ * PARAMETERS: StackPtr - Pointer to a stack location that contains a
+ * ptr to an internal object.
+ * WalkState - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieve the value from an internal object. The Reference type
+ * uses the associated AML opcode to determine the value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveObjectToValue (
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *StackDesc;
+ void *TempNode;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT16 Opcode;
+
+
+ ACPI_FUNCTION_TRACE ("ExResolveObjectToValue");
+
+
+ StackDesc = *StackPtr;
+
+ /* This is an ACPI_OPERAND_OBJECT */
+
+ switch (ACPI_GET_OBJECT_TYPE (StackDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ Opcode = StackDesc->Reference.Opcode;
+
+ switch (Opcode)
+ {
+ case AML_NAME_OP:
+
+ /*
+ * Convert indirect name ptr to a direct name ptr.
+ * Then, AcpiExResolveNodeToValue can be used to get the value
+ */
+ TempNode = StackDesc->Reference.Object;
+
+ /* Delete the Reference Object */
+
+ AcpiUtRemoveReference (StackDesc);
+
+ /* Put direct name pointer onto stack and exit */
+
+ (*StackPtr) = TempNode;
+ break;
+
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ /*
+ * Get the local from the method's state info
+ * Note: this increments the local's object reference count
+ */
+ Status = AcpiDsMethodDataGetValue (Opcode,
+ StackDesc->Reference.Offset, WalkState, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Now we can delete the original Reference Object and
+ * replace it with the resolve value
+ */
+ AcpiUtRemoveReference (StackDesc);
+ *StackPtr = ObjDesc;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %d] ValueObj is %p\n",
+ StackDesc->Reference.Offset, ObjDesc));
+ break;
+
+
+ case AML_INDEX_OP:
+
+ switch (StackDesc->Reference.TargetType)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /* Just return - leave the Reference on the stack */
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ ObjDesc = *StackDesc->Reference.Where;
+ if (ObjDesc)
+ {
+ /*
+ * Valid obj descriptor, copy pointer to return value
+ * (i.e., dereference the package index)
+ * Delete the ref object, increment the returned object
+ */
+ AcpiUtRemoveReference (StackDesc);
+ AcpiUtAddReference (ObjDesc);
+ *StackPtr = ObjDesc;
+ }
+ else
+ {
+ /*
+ * A NULL object descriptor means an unitialized element of
+ * the package, can't dereference it
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+ StackDesc));
+ Status = AE_AML_UNINITIALIZED_ELEMENT;
+ }
+ break;
+
+
+ default:
+
+ /* Invalid reference object */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown TargetType %X in Index/Reference obj %p\n",
+ StackDesc->Reference.TargetType, StackDesc));
+ Status = AE_AML_INTERNAL;
+ break;
+ }
+ break;
+
+
+ case AML_REF_OF_OP:
+ case AML_DEBUG_OP:
+
+ /* Just leave the object as-is */
+
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n",
+ Opcode, StackDesc));
+ Status = AE_AML_INTERNAL;
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ Status = AcpiDsGetBufferArguments (StackDesc);
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ Status = AcpiDsGetPackageArguments (StackDesc);
+ break;
+
+
+ /*
+ * These cases may never happen here, but just in case..
+ */
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
+ StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
+
+ Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
+ *StackPtr = (void *) ObjDesc;
+ break;
+
+ default:
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveMultiple
+ *
+ * PARAMETERS: WalkState - Current state (contains AML opcode)
+ * Operand - Starting point for resolution
+ * ReturnType - Where the object type is returned
+ * ReturnDesc - Where the resolved object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return the base object and type. Traverse a reference list if
+ * necessary to get to the base object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveMultiple (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *Operand,
+ ACPI_OBJECT_TYPE *ReturnType,
+ ACPI_OPERAND_OBJECT **ReturnDesc)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc = (void *) Operand;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OBJECT_TYPE Type;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple");
+
+
+ /*
+ * For reference objects created via the RefOf or Index operators,
+ * we need to get to the base object (as per the ACPI specification
+ * of the ObjectType and SizeOf operators). This means traversing
+ * the list of possibly many nested references.
+ */
+ while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_REF_OF_OP:
+
+ /* Dereference the reference pointer */
+
+ Node = ObjDesc->Reference.Object;
+
+ /* All "References" point to a NS node */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /* Get the attached object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* No object, use the NS node type */
+
+ Type = AcpiNsGetType (Node);
+ goto Exit;
+ }
+
+ /* Check for circular references */
+
+ if (ObjDesc == Operand)
+ {
+ return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+ }
+ break;
+
+
+ case AML_INDEX_OP:
+
+ /* Get the type of this reference (index into another object) */
+
+ Type = ObjDesc->Reference.TargetType;
+ if (Type != ACPI_TYPE_PACKAGE)
+ {
+ goto Exit;
+ }
+
+ /*
+ * The main object is a package, we want to get the type
+ * of the individual package element that is referenced by
+ * the index.
+ *
+ * This could of course in turn be another reference object.
+ */
+ ObjDesc = *(ObjDesc->Reference.Where);
+ break;
+
+
+ case AML_INT_NAMEPATH_OP:
+
+ /* Dereference the reference pointer */
+
+ Node = ObjDesc->Reference.Node;
+
+ /* All "References" point to a NS node */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /* Get the attached object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* No object, use the NS node type */
+
+ Type = AcpiNsGetType (Node);
+ goto Exit;
+ }
+
+ /* Check for circular references */
+
+ if (ObjDesc == Operand)
+ {
+ return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+ }
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ /* The Debug Object is of type "DebugObject" */
+
+ Type = ACPI_TYPE_DEBUG_OBJECT;
+ goto Exit;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Unknown Reference subtype %X\n",
+ ObjDesc->Reference.Opcode));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+ }
+
+ /*
+ * Now we are guaranteed to have an object that has not been created
+ * via the RefOf or Index operators.
+ */
+ Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+
+
+Exit:
+ /* Convert internal types to external types */
+
+ switch (Type)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ Type = ACPI_TYPE_FIELD_UNIT;
+ break;
+
+ case ACPI_TYPE_LOCAL_SCOPE:
+
+ /* Per ACPI Specification, Scope is untyped */
+
+ Type = ACPI_TYPE_ANY;
+ break;
+
+ default:
+ /* No change to Type required */
+ break;
+ }
+
+ *ReturnType = Type;
+ if (ReturnDesc)
+ {
+ *ReturnDesc = ObjDesc;
+ }
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c
new file mode 100644
index 0000000..2245d7e
--- /dev/null
+++ b/sys/contrib/dev/acpica/exresop.c
@@ -0,0 +1,720 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresop - AML Interpreter operand/object resolution
+ * $Revision: 62 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXRESOP_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exresop")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExCheckObjectType
+ *
+ * PARAMETERS: TypeNeeded Object type needed
+ * ThisType Actual object type
+ * Object Object pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check required type against actual type
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExCheckObjectType (
+ ACPI_OBJECT_TYPE TypeNeeded,
+ ACPI_OBJECT_TYPE ThisType,
+ void *Object)
+{
+ ACPI_FUNCTION_NAME ("ExCheckObjectType");
+
+
+ if (TypeNeeded == ACPI_TYPE_ANY)
+ {
+ /* All types OK, so we don't perform any typechecks */
+
+ return (AE_OK);
+ }
+
+ if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ /*
+ * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
+ * objects and thus allow them to be targets. (As per the ACPI
+ * specification, a store to a constant is a noop.)
+ */
+ if ((ThisType == ACPI_TYPE_INTEGER) &&
+ (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
+ {
+ return (AE_OK);
+ }
+ }
+
+ if (TypeNeeded != ThisType)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [%s], found [%s] %p\n",
+ AcpiUtGetTypeName (TypeNeeded),
+ AcpiUtGetTypeName (ThisType), Object));
+
+ return (AE_AML_OPERAND_TYPE);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveOperands
+ *
+ * PARAMETERS: Opcode - Opcode being interpreted
+ * StackPtr - Pointer to the operand stack to be
+ * resolved
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert multiple input operands to the types required by the
+ * target operator.
+ *
+ * Each 5-bit group in ArgTypes represents one required
+ * operand and indicates the required Type. The corresponding operand
+ * will be converted to the required type if possible, otherwise we
+ * abort with an exception.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveOperands (
+ UINT16 Opcode,
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status = AE_OK;
+ UINT8 ObjectType;
+ void *TempNode;
+ UINT32 ArgTypes;
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 ThisArgType;
+ ACPI_OBJECT_TYPE TypeNeeded;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+ if (OpInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+ }
+
+ ArgTypes = OpInfo->RuntimeArgs;
+ if (ArgTypes == ARGI_INVALID_OPCODE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n",
+ Opcode));
+
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] OperandTypes=%X \n",
+ Opcode, OpInfo->Name, ArgTypes));
+
+ /*
+ * Normal exit is with (ArgTypes == 0) at end of argument list.
+ * Function will return an exception from within the loop upon
+ * finding an entry which is not (or cannot be converted
+ * to) the required type; if stack underflows; or upon
+ * finding a NULL stack entry (which should not happen).
+ */
+ while (GET_CURRENT_ARG_TYPE (ArgTypes))
+ {
+ if (!StackPtr || !*StackPtr)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %p\n",
+ StackPtr));
+
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /* Extract useful items */
+
+ ObjDesc = *StackPtr;
+
+ /* Decode the descriptor type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+
+ /* Node */
+
+ ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
+ break;
+
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ /* ACPI internal object */
+
+ ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
+
+ /* Check for bad ACPI_OBJECT_TYPE */
+
+ if (!AcpiUtValidObjectType (ObjectType))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
+ ObjectType));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ /*
+ * Decode the Reference
+ */
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+ if (OpInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+ }
+
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_DEBUG_OP:
+ case AML_NAME_OP:
+ case AML_INDEX_OP:
+ case AML_REF_OF_OP:
+ case AML_ARG_OP:
+ case AML_LOCAL_OP:
+
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Reference Opcode: %s\n", OpInfo->Name)));
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown Reference Opcode %X\n",
+ ObjDesc->Reference.Opcode));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ }
+ break;
+
+
+ default:
+
+ /* Invalid descriptor */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Bad descriptor type %X in Obj %p\n",
+ ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+
+ /*
+ * Get one argument type, point to the next
+ */
+ ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
+ INCREMENT_ARG_LIST (ArgTypes);
+
+ /*
+ * Handle cases where the object does not need to be
+ * resolved to a value
+ */
+ switch (ThisArgType)
+ {
+ case ARGI_REF_OR_STRING: /* Can be a String or Reference */
+
+ if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
+ {
+ /*
+ * String found - the string references a named object and must be
+ * resolved to a node
+ */
+ goto NextOperand;
+ }
+
+ /* Else not a string - fall through to the normal Reference case below */
+ /*lint -fallthrough */
+
+ case ARGI_REFERENCE: /* References: */
+ case ARGI_INTEGER_REF:
+ case ARGI_OBJECT_REF:
+ case ARGI_DEVICE_REF:
+ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
+ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
+ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
+
+ /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
+ {
+ goto NextOperand;
+ }
+
+ Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
+ ObjectType, ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (AML_NAME_OP == ObjDesc->Reference.Opcode)
+ {
+ /*
+ * Convert an indirect name ptr to direct name ptr and put
+ * it on the stack
+ */
+ TempNode = ObjDesc->Reference.Object;
+ AcpiUtRemoveReference (ObjDesc);
+ (*StackPtr) = TempNode;
+ }
+ goto NextOperand;
+
+
+ case ARGI_ANYTYPE:
+
+ /*
+ * We don't want to resolve IndexOp reference objects during
+ * a store because this would be an implicit DeRefOf operation.
+ * Instead, we just want to store the reference object.
+ * -- All others must be resolved below.
+ */
+ if ((Opcode == AML_STORE_OP) &&
+ (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
+ ((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
+ {
+ goto NextOperand;
+ }
+ break;
+
+ default:
+ /* All cases covered above */
+ break;
+ }
+
+
+ /*
+ * Resolve this object to a value
+ */
+ Status = AcpiExResolveToValue (StackPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the resolved object */
+
+ ObjDesc = *StackPtr;
+
+ /*
+ * Check the resulting object (value) type
+ */
+ switch (ThisArgType)
+ {
+ /*
+ * For the simple cases, only one type of resolved object
+ * is allowed
+ */
+ case ARGI_MUTEX:
+
+ /* Need an operand of type ACPI_TYPE_MUTEX */
+
+ TypeNeeded = ACPI_TYPE_MUTEX;
+ break;
+
+ case ARGI_EVENT:
+
+ /* Need an operand of type ACPI_TYPE_EVENT */
+
+ TypeNeeded = ACPI_TYPE_EVENT;
+ break;
+
+ case ARGI_PACKAGE: /* Package */
+
+ /* Need an operand of type ACPI_TYPE_PACKAGE */
+
+ TypeNeeded = ACPI_TYPE_PACKAGE;
+ break;
+
+ case ARGI_ANYTYPE:
+
+ /* Any operand type will do */
+
+ TypeNeeded = ACPI_TYPE_ANY;
+ break;
+
+
+ /*
+ * The more complex cases allow multiple resolved object types
+ */
+ case ARGI_INTEGER: /* Number */
+
+ /*
+ * Need an operand of type ACPI_TYPE_INTEGER,
+ * But we can implicitly convert from a STRING or BUFFER
+ * Aka - "Implicit Source Operand Conversion"
+ */
+ Status = AcpiExConvertToInteger (ObjDesc, StackPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_TYPE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Integer/String/Buffer], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+ goto NextOperand;
+
+
+ case ARGI_BUFFER:
+
+ /*
+ * Need an operand of type ACPI_TYPE_BUFFER,
+ * But we can implicitly convert from a STRING or INTEGER
+ * Aka - "Implicit Source Operand Conversion"
+ */
+ Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_TYPE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Integer/String/Buffer], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+ goto NextOperand;
+
+
+ case ARGI_STRING:
+
+ /*
+ * Need an operand of type ACPI_TYPE_STRING,
+ * But we can implicitly convert from a BUFFER or INTEGER
+ * Aka - "Implicit Source Operand Conversion"
+ */
+ Status = AcpiExConvertToString (ObjDesc, StackPtr, 16, ACPI_UINT32_MAX, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_TYPE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Integer/String/Buffer], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+ goto NextOperand;
+
+
+ case ARGI_COMPUTEDATA:
+
+ /* Need an operand of type INTEGER, STRING or BUFFER */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Integer/String/Buffer], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ case ARGI_BUFFER_OR_STRING:
+
+ /* Need an operand of type STRING or BUFFER */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ case ACPI_TYPE_INTEGER:
+
+ /* Highest priority conversion is to type Buffer */
+
+ Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Integer/String/Buffer], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ case ARGI_DATAOBJECT:
+ /*
+ * ARGI_DATAOBJECT is only used by the SizeOf operator.
+ * Need a buffer, string, package, or RefOf reference.
+ *
+ * The only reference allowed here is a direct reference to
+ * a namespace node.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ case ARGI_COMPLEXOBJ:
+
+ /* Need a buffer or package or (ACPI 2.0) String */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buffer/String/Package], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ case ARGI_REGION_OR_FIELD:
+
+ /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_REGION:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Region/RegionField], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ default:
+
+ /* Unknown type */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Internal - Unknown ARGI (required operand) type %X\n",
+ ThisArgType));
+
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Make sure that the original object was resolved to the
+ * required object type (Simple cases only).
+ */
+ Status = AcpiExCheckObjectType (TypeNeeded,
+ ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+NextOperand:
+ /*
+ * If more operands needed, decrement StackPtr to point
+ * to next operand on stack
+ */
+ if (GET_CURRENT_ARG_TYPE (ArgTypes))
+ {
+ StackPtr--;
+ }
+
+ } /* while (*Types) */
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c
new file mode 100644
index 0000000..b43b47c
--- /dev/null
+++ b/sys/contrib/dev/acpica/exstore.c
@@ -0,0 +1,600 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstore - AML Interpreter object store support
+ * $Revision: 176 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXSTORE_C__
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exstore")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStore
+ *
+ * PARAMETERS: *SourceDesc - Value to be stored
+ * *DestDesc - Where to store it. Must be an NS node
+ * or an ACPI_OPERAND_OBJECT of type
+ * Reference;
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Store the value described by SourceDesc into the location
+ * described by DestDesc. Called by various interpreter
+ * functions to store the result of an operation into
+ * the destination operand -- not just simply the actual "Store"
+ * ASL operator.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStore (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExStore", DestDesc);
+
+
+ /* Validate parameters */
+
+ if (!SourceDesc || !DestDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /* DestDesc can be either a namespace node or an ACPI object */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+ /*
+ * Dest is a namespace node,
+ * Storing an object into a Named node.
+ */
+ Status = AcpiExStoreObjectToNode (SourceDesc,
+ (ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Destination object must be a Reference or a Constant object */
+
+ switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ break;
+
+ case ACPI_TYPE_INTEGER:
+
+ /* Allow stores to Constants -- a Noop as per ACPI spec */
+
+ if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*lint -fallthrough */
+
+ default:
+
+ /* Destination is not an Reference */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Destination is not a Reference or Constant object [%p]\n", DestDesc));
+
+ ACPI_DUMP_STACK_ENTRY (SourceDesc);
+ ACPI_DUMP_STACK_ENTRY (DestDesc);
+ ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore",
+ 2, "Target is not a Reference or Constant object");
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * Examine the Reference opcode. These cases are handled:
+ *
+ * 1) Store to Name (Change the object associated with a name)
+ * 2) Store to an indexed area of a Buffer or Package
+ * 3) Store to a Method Local or Arg
+ * 4) Store to the debug object
+ */
+ switch (RefDesc->Reference.Opcode)
+ {
+ case AML_NAME_OP:
+ case AML_REF_OF_OP:
+
+ /* Storing an object into a Name "container" */
+
+ Status = AcpiExStoreObjectToNode (SourceDesc, RefDesc->Reference.Object,
+ WalkState);
+ break;
+
+
+ case AML_INDEX_OP:
+
+ /* Storing to an Index (pointer into a packager or buffer) */
+
+ Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState);
+ break;
+
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ /* Store to a method local/arg */
+
+ Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode,
+ RefDesc->Reference.Offset, SourceDesc, WalkState);
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ /*
+ * Storing to the Debug object causes the value stored to be
+ * displayed and otherwise has no effect -- see ACPI Specification
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+
+ switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
+ ACPI_HIDWORD (SourceDesc->Integer.Value),
+ ACPI_LODWORD (SourceDesc->Integer.Value)));
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length %.2X\n",
+ (UINT32) SourceDesc->Buffer.Length));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", SourceDesc->String.Pointer));
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements Ptr - %p\n",
+ SourceDesc->Package.Elements));
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n",
+ AcpiUtGetObjectTypeName (SourceDesc), SourceDesc));
+ break;
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X\n",
+ RefDesc->Reference.Opcode));
+ ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
+
+ Status = AE_AML_INTERNAL;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreObjectToIndex
+ *
+ * PARAMETERS: *SourceDesc - Value to be stored
+ * *DestDesc - Named object to receive the value
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Store the object to indexed Buffer or Package element
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStoreObjectToIndex (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *IndexDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *NewDesc;
+ UINT8 Value = 0;
+
+
+ ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
+
+
+ /*
+ * Destination must be a reference pointer, and
+ * must point to either a buffer or a package
+ */
+ switch (IndexDesc->Reference.TargetType)
+ {
+ case ACPI_TYPE_PACKAGE:
+ /*
+ * Storing to a package element is not simple. The source must be
+ * evaluated and converted to the type of the destination and then the
+ * source is copied into the destination - we can't just point to the
+ * source object.
+ */
+ /*
+ * The object at *(IndexDesc->Reference.Where) is the
+ * element within the package that is to be modified.
+ */
+ ObjDesc = *(IndexDesc->Reference.Where);
+
+ /* Do the conversion/store */
+
+ Status = AcpiExStoreObjectToObject (SourceDesc, ObjDesc, &NewDesc,
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not store object to indexed package element\n"));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * If a new object was created, we must install it as the new
+ * package element
+ */
+ if (NewDesc != ObjDesc)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ *(IndexDesc->Reference.Where) = NewDesc;
+
+ /* If same as the original source, add a reference */
+
+ if (NewDesc == SourceDesc)
+ {
+ AcpiUtAddReference (NewDesc);
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /*
+ * Store into a Buffer (not actually a real BufferField) at a
+ * location defined by an Index.
+ *
+ * The first 8-bit element of the source object is written to the
+ * 8-bit Buffer location defined by the Index destination object,
+ * according to the ACPI 2.0 specification.
+ */
+
+ /*
+ * Make sure the target is a Buffer
+ */
+ ObjDesc = IndexDesc->Reference.Object;
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * The assignment of the individual elements will be slightly
+ * different for each source type.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Use the least-significant byte of the integer */
+
+ Value = (UINT8) (SourceDesc->Integer.Value);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ Value = SourceDesc->Buffer.Pointer[0];
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ Value = (UINT8) SourceDesc->String.Pointer[0];
+ break;
+
+ default:
+
+ /* All other types are invalid */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Source must be Integer/Buffer/String type, not %s\n",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Store the source value into the target buffer byte */
+
+ ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value;
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Target is not a Package or BufferField\n"));
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreObjectToNode
+ *
+ * PARAMETERS: SourceDesc - Value to be stored
+ * Node - Named object to receive the value
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Store the object to the named object.
+ *
+ * The Assignment of an object to a named object is handled here
+ * The value passed in will replace the current value (if any)
+ * with the input value.
+ *
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation.
+ *
+ * Assumes parameters are already validated.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStoreObjectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *TargetDesc;
+ ACPI_OPERAND_OBJECT *NewDesc;
+ ACPI_OBJECT_TYPE TargetType;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
+
+
+ /*
+ * Get current type of the node, and object attached to Node
+ */
+ TargetType = AcpiNsGetType (Node);
+ TargetDesc = AcpiNsGetAttachedObject (Node);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
+ SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
+ Node, AcpiUtGetTypeName (TargetType)));
+
+ /*
+ * Resolve the source object to an actual value
+ * (If it is a reference object)
+ */
+ Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Do the actual store operation
+ */
+ switch (TargetType)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ /*
+ * For fields, copy the source data to the target field.
+ */
+ Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, &WalkState->ResultObj);
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * These target types are all of type Integer/String/Buffer, and
+ * therefore support implicit conversion before the store.
+ *
+ * Copy and/or convert the source object to a new target object
+ */
+ Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, &NewDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (NewDesc != TargetDesc)
+ {
+ /*
+ * Store the new NewDesc as the new value of the Name, and set
+ * the Name's type to that of the value being stored in it.
+ * SourceDesc reference count is incremented by AttachObject.
+ *
+ * Note: This may change the type of the node if an explicit store
+ * has been performed such that the node/object type has been
+ * changed.
+ */
+ Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Store %s into %s via Convert/Attach\n",
+ AcpiUtGetObjectTypeName (SourceDesc),
+ AcpiUtGetObjectTypeName (NewDesc)));
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+ AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node));
+
+ /* No conversions for all other types. Just attach the source object */
+
+ Status = AcpiNsAttachObject (Node, SourceDesc, ACPI_GET_OBJECT_TYPE (SourceDesc));
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c
new file mode 100644
index 0000000..22c5d1f
--- /dev/null
+++ b/sys/contrib/dev/acpica/exstoren.c
@@ -0,0 +1,376 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstoren - AML Interpreter object store support,
+ * Store to Node (namespace object)
+ * $Revision: 55 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXSTOREN_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exstoren")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExResolveObject
+ *
+ * PARAMETERS: SourceDescPtr - Pointer to the source object
+ * TargetType - Current type of the target
+ * WalkState - Current walk state
+ *
+ * RETURN: Status, resolved object in SourceDescPtr.
+ *
+ * DESCRIPTION: Resolve an object. If the object is a reference, dereference
+ * it and return the actual object in the SourceDescPtr.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExResolveObject (
+ ACPI_OPERAND_OBJECT **SourceDescPtr,
+ ACPI_OBJECT_TYPE TargetType,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExResolveObject");
+
+
+ /*
+ * Ensure we have a Target that can be stored to
+ */
+ switch (TargetType)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /*
+ * These cases all require only Integers or values that
+ * can be converted to Integers (Strings or Buffers)
+ */
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * Stores into a Field/Region or into a Integer/Buffer/String
+ * are all essentially the same. This case handles the
+ * "interchangeable" types Integer, String, and Buffer.
+ */
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ /* Resolve a reference object first */
+
+ Status = AcpiExResolveToValue (SourceDescPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+
+ /*
+ * Must have a Integer, Buffer, or String
+ */
+ if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) &&
+ (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) &&
+ (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING))
+ {
+ /*
+ * Conversion successful but still not a valid type
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+ AcpiUtGetObjectTypeName (SourceDesc),
+ AcpiUtGetTypeName (TargetType)));
+ Status = AE_AML_OPERAND_TYPE;
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_ALIAS:
+
+ /*
+ * Aliases are resolved by AcpiExPrepOperands
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into Alias - should never happen\n"));
+ Status = AE_AML_INTERNAL;
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+ default:
+
+ /*
+ * All other types than Alias and the various Fields come here,
+ * including the untyped case - ACPI_TYPE_ANY.
+ */
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreObjectToObject
+ *
+ * PARAMETERS: SourceDesc - Object to store
+ * DestDesc - Object to receive a copy of the source
+ * NewDesc - New object if DestDesc is obsoleted
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: "Store" an object to another object. This may include
+ * converting the source type to the target type (implicit
+ * conversion), and a copy of the value of the source to
+ * the target.
+ *
+ * The Assignment of an object to another (not named) object
+ * is handled here.
+ * The Source passed in will replace the current value (if any)
+ * with the input value.
+ *
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation.
+ *
+ * This module allows destination types of Number, String,
+ * Buffer, and Package.
+ *
+ * Assumes parameters are already validated. NOTE: SourceDesc
+ * resolution (from a reference object) must be performed by
+ * the caller if necessary.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStoreObjectToObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_OPERAND_OBJECT **NewDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_OPERAND_OBJECT *ActualSrcDesc;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToObject", SourceDesc);
+
+
+ ActualSrcDesc = SourceDesc;
+ if (!DestDesc)
+ {
+ /*
+ * There is no destination object (An uninitialized node or
+ * package element), so we can simply copy the source object
+ * creating a new destination object
+ */
+ Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc))
+ {
+ /*
+ * The source type does not match the type of the destination.
+ * Perform the "implicit conversion" of the source to the current type
+ * of the target as per the ACPI specification.
+ *
+ * If no conversion performed, ActualSrcDesc = SourceDesc.
+ * Otherwise, ActualSrcDesc is a temporary object to hold the
+ * converted object.
+ */
+ Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc), SourceDesc,
+ &ActualSrcDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (SourceDesc == ActualSrcDesc)
+ {
+ /*
+ * No conversion was performed. Return the SourceDesc as the
+ * new object.
+ */
+ *NewDesc = SourceDesc;
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /*
+ * We now have two objects of identical types, and we can perform a
+ * copy of the *value* of the source object.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ DestDesc->Integer.Value = ActualSrcDesc->Integer.Value;
+
+ /* Truncate value if we are executing from a 32-bit ACPI table */
+
+ AcpiExTruncateFor32bitTable (DestDesc);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc, WalkState);
+ break;
+
+ default:
+ /*
+ * All other types come here.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
+ AcpiUtGetObjectTypeName (DestDesc)));
+
+ Status = AE_NOT_IMPLEMENTED;
+ break;
+ }
+
+ if (ActualSrcDesc != SourceDesc)
+ {
+ /* Delete the intermediate (temporary) source object */
+
+ AcpiUtRemoveReference (ActualSrcDesc);
+ }
+
+ *NewDesc = DestDesc;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c
new file mode 100644
index 0000000..360ab5c
--- /dev/null
+++ b/sys/contrib/dev/acpica/exstorob.c
@@ -0,0 +1,282 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstorob - AML Interpreter object store support, store to object
+ * $Revision: 50 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXSTOROB_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exstorob")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreBufferToBuffer
+ *
+ * PARAMETERS: SourceDesc - Source object to copy
+ * TargetDesc - Destination object of the copy
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy a buffer object to another buffer object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStoreBufferToBuffer (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc)
+{
+ UINT32 Length;
+ UINT8 *Buffer;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
+
+
+ /*
+ * We know that SourceDesc is a buffer by now
+ */
+ Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
+ Length = SourceDesc->Buffer.Length;
+
+ /*
+ * If target is a buffer of length zero or is a static buffer,
+ * allocate a new buffer of the proper length
+ */
+ if ((TargetDesc->Buffer.Length == 0) ||
+ (TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))
+ {
+ TargetDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (Length);
+ if (!TargetDesc->Buffer.Pointer)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
+ TargetDesc->Buffer.Length = Length;
+ }
+
+ /*
+ * Buffer is a static allocation,
+ * only place what will fit in the buffer.
+ */
+ if (Length <= TargetDesc->Buffer.Length)
+ {
+ /* Clear existing buffer and copy in the new one */
+
+ ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
+ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
+ }
+ else
+ {
+ /*
+ * Truncate the source, copy only what will fit
+ */
+ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Truncating src buffer from %X to %X\n",
+ Length, TargetDesc->Buffer.Length));
+ }
+
+ /* Copy flags */
+
+ TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreStringToString
+ *
+ * PARAMETERS: SourceDesc - Source object to copy
+ * TargetDesc - Destination object of the copy
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy a String object to another String object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExStoreStringToString (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *TargetDesc)
+{
+ UINT32 Length;
+ UINT8 *Buffer;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
+
+
+ /*
+ * We know that SourceDesc is a string by now.
+ */
+ Buffer = (UINT8 *) SourceDesc->String.Pointer;
+ Length = SourceDesc->String.Length;
+
+ /*
+ * Replace existing string value if it will fit and the string
+ * pointer is not a static pointer (part of an ACPI table)
+ */
+ if ((Length < TargetDesc->String.Length) &&
+ (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ {
+ /*
+ * String will fit in existing non-static buffer.
+ * Clear old string and copy in the new one
+ */
+ ACPI_MEMSET (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1);
+ ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+ }
+ else
+ {
+ /*
+ * Free the current buffer, then allocate a new buffer
+ * large enough to hold the value
+ */
+ if (TargetDesc->String.Pointer &&
+ (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ {
+ /*
+ * Only free if not a pointer into the DSDT
+ */
+ ACPI_MEM_FREE (TargetDesc->String.Pointer);
+ }
+
+ TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
+ if (!TargetDesc->String.Pointer)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
+ ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+ }
+
+ /* Set the new target length */
+
+ TargetDesc->String.Length = Length;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c
new file mode 100644
index 0000000..ae38ec8
--- /dev/null
+++ b/sys/contrib/dev/acpica/exsystem.c
@@ -0,0 +1,461 @@
+
+/******************************************************************************
+ *
+ * Module Name: exsystem - Interface to OS services
+ * $Revision: 76 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXSYSTEM_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exsystem")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemWaitSemaphore
+ *
+ * PARAMETERS: Semaphore - OSD semaphore to wait on
+ * Timeout - Max time to wait
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Implements a semaphore wait with a check to see if the
+ * semaphore is available immediately. If it is not, the
+ * interpreter is released.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemWaitSemaphore (
+ ACPI_HANDLE Semaphore,
+ UINT16 Timeout)
+{
+ ACPI_STATUS Status;
+ ACPI_STATUS Status2;
+
+
+ ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
+
+
+ Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
+ if (ACPI_SUCCESS (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Status == AE_TIME)
+ {
+ /* We must wait, so unlock the interpreter */
+
+ AcpiExExitInterpreter ();
+
+ Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n",
+ AcpiFormatException (Status)));
+
+ /* Reacquire the interpreter */
+
+ Status2 = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status2))
+ {
+ /* Report fatal error, could not acquire interpreter */
+
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemDoStall
+ *
+ * PARAMETERS: HowLong - The amount of time to stall
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Suspend running thread for specified amount of time.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemDoStall (
+ UINT32 HowLong)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (HowLong > 1000) /* 1 millisecond */
+ {
+ /* Since this thread will sleep, we must release the interpreter */
+
+ AcpiExExitInterpreter ();
+
+ AcpiOsSleep (0, (HowLong / 1000) + 1);
+
+ /* And now we must get the interpreter again */
+
+ Status = AcpiExEnterInterpreter ();
+ }
+
+ else
+ {
+ AcpiOsStall (HowLong);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemDoSuspend
+ *
+ * PARAMETERS: HowLong - The amount of time to suspend
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Suspend running thread for specified amount of time.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemDoSuspend (
+ UINT32 HowLong)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Since this thread will sleep, we must release the interpreter */
+
+ AcpiExExitInterpreter ();
+
+ AcpiOsSleep ((UINT16) (HowLong / (UINT32) 1000),
+ (UINT16) (HowLong % (UINT32) 1000));
+
+ /* And now we must get the interpreter again */
+
+ Status = AcpiExEnterInterpreter ();
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemAcquireMutex
+ *
+ * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
+ * *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ * within the AML. This function will cause a lock to be generated
+ * for the Mutex pointed to by ObjDesc.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemAcquireMutex (
+ ACPI_OPERAND_OBJECT *TimeDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Support for the _GL_ Mutex object -- go get the global lock
+ */
+ if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
+ {
+ Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value);
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
+ (UINT16) TimeDesc->Integer.Value);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemReleaseMutex
+ *
+ * PARAMETERS: *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ * within the AML. This operation is a request to release a
+ * previously acquired Mutex. If the Mutex variable is set then
+ * it will be decremented.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemReleaseMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Support for the _GL_ Mutex object -- release the global lock
+ */
+ if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
+ {
+ Status = AcpiEvReleaseGlobalLock ();
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemSignalEvent
+ *
+ * PARAMETERS: *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: AE_OK
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ * within the AML.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemSignalEvent (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
+
+
+ if (ObjDesc)
+ {
+ Status = AcpiOsSignalSemaphore (ObjDesc->Event.Semaphore, 1);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemWaitEvent
+ *
+ * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
+ * *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ * within the AML. This operation is a request to wait for an
+ * event.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemWaitEvent (
+ ACPI_OPERAND_OBJECT *TimeDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
+
+
+ if (ObjDesc)
+ {
+ Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore,
+ (UINT16) TimeDesc->Integer.Value);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemResetEvent
+ *
+ * PARAMETERS: *ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Reset an event to a known state.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemResetEvent (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+ void *TempSemaphore;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * We are going to simply delete the existing semaphore and
+ * create a new one!
+ */
+ Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
+ if (ACPI_SUCCESS (Status))
+ {
+ (void) AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore);
+ ObjDesc->Event.Semaphore = TempSemaphore;
+ }
+
+ return (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c
new file mode 100644
index 0000000..6d3083d
--- /dev/null
+++ b/sys/contrib/dev/acpica/exutils.c
@@ -0,0 +1,466 @@
+
+/******************************************************************************
+ *
+ * Module Name: exutils - interpreter/scanner utilities
+ * $Revision: 109 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __EXUTILS_C__
+
+/*
+ * DEFINE_AML_GLOBALS is tested in amlcode.h
+ * to determine whether certain global names should be "defined" or only
+ * "declared" in the current compilation. This enhances maintainability
+ * by enabling a single header file to embody all knowledge of the names
+ * in question.
+ *
+ * Exactly one module of any executable should #define DEFINE_GLOBALS
+ * before #including the header files which use this convention. The
+ * names in question will be defined and initialized in that module,
+ * and declared as extern in all other modules which #include those
+ * header files.
+ */
+
+#define DEFINE_AML_GLOBALS
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ ACPI_MODULE_NAME ("exutils")
+
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExEnterInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * DESCRIPTION: Enter the interpreter execution region. Failure to enter
+ * the interpreter region is a fatal system error
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExEnterInterpreter (void)
+{
+ ACPI_STATUS Status;
+
+ ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExExitInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * DESCRIPTION: Exit the interpreter execution region
+ *
+ * Cases where the interpreter is unlocked:
+ * 1) Completion of the execution of a control method
+ * 2) Method blocked on a Sleep() AML opcode
+ * 3) Method blocked on an Acquire() AML opcode
+ * 4) Method blocked on a Wait() AML opcode
+ * 5) Method blocked to acquire the global lock
+ * 6) Method blocked to execute a serialized control method that is
+ * already executing
+ * 7) About to invoke a user-installed opregion handler
+ *
+ ******************************************************************************/
+
+void
+AcpiExExitInterpreter (void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("ExExitInterpreter");
+
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExTruncateFor32bitTable
+ *
+ * PARAMETERS: ObjDesc - Object to be truncated
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
+ * belongs to a 32-bit ACPI table.
+ *
+ ******************************************************************************/
+
+void
+AcpiExTruncateFor32bitTable (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Object must be a valid number and we must be executing
+ * a control method
+ */
+ if ((!ObjDesc) ||
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
+ {
+ return;
+ }
+
+ if (AcpiGbl_IntegerByteWidth == 4)
+ {
+ /*
+ * We are running a method that exists in a 32-bit ACPI table.
+ * Truncate the value to 32 bits by zeroing out the upper 32-bit field
+ */
+ ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAcquireGlobalLock
+ *
+ * PARAMETERS: FieldFlags - Flags with Lock rule:
+ * AlwaysLock or NeverLock
+ *
+ * RETURN: TRUE/FALSE indicating whether the lock was actually acquired
+ *
+ * DESCRIPTION: Obtain the global lock and keep track of this fact via two
+ * methods. A global variable keeps the state of the lock, and
+ * the state is returned to the caller.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiExAcquireGlobalLock (
+ UINT32 FieldFlags)
+{
+ BOOLEAN Locked = FALSE;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
+
+
+ /* Only attempt lock if the AlwaysLock bit is set */
+
+ if (FieldFlags & AML_FIELD_LOCK_RULE_MASK)
+ {
+ /* We should attempt to get the lock, wait forever */
+
+ Status = AcpiEvAcquireGlobalLock (ACPI_WAIT_FOREVER);
+ if (ACPI_SUCCESS (Status))
+ {
+ Locked = TRUE;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
+ AcpiFormatException (Status)));
+ }
+ }
+
+ return_VALUE (Locked);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReleaseGlobalLock
+ *
+ * PARAMETERS: LockedByMe - Return value from corresponding call to
+ * AcquireGlobalLock.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release the global lock if it is locked.
+ *
+ ******************************************************************************/
+
+void
+AcpiExReleaseGlobalLock (
+ BOOLEAN LockedByMe)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
+
+
+ /* Only attempt unlock if the caller locked it */
+
+ if (LockedByMe)
+ {
+ /* OK, now release the lock */
+
+ Status = AcpiEvReleaseGlobalLock ();
+ if (ACPI_FAILURE (Status))
+ {
+ /* Report the error, but there isn't much else we can do */
+
+ ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
+ AcpiFormatException (Status)));
+ }
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDigitsNeeded
+ *
+ * PARAMETERS: Value - Value to be represented
+ * Base - Base of representation
+ *
+ * RETURN: the number of digits needed to represent Value in Base
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiExDigitsNeeded (
+ ACPI_INTEGER Value,
+ UINT32 Base)
+{
+ UINT32 NumDigits;
+ ACPI_INTEGER CurrentValue;
+ ACPI_INTEGER Quotient;
+
+
+ ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
+
+
+ /*
+ * ACPI_INTEGER is unsigned, so we don't worry about a '-'
+ */
+ if ((CurrentValue = Value) == 0)
+ {
+ return_VALUE (1);
+ }
+
+ NumDigits = 0;
+
+ while (CurrentValue)
+ {
+ (void) AcpiUtShortDivide (&CurrentValue, Base, &Quotient, NULL);
+ NumDigits++;
+ CurrentValue = Quotient;
+ }
+
+ return_VALUE (NumDigits);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExEisaIdToString
+ *
+ * PARAMETERS: NumericId - EISA ID to be converted
+ * OutString - Where to put the converted string (8 bytes)
+ *
+ * DESCRIPTION: Convert a numeric EISA ID to string representation
+ *
+ ******************************************************************************/
+
+void
+AcpiExEisaIdToString (
+ UINT32 NumericId,
+ char *OutString)
+{
+ UINT32 EisaId;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Swap ID to big-endian to get contiguous bits */
+
+ EisaId = AcpiUtDwordByteSwap (NumericId);
+
+ OutString[0] = (char) ('@' + (((unsigned long) EisaId >> 26) & 0x1f));
+ OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f));
+ OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f));
+ OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12);
+ OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8);
+ OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4);
+ OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0);
+ OutString[7] = 0;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExUnsignedIntegerToString
+ *
+ * PARAMETERS: Value - Value to be converted
+ * OutString - Where to put the converted string (8 bytes)
+ *
+ * RETURN: Convert a number to string representation
+ *
+ ******************************************************************************/
+
+void
+AcpiExUnsignedIntegerToString (
+ ACPI_INTEGER Value,
+ char *OutString)
+{
+ UINT32 Count;
+ UINT32 DigitsNeeded;
+ UINT32 Remainder;
+ ACPI_INTEGER Quotient;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ DigitsNeeded = AcpiExDigitsNeeded (Value, 10);
+ OutString[DigitsNeeded] = 0;
+
+ for (Count = DigitsNeeded; Count > 0; Count--)
+ {
+ (void) AcpiUtShortDivide (&Value, 10, &Quotient, &Remainder);
+ OutString[Count-1] = (char) ('0' + Remainder);\
+ Value = Quotient;
+ }
+}
+
+#endif
diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c
new file mode 100644
index 0000000..e271965
--- /dev/null
+++ b/sys/contrib/dev/acpica/hwacpi.c
@@ -0,0 +1,307 @@
+
+/******************************************************************************
+ *
+ * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
+ * $Revision: 63 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __HWACPI_C__
+
+#include "acpi.h"
+
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwacpi")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize and validate various ACPI registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwInitialize (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("HwInitialize");
+
+
+ /* We must have the ACPI tables by the time we get here */
+
+ if (!AcpiGbl_FADT)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
+
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /* Sanity check the FADT for valid values */
+
+ Status = AcpiUtValidateFadt ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwSetMode
+ *
+ * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Transitions the system into the requested mode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwSetMode (
+ UINT32 Mode)
+{
+
+ ACPI_STATUS Status;
+ UINT32 Retry;
+
+
+ ACPI_FUNCTION_TRACE ("HwSetMode");
+
+ /*
+ * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
+ * system does not support mode transition.
+ */
+ if (!AcpiGbl_FADT->SmiCmd)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No SMI_CMD in FADT, mode transition failed.\n"));
+ return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+ }
+
+ /*
+ * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE
+ * in FADT: If it is zero, enabling or disabling is not supported.
+ * As old systems may have used zero for mode transition,
+ * we make sure both the numbers are zero to determine these
+ * transitions are not supported.
+ */
+ if (!AcpiGbl_FADT->AcpiEnable && !AcpiGbl_FADT->AcpiDisable)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No mode transition supported in this system.\n"));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ switch (Mode)
+ {
+ case ACPI_SYS_MODE_ACPI:
+
+ /* BIOS should have disabled ALL fixed and GP events */
+
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
+ (UINT32) AcpiGbl_FADT->AcpiEnable, 8);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
+ break;
+
+ case ACPI_SYS_MODE_LEGACY:
+
+ /*
+ * BIOS should clear all fixed status bits and restore fixed event
+ * enable bits to default
+ */
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
+ (UINT32) AcpiGbl_FADT->AcpiDisable, 8);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Attempting to enable Legacy (non-ACPI) mode\n"));
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Some hardware takes a LONG time to switch modes. Give them 3 sec to
+ * do so, but allow faster systems to proceed more quickly.
+ */
+ Retry = 3000;
+ while (Retry)
+ {
+ Status = AE_NO_HARDWARE_RESPONSE;
+
+ if (AcpiHwGetMode() == Mode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode));
+ Status = AE_OK;
+ break;
+ }
+ AcpiOsStall(1000);
+ Retry--;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetMode
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY
+ *
+ * DESCRIPTION: Return current operating state of system. Determined by
+ * querying the SCI_EN bit.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiHwGetMode (void)
+{
+ ACPI_STATUS Status;
+ UINT32 Value;
+
+
+ ACPI_FUNCTION_TRACE ("HwGetMode");
+
+ Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VALUE (ACPI_SYS_MODE_LEGACY);
+ }
+
+ if (Value)
+ {
+ return_VALUE (ACPI_SYS_MODE_ACPI);
+ }
+ else
+ {
+ return_VALUE (ACPI_SYS_MODE_LEGACY);
+ }
+}
diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c
new file mode 100644
index 0000000..547acbb
--- /dev/null
+++ b/sys/contrib/dev/acpica/hwgpe.c
@@ -0,0 +1,674 @@
+
+/******************************************************************************
+ *
+ * Module Name: hwgpe - Low level GPE enable/disable/clear functions
+ * $Revision: 53 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwgpe")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableGpe
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enable a single GPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwEnableGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ UINT32 InByte;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Read the current value of the register, set the appropriate bit
+ * to enable the GPE, and write out the new register.
+ */
+ Status = AcpiHwLowLevelRead (8, &InByte,
+ &GpeEventInfo->RegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Write with the new GPE bit enabled */
+
+ Status = AcpiHwLowLevelWrite (8, (InByte | GpeEventInfo->BitMask),
+ &GpeEventInfo->RegisterInfo->EnableAddress);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableGpeForWakeup
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwEnableGpeForWakeup (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get the info block for the entire GPE register */
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+ if (!GpeRegisterInfo)
+ {
+ return;
+ }
+
+ /*
+ * Set the bit so we will not disable this when sleeping
+ */
+ GpeRegisterInfo->WakeEnable |= GpeEventInfo->BitMask;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableGpe
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disable a single GPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwDisableGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ UINT32 InByte;
+ ACPI_STATUS Status;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get the info block for the entire GPE register */
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+ if (!GpeRegisterInfo)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Read the current value of the register, clear the appropriate bit,
+ * and write out the new register value to disable the GPE.
+ */
+ Status = AcpiHwLowLevelRead (8, &InByte,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Write the byte with this GPE bit cleared */
+
+ Status = AcpiHwLowLevelWrite (8, (InByte & ~(GpeEventInfo->BitMask)),
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ AcpiHwDisableGpeForWakeup (GpeEventInfo);
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableGpeForWakeup
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwDisableGpeForWakeup (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get the info block for the entire GPE register */
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+ if (!GpeRegisterInfo)
+ {
+ return;
+ }
+
+ /*
+ * Clear the bit so we will disable this when sleeping
+ */
+ GpeRegisterInfo->WakeEnable &= ~(GpeEventInfo->BitMask);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwClearGpe
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Clear a single GPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwClearGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Write a one to the appropriate bit in the status register to
+ * clear this GPE.
+ */
+ Status = AcpiHwLowLevelWrite (8, GpeEventInfo->BitMask,
+ &GpeEventInfo->RegisterInfo->StatusAddress);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetGpeStatus
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Return the status of a single GPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwGetGpeStatus (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ ACPI_EVENT_STATUS *EventStatus)
+{
+ UINT32 InByte;
+ UINT8 BitMask;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+ ACPI_EVENT_STATUS LocalEventStatus = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!EventStatus)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Get the info block for the entire GPE register */
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = GpeEventInfo->BitMask;
+
+ /* GPE Enabled? */
+
+ Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ if (BitMask & InByte)
+ {
+ LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
+ }
+
+ /* GPE Enabled for wake? */
+
+ if (BitMask & GpeRegisterInfo->WakeEnable)
+ {
+ LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
+ }
+
+ /* GPE active (set)? */
+
+ Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ if (BitMask & InByte)
+ {
+ LocalEventStatus |= ACPI_EVENT_FLAG_SET;
+ }
+
+ /* Set return value */
+
+ (*EventStatus) = LocalEventStatus;
+
+
+UnlockAndExit:
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable all GPEs within a GPE block
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwDisableGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ Status = AcpiHwLowLevelWrite (8, 0x00,
+ &GpeBlock->RegisterInfo[i].EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwClearGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear all GPEs within a GPE block
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwClearGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ Status = AcpiHwLowLevelWrite (8, 0xFF,
+ &GpeBlock->RegisterInfo[i].StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableNonWakeupGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable all GPEs except wakeup GPEs in a GPE block
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwDisableNonWakeupGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT32 InValue;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /*
+ * Read the enabled status of all GPEs. We
+ * will be using it to restore all the GPEs later.
+ */
+ Status = AcpiHwLowLevelRead (8, &InValue,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ GpeRegisterInfo->Enable = (UINT8) InValue;
+
+ /*
+ * Disable all GPEs except wakeup GPEs.
+ */
+ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ GpeRegisterInfo++;
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableNonWakeupGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disable all non-wakeup GPEs
+ * Called with interrupts disabled. The interrupt handler also
+ * modifies GpeRegisterInfo->Enable, so it should not be
+ * given the chance to run until after non-wake GPEs are
+ * re-enabled.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwDisableNonWakeupGpes (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Status = AcpiEvWalkGpeList (AcpiHwDisableNonWakeupGpeBlock);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableNonWakeupGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enable a single GPE.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwEnableNonWakeupGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+
+
+ /* This callback processes one entire GPE block */
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /*
+ * We previously stored the enabled status of all GPEs.
+ * Blast them back in.
+ */
+ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ GpeRegisterInfo++;
+ }
+
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableNonWakeupGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwEnableNonWakeupGpes (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Status = AcpiEvWalkGpeList (AcpiHwEnableNonWakeupGpeBlock);
+
+ return (Status);
+}
diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c
new file mode 100644
index 0000000..e4a55d3
--- /dev/null
+++ b/sys/contrib/dev/acpica/hwregs.c
@@ -0,0 +1,978 @@
+
+/*******************************************************************************
+ *
+ * Module Name: hwregs - Read/write access functions for the various ACPI
+ * control and status registers.
+ * $Revision: 149 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __HWREGS_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwregs")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwClearAcpiStatus
+ *
+ * PARAMETERS: Flags - Lock the hardware or not
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Clears all fixed and general purpose status bits
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwClearAcpiStatus (
+ UINT32 Flags)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
+ ACPI_BITMASK_ALL_FIXED_STATUS,
+ (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
+
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ ACPI_BITMASK_ALL_FIXED_STATUS);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Clear the fixed events */
+
+ if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
+ {
+ Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
+ &AcpiGbl_FADT->XPm1bEvtBlk);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+
+ /* Clear the GPE Bits in all GPE registers in all GPE blocks */
+
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
+
+UnlockAndExit:
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetSleepTypeData
+ *
+ * PARAMETERS: SleepState - Numeric sleep state
+ * *SleepTypeA - Where SLP_TYPa is returned
+ * *SleepTypeB - Where SLP_TYPb is returned
+ *
+ * RETURN: Status - ACPI status
+ *
+ * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
+ * state.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetSleepTypeData (
+ UINT8 SleepState,
+ UINT8 *SleepTypeA,
+ UINT8 *SleepTypeB)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData");
+
+
+ /*
+ * Validate parameters
+ */
+ if ((SleepState > ACPI_S_STATES_MAX) ||
+ !SleepTypeA || !SleepTypeB)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Evaluate the namespace object containing the values for this state
+ */
+ Status = AcpiNsEvaluateByName ((char *) AcpiGbl_DbSleepStates[SleepState],
+ NULL, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating SleepState [%s]\n",
+ AcpiFormatException (Status), AcpiGbl_DbSleepStates[SleepState]));
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Must have a return object */
+
+ if (!ObjDesc)
+ {
+ ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
+ Status = AE_NOT_EXIST;
+ }
+
+ /* It must be of type Package */
+
+ else if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_PACKAGE)
+ {
+ ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
+ Status = AE_AML_OPERAND_TYPE;
+ }
+
+ /* The package must have at least two elements */
+
+ else if (ObjDesc->Package.Count < 2)
+ {
+ ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
+ Status = AE_AML_NO_OPERAND;
+ }
+
+ /* The first two elements must both be of type Integer */
+
+ else if ((ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_INTEGER) ||
+ (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER))
+ {
+ ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n",
+ AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[0]),
+ AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[1])));
+ Status = AE_AML_OPERAND_TYPE;
+ }
+ else
+ {
+ /*
+ * Valid _Sx_ package size, type, and value
+ */
+ *SleepTypeA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value;
+ *SleepTypeB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While evaluating SleepState [%s], bad Sleep object %p type %s\n",
+ AcpiGbl_DbSleepStates[SleepState], ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
+ }
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetRegisterBitMask
+ *
+ * PARAMETERS: RegisterId - Index of ACPI Register to access
+ *
+ * RETURN: The bit mask to be used when accessing the register
+ *
+ * DESCRIPTION: Map RegisterId into a register bit mask.
+ *
+ ******************************************************************************/
+
+ACPI_BIT_REGISTER_INFO *
+AcpiHwGetBitRegisterInfo (
+ UINT32 RegisterId)
+{
+ ACPI_FUNCTION_NAME ("HwGetBitRegisterInfo");
+
+
+ if (RegisterId > ACPI_BITREG_MAX)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid BitRegister ID: %X\n", RegisterId));
+ return (NULL);
+ }
+
+ return (&AcpiGbl_BitRegisterInfo[RegisterId]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetRegister
+ *
+ * PARAMETERS: RegisterId - ID of ACPI BitRegister to access
+ * ReturnValue - Value that was read from the register
+ * Flags - Lock the hardware or not
+ *
+ * RETURN: Value is read from specified Register. Value returned is
+ * normalized to bit0 (is shifted all the way right)
+ *
+ * DESCRIPTION: ACPI BitRegister read function.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetRegister (
+ UINT32 RegisterId,
+ UINT32 *ReturnValue,
+ UINT32 Flags)
+{
+ UINT32 RegisterValue = 0;
+ ACPI_BIT_REGISTER_INFO *BitRegInfo;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetRegister");
+
+
+ /* Get the info structure corresponding to the requested ACPI Register */
+
+ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+ if (!BitRegInfo)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ BitRegInfo->ParentRegister, &RegisterValue);
+
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Normalize the value that was read */
+
+ RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask)
+ >> BitRegInfo->BitPosition);
+
+ *ReturnValue = RegisterValue;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
+ RegisterValue, BitRegInfo->ParentRegister));
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiSetRegister
+ *
+ * PARAMETERS: RegisterId - ID of ACPI BitRegister to access
+ * Value - (only used on write) value to write to the
+ * Register, NOT pre-normalized to the bit pos.
+ * Flags - Lock the hardware or not
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: ACPI Bit Register write function.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiSetRegister (
+ UINT32 RegisterId,
+ UINT32 Value,
+ UINT32 Flags)
+{
+ UINT32 RegisterValue = 0;
+ ACPI_BIT_REGISTER_INFO *BitRegInfo;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("AcpiSetRegister", RegisterId);
+
+
+ /* Get the info structure corresponding to the requested ACPI Register */
+
+ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+ if (!BitRegInfo)
+ {
+ ACPI_REPORT_ERROR (("Bad ACPI HW RegisterId: %X\n", RegisterId));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Always do a register read first so we can insert the new bits */
+
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ BitRegInfo->ParentRegister, &RegisterValue);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Decode the Register ID
+ * Register id = Register block id | bit id
+ *
+ * Check bit id to fine locate Register offset.
+ * Check Mask to determine Register offset, and then read-write.
+ */
+ switch (BitRegInfo->ParentRegister)
+ {
+ case ACPI_REGISTER_PM1_STATUS:
+
+ /*
+ * Status Registers are different from the rest. Clear by
+ * writing 1, writing 0 has no effect. So, the only relevant
+ * information is the single bit we're interested in, all others should
+ * be written as 0 so they will be left unchanged
+ */
+ Value = ACPI_REGISTER_PREPARE_BITS (Value,
+ BitRegInfo->BitPosition, BitRegInfo->AccessBitMask);
+ if (Value)
+ {
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_STATUS, (UINT16) Value);
+ RegisterValue = 0;
+ }
+ break;
+
+
+ case ACPI_REGISTER_PM1_ENABLE:
+
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
+ BitRegInfo->AccessBitMask, Value);
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
+ break;
+
+
+ case ACPI_REGISTER_PM1_CONTROL:
+
+ /*
+ * Read the PM1 Control register.
+ * Note that at this level, the fact that there are actually TWO
+ * registers (A and B - and that B may not exist) is abstracted.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue));
+
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
+ BitRegInfo->AccessBitMask, Value);
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
+ break;
+
+
+ case ACPI_REGISTER_PM2_CONTROL:
+
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM2_CONTROL, &RegisterValue);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
+ RegisterValue,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
+
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
+ BitRegInfo->AccessBitMask, Value);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
+ RegisterValue,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
+ break;
+
+
+ default:
+ break;
+ }
+
+
+UnlockAndExit:
+
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
+
+ /* Normalize the value that was read */
+
+ ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
+ Value, RegisterValue, BitRegInfo->ParentRegister));
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwRegisterRead
+ *
+ * PARAMETERS: UseLock - Mutex hw access.
+ * RegisterId - RegisterID + Offset.
+ *
+ * RETURN: Value read or written.
+ *
+ * DESCRIPTION: Acpi register read function. Registers are read at the
+ * given offset.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwRegisterRead (
+ BOOLEAN UseLock,
+ UINT32 RegisterId,
+ UINT32 *ReturnValue)
+{
+ UINT32 Value1 = 0;
+ UINT32 Value2 = 0;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("HwRegisterRead");
+
+
+ if (ACPI_MTX_LOCK == UseLock)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ switch (RegisterId)
+ {
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
+
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk);
+ Value1 |= Value2;
+ break;
+
+
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
+
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_XPm1aEnable);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_XPm1bEnable);
+ Value1 |= Value2;
+ break;
+
+
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
+
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk);
+ Value1 |= Value2;
+ break;
+
+
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
+
+ Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
+
+ Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk);
+ break;
+
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
+
+ Status = AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value1, 8);
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", RegisterId));
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
+UnlockAndExit:
+ if (ACPI_MTX_LOCK == UseLock)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
+
+ if (ACPI_SUCCESS (Status))
+ {
+ *ReturnValue = Value1;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwRegisterWrite
+ *
+ * PARAMETERS: UseLock - Mutex hw access.
+ * RegisterId - RegisterID + Offset.
+ *
+ * RETURN: Value read or written.
+ *
+ * DESCRIPTION: Acpi register Write function. Registers are written at the
+ * given offset.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwRegisterWrite (
+ BOOLEAN UseLock,
+ UINT32 RegisterId,
+ UINT32 Value)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("HwRegisterWrite");
+
+
+ if (ACPI_MTX_LOCK == UseLock)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ switch (RegisterId)
+ {
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1bEnable);
+ break;
+
+
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
+
+ Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk);
+ break;
+
+
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
+
+ Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk);
+ break;
+
+
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
+
+ /* SMI_CMD is currently always in IO space */
+
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
+ break;
+
+
+ default:
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
+UnlockAndExit:
+ if (ACPI_MTX_LOCK == UseLock)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwLowLevelRead
+ *
+ * PARAMETERS: Width - 8, 16, or 32
+ * Value - Where the value is returned
+ * Register - GAS register structure
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read from either memory, IO, or PCI config space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwLowLevelRead (
+ UINT32 Width,
+ UINT32 *Value,
+ ACPI_GENERIC_ADDRESS *Reg)
+{
+ ACPI_PCI_ID PciId;
+ UINT16 PciRegister;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME ("HwLowLevelRead");
+
+
+ /*
+ * Must have a valid pointer to a GAS structure, and
+ * a non-zero address within. However, don't return an error
+ * because the PM1A/B code must not fail if B isn't present.
+ */
+ if ((!Reg) ||
+ (!ACPI_VALID_ADDRESS (Reg->Address)))
+ {
+ return (AE_OK);
+ }
+ *Value = 0;
+
+ /*
+ * Three address spaces supported:
+ * Memory, Io, or PCI config.
+ */
+ switch (Reg->AddressSpaceId)
+ {
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
+ Status = AcpiOsReadMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
+ break;
+
+
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
+ break;
+
+
+ case ACPI_ADR_SPACE_PCI_CONFIG:
+
+ PciId.Segment = 0;
+ PciId.Bus = 0;
+ PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
+ PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
+ PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
+
+ Status = AcpiOsReadPciConfiguration (&PciId, PciRegister,
+ Value, Width);
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ return (AE_BAD_PARAMETER);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
+ *Value, Width,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ AcpiUtGetRegionName (Reg->AddressSpaceId)));
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwLowLevelWrite
+ *
+ * PARAMETERS: Width - 8, 16, or 32
+ * Value - To be written
+ * Register - GAS register structure
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Write to either memory, IO, or PCI config space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwLowLevelWrite (
+ UINT32 Width,
+ UINT32 Value,
+ ACPI_GENERIC_ADDRESS *Reg)
+{
+ ACPI_PCI_ID PciId;
+ UINT16 PciRegister;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME ("HwLowLevelWrite");
+
+
+ /*
+ * Must have a valid pointer to a GAS structure, and
+ * a non-zero address within. However, don't return an error
+ * because the PM1A/B code must not fail if B isn't present.
+ */
+ if ((!Reg) ||
+ (!ACPI_VALID_ADDRESS (Reg->Address)))
+ {
+ return (AE_OK);
+ }
+ /*
+ * Three address spaces supported:
+ * Memory, Io, or PCI config.
+ */
+ switch (Reg->AddressSpaceId)
+ {
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
+ Status = AcpiOsWriteMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
+ break;
+
+
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+
+ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
+ break;
+
+
+ case ACPI_ADR_SPACE_PCI_CONFIG:
+
+ PciId.Segment = 0;
+ PciId.Bus = 0;
+ PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
+ PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
+ PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
+
+ Status = AcpiOsWritePciConfiguration (&PciId, PciRegister,
+ (ACPI_INTEGER) Value, Width);
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ return (AE_BAD_PARAMETER);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
+ Value, Width,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ AcpiUtGetRegionName (Reg->AddressSpaceId)));
+
+ return (Status);
+}
diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c
new file mode 100644
index 0000000..3030038
--- /dev/null
+++ b/sys/contrib/dev/acpica/hwsleep.c
@@ -0,0 +1,547 @@
+
+/******************************************************************************
+ *
+ * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
+ * $Revision: 56 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwsleep")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiSetFirmwareWakingVector
+ *
+ * PARAMETERS: PhysicalAddress - Physical address of ACPI real mode
+ * entry point.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiSetFirmwareWakingVector (
+ ACPI_PHYSICAL_ADDRESS PhysicalAddress)
+{
+
+ ACPI_FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
+
+
+ /* Set the vector */
+
+ if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ {
+ *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector))
+ = (UINT32) PhysicalAddress;
+ }
+ else
+ {
+ *AcpiGbl_CommonFACS.FirmwareWakingVector
+ = PhysicalAddress;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetFirmwareWakingVector
+ *
+ * PARAMETERS: *PhysicalAddress - Output buffer where contents of
+ * the FirmwareWakingVector field of
+ * the FACS will be stored.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Access function for FirmwareWakingVector field in FACS
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetFirmwareWakingVector (
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+{
+
+ ACPI_FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
+
+
+ if (!PhysicalAddress)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the vector */
+
+ if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ {
+ *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
+ *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector));
+ }
+ else
+ {
+ *PhysicalAddress =
+ *AcpiGbl_CommonFACS.FirmwareWakingVector;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepStatePrep
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231)
+ * This function must execute with interrupts enabled.
+ * We break sleeping into 2 stages so that OSPM can handle
+ * various OS-specific tasks between the two steps.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepStatePrep (
+ UINT8 SleepState)
+{
+ ACPI_STATUS Status;
+ ACPI_OBJECT_LIST ArgList;
+ ACPI_OBJECT Arg;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
+
+
+ /*
+ * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
+ */
+ Status = AcpiGetSleepTypeData (SleepState,
+ &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Setup parameter object */
+
+ ArgList.Count = 1;
+ ArgList.Pointer = &Arg;
+
+ Arg.Type = ACPI_TYPE_INTEGER;
+ Arg.Integer.Value = SleepState;
+
+ /* Run the _PTS and _GTS methods */
+
+ Status = AcpiEvaluateObject (NULL, "\\_PTS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiEvaluateObject (NULL, "\\_GTS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepState
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepState (
+ UINT8 SleepState)
+{
+ UINT32 PM1AControl;
+ UINT32 PM1BControl;
+ ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
+ ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
+ UINT32 InValue;
+ UINT32 Retry;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnterSleepState");
+
+
+ if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
+ (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
+ {
+ ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
+ AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+
+
+ SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A);
+ SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
+
+ /* Clear wake status */
+
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Disable BM arbitration */
+
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiHwDisableNonWakeupGpes();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get current value of PM1A control */
+
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState));
+
+ /* Clear SLP_EN and SLP_TYP fields */
+
+ PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask);
+ PM1BControl = PM1AControl;
+
+ /* Insert SLP_TYP bits */
+
+ PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition);
+ PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition);
+
+ /* Write #1: fill in SLP_TYP data */
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Insert SLP_ENABLE bit */
+
+ PM1AControl |= SleepEnableRegInfo->AccessBitMask;
+ PM1BControl |= SleepEnableRegInfo->AccessBitMask;
+
+ /* Write #2: SLP_TYP + SLP_EN */
+
+ ACPI_FLUSH_CPU_CACHE ();
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Wait a second, then try again. This is to get S4/5 to work on all machines.
+ */
+ if (SleepState > ACPI_STATE_S3)
+ {
+ /*
+ * We wait so long to allow chipsets that poll this reg very slowly to
+ * still read the right value. Ideally, this entire block would go
+ * away entirely.
+ */
+ AcpiOsStall (10000000);
+
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL,
+ SleepEnableRegInfo->AccessBitMask);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Wait until we enter sleep state */
+
+ Retry = 1000;
+ do
+ {
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Some BIOSes don't set WAK_STS at all,
+ * give up waiting for wakeup if we time out.
+ */
+ if (Retry-- == 0)
+ {
+ break; /* giving up */
+ }
+
+ /* Spin until we wake */
+
+ } while (!InValue);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepStateS4bios
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform a S4 bios request.
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepStateS4bios (
+ void)
+{
+ UINT32 InValue;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios");
+
+ AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK);
+
+ AcpiHwDisableNonWakeupGpes();
+
+ ACPI_FLUSH_CPU_CACHE();
+
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8);
+
+ do {
+ AcpiOsStall(1000);
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ } while (!InValue);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiLeaveSleepState
+ *
+ * PARAMETERS: SleepState - Which sleep state we just exited
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLeaveSleepState (
+ UINT8 SleepState)
+{
+ ACPI_OBJECT_LIST ArgList;
+ ACPI_OBJECT Arg;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiLeaveSleepState");
+
+
+ /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
+
+ AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
+
+ /* Setup parameter object */
+
+ ArgList.Count = 1;
+ ArgList.Pointer = &Arg;
+
+ Arg.Type = ACPI_TYPE_INTEGER;
+ Arg.Integer.Value = SleepState;
+
+ /* Ignore any errors from these methods */
+
+ Status = AcpiEvaluateObject (NULL, "\\_BFS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", AcpiFormatException (Status)));
+ }
+
+ Status = AcpiEvaluateObject (NULL, "\\_WAK", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status)));
+ }
+
+ /* _WAK returns stuff - do we want to look at it? */
+
+ Status = AcpiHwEnableNonWakeupGpes();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Disable BM arbitration */
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
+
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c
new file mode 100644
index 0000000..5e4cb26
--- /dev/null
+++ b/sys/contrib/dev/acpica/hwtimer.c
@@ -0,0 +1,290 @@
+
+/******************************************************************************
+ *
+ * Name: hwtimer.c - ACPI Power Management Timer Interface
+ * $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwtimer")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetTimerResolution
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: Number of bits of resolution in the PM Timer (24 or 32).
+ *
+ * DESCRIPTION: Obtains resolution of the ACPI PM Timer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetTimerResolution (
+ UINT32 *Resolution)
+{
+ ACPI_FUNCTION_TRACE ("AcpiGetTimerResolution");
+
+
+ if (!Resolution)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (0 == AcpiGbl_FADT->TmrValExt)
+ {
+ *Resolution = 24;
+ }
+ else
+ {
+ *Resolution = 32;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetTimer
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: Current value of the ACPI PM Timer (in ticks).
+ *
+ * DESCRIPTION: Obtains current value of ACPI PM Timer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetTimer (
+ UINT32 *Ticks)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetTimer");
+
+
+ if (!Ticks)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetTimerDuration
+ *
+ * PARAMETERS: StartTicks
+ * EndTicks
+ * TimeElapsed
+ *
+ * RETURN: TimeElapsed
+ *
+ * DESCRIPTION: Computes the time elapsed (in microseconds) between two
+ * PM Timer time stamps, taking into account the possibility of
+ * rollovers, the timer resolution, and timer frequency.
+ *
+ * The PM Timer's clock ticks at roughly 3.6 times per
+ * _microsecond_, and its clock continues through Cx state
+ * transitions (unlike many CPU timestamp counters) -- making it
+ * a versatile and accurate timer.
+ *
+ * Note that this function accommodates only a single timer
+ * rollover. Thus for 24-bit timers, this function should only
+ * be used for calculating durations less than ~4.6 seconds
+ * (~20 minutes for 32-bit timers) -- calculations below
+ *
+ * 2**24 Ticks / 3,600,000 Ticks/Sec = 4.66 sec
+ * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetTimerDuration (
+ UINT32 StartTicks,
+ UINT32 EndTicks,
+ UINT32 *TimeElapsed)
+{
+ UINT32 DeltaTicks = 0;
+ UINT64_OVERLAY NormalizedTicks;
+ ACPI_STATUS Status;
+ ACPI_INTEGER OutQuotient;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetTimerDuration");
+
+
+ if (!TimeElapsed)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Compute Tick Delta:
+ * -------------------
+ * Handle (max one) timer rollovers on 24- versus 32-bit timers.
+ */
+ if (StartTicks < EndTicks)
+ {
+ DeltaTicks = EndTicks - StartTicks;
+ }
+ else if (StartTicks > EndTicks)
+ {
+ if (0 == AcpiGbl_FADT->TmrValExt)
+ {
+ /* 24-bit Timer */
+
+ DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
+ }
+ else
+ {
+ /* 32-bit Timer */
+
+ DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
+ }
+ }
+ else
+ {
+ *TimeElapsed = 0;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Compute Duration:
+ * -----------------
+ *
+ * Requires a 64-bit divide:
+ *
+ * TimeElapsed = (DeltaTicks * 1000000) / PM_TIMER_FREQUENCY;
+ */
+ NormalizedTicks.Full = ((UINT64) DeltaTicks) * 1000000;
+
+ Status = AcpiUtShortDivide (&NormalizedTicks.Full, PM_TIMER_FREQUENCY,
+ &OutQuotient, NULL);
+
+ *TimeElapsed = (UINT32) OutQuotient;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c
new file mode 100644
index 0000000..a1c8a19
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsaccess.c
@@ -0,0 +1,723 @@
+/*******************************************************************************
+ *
+ * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
+ * $Revision: 173 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSACCESS_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsaccess")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsRootInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocate and initialize the default root named objects
+ *
+ * MUTEX: Locks namespace for entire execution
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsRootInitialize (void)
+{
+ ACPI_STATUS Status;
+ const ACPI_PREDEFINED_NAMES *InitVal = NULL;
+ ACPI_NAMESPACE_NODE *NewNode;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STRING Val = NULL;
+
+
+ ACPI_FUNCTION_TRACE ("NsRootInitialize");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The global root ptr is initially NULL, so a non-NULL value indicates
+ * that AcpiNsRootInitialize() has already been called; just return.
+ */
+ if (AcpiGbl_RootNode)
+ {
+ Status = AE_OK;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Tell the rest of the subsystem that the root is initialized
+ * (This is OK because the namespace is locked)
+ */
+ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
+
+ /* Enter the pre-defined names in the name table */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Entering predefined entries into namespace\n"));
+
+ for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
+ {
+ Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &NewNode);
+
+ if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not create predefined name %s, %s\n",
+ InitVal->Name, AcpiFormatException (Status)));
+ }
+
+ /*
+ * Name entered successfully.
+ * If entry in PreDefinedNames[] specifies an
+ * initial value, create the initial value.
+ */
+ if (InitVal->Val)
+ {
+ Status = AcpiOsPredefinedOverride (InitVal, &Val);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not override predefined %s\n",
+ InitVal->Name));
+ }
+
+ if (!Val)
+ {
+ Val = InitVal->Val;
+ }
+
+ /*
+ * Entry requests an initial value, allocate a
+ * descriptor for it.
+ */
+ ObjDesc = AcpiUtCreateInternalObject (InitVal->Type);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Convert value string from table entry to
+ * internal representation. Only types actually
+ * used for initial values are implemented here.
+ */
+ switch (InitVal->Type)
+ {
+ case ACPI_TYPE_METHOD:
+ ObjDesc->Method.ParamCount =
+ (UINT8) ACPI_STRTOUL (Val, NULL, 10);
+ ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
+
+#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
+
+ /* Compiler cheats by putting parameter count in the OwnerID */
+
+ NewNode->OwnerId = ObjDesc->Method.ParamCount;
+#endif
+ break;
+
+ case ACPI_TYPE_INTEGER:
+
+ ObjDesc->Integer.Value =
+ (ACPI_INTEGER) ACPI_STRTOUL (Val, NULL, 10);
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Build an object around the static string
+ */
+ ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val);
+ ObjDesc->String.Pointer = Val;
+ ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
+ break;
+
+
+ case ACPI_TYPE_MUTEX:
+
+ ObjDesc->Mutex.Node = NewNode;
+ ObjDesc->Mutex.SyncLevel =
+ (UINT16) ACPI_STRTOUL (Val, NULL, 10);
+
+ if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
+ {
+ /*
+ * Create a counting semaphore for the
+ * global lock
+ */
+ Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT,
+ 1, &ObjDesc->Mutex.Semaphore);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /*
+ * We just created the mutex for the
+ * global lock, save it
+ */
+ AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore;
+ }
+ else
+ {
+ /* Create a mutex */
+
+ Status = AcpiOsCreateSemaphore (1, 1,
+ &ObjDesc->Mutex.Semaphore);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+ break;
+
+
+ default:
+ ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
+ InitVal->Type));
+ AcpiUtRemoveReference (ObjDesc);
+ ObjDesc = NULL;
+ continue;
+ }
+
+ /* Store pointer to value descriptor in the Node */
+
+ Status = AcpiNsAttachObject (NewNode, ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc));
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ }
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsLookup
+ *
+ * PARAMETERS: PrefixNode - Search scope if name is not fully qualified
+ * Pathname - Search pathname, in internal format
+ * (as represented in the AML stream)
+ * Type - Type associated with name
+ * InterpreterMode - IMODE_LOAD_PASS2 => add name if not found
+ * Flags - Flags describing the search restrictions
+ * WalkState - Current state of the walk
+ * ReturnNode - Where the Node is placed (if found
+ * or created successfully)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find or enter the passed name in the name space.
+ * Log an error if name not found in Exec mode.
+ *
+ * MUTEX: Assumes namespace is locked.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsLookup (
+ ACPI_GENERIC_STATE *ScopeInfo,
+ char *Pathname,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ UINT32 Flags,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+ char *Path = Pathname;
+ ACPI_NAMESPACE_NODE *PrefixNode;
+ ACPI_NAMESPACE_NODE *CurrentNode = NULL;
+ ACPI_NAMESPACE_NODE *ThisNode = NULL;
+ UINT32 NumSegments;
+ UINT32 NumCarats;
+ ACPI_NAME SimpleName;
+ ACPI_OBJECT_TYPE TypeToCheckFor;
+ ACPI_OBJECT_TYPE ThisSearchType;
+ UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
+ UINT32 LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND |
+ ACPI_NS_SEARCH_PARENT);
+
+
+ ACPI_FUNCTION_TRACE ("NsLookup");
+
+
+ if (!ReturnNode)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ AcpiGbl_NsLookupCount++;
+ *ReturnNode = ACPI_ENTRY_NOT_FOUND;
+
+ if (!AcpiGbl_RootNode)
+ {
+ return_ACPI_STATUS (AE_NO_NAMESPACE);
+ }
+
+ /*
+ * Get the prefix scope.
+ * A null scope means use the root scope
+ */
+ if ((!ScopeInfo) ||
+ (!ScopeInfo->Scope.Node))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Null scope prefix, using root node (%p)\n",
+ AcpiGbl_RootNode));
+
+ PrefixNode = AcpiGbl_RootNode;
+ }
+ else
+ {
+ PrefixNode = ScopeInfo->Scope.Node;
+ if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%p] Not a namespace node\n",
+ PrefixNode));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ /*
+ * This node might not be a actual "scope" node (such as a
+ * Device/Method, etc.) It could be a Package or other object node.
+ * Backup up the tree to find the containing scope node.
+ */
+ while (!AcpiNsOpensScope (PrefixNode->Type) &&
+ PrefixNode->Type != ACPI_TYPE_ANY)
+ {
+ PrefixNode = AcpiNsGetParentNode (PrefixNode);
+ }
+ }
+
+ /* Save type TBD: may be no longer necessary */
+
+ TypeToCheckFor = Type;
+
+ /*
+ * Begin examination of the actual pathname
+ */
+ if (!Pathname)
+ {
+ /* A Null NamePath is allowed and refers to the root */
+
+ NumSegments = 0;
+ ThisNode = AcpiGbl_RootNode;
+ Path = "";
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Null Pathname (Zero segments), Flags=%X\n", Flags));
+ }
+ else
+ {
+ /*
+ * Name pointer is valid (and must be in internal name format)
+ *
+ * Check for scope prefixes:
+ *
+ * As represented in the AML stream, a namepath consists of an
+ * optional scope prefix followed by a name segment part.
+ *
+ * If present, the scope prefix is either a Root Prefix (in
+ * which case the name is fully qualified), or one or more
+ * Parent Prefixes (in which case the name's scope is relative
+ * to the current scope).
+ */
+ if (*Path == (UINT8) AML_ROOT_PREFIX)
+ {
+ /* Pathname is fully qualified, start from the root */
+
+ ThisNode = AcpiGbl_RootNode;
+ SearchParentFlag = ACPI_NS_NO_UPSEARCH;
+
+ /* Point to name segment part */
+
+ Path++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Path is absolute from root [%p]\n", ThisNode));
+ }
+ else
+ {
+ /* Pathname is relative to current scope, start there */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Searching relative to prefix scope [%4.4s] (%p)\n",
+ PrefixNode->Name.Ascii, PrefixNode));
+
+ /*
+ * Handle multiple Parent Prefixes (carat) by just getting
+ * the parent node for each prefix instance.
+ */
+ ThisNode = PrefixNode;
+ NumCarats = 0;
+ while (*Path == (UINT8) AML_PARENT_PREFIX)
+ {
+ /* Name is fully qualified, no search rules apply */
+
+ SearchParentFlag = ACPI_NS_NO_UPSEARCH;
+ /*
+ * Point past this prefix to the name segment
+ * part or the next Parent Prefix
+ */
+ Path++;
+
+ /* Backup to the parent node */
+
+ NumCarats++;
+ ThisNode = AcpiNsGetParentNode (ThisNode);
+ if (!ThisNode)
+ {
+ /* Current scope has no parent scope */
+
+ ACPI_REPORT_ERROR (
+ ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+ return_ACPI_STATUS (AE_NOT_FOUND);
+ }
+ }
+
+ if (SearchParentFlag == ACPI_NS_NO_UPSEARCH)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Search scope is [%4.4s], path has %d carat(s)\n",
+ ThisNode->Name.Ascii, NumCarats));
+ }
+ }
+
+ /*
+ * Determine the number of ACPI name segments in this pathname.
+ *
+ * The segment part consists of either:
+ * - A Null name segment (0)
+ * - A DualNamePrefix followed by two 4-byte name segments
+ * - A MultiNamePrefix followed by a byte indicating the
+ * number of segments and the segments themselves.
+ * - A single 4-byte name segment
+ *
+ * Examine the name prefix opcode, if any, to determine the number of
+ * segments.
+ */
+ switch (*Path)
+ {
+ case 0:
+ /*
+ * Null name after a root or parent prefixes. We already
+ * have the correct target node and there are no name segments.
+ */
+ NumSegments = 0;
+ Type = ThisNode->Type;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Prefix-only Pathname (Zero name segments), Flags=%X\n", Flags));
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+
+ /* More than one NameSeg, search rules do not apply */
+
+ SearchParentFlag = ACPI_NS_NO_UPSEARCH;
+
+ /* Two segments, point to first name segment */
+
+ NumSegments = 2;
+ Path++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Dual Pathname (2 segments, Flags=%X)\n", Flags));
+ break;
+
+ case AML_MULTI_NAME_PREFIX_OP:
+
+ /* More than one NameSeg, search rules do not apply */
+
+ SearchParentFlag = ACPI_NS_NO_UPSEARCH;
+
+ /* Extract segment count, point to first name segment */
+
+ Path++;
+ NumSegments = (UINT32) (UINT8) *Path;
+ Path++;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Multi Pathname (%d Segments, Flags=%X) \n",
+ NumSegments, Flags));
+ break;
+
+ default:
+ /*
+ * Not a Null name, no Dual or Multi prefix, hence there is
+ * only one name segment and Pathname is already pointing to it.
+ */
+ NumSegments = 1;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Simple Pathname (1 segment, Flags=%X)\n", Flags));
+ break;
+ }
+
+ ACPI_DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Path));
+ }
+
+
+ /*
+ * Search namespace for each segment of the name. Loop through and
+ * verify (or add to the namespace) each name segment.
+ *
+ * The object type is significant only at the last name
+ * segment. (We don't care about the types along the path, only
+ * the type of the final target object.)
+ */
+ ThisSearchType = ACPI_TYPE_ANY;
+ CurrentNode = ThisNode;
+ while (NumSegments && CurrentNode)
+ {
+ NumSegments--;
+ if (!NumSegments)
+ {
+ /*
+ * This is the last segment, enable typechecking
+ */
+ ThisSearchType = Type;
+
+ /*
+ * Only allow automatic parent search (search rules) if the caller
+ * requested it AND we have a single, non-fully-qualified NameSeg
+ */
+ if ((SearchParentFlag != ACPI_NS_NO_UPSEARCH) &&
+ (Flags & ACPI_NS_SEARCH_PARENT))
+ {
+ LocalFlags |= ACPI_NS_SEARCH_PARENT;
+ }
+
+ /* Set error flag according to caller */
+
+ if (Flags & ACPI_NS_ERROR_IF_FOUND)
+ {
+ LocalFlags |= ACPI_NS_ERROR_IF_FOUND;
+ }
+ }
+
+ /* Extract one ACPI name from the front of the pathname */
+
+ ACPI_MOVE_32_TO_32 (&SimpleName, Path);
+
+ /* Try to find the single (4 character) ACPI name */
+
+ Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode,
+ InterpreterMode, ThisSearchType, LocalFlags, &ThisNode);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ /* Name not found in ACPI namespace */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Name [%4.4s] not found in scope [%4.4s] %p\n",
+ (char *) &SimpleName, (char *) &CurrentNode->Name,
+ CurrentNode));
+ }
+
+ *ReturnNode = ThisNode;
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Sanity typecheck of the target object:
+ *
+ * If 1) This is the last segment (NumSegments == 0)
+ * 2) And we are looking for a specific type
+ * (Not checking for TYPE_ANY)
+ * 3) Which is not an alias
+ * 4) Which is not a local type (TYPE_SCOPE)
+ * 5) And the type of target object is known (not TYPE_ANY)
+ * 6) And target object does not match what we are looking for
+ *
+ * Then we have a type mismatch. Just warn and ignore it.
+ */
+ if ((NumSegments == 0) &&
+ (TypeToCheckFor != ACPI_TYPE_ANY) &&
+ (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) &&
+ (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) &&
+ (ThisNode->Type != ACPI_TYPE_ANY) &&
+ (ThisNode->Type != TypeToCheckFor))
+ {
+ /* Complain about a type mismatch */
+
+ ACPI_REPORT_WARNING (
+ ("NsLookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
+ (char *) &SimpleName, AcpiUtGetTypeName (ThisNode->Type),
+ AcpiUtGetTypeName (TypeToCheckFor)));
+ }
+
+ /*
+ * If this is the last name segment and we are not looking for a
+ * specific type, but the type of found object is known, use that type
+ * to see if it opens a scope.
+ */
+ if ((NumSegments == 0) && (Type == ACPI_TYPE_ANY))
+ {
+ Type = ThisNode->Type;
+ }
+
+ /* Point to next name segment and make this node current */
+
+ Path += ACPI_NAME_SIZE;
+ CurrentNode = ThisNode;
+ }
+
+ /*
+ * Always check if we need to open a new scope
+ */
+ if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState))
+ {
+ /*
+ * If entry is a type which opens a scope, push the new scope on the
+ * scope stack.
+ */
+ if (AcpiNsOpensScope (Type))
+ {
+ Status = AcpiDsScopeStackPush (ThisNode, Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+
+ *ReturnNode = ThisNode;
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c
new file mode 100644
index 0000000..e221973
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsalloc.c
@@ -0,0 +1,800 @@
+/*******************************************************************************
+ *
+ * Module Name: nsalloc - Namespace allocation and deletion utilities
+ * $Revision: 82 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSALLOC_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsalloc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsCreateNode
+ *
+ * PARAMETERS: AcpiName - Name of the new node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a namespace node
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiNsCreateNode (
+ UINT32 Name)
+{
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE ("NsCreateNode");
+
+
+ Node = ACPI_MEM_CALLOCATE (sizeof (ACPI_NAMESPACE_NODE));
+ if (!Node)
+ {
+ return_PTR (NULL);
+ }
+
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalAllocated++);
+
+ Node->Name.Integer = Name;
+ Node->ReferenceCount = 1;
+ ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
+
+ return_PTR (Node);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDeleteNode
+ *
+ * PARAMETERS: Node - Node to be deleted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete a namespace node
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDeleteNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *PrevNode;
+ ACPI_NAMESPACE_NODE *NextNode;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
+
+
+ ParentNode = AcpiNsGetParentNode (Node);
+
+ PrevNode = NULL;
+ NextNode = ParentNode->Child;
+
+ /* Find the node that is the previous peer in the parent's child list */
+
+ while (NextNode != Node)
+ {
+ PrevNode = NextNode;
+ NextNode = PrevNode->Peer;
+ }
+
+ if (PrevNode)
+ {
+ /* Node is not first child, unlink it */
+
+ PrevNode->Peer = NextNode->Peer;
+ if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST;
+ }
+ }
+ else
+ {
+ /* Node is first child (has no previous peer) */
+
+ if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ /* No peers at all */
+
+ ParentNode->Child = NULL;
+ }
+ else
+ { /* Link peer list to parent */
+
+ ParentNode->Child = NextNode->Peer;
+ }
+ }
+
+
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+
+ /*
+ * Detach an object if there is one then delete the node
+ */
+ AcpiNsDetachObject (Node);
+ ACPI_MEM_FREE (Node);
+ return_VOID;
+}
+
+
+#ifdef ACPI_ALPHABETIC_NAMESPACE
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsCompareNames
+ *
+ * PARAMETERS: Name1 - First name to compare
+ * Name2 - Second name to compare
+ *
+ * RETURN: value from strncmp
+ *
+ * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
+ * underscore are forced to be alphabetically first.
+ *
+ ******************************************************************************/
+
+int
+AcpiNsCompareNames (
+ char *Name1,
+ char *Name2)
+{
+ char ReversedName1[ACPI_NAME_SIZE];
+ char ReversedName2[ACPI_NAME_SIZE];
+ UINT32 i;
+ UINT32 j;
+
+
+ /*
+ * Replace all instances of "underscore" with a value that is smaller so
+ * that all names that are prefixed with underscore(s) are alphabetically
+ * first.
+ *
+ * Reverse the name bytewise so we can just do a 32-bit compare instead
+ * of a strncmp.
+ */
+ for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--)
+ {
+ ReversedName1[j] = Name1[i];
+ if (Name1[i] == '_')
+ {
+ ReversedName1[j] = '*';
+ }
+
+ ReversedName2[j] = Name2[i];
+ if (Name2[i] == '_')
+ {
+ ReversedName2[j] = '*';
+ }
+ }
+
+ return (*(int *) ReversedName1 - *(int *) ReversedName2);
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInstallNode
+ *
+ * PARAMETERS: WalkState - Current state of the walk
+ * ParentNode - The parent of the new Node
+ * Node - The new Node to install
+ * Type - ACPI object type of the new Node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a new namespace node and install it amongst
+ * its peers.
+ *
+ * Note: Current namespace lookup is linear search. However, the
+ * nodes are linked in alphabetical order to 1) put all reserved
+ * names (start with underscore) first, and to 2) make a readable
+ * namespace dump.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsInstallNode (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *ParentNode, /* Parent */
+ ACPI_NAMESPACE_NODE *Node, /* New Child*/
+ ACPI_OBJECT_TYPE Type)
+{
+ UINT16 OwnerId = 0;
+ ACPI_NAMESPACE_NODE *ChildNode;
+#ifdef ACPI_ALPHABETIC_NAMESPACE
+
+ ACPI_NAMESPACE_NODE *PreviousChildNode;
+#endif
+
+
+ ACPI_FUNCTION_TRACE ("NsInstallNode");
+
+
+ /*
+ * Get the owner ID from the Walk state
+ * The owner ID is used to track table deletion and
+ * deletion of objects created by methods
+ */
+ if (WalkState)
+ {
+ OwnerId = WalkState->OwnerId;
+ }
+
+ /* Link the new entry into the parent and existing children */
+
+ ChildNode = ParentNode->Child;
+ if (!ChildNode)
+ {
+ ParentNode->Child = Node;
+ Node->Flags |= ANOBJ_END_OF_PEER_LIST;
+ Node->Peer = ParentNode;
+ }
+ else
+ {
+#ifdef ACPI_ALPHABETIC_NAMESPACE
+ /*
+ * Walk the list whilst searching for the the correct
+ * alphabetic placement.
+ */
+ PreviousChildNode = NULL;
+ while (AcpiNsCompareNames (ChildNode->Name.Ascii, Node->Name.Ascii) < 0)
+ {
+ if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ /* Last peer; Clear end-of-list flag */
+
+ ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST;
+
+ /* This node is the new peer to the child node */
+
+ ChildNode->Peer = Node;
+
+ /* This node is the new end-of-list */
+
+ Node->Flags |= ANOBJ_END_OF_PEER_LIST;
+ Node->Peer = ParentNode;
+ break;
+ }
+
+ /* Get next peer */
+
+ PreviousChildNode = ChildNode;
+ ChildNode = ChildNode->Peer;
+ }
+
+ /* Did the node get inserted at the end-of-list? */
+
+ if (!(Node->Flags & ANOBJ_END_OF_PEER_LIST))
+ {
+ /*
+ * Loop above terminated without reaching the end-of-list.
+ * Insert the new node at the current location
+ */
+ if (PreviousChildNode)
+ {
+ /* Insert node alphabetically */
+
+ Node->Peer = ChildNode;
+ PreviousChildNode->Peer = Node;
+ }
+ else
+ {
+ /* Insert node alphabetically at start of list */
+
+ Node->Peer = ChildNode;
+ ParentNode->Child = Node;
+ }
+ }
+#else
+ while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST))
+ {
+ ChildNode = ChildNode->Peer;
+ }
+
+ ChildNode->Peer = Node;
+
+ /* Clear end-of-list flag */
+
+ ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST;
+ Node->Flags |= ANOBJ_END_OF_PEER_LIST;
+ Node->Peer = ParentNode;
+#endif
+ }
+
+ /* Init the new entry */
+
+ Node->OwnerId = OwnerId;
+ Node->Type = (UINT8) Type;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s (%s) added to %4.4s (%s) %p at %p\n",
+ Node->Name.Ascii, AcpiUtGetTypeName (Node->Type),
+ ParentNode->Name.Ascii, AcpiUtGetTypeName (ParentNode->Type), ParentNode, Node));
+
+ /*
+ * Increment the reference count(s) of all parents up to
+ * the root!
+ */
+ while ((Node = AcpiNsGetParentNode (Node)) != NULL)
+ {
+ Node->ReferenceCount++;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDeleteChildren
+ *
+ * PARAMETERS: ParentNode - Delete this objects children
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete all children of the parent object. In other words,
+ * deletes a "scope".
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDeleteChildren (
+ ACPI_NAMESPACE_NODE *ParentNode)
+{
+ ACPI_NAMESPACE_NODE *ChildNode;
+ ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *Node;
+ UINT8 Flags;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
+
+
+ if (!ParentNode)
+ {
+ return_VOID;
+ }
+
+ /* If no children, all done! */
+
+ ChildNode = ParentNode->Child;
+ if (!ChildNode)
+ {
+ return_VOID;
+ }
+
+ /*
+ * Deallocate all children at this level
+ */
+ do
+ {
+ /* Get the things we need */
+
+ NextNode = ChildNode->Peer;
+ Flags = ChildNode->Flags;
+
+ /* Grandchildren should have all been deleted already */
+
+ if (ChildNode->Child)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
+ ParentNode, ChildNode));
+ }
+
+ /* Now we can free this child object */
+
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
+ ChildNode, AcpiGbl_CurrentNodeCount));
+
+ /*
+ * Detach an object if there is one, then free the child node
+ */
+ AcpiNsDetachObject (ChildNode);
+
+ /*
+ * Decrement the reference count(s) of all parents up to
+ * the root! (counts were incremented when the node was created)
+ */
+ Node = ChildNode;
+ while ((Node = AcpiNsGetParentNode (Node)) != NULL)
+ {
+ Node->ReferenceCount--;
+ }
+
+ /* There should be only one reference remaining on this node */
+
+ if (ChildNode->ReferenceCount != 1)
+ {
+ ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
+ ChildNode->ReferenceCount, ChildNode));
+ }
+
+ /* Now we can delete the node */
+
+ ACPI_MEM_FREE (ChildNode);
+
+ /* And move on to the next child in the list */
+
+ ChildNode = NextNode;
+
+ } while (!(Flags & ANOBJ_END_OF_PEER_LIST));
+
+
+ /* Clear the parent's child pointer */
+
+ ParentNode->Child = NULL;
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDeleteNamespaceSubtree
+ *
+ * PARAMETERS: ParentNode - Root of the subtree to be deleted
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete a subtree of the namespace. This includes all objects
+ * stored within the subtree.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDeleteNamespaceSubtree (
+ ACPI_NAMESPACE_NODE *ParentNode)
+{
+ ACPI_NAMESPACE_NODE *ChildNode = NULL;
+ UINT32 Level = 1;
+
+
+ ACPI_FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
+
+
+ if (!ParentNode)
+ {
+ return_VOID;
+ }
+
+ /*
+ * Traverse the tree of objects until we bubble back up
+ * to where we started.
+ */
+ while (Level > 0)
+ {
+ /* Get the next node in this scope (NULL if none) */
+
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode,
+ ChildNode);
+ if (ChildNode)
+ {
+ /* Found a child node - detach any attached object */
+
+ AcpiNsDetachObject (ChildNode);
+
+ /* Check if this node has any children */
+
+ if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, 0))
+ {
+ /*
+ * There is at least one child of this node,
+ * visit the node
+ */
+ Level++;
+ ParentNode = ChildNode;
+ ChildNode = 0;
+ }
+ }
+ else
+ {
+ /*
+ * No more children of this parent node.
+ * Move up to the grandparent.
+ */
+ Level--;
+
+ /*
+ * Now delete all of the children of this parent
+ * all at the same time.
+ */
+ AcpiNsDeleteChildren (ParentNode);
+
+ /* New "last child" is this parent node */
+
+ ChildNode = ParentNode;
+
+ /* Move up the tree to the grandparent */
+
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsRemoveReference
+ *
+ * PARAMETERS: Node - Named node whose reference count is to be
+ * decremented
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Remove a Node reference. Decrements the reference count
+ * of all parent Nodes up to the root. Any node along
+ * the way that reaches zero references is freed.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsRemoveReference (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *ThisNode;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Decrement the reference count(s) of this node and all
+ * nodes up to the root, Delete anything with zero remaining references.
+ */
+ ThisNode = Node;
+ while (ThisNode)
+ {
+ /* Prepare to move up to parent */
+
+ ParentNode = AcpiNsGetParentNode (ThisNode);
+
+ /* Decrement the reference count on this node */
+
+ ThisNode->ReferenceCount--;
+
+ /* Delete the node if no more references */
+
+ if (!ThisNode->ReferenceCount)
+ {
+ /* Delete all children and delete the node */
+
+ AcpiNsDeleteChildren (ThisNode);
+ AcpiNsDeleteNode (ThisNode);
+ }
+
+ ThisNode = ParentNode;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDeleteNamespaceByOwner
+ *
+ * PARAMETERS: OwnerId - All nodes with this owner will be deleted
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete entries within the namespace that are owned by a
+ * specific ID. Used to delete entire ACPI tables. All
+ * reference counts are updated.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDeleteNamespaceByOwner (
+ UINT16 OwnerId)
+{
+ ACPI_NAMESPACE_NODE *ChildNode;
+ ACPI_NAMESPACE_NODE *DeletionNode;
+ UINT32 Level;
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("NsDeleteNamespaceByOwner", OwnerId);
+
+
+ ParentNode = AcpiGbl_RootNode;
+ ChildNode = NULL;
+ DeletionNode = NULL;
+ Level = 1;
+
+ /*
+ * Traverse the tree of nodes until we bubble back up
+ * to where we started.
+ */
+ while (Level > 0)
+ {
+ /*
+ * Get the next child of this parent node. When ChildNode is NULL,
+ * the first child of the parent is returned
+ */
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+
+ if (DeletionNode)
+ {
+ AcpiNsRemoveReference (DeletionNode);
+ DeletionNode = NULL;
+ }
+
+ if (ChildNode)
+ {
+ if (ChildNode->OwnerId == OwnerId)
+ {
+ /* Found a matching child node - detach any attached object */
+
+ AcpiNsDetachObject (ChildNode);
+ }
+
+ /* Check if this node has any children */
+
+ if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
+ {
+ /*
+ * There is at least one child of this node,
+ * visit the node
+ */
+ Level++;
+ ParentNode = ChildNode;
+ ChildNode = NULL;
+ }
+ else if (ChildNode->OwnerId == OwnerId)
+ {
+ DeletionNode = ChildNode;
+ }
+ }
+ else
+ {
+ /*
+ * No more children of this parent node.
+ * Move up to the grandparent.
+ */
+ Level--;
+ if (Level != 0)
+ {
+ if (ParentNode->OwnerId == OwnerId)
+ {
+ DeletionNode = ParentNode;
+ }
+ }
+
+ /* New "last child" is this parent node */
+
+ ChildNode = ParentNode;
+
+ /* Move up the tree to the grandparent */
+
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+ }
+
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c
new file mode 100644
index 0000000..085565d
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsdump.c
@@ -0,0 +1,776 @@
+/******************************************************************************
+ *
+ * Module Name: nsdump - table dumping routines for debug
+ * $Revision: 151 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSDUMP_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acparser.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsdump")
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsPrintPathname
+ *
+ * PARAMETERS: NumSegment - Number of ACPI name segments
+ * Pathname - The compressed (internal) path
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ *
+ ******************************************************************************/
+
+void
+AcpiNsPrintPathname (
+ UINT32 NumSegments,
+ char *Pathname)
+{
+ ACPI_FUNCTION_NAME ("NsPrintPathname");
+
+
+ if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
+ {
+ return;
+ }
+
+ /* Print the entire name */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+
+ while (NumSegments)
+ {
+ AcpiOsPrintf ("%4.4s", Pathname);
+ Pathname += ACPI_NAME_SIZE;
+
+ NumSegments--;
+ if (NumSegments)
+ {
+ AcpiOsPrintf (".");
+ }
+ }
+
+ AcpiOsPrintf ("]\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpPathname
+ *
+ * PARAMETERS: Handle - Object
+ * Msg - Prefix message
+ * Level - Desired debug level
+ * Component - Caller's component ID
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ * Manages allocation/freeing of a pathname buffer
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpPathname (
+ ACPI_HANDLE Handle,
+ char *Msg,
+ UINT32 Level,
+ UINT32 Component)
+{
+
+ ACPI_FUNCTION_TRACE ("NsDumpPathname");
+
+
+ /* Do this only if the requested debug level and component are enabled */
+
+ if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
+ {
+ return_VOID;
+ }
+
+ /* Convert handle to a full pathname and print it (with supplied message) */
+
+ AcpiNsPrintNodePathname (Handle, Msg);
+ AcpiOsPrintf ("\n");
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpOneObject
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * Level - Nesting level of the handle
+ * Context - Passed into WalkNamespace
+ *
+ * DESCRIPTION: Dump a single Node
+ * This procedure is a UserFunction called by AcpiNsWalkNamespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsDumpOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
+ ACPI_NAMESPACE_NODE *ThisNode;
+ ACPI_OPERAND_OBJECT *ObjDesc = NULL;
+ ACPI_OBJECT_TYPE ObjType;
+ ACPI_OBJECT_TYPE Type;
+ UINT32 BytesToDump;
+ UINT32 DbgLevel;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_NAME ("NsDumpOneObject");
+
+
+ /* Is output enabled? */
+
+ if (!(AcpiDbgLevel & Info->DebugLevel))
+ {
+ return (AE_OK);
+ }
+
+ if (!ObjHandle)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
+ return (AE_OK);
+ }
+
+ ThisNode = AcpiNsMapHandleToNode (ObjHandle);
+ Type = ThisNode->Type;
+
+ /* Check if the owner matches */
+
+ if ((Info->OwnerId != ACPI_UINT32_MAX) &&
+ (Info->OwnerId != ThisNode->OwnerId))
+ {
+ return (AE_OK);
+ }
+
+ /* Indent the object according to the level */
+
+ AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
+
+ /* Check the node type and name */
+
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
+ }
+
+ if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
+ {
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name.Integer));
+ }
+
+ /*
+ * Now we can print out the pertinent information
+ */
+ AcpiOsPrintf ("%4.4s %-12s %p ",
+ ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode);
+
+ DbgLevel = AcpiDbgLevel;
+ AcpiDbgLevel = 0;
+ ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ AcpiDbgLevel = DbgLevel;
+
+ switch (Info->DisplayType)
+ {
+ case ACPI_DISPLAY_SUMMARY:
+
+ if (!ObjDesc)
+ {
+ /* No attached object, we are done */
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+ }
+
+ switch (Type)
+ {
+ case ACPI_TYPE_PROCESSOR:
+
+ AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
+ ObjDesc->Processor.ProcId,
+ ObjDesc->Processor.Length,
+ (char *) ObjDesc->Processor.Address);
+ break;
+
+
+ case ACPI_TYPE_DEVICE:
+
+ AcpiOsPrintf ("Notify object: %p", ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
+ (UINT32) ObjDesc->Method.ParamCount,
+ ObjDesc->Method.AmlLength,
+ ObjDesc->Method.AmlStart);
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf ("= %8.8X%8.8X\n",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ AcpiOsPrintf ("Elements %.2X\n",
+ ObjDesc->Package.Count);
+ }
+ else
+ {
+ AcpiOsPrintf ("[Length not yet evaluated]\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ AcpiOsPrintf ("Len %.2X",
+ ObjDesc->Buffer.Length);
+
+ /* Dump some of the buffer */
+
+ if (ObjDesc->Buffer.Length > 0)
+ {
+ AcpiOsPrintf (" =");
+ for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
+ {
+ AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
+ }
+ }
+ AcpiOsPrintf ("\n");
+ }
+ else
+ {
+ AcpiOsPrintf ("[Length not yet evaluated]\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
+ AcpiUtPrintString (ObjDesc->String.Pointer, 32);
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_REGION:
+
+ AcpiOsPrintf ("[%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
+ if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
+ {
+ AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
+ ACPI_HIDWORD (ObjDesc->Region.Address),
+ ACPI_LODWORD (ObjDesc->Region.Address),
+ ObjDesc->Region.Length);
+ }
+ else
+ {
+ AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ AcpiOsPrintf ("[%s]\n",
+ AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ if (ObjDesc->BufferField.BufferObj &&
+ ObjDesc->BufferField.BufferObj->Buffer.Node)
+ {
+ AcpiOsPrintf ("Buf [%4.4s]",
+ ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii);
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+
+ AcpiOsPrintf ("Rgn [%4.4s]",
+ ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+ AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
+ ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii,
+ ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
+ ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii,
+ ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_ALIAS:
+
+ AcpiOsPrintf ("Target %4.4s (%p)\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Name.Ascii, ObjDesc);
+ break;
+
+ default:
+
+ AcpiOsPrintf ("Object %p\n", ObjDesc);
+ break;
+ }
+
+ /* Common field handling */
+
+ switch (Type)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2hd\n",
+ (ObjDesc->CommonField.BaseByteOffset * 8)
+ + ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.BitLength,
+ ObjDesc->CommonField.AccessByteWidth);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+
+ case ACPI_DISPLAY_OBJECTS:
+
+ AcpiOsPrintf ("O:%p", ObjDesc);
+ if (!ObjDesc)
+ {
+ /* No attached object, we are done */
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+ }
+
+ AcpiOsPrintf ("(R%d)",
+ ObjDesc->Common.ReferenceCount);
+
+ switch (Type)
+ {
+ case ACPI_TYPE_METHOD:
+
+ /* Name is a Method and its AML offset/length are set */
+
+ AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength);
+ break;
+
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
+ ObjDesc->String.Length);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length);
+ break;
+
+ default:
+
+ AcpiOsPrintf ("\n");
+ break;
+ }
+ break;
+
+
+ default:
+ AcpiOsPrintf ("\n");
+ break;
+ }
+
+ /* If debug turned off, done */
+
+ if (!(AcpiDbgLevel & ACPI_LV_VALUES))
+ {
+ return (AE_OK);
+ }
+
+
+ /* If there is an attached object, display it */
+
+ DbgLevel = AcpiDbgLevel;
+ AcpiDbgLevel = 0;
+ ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ AcpiDbgLevel = DbgLevel;
+
+ /* Dump attached objects */
+
+ while (ObjDesc)
+ {
+ ObjType = ACPI_TYPE_INVALID;
+ AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
+
+ /* Decode the type of attached object and dump the contents */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+
+ AcpiOsPrintf ("(Ptr to Node)\n");
+ BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
+ break;
+
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
+
+ if (ObjType > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType);
+ BytesToDump = 32;
+ }
+ else
+ {
+ AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n",
+ AcpiUtGetTypeName (ObjType), ObjType);
+ BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n");
+ BytesToDump = 16;
+ break;
+ }
+
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
+
+ /* If value is NOT an internal object, we are done */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ goto Cleanup;
+ }
+
+ /*
+ * Valid object, get the pointer to next level, if any
+ */
+ switch (ObjType)
+ {
+ case ACPI_TYPE_STRING:
+ ObjDesc = (void *) ObjDesc->String.Pointer;
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ ObjDesc = (void *) ObjDesc->Buffer.Pointer;
+ break;
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ ObjDesc = (void *) ObjDesc->Package.Elements;
+ break;
+
+ case ACPI_TYPE_METHOD:
+ ObjDesc = (void *) ObjDesc->Method.AmlStart;
+ break;
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ ObjDesc = (void *) ObjDesc->Field.RegionObj;
+ break;
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ ObjDesc = (void *) ObjDesc->BankField.RegionObj;
+ break;
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
+ break;
+
+ default:
+ goto Cleanup;
+ }
+
+ ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
+ }
+
+Cleanup:
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpObjects
+ *
+ * PARAMETERS: Type - Object type to be dumped
+ * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
+ * for an effectively unlimited depth.
+ * OwnerId - Dump only objects owned by this ID. Use
+ * ACPI_UINT32_MAX to match all owners.
+ * StartHandle - Where in namespace to start/end search
+ *
+ * DESCRIPTION: Dump typed objects within the loaded namespace.
+ * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpObjects (
+ ACPI_OBJECT_TYPE Type,
+ UINT8 DisplayType,
+ UINT32 MaxDepth,
+ UINT32 OwnerId,
+ ACPI_HANDLE StartHandle)
+{
+ ACPI_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Info.DebugLevel = ACPI_LV_TABLES;
+ Info.OwnerId = OwnerId;
+ Info.DisplayType = DisplayType;
+
+
+ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
+ ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
+ (void *) &Info, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpTables
+ *
+ * PARAMETERS: SearchBase - Root of subtree to be dumped, or
+ * NS_ALL to dump the entire namespace
+ * MaxDepth - Maximum depth of dump. Use INT_MAX
+ * for an effectively unlimited depth.
+ *
+ * DESCRIPTION: Dump the name space, or a portion of it.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpTables (
+ ACPI_HANDLE SearchBase,
+ UINT32 MaxDepth)
+{
+ ACPI_HANDLE SearchHandle = SearchBase;
+
+
+ ACPI_FUNCTION_TRACE ("NsDumpTables");
+
+
+ if (!AcpiGbl_RootNode)
+ {
+ /*
+ * If the name space has not been initialized,
+ * there is nothing to dump.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
+ return_VOID;
+ }
+
+ if (ACPI_NS_ALL == SearchBase)
+ {
+ /* entire namespace */
+
+ SearchHandle = AcpiGbl_RootNode;
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
+ }
+
+
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
+ ACPI_UINT32_MAX, SearchHandle);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpEntry
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * DebugLevel - Output level
+ *
+ * DESCRIPTION: Dump a single Node
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpEntry (
+ ACPI_HANDLE Handle,
+ UINT32 DebugLevel)
+{
+ ACPI_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Info.DebugLevel = DebugLevel;
+ Info.OwnerId = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY;
+
+ (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/nsdumpdv.c b/sys/contrib/dev/acpica/nsdumpdv.c
new file mode 100644
index 0000000..702b1d1
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsdumpdv.c
@@ -0,0 +1,224 @@
+/******************************************************************************
+ *
+ * Module Name: nsdump - table dumping routines for debug
+ * $Revision: 8 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSDUMPDV_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsdumpdv")
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpOneDevice
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * Level - Nesting level of the handle
+ * Context - Passed into WalkNamespace
+ *
+ * DESCRIPTION: Dump a single Node that represents a device
+ * This procedure is a UserFunction called by AcpiNsWalkNamespace.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsDumpOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_BUFFER Buffer;
+ ACPI_DEVICE_INFO *Info;
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_NAME ("NsDumpOneDevice");
+
+
+ Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info = Buffer.Pointer;
+ for (i = 0; i < Level; i++)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
+ Info->HardwareId.Value,
+ ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address),
+ Info->CurrentStatus));
+ ACPI_MEM_FREE (Info);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpRootDevices
+ *
+ * PARAMETERS: None
+ *
+ * DESCRIPTION: Dump all objects of type "device"
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpRootDevices (void)
+{
+ ACPI_HANDLE SysBusHandle;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME ("NsDumpRootDevices");
+
+
+ /* Only dump the table if tracing is enabled */
+
+ if (!(ACPI_LV_TABLES & AcpiDbgLevel))
+ {
+ return;
+ }
+
+ Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ AcpiNsDumpOneDevice, NULL, NULL);
+}
+
+#endif
+
+
diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c
new file mode 100644
index 0000000..e325a7b
--- /dev/null
+++ b/sys/contrib/dev/acpica/nseval.c
@@ -0,0 +1,614 @@
+/*******************************************************************************
+ *
+ * Module Name: nseval - Object evaluation interfaces -- includes control
+ * method lookup and execution.
+ * $Revision: 121 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSEVAL_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nseval")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsEvaluateRelative
+ *
+ * PARAMETERS: Handle - The relative containing object
+ * Pathname - Name of method to execute, If NULL, the
+ * handle is the object to execute
+ * Params - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and execute the requested method using the handle as a
+ * scope
+ *
+ * MUTEX: Locks Namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsEvaluateRelative (
+ ACPI_NAMESPACE_NODE *Handle,
+ char *Pathname,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject)
+{
+ ACPI_NAMESPACE_NODE *PrefixNode;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = NULL;
+ char *InternalPath = NULL;
+ ACPI_GENERIC_STATE ScopeInfo;
+
+
+ ACPI_FUNCTION_TRACE ("NsEvaluateRelative");
+
+
+ /*
+ * Must have a valid object handle
+ */
+ if (!Handle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Build an internal name string for the method */
+
+ Status = AcpiNsInternalizeName (Pathname, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the prefix handle and Node */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ PrefixNode = AcpiNsMapHandleToNode (Handle);
+ if (!PrefixNode)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AE_BAD_PARAMETER;
+ goto Cleanup;
+ }
+
+ /* Lookup the name in the namespace */
+
+ ScopeInfo.Scope.Node = PrefixNode;
+ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+ &Node);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
+ Pathname, AcpiFormatException (Status)));
+ goto Cleanup;
+ }
+
+ /*
+ * Now that we have a handle to the object, we can attempt
+ * to evaluate it.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+ Pathname, Node, AcpiNsGetAttachedObject (Node)));
+
+ Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
+ Pathname));
+
+Cleanup:
+
+ ACPI_MEM_FREE (InternalPath);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsEvaluateByName
+ *
+ * PARAMETERS: Pathname - Fully qualified pathname to the object
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * Params - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and execute the requested method passing the given
+ * parameters
+ *
+ * MUTEX: Locks Namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsEvaluateByName (
+ char *Pathname,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = NULL;
+ char *InternalPath = NULL;
+
+
+ ACPI_FUNCTION_TRACE ("NsEvaluateByName");
+
+
+ /* Build an internal name string for the method */
+
+ Status = AcpiNsInternalizeName (Pathname, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Lookup the name in the namespace */
+
+ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+ &Node);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n",
+ Pathname, Status));
+ goto Cleanup;
+ }
+
+ /*
+ * Now that we have a handle to the object, we can attempt
+ * to evaluate it.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+ Pathname, Node, AcpiNsGetAttachedObject (Node)));
+
+ Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
+ Pathname));
+
+
+Cleanup:
+
+ /* Cleanup */
+
+ if (InternalPath)
+ {
+ ACPI_MEM_FREE (InternalPath);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsEvaluateByHandle
+ *
+ * PARAMETERS: Handle - Method Node to execute
+ * Params - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute the requested method passing the given parameters
+ *
+ * MUTEX: Locks Namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsEvaluateByHandle (
+ ACPI_NAMESPACE_NODE *Handle,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObject)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *LocalReturnObject;
+
+
+ ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
+
+
+ /* Check if namespace has been initialized */
+
+ if (!AcpiGbl_RootNode)
+ {
+ return_ACPI_STATUS (AE_NO_NAMESPACE);
+ }
+
+ /* Parameter Validation */
+
+ if (!Handle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (ReturnObject)
+ {
+ /* Initialize the return value to an invalid object */
+
+ *ReturnObject = NULL;
+ }
+
+ /* Get the prefix handle and Node */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (Handle);
+ if (!Node)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Two major cases here:
+ * 1) The object is an actual control method -- execute it.
+ * 2) The object is not a method -- just return it's current
+ * value
+ *
+ * In both cases, the namespace is unlocked by the
+ * AcpiNs* procedure
+ */
+ if (AcpiNsGetType (Node) == ACPI_TYPE_METHOD)
+ {
+ /*
+ * Case 1) We have an actual control method to execute
+ */
+ Status = AcpiNsExecuteControlMethod (Node, Params,
+ &LocalReturnObject);
+ }
+ else
+ {
+ /*
+ * Case 2) Object is NOT a method, just return its
+ * current value
+ */
+ Status = AcpiNsGetObjectValue (Node, &LocalReturnObject);
+ }
+
+ /*
+ * Check if there is a return value on the stack that must
+ * be dealt with
+ */
+ if (Status == AE_CTRL_RETURN_VALUE)
+ {
+ /*
+ * If the Method returned a value and the caller
+ * provided a place to store a returned value, Copy
+ * the returned value to the object descriptor provided
+ * by the caller.
+ */
+ if (ReturnObject)
+ {
+ /*
+ * Valid return object, copy the pointer to
+ * the returned object
+ */
+ *ReturnObject = LocalReturnObject;
+ }
+
+ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
+
+ Status = AE_OK;
+ }
+
+ /*
+ * Namespace was unlocked by the handling AcpiNs* function,
+ * so we just return
+ */
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsExecuteControlMethod
+ *
+ * PARAMETERS: MethodNode - The method to execute
+ * Params - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ * ReturnObjDesc - List of result objects to be returned
+ * from the method.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute the requested method passing the given parameters
+ *
+ * MUTEX: Assumes namespace is locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsExecuteControlMethod (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("NsExecuteControlMethod");
+
+
+ /* Verify that there is a method associated with this object */
+
+ ObjDesc = AcpiNsGetAttachedObject (MethodNode);
+ if (!ObjDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ ACPI_DUMP_PATHNAME (MethodNode, "Execute Method:",
+ ACPI_LV_INFO, _COMPONENT);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
+ ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1));
+
+ /*
+ * Unlock the namespace before execution. This allows namespace access
+ * via the external Acpi* interfaces while a method is being executed.
+ * However, any namespace deletion must acquire both the namespace and
+ * interpreter locks to ensure that no thread is using the portion of the
+ * namespace that is being deleted.
+ */
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Execute the method via the interpreter. The interpreter is locked
+ * here before calling into the AML parser
+ */
+ Status = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiPsxExecute (MethodNode, Params, ReturnObjDesc);
+ AcpiExExitInterpreter ();
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetObjectValue
+ *
+ * PARAMETERS: Node - The object
+ * ReturnObjDesc - Where the objects value is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return the current value of the object
+ *
+ * MUTEX: Assumes namespace is locked, leaves namespace unlocked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsGetObjectValue (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_NAMESPACE_NODE *ResolvedNode = Node;
+
+
+ ACPI_FUNCTION_TRACE ("NsGetObjectValue");
+
+
+ /*
+ * Objects require additional resolution steps (e.g., the
+ * Node may be a field that must be read, etc.) -- we can't just grab
+ * the object out of the node.
+ */
+
+ /*
+ * Use ResolveNodeToValue() to get the associated value. This call
+ * always deletes ObjDesc (allocated above).
+ *
+ * NOTE: we can get away with passing in NULL for a walk state
+ * because ObjDesc is guaranteed to not be a reference to either
+ * a method local or a method argument (because this interface can only be
+ * called from the AcpiEvaluate external interface, never called from
+ * a running control method.)
+ *
+ * Even though we do not directly invoke the interpreter
+ * for this, we must enter it because we could access an opregion.
+ * The opregion access code assumes that the interpreter
+ * is locked.
+ *
+ * We must release the namespace lock before entering the
+ * intepreter.
+ */
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiExEnterInterpreter ();
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL);
+ /*
+ * If AcpiExResolveNodeToValue() succeeded, the return value was
+ * placed in ResolvedNode.
+ */
+ AcpiExExitInterpreter ();
+
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AE_CTRL_RETURN_VALUE;
+ *ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode);
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
+ *ReturnObjDesc, AcpiUtGetObjectTypeName (*ReturnObjDesc)));
+ }
+ }
+
+ /* Namespace is unlocked */
+
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c
new file mode 100644
index 0000000..87cae8d
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsinit.c
@@ -0,0 +1,513 @@
+/******************************************************************************
+ *
+ * Module Name: nsinit - namespace initialization
+ * $Revision: 55 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSXFINIT_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsinit")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInitializeObjects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk the entire namespace and perform any necessary
+ * initialization on the objects found therein
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsInitializeObjects (
+ void)
+{
+ ACPI_STATUS Status;
+ ACPI_INIT_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE ("NsInitializeObjects");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "**** Starting initialization of namespace objects ****\n"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:"));
+
+ /* Set all init info to zero */
+
+ ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
+
+ /* Walk entire namespace from the supplied root */
+
+ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiNsInitOneObject,
+ &Info, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
+ AcpiFormatException (Status)));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+ "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
+ Info.OpRegionInit, Info.OpRegionCount,
+ Info.FieldInit, Info.FieldCount,
+ Info.BufferInit, Info.BufferCount,
+ Info.PackageInit, Info.PackageCount, Info.ObjectCount));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "%hd Control Methods found\n", Info.MethodCount));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "%hd Op Regions found\n", Info.OpRegionCount));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInitializeDevices
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices.
+ * This means running _INI on all present devices.
+ *
+ * Note: We install PCI config space handler on region access,
+ * not here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsInitializeDevices (
+ void)
+{
+ ACPI_STATUS Status;
+ ACPI_DEVICE_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE ("NsInitializeDevices");
+
+
+ /* Init counters */
+
+ Info.DeviceCount = 0;
+ Info.Num_STA = 0;
+ Info.Num_INI = 0;
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:"));
+
+ /* Walk namespace for all objects of type Device */
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
+ AcpiFormatException (Status)));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+ "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
+ Info.DeviceCount, Info.Num_STA, Info.Num_INI));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInitOneObject
+ *
+ * PARAMETERS: ObjHandle - Node
+ * Level - Current nesting level
+ * Context - Points to a init info struct
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
+ * within the namespace.
+ *
+ * Currently, the only objects that require initialization are:
+ * 1) Methods
+ * 2) Op Regions
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OBJECT_TYPE Type;
+ ACPI_STATUS Status;
+ ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_NAME ("NsInitOneObject");
+
+
+ Info->ObjectCount++;
+
+ /* And even then, we are only interested in a few object types */
+
+ Type = AcpiNsGetType (ObjHandle);
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ return (AE_OK);
+ }
+
+ /* Increment counters for object types we are looking for */
+
+ switch (Type)
+ {
+ case ACPI_TYPE_REGION:
+ Info->OpRegionCount++;
+ break;
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ Info->FieldCount++;
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Info->BufferCount++;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ Info->PackageCount++;
+ break;
+
+ default:
+
+ /* No init required, just exit now */
+ return (AE_OK);
+ }
+
+ /*
+ * If the object is already initialized, nothing else to do
+ */
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Must lock the interpreter before executing AML code
+ */
+ Status = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * Each of these types can contain executable AML code within
+ * the declaration.
+ */
+ switch (Type)
+ {
+ case ACPI_TYPE_REGION:
+
+ Info->OpRegionInit++;
+ Status = AcpiDsGetRegionArguments (ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ Info->FieldInit++;
+ Status = AcpiDsGetBufferFieldArguments (ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ Info->BufferInit++;
+ Status = AcpiDsGetBufferArguments (ObjDesc);
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ Info->PackageInit++;
+ Status = AcpiDsGetPackageArguments (ObjDesc);
+ break;
+
+ default:
+ /* No other types can get here */
+ break;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not execute arguments for [%4.4s] (%s), %s\n",
+ Node->Name.Ascii, AcpiUtGetTypeName (Type), AcpiFormatException (Status)));
+ }
+
+ /* Print a dot for each object unless we are going to print the entire pathname */
+
+ if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ }
+
+ /*
+ * We ignore errors from above, and always return OK, since
+ * we don't want to abort the walk on any single error.
+ */
+ AcpiExExitInterpreter ();
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInitOneDevice
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: This is called once per device soon after ACPI is enabled
+ * to initialize each device. It determines if the device is
+ * present, and if so, calls _INI.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsInitOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ UINT32 Flags;
+ ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context;
+
+
+ ACPI_FUNCTION_TRACE ("NsInitOneDevice");
+
+
+ if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) && (!(AcpiDbgLevel & ACPI_LV_INFO)))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ }
+
+ Info->DeviceCount++;
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ if (!Node)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Run _STA to determine if we can run _INI on the device.
+ */
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Node, "_STA"));
+ Status = AcpiUtExecute_STA (Node, &Flags);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Ignore error and move on to next device */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ Info->Num_STA++;
+
+ if (!(Flags & 0x01))
+ {
+ /* don't look at children of a not present device */
+
+ return_ACPI_STATUS(AE_CTRL_DEPTH);
+ }
+
+ /*
+ * The device is present. Run _INI.
+ */
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, ObjHandle, "_INI"));
+ Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ /* No _INI (AE_NOT_FOUND) means device requires no initialization */
+
+ if (Status != AE_NOT_FOUND)
+ {
+ /* Ignore error and move on to next device */
+
+ #ifdef ACPI_DEBUG_OUTPUT
+ char *ScopeName = AcpiNsGetExternalPathname (ObjHandle);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
+ ScopeName, AcpiFormatException (Status)));
+
+ ACPI_MEM_FREE (ScopeName);
+ #endif
+ }
+
+ Status = AE_OK;
+ }
+ else
+ {
+ /* Count of successful INIs */
+
+ Info->Num_INI++;
+ }
+
+ if (AcpiGbl_InitHandler)
+ {
+ /* External initialization handler is present, call it */
+
+ Status = AcpiGbl_InitHandler (ObjHandle, ACPI_INIT_DEVICE_INI);
+ }
+
+
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c
new file mode 100644
index 0000000..5cd5d43
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsload.c
@@ -0,0 +1,553 @@
+/******************************************************************************
+ *
+ * Module Name: nsload - namespace loading/expanding/contracting procedures
+ * $Revision: 66 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSLOAD_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsload")
+
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsLoadTable
+ *
+ * PARAMETERS: TableDesc - Descriptor for table to be loaded
+ * Node - Owning NS node
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load one ACPI table into the namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsLoadTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("NsLoadTable");
+
+
+ /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
+
+ if (!(AcpiGbl_TableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
+ {
+ /* Just ignore this table */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Check validity of the AML start and length */
+
+ if (!TableDesc->AmlStart)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart));
+
+ /* Ignore table if there is no AML contained within */
+
+ if (!TableDesc->AmlLength)
+ {
+ ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", TableDesc->Pointer->Signature));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Parse the table and load the namespace with all named
+ * objects found within. Control methods are NOT parsed
+ * at this time. In fact, the control methods cannot be
+ * parsed until the entire namespace is loaded, because
+ * if a control method makes a forward reference (call)
+ * to another control method, we can't continue parsing
+ * because we don't know how many arguments to parse next!
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiNsParseTable (TableDesc, Node->Child);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Now we can parse the control methods. We always parse
+ * them here for a sanity check, and if configured for
+ * just-in-time parsing, we delete the control method
+ * parse trees.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Begin Table Method Parsing and Object Initialization ****\n"));
+
+ Status = AcpiDsInitializeObjects (TableDesc, Node);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Completed Table Method Parsing and Object Initialization ****\n"));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsLoadTableByType
+ *
+ * PARAMETERS: TableType - Id of the table type to load
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table or tables into the namespace. All tables
+ * of the given type are loaded. The mechanism allows this
+ * routine to be called repeatedly.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsLoadTableByType (
+ ACPI_TABLE_TYPE TableType)
+{
+ UINT32 i;
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ ACPI_FUNCTION_TRACE ("NsLoadTableByType");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Table types supported are:
+ * DSDT (one), SSDT/PSDT (multiple)
+ */
+ switch (TableType)
+ {
+ case ACPI_TABLE_DSDT:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next;
+
+ /* If table already loaded into namespace, just return */
+
+ if (TableDesc->LoadedIntoNamespace)
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Now load the single DSDT */
+
+ Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
+ if (ACPI_SUCCESS (Status))
+ {
+ TableDesc->LoadedIntoNamespace = TRUE;
+ }
+
+ break;
+
+
+ case ACPI_TABLE_SSDT:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
+ AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count));
+
+ /*
+ * Traverse list of SSDT tables
+ */
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_SSDT].Next;
+ for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count; i++)
+ {
+ /*
+ * Only attempt to load table if it is not
+ * already loaded!
+ */
+ if (!TableDesc->LoadedIntoNamespace)
+ {
+ Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ TableDesc->LoadedIntoNamespace = TRUE;
+ }
+
+ TableDesc = TableDesc->Next;
+ }
+ break;
+
+
+ case ACPI_TABLE_PSDT:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
+ AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count));
+
+ /*
+ * Traverse list of PSDT tables
+ */
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_PSDT].Next;
+
+ for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count; i++)
+ {
+ /* Only attempt to load table if it is not already loaded! */
+
+ if (!TableDesc->LoadedIntoNamespace)
+ {
+ Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+
+ TableDesc->LoadedIntoNamespace = TRUE;
+ }
+
+ TableDesc = TableDesc->Next;
+ }
+
+ break;
+
+
+ default:
+ Status = AE_SUPPORT;
+ break;
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLoadNamespace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
+ * (DSDT points to either the BIOS or a buffer.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsLoadNamespace (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
+
+
+ /* There must be at least a DSDT installed */
+
+ if (AcpiGbl_DSDT == NULL)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /*
+ * Load the namespace. The DSDT is required,
+ * but the SSDT and PSDT tables are optional.
+ */
+ Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Ignore exceptions from these */
+
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+ "ACPI Namespace successfully loaded at root %p\n",
+ AcpiGbl_RootNode));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDeleteSubtree
+ *
+ * PARAMETERS: StartHandle - Handle in namespace where search begins
+ *
+ * RETURNS Status
+ *
+ * DESCRIPTION: Walks the namespace starting at the given handle and deletes
+ * all objects, entries, and scopes in the entire subtree.
+ *
+ * Namespace/Interpreter should be locked or the subsystem should
+ * be in shutdown before this routine is called.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsDeleteSubtree (
+ ACPI_HANDLE StartHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_HANDLE ChildHandle;
+ ACPI_HANDLE ParentHandle;
+ ACPI_HANDLE NextChildHandle;
+ ACPI_HANDLE Dummy;
+ UINT32 Level;
+
+
+ ACPI_FUNCTION_TRACE ("NsDeleteSubtree");
+
+
+ ParentHandle = StartHandle;
+ ChildHandle = 0;
+ Level = 1;
+
+ /*
+ * Traverse the tree of objects until we bubble back up
+ * to where we started.
+ */
+ while (Level > 0)
+ {
+ /* Attempt to get the next object in this scope */
+
+ Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle,
+ ChildHandle, &NextChildHandle);
+
+ ChildHandle = NextChildHandle;
+
+ /* Did we get a new object? */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Check if this object has any children */
+
+ if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle,
+ 0, &Dummy)))
+ {
+ /*
+ * There is at least one child of this object,
+ * visit the object
+ */
+ Level++;
+ ParentHandle = ChildHandle;
+ ChildHandle = 0;
+ }
+ }
+ else
+ {
+ /*
+ * No more children in this object, go back up to
+ * the object's parent
+ */
+ Level--;
+
+ /* Delete all children now */
+
+ AcpiNsDeleteChildren (ChildHandle);
+
+ ChildHandle = ParentHandle;
+ Status = AcpiGetParent (ParentHandle, &ParentHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ }
+
+ /* Now delete the starting object, and we are done */
+
+ AcpiNsDeleteNode (ChildHandle);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsUnloadNameSpace
+ *
+ * PARAMETERS: Handle - Root of namespace subtree to be deleted
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Shrinks the namespace, typically in response to an undocking
+ * event. Deletes an entire subtree starting from (and
+ * including) the given handle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsUnloadNamespace (
+ ACPI_HANDLE Handle)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("NsUnloadNameSpace");
+
+
+ /* Parameter validation */
+
+ if (!AcpiGbl_RootNode)
+ {
+ return_ACPI_STATUS (AE_NO_NAMESPACE);
+ }
+
+ if (!Handle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* This function does the real work */
+
+ Status = AcpiNsDeleteSubtree (Handle);
+
+ return_ACPI_STATUS (Status);
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c
new file mode 100644
index 0000000..f7f3528
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsnames.c
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ *
+ * Module Name: nsnames - Name manipulation and search
+ * $Revision: 83 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSNAMES_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsnames")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsBuildExternalPath
+ *
+ * PARAMETERS: Node - NS node whose pathname is needed
+ * Size - Size of the pathname
+ * *NameBuffer - Where to return the pathname
+ *
+ * RETURN: Places the pathname into the NameBuffer, in external format
+ * (name segments separated by path separators)
+ *
+ * DESCRIPTION: Generate a full pathaname
+ *
+ ******************************************************************************/
+
+void
+AcpiNsBuildExternalPath (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_SIZE Size,
+ char *NameBuffer)
+{
+ ACPI_SIZE Index;
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_NAME ("NsBuildExternalPath");
+
+
+ /* Special case for root */
+
+ Index = Size - 1;
+ if (Index < ACPI_NAME_SIZE)
+ {
+ NameBuffer[0] = AML_ROOT_PREFIX;
+ NameBuffer[1] = 0;
+ return;
+ }
+
+ /* Store terminator byte, then build name backwards */
+
+ ParentNode = Node;
+ NameBuffer[Index] = 0;
+
+ while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode))
+ {
+ Index -= ACPI_NAME_SIZE;
+
+ /* Put the name into the buffer */
+
+ ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+
+ /* Prefix name with the path separator */
+
+ Index--;
+ NameBuffer[Index] = ACPI_PATH_SEPARATOR;
+ }
+
+ /* Overwrite final separator with the root prefix character */
+
+ NameBuffer[Index] = AML_ROOT_PREFIX;
+
+ if (Index != 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ (UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
+ }
+
+ return;
+}
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetExternalPathname
+ *
+ * PARAMETERS: Node - NS node whose pathname is needed
+ *
+ * RETURN: Pointer to storage containing the fully qualified name of
+ * the node, In external format (name segments separated by path
+ * separators.)
+ *
+ * DESCRIPTION: Used for debug printing in AcpiNsSearchTable().
+ *
+ ******************************************************************************/
+
+char *
+AcpiNsGetExternalPathname (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ char *NameBuffer;
+ ACPI_SIZE Size;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("NsGetExternalPathname", Node);
+
+
+ /* Calculate required buffer size based on depth below root */
+
+ Size = AcpiNsGetPathnameLength (Node);
+
+ /* Allocate a buffer to be returned to caller */
+
+ NameBuffer = ACPI_MEM_CALLOCATE (Size);
+ if (!NameBuffer)
+ {
+ ACPI_REPORT_ERROR (("NsGetTablePathname: allocation failure\n"));
+ return_PTR (NULL);
+ }
+
+ /* Build the path in the allocated buffer */
+
+ AcpiNsBuildExternalPath (Node, Size, NameBuffer);
+ return_PTR (NameBuffer);
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetPathnameLength
+ *
+ * PARAMETERS: Node - Namespace node
+ *
+ * RETURN: Length of path, including prefix
+ *
+ * DESCRIPTION: Get the length of the pathname string for this node
+ *
+ ******************************************************************************/
+
+ACPI_SIZE
+AcpiNsGetPathnameLength (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_SIZE Size;
+ ACPI_NAMESPACE_NODE *NextNode;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Compute length of pathname as 5 * number of name segments.
+ * Go back up the parent tree to the root
+ */
+ Size = 0;
+ NextNode = Node;
+
+ while (NextNode && (NextNode != AcpiGbl_RootNode))
+ {
+ Size += ACPI_PATH_SEGMENT_LENGTH;
+ NextNode = AcpiNsGetParentNode (NextNode);
+ }
+
+ return (Size + 1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsHandleToPathname
+ *
+ * PARAMETERS: TargetHandle - Handle of named object whose name is
+ * to be found
+ * Buffer - Where the pathname is returned
+ *
+ * RETURN: Status, Buffer is filled with pathname if status is AE_OK
+ *
+ * DESCRIPTION: Build and return a full namespace pathname
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsHandleToPathname (
+ ACPI_HANDLE TargetHandle,
+ ACPI_BUFFER *Buffer)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_SIZE RequiredSize;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
+
+
+ Node = AcpiNsMapHandleToNode (TargetHandle);
+ if (!Node)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Determine size required for the caller buffer */
+
+ RequiredSize = AcpiNsGetPathnameLength (Node);
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Build the path in the caller buffer */
+
+ AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, (UINT32) RequiredSize));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c
new file mode 100644
index 0000000..6a6250d
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsobject.c
@@ -0,0 +1,562 @@
+/*******************************************************************************
+ *
+ * Module Name: nsobject - Utilities for objects attached to namespace
+ * table entries
+ * $Revision: 87 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSOBJECT_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsobject")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsAttachObject
+ *
+ * PARAMETERS: Node - Parent Node
+ * Object - Object to be attached
+ * Type - Type of object, or ACPI_TYPE_ANY if not
+ * known
+ *
+ * DESCRIPTION: Record the given object as the value associated with the
+ * name whose ACPI_HANDLE is passed. If Object is NULL
+ * and Type is ACPI_TYPE_ANY, set the name as having no value.
+ * Note: Future may require that the Node->Flags field be passed
+ * as a parameter.
+ *
+ * MUTEX: Assumes namespace is locked
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsAttachObject (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_OBJECT_TYPE Type)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *LastObjDesc;
+ ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY;
+
+
+ ACPI_FUNCTION_TRACE ("NsAttachObject");
+
+
+ /*
+ * Parameter validation
+ */
+ if (!Node)
+ {
+ /* Invalid handle */
+
+ ACPI_REPORT_ERROR (("NsAttachObject: Null NamedObj handle\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (!Object && (ACPI_TYPE_ANY != Type))
+ {
+ /* Null object */
+
+ ACPI_REPORT_ERROR (("NsAttachObject: Null object, but type not ACPI_TYPE_ANY\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ /* Not a name handle */
+
+ ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Check if this object is already attached */
+
+ if (Node->Object == Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in NameObj %p\n",
+ Object, Node));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* If null object, we will just install it */
+
+ if (!Object)
+ {
+ ObjDesc = NULL;
+ ObjectType = ACPI_TYPE_ANY;
+ }
+
+ /*
+ * If the source object is a namespace Node with an attached object,
+ * we will use that (attached) object
+ */
+ else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) &&
+ ((ACPI_NAMESPACE_NODE *) Object)->Object)
+ {
+ /*
+ * Value passed is a name handle and that name has a
+ * non-null value. Use that name's value and type.
+ */
+ ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object;
+ ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type;
+ }
+
+ /*
+ * Otherwise, we will use the parameter object, but we must type
+ * it first
+ */
+ else
+ {
+ ObjDesc = (ACPI_OPERAND_OBJECT *) Object;
+
+ /* Use the given type */
+
+ ObjectType = Type;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
+ ObjDesc, Node, Node->Name.Ascii));
+
+ /* Detach an existing attached object if present */
+
+ if (Node->Object)
+ {
+ AcpiNsDetachObject (Node);
+ }
+
+ if (ObjDesc)
+ {
+ /*
+ * Must increment the new value's reference count
+ * (if it is an internal object)
+ */
+ AcpiUtAddReference (ObjDesc);
+
+ /*
+ * Handle objects with multiple descriptors - walk
+ * to the end of the descriptor list
+ */
+ LastObjDesc = ObjDesc;
+ while (LastObjDesc->Common.NextObject)
+ {
+ LastObjDesc = LastObjDesc->Common.NextObject;
+ }
+
+ /* Install the object at the front of the object list */
+
+ LastObjDesc->Common.NextObject = Node->Object;
+ }
+
+ Node->Type = (UINT8) ObjectType;
+ Node->Object = ObjDesc;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDetachObject
+ *
+ * PARAMETERS: Node - An node whose object will be detached
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Detach/delete an object associated with a namespace node.
+ * if the object is an allocated object, it is freed.
+ * Otherwise, the field is simply cleared.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDetachObject (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("NsDetachObject");
+
+
+ ObjDesc = Node->Object;
+
+ if (!ObjDesc ||
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA))
+ {
+ return_VOID;
+ }
+
+ /* Clear the entry in all cases */
+
+ Node->Object = NULL;
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
+ {
+ Node->Object = ObjDesc->Common.NextObject;
+ if (Node->Object &&
+ (ACPI_GET_OBJECT_TYPE (Node->Object) != ACPI_TYPE_LOCAL_DATA))
+ {
+ Node->Object = Node->Object->Common.NextObject;
+ }
+ }
+
+ /* Reset the node type to untyped */
+
+ Node->Type = ACPI_TYPE_ANY;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
+ Node, Node->Name.Ascii, ObjDesc));
+
+ /* Remove one reference on the object (and all subobjects) */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetAttachedObject
+ *
+ * PARAMETERS: Node - Parent Node to be examined
+ *
+ * RETURN: Current value of the object field from the Node whose
+ * handle is passed
+ *
+ * DESCRIPTION: Obtain the object attached to a namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_OPERAND_OBJECT *
+AcpiNsGetAttachedObject (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node);
+
+
+ if (!Node)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
+ return_PTR (NULL);
+ }
+
+ if (!Node->Object ||
+ ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) ||
+ (ACPI_GET_OBJECT_TYPE (Node->Object) == ACPI_TYPE_LOCAL_DATA))
+ {
+ return_PTR (NULL);
+ }
+
+ return_PTR (Node->Object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetSecondaryObject
+ *
+ * PARAMETERS: Node - Parent Node to be examined
+ *
+ * RETURN: Current value of the object field from the Node whose
+ * handle is passed.
+ *
+ * DESCRIPTION: Obtain a secondary object associated with a namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_OPERAND_OBJECT *
+AcpiNsGetSecondaryObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_FUNCTION_TRACE_PTR ("NsGetSecondaryObject", ObjDesc);
+
+
+ if ((!ObjDesc) ||
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) ||
+ (!ObjDesc->Common.NextObject) ||
+ (ACPI_GET_OBJECT_TYPE (ObjDesc->Common.NextObject) == ACPI_TYPE_LOCAL_DATA))
+ {
+ return_PTR (NULL);
+ }
+
+ return_PTR (ObjDesc->Common.NextObject);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsAttachData
+ *
+ * PARAMETERS: Node - Namespace node
+ * Handler - Handler to be associated with the data
+ * Data - Data to be attached
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Low-level attach data. Create and attach a Data object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsAttachData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler,
+ void *Data)
+{
+ ACPI_OPERAND_OBJECT *PrevObjDesc;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *DataDesc;
+
+
+ /* We only allow one attachment per handler */
+
+ PrevObjDesc = NULL;
+ ObjDesc = Node->Object;
+ while (ObjDesc)
+ {
+ if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+ (ObjDesc->Data.Handler == Handler))
+ {
+ return (AE_ALREADY_EXISTS);
+ }
+
+ PrevObjDesc = ObjDesc;
+ ObjDesc = ObjDesc->Common.NextObject;
+ }
+
+ /* Create an internal object for the data */
+
+ DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA);
+ if (!DataDesc)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ DataDesc->Data.Handler = Handler;
+ DataDesc->Data.Pointer = Data;
+
+ /* Install the data object */
+
+ if (PrevObjDesc)
+ {
+ PrevObjDesc->Common.NextObject = DataDesc;
+ }
+ else
+ {
+ Node->Object = DataDesc;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDetachData
+ *
+ * PARAMETERS: Node - Namespace node
+ * Handler - Handler associated with the data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Low-level detach data. Delete the data node, but the caller
+ * is responsible for the actual data.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsDetachData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *PrevObjDesc;
+
+
+ PrevObjDesc = NULL;
+ ObjDesc = Node->Object;
+ while (ObjDesc)
+ {
+ if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+ (ObjDesc->Data.Handler == Handler))
+ {
+ if (PrevObjDesc)
+ {
+ PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject;
+ }
+ else
+ {
+ Node->Object = ObjDesc->Common.NextObject;
+ }
+
+ AcpiUtRemoveReference (ObjDesc);
+ return (AE_OK);
+ }
+
+ PrevObjDesc = ObjDesc;
+ ObjDesc = ObjDesc->Common.NextObject;
+ }
+
+ return (AE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetAttachedData
+ *
+ * PARAMETERS: Node - Namespace node
+ * Handler - Handler associated with the data
+ * Data - Where the data is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Low level interface to obtain data previously associated with
+ * a namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsGetAttachedData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_HANDLER Handler,
+ void **Data)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ObjDesc = Node->Object;
+ while (ObjDesc)
+ {
+ if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+ (ObjDesc->Data.Handler == Handler))
+ {
+ *Data = ObjDesc->Data.Pointer;
+ return (AE_OK);
+ }
+
+ ObjDesc = ObjDesc->Common.NextObject;
+ }
+
+ return (AE_NOT_FOUND);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsparse.c b/sys/contrib/dev/acpica/nsparse.c
new file mode 100644
index 0000000..54fd0c1
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsparse.c
@@ -0,0 +1,249 @@
+/******************************************************************************
+ *
+ * Module Name: nsparse - namespace interface to AML parser
+ * $Revision: 4 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSPARSE_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsparse")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: NsOneCompleteParse
+ *
+ * PARAMETERS: PassNumber - 1 or 2
+ * TableDesc - The table to be parsed.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsOneCompleteParse (
+ UINT32 PassNumber,
+ ACPI_TABLE_DESC *TableDesc)
+{
+ ACPI_PARSE_OBJECT *ParseRoot;
+ ACPI_STATUS Status;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
+
+
+ /* Create and init a Root Node */
+
+ ParseRoot = AcpiPsCreateScopeOp ();
+ if (!ParseRoot)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (TableDesc->TableId,
+ NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ AcpiPsFreeOp (ParseRoot);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart,
+ TableDesc->AmlLength, NULL, NULL, PassNumber);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parse the AML */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber));
+ Status = AcpiPsParseAml (WalkState);
+
+ AcpiPsDeleteParseTree (ParseRoot);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsParseTable
+ *
+ * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse
+ * StartNode - Where to enter the table into the namespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsParseTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NAMESPACE_NODE *StartNode)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("NsParseTable");
+
+
+ /*
+ * AML Parse, pass 1
+ *
+ * In this pass, we load most of the namespace. Control methods
+ * are not parsed until later. A parse tree is not created. Instead,
+ * each Parser Op subtree is deleted when it is finished. This saves
+ * a great deal of memory, and allows a small cache of parse objects
+ * to service the entire parse. The second pass of the parse then
+ * performs another complete parse of the AML..
+ */
+ Status = AcpiNsOneCompleteParse (1, TableDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * AML Parse, pass 2
+ *
+ * In this pass, we resolve forward references and other things
+ * that could not be completed during the first pass.
+ * Another complete parse of the AML is performed, but the
+ * overhead of this is compensated for by the fact that the
+ * parse objects are all cached.
+ */
+ Status = AcpiNsOneCompleteParse (2, TableDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c
new file mode 100644
index 0000000..4051d3f
--- /dev/null
+++ b/sys/contrib/dev/acpica/nssearch.c
@@ -0,0 +1,463 @@
+/*******************************************************************************
+ *
+ * Module Name: nssearch - Namespace search
+ * $Revision: 97 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSSEARCH_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nssearch")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsSearchNode
+ *
+ * PARAMETERS: *TargetName - Ascii ACPI name to search for
+ * *Node - Starting node where search will begin
+ * Type - Object type to match
+ * **ReturnNode - Where the matched Named obj is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Search a single level of the namespace. Performs a
+ * simple search of the specified level, and does not add
+ * entries or search parents.
+ *
+ *
+ * Named object lists are built (and subsequently dumped) in the
+ * order in which the names are encountered during the namespace load;
+ *
+ * All namespace searching is linear in this implementation, but
+ * could be easily modified to support any improved search
+ * algorithm. However, the linear search was chosen for simplicity
+ * and because the trees are small and the other interpreter
+ * execution overhead is relatively high.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsSearchNode (
+ UINT32 TargetName,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_NAMESPACE_NODE *NextNode;
+
+
+ ACPI_FUNCTION_TRACE ("NsSearchNode");
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+ if (ACPI_LV_NAMES & AcpiDbgLevel)
+ {
+ char *ScopeName;
+
+ ScopeName = AcpiNsGetExternalPathname (Node);
+ if (ScopeName)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n",
+ ScopeName, Node, (char *) &TargetName, AcpiUtGetTypeName (Type)));
+
+ ACPI_MEM_FREE (ScopeName);
+ }
+ }
+#endif
+
+ /*
+ * Search for name at this namespace level, which is to say that we
+ * must search for the name among the children of this object
+ */
+ NextNode = Node->Child;
+ while (NextNode)
+ {
+ /* Check for match against the name */
+
+ if (NextNode->Name.Integer == TargetName)
+ {
+ /*
+ * Found matching entry.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Name %4.4s Type [%s] found in scope [%4.4s] %p\n",
+ (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type),
+ NextNode->Name.Ascii, NextNode));
+
+ *ReturnNode = NextNode;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * The last entry in the list points back to the parent,
+ * so a flag is used to indicate the end-of-list
+ */
+ if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ /* Searched entire list, we are done */
+
+ break;
+ }
+
+ /* Didn't match name, move on to the next peer object */
+
+ NextNode = NextNode->Peer;
+ }
+
+ /* Searched entire namespace level, not found */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Name %4.4s Type [%s] not found in search in scope [%4.4s] %p first child %p\n",
+ (char *) &TargetName, AcpiUtGetTypeName (Type),
+ Node->Name.Ascii, Node, Node->Child));
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsSearchParentTree
+ *
+ * PARAMETERS: *TargetName - Ascii ACPI name to search for
+ * *Node - Starting node where search will begin
+ * Type - Object type to match
+ * **ReturnNode - Where the matched Named Obj is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Called when a name has not been found in the current namespace
+ * level. Before adding it or giving up, ACPI scope rules require
+ * searching enclosing scopes in cases identified by AcpiNsLocal().
+ *
+ * "A name is located by finding the matching name in the current
+ * name space, and then in the parent name space. If the parent
+ * name space does not contain the name, the search continues
+ * recursively until either the name is found or the name space
+ * does not have a parent (the root of the name space). This
+ * indicates that the name is not found" (From ACPI Specification,
+ * section 5.3)
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsSearchParentTree (
+ UINT32 TargetName,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_TRACE ("NsSearchParentTree");
+
+
+ ParentNode = AcpiNsGetParentNode (Node);
+
+ /*
+ * If there is no parent (i.e., we are at the root) or
+ * type is "local", we won't be searching the parent tree.
+ */
+ if (!ParentNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
+ (char *) &TargetName));
+ return_ACPI_STATUS (AE_NOT_FOUND);
+ }
+
+ if (AcpiNsLocal (Type))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
+ (char *) &TargetName, AcpiUtGetTypeName (Type)));
+ return_ACPI_STATUS (AE_NOT_FOUND);
+ }
+
+ /* Search the parent tree */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &TargetName));
+
+ /*
+ * Search parents until found the target or we have backed up to
+ * the root
+ */
+ while (ParentNode)
+ {
+ /*
+ * Search parent scope. Use TYPE_ANY because we don't care about the
+ * object type at this point, we only care about the existence of
+ * the actual name we are searching for. Typechecking comes later.
+ */
+ Status = AcpiNsSearchNode (TargetName, ParentNode,
+ ACPI_TYPE_ANY, ReturnNode);
+ if (ACPI_SUCCESS (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Not found here, go up another level
+ * (until we reach the root)
+ */
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+
+ /* Not found in parent tree */
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsSearchAndEnter
+ *
+ * PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars)
+ * WalkState - Current state of the walk
+ * *Node - Starting node where search will begin
+ * InterpreterMode - Add names only in ACPI_MODE_LOAD_PASS_x.
+ * Otherwise,search only.
+ * Type - Object type to match
+ * Flags - Flags describing the search restrictions
+ * **ReturnNode - Where the Node is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Search for a name segment in a single namespace level,
+ * optionally adding it if it is not found. If the passed
+ * Type is not Any and the type previously stored in the
+ * entry was Any (i.e. unknown), update the stored type.
+ *
+ * In ACPI_IMODE_EXECUTE, search only.
+ * In other modes, search and add if not found.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsSearchAndEnter (
+ UINT32 TargetName,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *NewNode;
+
+
+ ACPI_FUNCTION_TRACE ("NsSearchAndEnter");
+
+
+ /* Parameter validation */
+
+ if (!Node || !TargetName || !ReturnNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param: Node %p Name %X ReturnNode %p\n",
+ Node, TargetName, ReturnNode));
+
+ ACPI_REPORT_ERROR (("NsSearchAndEnter: Null parameter\n"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Name must consist of printable characters */
+
+ if (!AcpiUtValidAcpiName (TargetName))
+ {
+ ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name: %X\n",
+ TargetName));
+ return_ACPI_STATUS (AE_BAD_CHARACTER);
+ }
+
+ /* Try to find the name in the namespace level specified by the caller */
+
+ *ReturnNode = ACPI_ENTRY_NOT_FOUND;
+ Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
+ if (Status != AE_NOT_FOUND)
+ {
+ /*
+ * If we found it AND the request specifies that a find is an error,
+ * return the error
+ */
+ if ((Status == AE_OK) &&
+ (Flags & ACPI_NS_ERROR_IF_FOUND))
+ {
+ Status = AE_ALREADY_EXISTS;
+ }
+
+ /*
+ * Either found it or there was an error
+ * -- finished either way
+ */
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The name was not found. If we are NOT performing the
+ * first pass (name entry) of loading the namespace, search
+ * the parent tree (all the way to the root if necessary.)
+ * We don't want to perform the parent search when the
+ * namespace is actually being loaded. We want to perform
+ * the search when namespace references are being resolved
+ * (load pass 2) and during the execution phase.
+ */
+ if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) &&
+ (Flags & ACPI_NS_SEARCH_PARENT))
+ {
+ /*
+ * Not found at this level - search parent tree according
+ * to ACPI specification
+ */
+ Status = AcpiNsSearchParentTree (TargetName, Node,
+ Type, ReturnNode);
+ if (ACPI_SUCCESS (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * In execute mode, just search, never add names. Exit now.
+ */
+ if (InterpreterMode == ACPI_IMODE_EXECUTE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
+ (char *) &TargetName, Node));
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+ }
+
+ /* Create the new named object */
+
+ NewNode = AcpiNsCreateNode (TargetName);
+ if (!NewNode)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Install the new object into the parent's list of children */
+
+ AcpiNsInstallNode (WalkState, Node, NewNode, Type);
+ *ReturnNode = NewNode;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c
new file mode 100644
index 0000000..3f1b574
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsutils.c
@@ -0,0 +1,1204 @@
+/******************************************************************************
+ *
+ * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
+ * parents and siblings and Scope manipulation
+ * $Revision: 129 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSUTILS_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+#include "actables.h"
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsReportError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ * Message - Error message to use on failure
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print warning message with full pathname
+ *
+ ******************************************************************************/
+
+void
+AcpiNsReportError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ char *InternalName,
+ ACPI_STATUS LookupStatus)
+{
+ ACPI_STATUS Status;
+ char *Name = NULL;
+
+
+ AcpiOsPrintf ("%8s-%04d: *** Error: Looking up ",
+ ModuleName, LineNumber);
+
+ if (LookupStatus == AE_BAD_CHARACTER)
+ {
+ /* There is a non-ascii character in the name */
+
+ AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (UINT32, InternalName)));
+ }
+ else
+ {
+ /* Convert path to external format */
+
+ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalName, NULL, &Name);
+
+ /* Print target name */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("[%s]", Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
+ }
+
+ if (Name)
+ {
+ ACPI_MEM_FREE (Name);
+ }
+ }
+
+ AcpiOsPrintf (" in namespace, %s\n",
+ AcpiFormatException (LookupStatus));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsReportMethodError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ * Message - Error message to use on failure
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print warning message with full pathname
+ *
+ ******************************************************************************/
+
+void
+AcpiNsReportMethodError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ char *Message,
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ char *Path,
+ ACPI_STATUS MethodStatus)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = PrefixNode;
+
+
+ if (Path)
+ {
+ Status = AcpiNsGetNodeByPath (Path, PrefixNode, ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("ReportMethodError: Could not get node\n");
+ return;
+ }
+ }
+
+ AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
+ AcpiNsPrintNodePathname (Node, Message);
+ AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsPrintNodePathname
+ *
+ * PARAMETERS: Node - Object
+ * Msg - Prefix message
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ * Manages allocation/freeing of a pathname buffer
+ *
+ ******************************************************************************/
+
+void
+AcpiNsPrintNodePathname (
+ ACPI_NAMESPACE_NODE *Node,
+ char *Msg)
+{
+ ACPI_BUFFER Buffer;
+ ACPI_STATUS Status;
+
+
+ /* Convert handle to a full pathname and print it (with supplied message) */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiNsHandleToPathname (Node, &Buffer);
+ if (ACPI_SUCCESS (Status))
+ {
+ if (Msg)
+ {
+ AcpiOsPrintf ("%s ", Msg);
+ }
+
+ AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
+ ACPI_MEM_FREE (Buffer.Pointer);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsValidRootPrefix
+ *
+ * PARAMETERS: Prefix - Character to be checked
+ *
+ * RETURN: TRUE if a valid prefix
+ *
+ * DESCRIPTION: Check if a character is a valid ACPI Root prefix
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiNsValidRootPrefix (
+ char Prefix)
+{
+
+ return ((BOOLEAN) (Prefix == '\\'));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsValidPathSeparator
+ *
+ * PARAMETERS: Sep - Character to be checked
+ *
+ * RETURN: TRUE if a valid path separator
+ *
+ * DESCRIPTION: Check if a character is a valid ACPI path separator
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiNsValidPathSeparator (
+ char Sep)
+{
+
+ return ((BOOLEAN) (Sep == '.'));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetType
+ *
+ * PARAMETERS: Handle - Parent Node to be examined
+ *
+ * RETURN: Type field from Node whose handle is passed
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE
+AcpiNsGetType (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_FUNCTION_TRACE ("NsGetType");
+
+
+ if (!Node)
+ {
+ ACPI_REPORT_WARNING (("NsGetType: Null Node ptr"));
+ return_VALUE (ACPI_TYPE_ANY);
+ }
+
+ return_VALUE ((ACPI_OBJECT_TYPE) Node->Type);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsLocal
+ *
+ * PARAMETERS: Type - A namespace object type
+ *
+ * RETURN: LOCAL if names must be found locally in objects of the
+ * passed type, 0 if enclosing scopes should be searched
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiNsLocal (
+ ACPI_OBJECT_TYPE Type)
+{
+ ACPI_FUNCTION_TRACE ("NsLocal");
+
+
+ if (!AcpiUtValidObjectType (Type))
+ {
+ /* Type code out of range */
+
+ ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
+ return_VALUE (ACPI_NS_NORMAL);
+ }
+
+ return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetInternalNameLength
+ *
+ * PARAMETERS: Info - Info struct initialized with the
+ * external name pointer.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Calculate the length of the internal (AML) namestring
+ * corresponding to the external (ASL) namestring.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsGetInternalNameLength (
+ ACPI_NAMESTRING_INFO *Info)
+{
+ char *NextExternalChar;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ NextExternalChar = Info->ExternalName;
+ Info->NumCarats = 0;
+ Info->NumSegments = 0;
+ Info->FullyQualified = FALSE;
+
+ /*
+ * For the internal name, the required length is 4 bytes
+ * per segment, plus 1 each for RootPrefix, MultiNamePrefixOp,
+ * segment count, trailing null (which is not really needed,
+ * but no there's harm in putting it there)
+ *
+ * strlen() + 1 covers the first NameSeg, which has no
+ * path separator
+ */
+ if (AcpiNsValidRootPrefix (NextExternalChar[0]))
+ {
+ Info->FullyQualified = TRUE;
+ NextExternalChar++;
+ }
+ else
+ {
+ /*
+ * Handle Carat prefixes
+ */
+ while (*NextExternalChar == '^')
+ {
+ Info->NumCarats++;
+ NextExternalChar++;
+ }
+ }
+
+ /*
+ * Determine the number of ACPI name "segments" by counting
+ * the number of path separators within the string. Start
+ * with one segment since the segment count is (# separators)
+ * + 1, and zero separators is ok.
+ */
+ if (*NextExternalChar)
+ {
+ Info->NumSegments = 1;
+ for (i = 0; NextExternalChar[i]; i++)
+ {
+ if (AcpiNsValidPathSeparator (NextExternalChar[i]))
+ {
+ Info->NumSegments++;
+ }
+ }
+ }
+
+ Info->Length = (ACPI_NAME_SIZE * Info->NumSegments) +
+ 4 + Info->NumCarats;
+
+ Info->NextExternalChar = NextExternalChar;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsBuildInternalName
+ *
+ * PARAMETERS: Info - Info struct fully initialized
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Construct the internal (AML) namestring
+ * corresponding to the external (ASL) namestring.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsBuildInternalName (
+ ACPI_NAMESTRING_INFO *Info)
+{
+ UINT32 NumSegments = Info->NumSegments;
+ char *InternalName = Info->InternalName;
+ char *ExternalName = Info->NextExternalChar;
+ char *Result = NULL;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("NsBuildInternalName");
+
+
+ /* Setup the correct prefixes, counts, and pointers */
+
+ if (Info->FullyQualified)
+ {
+ InternalName[0] = '\\';
+
+ if (NumSegments <= 1)
+ {
+ Result = &InternalName[1];
+ }
+ else if (NumSegments == 2)
+ {
+ InternalName[1] = AML_DUAL_NAME_PREFIX;
+ Result = &InternalName[2];
+ }
+ else
+ {
+ InternalName[1] = AML_MULTI_NAME_PREFIX_OP;
+ InternalName[2] = (char) NumSegments;
+ Result = &InternalName[3];
+ }
+ }
+ else
+ {
+ /*
+ * Not fully qualified.
+ * Handle Carats first, then append the name segments
+ */
+ i = 0;
+ if (Info->NumCarats)
+ {
+ for (i = 0; i < Info->NumCarats; i++)
+ {
+ InternalName[i] = '^';
+ }
+ }
+
+ if (NumSegments <= 1)
+ {
+ Result = &InternalName[i];
+ }
+ else if (NumSegments == 2)
+ {
+ InternalName[i] = AML_DUAL_NAME_PREFIX;
+ Result = &InternalName[(ACPI_NATIVE_UINT) (i+1)];
+ }
+ else
+ {
+ InternalName[i] = AML_MULTI_NAME_PREFIX_OP;
+ InternalName[(ACPI_NATIVE_UINT) (i+1)] = (char) NumSegments;
+ Result = &InternalName[(ACPI_NATIVE_UINT) (i+2)];
+ }
+ }
+
+ /* Build the name (minus path separators) */
+
+ for (; NumSegments; NumSegments--)
+ {
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ if (AcpiNsValidPathSeparator (*ExternalName) ||
+ (*ExternalName == 0))
+ {
+ /* Pad the segment with underscore(s) if segment is short */
+
+ Result[i] = '_';
+ }
+ else
+ {
+ /* Convert the character to uppercase and save it */
+
+ Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName);
+ ExternalName++;
+ }
+ }
+
+ /* Now we must have a path separator, or the pathname is bad */
+
+ if (!AcpiNsValidPathSeparator (*ExternalName) &&
+ (*ExternalName != 0))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Move on the next segment */
+
+ ExternalName++;
+ Result += ACPI_NAME_SIZE;
+ }
+
+ /* Terminate the string */
+
+ *Result = 0;
+
+ if (Info->FullyQualified)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (abs) \"\\%s\"\n",
+ InternalName, InternalName));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (rel) \"%s\"\n",
+ InternalName, InternalName));
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsInternalizeName
+ *
+ * PARAMETERS: *ExternalName - External representation of name
+ * **Converted Name - Where to return the resulting
+ * internal represention of the name
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
+ * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
+ *
+ *******************************************************************************/
+
+ACPI_STATUS
+AcpiNsInternalizeName (
+ char *ExternalName,
+ char **ConvertedName)
+{
+ char *InternalName;
+ ACPI_NAMESTRING_INFO Info;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("NsInternalizeName");
+
+
+ if ((!ExternalName) ||
+ (*ExternalName == 0) ||
+ (!ConvertedName))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the length of the new internal name */
+
+ Info.ExternalName = ExternalName;
+ AcpiNsGetInternalNameLength (&Info);
+
+ /* We need a segment to store the internal name */
+
+ InternalName = ACPI_MEM_CALLOCATE (Info.Length);
+ if (!InternalName)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Build the name */
+
+ Info.InternalName = InternalName;
+ Status = AcpiNsBuildInternalName (&Info);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_MEM_FREE (InternalName);
+ return_ACPI_STATUS (Status);
+ }
+
+ *ConvertedName = InternalName;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsExternalizeName
+ *
+ * PARAMETERS: *InternalName - Internal representation of name
+ * **ConvertedName - Where to return the resulting
+ * external representation of name
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
+ * to its external form (e.g. "\_PR_.CPU0")
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsExternalizeName (
+ UINT32 InternalNameLength,
+ char *InternalName,
+ UINT32 *ConvertedNameLength,
+ char **ConvertedName)
+{
+ ACPI_NATIVE_UINT NamesIndex = 0;
+ ACPI_NATIVE_UINT NumSegments = 0;
+ ACPI_NATIVE_UINT RequiredLength;
+ ACPI_NATIVE_UINT PrefixLength = 0;
+ ACPI_NATIVE_UINT i = 0;
+ ACPI_NATIVE_UINT j = 0;
+
+
+ ACPI_FUNCTION_TRACE ("NsExternalizeName");
+
+
+ if (!InternalNameLength ||
+ !InternalName ||
+ !ConvertedName)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Check for a prefix (one '\' | one or more '^').
+ */
+ switch (InternalName[0])
+ {
+ case '\\':
+ PrefixLength = 1;
+ break;
+
+ case '^':
+ for (i = 0; i < InternalNameLength; i++)
+ {
+ if (InternalName[i] == '^')
+ {
+ PrefixLength = i + 1;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (i == InternalNameLength)
+ {
+ PrefixLength = i;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * Check for object names. Note that there could be 0-255 of these
+ * 4-byte elements.
+ */
+ if (PrefixLength < InternalNameLength)
+ {
+ switch (InternalName[PrefixLength])
+ {
+ case AML_MULTI_NAME_PREFIX_OP:
+
+ /* <count> 4-byte names */
+
+ NamesIndex = PrefixLength + 2;
+ NumSegments = (ACPI_NATIVE_UINT) (UINT8) InternalName[(ACPI_NATIVE_UINT) (PrefixLength + 1)];
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+
+ /* Two 4-byte names */
+
+ NamesIndex = PrefixLength + 1;
+ NumSegments = 2;
+ break;
+
+ case 0:
+
+ /* NullName */
+
+ NamesIndex = 0;
+ NumSegments = 0;
+ break;
+
+ default:
+
+ /* one 4-byte name */
+
+ NamesIndex = PrefixLength;
+ NumSegments = 1;
+ break;
+ }
+ }
+
+ /*
+ * Calculate the length of ConvertedName, which equals the length
+ * of the prefix, length of all object names, length of any required
+ * punctuation ('.') between object names, plus the NULL terminator.
+ */
+ RequiredLength = PrefixLength + (4 * NumSegments) +
+ ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1;
+
+ /*
+ * Check to see if we're still in bounds. If not, there's a problem
+ * with InternalName (invalid format).
+ */
+ if (RequiredLength > InternalNameLength)
+ {
+ ACPI_REPORT_ERROR (("NsExternalizeName: Invalid internal name\n"));
+ return_ACPI_STATUS (AE_BAD_PATHNAME);
+ }
+
+ /*
+ * Build ConvertedName...
+ */
+ *ConvertedName = ACPI_MEM_CALLOCATE (RequiredLength);
+ if (!(*ConvertedName))
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ j = 0;
+
+ for (i = 0; i < PrefixLength; i++)
+ {
+ (*ConvertedName)[j++] = InternalName[i];
+ }
+
+ if (NumSegments > 0)
+ {
+ for (i = 0; i < NumSegments; i++)
+ {
+ if (i > 0)
+ {
+ (*ConvertedName)[j++] = '.';
+ }
+
+ (*ConvertedName)[j++] = InternalName[NamesIndex++];
+ (*ConvertedName)[j++] = InternalName[NamesIndex++];
+ (*ConvertedName)[j++] = InternalName[NamesIndex++];
+ (*ConvertedName)[j++] = InternalName[NamesIndex++];
+ }
+ }
+
+ if (ConvertedNameLength)
+ {
+ *ConvertedNameLength = (UINT32) RequiredLength;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsMapHandleToNode
+ *
+ * PARAMETERS: Handle - Handle to be converted to an Node
+ *
+ * RETURN: A Name table entry pointer
+ *
+ * DESCRIPTION: Convert a namespace handle to a real Node
+ *
+ * Note: Real integer handles allow for more verification
+ * and keep all pointers within this subsystem.
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiNsMapHandleToNode (
+ ACPI_HANDLE Handle)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Simple implementation.
+ */
+ if (!Handle)
+ {
+ return (NULL);
+ }
+
+ if (Handle == ACPI_ROOT_OBJECT)
+ {
+ return (AcpiGbl_RootNode);
+ }
+
+ /* We can at least attempt to verify the handle */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Handle) != ACPI_DESC_TYPE_NAMED)
+ {
+ return (NULL);
+ }
+
+ return ((ACPI_NAMESPACE_NODE *) Handle);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsConvertEntryToHandle
+ *
+ * PARAMETERS: Node - Node to be converted to a Handle
+ *
+ * RETURN: An USER ACPI_HANDLE
+ *
+ * DESCRIPTION: Convert a real Node to a namespace handle
+ *
+ ******************************************************************************/
+
+ACPI_HANDLE
+AcpiNsConvertEntryToHandle (
+ ACPI_NAMESPACE_NODE *Node)
+{
+
+
+ /*
+ * Simple implementation for now;
+ */
+ return ((ACPI_HANDLE) Node);
+
+
+/* ---------------------------------------------------
+
+ if (!Node)
+ {
+ return (NULL);
+ }
+
+ if (Node == AcpiGbl_RootNode)
+ {
+ return (ACPI_ROOT_OBJECT);
+ }
+
+
+ return ((ACPI_HANDLE) Node);
+------------------------------------------------------*/
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsTerminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: free memory allocated for table storage.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsTerminate (void)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("NsTerminate");
+
+
+ /*
+ * 1) Free the entire namespace -- all nodes and objects
+ *
+ * Delete all object descriptors attached to namepsace nodes
+ */
+ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
+
+ /* Detach any objects attached to the root */
+
+ ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
+ if (ObjDesc)
+ {
+ AcpiNsDetachObject (AcpiGbl_RootNode);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
+
+ /*
+ * 2) Now we can delete the ACPI tables
+ */
+ AcpiTbDeleteAllTables ();
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsOpensScope
+ *
+ * PARAMETERS: Type - A valid namespace type
+ *
+ * RETURN: NEWSCOPE if the passed type "opens a name scope" according
+ * to the ACPI specification, else 0
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiNsOpensScope (
+ ACPI_OBJECT_TYPE Type)
+{
+ ACPI_FUNCTION_TRACE_STR ("NsOpensScope", AcpiUtGetTypeName (Type));
+
+
+ if (!AcpiUtValidObjectType (Type))
+ {
+ /* type code out of range */
+
+ ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type));
+ return_VALUE (ACPI_NS_NORMAL);
+ }
+
+ return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetNodeByPath
+ *
+ * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
+ * \ (backslash) and ^ (carat) prefixes, and the
+ * . (period) to separate segments are supported.
+ * StartNode - Root of subtree to be searched, or NS_ALL for the
+ * root of the name space. If Name is fully
+ * qualified (first INT8 is '\'), the passed value
+ * of Scope will not be accessed.
+ * Flags - Used to indicate whether to perform upsearch or
+ * not.
+ * ReturnNode - Where the Node is returned
+ *
+ * DESCRIPTION: Look up a name relative to a given scope and return the
+ * corresponding Node. NOTE: Scope can be null.
+ *
+ * MUTEX: Locks namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsGetNodeByPath (
+ char *Pathname,
+ ACPI_NAMESPACE_NODE *StartNode,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_STATUS Status;
+ char *InternalPath = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("NsGetNodeByPath", Pathname);
+
+
+ if (Pathname)
+ {
+ /* Convert path to internal representation */
+
+ Status = AcpiNsInternalizeName (Pathname, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Must lock namespace during lookup */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Setup lookup scope (search starting point) */
+
+ ScopeInfo.Scope.Node = StartNode;
+
+ /* Lookup the name in the namespace */
+
+ Status = AcpiNsLookup (&ScopeInfo, InternalPath,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ (Flags | ACPI_NS_DONT_OPEN_SCOPE),
+ NULL, ReturnNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
+ InternalPath, AcpiFormatException (Status)));
+ }
+
+ /* Cleanup */
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ if (InternalPath)
+ {
+ ACPI_MEM_FREE (InternalPath);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsFindParentName
+ *
+ * PARAMETERS: *ChildNode - Named Obj whose name is to be found
+ *
+ * RETURN: The ACPI name
+ *
+ * DESCRIPTION: Search for the given obj in its parent scope and return the
+ * name segment, or "????" if the parent name can't be found
+ * (which "should not happen").
+ *
+ ******************************************************************************/
+
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *ChildNode)
+{
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_TRACE ("NsFindParentName");
+
+
+ if (ChildNode)
+ {
+ /* Valid entry. Get the parent Node */
+
+ ParentNode = AcpiNsGetParentNode (ChildNode);
+ if (ParentNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
+ ChildNode, ChildNode->Name.Ascii,
+ ParentNode, ParentNode->Name.Ascii));
+
+ if (ParentNode->Name.Integer)
+ {
+ return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
+ ChildNode, ChildNode->Name.Ascii));
+ }
+
+ return_VALUE (ACPI_UNKNOWN_NAME);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetParentNode
+ *
+ * PARAMETERS: Node - Current table entry
+ *
+ * RETURN: Parent entry of the given entry
+ *
+ * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
+ *
+ ******************************************************************************/
+
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetParentNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Node)
+ {
+ return (NULL);
+ }
+
+ /*
+ * Walk to the end of this peer list.
+ * The last entry is marked with a flag and the peer
+ * pointer is really a pointer back to the parent.
+ * This saves putting a parent back pointer in each and
+ * every named object!
+ */
+ while (!(Node->Flags & ANOBJ_END_OF_PEER_LIST))
+ {
+ Node = Node->Peer;
+ }
+
+
+ return (Node->Peer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetNextValidNode
+ *
+ * PARAMETERS: Node - Current table entry
+ *
+ * RETURN: Next valid Node in the linked node list. NULL if no more valid
+ * nodess
+ *
+ * DESCRIPTION: Find the next valid node within a name table.
+ * Useful for implementing NULL-end-of-list loops.
+ *
+ ******************************************************************************/
+
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextValidNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+
+ /* If we are at the end of this peer list, return NULL */
+
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ return NULL;
+ }
+
+ /* Otherwise just return the next peer */
+
+ return (Node->Peer);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c
new file mode 100644
index 0000000..b1dad48
--- /dev/null
+++ b/sys/contrib/dev/acpica/nswalk.c
@@ -0,0 +1,383 @@
+/******************************************************************************
+ *
+ * Module Name: nswalk - Functions for walking the ACPI namespace
+ * $Revision: 35 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSWALK_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nswalk")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetNextNode
+ *
+ * PARAMETERS: Type - Type of node to be searched for
+ * ParentNode - Parent node whose children we are
+ * getting
+ * ChildNode - Previous child that was found.
+ * The NEXT child will be returned
+ *
+ * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
+ * none is found.
+ *
+ * DESCRIPTION: Return the next peer node within the namespace. If Handle
+ * is valid, Scope is ignored. Otherwise, the first node
+ * within Scope is returned.
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextNode (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_NAMESPACE_NODE *ChildNode)
+{
+ ACPI_NAMESPACE_NODE *NextNode = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!ChildNode)
+ {
+ /* It's really the parent's _scope_ that we want */
+
+ if (ParentNode->Child)
+ {
+ NextNode = ParentNode->Child;
+ }
+ }
+
+ else
+ {
+ /* Start search at the NEXT node */
+
+ NextNode = AcpiNsGetNextValidNode (ChildNode);
+ }
+
+ /* If any type is OK, we are done */
+
+ if (Type == ACPI_TYPE_ANY)
+ {
+ /* NextNode is NULL if we are at the end-of-list */
+
+ return (NextNode);
+ }
+
+ /* Must search for the node -- but within this scope only */
+
+ while (NextNode)
+ {
+ /* If type matches, we are done */
+
+ if (NextNode->Type == Type)
+ {
+ return (NextNode);
+ }
+
+ /* Otherwise, move on to the next node */
+
+ NextNode = AcpiNsGetNextValidNode (NextNode);
+ }
+
+ /* Not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsWalkNamespace
+ *
+ * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
+ * StartNode - Handle in namespace where search begins
+ * MaxDepth - Depth to which search is to reach
+ * UnlockBeforeCallback- Whether to unlock the NS before invoking
+ * the callback routine
+ * UserFunction - Called when an object of "Type" is found
+ * Context - Passed to user function
+ * ReturnValue - from the UserFunction if terminated early.
+ * Otherwise, returns NULL.
+ * RETURNS: Status
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ * starting (and ending) at the node specified by StartHandle.
+ * The UserFunction is called whenever a node that matches
+ * the type parameter is found. If the user function returns
+ * a non-zero value, the search is terminated immediately and this
+ * value is returned to the caller.
+ *
+ * The point of this procedure is to provide a generic namespace
+ * walk routine that can be called from multiple places to
+ * provide multiple services; the User Function can be tailored
+ * to each task, whether it is a print function, a compare
+ * function, etc.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsWalkNamespace (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE StartNode,
+ UINT32 MaxDepth,
+ BOOLEAN UnlockBeforeCallback,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+ ACPI_STATUS MutexStatus;
+ ACPI_NAMESPACE_NODE *ChildNode;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_OBJECT_TYPE ChildType;
+ UINT32 Level;
+
+
+ ACPI_FUNCTION_TRACE ("NsWalkNamespace");
+
+
+ /* Special case for the namespace Root Node */
+
+ if (StartNode == ACPI_ROOT_OBJECT)
+ {
+ StartNode = AcpiGbl_RootNode;
+ }
+
+ /* Null child means "get first node" */
+
+ ParentNode = StartNode;
+ ChildNode = 0;
+ ChildType = ACPI_TYPE_ANY;
+ Level = 1;
+
+ /*
+ * Traverse the tree of nodes until we bubble back up to where we
+ * started. When Level is zero, the loop is done because we have
+ * bubbled up to (and passed) the original parent handle (StartEntry)
+ */
+ while (Level > 0)
+ {
+ /* Get the next node in this scope. Null if not found */
+
+ Status = AE_OK;
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+ if (ChildNode)
+ {
+ /*
+ * Found node, Get the type if we are not
+ * searching for ANY
+ */
+ if (Type != ACPI_TYPE_ANY)
+ {
+ ChildType = ChildNode->Type;
+ }
+
+ if (ChildType == Type)
+ {
+ /*
+ * Found a matching node, invoke the user
+ * callback function
+ */
+ if (UnlockBeforeCallback)
+ {
+ MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (MutexStatus))
+ {
+ return_ACPI_STATUS (MutexStatus);
+ }
+ }
+
+ Status = UserFunction (ChildNode, Level,
+ Context, ReturnValue);
+
+ if (UnlockBeforeCallback)
+ {
+ MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (MutexStatus))
+ {
+ return_ACPI_STATUS (MutexStatus);
+ }
+ }
+
+ switch (Status)
+ {
+ case AE_OK:
+ case AE_CTRL_DEPTH:
+
+ /* Just keep going */
+ break;
+
+ case AE_CTRL_TERMINATE:
+
+ /* Exit now, with OK status */
+
+ return_ACPI_STATUS (AE_OK);
+
+ default:
+
+ /* All others are valid exceptions */
+
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Depth first search:
+ * Attempt to go down another level in the namespace
+ * if we are allowed to. Don't go any further if we
+ * have reached the caller specified maximum depth
+ * or if the user function has specified that the
+ * maximum depth has been reached.
+ */
+ if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH))
+ {
+ if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, 0))
+ {
+ /*
+ * There is at least one child of this
+ * node, visit the onde
+ */
+ Level++;
+ ParentNode = ChildNode;
+ ChildNode = 0;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * No more children of this node (AcpiNsGetNextNode
+ * failed), go back upwards in the namespace tree to
+ * the node's parent.
+ */
+ Level--;
+ ChildNode = ParentNode;
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+ }
+
+ /* Complete walk, not terminated by user function */
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsxfeval.c b/sys/contrib/dev/acpica/nsxfeval.c
new file mode 100644
index 0000000..e779c44
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsxfeval.c
@@ -0,0 +1,876 @@
+/*******************************************************************************
+ *
+ * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
+ * ACPI Object evaluation interfaces
+ * $Revision: 10 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSXFEVAL_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsxfeval")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvaluateObjectTyped
+ *
+ * PARAMETERS: Handle - Object handle (optional)
+ * *Pathname - Object pathname (optional)
+ * **ExternalParams - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *ReturnBuffer - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * ReturnType - Expected type of return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and evaluate the given object, passing the given
+ * parameters if necessary. One of "Handle" or "Pathname" must
+ * be valid (non-null)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvaluateObjectTyped (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ ACPI_OBJECT_LIST *ExternalParams,
+ ACPI_BUFFER *ReturnBuffer,
+ ACPI_OBJECT_TYPE ReturnType)
+{
+ ACPI_STATUS Status;
+ BOOLEAN MustFree = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped");
+
+
+ /* Return buffer must be valid */
+
+ if (!ReturnBuffer)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER)
+ {
+ MustFree = TRUE;
+ }
+
+ /* Evaluate the object */
+
+ Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Type ANY means "don't care" */
+
+ if (ReturnType == ACPI_TYPE_ANY)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (ReturnBuffer->Length == 0)
+ {
+ /* Error because caller specifically asked for a return value */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No return value\n"));
+
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Examine the object type returned from EvaluateObject */
+
+ if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Return object type does not match requested type */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Incorrect return type [%s] requested [%s]\n",
+ AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
+ AcpiUtGetTypeName (ReturnType)));
+
+ if (MustFree)
+ {
+ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
+
+ AcpiOsFree (ReturnBuffer->Pointer);
+ ReturnBuffer->Pointer = NULL;
+ }
+
+ ReturnBuffer->Length = 0;
+ return_ACPI_STATUS (AE_TYPE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvaluateObject
+ *
+ * PARAMETERS: Handle - Object handle (optional)
+ * *Pathname - Object pathname (optional)
+ * **ExternalParams - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *ReturnBuffer - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and evaluate the given object, passing the given
+ * parameters if necessary. One of "Handle" or "Pathname" must
+ * be valid (non-null)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvaluateObject (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ ACPI_OBJECT_LIST *ExternalParams,
+ ACPI_BUFFER *ReturnBuffer)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT **InternalParams = NULL;
+ ACPI_OPERAND_OBJECT *InternalReturnObj = NULL;
+ ACPI_SIZE BufferSpaceNeeded;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
+
+
+ /*
+ * If there are parameters to be passed to the object
+ * (which must be a control method), the external objects
+ * must be converted to internal objects
+ */
+ if (ExternalParams && ExternalParams->Count)
+ {
+ /*
+ * Allocate a new parameter block for the internal objects
+ * Add 1 to count to allow for null terminated internal list
+ */
+ InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) *
+ sizeof (void *));
+ if (!InternalParams)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Convert each external object in the list to an
+ * internal object
+ */
+ for (i = 0; i < ExternalParams->Count; i++)
+ {
+ Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
+ &InternalParams[i]);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteInternalObjectList (InternalParams);
+ return_ACPI_STATUS (Status);
+ }
+ }
+ InternalParams[ExternalParams->Count] = NULL;
+ }
+
+ /*
+ * Three major cases:
+ * 1) Fully qualified pathname
+ * 2) No handle, not fully qualified pathname (error)
+ * 3) Valid handle
+ */
+ if ((Pathname) &&
+ (AcpiNsValidRootPrefix (Pathname[0])))
+ {
+ /*
+ * The path is fully qualified, just evaluate by name
+ */
+ Status = AcpiNsEvaluateByName (Pathname, InternalParams,
+ &InternalReturnObj);
+ }
+ else if (!Handle)
+ {
+ /*
+ * A handle is optional iff a fully qualified pathname
+ * is specified. Since we've already handled fully
+ * qualified names above, this is an error
+ */
+ if (!Pathname)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Both Handle and Pathname are NULL\n"));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Handle is NULL and Pathname is relative\n"));
+ }
+
+ Status = AE_BAD_PARAMETER;
+ }
+ else
+ {
+ /*
+ * We get here if we have a handle -- and if we have a
+ * pathname it is relative. The handle will be validated
+ * in the lower procedures
+ */
+ if (!Pathname)
+ {
+ /*
+ * The null pathname case means the handle is for
+ * the actual object to be evaluated
+ */
+ Status = AcpiNsEvaluateByHandle (Handle, InternalParams,
+ &InternalReturnObj);
+ }
+ else
+ {
+ /*
+ * Both a Handle and a relative Pathname
+ */
+ Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams,
+ &InternalReturnObj);
+ }
+ }
+
+
+ /*
+ * If we are expecting a return value, and all went well above,
+ * copy the return value to an external object.
+ */
+ if (ReturnBuffer)
+ {
+ if (!InternalReturnObj)
+ {
+ ReturnBuffer->Length = 0;
+ }
+ else
+ {
+ if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED)
+ {
+ /*
+ * If we received a NS Node as a return object, this means that
+ * the object we are evaluating has nothing interesting to
+ * return (such as a mutex, etc.) We return an error because
+ * these types are essentially unsupported by this interface.
+ * We don't check up front because this makes it easier to add
+ * support for various types at a later date if necessary.
+ */
+ Status = AE_TYPE;
+ InternalReturnObj = NULL; /* No need to delete a NS Node */
+ ReturnBuffer->Length = 0;
+ }
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Find out how large a buffer is needed
+ * to contain the returned object
+ */
+ Status = AcpiUtGetObjectSize (InternalReturnObj,
+ &BufferSpaceNeeded);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * Caller's buffer is too small or a new one can't be allocated
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Needed buffer size %X, %s\n",
+ (UINT32) BufferSpaceNeeded, AcpiFormatException (Status)));
+ }
+ else
+ {
+ /*
+ * We have enough space for the object, build it
+ */
+ Status = AcpiUtCopyIobjectToEobject (InternalReturnObj,
+ ReturnBuffer);
+ }
+ }
+ }
+ }
+ }
+
+ /* Delete the return and parameter objects */
+
+ if (InternalReturnObj)
+ {
+ /*
+ * Delete the internal return object. (Or at least
+ * decrement the reference count by one)
+ */
+ AcpiUtRemoveReference (InternalReturnObj);
+ }
+
+ /*
+ * Free the input parameter list (if we created one),
+ */
+ if (InternalParams)
+ {
+ /* Free the allocated parameter block */
+
+ AcpiUtDeleteInternalObjectList (InternalParams);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiWalkNamespace
+ *
+ * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
+ * StartObject - Handle in namespace where search begins
+ * MaxDepth - Depth to which search is to reach
+ * UserFunction - Called when an object of "Type" is found
+ * Context - Passed to user function
+ * ReturnValue - Location where return value of
+ * UserFunction is put if terminated early
+ *
+ * RETURNS Return value from the UserFunction if terminated early.
+ * Otherwise, returns NULL.
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ * starting (and ending) at the object specified by StartHandle.
+ * The UserFunction is called whenever an object that matches
+ * the type parameter is found. If the user function returns
+ * a non-zero value, the search is terminated immediately and this
+ * value is returned to the caller.
+ *
+ * The point of this procedure is to provide a generic namespace
+ * walk routine that can be called from multiple places to
+ * provide multiple services; the User Function can be tailored
+ * to each task, whether it is a print function, a compare
+ * function, etc.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiWalkNamespace (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE StartObject,
+ UINT32 MaxDepth,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
+
+
+ /* Parameter validation */
+
+ if ((Type > ACPI_TYPE_EXTERNAL_MAX) ||
+ (!MaxDepth) ||
+ (!UserFunction))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Lock the namespace around the walk.
+ * The namespace will be unlocked/locked around each call
+ * to the user function - since this function
+ * must be allowed to make Acpi calls itself.
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK,
+ UserFunction, Context, ReturnValue);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetDeviceCallback
+ *
+ * PARAMETERS: Callback from AcpiGetDevice
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
+ * present devices, or if they specified a HID, it filters based
+ * on that.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsGetDeviceCallback (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_GET_DEVICES_INFO *Info = Context;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ UINT32 Flags;
+ ACPI_DEVICE_ID Hid;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NATIVE_UINT i;
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ if (!Node)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Run _STA to determine if device is present */
+
+ Status = AcpiUtExecute_STA (Node, &Flags);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_CTRL_DEPTH);
+ }
+
+ if (!(Flags & 0x01))
+ {
+ /* Don't return at the device or children of the device if not there */
+
+ return (AE_CTRL_DEPTH);
+ }
+
+ /* Filter based on device HID & CID */
+
+ if (Info->Hid != NULL)
+ {
+ Status = AcpiUtExecute_HID (Node, &Hid);
+ if (Status == AE_NOT_FOUND)
+ {
+ return (AE_OK);
+ }
+ else if (ACPI_FAILURE (Status))
+ {
+ return (AE_CTRL_DEPTH);
+ }
+
+ if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0)
+ {
+ /* Get the list of Compatible IDs */
+
+ Status = AcpiUtExecute_CID (Node, &Cid);
+ if (Status == AE_NOT_FOUND)
+ {
+ return (AE_OK);
+ }
+ else if (ACPI_FAILURE (Status))
+ {
+ return (AE_CTRL_DEPTH);
+ }
+
+ /* Walk the CID list */
+
+ for (i = 0; i < Cid->Count; i++)
+ {
+ if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid,
+ sizeof (ACPI_COMPATIBLE_ID)) != 0)
+ {
+ ACPI_MEM_FREE (Cid);
+ return (AE_OK);
+ }
+ }
+ ACPI_MEM_FREE (Cid);
+ }
+ }
+
+ Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetDevices
+ *
+ * PARAMETERS: HID - HID to search for. Can be NULL.
+ * UserFunction - Called when a matching object is found
+ * Context - Passed to user function
+ * ReturnValue - Location where return value of
+ * UserFunction is put if terminated early
+ *
+ * RETURNS Return value from the UserFunction if terminated early.
+ * Otherwise, returns NULL.
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ * starting (and ending) at the object specified by StartHandle.
+ * The UserFunction is called whenever an object of type
+ * Device is found. If the user function returns
+ * a non-zero value, the search is terminated immediately and this
+ * value is returned to the caller.
+ *
+ * This is a wrapper for WalkNamespace, but the callback performs
+ * additional filtering. Please see AcpiGetDeviceCallback.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetDevices (
+ char *HID,
+ ACPI_WALK_CALLBACK UserFunction,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+ ACPI_GET_DEVICES_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetDevices");
+
+
+ /* Parameter validation */
+
+ if (!UserFunction)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * We're going to call their callback from OUR callback, so we need
+ * to know what it is, and their context parameter.
+ */
+ Info.Context = Context;
+ Info.UserFunction = UserFunction;
+ Info.Hid = HID;
+
+ /*
+ * Lock the namespace around the walk.
+ * The namespace will be unlocked/locked around each call
+ * to the user function - since this function
+ * must be allowed to make Acpi calls itself.
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
+ ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_UNLOCK,
+ AcpiNsGetDeviceCallback, &Info,
+ ReturnValue);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiAttachData
+ *
+ * PARAMETERS: ObjHandle - Namespace node
+ * Handler - Handler for this attachment
+ * Data - Pointer to data to be attached
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiAttachData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler,
+ void *Data)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Parameter validation */
+
+ if (!ObjHandle ||
+ !Handler ||
+ !Data)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Convert and validate the handle */
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiNsAttachData (Node, Handler, Data);
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDetachData
+ *
+ * PARAMETERS: ObjHandle - Namespace node handle
+ * Handler - Handler used in call to AcpiAttachData
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove data that was previously attached to a node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDetachData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Parameter validation */
+
+ if (!ObjHandle ||
+ !Handler)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Convert and validate the handle */
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiNsDetachData (Node, Handler);
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetData
+ *
+ * PARAMETERS: ObjHandle - Namespace node
+ * Handler - Handler used in call to AttachData
+ * Data - Where the data is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetData (
+ ACPI_HANDLE ObjHandle,
+ ACPI_OBJECT_HANDLER Handler,
+ void **Data)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Parameter validation */
+
+ if (!ObjHandle ||
+ !Handler ||
+ !Data)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Convert and validate the handle */
+
+ Node = AcpiNsMapHandleToNode (ObjHandle);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiNsGetAttachedData (Node, Handler, Data);
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c
new file mode 100644
index 0000000..cac3914
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsxfname.c
@@ -0,0 +1,456 @@
+/******************************************************************************
+ *
+ * Module Name: nsxfname - Public interfaces to the ACPI subsystem
+ * ACPI Namespace oriented interfaces
+ * $Revision: 97 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSXFNAME_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsxfname")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetHandle
+ *
+ * PARAMETERS: Parent - Object to search under (search scope).
+ * PathName - Pointer to an asciiz string containing the
+ * name
+ * RetHandle - Where the return handle is placed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This routine will search for a caller specified name in the
+ * name space. The caller can restrict the search region by
+ * specifying a non NULL parent. The parent value is itself a
+ * namespace handle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetHandle (
+ ACPI_HANDLE Parent,
+ ACPI_STRING Pathname,
+ ACPI_HANDLE *RetHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = NULL;
+ ACPI_NAMESPACE_NODE *PrefixNode = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Parameter Validation */
+
+ if (!RetHandle || !Pathname)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Convert a parent handle to a prefix node */
+
+ if (Parent)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ PrefixNode = AcpiNsMapHandleToNode (Parent);
+ if (!PrefixNode)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ /* Special case for root, since we can't search for it */
+
+ if (ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH) == 0)
+ {
+ *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
+ return (AE_OK);
+ }
+
+ /*
+ * Find the Node and convert to a handle
+ */
+ Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH,
+ &Node);
+
+ *RetHandle = NULL;
+ if (ACPI_SUCCESS (Status))
+ {
+ *RetHandle = AcpiNsConvertEntryToHandle (Node);
+ }
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetName
+ *
+ * PARAMETERS: Handle - Handle to be converted to a pathname
+ * NameType - Full pathname or single segment
+ * Buffer - Buffer for returned path
+ *
+ * RETURN: Pointer to a string containing the fully qualified Name.
+ *
+ * DESCRIPTION: This routine returns the fully qualified name associated with
+ * the Handle parameter. This and the AcpiPathnameToHandle are
+ * complementary functions.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetName (
+ ACPI_HANDLE Handle,
+ UINT32 NameType,
+ ACPI_BUFFER *Buffer)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ /* Parameter validation */
+
+ if (NameType > ACPI_NAME_TYPE_MAX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ if (NameType == ACPI_FULL_PATHNAME)
+ {
+ /* Get the full pathname (From the namespace root) */
+
+ Status = AcpiNsHandleToPathname (Handle, Buffer);
+ return (Status);
+ }
+
+ /*
+ * Wants the single segment ACPI name.
+ * Validate handle and convert to a namespace Node
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (Handle);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Just copy the ACPI name from the Node and zero terminate it */
+
+ ACPI_STRNCPY (Buffer->Pointer, Node->Name.Ascii,
+ ACPI_NAME_SIZE);
+ ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
+ Status = AE_OK;
+
+
+UnlockAndExit:
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetObjectInfo
+ *
+ * PARAMETERS: Handle - Object Handle
+ * Info - Where the info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Returns information about an object as gleaned from the
+ * namespace node and possibly by running several standard
+ * control methods (Such as in the case of a device.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetObjectInfo (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *Buffer)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_DEVICE_INFO Info;
+ ACPI_DEVICE_INFO *ReturnInfo;
+ ACPI_COMPATIBLE_ID_LIST *CidList = NULL;
+ ACPI_SIZE Size;
+
+
+ /* Parameter validation */
+
+ if (!Handle || !Buffer)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (Handle);
+ if (!Node)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Init return structure */
+
+ Size = sizeof (ACPI_DEVICE_INFO);
+ ACPI_MEMSET (&Info, 0, Size);
+
+ Info.Type = Node->Type;
+ Info.Name = Node->Name.Integer;
+ Info.Valid = 0;
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* If not a device, we are all done */
+
+ if (Info.Type == ACPI_TYPE_DEVICE)
+ {
+ /*
+ * Get extra info for ACPI Devices objects only:
+ * Run the Device _HID, _UID, _CID, _STA, and _ADR methods.
+ *
+ * Note: none of these methods are required, so they may or may
+ * not be present for this device. The Info.Valid bitfield is used
+ * to indicate which methods were found and ran successfully.
+ */
+
+ /* Execute the Device._HID method */
+
+ Status = AcpiUtExecute_HID (Node, &Info.HardwareId);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_HID;
+ }
+
+ /* Execute the Device._UID method */
+
+ Status = AcpiUtExecute_UID (Node, &Info.UniqueId);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_UID;
+ }
+
+ /* Execute the Device._CID method */
+
+ Status = AcpiUtExecute_CID (Node, &CidList);
+ if (ACPI_SUCCESS (Status))
+ {
+ Size += ((ACPI_SIZE) CidList->Count - 1) *
+ sizeof (ACPI_COMPATIBLE_ID);
+ Info.Valid |= ACPI_VALID_CID;
+ }
+
+ /* Execute the Device._STA method */
+
+ Status = AcpiUtExecute_STA (Node, &Info.CurrentStatus);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_STA;
+ }
+
+ /* Execute the Device._ADR method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node,
+ &Info.Address);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_ADR;
+ }
+
+ Status = AE_OK;
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (Buffer, Size);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Populate the return buffer */
+
+ ReturnInfo = Buffer->Pointer;
+ ACPI_MEMCPY (ReturnInfo, &Info, sizeof (ACPI_DEVICE_INFO));
+
+ if (CidList)
+ {
+ ACPI_MEMCPY (&ReturnInfo->CompatibilityId, CidList, CidList->Size);
+ }
+
+
+Cleanup:
+ if (CidList)
+ {
+ ACPI_MEM_FREE (CidList);
+ }
+ return (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c
new file mode 100644
index 0000000..49310ca
--- /dev/null
+++ b/sys/contrib/dev/acpica/nsxfobj.c
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ *
+ * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
+ * ACPI Object oriented interfaces
+ * $Revision: 116 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __NSXFOBJ_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsxfobj")
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetType
+ *
+ * PARAMETERS: Handle - Handle of object whose type is desired
+ * *RetType - Where the type will be placed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This routine returns the type associatd with a particular handle
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetType (
+ ACPI_HANDLE Handle,
+ ACPI_OBJECT_TYPE *RetType)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ /* Parameter Validation */
+
+ if (!RetType)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Special case for the predefined Root Node
+ * (return type ANY)
+ */
+ if (Handle == ACPI_ROOT_OBJECT)
+ {
+ *RetType = ACPI_TYPE_ANY;
+ return (AE_OK);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Convert and validate the handle */
+
+ Node = AcpiNsMapHandleToNode (Handle);
+ if (!Node)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (AE_BAD_PARAMETER);
+ }
+
+ *RetType = Node->Type;
+
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetParent
+ *
+ * PARAMETERS: Handle - Handle of object whose parent is desired
+ * RetHandle - Where the parent handle will be placed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Returns a handle to the parent of the object represented by
+ * Handle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetParent (
+ ACPI_HANDLE Handle,
+ ACPI_HANDLE *RetHandle)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ if (!RetHandle)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Special case for the predefined Root Node (no parent) */
+
+ if (Handle == ACPI_ROOT_OBJECT)
+ {
+ return (AE_NULL_ENTRY);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Convert and validate the handle */
+
+ Node = AcpiNsMapHandleToNode (Handle);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Get the parent entry */
+
+ *RetHandle =
+ AcpiNsConvertEntryToHandle (AcpiNsGetParentNode (Node));
+
+ /* Return exception if parent is null */
+
+ if (!AcpiNsGetParentNode (Node))
+ {
+ Status = AE_NULL_ENTRY;
+ }
+
+
+UnlockAndExit:
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetNextObject
+ *
+ * PARAMETERS: Type - Type of object to be searched for
+ * Parent - Parent object whose children we are getting
+ * LastChild - Previous child that was found.
+ * The NEXT child will be returned
+ * RetHandle - Where handle to the next object is placed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return the next peer object within the namespace. If Handle is
+ * valid, Scope is ignored. Otherwise, the first object within
+ * Scope is returned.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetNextObject (
+ ACPI_OBJECT_TYPE Type,
+ ACPI_HANDLE Parent,
+ ACPI_HANDLE Child,
+ ACPI_HANDLE *RetHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *ParentNode = NULL;
+ ACPI_NAMESPACE_NODE *ChildNode = NULL;
+
+
+ /* Parameter validation */
+
+ if (Type > ACPI_TYPE_EXTERNAL_MAX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* If null handle, use the parent */
+
+ if (!Child)
+ {
+ /* Start search at the beginning of the specified scope */
+
+ ParentNode = AcpiNsMapHandleToNode (Parent);
+ if (!ParentNode)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+ }
+ else
+ {
+ /* Non-null handle, ignore the parent */
+ /* Convert and validate the handle */
+
+ ChildNode = AcpiNsMapHandleToNode (Child);
+ if (!ChildNode)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+ }
+
+ /* Internal function does the real work */
+
+ Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode);
+ if (!Node)
+ {
+ Status = AE_NOT_FOUND;
+ goto UnlockAndExit;
+ }
+
+ if (RetHandle)
+ {
+ *RetHandle = AcpiNsConvertEntryToHandle (Node);
+ }
+
+
+UnlockAndExit:
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c
new file mode 100644
index 0000000..0e8e26b
--- /dev/null
+++ b/sys/contrib/dev/acpica/osunixxf.c
@@ -0,0 +1,1085 @@
+/******************************************************************************
+ *
+ * Module Name: osunixxf - UNIX OSL interfaces
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+/*
+ * These interfaces are required in order to compile the ASL compiler under
+ * Linux.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdebug.h"
+
+#define _COMPONENT ACPI_OS_SERVICES
+ ACPI_MODULE_NAME ("osunixxf")
+
+
+extern FILE *AcpiGbl_DebugFile;
+FILE *AcpiGbl_OutputFile;
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Init and terminate. Nothing to do.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsInitialize (void)
+{
+ AcpiGbl_OutputFile = stdout;
+
+ return AE_OK;
+}
+
+
+ACPI_STATUS
+AcpiOsTerminate (void)
+{
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetRootPointer
+ *
+ * PARAMETERS: Flags - Logical or physical addressing mode
+ * Address - Where the address is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Gets the root pointer (RSDP)
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsGetRootPointer (
+ UINT32 Flags,
+ ACPI_POINTER *Address)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsPredefinedOverride
+ *
+ * PARAMETERS: InitVal - Initial value of the predefined object
+ * NewVal - The new value for the object
+ *
+ * RETURN: Status, pointer to value. Null pointer returned if not
+ * overriding.
+ *
+ * DESCRIPTION: Allow the OS to override predefined names
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsPredefinedOverride (
+ const ACPI_PREDEFINED_NAMES *InitVal,
+ ACPI_STRING *NewVal)
+{
+
+ if (!InitVal || !NewVal)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ *NewVal = NULL;
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsTableOverride
+ *
+ * PARAMETERS: ExistingTable - Header of current table (probably firmware)
+ * NewTable - Where an entire new table is returned.
+ *
+ * RETURN: Status, pointer to new table. Null pointer returned if no
+ * table is available to override
+ *
+ * DESCRIPTION: Return a different version of a table if one is available
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_TABLE_HEADER **NewTable)
+{
+ if (!ExistingTable || !NewTable)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ *NewTable = NULL;
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadable
+ *
+ * PARAMETERS: Pointer - Area to be verified
+ * Length - Size of area
+ *
+ * RETURN: TRUE if readable for entire length
+ *
+ * DESCRIPTION: Verify that a pointer is valid for reading
+ *
+ *****************************************************************************/
+
+BOOLEAN
+AcpiOsReadable (
+ void *Pointer,
+ ACPI_SIZE Length)
+{
+
+ return (TRUE);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWritable
+ *
+ * PARAMETERS: Pointer - Area to be verified
+ * Length - Size of area
+ *
+ * RETURN: TRUE if writable for entire length
+ *
+ * DESCRIPTION: Verify that a pointer is valid for writing
+ *
+ *****************************************************************************/
+
+BOOLEAN
+AcpiOsWritable (
+ void *Pointer,
+ ACPI_SIZE Length)
+{
+
+ return (TRUE);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsRedirectOutput
+ *
+ * PARAMETERS: Destination - An open file handle/pointer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
+ *
+ *****************************************************************************/
+
+void
+AcpiOsRedirectOutput (
+ void *Destination)
+{
+
+ AcpiGbl_OutputFile = Destination;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsPrintf
+ *
+ * PARAMETERS: fmt, ... Standard printf format
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Formatted output
+ *
+ *****************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiOsPrintf (
+ const char *Fmt,
+ ...)
+{
+ va_list Args;
+
+
+ va_start (Args, Fmt);
+
+ AcpiOsVprintf (Fmt, Args);
+
+ va_end (Args);
+ return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsVprintf
+ *
+ * PARAMETERS: fmt Standard printf format
+ * args Argument list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Formatted output with argument list pointer
+ *
+ *****************************************************************************/
+
+void
+AcpiOsVprintf (
+ const char *Fmt,
+ va_list Args)
+{
+ INT32 Count = 0;
+ UINT8 Flags;
+
+
+ Flags = AcpiGbl_DbOutputFlags;
+ if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
+ {
+ /* Output is directable to either a file (if open) or the console */
+
+ if (AcpiGbl_DebugFile)
+ {
+ /* Output file is open, send the output there */
+
+ Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args);
+ }
+ else
+ {
+ /* No redirection, send output to console (once only!) */
+
+ Flags |= ACPI_DB_CONSOLE_OUTPUT;
+ }
+ }
+
+ if (Flags & ACPI_DB_CONSOLE_OUTPUT)
+ {
+ Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args);
+ }
+
+ return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetLine
+ *
+ * PARAMETERS: fmt Standard printf format
+ * args Argument list
+ *
+ * RETURN: Actual bytes read
+ *
+ * DESCRIPTION: Formatted input with argument list pointer
+ *
+ *****************************************************************************/
+
+UINT32
+AcpiOsGetLine (
+ char *Buffer)
+{
+ UINT8 Temp;
+ UINT32 i;
+
+
+ for (i = 0; ; i++)
+ {
+ scanf ("%1c", &Temp);
+ if (!Temp || Temp == '\n')
+ {
+ break;
+ }
+
+ Buffer [i] = Temp;
+ }
+
+ /* Null terminate the buffer */
+
+ Buffer [i] = 0;
+
+ /* Return the number of bytes in the string */
+
+ return (i);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsMapMemory
+ *
+ * PARAMETERS: where Physical address of memory to be mapped
+ * length How much memory to map
+ * there Logical address of mapped memory
+ *
+ * RETURN: Pointer to mapped memory. Null on error.
+ *
+ * DESCRIPTION: Map physical memory into caller's address space
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS where,
+ ACPI_SIZE length,
+ void **there)
+{
+ *there = (void *) (uintptr_t) where;
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsUnmapMemory
+ *
+ * PARAMETERS: where Logical address of memory to be unmapped
+ * length How much memory to unmap
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete a previously created mapping. Where and Length must
+ * correspond to a previous mapping exactly.
+ *
+ *****************************************************************************/
+
+void
+AcpiOsUnmapMemory (
+ void *where,
+ ACPI_SIZE length)
+{
+
+ return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsAllocate
+ *
+ * PARAMETERS: Size Amount to allocate, in bytes
+ *
+ * RETURN: Pointer to the new allocation. Null on error.
+ *
+ * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
+ *
+ *****************************************************************************/
+
+void *
+AcpiOsAllocate (
+ ACPI_SIZE size)
+{
+ void *Mem;
+
+
+ Mem = (void *) malloc ((size_t) size);
+
+ return Mem;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsFree
+ *
+ * PARAMETERS: mem Pointer to previously allocated memory
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Free memory allocated via AcpiOsAllocate
+ *
+ *****************************************************************************/
+
+void
+AcpiOsFree (
+ void *mem)
+{
+
+
+ free (mem);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsCreateSemaphore
+ *
+ * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
+ * OutHandle - Where a handle will be returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create an OS semaphore
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsCreateSemaphore (
+ UINT32 MaxUnits,
+ UINT32 InitialUnits,
+ ACPI_HANDLE *OutHandle)
+{
+
+
+ *OutHandle = (ACPI_HANDLE) 1;
+ return AE_OK;
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsDeleteSemaphore
+ *
+ * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete an OS semaphore
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsDeleteSemaphore (
+ ACPI_HANDLE Handle)
+{
+
+ if (!Handle)
+ {
+ return AE_BAD_PARAMETER;
+ }
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWaitSemaphore
+ *
+ * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
+ * Units - How many units to wait for
+ * Timeout - How long to wait
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Wait for units
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWaitSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units,
+ UINT16 Timeout)
+{
+
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsSignalSemaphore
+ *
+ * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
+ * Units - Number of units to send
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Send units
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsSignalSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units)
+{
+
+
+ return AE_OK;
+}
+
+
+ACPI_STATUS
+AcpiOsCreateLock (
+ ACPI_HANDLE *OutHandle)
+{
+
+ return (AcpiOsCreateSemaphore (1, 1, OutHandle));
+}
+
+void
+AcpiOsDeleteLock (
+ ACPI_HANDLE Handle)
+{
+ AcpiOsDeleteSemaphore (Handle);
+}
+
+
+void
+AcpiOsAcquireLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags)
+{
+ AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
+}
+
+
+void
+AcpiOsReleaseLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags)
+{
+ AcpiOsSignalSemaphore (Handle, 1);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsInstallInterruptHandler
+ *
+ * PARAMETERS: InterruptNumber Level handler should respond to.
+ * Isr Address of the ACPI interrupt handler
+ * ExceptPtr Where status is returned
+ *
+ * RETURN: Handle to the newly installed handler.
+ *
+ * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
+ * OS-independent handler.
+ *
+ *****************************************************************************/
+
+UINT32
+AcpiOsInstallInterruptHandler (
+ UINT32 InterruptNumber,
+ OSD_HANDLER ServiceRoutine,
+ void *Context)
+{
+
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsRemoveInterruptHandler
+ *
+ * PARAMETERS: Handle Returned when handler was installed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Uninstalls an interrupt handler.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsRemoveInterruptHandler (
+ UINT32 InterruptNumber,
+ OSD_HANDLER ServiceRoutine)
+{
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsQueueForExecution
+ *
+ * PARAMETERS: Priority - Requested execution priority
+ * Function - Address of the function to execute
+ * Context - Passed as a parameter to the function
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Sleep at microsecond granularity
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsQueueForExecution (
+ UINT32 Priority,
+ OSD_EXECUTION_CALLBACK Function,
+ void *Context)
+{
+
+// _beginthread (Function, (unsigned) 0, Context);
+ return 0;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsBreakpoint
+ *
+ * PARAMETERS: Msg Message to print
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Print a message and break to the debugger.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsBreakpoint (
+ char *Msg)
+{
+
+ /* Print the message and do an INT 3 */
+
+ if (Msg)
+ {
+ AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
+ }
+ else
+ {
+ AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
+ }
+
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsSleepUsec
+ *
+ * PARAMETERS: microseconds To sleep
+ *
+ * RETURN: Blocks until sleep is completed.
+ *
+ * DESCRIPTION: Sleep at microsecond granularity
+ *
+ *****************************************************************************/
+
+void
+AcpiOsStall (
+ UINT32 microseconds)
+{
+
+ return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsSleep
+ *
+ * PARAMETERS: seconds To sleep
+ * milliseconds To sleep
+ *
+ * RETURN: Blocks until sleep is completed.
+ *
+ * DESCRIPTION: Sleep at second/millisecond granularity
+ *
+ *****************************************************************************/
+
+void
+AcpiOsSleep (
+ UINT32 seconds,
+ UINT32 milliseconds)
+{
+
+ usleep (((seconds * 1000) + milliseconds) * 1000);
+ return;
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetTimer
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Current time in milliseconds
+ *
+ * DESCRIPTION: Get the current system time (in milliseconds).
+ *
+ *****************************************************************************/
+
+UINT32
+AcpiOsGetTimer (void)
+{
+ struct timeval time;
+
+ gettimeofday(&time, NULL);
+
+ return ((time.tv_sec/1000) + (time.tv_usec*1000));
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadPciConfiguration
+ *
+ * PARAMETERS: PciId Seg/Bus/Dev
+ * Register Device Register
+ * Value Buffer where value is placed
+ * Width Number of bits
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read data from PCI configuration space
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadPciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ void *Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWritePciConfiguration
+ *
+ * PARAMETERS: PciId Seg/Bus/Dev
+ * Register Device Register
+ * Value Value to be written
+ * Width Number of bits
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Write data to PCI configuration space
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWritePciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ ACPI_INTEGER Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+/* TEMPORARY STUB FUNCTION */
+void
+AcpiOsDerivePciId(
+ ACPI_HANDLE rhandle,
+ ACPI_HANDLE chandle,
+ ACPI_PCI_ID **PciId)
+{
+
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadPort
+ *
+ * PARAMETERS: Address Address of I/O port/register to read
+ * Value Where value is placed
+ * Width Number of bits
+ *
+ * RETURN: Value read from port
+ *
+ * DESCRIPTION: Read data from an I/O port or register
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadPort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ *Value = 0xFF;
+ break;
+
+ case 16:
+ *Value = 0xFFFF;
+ break;
+
+ case 32:
+ *Value = 0xFFFFFFFF;
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWritePort
+ *
+ * PARAMETERS: Address Address of I/O port/register to write
+ * Value Value to write
+ * Width Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to an I/O port or register
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWritePort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadMemory
+ *
+ * PARAMETERS: Address Physical Memory Address to read
+ * Value Where value is placed
+ * Width Number of bits
+ *
+ * RETURN: Value read from physical memory address
+ *
+ * DESCRIPTION: Read data from a physical memory address
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ case 16:
+ case 32:
+ *Value = 0;
+ break;
+
+ default:
+ return (AE_BAD_PARAMETER);
+ break;
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteMemory
+ *
+ * PARAMETERS: Address Physical Memory Address to write
+ * Value Value to write
+ * Width Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to a physical memory address
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
+UINT32
+AcpiOsGetThreadId(void)
+{
+ return getpid();
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsSignal
+ *
+ * PARAMETERS: Function ACPI CA signal function code
+ * Info Pointer to function-dependent structure
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Miscellaneous functions
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsSignal (
+ UINT32 Function,
+ void *Info)
+{
+
+ switch (Function)
+ {
+ case ACPI_SIGNAL_FATAL:
+ break;
+
+ case ACPI_SIGNAL_BREAKPOINT:
+
+ if (Info)
+ {
+ AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info);
+ }
+ else
+ {
+ AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
+ }
+
+ break;
+ }
+
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c
new file mode 100644
index 0000000..7ada389
--- /dev/null
+++ b/sys/contrib/dev/acpica/psargs.c
@@ -0,0 +1,851 @@
+/******************************************************************************
+ *
+ * Module Name: psargs - Parse AML opcode arguments
+ * $Revision: 73 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __PSARGS_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psargs")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextPackageLength
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Decoded package length. On completion, the AML pointer points
+ * past the length byte or bytes.
+ *
+ * DESCRIPTION: Decode and return a package length field
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiPsGetNextPackageLength (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT32 EncodedLength;
+ UINT32 Length = 0;
+
+
+ ACPI_FUNCTION_TRACE ("PsGetNextPackageLength");
+
+
+ EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+
+
+ switch (EncodedLength >> 6) /* bits 6-7 contain encoding scheme */
+ {
+ case 0: /* 1-byte encoding (bits 0-5) */
+
+ Length = (EncodedLength & 0x3F);
+ break;
+
+
+ case 1: /* 2-byte encoding (next byte + bits 0-3) */
+
+ Length = ((ACPI_GET8 (ParserState->Aml) << 04) |
+ (EncodedLength & 0x0F));
+ ParserState->Aml++;
+ break;
+
+
+ case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
+
+ Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) |
+ (ACPI_GET8 (ParserState->Aml) << 04) |
+ (EncodedLength & 0x0F));
+ ParserState->Aml += 2;
+ break;
+
+
+ case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
+
+ Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) |
+ (ACPI_GET8 (ParserState->Aml + 1) << 12) |
+ (ACPI_GET8 (ParserState->Aml) << 04) |
+ (EncodedLength & 0x0F));
+ ParserState->Aml += 3;
+ break;
+
+ default:
+
+ /* Can't get here, only 2 bits / 4 cases */
+ break;
+ }
+
+ return_VALUE (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextPackageEnd
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Pointer to end-of-package +1
+ *
+ * DESCRIPTION: Get next package length and return a pointer past the end of
+ * the package. Consumes the package length field
+ *
+ ******************************************************************************/
+
+UINT8 *
+AcpiPsGetNextPackageEnd (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT8 *Start = ParserState->Aml;
+ ACPI_NATIVE_UINT Length;
+
+
+ ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd");
+
+
+ /* Function below changes ParserState->Aml */
+
+ Length = (ACPI_NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState);
+
+ return_PTR (Start + Length); /* end of package */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextNamestring
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Pointer to the start of the name string (pointer points into
+ * the AML.
+ *
+ * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name
+ * prefix characters. Set parser state to point past the string.
+ * (Name is consumed from the AML.)
+ *
+ ******************************************************************************/
+
+char *
+AcpiPsGetNextNamestring (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT8 *Start = ParserState->Aml;
+ UINT8 *End = ParserState->Aml;
+
+
+ ACPI_FUNCTION_TRACE ("PsGetNextNamestring");
+
+
+ /* Handle multiple prefix characters */
+
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (End)))
+ {
+ /* Include prefix '\\' or '^' */
+
+ End++;
+ }
+
+ /* Decode the path */
+
+ switch (ACPI_GET8 (End))
+ {
+ case 0:
+
+ /* NullName */
+
+ if (End == Start)
+ {
+ Start = NULL;
+ }
+ End++;
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+
+ /* Two name segments */
+
+ End += 1 + (2 * ACPI_NAME_SIZE);
+ break;
+
+ case AML_MULTI_NAME_PREFIX_OP:
+
+ /* Multiple name segments, 4 chars each */
+
+ End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * ACPI_NAME_SIZE);
+ break;
+
+ default:
+
+ /* Single name segment */
+
+ End += ACPI_NAME_SIZE;
+ break;
+ }
+
+ ParserState->Aml = (UINT8*) End;
+ return_PTR ((char *) Start);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextNamepath
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * Arg - Where the namepath will be stored
+ * ArgCount - If the namepath points to a control method
+ * the method's argument is returned here.
+ * MethodCall - Whether the namepath can possibly be the
+ * start of a method call
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get next name (if method call, return # of required args).
+ * Names are looked up in the internal namespace to determine
+ * if the name represents a control method. If a method
+ * is found, the number of arguments to the method is returned.
+ * This information is critical for parsing to continue correctly.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsGetNextNamepath (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *Arg,
+ BOOLEAN MethodCall)
+{
+ char *Path;
+ ACPI_PARSE_OBJECT *NameOp;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OPERAND_OBJECT *MethodDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_GENERIC_STATE ScopeInfo;
+
+
+ ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
+
+
+ Path = AcpiPsGetNextNamestring (ParserState);
+
+ /* Null path case is allowed */
+
+ if (Path)
+ {
+ /*
+ * Lookup the name in the internal namespace
+ */
+ ScopeInfo.Scope.Node = NULL;
+ Node = ParserState->StartNode;
+ if (Node)
+ {
+ ScopeInfo.Scope.Node = Node;
+ }
+
+ /*
+ * Lookup object. We don't want to add anything new to the namespace
+ * here, however. So we use MODE_EXECUTE. Allow searching of the
+ * parent tree, but don't open a new scope -- we just want to lookup the
+ * object (MUST BE mode EXECUTE to perform upsearch)
+ */
+ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+ if (ACPI_SUCCESS (Status) && MethodCall)
+ {
+ if (Node->Type == ACPI_TYPE_METHOD)
+ {
+ /*
+ * This name is actually a control method invocation
+ */
+ MethodDesc = AcpiNsGetAttachedObject (Node);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Desc %p Path=%p\n",
+ Node, MethodDesc, Path));
+
+ NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!NameOp)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Change arg into a METHOD CALL and attach name to it */
+
+ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+ NameOp->Common.Value.Name = Path;
+
+ /* Point METHODCALL/NAME to the METHOD Node */
+
+ NameOp->Common.Node = Node;
+ AcpiPsAppendArg (Arg, NameOp);
+
+ if (!MethodDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p has no attached object\n",
+ Node));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Args %X\n",
+ Node, MethodDesc->Method.ParamCount));
+
+ /* Get the number of arguments to expect */
+
+ WalkState->ArgCount = MethodDesc->Method.ParamCount;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Else this is normal named object reference.
+ * Just init the NAMEPATH object with the pathname.
+ * (See code below)
+ */
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * 1) Any error other than NOT_FOUND is always severe
+ * 2) NOT_FOUND is only important if we are executing a method.
+ * 3) If executing a CondRefOf opcode, NOT_FOUND is ok.
+ */
+ if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
+ (Status == AE_NOT_FOUND) &&
+ (WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) ||
+
+ (Status != AE_NOT_FOUND))
+ {
+ ACPI_REPORT_NSERROR (Path, Status);
+
+ AcpiOsPrintf ("SearchNode %p StartNode %p ReturnNode %p\n",
+ ScopeInfo.Scope.Node, ParserState->StartNode, Node);
+
+
+ }
+ else
+ {
+ /*
+ * We got a NOT_FOUND during table load or we encountered
+ * a CondRefOf(x) where the target does not exist.
+ * -- either case is ok
+ */
+ Status = AE_OK;
+ }
+ }
+ }
+
+ /*
+ * Regardless of success/failure above,
+ * Just initialize the Op with the pathname.
+ */
+ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
+ Arg->Common.Value.Name = Path;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextSimpleArg
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * ArgType - The argument type (AML_*_ARG)
+ * Arg - Where the argument is returned
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get the next simple argument (constant, string, or namestring)
+ *
+ ******************************************************************************/
+
+void
+AcpiPsGetNextSimpleArg (
+ ACPI_PARSE_STATE *ParserState,
+ UINT32 ArgType,
+ ACPI_PARSE_OBJECT *Arg)
+{
+
+ ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
+
+
+ switch (ArgType)
+ {
+ case ARGP_BYTEDATA:
+
+ AcpiPsInitOp (Arg, AML_BYTE_OP);
+ Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+ break;
+
+
+ case ARGP_WORDDATA:
+
+ AcpiPsInitOp (Arg, AML_WORD_OP);
+
+ /* Get 2 bytes from the AML stream */
+
+ ACPI_MOVE_16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ParserState->Aml += 2;
+ break;
+
+
+ case ARGP_DWORDDATA:
+
+ AcpiPsInitOp (Arg, AML_DWORD_OP);
+
+ /* Get 4 bytes from the AML stream */
+
+ ACPI_MOVE_32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ParserState->Aml += 4;
+ break;
+
+
+ case ARGP_QWORDDATA:
+
+ AcpiPsInitOp (Arg, AML_QWORD_OP);
+
+ /* Get 8 bytes from the AML stream */
+
+ ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ParserState->Aml += 8;
+ break;
+
+
+ case ARGP_CHARLIST:
+
+ AcpiPsInitOp (Arg, AML_STRING_OP);
+ Arg->Common.Value.String = (char *) ParserState->Aml;
+
+ while (ACPI_GET8 (ParserState->Aml) != '\0')
+ {
+ ParserState->Aml++;
+ }
+ ParserState->Aml++;
+ break;
+
+
+ case ARGP_NAME:
+ case ARGP_NAMESTRING:
+
+ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
+ Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType));
+ break;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextField
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: A newly allocated FIELD op
+ *
+ * DESCRIPTION: Get next field (NamedField, ReservedField, or AccessField)
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetNextField (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
+ ParserState->AmlStart);
+ ACPI_PARSE_OBJECT *Field;
+ UINT16 Opcode;
+ UINT32 Name;
+
+
+ ACPI_FUNCTION_TRACE ("PsGetNextField");
+
+
+ /* determine field type */
+
+ switch (ACPI_GET8 (ParserState->Aml))
+ {
+ default:
+
+ Opcode = AML_INT_NAMEDFIELD_OP;
+ break;
+
+ case 0x00:
+
+ Opcode = AML_INT_RESERVEDFIELD_OP;
+ ParserState->Aml++;
+ break;
+
+ case 0x01:
+
+ Opcode = AML_INT_ACCESSFIELD_OP;
+ ParserState->Aml++;
+ break;
+ }
+
+
+ /* Allocate a new field op */
+
+ Field = AcpiPsAllocOp (Opcode);
+ if (!Field)
+ {
+ return_PTR (NULL);
+ }
+
+ Field->Common.AmlOffset = AmlOffset;
+
+ /* Decode the field type */
+
+ switch (Opcode)
+ {
+ case AML_INT_NAMEDFIELD_OP:
+
+ /* Get the 4-character name */
+
+ ACPI_MOVE_32_TO_32 (&Name, ParserState->Aml);
+ AcpiPsSetName (Field, Name);
+ ParserState->Aml += ACPI_NAME_SIZE;
+
+ /* Get the length which is encoded as a package length */
+
+ Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
+ break;
+
+
+ case AML_INT_RESERVEDFIELD_OP:
+
+ /* Get the length which is encoded as a package length */
+
+ Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
+ break;
+
+
+ case AML_INT_ACCESSFIELD_OP:
+
+ /*
+ * Get AccessType and AccessAttrib and merge into the field Op
+ * AccessType is first operand, AccessAttribute is second
+ */
+ Field->Common.Value.Integer = (ACPI_GET8 (ParserState->Aml) << 8);
+ ParserState->Aml++;
+ Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+ break;
+
+ default:
+
+ /* Opcode was set in previous switch */
+ break;
+ }
+
+ return_PTR (Field);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextArg
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * ArgType - The argument type (AML_*_ARG)
+ * ArgCount - If the argument points to a control method
+ * the method's argument is returned here.
+ *
+ * RETURN: Status, and an op object containing the next argument.
+ *
+ * DESCRIPTION: Get next argument (including complex list arguments that require
+ * pushing the parser stack)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsGetNextArg (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_STATE *ParserState,
+ UINT32 ArgType,
+ ACPI_PARSE_OBJECT **ReturnArg)
+{
+ ACPI_PARSE_OBJECT *Arg = NULL;
+ ACPI_PARSE_OBJECT *Prev = NULL;
+ ACPI_PARSE_OBJECT *Field;
+ UINT32 Subop;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
+
+
+ switch (ArgType)
+ {
+ case ARGP_BYTEDATA:
+ case ARGP_WORDDATA:
+ case ARGP_DWORDDATA:
+ case ARGP_CHARLIST:
+ case ARGP_NAME:
+ case ARGP_NAMESTRING:
+
+ /* constants, strings, and namestrings are all the same size */
+
+ Arg = AcpiPsAllocOp (AML_BYTE_OP);
+ if (!Arg)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
+ break;
+
+
+ case ARGP_PKGLENGTH:
+
+ /* Package length, nothing returned */
+
+ ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
+ break;
+
+
+ case ARGP_FIELDLIST:
+
+ if (ParserState->Aml < ParserState->PkgEnd)
+ {
+ /* Non-empty list */
+
+ while (ParserState->Aml < ParserState->PkgEnd)
+ {
+ Field = AcpiPsGetNextField (ParserState);
+ if (!Field)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ if (Prev)
+ {
+ Prev->Common.Next = Field;
+ }
+ else
+ {
+ Arg = Field;
+ }
+
+ Prev = Field;
+ }
+
+ /* Skip to End of byte data */
+
+ ParserState->Aml = ParserState->PkgEnd;
+ }
+ break;
+
+
+ case ARGP_BYTELIST:
+
+ if (ParserState->Aml < ParserState->PkgEnd)
+ {
+ /* Non-empty list */
+
+ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+ if (!Arg)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Fill in bytelist data */
+
+ Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd,
+ ParserState->Aml);
+ Arg->Named.Data = ParserState->Aml;
+
+ /* Skip to End of byte data */
+
+ ParserState->Aml = ParserState->PkgEnd;
+ }
+ break;
+
+
+ case ARGP_TARGET:
+ case ARGP_SUPERNAME:
+ case ARGP_SIMPLENAME:
+
+ Subop = AcpiPsPeekOpcode (ParserState);
+ if (Subop == 0 ||
+ AcpiPsIsLeadingChar (Subop) ||
+ AcpiPsIsPrefixChar (Subop))
+ {
+ /* NullName or NameString */
+
+ Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!Arg)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0);
+ }
+ else
+ {
+ /* single complex argument, nothing returned */
+
+ WalkState->ArgCount = 1;
+ }
+ break;
+
+
+ case ARGP_DATAOBJ:
+ case ARGP_TERMARG:
+
+ /* single complex argument, nothing returned */
+
+ WalkState->ArgCount = 1;
+ break;
+
+
+ case ARGP_DATAOBJLIST:
+ case ARGP_TERMLIST:
+ case ARGP_OBJLIST:
+
+ if (ParserState->Aml < ParserState->PkgEnd)
+ {
+ /* non-empty list of variable arguments, nothing returned */
+
+ WalkState->ArgCount = ACPI_VAR_ARGS;
+ }
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType));
+ Status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+
+ *ReturnArg = Arg;
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c
new file mode 100644
index 0000000..6862843
--- /dev/null
+++ b/sys/contrib/dev/acpica/psfind.c
@@ -0,0 +1,485 @@
+
+/******************************************************************************
+ *
+ * Module Name: psfind - Parse tree search routine
+ * $Revision: 42 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __PSFIND_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psfind")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetParent
+ *
+ * PARAMETERS: Op - Get the parent of this Op
+ *
+ * RETURN: The Parent op.
+ *
+ * DESCRIPTION: Get op's parent
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT*
+AcpiPsGetParent (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Parent = Op;
+
+
+ /* Traverse the tree upward (to root if necessary) */
+
+ while (Parent)
+ {
+ switch (Parent->Common.AmlOpcode)
+ {
+ case AML_SCOPE_OP:
+ case AML_PACKAGE_OP:
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_POWER_RES_OP:
+ case AML_THERMAL_ZONE_OP:
+
+ return (Parent->Common.Parent);
+
+ default:
+ break;
+ }
+
+ Parent = Parent->Common.Parent;
+ }
+
+ return (Parent);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsFindName
+ *
+ * PARAMETERS: Scope - Scope to search
+ * Name - ACPI name to search for
+ * Opcode - Opcode to search for
+ *
+ * RETURN: Op containing the name
+ *
+ * DESCRIPTION: Find name segment from a list of acpi_ops. Searches a single
+ * scope, no more.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsFindName (
+ ACPI_PARSE_OBJECT *Scope,
+ UINT32 Name,
+ UINT32 Opcode)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_PARSE_OBJECT *Field;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ /* search scope level for matching name segment */
+
+ Op = AcpiPsGetChild (Scope);
+
+ while (Op)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Check AML_CREATE first (since some opcodes have AML_FIELD set also )*/
+
+ if (OpInfo->Flags & AML_CREATE)
+ {
+ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
+ {
+ Field = AcpiPsGetArg (Op, 3);
+ }
+ else
+ {
+ /* CreateXXXField, check name */
+
+ Field = AcpiPsGetArg (Op, 2);
+ }
+
+ if ((Field) &&
+ (Field->Common.Value.String) &&
+ (!ACPI_STRNCMP (Field->Common.Value.String, (char *) &Name, ACPI_NAME_SIZE)))
+ {
+ return (Op);
+ }
+ }
+ else if (OpInfo->Flags & AML_FIELD)
+ {
+ /* Field, search named fields */
+
+ Field = AcpiPsGetChild (Op);
+ while (Field)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Field->Common.AmlOpcode);
+
+ if ((OpInfo->Flags & AML_NAMED) &&
+ AcpiPsGetName (Field) == Name &&
+ (!Opcode || Field->Common.AmlOpcode == Opcode))
+ {
+ return (Field);
+ }
+
+ Field = Field->Common.Next;
+ }
+ }
+ else if ((OpInfo->Flags & AML_NAMED) &&
+ (AcpiPsGetName (Op) == Name) &&
+ (!Opcode || Op->Common.AmlOpcode == Opcode || Opcode == AML_SCOPE_OP))
+ {
+ break;
+ }
+
+ Op = Op->Common.Next;
+ }
+
+ return (Op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsFind
+ *
+ * PARAMETERS: Scope - Where to begin the search
+ * Path - ACPI Path to the named object
+ * Opcode - Opcode associated with the object
+ * Create - if TRUE, create the object if not found.
+ *
+ * RETURN: Op if found, NULL otherwise.
+ *
+ * DESCRIPTION: Find object within scope
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT*
+AcpiPsFind (
+ ACPI_PARSE_OBJECT *Scope,
+ NATIVE_CHAR *Path,
+ UINT16 Opcode,
+ UINT32 Create)
+{
+ UINT32 SegCount;
+ UINT32 Name;
+ UINT32 NameOp;
+ ACPI_PARSE_OBJECT *Op = NULL;
+ BOOLEAN Unprefixed = TRUE;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsFind", Scope);
+
+
+ if (!Scope || !Path)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Null path (%p) or scope (%p)!\n",
+ Path, Scope));
+ return_PTR (NULL);
+ }
+
+ AcpiGbl_PsFindCount++;
+
+#if 0
+ if ((Create) && (Opcode == AML_SCOPE_OP))
+ {
+ Op = AcpiPsAllocOp (AML_SCOPE_OP);
+ if (Op)
+ {
+ AcpiPsSetName (Op, 'XXXX');
+ AcpiPsAppendArg (Scope, Op);
+ }
+/* return_PTR (Op);*/
+ }
+#endif
+
+ /* Handle all prefixes in the name path */
+
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (Path)))
+ {
+ switch (ACPI_GET8 (Path))
+ {
+ case '\\':
+
+ /* Could just use a global for "root scope" here */
+
+ while (Scope->Common.Parent)
+ {
+ Scope = Scope->Common.Parent;
+ }
+ break;
+
+
+ case '^':
+
+ /* Go up to the next valid scoping Op (method, scope, etc.) */
+
+ if (AcpiPsGetParent (Scope))
+ {
+ Scope = AcpiPsGetParent (Scope);
+ }
+ break;
+
+ default:
+ /* Should not get here */
+ break;
+ }
+
+ Unprefixed = FALSE;
+ Path++;
+ }
+
+
+ /* get name segment count */
+
+ switch (ACPI_GET8 (Path))
+ {
+ case 0:
+ SegCount = 0;
+
+ /* Null name case */
+
+ if (Unprefixed)
+ {
+ Op = NULL;
+ }
+ else
+ {
+ Op = Scope;
+ }
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Null path, returning current root scope Op=%p\n", Op));
+ return_PTR (Op);
+
+ case AML_DUAL_NAME_PREFIX:
+ SegCount = 2;
+ Path++;
+ break;
+
+ case AML_MULTI_NAME_PREFIX_OP:
+ SegCount = ACPI_GET8 (Path + 1);
+ Path += 2;
+ break;
+
+ default:
+ SegCount = 1;
+ break;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Search scope %p Segs=%d Opcode=%4.4hX Create=%d\n",
+ Scope, SegCount, Opcode, Create));
+
+
+ /* match each name segment */
+
+ while (Scope && SegCount)
+ {
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Name, Path);
+ Path += 4;
+ SegCount --;
+
+ if (SegCount)
+ {
+ NameOp = 0;
+ }
+ else
+ {
+ NameOp = Opcode;
+ }
+
+ Op = AcpiPsFindName (Scope, Name, NameOp);
+ if (Op)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Found! Op=%p Opcode=%4.4hX\n",
+ (char *) &Name, Op, Op->Common.AmlOpcode));
+ }
+
+ if (!Op)
+ {
+ if (Create)
+ {
+ /* Create a new Scope level */
+
+ if (SegCount)
+ {
+ Op = AcpiPsAllocOp (AML_SCOPE_OP);
+ }
+ else
+ {
+ Op = AcpiPsAllocOp (Opcode);
+ }
+
+ if (Op)
+ {
+ AcpiPsSetName (Op, Name);
+ AcpiPsAppendArg (Scope, Op);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Not found, created Op=%p Opcode=%4.4hX\n",
+ (char *) &Name, Op, Opcode));
+ }
+ }
+
+ else if (Unprefixed)
+ {
+ /* Search higher scopes for unprefixed name */
+
+ while (!Op && Scope->Common.Parent)
+ {
+ Scope = Scope->Common.Parent;
+ Op = AcpiPsFindName (Scope, Name, Opcode);
+ if (Op)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4hX\n",
+ (char *) &Name, Op, Op->Common.AmlOpcode));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Not found in parent=%p\n",
+ (char *) &Name, Scope));
+ }
+ }
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Segment [%4.4s] Not Found in scope %p!\n",
+ (char *) &Name, Scope));
+ }
+ }
+
+ Unprefixed = FALSE;
+ Scope = Op;
+ }
+
+ return_PTR (Op);
+}
+
+
diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c
new file mode 100644
index 0000000..4a94a3a
--- /dev/null
+++ b/sys/contrib/dev/acpica/psopcode.c
@@ -0,0 +1,846 @@
+/******************************************************************************
+ *
+ * Module Name: psopcode - Parser/Interpreter opcode information table
+ * $Revision: 77 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psopcode")
+
+
+#define _UNK 0x6B
+/*
+ * Reserved ASCII characters. Do not use any of these for
+ * internal opcodes, since they are used to differentiate
+ * name strings from AML opcodes
+ */
+#define _ASC 0x6C
+#define _NAM 0x6C
+#define _PFX 0x6D
+#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
+
+#define MAX_EXTENDED_OPCODE 0x88
+#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
+#define MAX_INTERNAL_OPCODE
+#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
+
+
+/*******************************************************************************
+ *
+ * NAME: AcpiGbl_AmlOpInfo
+ *
+ * DESCRIPTION: Opcode table. Each entry contains <opcode, type, name, operands>
+ * The name is a simple ascii string, the operand specifier is an
+ * ascii string with one letter per operand. The letter specifies
+ * the operand type.
+ *
+ ******************************************************************************/
+
+
+/*
+ * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed
+ * into a 32-bit number and stored in the master opcode table at the end of this file.
+ */
+
+
+#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
+#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
+#define ARGP_ARG0 ARG_NONE
+#define ARGP_ARG1 ARG_NONE
+#define ARGP_ARG2 ARG_NONE
+#define ARGP_ARG3 ARG_NONE
+#define ARGP_ARG4 ARG_NONE
+#define ARGP_ARG5 ARG_NONE
+#define ARGP_ARG6 ARG_NONE
+#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
+#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BREAK_OP ARG_NONE
+#define ARGP_BREAK_POINT_OP ARG_NONE
+#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
+#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
+#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
+#define ARGP_CONTINUE_OP ARG_NONE
+#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
+#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_DEBUG_OP ARG_NONE
+#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
+#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
+#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
+#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
+#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
+#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
+#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
+#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
+#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
+#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
+#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LOCAL0 ARG_NONE
+#define ARGP_LOCAL1 ARG_NONE
+#define ARGP_LOCAL2 ARG_NONE
+#define ARGP_LOCAL3 ARG_NONE
+#define ARGP_LOCAL4 ARG_NONE
+#define ARGP_LOCAL5 ARG_NONE
+#define ARGP_LOCAL6 ARG_NONE
+#define ARGP_LOCAL7 ARG_NONE
+#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
+#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
+#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
+#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_NOOP_OP ARG_NONE
+#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
+#define ARGP_ONE_OP ARG_NONE
+#define ARGP_ONES_OP ARG_NONE
+#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
+#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
+#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
+#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
+#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_REVISION_OP ARG_NONE
+#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
+#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
+#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
+#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
+#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
+#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
+#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
+#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
+#define ARGP_ZERO_OP ARG_NONE
+
+
+/*
+ * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed
+ * into a 32-bit number and stored in the master opcode table at the end of this file.
+ *
+ * (Used by PrepOperands procedure and the ASL Compiler)
+ */
+
+
+#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
+#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
+#define ARGI_ARG0 ARG_NONE
+#define ARGI_ARG1 ARG_NONE
+#define ARGI_ARG2 ARG_NONE
+#define ARGI_ARG3 ARG_NONE
+#define ARGI_ARG4 ARG_NONE
+#define ARGI_ARG5 ARG_NONE
+#define ARGI_ARG6 ARG_NONE
+#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BREAK_OP ARG_NONE
+#define ARGI_BREAK_POINT_OP ARG_NONE
+#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
+#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
+#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
+#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
+#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
+#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
+#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
+#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
+#define ARGI_DEBUG_OP ARG_NONE
+#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
+#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
+#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
+#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
+#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
+#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
+#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
+#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_IF_OP ARGI_INVALID_OPCODE
+#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
+#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
+#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
+#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
+#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
+#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
+#define ARGI_LOCAL0 ARG_NONE
+#define ARGI_LOCAL1 ARG_NONE
+#define ARGI_LOCAL2 ARG_NONE
+#define ARGI_LOCAL3 ARG_NONE
+#define ARGI_LOCAL4 ARG_NONE
+#define ARGI_LOCAL5 ARG_NONE
+#define ARGI_LOCAL6 ARG_NONE
+#define ARGI_LOCAL7 ARG_NONE
+#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
+#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
+#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
+#define ARGI_NAME_OP ARGI_INVALID_OPCODE
+#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
+#define ARGI_NOOP_OP ARG_NONE
+#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
+#define ARGI_ONE_OP ARG_NONE
+#define ARGI_ONES_OP ARG_NONE
+#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
+#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
+#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
+#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
+#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
+#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
+#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
+#define ARGI_REVISION_OP ARG_NONE
+#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
+#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
+#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
+#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
+#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF)
+#define ARGI_STRING_OP ARGI_INVALID_OPCODE
+#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
+#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
+#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
+#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
+#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
+#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
+#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
+#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
+#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
+#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
+#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
+#define ARGI_WORD_OP ARGI_INVALID_OPCODE
+#define ARGI_ZERO_OP ARG_NONE
+
+
+/*
+ * Summary of opcode types/flags
+ */
+
+/******************************************************************************
+
+ Opcodes that have associated namespace objects (AML_NSOBJECT flag)
+
+ AML_SCOPE_OP
+ AML_DEVICE_OP
+ AML_THERMAL_ZONE_OP
+ AML_METHOD_OP
+ AML_POWER_RES_OP
+ AML_PROCESSOR_OP
+ AML_FIELD_OP
+ AML_INDEX_FIELD_OP
+ AML_BANK_FIELD_OP
+ AML_NAME_OP
+ AML_ALIAS_OP
+ AML_MUTEX_OP
+ AML_EVENT_OP
+ AML_REGION_OP
+ AML_CREATE_FIELD_OP
+ AML_CREATE_BIT_FIELD_OP
+ AML_CREATE_BYTE_FIELD_OP
+ AML_CREATE_WORD_FIELD_OP
+ AML_CREATE_DWORD_FIELD_OP
+ AML_CREATE_QWORD_FIELD_OP
+ AML_INT_NAMEDFIELD_OP
+ AML_INT_METHODCALL_OP
+ AML_INT_NAMEPATH_OP
+
+ Opcodes that are "namespace" opcodes (AML_NSOPCODE flag)
+
+ AML_SCOPE_OP
+ AML_DEVICE_OP
+ AML_THERMAL_ZONE_OP
+ AML_METHOD_OP
+ AML_POWER_RES_OP
+ AML_PROCESSOR_OP
+ AML_FIELD_OP
+ AML_INDEX_FIELD_OP
+ AML_BANK_FIELD_OP
+ AML_NAME_OP
+ AML_ALIAS_OP
+ AML_MUTEX_OP
+ AML_EVENT_OP
+ AML_REGION_OP
+ AML_INT_NAMEDFIELD_OP
+
+ Opcodes that have an associated namespace node (AML_NSNODE flag)
+
+ AML_SCOPE_OP
+ AML_DEVICE_OP
+ AML_THERMAL_ZONE_OP
+ AML_METHOD_OP
+ AML_POWER_RES_OP
+ AML_PROCESSOR_OP
+ AML_NAME_OP
+ AML_ALIAS_OP
+ AML_MUTEX_OP
+ AML_EVENT_OP
+ AML_REGION_OP
+ AML_CREATE_FIELD_OP
+ AML_CREATE_BIT_FIELD_OP
+ AML_CREATE_BYTE_FIELD_OP
+ AML_CREATE_WORD_FIELD_OP
+ AML_CREATE_DWORD_FIELD_OP
+ AML_CREATE_QWORD_FIELD_OP
+ AML_INT_NAMEDFIELD_OP
+ AML_INT_METHODCALL_OP
+ AML_INT_NAMEPATH_OP
+
+ Opcodes that define named ACPI objects (AML_NAMED flag)
+
+ AML_SCOPE_OP
+ AML_DEVICE_OP
+ AML_THERMAL_ZONE_OP
+ AML_METHOD_OP
+ AML_POWER_RES_OP
+ AML_PROCESSOR_OP
+ AML_NAME_OP
+ AML_ALIAS_OP
+ AML_MUTEX_OP
+ AML_EVENT_OP
+ AML_REGION_OP
+ AML_INT_NAMEDFIELD_OP
+
+ Opcodes that contain executable AML as part of the definition that
+ must be deferred until needed
+
+ AML_METHOD_OP
+ AML_VAR_PACKAGE_OP
+ AML_CREATE_FIELD_OP
+ AML_CREATE_BIT_FIELD_OP
+ AML_CREATE_BYTE_FIELD_OP
+ AML_CREATE_WORD_FIELD_OP
+ AML_CREATE_DWORD_FIELD_OP
+ AML_CREATE_QWORD_FIELD_OP
+ AML_REGION_OP
+ AML_BUFFER_OP
+
+ Field opcodes
+
+ AML_CREATE_FIELD_OP
+ AML_FIELD_OP
+ AML_INDEX_FIELD_OP
+ AML_BANK_FIELD_OP
+
+ Field "Create" opcodes
+
+ AML_CREATE_FIELD_OP
+ AML_CREATE_BIT_FIELD_OP
+ AML_CREATE_BYTE_FIELD_OP
+ AML_CREATE_WORD_FIELD_OP
+ AML_CREATE_DWORD_FIELD_OP
+ AML_CREATE_QWORD_FIELD_OP
+
+******************************************************************************/
+
+
+/*
+ * Master Opcode information table. A summary of everything we know about each opcode, all in one place.
+ */
+
+
+const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
+{
+/*! [Begin] no source code translation */
+/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
+
+/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
+/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
+/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
+/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+
+/* Prefixed opcodes (Two-byte opcodes with a prefix op) */
+
+/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
+/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R),
+/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
+/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+
+/* Internal opcodes that map to invalid AML opcodes */
+
+/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
+/* 64 */ ACPI_OP ("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
+/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 67 */ ACPI_OP ("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 6A */ ACPI_OP ("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
+/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
+
+
+/* ACPI 2.0 opcodes */
+
+/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
+/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
+/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
+
+/*! [End] no source code translation !*/
+};
+
+/*
+ * This table is directly indexed by the opcodes, and returns an
+ * index into the table above
+ */
+
+static const UINT8 AcpiGbl_ShortOpIndex[256] =
+{
+/* 0 1 2 3 4 5 6 7 */
+/* 8 9 A B C D E F */
+/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
+/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
+/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
+/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
+/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
+/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
+/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
+/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
+/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
+/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
+/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
+/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
+/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
+/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
+/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
+};
+
+
+static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] =
+{
+/* 0 1 2 3 4 5 6 7 */
+/* 8 9 A B C D E F */
+/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
+/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+/* 0x88 */ 0x7C,
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetOpcodeInfo
+ *
+ * PARAMETERS: Opcode - The AML opcode
+ *
+ * RETURN: A pointer to the info about the opcode. NULL if the opcode was
+ * not found in the table.
+ *
+ * DESCRIPTION: Find AML opcode description based on the opcode.
+ * NOTE: This procedure must ALWAYS return a valid pointer!
+ *
+ ******************************************************************************/
+
+const ACPI_OPCODE_INFO *
+AcpiPsGetOpcodeInfo (
+ UINT16 Opcode)
+{
+ ACPI_FUNCTION_NAME ("PsGetOpcodeInfo");
+
+
+ /*
+ * Detect normal 8-bit opcode or extended 16-bit opcode
+ */
+ switch ((UINT8) (Opcode >> 8))
+ {
+ case 0:
+
+ /* Simple (8-bit) opcode: 0-255, can't index beyond table */
+
+ return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
+
+ case AML_EXTOP:
+
+ /* Extended (16-bit, prefix+opcode) opcode */
+
+ if (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE)
+ {
+ return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
+ }
+
+ /* Else fall through to error case below */
+ /*lint -fallthrough */
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", Opcode));
+ break;
+ }
+
+
+ /* Default is "unknown opcode" */
+
+ return (&AcpiGbl_AmlOpInfo [_UNK]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetOpcodeName
+ *
+ * PARAMETERS: Opcode - The AML opcode
+ *
+ * RETURN: A pointer to the name of the opcode (ASCII String)
+ * Note: Never returns NULL.
+ *
+ * DESCRIPTION: Translate an opcode into a human-readable string
+ *
+ ******************************************************************************/
+
+char *
+AcpiPsGetOpcodeName (
+ UINT16 Opcode)
+{
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
+
+ const ACPI_OPCODE_INFO *Op;
+
+
+ Op = AcpiPsGetOpcodeInfo (Opcode);
+
+ /* Always guaranteed to return a valid pointer */
+
+ return (Op->Name);
+
+#else
+ return ("AE_NOT_CONFIGURED");
+
+#endif
+}
+
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
new file mode 100644
index 0000000..ce6f530
--- /dev/null
+++ b/sys/contrib/dev/acpica/psparse.c
@@ -0,0 +1,1396 @@
+/******************************************************************************
+ *
+ * Module Name: psparse - Parser top level AML parse routines
+ * $Revision: 139 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+/*
+ * Parse the AML and build an operation tree as most interpreters,
+ * like Perl, do. Parsing is done by hand rather than with a YACC
+ * generated parser to tightly constrain stack and dynamic memory
+ * usage. At the same time, parsing is kept flexible and the code
+ * fairly compact by parsing based on a list of AML opcode
+ * templates in AmlOpInfo[]
+ */
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psparse")
+
+
+static UINT32 AcpiGbl_Depth = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetOpcodeSize
+ *
+ * PARAMETERS: Opcode - An AML opcode
+ *
+ * RETURN: Size of the opcode, in bytes (1 or 2)
+ *
+ * DESCRIPTION: Get the size of the current opcode.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiPsGetOpcodeSize (
+ UINT32 Opcode)
+{
+
+ /* Extended (2-byte) opcode if > 255 */
+
+ if (Opcode > 0x00FF)
+ {
+ return (2);
+ }
+
+ /* Otherwise, just a single byte opcode */
+
+ return (1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsPeekOpcode
+ *
+ * PARAMETERS: ParserState - A parser state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
+ *
+ ******************************************************************************/
+
+UINT16
+AcpiPsPeekOpcode (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT8 *Aml;
+ UINT16 Opcode;
+
+
+ Aml = ParserState->Aml;
+ Opcode = (UINT16) ACPI_GET8 (Aml);
+
+
+ if (Opcode == AML_EXTOP)
+ {
+ /* Extended opcode */
+
+ Aml++;
+ Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
+ }
+
+ return (Opcode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCompleteThisOp
+ *
+ * PARAMETERS: WalkState - Current State
+ * Op - Op to complete
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Perform any cleanup at the completion of an Op.
+ *
+ ******************************************************************************/
+
+void
+AcpiPsCompleteThisOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Prev;
+ ACPI_PARSE_OBJECT *Next;
+ const ACPI_OPCODE_INFO *ParentInfo;
+ ACPI_PARSE_OBJECT *ReplacementOp = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
+
+
+ /* Check for null Op, can happen if AML code is corrupt */
+
+ if (!Op)
+ {
+ return_VOID;
+ }
+
+ /* Delete this op and the subtree below it if asked to */
+
+ if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
+ (WalkState->OpInfo->Class != AML_CLASS_ARGUMENT))
+ {
+ /* Make sure that we only delete this subtree */
+
+ if (Op->Common.Parent)
+ {
+ /*
+ * Check if we need to replace the operator and its subtree
+ * with a return value op (placeholder op)
+ */
+ ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
+
+ switch (ParentInfo->Class)
+ {
+ case AML_CLASS_CONTROL:
+ break;
+
+ case AML_CLASS_CREATE:
+
+ /*
+ * These opcodes contain TermArg operands. The current
+ * op must be replaced by a placeholder return op
+ */
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ if (!ReplacementOp)
+ {
+ return_VOID;
+ }
+ break;
+
+ case AML_CLASS_NAMED_OBJECT:
+
+ /*
+ * These opcodes contain TermArg operands. The current
+ * op must be replaced by a placeholder return op
+ */
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ if (!ReplacementOp)
+ {
+ return_VOID;
+ }
+ }
+
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->DescendingCallback != AcpiDsExecBeginOp))
+
+ {
+ if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
+ if (!ReplacementOp)
+ {
+ return_VOID;
+ }
+
+ ReplacementOp->Named.Data = Op->Named.Data;
+ ReplacementOp->Named.Length = Op->Named.Length;
+ }
+ }
+ break;
+
+ default:
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ if (!ReplacementOp)
+ {
+ return_VOID;
+ }
+ }
+
+ /* We must unlink this op from the parent tree */
+
+ Prev = Op->Common.Parent->Common.Value.Arg;
+ if (Prev == Op)
+ {
+ /* This op is the first in the list */
+
+ if (ReplacementOp)
+ {
+ ReplacementOp->Common.Parent = Op->Common.Parent;
+ ReplacementOp->Common.Value.Arg = NULL;
+ ReplacementOp->Common.Node = Op->Common.Node;
+ Op->Common.Parent->Common.Value.Arg = ReplacementOp;
+ ReplacementOp->Common.Next = Op->Common.Next;
+ }
+ else
+ {
+ Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
+ }
+ }
+
+ /* Search the parent list */
+
+ else while (Prev)
+ {
+ /* Traverse all siblings in the parent's argument list */
+
+ Next = Prev->Common.Next;
+ if (Next == Op)
+ {
+ if (ReplacementOp)
+ {
+ ReplacementOp->Common.Parent = Op->Common.Parent;
+ ReplacementOp->Common.Value.Arg = NULL;
+ ReplacementOp->Common.Node = Op->Common.Node;
+ Prev->Common.Next = ReplacementOp;
+ ReplacementOp->Common.Next = Op->Common.Next;
+ Next = NULL;
+ }
+ else
+ {
+ Prev->Common.Next = Op->Common.Next;
+ Next = NULL;
+ }
+ }
+
+ Prev = Next;
+ }
+ }
+
+ /* Now we can actually delete the subtree rooted at op */
+
+ AcpiPsDeleteParseTree (Op);
+
+ return_VOID;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsNextParseState
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Update the parser state based upon the return exception from
+ * the parser callback.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsNextParseState (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS CallbackStatus)
+{
+ ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
+ ACPI_STATUS Status = AE_CTRL_PENDING;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
+
+
+ switch (CallbackStatus)
+ {
+ case AE_CTRL_TERMINATE:
+
+ /*
+ * A control method was terminated via a RETURN statement.
+ * The walk of this method is complete.
+ */
+ ParserState->Aml = ParserState->AmlEnd;
+ Status = AE_CTRL_TERMINATE;
+ break;
+
+
+ case AE_CTRL_BREAK:
+
+ ParserState->Aml = WalkState->AmlLastWhile;
+ WalkState->ControlState->Common.Value = FALSE;
+ Status = AE_CTRL_BREAK;
+ break;
+
+ case AE_CTRL_CONTINUE:
+
+
+ ParserState->Aml = WalkState->AmlLastWhile;
+ Status = AE_CTRL_CONTINUE;
+ break;
+
+ case AE_CTRL_PENDING:
+
+ ParserState->Aml = WalkState->AmlLastWhile;
+ break;
+
+#if 0
+ case AE_CTRL_SKIP:
+
+ ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
+ Status = AE_OK;
+ break;
+#endif
+
+ case AE_CTRL_TRUE:
+
+ /*
+ * Predicate of an IF was true, and we are at the matching ELSE.
+ * Just close out this package
+ */
+ ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
+ break;
+
+
+ case AE_CTRL_FALSE:
+
+ /*
+ * Either an IF/WHILE Predicate was false or we encountered a BREAK
+ * opcode. In both cases, we do not execute the rest of the
+ * package; We simply close out the parent (finishing the walk of
+ * this branch of the tree) and continue execution at the parent
+ * level.
+ */
+ ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
+
+ /* In the case of a BREAK, just force a predicate (if any) to FALSE */
+
+ WalkState->ControlState->Common.Value = FALSE;
+ Status = AE_CTRL_END;
+ break;
+
+
+ case AE_CTRL_TRANSFER:
+
+ /*
+ * A method call (invocation) -- transfer control
+ */
+ Status = AE_CTRL_TRANSFER;
+ WalkState->PrevOp = Op;
+ WalkState->MethodCallOp = Op;
+ WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node;
+
+ /* Will return value (if any) be used by the caller? */
+
+ WalkState->ReturnUsed = AcpiDsIsResultUsed (Op, WalkState);
+ break;
+
+
+ default:
+ Status = CallbackStatus;
+ if ((CallbackStatus & AE_CODE_MASK) == AE_CODE_CONTROL)
+ {
+ Status = AE_OK;
+ }
+ break;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsParseLoop
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ * a tree of ops.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsParseLoop (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Op = NULL; /* current op */
+ ACPI_PARSE_OBJECT *Arg = NULL;
+ ACPI_PARSE_OBJECT PreOp;
+ ACPI_PARSE_STATE *ParserState;
+ UINT8 *AmlOpStart = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
+
+ if (WalkState->DescendingCallback == NULL)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+
+ ParserState = &WalkState->ParserState;
+ WalkState->ArgTypes = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+ if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
+ {
+ /* We are restarting a preempted control method */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ /*
+ * We must check if a predicate to an IF or WHILE statement
+ * was just completed
+ */
+ if ((ParserState->Scope->ParseScope.Op) &&
+ ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
+ (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
+ (WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_PREDICATE_EXECUTING))
+ {
+ /*
+ * A predicate was just completed, get the value of the
+ * predicate and branch based on that value
+ */
+ WalkState->Op = NULL;
+ Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
+ if (ACPI_FAILURE (Status) &&
+ ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
+ {
+ if (Status == AE_AML_NO_RETURN_VALUE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invoked method did not return a value, %s\n",
+ AcpiFormatException (Status)));
+
+ }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GetPredicate Failed, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ }
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
+ }
+ else if (WalkState->PrevOp)
+ {
+ /* We were in the middle of an op */
+
+ Op = WalkState->PrevOp;
+ WalkState->ArgTypes = WalkState->PrevArgTypes;
+ }
+ }
+#endif
+
+ /*
+ * Iterative parsing loop, while there is more aml to process:
+ */
+ while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
+ {
+ AmlOpStart = ParserState->Aml;
+ if (!Op)
+ {
+ /* Get the next opcode from the AML stream */
+
+ WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
+ ParserState->AmlStart);
+ WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
+
+ /*
+ * First cut to determine what we have found:
+ * 1) A valid AML opcode
+ * 2) A name string
+ * 3) An unknown/invalid opcode
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+ switch (WalkState->OpInfo->Class)
+ {
+ case AML_CLASS_ASCII:
+ case AML_CLASS_PREFIX:
+ /*
+ * Starts with a valid prefix or ASCII char, this is a name
+ * string. Convert the bare name string to a namepath.
+ */
+ WalkState->Opcode = AML_INT_NAMEPATH_OP;
+ WalkState->ArgTypes = ARGP_NAMESTRING;
+ break;
+
+ case AML_CLASS_UNKNOWN:
+
+ /* The opcode is unrecognized. Just skip unknown opcodes */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+ WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
+
+ ACPI_DUMP_BUFFER (ParserState->Aml, 128);
+
+ /* Assume one-byte bad opcode */
+
+ ParserState->Aml++;
+ continue;
+
+ default:
+
+ /* Found opcode info, this is a normal opcode */
+
+ ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
+ WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
+ break;
+ }
+
+ /* Create Op structure and append to parent's argument list */
+
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ PreOp.Common.Value.Arg = NULL;
+ PreOp.Common.AmlOpcode = WalkState->Opcode;
+
+ /*
+ * Get and append arguments until we find the node that contains
+ * the name (the type ARGP_NAME).
+ */
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
+ (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
+ {
+ Status = AcpiPsGetNextArg (WalkState, ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ AcpiPsAppendArg (&PreOp, Arg);
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
+
+ /* Make sure that we found a NAME and didn't run out of arguments */
+
+ if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
+ {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ /* We know that this arg is a name, move to next arg */
+
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ WalkState->Op = NULL;
+
+ Status = WalkState->DescendingCallback (WalkState, &Op);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
+ AcpiFormatException (Status)));
+ goto CloseThisOp;
+ }
+
+ if (Op == NULL)
+ {
+ continue;
+ }
+
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ AcpiPsAppendArg (Op, PreOp.Common.Value.Arg);
+ AcpiGbl_Depth++;
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Defer final parsing of an OperationRegion body,
+ * because we don't have enough info in the first pass
+ * to parse it correctly (i.e., there may be method
+ * calls within the TermArg elements of the body.)
+ *
+ * However, we must continue parsing because
+ * the opregion is not a standalone package --
+ * we don't know where the end is at this point.
+ *
+ * (Length is unknown until parse of the body complete)
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = 0;
+ }
+ }
+ else
+ {
+ /* Not a named opcode, just allocate Op and append to parent */
+
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration
+ * BodyLength is unknown until we parse the body
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = 0;
+ }
+
+ AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
+
+ if ((WalkState->DescendingCallback != NULL))
+ {
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ WalkState->Op = Op;
+
+ Status = WalkState->DescendingCallback (WalkState, &Op);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+ }
+ }
+
+ Op->Common.AmlOffset = WalkState->AmlOffset;
+
+ if (WalkState->OpInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
+ (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
+ Op, ParserState->Aml, Op->Common.AmlOffset));
+ }
+ }
+
+
+ /* Start ArgCount at zero because we don't know if there are any args yet */
+
+ WalkState->ArgCount = 0;
+
+ if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */
+ {
+ /* Get arguments */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+ case AML_QWORD_OP: /* AML_QWORDATA_ARG */
+ case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
+
+ /* Fill in constant or string argument directly */
+
+ AcpiPsGetNextSimpleArg (ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
+ break;
+
+ case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
+
+ Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ WalkState->ArgTypes = 0;
+ break;
+
+
+ default:
+
+ /* Op is not a constant or string, append each argument */
+
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
+ !WalkState->ArgCount)
+ {
+ WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
+ ParserState->AmlStart);
+ Status = AcpiPsGetNextArg (WalkState, ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ if (Arg)
+ {
+ Arg->Common.AmlOffset = WalkState->AmlOffset;
+ AcpiPsAppendArg (Op, Arg);
+ }
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+
+ /* For a method, save the length and address of the body */
+
+ /*
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ */
+ Op->Named.Data = ParserState->Aml;
+ Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml);
+ /*
+ * Skip body of method. For OpRegions, we must continue
+ * parsing because the opregion is not a standalone
+ * package (We don't know where the end is).
+ */
+ ParserState->Aml = ParserState->PkgEnd;
+ WalkState->ArgCount = 0;
+ break;
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ if ((Op->Common.Parent) &&
+ (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->DescendingCallback != AcpiDsExecBeginOp))
+ {
+ /*
+ * Skip parsing of
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart);
+ /*
+ * Skip body
+ */
+ ParserState->Aml = ParserState->PkgEnd;
+ WalkState->ArgCount = 0;
+ }
+ break;
+
+ case AML_WHILE_OP:
+
+ if (WalkState->ControlState)
+ {
+ WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd;
+ }
+ break;
+
+ default:
+ /* No action for all other opcodes */
+ break;
+ }
+ break;
+ }
+ }
+
+ /* Check for arguments that need to be processed */
+
+ if (WalkState->ArgCount)
+ {
+ /* There are arguments (complex ones), push Op and prepare for argument */
+
+ Status = AcpiPsPushScope (ParserState, Op,
+ WalkState->ArgTypes, WalkState->ArgCount);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ Op = NULL;
+ continue;
+ }
+
+ /* All arguments have been processed -- Op is complete, prepare for next */
+
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ if (AcpiGbl_Depth)
+ {
+ AcpiGbl_Depth--;
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ *
+ * Completed parsing an OpRegion declaration, we now
+ * know the length.
+ */
+ Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ }
+ }
+
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration (1 for
+ * Opcode)
+ *
+ * BodyLength is unknown until we parse the body
+ */
+ Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ }
+
+ /* This op complete, notify the dispatcher */
+
+ if (WalkState->AscendingCallback != NULL)
+ {
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+ }
+
+
+CloseThisOp:
+ /*
+ * Finished one argument of the containing scope
+ */
+ ParserState->Scope->ParseScope.ArgCount--;
+
+ /* Close this Op (will result in parse subtree deletion) */
+
+ AcpiPsCompleteThisOp (WalkState, Op);
+ Op = NULL;
+
+ switch (Status)
+ {
+ case AE_OK:
+ break;
+
+
+ case AE_CTRL_TRANSFER:
+
+ /*
+ * We are about to transfer to a called method.
+ */
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+
+
+ case AE_CTRL_END:
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ if (Op)
+ {
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+
+ AcpiPsCompleteThisOp (WalkState, Op);
+ Op = NULL;
+ }
+ Status = AE_OK;
+ break;
+
+
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
+
+ /* Pop off scopes until we find the While */
+
+ while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
+
+ /* Close this iteration of the While loop */
+
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+
+ AcpiPsCompleteThisOp (WalkState, Op);
+ Op = NULL;
+
+ Status = AE_OK;
+ break;
+
+
+ case AE_CTRL_TERMINATE:
+
+ Status = AE_OK;
+
+ /* Clean up */
+ do
+ {
+ if (Op)
+ {
+ AcpiPsCompleteThisOp (WalkState, Op);
+ }
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+
+
+ default: /* All other non-AE_OK status */
+
+ do
+ {
+ if (Op)
+ {
+ AcpiPsCompleteThisOp (WalkState, Op);
+ }
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+#if 0
+ if (Op == NULL)
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
+#endif
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+ }
+
+ /* This scope complete? */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
+ }
+ else
+ {
+ Op = NULL;
+ }
+
+ } /* while ParserState->Aml */
+
+
+ /*
+ * Complete the last Op (if not completed), and clear the scope stack.
+ * It is easily possible to end an AML "package" with an unbounded number
+ * of open scopes (such as when several ASL blocks are closed with
+ * sequential closing braces). We want to terminate each one cleanly.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
+ do
+ {
+ if (Op)
+ {
+ if (WalkState->AscendingCallback != NULL)
+ {
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ Status = AE_OK;
+
+ /* Clean up */
+ do
+ {
+ if (Op)
+ {
+ AcpiPsCompleteThisOp (WalkState, Op);
+ }
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+ }
+
+ else if (ACPI_FAILURE (Status))
+ {
+ AcpiPsCompleteThisOp (WalkState, Op);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ AcpiPsCompleteThisOp (WalkState, Op);
+ }
+
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
+ &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsParseAml
+ *
+ * PARAMETERS: StartScope - The starting point of the parse. Becomes the
+ * root of the parsed op tree.
+ * Aml - Pointer to the raw AML code to parse
+ * AmlSize - Length of the AML to parse
+ *
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse raw AML and return a tree of ops
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsParseAml (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_STATUS TerminateStatus;
+ ACPI_THREAD_STATE *Thread;
+ ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
+ ACPI_WALK_STATE *PreviousWalkState;
+ ACPI_OPERAND_OBJECT **CallerReturnDesc = WalkState->CallerReturnDesc;
+ ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL;
+
+
+
+ ACPI_FUNCTION_TRACE ("PsParseAml");
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with WalkState=%p Aml=%p size=%X\n",
+ WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize));
+
+
+ /* Create and initialize a new thread state */
+
+ Thread = AcpiUtCreateThreadState ();
+ if (!Thread)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ WalkState->Thread = Thread;
+ AcpiDsPushWalkState (WalkState, Thread);
+
+ /*
+ * This global allows the AML debugger to get a handle to the currently
+ * executing control method.
+ */
+ AcpiGbl_CurrentWalkList = Thread;
+
+ /*
+ * Execute the walk loop as long as there is a valid Walk State. This
+ * handles nested control method invocations without recursion.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", WalkState));
+
+ Status = AE_OK;
+ while (WalkState)
+ {
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * The ParseLoop executes AML until the method terminates
+ * or calls another method.
+ */
+ Status = AcpiPsParseLoop (WalkState);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Completed one call to walk loop, %s State=%p\n",
+ AcpiFormatException (Status), WalkState));
+
+ if (Status == AE_CTRL_TRANSFER)
+ {
+ /*
+ * A method call was detected.
+ * Transfer control to the called control method
+ */
+ Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
+
+ /*
+ * If the transfer to the new method method call worked, a new walk
+ * state was created -- get it
+ */
+ WalkState = AcpiDsGetCurrentWalkState (Thread);
+ continue;
+ }
+ else if (Status == AE_CTRL_TERMINATE)
+ {
+ Status = AE_OK;
+ }
+ else if (Status != AE_OK)
+ {
+ ACPI_REPORT_METHOD_ERROR ("Method execution failed",
+ WalkState->MethodNode, NULL, Status);
+ }
+
+ /* We are done with this walk, move on to the parent if any */
+
+ WalkState = AcpiDsPopWalkState (Thread);
+ /* Save the last effective return value */
+
+ if (CallerReturnDesc && WalkState->ReturnDesc)
+ {
+ AcpiUtRemoveReference (EffectiveReturnDesc);
+ EffectiveReturnDesc = WalkState->ReturnDesc;
+ AcpiUtAddReference (EffectiveReturnDesc);
+ }
+
+ /* Reset the current scope to the beginning of scope stack */
+
+ AcpiDsScopeStackClear (WalkState);
+
+ /*
+ * If we just returned from the execution of a control method,
+ * there's lots of cleanup to do
+ */
+ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE)
+ {
+ TerminateStatus = AcpiDsTerminateControlMethod (WalkState);
+ if (ACPI_FAILURE (TerminateStatus))
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not terminate control method properly\n"));
+
+ /* Ignore error and continue */
+ }
+ }
+
+ /* Delete this walk state and all linked control states */
+
+ AcpiPsCleanupScope (&WalkState->ParserState);
+
+ PreviousWalkState = WalkState;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "ReturnValue=%p, State=%p\n",
+ WalkState->ReturnDesc, WalkState));
+
+ /* Check if we have restarted a preempted walk */
+
+ WalkState = AcpiDsGetCurrentWalkState (Thread);
+ if (WalkState)
+ {
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * There is another walk state, restart it.
+ * If the method return value is not used by the parent,
+ * The object is deleted
+ */
+ Status = AcpiDsRestartControlMethod (WalkState,
+ PreviousWalkState->ReturnDesc);
+ if (ACPI_SUCCESS (Status))
+ {
+ WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
+ }
+ }
+ else
+ {
+ /* On error, delete any return object */
+
+ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+ }
+ }
+
+ /*
+ * Just completed a 1st-level method, save the final internal return
+ * value (if any)
+ */
+ else if (PreviousWalkState->CallerReturnDesc)
+ {
+ /*
+ * Some AML code expects return value w/o ReturnOp.
+ * Return the saved effective return value instead.
+ */
+
+ if (PreviousWalkState->ReturnDesc == NULL && EffectiveReturnDesc != NULL)
+ {
+ PreviousWalkState->ReturnDesc = EffectiveReturnDesc;
+ AcpiUtAddReference (PreviousWalkState->ReturnDesc);
+ }
+
+ *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */
+ }
+ else if (PreviousWalkState->ReturnDesc)
+ {
+ /* Caller doesn't want it, must delete it */
+
+ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+ }
+
+ AcpiDsDeleteWalkState (PreviousWalkState);
+ }
+
+ /* Normal exit */
+
+ AcpiUtRemoveReference (EffectiveReturnDesc);
+ AcpiExReleaseAllMutexes (Thread);
+ AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
+ AcpiGbl_CurrentWalkList = PrevWalkList;
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c
new file mode 100644
index 0000000..4c64aa6
--- /dev/null
+++ b/sys/contrib/dev/acpica/psscope.c
@@ -0,0 +1,376 @@
+/******************************************************************************
+ *
+ * Module Name: psscope - Parser scope stack management routines
+ * $Revision: 36 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psscope")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetParentScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Pointer to an Op object
+ *
+ * DESCRIPTION: Get parent of current op being parsed
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetParentScope (
+ ACPI_PARSE_STATE *ParserState)
+{
+ return (ParserState->Scope->ParseScope.Op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsHasCompletedScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Boolean, TRUE = scope completed.
+ *
+ * DESCRIPTION: Is parsing of current argument complete? Determined by
+ * 1) AML pointer is at or beyond the end of the scope
+ * 2) The scope argument count has reached zero.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiPsHasCompletedScope (
+ ACPI_PARSE_STATE *ParserState)
+{
+ return ((BOOLEAN) ((ParserState->Aml >= ParserState->Scope->ParseScope.ArgEnd ||
+ !ParserState->Scope->ParseScope.ArgCount)));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsInitScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * Root - the Root Node of this new scope
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocate and init a new scope object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsInitScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *RootOp)
+{
+ ACPI_GENERIC_STATE *Scope;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
+
+
+ Scope = AcpiUtCreateGenericState ();
+ if (!Scope)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Scope->Common.DataType = ACPI_DESC_TYPE_STATE_RPSCOPE;
+ Scope->ParseScope.Op = RootOp;
+ Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
+ Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
+ Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
+
+ ParserState->Scope = Scope;
+ ParserState->StartOp = RootOp;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsPushScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * Op - Current op to be pushed
+ * RemainingArgs - List of args remaining
+ * ArgCount - Fixed or variable number of args
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push current op to begin parsing its argument
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsPushScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 RemainingArgs,
+ UINT32 ArgCount)
+{
+ ACPI_GENERIC_STATE *Scope;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsPushScope", Op);
+
+
+ Scope = AcpiUtCreateGenericState ();
+ if (!Scope)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+
+ Scope->Common.DataType = ACPI_DESC_TYPE_STATE_PSCOPE;
+ Scope->ParseScope.Op = Op;
+ Scope->ParseScope.ArgList = RemainingArgs;
+ Scope->ParseScope.ArgCount = ArgCount;
+ Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
+
+ /* Push onto scope stack */
+
+ AcpiUtPushGenericState (&ParserState->Scope, Scope);
+
+
+ if (ArgCount == ACPI_VAR_ARGS)
+ {
+ /* multiple arguments */
+
+ Scope->ParseScope.ArgEnd = ParserState->PkgEnd;
+ }
+
+ else
+ {
+ /* single argument */
+
+ Scope->ParseScope.ArgEnd = ACPI_TO_POINTER (ACPI_MAX_PTR);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsPopScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ * Op - Where the popped op is returned
+ * ArgList - Where the popped "next argument" is
+ * returned
+ * ArgCount - Count of objects in ArgList
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return to parsing a previous op
+ *
+ ******************************************************************************/
+
+void
+AcpiPsPopScope (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_PARSE_OBJECT **Op,
+ UINT32 *ArgList,
+ UINT32 *ArgCount)
+{
+ ACPI_GENERIC_STATE *Scope = ParserState->Scope;
+
+
+ ACPI_FUNCTION_TRACE ("PsPopScope");
+
+
+ /*
+ * Only pop the scope if there is in fact a next scope
+ */
+ if (Scope->Common.Next)
+ {
+ Scope = AcpiUtPopGenericState (&ParserState->Scope);
+
+ /* return to parsing previous op */
+
+ *Op = Scope->ParseScope.Op;
+ *ArgList = Scope->ParseScope.ArgList;
+ *ArgCount = Scope->ParseScope.ArgCount;
+ ParserState->PkgEnd = Scope->ParseScope.PkgEnd;
+
+ /* All done with this scope state structure */
+
+ AcpiUtDeleteGenericState (Scope);
+ }
+
+ else
+ {
+ /* empty parse stack, prepare to fetch next opcode */
+
+ *Op = NULL;
+ *ArgList = 0;
+ *ArgCount = 0;
+ }
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *Op, *ArgCount));
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCleanupScope
+ *
+ * PARAMETERS: ParserState - Current parser state object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Destroy available list, remaining stack levels, and return
+ * root scope
+ *
+ ******************************************************************************/
+
+void
+AcpiPsCleanupScope (
+ ACPI_PARSE_STATE *ParserState)
+{
+ ACPI_GENERIC_STATE *Scope;
+
+ ACPI_FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
+
+
+ if (!ParserState)
+ {
+ return;
+ }
+
+
+ /* Delete anything on the scope stack */
+
+ while (ParserState->Scope)
+ {
+ Scope = AcpiUtPopGenericState (&ParserState->Scope);
+ AcpiUtDeleteGenericState (Scope);
+ }
+
+ return_VOID;
+}
+
diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c
new file mode 100644
index 0000000..f4f1d48
--- /dev/null
+++ b/sys/contrib/dev/acpica/pstree.c
@@ -0,0 +1,418 @@
+/******************************************************************************
+ *
+ * Module Name: pstree - Parser op tree manipulation/traversal/search
+ * $Revision: 41 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __PSTREE_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("pstree")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetArg
+ *
+ * PARAMETERS: Op - Get an argument for this op
+ * Argn - Nth argument to get
+ *
+ * RETURN: The argument (as an Op object). NULL if argument does not exist
+ *
+ * DESCRIPTION: Get the specified op's argument.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetArg (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Argn)
+{
+ ACPI_PARSE_OBJECT *Arg = NULL;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Get the info structure for this opcode */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ /* Invalid opcode or ASCII character */
+
+ return (NULL);
+ }
+
+ /* Check if this opcode requires argument sub-objects */
+
+ if (!(OpInfo->Flags & AML_HAS_ARGS))
+ {
+ /* Has no linked argument objects */
+
+ return (NULL);
+ }
+
+ /* Get the requested argument object */
+
+ Arg = Op->Common.Value.Arg;
+ while (Arg && Argn)
+ {
+ Argn--;
+ Arg = Arg->Common.Next;
+ }
+
+ return (Arg);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsAppendArg
+ *
+ * PARAMETERS: Op - Append an argument to this Op.
+ * Arg - Argument Op to append
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Append an argument to an op's argument list (a NULL arg is OK)
+ *
+ ******************************************************************************/
+
+void
+AcpiPsAppendArg (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *Arg)
+{
+ ACPI_PARSE_OBJECT *PrevArg;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Op)
+ {
+ return;
+ }
+
+ /* Get the info structure for this opcode */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Class == AML_CLASS_UNKNOWN)
+ {
+ /* Invalid opcode */
+
+ ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n",
+ Op->Common.AmlOpcode));
+ return;
+ }
+
+ /* Check if this opcode requires argument sub-objects */
+
+ if (!(OpInfo->Flags & AML_HAS_ARGS))
+ {
+ /* Has no linked argument objects */
+
+ return;
+ }
+
+
+ /* Append the argument to the linked argument list */
+
+ if (Op->Common.Value.Arg)
+ {
+ /* Append to existing argument list */
+
+ PrevArg = Op->Common.Value.Arg;
+ while (PrevArg->Common.Next)
+ {
+ PrevArg = PrevArg->Common.Next;
+ }
+ PrevArg->Common.Next = Arg;
+ }
+
+ else
+ {
+ /* No argument list, this will be the first argument */
+
+ Op->Common.Value.Arg = Arg;
+ }
+
+
+ /* Set the parent in this arg and any args linked after it */
+
+ while (Arg)
+ {
+ Arg->Common.Parent = Op;
+ Arg = Arg->Common.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetChild
+ *
+ * PARAMETERS: Op - Get the child of this Op
+ *
+ * RETURN: Child Op, Null if none is found.
+ *
+ * DESCRIPTION: Get op's children or NULL if none
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetChild (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_SCOPE_OP:
+ case AML_ELSE_OP:
+ case AML_DEVICE_OP:
+ case AML_THERMAL_ZONE_OP:
+ case AML_INT_METHODCALL_OP:
+
+ Child = AcpiPsGetArg (Op, 0);
+ break;
+
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_METHOD_OP:
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 1);
+ break;
+
+
+ case AML_POWER_RES_OP:
+ case AML_INDEX_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 2);
+ break;
+
+
+ case AML_PROCESSOR_OP:
+ case AML_BANK_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 3);
+ break;
+
+
+ default:
+ /* All others have no children */
+ break;
+ }
+
+ return (Child);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetDepthNext
+ *
+ * PARAMETERS: Origin - Root of subtree to search
+ * Op - Last (previous) Op that was found
+ *
+ * RETURN: Next Op found in the search.
+ *
+ * DESCRIPTION: Get next op in tree (walking the tree in depth-first order)
+ * Return NULL when reaching "origin" or when walking up from root
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetDepthNext (
+ ACPI_PARSE_OBJECT *Origin,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next = NULL;
+ ACPI_PARSE_OBJECT *Parent;
+ ACPI_PARSE_OBJECT *Arg;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* look for an argument or child */
+
+ Next = AcpiPsGetArg (Op, 0);
+ if (Next)
+ {
+ return (Next);
+ }
+
+ /* look for a sibling */
+
+ Next = Op->Common.Next;
+ if (Next)
+ {
+ return (Next);
+ }
+
+ /* look for a sibling of parent */
+
+ Parent = Op->Common.Parent;
+
+ while (Parent)
+ {
+ Arg = AcpiPsGetArg (Parent, 0);
+ while (Arg && (Arg != Origin) && (Arg != Op))
+ {
+ Arg = Arg->Common.Next;
+ }
+
+ if (Arg == Origin)
+ {
+ /* reached parent of origin, end search */
+
+ return (NULL);
+ }
+
+ if (Parent->Common.Next)
+ {
+ /* found sibling of parent */
+
+ return (Parent->Common.Next);
+ }
+
+ Op = Parent;
+ Parent = Parent->Common.Parent;
+ }
+
+ return (Next);
+}
+
+
diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c
new file mode 100644
index 0000000..78a005b
--- /dev/null
+++ b/sys/contrib/dev/acpica/psutils.c
@@ -0,0 +1,396 @@
+/******************************************************************************
+ *
+ * Module Name: psutils - Parser miscellaneous utilities (Parser only)
+ * $Revision: 55 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCreateScopeOp
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: ScopeOp
+ *
+ * DESCRIPTION: Create a Scope and associated namepath op with the root name
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsCreateScopeOp (
+ void)
+{
+ ACPI_PARSE_OBJECT *ScopeOp;
+
+
+ ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP);
+ if (!ScopeOp)
+ {
+ return (NULL);
+ }
+
+
+ ScopeOp->Named.Name = ACPI_ROOT_NAME;
+ return (ScopeOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsInitOp
+ *
+ * PARAMETERS: Op - A newly allocated Op object
+ * Opcode - Opcode to store in the Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
+ * opcode
+ *
+ ******************************************************************************/
+
+void
+AcpiPsInitOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT16 Opcode)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Op->Common.DataType = ACPI_DESC_TYPE_PARSER;
+ Op->Common.AmlOpcode = Opcode;
+
+ ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
+ (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName)));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsAllocOp
+ *
+ * PARAMETERS: Opcode - Opcode that will be stored in the new Op
+ *
+ * RETURN: Pointer to the new Op.
+ *
+ * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
+ * opcode. A cache of opcodes is available for the pure
+ * GENERIC_OP, since this is by far the most commonly used.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT*
+AcpiPsAllocOp (
+ UINT16 Opcode)
+{
+ ACPI_PARSE_OBJECT *Op = NULL;
+ UINT32 Size;
+ UINT8 Flags;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+
+ /* Allocate the minimum required size object */
+
+ if (OpInfo->Flags & AML_DEFER)
+ {
+ Size = sizeof (ACPI_PARSE_OBJ_NAMED);
+ Flags = ACPI_PARSEOP_DEFERRED;
+ }
+ else if (OpInfo->Flags & AML_NAMED)
+ {
+ Size = sizeof (ACPI_PARSE_OBJ_NAMED);
+ Flags = ACPI_PARSEOP_NAMED;
+ }
+ else if (Opcode == AML_INT_BYTELIST_OP)
+ {
+ Size = sizeof (ACPI_PARSE_OBJ_NAMED);
+ Flags = ACPI_PARSEOP_BYTELIST;
+ }
+ else
+ {
+ Size = sizeof (ACPI_PARSE_OBJ_COMMON);
+ Flags = ACPI_PARSEOP_GENERIC;
+ }
+
+ if (Size == sizeof (ACPI_PARSE_OBJ_COMMON))
+ {
+ /*
+ * The generic op is by far the most common (16 to 1)
+ */
+ Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE);
+ }
+ else
+ {
+ Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE_EXT);
+ }
+
+ /* Initialize the Op */
+
+ if (Op)
+ {
+ AcpiPsInitOp (Op, Opcode);
+ Op->Common.Flags = Flags;
+ }
+
+ return (Op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsFreeOp
+ *
+ * PARAMETERS: Op - Op to be freed
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Free an Op object. Either put it on the GENERIC_OP cache list
+ * or actually free it.
+ *
+ ******************************************************************************/
+
+void
+AcpiPsFreeOp (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_FUNCTION_NAME ("PsFreeOp");
+
+
+ if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", Op));
+ }
+
+ if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
+ {
+ AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op);
+ }
+ else
+ {
+ AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE_EXT, Op);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsDeleteParseCache
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Free all objects that are on the parse cache list.
+ *
+ ******************************************************************************/
+
+void
+AcpiPsDeleteParseCache (
+ void)
+{
+ ACPI_FUNCTION_TRACE ("PsDeleteParseCache");
+
+
+ AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE);
+ AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE_EXT);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Utility functions
+ *
+ * DESCRIPTION: Low level character and object functions
+ *
+ ******************************************************************************/
+
+
+/*
+ * Is "c" a namestring lead character?
+ */
+BOOLEAN
+AcpiPsIsLeadingChar (
+ UINT32 c)
+{
+ return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z')));
+}
+
+
+/*
+ * Is "c" a namestring prefix character?
+ */
+BOOLEAN
+AcpiPsIsPrefixChar (
+ UINT32 c)
+{
+ return ((BOOLEAN) (c == '\\' || c == '^'));
+}
+
+
+/*
+ * Get op's name (4-byte name segment) or 0 if unnamed
+ */
+UINT32
+AcpiPsGetName (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ /* The "generic" object has no name associated with it */
+
+ if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
+ {
+ return (0);
+ }
+
+ /* Only the "Extended" parse objects have a name */
+
+ return (Op->Named.Name);
+}
+
+
+/*
+ * Set op's name
+ */
+void
+AcpiPsSetName (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 name)
+{
+
+ /* The "generic" object has no name associated with it */
+
+ if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
+ {
+ return;
+ }
+
+ Op->Named.Name = name;
+}
+
diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c
new file mode 100644
index 0000000..74813c2
--- /dev/null
+++ b/sys/contrib/dev/acpica/pswalk.c
@@ -0,0 +1,393 @@
+/******************************************************************************
+ *
+ * Module Name: pswalk - Parser routines to walk parsed op tree(s)
+ * $Revision: 69 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("pswalk")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetNextWalkOp
+ *
+ * PARAMETERS: WalkState - Current state of the walk
+ * Op - Current Op to be walked
+ * AscendingCallback - Procedure called when Op is complete
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the next Op in a walk of the parse tree.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsGetNextWalkOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_UPWARDS AscendingCallback)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_PARSE_OBJECT *Parent;
+ ACPI_PARSE_OBJECT *GrandParent;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
+
+
+ /* Check for a argument only if we are descending in the tree */
+
+ if (WalkState->NextOpInfo != ACPI_NEXT_OP_UPWARD)
+ {
+ /* Look for an argument or child of the current op */
+
+ Next = AcpiPsGetArg (Op, 0);
+ if (Next)
+ {
+ /* Still going downward in tree (Op is not completed yet) */
+
+ WalkState->PrevOp = Op;
+ WalkState->NextOp = Next;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * No more children, this Op is complete. Save Next and Parent
+ * in case the Op object gets deleted by the callback routine
+ */
+ Next = Op->Common.Next;
+ Parent = Op->Common.Parent;
+
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = AscendingCallback (WalkState);
+
+ /*
+ * If we are back to the starting point, the walk is complete.
+ */
+ if (Op == WalkState->Origin)
+ {
+ /* Reached the point of origin, the walk is complete */
+
+ WalkState->PrevOp = Op;
+ WalkState->NextOp = NULL;
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Check for a sibling to the current op. A sibling means
+ * we are still going "downward" in the tree.
+ */
+ if (Next)
+ {
+ /* There is a sibling, it will be next */
+
+ WalkState->PrevOp = Op;
+ WalkState->NextOp = Next;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
+
+ /* Continue downward */
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Drop into the loop below because we are moving upwards in
+ * the tree
+ */
+ }
+ else
+ {
+ /*
+ * We are resuming a walk, and we were (are) going upward in the tree.
+ * So, we want to drop into the parent loop below.
+ */
+ Parent = Op;
+ }
+
+ /*
+ * Look for a sibling of the current Op's parent
+ * Continue moving up the tree until we find a node that has not been
+ * visited, or we get back to where we started.
+ */
+ while (Parent)
+ {
+ /* We are moving up the tree, therefore this parent Op is complete */
+
+ GrandParent = Parent->Common.Parent;
+ Next = Parent->Common.Next;
+
+ WalkState->Op = Parent;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Common.AmlOpcode);
+ WalkState->Opcode = Parent->Common.AmlOpcode;
+
+ Status = AscendingCallback (WalkState);
+
+ /*
+ * If we are back to the starting point, the walk is complete.
+ */
+ if (Parent == WalkState->Origin)
+ {
+ /* Reached the point of origin, the walk is complete */
+
+ WalkState->PrevOp = Parent;
+ WalkState->NextOp = NULL;
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * If there is a sibling to this parent (it is not the starting point
+ * Op), then we will visit it.
+ */
+ if (Next)
+ {
+ /* found sibling of parent */
+
+ WalkState->PrevOp = Parent;
+ WalkState->NextOp = Next;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* No siblings, no errors, just move up one more level in the tree */
+
+ Op = Parent;
+ Parent = GrandParent;
+ WalkState->PrevOp = Op;
+ }
+
+
+ /*
+ * Got all the way to the top of the tree, we must be done!
+ * However, the code should have terminated in the loop above
+ */
+ WalkState->NextOp = NULL;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsDeleteCompletedOp
+ *
+ * PARAMETERS: State - Walk state
+ * Op - Completed op
+ *
+ * RETURN: AE_OK
+ *
+ * DESCRIPTION: Callback function for AcpiPsGetNextWalkOp(). Used during
+ * AcpiPsDeleteParse tree to delete Op objects when all sub-objects
+ * have been visited (and deleted.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsDeleteCompletedOp (
+ ACPI_WALK_STATE *WalkState)
+{
+
+ AcpiPsFreeOp (WalkState->Op);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsDeleteParseTree
+ *
+ * PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete a portion of or an entire parse tree.
+ *
+ ******************************************************************************/
+
+void
+AcpiPsDeleteParseTree (
+ ACPI_PARSE_OBJECT *SubtreeRoot)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_THREAD_STATE *Thread;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
+
+
+ if (!SubtreeRoot)
+ {
+ return_VOID;
+ }
+
+ /* Create and initialize a new walk list */
+
+ Thread = AcpiUtCreateThreadState ();
+ if (!Thread)
+ {
+ return_VOID;
+ }
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, Thread);
+ if (!WalkState)
+ {
+ return_VOID;
+ }
+
+ WalkState->ParseFlags = 0;
+ WalkState->DescendingCallback = NULL;
+ WalkState->AscendingCallback = NULL;
+
+ WalkState->Origin = SubtreeRoot;
+ WalkState->NextOp = SubtreeRoot;
+
+ /* Head downward in the tree */
+
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
+
+ /* Visit all nodes in the subtree */
+
+ while (WalkState->NextOp)
+ {
+ Status = AcpiPsGetNextWalkOp (WalkState, WalkState->NextOp,
+ AcpiPsDeleteCompletedOp);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+
+ /* We are done with this walk */
+
+ AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
+ AcpiDsDeleteWalkState (WalkState);
+
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c
new file mode 100644
index 0000000..4f8795a
--- /dev/null
+++ b/sys/contrib/dev/acpica/psxface.c
@@ -0,0 +1,312 @@
+/******************************************************************************
+ *
+ * Module Name: psxface - Parser external interfaces
+ * $Revision: 68 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __PSXFACE_C__
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsxExecute
+ *
+ * PARAMETERS: MethodNode - A method object containing both the AML
+ * address and length.
+ * **Params - List of parameters to pass to method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ * **ReturnObjDesc - Return object from execution of the
+ * method.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a control method
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsxExecute (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT **Params,
+ ACPI_OPERAND_OBJECT **ReturnObjDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 i;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE ("PsxExecute");
+
+
+ /* Validate the Node and get the attached object */
+
+ if (!MethodNode)
+ {
+ return_ACPI_STATUS (AE_NULL_ENTRY);
+ }
+
+ ObjDesc = AcpiNsGetAttachedObject (MethodNode);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Init for new method, wait on concurrency semaphore */
+
+ Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Params)
+ {
+ /*
+ * The caller "owns" the parameters, so give each one an extra
+ * reference
+ */
+ for (i = 0; Params[i]; i++)
+ {
+ AcpiUtAddReference (Params[i]);
+ }
+ }
+
+ /*
+ * 1) Perform the first pass parse of the method to enter any
+ * named objects that it creates into the namespace
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "**** Begin Method Parse **** Entry=%p obj=%p\n",
+ MethodNode, ObjDesc));
+
+ /* Create and init a Root Node */
+
+ Op = AcpiPsCreateScopeOp ();
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Get a new OwnerId for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength, NULL, NULL, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parse the AML */
+
+ Status = AcpiPsParseAml (WalkState);
+ AcpiPsDeleteParseTree (Op);
+
+ /*
+ * 2) Execute the method. Performs second pass parse simultaneously
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "**** Begin Method Execution **** Entry=%p obj=%p\n",
+ MethodNode, ObjDesc));
+
+ /* Create and init a Root Node */
+
+ Op = AcpiPsCreateScopeOp ();
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Init new op with the method name and pointer back to the NS node */
+
+ AcpiPsSetName (Op, MethodNode->Name.Integer);
+ Op->Common.Node = MethodNode;
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The walk of the parse tree is where we actually execute the method
+ */
+ Status = AcpiPsParseAml (WalkState);
+ AcpiPsDeleteParseTree (Op);
+
+ if (Params)
+ {
+ /* Take away the extra reference that we gave the parameters above */
+
+ for (i = 0; Params[i]; i++)
+ {
+ /* Ignore errors, just do them all */
+
+ (void) AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT);
+ }
+ }
+
+ /*
+ * If the method has returned an object, signal this to the caller with
+ * a control exception code
+ */
+ if (*ReturnObjDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
+ *ReturnObjDesc));
+ ACPI_DUMP_STACK_ENTRY (*ReturnObjDesc);
+
+ Status = AE_CTRL_RETURN_VALUE;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c
new file mode 100644
index 0000000..8f3eceb
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsaddr.c
@@ -0,0 +1,1308 @@
+/*******************************************************************************
+ *
+ * Module Name: rsaddr - Address resource descriptors (16/32/64)
+ * $Revision: 32 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSADDR_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsaddr")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress16Resource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress16Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT8 *TempPtr;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
+ UINT32 Index;
+ UINT16 Temp16;
+ UINT8 Temp8;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress16Resource");
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ /* Check for the minimum length. */
+ if (Temp16 < 13)
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+
+ *BytesConsumed = Temp16 + 3;
+ OutputStruct->Id = ACPI_RSTYPE_ADDRESS16;
+
+ /*
+ * Get the Resource Type (Byte3)
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ /* Values 0-2 are valid */
+
+ if (Temp8 > 2)
+ {
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ OutputStruct->Data.Address16.ResourceType = Temp8 & 0x03;
+
+ /*
+ * Get the General Flags (Byte4)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /* Producer / Consumer */
+
+ OutputStruct->Data.Address16.ProducerConsumer = Temp8 & 0x01;
+
+ /* Decode */
+
+ OutputStruct->Data.Address16.Decode = (Temp8 >> 1) & 0x01;
+
+ /* Min Address Fixed */
+
+ OutputStruct->Data.Address16.MinAddressFixed = (Temp8 >> 2) & 0x01;
+
+ /* Max Address Fixed */
+
+ OutputStruct->Data.Address16.MaxAddressFixed = (Temp8 >> 3) & 0x01;
+
+ /*
+ * Get the Type Specific Flags (Byte5)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address16.ResourceType)
+ {
+ OutputStruct->Data.Address16.Attribute.Memory.ReadWriteAttribute =
+ (UINT16) (Temp8 & 0x01);
+ OutputStruct->Data.Address16.Attribute.Memory.CacheAttribute =
+ (UINT16) ((Temp8 >> 1) & 0x0F);
+ }
+ else
+ {
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address16.ResourceType)
+ {
+ OutputStruct->Data.Address16.Attribute.Io.RangeAttribute =
+ (UINT16) (Temp8 & 0x03);
+ OutputStruct->Data.Address16.Attribute.Io.TranslationAttribute =
+ (UINT16) ((Temp8 >> 4) & 0x03);
+ }
+ else
+ {
+ /* BUS_NUMBER_RANGE == Address16.Data->ResourceType */
+ /* Nothing needs to be filled in */
+ }
+ }
+
+ /*
+ * Get Granularity (Bytes 6-7)
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.Granularity, Buffer);
+
+ /*
+ * Get MinAddressRange (Bytes 8-9)
+ */
+ Buffer += 2;
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MinAddressRange, Buffer);
+
+ /*
+ * Get MaxAddressRange (Bytes 10-11)
+ */
+ Buffer += 2;
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MaxAddressRange, Buffer);
+
+ /*
+ * Get AddressTranslationOffset (Bytes 12-13)
+ */
+ Buffer += 2;
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressTranslationOffset, Buffer);
+
+ /*
+ * Get AddressLength (Bytes 14-15)
+ */
+ Buffer += 2;
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressLength, Buffer);
+
+ /*
+ * Resource Source Index (if present)
+ */
+ Buffer += 2;
+
+ /*
+ * This will leave us pointing to the Resource Source Index
+ * If it is present, then save it off and calculate the
+ * pointer to where the null terminated string goes.
+ *
+ * Note that some buggy resources have a length that indicates the
+ * Index byte is present even though it isn't (since there is no
+ * following Resource String.) We add one to catch these.
+ */
+ if (*BytesConsumed > 16 + 1)
+ {
+ /* Dereference the Index */
+
+ Temp8 = *Buffer;
+ OutputStruct->Data.Address16.ResourceSource.Index = (UINT32) Temp8;
+
+ /* Point to the String */
+
+ Buffer += 1;
+
+ /* Point the String pointer to the end of this structure */
+
+ OutputStruct->Data.Address16.ResourceSource.StringPtr =
+ (char *)((UINT8 * )OutputStruct + StructSize);
+
+ TempPtr = (UINT8 *) OutputStruct->Data.Address16.ResourceSource.StringPtr;
+
+ /* Copy the string into the buffer */
+
+ Index = 0;
+
+ while (0x00 != *Buffer)
+ {
+ *TempPtr = *Buffer;
+
+ TempPtr += 1;
+ Buffer += 1;
+ Index += 1;
+ }
+
+ /*
+ * Add the terminating null
+ */
+ *TempPtr = 0x00;
+
+ OutputStruct->Data.Address16.ResourceSource.StringLength = Index + 1;
+
+ /*
+ * In order for the StructSize to fall on a 32-bit boundary,
+ * calculate the length of the string and expand the
+ * StructSize to the next 32-bit boundary.
+ */
+ Temp8 = (UINT8) (Index + 1);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
+ }
+ else
+ {
+ OutputStruct->Data.Address16.ResourceSource.Index = 0x00;
+ OutputStruct->Data.Address16.ResourceSource.StringLength = 0;
+ OutputStruct->Data.Address16.ResourceSource.StringPtr = NULL;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress16Stream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress16Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT8 *LengthField;
+ UINT8 Temp8;
+ char *TempPointer = NULL;
+ ACPI_SIZE ActualBytes;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress16Stream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x88;
+ Buffer += 1;
+
+ /*
+ * Save a pointer to the Length field - to be filled in later
+ */
+ LengthField = Buffer;
+ Buffer += 2;
+
+ /*
+ * Set the Resource Type (Memory, Io, BusNumber)
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address16.ResourceType & 0x03);
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the general flags
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address16.ProducerConsumer & 0x01);
+
+ Temp8 |= (LinkedList->Data.Address16.Decode & 0x01) << 1;
+ Temp8 |= (LinkedList->Data.Address16.MinAddressFixed & 0x01) << 2;
+ Temp8 |= (LinkedList->Data.Address16.MaxAddressFixed & 0x01) << 3;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the type specific flags
+ */
+ Temp8 = 0;
+
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address16.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address16.Attribute.Memory.ReadWriteAttribute &
+ 0x01);
+
+ Temp8 |=
+ (LinkedList->Data.Address16.Attribute.Memory.CacheAttribute &
+ 0x0F) << 1;
+ }
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address16.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address16.Attribute.Io.RangeAttribute &
+ 0x03);
+ Temp8 |=
+ (LinkedList->Data.Address16.Attribute.Io.TranslationAttribute &
+ 0x03) << 4;
+ }
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the address space granularity
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.Granularity);
+ Buffer += 2;
+
+ /*
+ * Set the address range minimum
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MinAddressRange);
+ Buffer += 2;
+
+ /*
+ * Set the address range maximum
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MaxAddressRange);
+ Buffer += 2;
+
+ /*
+ * Set the address translation offset
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressTranslationOffset);
+ Buffer += 2;
+
+ /*
+ * Set the address length
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressLength);
+ Buffer += 2;
+
+ /*
+ * Resource Source Index and Resource Source are optional
+ */
+ if (0 != LinkedList->Data.Address16.ResourceSource.StringLength)
+ {
+ Temp8 = (UINT8) LinkedList->Data.Address16.ResourceSource.Index;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ TempPointer = (char *) Buffer;
+
+ /*
+ * Copy the string
+ */
+ ACPI_STRCPY (TempPointer,
+ LinkedList->Data.Address16.ResourceSource.StringPtr);
+
+ /*
+ * Buffer needs to be set to the length of the sting + one for the
+ * terminating null
+ */
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1);
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ ActualBytes = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ActualBytes;
+
+ /*
+ * Set the length field to the number of bytes consumed
+ * minus the header size (3 bytes)
+ */
+ ActualBytes -= 3;
+ ACPI_MOVE_SIZE_TO_16 (LengthField, &ActualBytes);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress32Resource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress32Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer;
+ ACPI_RESOURCE *OutputStruct= (void *) *OutputBuffer;
+ UINT16 Temp16;
+ UINT8 Temp8;
+ UINT8 *TempPtr;
+ ACPI_SIZE StructSize;
+ UINT32 Index;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress32Resource");
+
+
+ Buffer = ByteStreamBuffer;
+ StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ /* Check for the minimum length. */
+ if (Temp16 < 23)
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ *BytesConsumed = Temp16 + 3;
+
+ OutputStruct->Id = ACPI_RSTYPE_ADDRESS32;
+
+ /*
+ * Get the Resource Type (Byte3)
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ /* Values 0-2 are valid */
+ if(Temp8 > 2)
+ {
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ OutputStruct->Data.Address32.ResourceType = Temp8 & 0x03;
+
+ /*
+ * Get the General Flags (Byte4)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /*
+ * Producer / Consumer
+ */
+ OutputStruct->Data.Address32.ProducerConsumer = Temp8 & 0x01;
+
+ /*
+ * Decode
+ */
+ OutputStruct->Data.Address32.Decode = (Temp8 >> 1) & 0x01;
+
+ /*
+ * Min Address Fixed
+ */
+ OutputStruct->Data.Address32.MinAddressFixed = (Temp8 >> 2) & 0x01;
+
+ /*
+ * Max Address Fixed
+ */
+ OutputStruct->Data.Address32.MaxAddressFixed = (Temp8 >> 3) & 0x01;
+
+ /*
+ * Get the Type Specific Flags (Byte5)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address32.ResourceType)
+ {
+ OutputStruct->Data.Address32.Attribute.Memory.ReadWriteAttribute =
+ (UINT16) (Temp8 & 0x01);
+
+ OutputStruct->Data.Address32.Attribute.Memory.CacheAttribute =
+ (UINT16) ((Temp8 >> 1) & 0x0F);
+ }
+ else
+ {
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address32.ResourceType)
+ {
+ OutputStruct->Data.Address32.Attribute.Io.RangeAttribute =
+ (UINT16) (Temp8 & 0x03);
+ OutputStruct->Data.Address32.Attribute.Io.TranslationAttribute =
+ (UINT16) ((Temp8 >> 4) & 0x03);
+ }
+ else
+ {
+ /* BUS_NUMBER_RANGE == OutputStruct->Data.Address32.ResourceType */
+ /* Nothing needs to be filled in */
+ }
+ }
+
+ /*
+ * Get Granularity (Bytes 6-9)
+ */
+ Buffer += 1;
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.Granularity, Buffer);
+
+ /*
+ * Get MinAddressRange (Bytes 10-13)
+ */
+ Buffer += 4;
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, Buffer);
+
+ /*
+ * Get MaxAddressRange (Bytes 14-17)
+ */
+ Buffer += 4;
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, Buffer);
+
+ /*
+ * Get AddressTranslationOffset (Bytes 18-21)
+ */
+ Buffer += 4;
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, Buffer);
+
+ /*
+ * Get AddressLength (Bytes 22-25)
+ */
+ Buffer += 4;
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressLength, Buffer);
+
+ /*
+ * Resource Source Index (if present)
+ */
+ Buffer += 4;
+
+ /*
+ * This will leave us pointing to the Resource Source Index
+ * If it is present, then save it off and calculate the
+ * pointer to where the null terminated string goes.
+ *
+ * Note that some buggy resources have a length that indicates the
+ * Index byte is present even though it isn't (since there is no
+ * following Resource String.) We add one to catch these.
+ */
+ if (*BytesConsumed > 26 + 1)
+ {
+ /* Dereference the Index */
+
+ Temp8 = *Buffer;
+ OutputStruct->Data.Address32.ResourceSource.Index =
+ (UINT32) Temp8;
+
+ /* Point to the String */
+
+ Buffer += 1;
+
+ /* Point the String pointer to the end of this structure */
+
+ OutputStruct->Data.Address32.ResourceSource.StringPtr =
+ (char *)((UINT8 *)OutputStruct + StructSize);
+
+ TempPtr = (UINT8 *) OutputStruct->Data.Address32.ResourceSource.StringPtr;
+
+ /* Copy the string into the buffer */
+
+ Index = 0;
+ while (0x00 != *Buffer)
+ {
+ *TempPtr = *Buffer;
+
+ TempPtr += 1;
+ Buffer += 1;
+ Index += 1;
+ }
+
+ /*
+ * Add the terminating null
+ */
+ *TempPtr = 0x00;
+ OutputStruct->Data.Address32.ResourceSource.StringLength = Index + 1;
+
+ /*
+ * In order for the StructSize to fall on a 32-bit boundary,
+ * calculate the length of the string and expand the
+ * StructSize to the next 32-bit boundary.
+ */
+ Temp8 = (UINT8) (Index + 1);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
+ }
+ else
+ {
+ OutputStruct->Data.Address32.ResourceSource.Index = 0x00;
+ OutputStruct->Data.Address32.ResourceSource.StringLength = 0;
+ OutputStruct->Data.Address32.ResourceSource.StringPtr = NULL;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress32Stream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress32Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer;
+ UINT16 *LengthField;
+ UINT8 Temp8;
+ char *TempPointer;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress32Stream");
+
+
+ Buffer = *OutputBuffer;
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x87;
+ Buffer += 1;
+
+ /*
+ * Set a pointer to the Length field - to be filled in later
+ */
+ LengthField = ACPI_CAST_PTR (UINT16, Buffer);
+ Buffer += 2;
+
+ /*
+ * Set the Resource Type (Memory, Io, BusNumber)
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address32.ResourceType & 0x03);
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the general flags
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address32.ProducerConsumer & 0x01);
+ Temp8 |= (LinkedList->Data.Address32.Decode & 0x01) << 1;
+ Temp8 |= (LinkedList->Data.Address32.MinAddressFixed & 0x01) << 2;
+ Temp8 |= (LinkedList->Data.Address32.MaxAddressFixed & 0x01) << 3;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the type specific flags
+ */
+ Temp8 = 0;
+
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address32.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address32.Attribute.Memory.ReadWriteAttribute &
+ 0x01);
+
+ Temp8 |=
+ (LinkedList->Data.Address32.Attribute.Memory.CacheAttribute &
+ 0x0F) << 1;
+ }
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address32.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address32.Attribute.Io.RangeAttribute &
+ 0x03);
+ Temp8 |=
+ (LinkedList->Data.Address32.Attribute.Io.TranslationAttribute &
+ 0x03) << 4;
+ }
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the address space granularity
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.Granularity);
+ Buffer += 4;
+
+ /*
+ * Set the address range minimum
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MinAddressRange);
+ Buffer += 4;
+
+ /*
+ * Set the address range maximum
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MaxAddressRange);
+ Buffer += 4;
+
+ /*
+ * Set the address translation offset
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressTranslationOffset);
+ Buffer += 4;
+
+ /*
+ * Set the address length
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressLength);
+ Buffer += 4;
+
+ /*
+ * Resource Source Index and Resource Source are optional
+ */
+ if (0 != LinkedList->Data.Address32.ResourceSource.StringLength)
+ {
+ Temp8 = (UINT8) LinkedList->Data.Address32.ResourceSource.Index;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ TempPointer = (char *) Buffer;
+
+ /*
+ * Copy the string
+ */
+ ACPI_STRCPY (TempPointer,
+ LinkedList->Data.Address32.ResourceSource.StringPtr);
+
+ /*
+ * Buffer needs to be set to the length of the sting + one for the
+ * terminating null
+ */
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+
+ /*
+ * Set the length field to the number of bytes consumed
+ * minus the header size (3 bytes)
+ */
+ *LengthField = (UINT16) (*BytesConsumed - 3);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress64Resource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress64Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16;
+ UINT8 Temp8;
+ UINT8 *TempPtr;
+ ACPI_SIZE StructSize;
+ UINT32 Index;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress64Resource");
+
+
+ Buffer = ByteStreamBuffer;
+ StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ /* Check for the minimum length. */
+ if (Temp16 < 43)
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ *BytesConsumed = Temp16 + 3;
+
+ OutputStruct->Id = ACPI_RSTYPE_ADDRESS64;
+
+ /*
+ * Get the Resource Type (Byte3)
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ /* Values 0-2 are valid */
+
+ if(Temp8 > 2)
+ {
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ OutputStruct->Data.Address64.ResourceType = Temp8 & 0x03;
+
+ /*
+ * Get the General Flags (Byte4)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /*
+ * Producer / Consumer
+ */
+ OutputStruct->Data.Address64.ProducerConsumer = Temp8 & 0x01;
+
+ /*
+ * Decode
+ */
+ OutputStruct->Data.Address64.Decode = (Temp8 >> 1) & 0x01;
+
+ /*
+ * Min Address Fixed
+ */
+ OutputStruct->Data.Address64.MinAddressFixed = (Temp8 >> 2) & 0x01;
+
+ /*
+ * Max Address Fixed
+ */
+ OutputStruct->Data.Address64.MaxAddressFixed = (Temp8 >> 3) & 0x01;
+
+ /*
+ * Get the Type Specific Flags (Byte5)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType)
+ {
+ OutputStruct->Data.Address64.Attribute.Memory.ReadWriteAttribute =
+ (UINT16) (Temp8 & 0x01);
+
+ OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute =
+ (UINT16) ((Temp8 >> 1) & 0x0F);
+ }
+ else
+ {
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address64.ResourceType)
+ {
+ OutputStruct->Data.Address64.Attribute.Io.RangeAttribute =
+ (UINT16) (Temp8 & 0x03);
+ OutputStruct->Data.Address64.Attribute.Io.TranslationAttribute =
+ (UINT16) ((Temp8 >> 4) & 0x03);
+ }
+ else
+ {
+ /* BUS_NUMBER_RANGE == OutputStruct->Data.Address64.ResourceType */
+ /* Nothing needs to be filled in */
+ }
+ }
+
+ /*
+ * Get Granularity (Bytes 6-13)
+ */
+ Buffer += 1;
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.Granularity, Buffer);
+
+ /*
+ * Get MinAddressRange (Bytes 14-21)
+ */
+ Buffer += 8;
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, Buffer);
+
+ /*
+ * Get MaxAddressRange (Bytes 22-29)
+ */
+ Buffer += 8;
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, Buffer);
+
+ /*
+ * Get AddressTranslationOffset (Bytes 30-37)
+ */
+ Buffer += 8;
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, Buffer);
+
+ /*
+ * Get AddressLength (Bytes 38-45)
+ */
+ Buffer += 8;
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressLength, Buffer);
+
+ /*
+ * Resource Source Index (if present)
+ */
+ Buffer += 8;
+
+ /*
+ * This will leave us pointing to the Resource Source Index
+ * If it is present, then save it off and calculate the
+ * pointer to where the null terminated string goes.
+ *
+ * Note that some buggy resources have a length that indicates the
+ * Index byte is present even though it isn't (since there is no
+ * following Resource String.) We add one to catch these.
+ */
+ if (*BytesConsumed > 46 + 1)
+ {
+ /* Dereference the Index */
+
+ Temp8 = *Buffer;
+ OutputStruct->Data.Address64.ResourceSource.Index =
+ (UINT32) Temp8;
+
+ /* Point to the String */
+
+ Buffer += 1;
+
+ /* Point the String pointer to the end of this structure */
+
+ OutputStruct->Data.Address64.ResourceSource.StringPtr =
+ (char *)((UINT8 *)OutputStruct + StructSize);
+
+ TempPtr = (UINT8 *) OutputStruct->Data.Address64.ResourceSource.StringPtr;
+
+ /* Copy the string into the buffer */
+
+ Index = 0;
+ while (0x00 != *Buffer)
+ {
+ *TempPtr = *Buffer;
+
+ TempPtr += 1;
+ Buffer += 1;
+ Index += 1;
+ }
+
+ /*
+ * Add the terminating null
+ */
+ *TempPtr = 0x00;
+
+ OutputStruct->Data.Address64.ResourceSource.StringLength = Index + 1;
+
+ /*
+ * In order for the StructSize to fall on a 32-bit boundary,
+ * calculate the length of the string and expand the
+ * StructSize to the next 32-bit boundary.
+ */
+ Temp8 = (UINT8) (Index + 1);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
+ }
+ else
+ {
+ OutputStruct->Data.Address64.ResourceSource.Index = 0x00;
+ OutputStruct->Data.Address64.ResourceSource.StringLength = 0;
+ OutputStruct->Data.Address64.ResourceSource.StringPtr = NULL;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsAddress64Stream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsAddress64Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer;
+ UINT16 *LengthField;
+ UINT8 Temp8;
+ char *TempPointer;
+
+
+ ACPI_FUNCTION_TRACE ("RsAddress64Stream");
+
+
+ Buffer = *OutputBuffer;
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x8A;
+ Buffer += 1;
+
+ /*
+ * Set a pointer to the Length field - to be filled in later
+ */
+
+ LengthField = ACPI_CAST_PTR (UINT16, Buffer);
+ Buffer += 2;
+
+ /*
+ * Set the Resource Type (Memory, Io, BusNumber)
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address64.ResourceType & 0x03);
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the general flags
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Address64.ProducerConsumer & 0x01);
+ Temp8 |= (LinkedList->Data.Address64.Decode & 0x01) << 1;
+ Temp8 |= (LinkedList->Data.Address64.MinAddressFixed & 0x01) << 2;
+ Temp8 |= (LinkedList->Data.Address64.MaxAddressFixed & 0x01) << 3;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the type specific flags
+ */
+ Temp8 = 0;
+
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address64.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address64.Attribute.Memory.ReadWriteAttribute &
+ 0x01);
+
+ Temp8 |=
+ (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute &
+ 0x0F) << 1;
+ }
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address64.ResourceType)
+ {
+ Temp8 = (UINT8)
+ (LinkedList->Data.Address64.Attribute.Io.RangeAttribute &
+ 0x03);
+ Temp8 |=
+ (LinkedList->Data.Address64.Attribute.Io.RangeAttribute &
+ 0x03) << 4;
+ }
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the address space granularity
+ */
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.Granularity);
+ Buffer += 8;
+
+ /*
+ * Set the address range minimum
+ */
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MinAddressRange);
+ Buffer += 8;
+
+ /*
+ * Set the address range maximum
+ */
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MaxAddressRange);
+ Buffer += 8;
+
+ /*
+ * Set the address translation offset
+ */
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressTranslationOffset);
+ Buffer += 8;
+
+ /*
+ * Set the address length
+ */
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressLength);
+ Buffer += 8;
+
+ /*
+ * Resource Source Index and Resource Source are optional
+ */
+ if (0 != LinkedList->Data.Address64.ResourceSource.StringLength)
+ {
+ Temp8 = (UINT8) LinkedList->Data.Address64.ResourceSource.Index;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ TempPointer = (char *) Buffer;
+
+ /*
+ * Copy the string
+ */
+ ACPI_STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr);
+
+ /*
+ * Buffer needs to be set to the length of the sting + one for the
+ * terminating null
+ */
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+
+ /*
+ * Set the length field to the number of bytes consumed
+ * minus the header size (3 bytes)
+ */
+ *LengthField = (UINT16) (*BytesConsumed - 3);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c
new file mode 100644
index 0000000..f1aafce
--- /dev/null
+++ b/sys/contrib/dev/acpica/rscalc.c
@@ -0,0 +1,953 @@
+/*******************************************************************************
+ *
+ * Module Name: rscalc - Calculate stream and list lengths
+ * $Revision: 48 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSCALC_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rscalc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetByteStreamLength
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * SizeNeeded - UINT32 pointer of the size buffer needed
+ * to properly return the parsed data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
+ * the size buffer needed to hold the linked list that conveys
+ * the resource data.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetByteStreamLength (
+ ACPI_RESOURCE *LinkedList,
+ ACPI_SIZE *SizeNeeded)
+{
+ ACPI_SIZE ByteStreamSizeNeeded = 0;
+ ACPI_SIZE SegmentSize;
+ ACPI_RESOURCE_EXT_IRQ *ExIrq = NULL;
+ BOOLEAN Done = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetByteStreamLength");
+
+
+ while (!Done)
+ {
+ /*
+ * Init the variable that will hold the size to add to the total.
+ */
+ SegmentSize = 0;
+
+ switch (LinkedList->Id)
+ {
+ case ACPI_RSTYPE_IRQ:
+ /*
+ * IRQ Resource
+ * For an IRQ Resource, Byte 3, although optional, will
+ * always be created - it holds IRQ information.
+ */
+ SegmentSize = 4;
+ break;
+
+ case ACPI_RSTYPE_DMA:
+ /*
+ * DMA Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 3;
+ break;
+
+ case ACPI_RSTYPE_START_DPF:
+ /*
+ * Start Dependent Functions Resource
+ * For a StartDependentFunctions Resource, Byte 1,
+ * although optional, will always be created.
+ */
+ SegmentSize = 2;
+ break;
+
+ case ACPI_RSTYPE_END_DPF:
+ /*
+ * End Dependent Functions Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 1;
+ break;
+
+ case ACPI_RSTYPE_IO:
+ /*
+ * IO Port Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 8;
+ break;
+
+ case ACPI_RSTYPE_FIXED_IO:
+ /*
+ * Fixed IO Port Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 4;
+ break;
+
+ case ACPI_RSTYPE_VENDOR:
+ /*
+ * Vendor Defined Resource
+ * For a Vendor Specific resource, if the Length is
+ * between 1 and 7 it will be created as a Small
+ * Resource data type, otherwise it is a Large
+ * Resource data type.
+ */
+ if (LinkedList->Data.VendorSpecific.Length > 7)
+ {
+ SegmentSize = 3;
+ }
+ else
+ {
+ SegmentSize = 1;
+ }
+ SegmentSize += LinkedList->Data.VendorSpecific.Length;
+ break;
+
+ case ACPI_RSTYPE_END_TAG:
+ /*
+ * End Tag
+ * For this resource the size is static
+ */
+ SegmentSize = 2;
+ Done = TRUE;
+ break;
+
+ case ACPI_RSTYPE_MEM24:
+ /*
+ * 24-Bit Memory Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 12;
+ break;
+
+ case ACPI_RSTYPE_MEM32:
+ /*
+ * 32-Bit Memory Range Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 20;
+ break;
+
+ case ACPI_RSTYPE_FIXED_MEM32:
+ /*
+ * 32-Bit Fixed Memory Resource
+ * For this resource the size is static
+ */
+ SegmentSize = 12;
+ break;
+
+ case ACPI_RSTYPE_ADDRESS16:
+ /*
+ * 16-Bit Address Resource
+ * The base size of this byte stream is 16. If a
+ * Resource Source string is not NULL, add 1 for
+ * the Index + the length of the null terminated
+ * string Resource Source + 1 for the null.
+ */
+ SegmentSize = 16;
+
+ if (LinkedList->Data.Address16.ResourceSource.StringPtr)
+ {
+ SegmentSize += LinkedList->Data.Address16.ResourceSource.StringLength;
+ SegmentSize++;
+ }
+ break;
+
+ case ACPI_RSTYPE_ADDRESS32:
+ /*
+ * 32-Bit Address Resource
+ * The base size of this byte stream is 26. If a Resource
+ * Source string is not NULL, add 1 for the Index + the
+ * length of the null terminated string Resource Source +
+ * 1 for the null.
+ */
+ SegmentSize = 26;
+
+ if (LinkedList->Data.Address32.ResourceSource.StringPtr)
+ {
+ SegmentSize += LinkedList->Data.Address32.ResourceSource.StringLength;
+ SegmentSize++;
+ }
+ break;
+
+ case ACPI_RSTYPE_ADDRESS64:
+ /*
+ * 64-Bit Address Resource
+ * The base size of this byte stream is 46. If a Resource
+ * Source string is not NULL, add 1 for the Index + the
+ * length of the null terminated string Resource Source +
+ * 1 for the null.
+ */
+ SegmentSize = 46;
+
+ if (LinkedList->Data.Address64.ResourceSource.StringPtr)
+ {
+ SegmentSize += LinkedList->Data.Address64.ResourceSource.StringLength;
+ SegmentSize++;
+ }
+ break;
+
+ case ACPI_RSTYPE_EXT_IRQ:
+ /*
+ * Extended IRQ Resource
+ * The base size of this byte stream is 9. This is for an
+ * Interrupt table length of 1. For each additional
+ * interrupt, add 4.
+ * If a Resource Source string is not NULL, add 1 for the
+ * Index + the length of the null terminated string
+ * Resource Source + 1 for the null.
+ */
+ SegmentSize = 9 +
+ (((ACPI_SIZE) LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4);
+
+ if (ExIrq && ExIrq->ResourceSource.StringPtr)
+ {
+ SegmentSize += LinkedList->Data.ExtendedIrq.ResourceSource.StringLength;
+ SegmentSize++;
+ }
+ break;
+
+ default:
+ /*
+ * If we get here, everything is out of sync,
+ * so exit with an error
+ */
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+
+ } /* switch (LinkedList->Id) */
+
+ /*
+ * Update the total
+ */
+ ByteStreamSizeNeeded += SegmentSize;
+
+ /*
+ * Point to the next object
+ */
+ LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
+ LinkedList, LinkedList->Length);
+ }
+
+ /*
+ * This is the data the caller needs
+ */
+ *SizeNeeded = ByteStreamSizeNeeded;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetListLength
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
+ * ByteStreamBufferLength - Size of ByteStreamBuffer
+ * SizeNeeded - UINT32 pointer of the size buffer
+ * needed to properly return the
+ * parsed data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
+ * the size buffer needed to hold the linked list that conveys
+ * the resource data.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetListLength (
+ UINT8 *ByteStreamBuffer,
+ UINT32 ByteStreamBufferLength,
+ ACPI_SIZE *SizeNeeded)
+{
+ UINT32 BufferSize = 0;
+ UINT32 BytesParsed = 0;
+ UINT8 NumberOfInterrupts = 0;
+ UINT8 NumberOfChannels = 0;
+ UINT8 ResourceType;
+ UINT32 StructureSize;
+ UINT32 BytesConsumed;
+ UINT8 *Buffer;
+ UINT8 Temp8;
+ UINT16 Temp16;
+ UINT8 Index;
+ UINT8 AdditionalBytes;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetListLength");
+
+
+ while (BytesParsed < ByteStreamBufferLength)
+ {
+ /*
+ * The next byte in the stream is the resource type
+ */
+ ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer);
+
+ switch (ResourceType)
+ {
+ case ACPI_RDESC_TYPE_MEMORY_24:
+ /*
+ * 24-Bit Memory Resource
+ */
+ BytesConsumed = 12;
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+ break;
+
+
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
+ /*
+ * Vendor Defined Resource
+ */
+ Buffer = ByteStreamBuffer;
+ ++Buffer;
+
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ BytesConsumed = Temp16 + 3;
+
+ /*
+ * Ensure a 32-bit boundary for the structure
+ */
+ Temp16 = (UINT16) ACPI_ROUND_UP_TO_32BITS (Temp16);
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+ (Temp16 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_MEMORY_32:
+ /*
+ * 32-Bit Memory Range Resource
+ */
+
+ BytesConsumed = 20;
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
+ /*
+ * 32-Bit Fixed Memory Resource
+ */
+ BytesConsumed = 12;
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+ break;
+
+
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ /*
+ * 64-Bit Address Resource
+ */
+ Buffer = ByteStreamBuffer;
+
+ ++Buffer;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ BytesConsumed = Temp16 + 3;
+
+ /*
+ * Resource Source Index and Resource Source are
+ * optional elements. Check the length of the
+ * Bytestream. If it is greater than 43, that
+ * means that an Index exists and is followed by
+ * a null termininated string. Therefore, set
+ * the temp variable to the length minus the minimum
+ * byte stream length plus the byte for the Index to
+ * determine the size of the NULL terminiated string.
+ */
+ if (43 < Temp16)
+ {
+ Temp8 = (UINT8) (Temp16 - 44);
+ }
+ else
+ {
+ Temp8 = 0;
+ }
+
+ /*
+ * Ensure a 64-bit boundary for the structure
+ */
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_64BITS (Temp8);
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
+ (Temp8 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ /*
+ * 32-Bit Address Resource
+ */
+ Buffer = ByteStreamBuffer;
+
+ ++Buffer;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ BytesConsumed = Temp16 + 3;
+
+ /*
+ * Resource Source Index and Resource Source are
+ * optional elements. Check the length of the
+ * Bytestream. If it is greater than 23, that
+ * means that an Index exists and is followed by
+ * a null termininated string. Therefore, set
+ * the temp variable to the length minus the minimum
+ * byte stream length plus the byte for the Index to
+ * determine the size of the NULL terminiated string.
+ */
+ if (23 < Temp16)
+ {
+ Temp8 = (UINT8) (Temp16 - 24);
+ }
+ else
+ {
+ Temp8 = 0;
+ }
+
+ /*
+ * Ensure a 32-bit boundary for the structure
+ */
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
+ (Temp8 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ /*
+ * 16-Bit Address Resource
+ */
+ Buffer = ByteStreamBuffer;
+
+ ++Buffer;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ BytesConsumed = Temp16 + 3;
+
+ /*
+ * Resource Source Index and Resource Source are
+ * optional elements. Check the length of the
+ * Bytestream. If it is greater than 13, that
+ * means that an Index exists and is followed by
+ * a null termininated string. Therefore, set
+ * the temp variable to the length minus the minimum
+ * byte stream length plus the byte for the Index to
+ * determine the size of the NULL terminiated string.
+ */
+ if (13 < Temp16)
+ {
+ Temp8 = (UINT8) (Temp16 - 14);
+ }
+ else
+ {
+ Temp8 = 0;
+ }
+
+ /*
+ * Ensure a 32-bit boundary for the structure
+ */
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
+ (Temp8 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+ /*
+ * Extended IRQ
+ */
+ Buffer = ByteStreamBuffer;
+
+ ++Buffer;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ BytesConsumed = Temp16 + 3;
+
+ /*
+ * Point past the length field and the
+ * Interrupt vector flags to save off the
+ * Interrupt table length to the Temp8 variable.
+ */
+ Buffer += 3;
+ Temp8 = *Buffer;
+
+ /*
+ * To compensate for multiple interrupt numbers, add 4 bytes for
+ * each additional interrupts greater than 1
+ */
+ AdditionalBytes = (UINT8) ((Temp8 - 1) * 4);
+
+ /*
+ * Resource Source Index and Resource Source are
+ * optional elements. Check the length of the
+ * Bytestream. If it is greater than 9, that
+ * means that an Index exists and is followed by
+ * a null termininated string. Therefore, set
+ * the temp variable to the length minus the minimum
+ * byte stream length plus the byte for the Index to
+ * determine the size of the NULL terminiated string.
+ */
+ if (9 + AdditionalBytes < Temp16)
+ {
+ Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes));
+ }
+ else
+ {
+ Temp8 = 0;
+ }
+
+ /*
+ * Ensure a 32-bit boundary for the structure
+ */
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
+ (AdditionalBytes * sizeof (UINT8)) +
+ (Temp8 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
+ /*
+ * IRQ Resource.
+ * Determine if it there are two or three trailing bytes
+ */
+ Buffer = ByteStreamBuffer;
+ Temp8 = *Buffer;
+
+ if(Temp8 & 0x01)
+ {
+ BytesConsumed = 4;
+ }
+ else
+ {
+ BytesConsumed = 3;
+ }
+
+ /*
+ * Point past the descriptor
+ */
+ ++Buffer;
+
+ /*
+ * Look at the number of bits set
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ for (Index = 0; Index < 16; Index++)
+ {
+ if (Temp16 & 0x1)
+ {
+ ++NumberOfInterrupts;
+ }
+
+ Temp16 >>= 1;
+ }
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
+ (NumberOfInterrupts * sizeof (UINT32));
+ break;
+
+
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
+ /*
+ * DMA Resource
+ */
+ Buffer = ByteStreamBuffer;
+ BytesConsumed = 3;
+
+ /*
+ * Point past the descriptor
+ */
+ ++Buffer;
+
+ /*
+ * Look at the number of bits set
+ */
+ Temp8 = *Buffer;
+
+ for(Index = 0; Index < 8; Index++)
+ {
+ if(Temp8 & 0x1)
+ {
+ ++NumberOfChannels;
+ }
+
+ Temp8 >>= 1;
+ }
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
+ (NumberOfChannels * sizeof (UINT32));
+ break;
+
+
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
+ /*
+ * Start Dependent Functions Resource
+ * Determine if it there are two or three trailing bytes
+ */
+ Buffer = ByteStreamBuffer;
+ Temp8 = *Buffer;
+
+ if(Temp8 & 0x01)
+ {
+ BytesConsumed = 2;
+ }
+ else
+ {
+ BytesConsumed = 1;
+ }
+
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
+ /*
+ * End Dependent Functions Resource
+ */
+ BytesConsumed = 1;
+ StructureSize = ACPI_RESOURCE_LENGTH;
+ break;
+
+
+ case ACPI_RDESC_TYPE_IO_PORT:
+ /*
+ * IO Port Resource
+ */
+ BytesConsumed = 8;
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
+ /*
+ * Fixed IO Port Resource
+ */
+ BytesConsumed = 4;
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+ break;
+
+
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ /*
+ * Vendor Specific Resource
+ */
+ Buffer = ByteStreamBuffer;
+
+ Temp8 = *Buffer;
+ Temp8 = (UINT8) (Temp8 & 0x7);
+ BytesConsumed = Temp8 + 1;
+
+ /*
+ * Ensure a 32-bit boundary for the structure
+ */
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+ (Temp8 * sizeof (UINT8));
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_TAG:
+ /*
+ * End Tag
+ */
+ BytesConsumed = 2;
+ StructureSize = ACPI_RESOURCE_LENGTH;
+ ByteStreamBufferLength = BytesParsed;
+ break;
+
+
+ default:
+ /*
+ * If we get here, everything is out of sync,
+ * so exit with an error
+ */
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ /*
+ * Update the return value and counter
+ */
+ BufferSize += ACPI_ALIGN_RESOURCE_SIZE(StructureSize);
+ BytesParsed += BytesConsumed;
+
+ /*
+ * Set the byte stream to point to the next resource
+ */
+ ByteStreamBuffer += BytesConsumed;
+ }
+
+ /*
+ * This is the data the caller needs
+ */
+ *SizeNeeded = BufferSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetPciRoutingTableLength
+ *
+ * PARAMETERS: PackageObject - Pointer to the package object
+ * BufferSizeNeeded - UINT32 pointer of the size buffer
+ * needed to properly return the
+ * parsed data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Given a package representing a PCI routing table, this
+ * calculates the size of the corresponding linked list of
+ * descriptions.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetPciRoutingTableLength (
+ ACPI_OPERAND_OBJECT *PackageObject,
+ ACPI_SIZE *BufferSizeNeeded)
+{
+ UINT32 NumberOfElements;
+ ACPI_SIZE TempSizeNeeded = 0;
+ ACPI_OPERAND_OBJECT **TopObjectList;
+ UINT32 Index;
+ ACPI_OPERAND_OBJECT *PackageElement;
+ ACPI_OPERAND_OBJECT **SubObjectList;
+ BOOLEAN NameFound;
+ UINT32 TableIndex;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetPciRoutingTableLength");
+
+
+ NumberOfElements = PackageObject->Package.Count;
+
+ /*
+ * Calculate the size of the return buffer.
+ * The base size is the number of elements * the sizes of the
+ * structures. Additional space for the strings is added below.
+ * The minus one is to subtract the size of the UINT8 Source[1]
+ * member because it is added below.
+ *
+ * But each PRT_ENTRY structure has a pointer to a string and
+ * the size of that string must be found.
+ */
+ TopObjectList = PackageObject->Package.Elements;
+
+ for (Index = 0; Index < NumberOfElements; Index++)
+ {
+ /*
+ * Dereference the sub-package
+ */
+ PackageElement = *TopObjectList;
+
+ /*
+ * The SubObjectList will now point to an array of the
+ * four IRQ elements: Address, Pin, Source and SourceIndex
+ */
+ SubObjectList = PackageElement->Package.Elements;
+
+ /*
+ * Scan the IrqTableElements for the Source Name String
+ */
+ NameFound = FALSE;
+
+ for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++)
+ {
+ if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*SubObjectList)) ||
+ ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*SubObjectList)) &&
+ ((*SubObjectList)->Reference.Opcode == AML_INT_NAMEPATH_OP)))
+ {
+ NameFound = TRUE;
+ }
+ else
+ {
+ /*
+ * Look at the next element
+ */
+ SubObjectList++;
+ }
+ }
+
+ TempSizeNeeded += (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
+
+ /*
+ * Was a String type found?
+ */
+ if (NameFound)
+ {
+ if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING)
+ {
+ /*
+ * The length String.Length field does not include the
+ * terminating NULL, add 1
+ */
+ TempSizeNeeded += ((ACPI_SIZE) (*SubObjectList)->String.Length + 1);
+ }
+ else
+ {
+ TempSizeNeeded += AcpiNsGetPathnameLength (
+ (*SubObjectList)->Reference.Node);
+ }
+ }
+ else
+ {
+ /*
+ * If no name was found, then this is a NULL, which is
+ * translated as a UINT32 zero.
+ */
+ TempSizeNeeded += sizeof (UINT32);
+ }
+
+ /* Round up the size since each element must be aligned */
+
+ TempSizeNeeded = ACPI_ROUND_UP_TO_64BITS (TempSizeNeeded);
+
+ /*
+ * Point to the next ACPI_OPERAND_OBJECT
+ */
+ TopObjectList++;
+ }
+
+ /*
+ * Adding an extra element to the end of the list, essentially a NULL terminator
+ */
+ *BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE);
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c
new file mode 100644
index 0000000..83fee4f
--- /dev/null
+++ b/sys/contrib/dev/acpica/rscreate.c
@@ -0,0 +1,522 @@
+/*******************************************************************************
+ *
+ * Module Name: rscreate - Create resource lists/tables
+ * $Revision: 64 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __RSCREATE_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rscreate")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsCreateResourceList
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
+ * OutputBuffer - Pointer to the user's buffer
+ *
+ * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code
+ * If OutputBuffer is not large enough, OutputBufferLength
+ * indicates how large OutputBuffer should be, else it
+ * indicates how may UINT8 elements of OutputBuffer are valid.
+ *
+ * DESCRIPTION: Takes the byte stream returned from a _CRS, _PRS control method
+ * execution and parses the stream to create a linked list
+ * of device resources.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsCreateResourceList (
+ ACPI_OPERAND_OBJECT *ByteStreamBuffer,
+ ACPI_BUFFER *OutputBuffer)
+{
+
+ ACPI_STATUS Status;
+ UINT8 *ByteStreamStart;
+ ACPI_SIZE ListSizeNeeded = 0;
+ UINT32 ByteStreamBufferLength;
+
+
+ ACPI_FUNCTION_TRACE ("RsCreateResourceList");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n",
+ ByteStreamBuffer));
+
+ /*
+ * Params already validated, so we don't re-validate here
+ */
+ ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length;
+ ByteStreamStart = ByteStreamBuffer->Buffer.Pointer;
+
+ /*
+ * Pass the ByteStreamBuffer into a module that can calculate
+ * the buffer size needed for the linked list
+ */
+ Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength,
+ &ListSizeNeeded);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
+ Status, (UINT32) ListSizeNeeded));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Do the conversion */
+
+ Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength,
+ OutputBuffer->Pointer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsCreatePciRoutingTable
+ *
+ * PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT
+ * package
+ * OutputBuffer - Pointer to the user's buffer
+ *
+ * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
+ * If the OutputBuffer is too small, the error will be
+ * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
+ * to the size buffer needed.
+ *
+ * DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a
+ * linked list of PCI interrupt descriptions
+ *
+ * NOTE: It is the caller's responsibility to ensure that the start of the
+ * output buffer is aligned properly (if necessary).
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsCreatePciRoutingTable (
+ ACPI_OPERAND_OBJECT *PackageObject,
+ ACPI_BUFFER *OutputBuffer)
+{
+ UINT8 *Buffer;
+ ACPI_OPERAND_OBJECT **TopObjectList;
+ ACPI_OPERAND_OBJECT **SubObjectList;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_SIZE BufferSizeNeeded = 0;
+ UINT32 NumberOfElements;
+ UINT32 Index;
+ ACPI_PCI_ROUTING_TABLE *UserPrt;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_BUFFER PathBuffer;
+
+
+ ACPI_FUNCTION_TRACE ("RsCreatePciRoutingTable");
+
+
+ /* Params already validated, so we don't re-validate here */
+
+ /*
+ * Get the required buffer length
+ */
+ Status = AcpiRsGetPciRoutingTableLength (PackageObject,
+ &BufferSizeNeeded);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n",
+ (UINT32) BufferSizeNeeded));
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutputBuffer, BufferSizeNeeded);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Loop through the ACPI_INTERNAL_OBJECTS - Each object
+ * should be a package that in turn contains an
+ * ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex.
+ */
+ TopObjectList = PackageObject->Package.Elements;
+ NumberOfElements = PackageObject->Package.Count;
+ Buffer = OutputBuffer->Pointer;
+ UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
+
+ for (Index = 0; Index < NumberOfElements; Index++)
+ {
+ /*
+ * Point UserPrt past this current structure
+ *
+ * NOTE: On the first iteration, UserPrt->Length will
+ * be zero because we cleared the return buffer earlier
+ */
+ Buffer += UserPrt->Length;
+ UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
+
+ /*
+ * Fill in the Length field with the information we have at this point.
+ * The minus four is to subtract the size of the UINT8 Source[4] member
+ * because it is added below.
+ */
+ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
+
+ /*
+ * Each element of the top-level package must also be a package
+ */
+ if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X]) Need sub-package, found %s\n",
+ Index, AcpiUtGetObjectTypeName (*TopObjectList)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Each sub-package must be of length 4 */
+
+ if ((*TopObjectList)->Package.Count != 4)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X]) Need package of length 4, found length %d\n",
+ Index, (*TopObjectList)->Package.Count));
+ return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
+ }
+
+ /*
+ * Dereference the sub-package.
+ * The SubObjectList will now point to an array of the four IRQ
+ * elements: [Address, Pin, Source, SourceIndex]
+ */
+ SubObjectList = (*TopObjectList)->Package.Elements;
+
+ /*
+ * 1) First subobject: Dereference the PRT.Address
+ */
+ ObjDesc = SubObjectList[0];
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ UserPrt->Address = ObjDesc->Integer.Value;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X].Address) Need Integer, found %s\n",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ /*
+ * 2) Second subobject: Dereference the PRT.Pin
+ */
+ ObjDesc = SubObjectList[1];
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ UserPrt->Pin = (UINT32) ObjDesc->Integer.Value;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X].Pin) Need Integer, found %s\n",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ /*
+ * 3) Third subobject: Dereference the PRT.SourceName
+ */
+ ObjDesc = SubObjectList[2];
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X].Source) Need name, found reference op %X\n",
+ Index, ObjDesc->Reference.Opcode));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ Node = ObjDesc->Reference.Node;
+
+ /* Use *remaining* length of the buffer as max for pathname */
+
+ PathBuffer.Length = OutputBuffer->Length -
+ (UINT32) ((UINT8 *) UserPrt->Source -
+ (UINT8 *) OutputBuffer->Pointer);
+ PathBuffer.Pointer = UserPrt->Source;
+
+ Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+
+ UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
+
+ /* Add to the Length field the length of the string (add 1 for terminator) */
+
+ UserPrt->Length += ObjDesc->String.Length + 1;
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+ /*
+ * If this is a number, then the Source Name is NULL, since the
+ * entire buffer was zeroed out, we can leave this alone.
+ *
+ * Add to the Length field the length of the UINT32 NULL
+ */
+ UserPrt->Length += sizeof (UINT32);
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ /* Now align the current length */
+
+ UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length);
+
+ /*
+ * 4) Fourth subobject: Dereference the PRT.SourceIndex
+ */
+ ObjDesc = SubObjectList[3];
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "(PRT[%X].SourceIndex) Need Integer, found %s\n",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ /* Point to the next ACPI_OPERAND_OBJECT in the top level package */
+
+ TopObjectList++;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsCreateByteStream
+ *
+ * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's buffer
+ *
+ * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
+ * If the OutputBuffer is too small, the error will be
+ * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
+ * to the size buffer needed.
+ *
+ * DESCRIPTION: Takes the linked list of device resources and
+ * creates a bytestream to be used as input for the
+ * _SRS control method.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsCreateByteStream (
+ ACPI_RESOURCE *LinkedListBuffer,
+ ACPI_BUFFER *OutputBuffer)
+{
+ ACPI_STATUS Status;
+ ACPI_SIZE ByteStreamSizeNeeded = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsCreateByteStream");
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
+ LinkedListBuffer));
+
+ /*
+ * Params already validated, so we don't re-validate here
+ *
+ * Pass the LinkedListBuffer into a module that calculates
+ * the buffer size needed for the byte stream.
+ */
+ Status = AcpiRsGetByteStreamLength (LinkedListBuffer,
+ &ByteStreamSizeNeeded);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n",
+ (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status)));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Do the conversion */
+
+ Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded,
+ OutputBuffer->Pointer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c
new file mode 100644
index 0000000..23b9e49
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsdump.c
@@ -0,0 +1,1255 @@
+/*******************************************************************************
+ *
+ * Module Name: rsdump - Functions to display the resource structures.
+ * $Revision: 36 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __RSDUMP_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsdump")
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpIrq
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpIrq (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_IRQ *IrqData = (ACPI_RESOURCE_IRQ *) Data;
+ UINT8 Index = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("IRQ Resource\n");
+
+ AcpiOsPrintf (" %s Triggered\n",
+ ACPI_LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge");
+
+ AcpiOsPrintf (" Active %s\n",
+ ACPI_ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High");
+
+ AcpiOsPrintf (" %s\n",
+ ACPI_SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive");
+
+ AcpiOsPrintf (" %X Interrupts ( ", IrqData->NumberOfInterrupts);
+
+ for (Index = 0; Index < IrqData->NumberOfInterrupts; Index++)
+ {
+ AcpiOsPrintf ("%X ", IrqData->Interrupts[Index]);
+ }
+
+ AcpiOsPrintf (")\n");
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpDma
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpDma (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_DMA *DmaData = (ACPI_RESOURCE_DMA *) Data;
+ UINT8 Index = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("DMA Resource\n");
+
+ switch (DmaData->Type)
+ {
+ case ACPI_COMPATIBILITY:
+ AcpiOsPrintf (" Compatibility mode\n");
+ break;
+
+ case ACPI_TYPE_A:
+ AcpiOsPrintf (" Type A\n");
+ break;
+
+ case ACPI_TYPE_B:
+ AcpiOsPrintf (" Type B\n");
+ break;
+
+ case ACPI_TYPE_F:
+ AcpiOsPrintf (" Type F\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Invalid DMA type\n");
+ break;
+ }
+
+ AcpiOsPrintf (" %sBus Master\n",
+ ACPI_BUS_MASTER == DmaData->BusMaster ? "" : "Not a ");
+
+
+ switch (DmaData->Transfer)
+ {
+ case ACPI_TRANSFER_8:
+ AcpiOsPrintf (" 8-bit only transfer\n");
+ break;
+
+ case ACPI_TRANSFER_8_16:
+ AcpiOsPrintf (" 8 and 16-bit transfer\n");
+ break;
+
+ case ACPI_TRANSFER_16:
+ AcpiOsPrintf (" 16 bit only transfer\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Invalid transfer preference\n");
+ break;
+ }
+
+ AcpiOsPrintf (" Number of Channels: %X ( ", DmaData->NumberOfChannels);
+
+ for (Index = 0; Index < DmaData->NumberOfChannels; Index++)
+ {
+ AcpiOsPrintf ("%X ", DmaData->Channels[Index]);
+ }
+
+ AcpiOsPrintf (")\n");
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpStartDependFns
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpStartDependFns (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Start Dependent Functions Resource\n");
+
+ switch (SdfData->CompatibilityPriority)
+ {
+ case ACPI_GOOD_CONFIGURATION:
+ AcpiOsPrintf (" Good configuration\n");
+ break;
+
+ case ACPI_ACCEPTABLE_CONFIGURATION:
+ AcpiOsPrintf (" Acceptable configuration\n");
+ break;
+
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
+ AcpiOsPrintf (" Sub-optimal configuration\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Invalid compatibility priority\n");
+ break;
+ }
+
+ switch(SdfData->PerformanceRobustness)
+ {
+ case ACPI_GOOD_CONFIGURATION:
+ AcpiOsPrintf (" Good configuration\n");
+ break;
+
+ case ACPI_ACCEPTABLE_CONFIGURATION:
+ AcpiOsPrintf (" Acceptable configuration\n");
+ break;
+
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
+ AcpiOsPrintf (" Sub-optimal configuration\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Invalid performance "
+ "robustness preference\n");
+ break;
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpIo
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpIo (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_IO *IoData = (ACPI_RESOURCE_IO *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Io Resource\n");
+
+ AcpiOsPrintf (" %d bit decode\n",
+ ACPI_DECODE_16 == IoData->IoDecode ? 16 : 10);
+
+ AcpiOsPrintf (" Range minimum base: %08X\n",
+ IoData->MinBaseAddress);
+
+ AcpiOsPrintf (" Range maximum base: %08X\n",
+ IoData->MaxBaseAddress);
+
+ AcpiOsPrintf (" Alignment: %08X\n",
+ IoData->Alignment);
+
+ AcpiOsPrintf (" Range Length: %08X\n",
+ IoData->RangeLength);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpFixedIo
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpFixedIo (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_FIXED_IO *FixedIoData = (ACPI_RESOURCE_FIXED_IO *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Fixed Io Resource\n");
+ AcpiOsPrintf (" Range base address: %08X",
+ FixedIoData->BaseAddress);
+
+ AcpiOsPrintf (" Range length: %08X",
+ FixedIoData->RangeLength);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpVendorSpecific
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpVendorSpecific (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_VENDOR *VendorData = (ACPI_RESOURCE_VENDOR *) Data;
+ UINT16 Index = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Vendor Specific Resource\n");
+
+ AcpiOsPrintf (" Length: %08X\n", VendorData->Length);
+
+ for (Index = 0; Index < VendorData->Length; Index++)
+ {
+ AcpiOsPrintf (" Byte %X: %08X\n",
+ Index, VendorData->Reserved[Index]);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpMemory24
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpMemory24 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_MEM24 *Memory24Data = (ACPI_RESOURCE_MEM24 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("24-Bit Memory Range Resource\n");
+
+ AcpiOsPrintf (" Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ Memory24Data->ReadWriteAttribute ?
+ "/Write" : " only");
+
+ AcpiOsPrintf (" Range minimum base: %08X\n",
+ Memory24Data->MinBaseAddress);
+
+ AcpiOsPrintf (" Range maximum base: %08X\n",
+ Memory24Data->MaxBaseAddress);
+
+ AcpiOsPrintf (" Alignment: %08X\n",
+ Memory24Data->Alignment);
+
+ AcpiOsPrintf (" Range length: %08X\n",
+ Memory24Data->RangeLength);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpMemory32
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpMemory32 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_MEM32 *Memory32Data = (ACPI_RESOURCE_MEM32 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("32-Bit Memory Range Resource\n");
+
+ AcpiOsPrintf (" Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ Memory32Data->ReadWriteAttribute ?
+ "/Write" : " only");
+
+ AcpiOsPrintf (" Range minimum base: %08X\n",
+ Memory32Data->MinBaseAddress);
+
+ AcpiOsPrintf (" Range maximum base: %08X\n",
+ Memory32Data->MaxBaseAddress);
+
+ AcpiOsPrintf (" Alignment: %08X\n",
+ Memory32Data->Alignment);
+
+ AcpiOsPrintf (" Range length: %08X\n",
+ Memory32Data->RangeLength);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpFixedMemory32
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpFixedMemory32 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_FIXED_MEM32 *FixedMemory32Data = (ACPI_RESOURCE_FIXED_MEM32 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("32-Bit Fixed Location Memory Range Resource\n");
+
+ AcpiOsPrintf (" Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ FixedMemory32Data->ReadWriteAttribute ?
+ "/Write" : " Only");
+
+ AcpiOsPrintf (" Range base address: %08X\n",
+ FixedMemory32Data->RangeBaseAddress);
+
+ AcpiOsPrintf (" Range length: %08X\n",
+ FixedMemory32Data->RangeLength);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpAddress16
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpAddress16 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_ADDRESS16 *Address16Data = (ACPI_RESOURCE_ADDRESS16 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("16-Bit Address Space Resource\n");
+ AcpiOsPrintf (" Resource Type: ");
+
+ switch (Address16Data->ResourceType)
+ {
+ case ACPI_MEMORY_RANGE:
+
+ AcpiOsPrintf ("Memory Range\n");
+
+ switch (Address16Data->Attribute.Memory.CacheAttribute)
+ {
+ case ACPI_NON_CACHEABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Noncacheable memory\n");
+ break;
+
+ case ACPI_CACHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Cacheable memory\n");
+ break;
+
+ case ACPI_WRITE_COMBINING_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Write-combining memory\n");
+ break;
+
+ case ACPI_PREFETCHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Prefetchable memory\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid cache attribute\n");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ Address16Data->Attribute.Memory.ReadWriteAttribute ?
+ "/Write" : " Only");
+ break;
+
+ case ACPI_IO_RANGE:
+
+ AcpiOsPrintf ("I/O Range\n");
+
+ switch (Address16Data->Attribute.Io.RangeAttribute)
+ {
+ case ACPI_NON_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "Non-ISA Io Addresses\n");
+ break;
+
+ case ACPI_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA Io Addresses\n");
+ break;
+
+ case ACPI_ENTIRE_RANGE:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA and non-ISA Io Addresses\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid range attribute\n");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: %s Translation\n",
+ ACPI_SPARSE_TRANSLATION ==
+ Address16Data->Attribute.Io.TranslationAttribute ?
+ "Sparse" : "Dense");
+ break;
+
+ case ACPI_BUS_NUMBER_RANGE:
+
+ AcpiOsPrintf ("Bus Number Range\n");
+ break;
+
+ default:
+
+ AcpiOsPrintf ("Invalid resource type. Exiting.\n");
+ return;
+ }
+
+ AcpiOsPrintf (" Resource %s\n",
+ ACPI_CONSUMER == Address16Data->ProducerConsumer ?
+ "Consumer" : "Producer");
+
+ AcpiOsPrintf (" %s decode\n",
+ ACPI_SUB_DECODE == Address16Data->Decode ?
+ "Subtractive" : "Positive");
+
+ AcpiOsPrintf (" Min address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address16Data->MinAddressFixed ?
+ "" : "not");
+
+ AcpiOsPrintf (" Max address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address16Data->MaxAddressFixed ?
+ "" : "not");
+
+ AcpiOsPrintf (" Granularity: %08X\n",
+ Address16Data->Granularity);
+
+ AcpiOsPrintf (" Address range min: %08X\n",
+ Address16Data->MinAddressRange);
+
+ AcpiOsPrintf (" Address range max: %08X\n",
+ Address16Data->MaxAddressRange);
+
+ AcpiOsPrintf (" Address translation offset: %08X\n",
+ Address16Data->AddressTranslationOffset);
+
+ AcpiOsPrintf (" Address Length: %08X\n",
+ Address16Data->AddressLength);
+
+ if (0xFF != Address16Data->ResourceSource.Index)
+ {
+ AcpiOsPrintf (" Resource Source Index: %X\n",
+ Address16Data->ResourceSource.Index);
+ AcpiOsPrintf (" Resource Source: %s\n",
+ Address16Data->ResourceSource.StringPtr);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpAddress32
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpAddress32 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_ADDRESS32 *Address32Data = (ACPI_RESOURCE_ADDRESS32 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("32-Bit Address Space Resource\n");
+
+ switch (Address32Data->ResourceType)
+ {
+ case ACPI_MEMORY_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Memory Range\n");
+
+ switch (Address32Data->Attribute.Memory.CacheAttribute)
+ {
+ case ACPI_NON_CACHEABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Noncacheable memory\n");
+ break;
+
+ case ACPI_CACHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Cacheable memory\n");
+ break;
+
+ case ACPI_WRITE_COMBINING_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Write-combining memory\n");
+ break;
+
+ case ACPI_PREFETCHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Prefetchable memory\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid cache attribute\n");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ Address32Data->Attribute.Memory.ReadWriteAttribute ?
+ "/Write" : " Only");
+ break;
+
+ case ACPI_IO_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Io Range\n");
+
+ switch (Address32Data->Attribute.Io.RangeAttribute)
+ {
+ case ACPI_NON_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "Non-ISA Io Addresses\n");
+ break;
+
+ case ACPI_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA Io Addresses\n");
+ break;
+
+ case ACPI_ENTIRE_RANGE:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA and non-ISA Io Addresses\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid Range attribute");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: %s Translation\n",
+ ACPI_SPARSE_TRANSLATION ==
+ Address32Data->Attribute.Io.TranslationAttribute ?
+ "Sparse" : "Dense");
+ break;
+
+ case ACPI_BUS_NUMBER_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Bus Number Range\n");
+ break;
+
+ default:
+
+ AcpiOsPrintf (" Invalid Resource Type..exiting.\n");
+ return;
+ }
+
+ AcpiOsPrintf (" Resource %s\n",
+ ACPI_CONSUMER == Address32Data->ProducerConsumer ?
+ "Consumer" : "Producer");
+
+ AcpiOsPrintf (" %s decode\n",
+ ACPI_SUB_DECODE == Address32Data->Decode ?
+ "Subtractive" : "Positive");
+
+ AcpiOsPrintf (" Min address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address32Data->MinAddressFixed ?
+ "" : "not ");
+
+ AcpiOsPrintf (" Max address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address32Data->MaxAddressFixed ?
+ "" : "not ");
+
+ AcpiOsPrintf (" Granularity: %08X\n",
+ Address32Data->Granularity);
+
+ AcpiOsPrintf (" Address range min: %08X\n",
+ Address32Data->MinAddressRange);
+
+ AcpiOsPrintf (" Address range max: %08X\n",
+ Address32Data->MaxAddressRange);
+
+ AcpiOsPrintf (" Address translation offset: %08X\n",
+ Address32Data->AddressTranslationOffset);
+
+ AcpiOsPrintf (" Address Length: %08X\n",
+ Address32Data->AddressLength);
+
+ if(0xFF != Address32Data->ResourceSource.Index)
+ {
+ AcpiOsPrintf (" Resource Source Index: %X\n",
+ Address32Data->ResourceSource.Index);
+ AcpiOsPrintf (" Resource Source: %s\n",
+ Address32Data->ResourceSource.StringPtr);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpAddress64
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpAddress64 (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_ADDRESS64 *Address64Data = (ACPI_RESOURCE_ADDRESS64 *) Data;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("64-Bit Address Space Resource\n");
+
+ switch (Address64Data->ResourceType)
+ {
+ case ACPI_MEMORY_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Memory Range\n");
+
+ switch (Address64Data->Attribute.Memory.CacheAttribute)
+ {
+ case ACPI_NON_CACHEABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Noncacheable memory\n");
+ break;
+
+ case ACPI_CACHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Cacheable memory\n");
+ break;
+
+ case ACPI_WRITE_COMBINING_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Write-combining memory\n");
+ break;
+
+ case ACPI_PREFETCHABLE_MEMORY:
+ AcpiOsPrintf (" Type Specific: "
+ "Prefetchable memory\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid cache attribute\n");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: Read%s\n",
+ ACPI_READ_WRITE_MEMORY ==
+ Address64Data->Attribute.Memory.ReadWriteAttribute ?
+ "/Write" : " Only");
+ break;
+
+ case ACPI_IO_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Io Range\n");
+
+ switch (Address64Data->Attribute.Io.RangeAttribute)
+ {
+ case ACPI_NON_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "Non-ISA Io Addresses\n");
+ break;
+
+ case ACPI_ISA_ONLY_RANGES:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA Io Addresses\n");
+ break;
+
+ case ACPI_ENTIRE_RANGE:
+ AcpiOsPrintf (" Type Specific: "
+ "ISA and non-ISA Io Addresses\n");
+ break;
+
+ default:
+ AcpiOsPrintf (" Type Specific: "
+ "Invalid Range attribute");
+ break;
+ }
+
+ AcpiOsPrintf (" Type Specific: %s Translation\n",
+ ACPI_SPARSE_TRANSLATION ==
+ Address64Data->Attribute.Io.TranslationAttribute ?
+ "Sparse" : "Dense");
+ break;
+
+ case ACPI_BUS_NUMBER_RANGE:
+
+ AcpiOsPrintf (" Resource Type: Bus Number Range\n");
+ break;
+
+ default:
+
+ AcpiOsPrintf (" Invalid Resource Type..exiting.\n");
+ return;
+ }
+
+ AcpiOsPrintf (" Resource %s\n",
+ ACPI_CONSUMER == Address64Data->ProducerConsumer ?
+ "Consumer" : "Producer");
+
+ AcpiOsPrintf (" %s decode\n",
+ ACPI_SUB_DECODE == Address64Data->Decode ?
+ "Subtractive" : "Positive");
+
+ AcpiOsPrintf (" Min address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address64Data->MinAddressFixed ?
+ "" : "not ");
+
+ AcpiOsPrintf (" Max address is %s fixed\n",
+ ACPI_ADDRESS_FIXED == Address64Data->MaxAddressFixed ?
+ "" : "not ");
+
+ AcpiOsPrintf (" Granularity: %8.8X%8.8X\n",
+ ACPI_HIDWORD (Address64Data->Granularity),
+ ACPI_LODWORD (Address64Data->Granularity));
+
+ AcpiOsPrintf (" Address range min: %8.8X%8.8X\n",
+ ACPI_HIDWORD (Address64Data->MinAddressRange),
+ ACPI_HIDWORD (Address64Data->MinAddressRange));
+
+ AcpiOsPrintf (" Address range max: %8.8X%8.8X\n",
+ ACPI_HIDWORD (Address64Data->MaxAddressRange),
+ ACPI_HIDWORD (Address64Data->MaxAddressRange));
+
+ AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n",
+ ACPI_HIDWORD (Address64Data->AddressTranslationOffset),
+ ACPI_HIDWORD (Address64Data->AddressTranslationOffset));
+
+ AcpiOsPrintf (" Address Length: %8.8X%8.8X\n",
+ ACPI_HIDWORD (Address64Data->AddressLength),
+ ACPI_HIDWORD (Address64Data->AddressLength));
+
+ if(0xFF != Address64Data->ResourceSource.Index)
+ {
+ AcpiOsPrintf (" Resource Source Index: %X\n",
+ Address64Data->ResourceSource.Index);
+ AcpiOsPrintf (" Resource Source: %s\n",
+ Address64Data->ResourceSource.StringPtr);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpExtendedIrq
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpExtendedIrq (
+ ACPI_RESOURCE_DATA *Data)
+{
+ ACPI_RESOURCE_EXT_IRQ *ExtIrqData = (ACPI_RESOURCE_EXT_IRQ *) Data;
+ UINT8 Index = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ AcpiOsPrintf ("Extended IRQ Resource\n");
+
+ AcpiOsPrintf (" Resource %s\n",
+ ACPI_CONSUMER == ExtIrqData->ProducerConsumer ?
+ "Consumer" : "Producer");
+
+ AcpiOsPrintf (" %s\n",
+ ACPI_LEVEL_SENSITIVE == ExtIrqData->EdgeLevel ?
+ "Level" : "Edge");
+
+ AcpiOsPrintf (" Active %s\n",
+ ACPI_ACTIVE_LOW == ExtIrqData->ActiveHighLow ?
+ "low" : "high");
+
+ AcpiOsPrintf (" %s\n",
+ ACPI_SHARED == ExtIrqData->SharedExclusive ?
+ "Shared" : "Exclusive");
+
+ AcpiOsPrintf (" Interrupts : %X ( ",
+ ExtIrqData->NumberOfInterrupts);
+
+ for (Index = 0; Index < ExtIrqData->NumberOfInterrupts; Index++)
+ {
+ AcpiOsPrintf ("%X ", ExtIrqData->Interrupts[Index]);
+ }
+
+ AcpiOsPrintf (")\n");
+
+ if(0xFF != ExtIrqData->ResourceSource.Index)
+ {
+ AcpiOsPrintf (" Resource Source Index: %X",
+ ExtIrqData->ResourceSource.Index);
+ AcpiOsPrintf (" Resource Source: %s",
+ ExtIrqData->ResourceSource.StringPtr);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpResourceList
+ *
+ * PARAMETERS: Data - pointer to the resource structure to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dispatches the structure to the correct dump routine.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpResourceList (
+ ACPI_RESOURCE *Resource)
+{
+ UINT8 Count = 0;
+ BOOLEAN Done = FALSE;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
+ {
+ while (!Done)
+ {
+ AcpiOsPrintf ("Resource structure %X.\n", Count++);
+
+ switch (Resource->Id)
+ {
+ case ACPI_RSTYPE_IRQ:
+ AcpiRsDumpIrq (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_DMA:
+ AcpiRsDumpDma (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_START_DPF:
+ AcpiRsDumpStartDependFns (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_END_DPF:
+ AcpiOsPrintf ("EndDependentFunctions Resource\n");
+ /* AcpiRsDumpEndDependentFunctions (Resource->Data);*/
+ break;
+
+ case ACPI_RSTYPE_IO:
+ AcpiRsDumpIo (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_FIXED_IO:
+ AcpiRsDumpFixedIo (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_VENDOR:
+ AcpiRsDumpVendorSpecific (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_END_TAG:
+ /*RsDumpEndTag (Resource->Data);*/
+ AcpiOsPrintf ("EndTag Resource\n");
+ Done = TRUE;
+ break;
+
+ case ACPI_RSTYPE_MEM24:
+ AcpiRsDumpMemory24 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_MEM32:
+ AcpiRsDumpMemory32 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_FIXED_MEM32:
+ AcpiRsDumpFixedMemory32 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS16:
+ AcpiRsDumpAddress16 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS32:
+ AcpiRsDumpAddress32 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS64:
+ AcpiRsDumpAddress64 (&Resource->Data);
+ break;
+
+ case ACPI_RSTYPE_EXT_IRQ:
+ AcpiRsDumpExtendedIrq (&Resource->Data);
+ break;
+
+ default:
+ AcpiOsPrintf ("Invalid resource type\n");
+ break;
+
+ }
+
+ Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length);
+ }
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDumpIrqList
+ *
+ * PARAMETERS: Data - pointer to the routing table to dump.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dispatches the structures to the correct dump routine.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsDumpIrqList (
+ UINT8 *RouteTable)
+{
+ UINT8 *Buffer = RouteTable;
+ UINT8 Count = 0;
+ BOOLEAN Done = FALSE;
+ ACPI_PCI_ROUTING_TABLE *PrtElement;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
+ {
+ PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
+
+ while (!Done)
+ {
+ AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++);
+
+ AcpiOsPrintf (" Address: %8.8X%8.8X\n",
+ ACPI_HIDWORD (PrtElement->Address),
+ ACPI_LODWORD (PrtElement->Address));
+
+ AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin);
+
+ AcpiOsPrintf (" Source: %s\n", PrtElement->Source);
+
+ AcpiOsPrintf (" SourceIndex: %X\n",
+ PrtElement->SourceIndex);
+
+ Buffer += PrtElement->Length;
+
+ PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
+
+ if(0 == PrtElement->Length)
+ {
+ Done = TRUE;
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c
new file mode 100644
index 0000000..d321909
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsio.c
@@ -0,0 +1,624 @@
+/*******************************************************************************
+ *
+ * Module Name: rsio - IO and DMA resource descriptors
+ * $Revision: 24 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSIO_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsio")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsIoResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsIoResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+
+
+ ACPI_FUNCTION_TRACE ("RsIoResource");
+
+
+ /*
+ * The number of bytes consumed are Constant
+ */
+ *BytesConsumed = 8;
+
+ OutputStruct->Id = ACPI_RSTYPE_IO;
+
+ /*
+ * Check Decode
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ OutputStruct->Data.Io.IoDecode = Temp8 & 0x01;
+
+ /*
+ * Check MinBase Address
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ OutputStruct->Data.Io.MinBaseAddress = Temp16;
+
+ /*
+ * Check MaxBase Address
+ */
+ Buffer += 2;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ OutputStruct->Data.Io.MaxBaseAddress = Temp16;
+
+ /*
+ * Check Base alignment
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ OutputStruct->Data.Io.Alignment = Temp8;
+
+ /*
+ * Check RangeLength
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ OutputStruct->Data.Io.RangeLength = Temp8;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsFixedIoResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsFixedIoResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+
+
+ ACPI_FUNCTION_TRACE ("RsFixedIoResource");
+
+
+ /*
+ * The number of bytes consumed are Constant
+ */
+ *BytesConsumed = 4;
+
+ OutputStruct->Id = ACPI_RSTYPE_FIXED_IO;
+
+ /*
+ * Check Range Base Address
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ OutputStruct->Data.FixedIo.BaseAddress = Temp16;
+
+ /*
+ * Check RangeLength
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ OutputStruct->Data.FixedIo.RangeLength = Temp8;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsIoStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsIoStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsIoStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x47;
+ Buffer += 1;
+
+ /*
+ * Io Information Byte
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Io.IoDecode & 0x01);
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the Range minimum base address
+ */
+ Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the Range maximum base address
+ */
+ Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the base alignment
+ */
+ Temp8 = (UINT8) LinkedList->Data.Io.Alignment;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the range length
+ */
+ Temp8 = (UINT8) LinkedList->Data.Io.RangeLength;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsFixedIoStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsFixedIoStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsFixedIoStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x4B;
+
+ Buffer += 1;
+
+ /*
+ * Set the Range base address
+ */
+ Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the range length
+ */
+ Temp8 = (UINT8) LinkedList->Data.FixedIo.RangeLength;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDmaResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsDmaResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+ UINT8 i;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
+
+
+ ACPI_FUNCTION_TRACE ("RsDmaResource");
+
+
+ /*
+ * The number of bytes consumed are Constant
+ */
+ *BytesConsumed = 3;
+ OutputStruct->Id = ACPI_RSTYPE_DMA;
+
+ /*
+ * Point to the 8-bits of Byte 1
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /* Decode the DMA channel bits */
+
+ for (i = 0, Index = 0; Index < 8; Index++)
+ {
+ if ((Temp8 >> Index) & 0x01)
+ {
+ OutputStruct->Data.Dma.Channels[i] = Index;
+ i++;
+ }
+ }
+
+ /* Zero DMA channels is valid */
+
+ OutputStruct->Data.Dma.NumberOfChannels = i;
+ if (i > 0)
+ {
+ /*
+ * Calculate the structure size based upon the number of interrupts
+ */
+ StructSize += ((ACPI_SIZE) i - 1) * 4;
+ }
+
+ /*
+ * Point to Byte 2
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /*
+ * Check for transfer preference (Bits[1:0])
+ */
+ OutputStruct->Data.Dma.Transfer = Temp8 & 0x03;
+
+ if (0x03 == OutputStruct->Data.Dma.Transfer)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n"));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+
+ /*
+ * Get bus master preference (Bit[2])
+ */
+ OutputStruct->Data.Dma.BusMaster = (Temp8 >> 2) & 0x01;
+
+ /*
+ * Get channel speed support (Bits[6:5])
+ */
+ OutputStruct->Data.Dma.Type = (Temp8 >> 5) & 0x03;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsDmaStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsDmaStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+
+
+ ACPI_FUNCTION_TRACE ("RsDmaStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x2A;
+ Buffer += 1;
+ Temp8 = 0;
+
+ /*
+ * Loop through all of the Channels and set the mask bits
+ */
+ for (Index = 0;
+ Index < LinkedList->Data.Dma.NumberOfChannels;
+ Index++)
+ {
+ Temp16 = (UINT16) LinkedList->Data.Dma.Channels[Index];
+ Temp8 |= 0x1 << Temp16;
+ }
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the DMA Info
+ */
+ Temp8 = (UINT8) ((LinkedList->Data.Dma.Type & 0x03) << 5);
+ Temp8 |= ((LinkedList->Data.Dma.BusMaster & 0x01) << 2);
+ Temp8 |= (LinkedList->Data.Dma.Transfer & 0x03);
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c
new file mode 100644
index 0000000..e0e1c38
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsirq.c
@@ -0,0 +1,682 @@
+/*******************************************************************************
+ *
+ * Module Name: rsirq - IRQ resource descriptors
+ * $Revision: 34 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSIRQ_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsirq")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsIrqResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsIrqResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+ UINT8 i;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
+
+
+ ACPI_FUNCTION_TRACE ("RsIrqResource");
+
+
+ /*
+ * The number of bytes consumed are contained in the descriptor
+ * (Bits:0-1)
+ */
+ Temp8 = *Buffer;
+ *BytesConsumed = (Temp8 & 0x03) + 1;
+ OutputStruct->Id = ACPI_RSTYPE_IRQ;
+
+ /*
+ * Point to the 16-bits of Bytes 1 and 2
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ OutputStruct->Data.Irq.NumberOfInterrupts = 0;
+
+ /* Decode the IRQ bits */
+
+ for (i = 0, Index = 0; Index < 16; Index++)
+ {
+ if ((Temp16 >> Index) & 0x01)
+ {
+ OutputStruct->Data.Irq.Interrupts[i] = Index;
+ i++;
+ }
+ }
+
+ /* Zero interrupts is valid */
+
+ OutputStruct->Data.Irq.NumberOfInterrupts = i;
+ if (i > 0)
+ {
+ /*
+ * Calculate the structure size based upon the number of interrupts
+ */
+ StructSize += ((ACPI_SIZE) i - 1) * 4;
+ }
+
+ /*
+ * Point to Byte 3 if it is used
+ */
+ if (4 == *BytesConsumed)
+ {
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ /*
+ * Check for HE, LL or HL
+ */
+ if (Temp8 & 0x01)
+ {
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
+ }
+ else
+ {
+ if (Temp8 & 0x8)
+ {
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW;
+ }
+ else
+ {
+ /*
+ * Only _LL and _HE polarity/trigger interrupts
+ * are allowed (ACPI spec v1.0b ection 6.4.2.1),
+ * so an error will occur if we reach this point
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n"));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+ }
+
+ /*
+ * Check for sharable
+ */
+ OutputStruct->Data.Irq.SharedExclusive = (Temp8 >> 3) & 0x01;
+ }
+ else
+ {
+ /*
+ * Assume Edge Sensitive, Active High, Non-Sharable
+ * per ACPI Specification
+ */
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
+ OutputStruct->Data.Irq.SharedExclusive = ACPI_EXCLUSIVE;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsIrqStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsIrqStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+ BOOLEAN IRQInfoByteNeeded;
+
+
+ ACPI_FUNCTION_TRACE ("RsIrqStream");
+
+
+ /*
+ * The descriptor field is set based upon whether a third byte is
+ * needed to contain the IRQ Information.
+ */
+ if (ACPI_EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
+ ACPI_ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow &&
+ ACPI_EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive)
+ {
+ *Buffer = 0x22;
+ IRQInfoByteNeeded = FALSE;
+ }
+ else
+ {
+ *Buffer = 0x23;
+ IRQInfoByteNeeded = TRUE;
+ }
+
+ Buffer += 1;
+ Temp16 = 0;
+
+ /*
+ * Loop through all of the interrupts and set the mask bits
+ */
+ for(Index = 0;
+ Index < LinkedList->Data.Irq.NumberOfInterrupts;
+ Index++)
+ {
+ Temp8 = (UINT8) LinkedList->Data.Irq.Interrupts[Index];
+ Temp16 |= 0x1 << Temp8;
+ }
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the IRQ Info byte if needed.
+ */
+ if (IRQInfoByteNeeded)
+ {
+ Temp8 = 0;
+ Temp8 = (UINT8) ((LinkedList->Data.Irq.SharedExclusive &
+ 0x01) << 4);
+
+ if (ACPI_LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
+ ACPI_ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow)
+ {
+ Temp8 |= 0x08;
+ }
+ else
+ {
+ Temp8 |= 0x01;
+ }
+
+ *Buffer = Temp8;
+ Buffer += 1;
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsExtendedIrqResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsExtendedIrqResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 *TempPtr;
+ UINT8 Index;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
+
+
+ ACPI_FUNCTION_TRACE ("RsExtendedIrqResource");
+
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ /* Check for the minimum length. */
+ if (Temp16 < 6)
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ *BytesConsumed = Temp16 + 3;
+
+ OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ;
+
+ /*
+ * Point to the Byte3
+ */
+ Buffer += 2;
+ Temp8 = *Buffer;
+
+ OutputStruct->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01;
+
+ /*
+ * Check for Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both).
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
+ */
+ OutputStruct->Data.ExtendedIrq.EdgeLevel =
+ (Temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
+
+ /*
+ * Check Interrupt Polarity
+ */
+ OutputStruct->Data.ExtendedIrq.ActiveHighLow = (Temp8 >> 2) & 0x1;
+
+ /*
+ * Check for sharable
+ */
+ OutputStruct->Data.ExtendedIrq.SharedExclusive = (Temp8 >> 3) & 0x01;
+
+ /*
+ * Point to Byte4 (IRQ Table length)
+ */
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /* Minimum number of IRQs is one. */
+ if (Temp8 < 1) {
+ *BytesConsumed = 0;
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ OutputStruct->Data.ExtendedIrq.NumberOfInterrupts = Temp8;
+
+ /*
+ * Add any additional structure size to properly calculate
+ * the next pointer at the end of this function
+ */
+ StructSize += (Temp8 - 1) * 4;
+
+ /*
+ * Point to Byte5 (First IRQ Number)
+ */
+ Buffer += 1;
+
+ /*
+ * Cycle through every IRQ in the table
+ */
+ for (Index = 0; Index < Temp8; Index++)
+ {
+ ACPI_MOVE_32_TO_32 (
+ &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer);
+
+ /* Point to the next IRQ */
+
+ Buffer += 4;
+ }
+
+ /*
+ * This will leave us pointing to the Resource Source Index
+ * If it is present, then save it off and calculate the
+ * pointer to where the null terminated string goes:
+ * Each Interrupt takes 32-bits + the 5 bytes of the
+ * stream that are default.
+ */
+ if (*BytesConsumed >
+ ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4)
+ + 5 + 1)
+ {
+ /* Dereference the Index */
+
+ Temp8 = *Buffer;
+ OutputStruct->Data.ExtendedIrq.ResourceSource.Index = (UINT32) Temp8;
+
+ /* Point to the String */
+
+ Buffer += 1;
+
+ /*
+ * Point the String pointer to the end of this structure.
+ */
+ OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr =
+ (char *)(OutputStruct + StructSize);
+
+ TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr;
+
+ /* Copy the string into the buffer */
+
+ Index = 0;
+ while (0x00 != *Buffer)
+ {
+ *TempPtr = *Buffer;
+
+ TempPtr += 1;
+ Buffer += 1;
+ Index += 1;
+ }
+
+ /*
+ * Add the terminating null
+ */
+ *TempPtr = 0x00;
+ OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = Index + 1;
+
+ /*
+ * In order for the StructSize to fall on a 32-bit boundary,
+ * calculate the length of the string and expand the
+ * StructSize to the next 32-bit boundary.
+ */
+ Temp8 = (UINT8) (Index + 1);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
+ }
+ else
+ {
+ OutputStruct->Data.ExtendedIrq.ResourceSource.Index = 0x00;
+ OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = 0;
+ OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = NULL;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsExtendedIrqStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsExtendedIrqStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 *LengthField;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+ char *TempPointer = NULL;
+
+
+ ACPI_FUNCTION_TRACE ("RsExtendedIrqStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x89;
+ Buffer += 1;
+
+ /*
+ * Set a pointer to the Length field - to be filled in later
+ */
+ LengthField = ACPI_CAST_PTR (UINT16, Buffer);
+ Buffer += 2;
+
+ /*
+ * Set the Interrupt vector flags
+ */
+ Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01);
+ Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3);
+
+ /*
+ * Set the Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not
+ * implement the more restrictive definition of 1.0b
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
+ */
+ if (ACPI_EDGE_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel)
+ {
+ Temp8 |= 0x2;
+ }
+
+ /*
+ * Set the Interrupt Polarity
+ */
+ Temp8 |= ((LinkedList->Data.ExtendedIrq.ActiveHighLow & 0x1) << 2);
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the Interrupt table length
+ */
+ Temp8 = (UINT8) LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
+ Index++)
+ {
+ ACPI_MOVE_32_TO_32 (Buffer,
+ &LinkedList->Data.ExtendedIrq.Interrupts[Index]);
+ Buffer += 4;
+ }
+
+ /*
+ * Resource Source Index and Resource Source are optional
+ */
+ if (0 != LinkedList->Data.ExtendedIrq.ResourceSource.StringLength)
+ {
+ *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSource.Index;
+ Buffer += 1;
+
+ TempPointer = (char *) Buffer;
+
+ /*
+ * Copy the string
+ */
+ ACPI_STRCPY (TempPointer,
+ LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr);
+
+ /*
+ * Buffer needs to be set to the length of the sting + one for the
+ * terminating null
+ */
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+
+ /*
+ * Set the length field to the number of bytes consumed
+ * minus the header size (3 bytes)
+ */
+ *LengthField = (UINT16) (*BytesConsumed - 3);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c
new file mode 100644
index 0000000..fd802c0
--- /dev/null
+++ b/sys/contrib/dev/acpica/rslist.c
@@ -0,0 +1,599 @@
+/*******************************************************************************
+ *
+ * Module Name: rslist - Linked list utilities
+ * $Revision: 32 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSLIST_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rslist")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetResourceType
+ *
+ * PARAMETERS: ResourceStartByte - Byte 0 of a resource descriptor
+ *
+ * RETURN: The Resource Type (Name) with no extraneous bits
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiRsGetResourceType (
+ UINT8 ResourceStartByte)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Determine if this is a small or large resource
+ */
+ switch (ResourceStartByte & ACPI_RDESC_TYPE_MASK)
+ {
+ case ACPI_RDESC_TYPE_SMALL:
+
+ /*
+ * Small Resource Type -- Only bits 6:3 are valid
+ */
+ return ((UINT8) (ResourceStartByte & ACPI_RDESC_SMALL_MASK));
+
+
+ case ACPI_RDESC_TYPE_LARGE:
+
+ /*
+ * Large Resource Type -- All bits are valid
+ */
+ return (ResourceStartByte);
+
+
+ default:
+ /* No other types of resource descriptor */
+ break;
+ }
+
+ return (0xFF);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsByteStreamToList
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
+ * ByteStreamBufferLength - Length of ByteStreamBuffer
+ * OutputBuffer - Pointer to the buffer that will
+ * contain the output structures
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes the resource byte stream and parses it, creating a
+ * linked list of resources in the caller's output buffer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsByteStreamToList (
+ UINT8 *ByteStreamBuffer,
+ UINT32 ByteStreamBufferLength,
+ UINT8 *OutputBuffer)
+{
+ ACPI_STATUS Status;
+ ACPI_SIZE BytesParsed = 0;
+ UINT8 ResourceType = 0;
+ ACPI_SIZE BytesConsumed = 0;
+ UINT8 *Buffer = OutputBuffer;
+ ACPI_SIZE StructureSize = 0;
+ BOOLEAN EndTagProcessed = FALSE;
+ ACPI_RESOURCE *Resource;
+
+ ACPI_FUNCTION_TRACE ("RsByteStreamToList");
+
+
+ while (BytesParsed < ByteStreamBufferLength &&
+ !EndTagProcessed)
+ {
+ /*
+ * The next byte in the stream is the resource type
+ */
+ ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer);
+
+ switch (ResourceType)
+ {
+ case ACPI_RDESC_TYPE_MEMORY_24:
+ /*
+ * 24-Bit Memory Resource
+ */
+ Status = AcpiRsMemory24Resource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
+ /*
+ * Vendor Defined Resource
+ */
+ Status = AcpiRsVendorResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_MEMORY_32:
+ /*
+ * 32-Bit Memory Range Resource
+ */
+ Status = AcpiRsMemory32RangeResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
+ /*
+ * 32-Bit Fixed Memory Resource
+ */
+ Status = AcpiRsFixedMemory32Resource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ /*
+ * 64-Bit Address Resource
+ */
+ Status = AcpiRsAddress64Resource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ /*
+ * 32-Bit Address Resource
+ */
+ Status = AcpiRsAddress32Resource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ /*
+ * 16-Bit Address Resource
+ */
+ Status = AcpiRsAddress16Resource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+ /*
+ * Extended IRQ
+ */
+ Status = AcpiRsExtendedIrqResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
+ /*
+ * IRQ Resource
+ */
+ Status = AcpiRsIrqResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
+ /*
+ * DMA Resource
+ */
+ Status = AcpiRsDmaResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
+ /*
+ * Start Dependent Functions Resource
+ */
+ Status = AcpiRsStartDependFnsResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
+ /*
+ * End Dependent Functions Resource
+ */
+ Status = AcpiRsEndDependFnsResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_IO_PORT:
+ /*
+ * IO Port Resource
+ */
+ Status = AcpiRsIoResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
+ /*
+ * Fixed IO Port Resource
+ */
+ Status = AcpiRsFixedIoResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ /*
+ * Vendor Specific Resource
+ */
+ Status = AcpiRsVendorResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ case ACPI_RDESC_TYPE_END_TAG:
+ /*
+ * End Tag
+ */
+ EndTagProcessed = TRUE;
+ Status = AcpiRsEndTagResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
+ break;
+
+
+ default:
+ /*
+ * Invalid/Unknown resource type
+ */
+ Status = AE_AML_INVALID_RESOURCE_TYPE;
+ break;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Update the return value and counter
+ */
+ BytesParsed += BytesConsumed;
+
+ /*
+ * Set the byte stream to point to the next resource
+ */
+ ByteStreamBuffer += BytesConsumed;
+
+ /*
+ * Set the Buffer to the next structure
+ */
+ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer);
+ Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length);
+ Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize);
+
+ } /* end while */
+
+ /*
+ * Check the reason for exiting the while loop
+ */
+ if (!EndTagProcessed)
+ {
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsListToByteStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * ByteSteamSizeNeeded - Calculated size of the byte stream
+ * needed from calling
+ * AcpiRsGetByteStreamLength()
+ * The size of the OutputBuffer is
+ * guaranteed to be >=
+ * ByteStreamSizeNeeded
+ * OutputBuffer - Pointer to the buffer that will
+ * contain the byte stream
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes the resource linked list and parses it, creating a
+ * byte stream of resources in the caller's output buffer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsListToByteStream (
+ ACPI_RESOURCE *LinkedList,
+ ACPI_SIZE ByteStreamSizeNeeded,
+ UINT8 *OutputBuffer)
+{
+ ACPI_STATUS Status;
+ UINT8 *Buffer = OutputBuffer;
+ ACPI_SIZE BytesConsumed = 0;
+ BOOLEAN Done = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("RsListToByteStream");
+
+
+ while (!Done)
+ {
+ switch (LinkedList->Id)
+ {
+ case ACPI_RSTYPE_IRQ:
+ /*
+ * IRQ Resource
+ */
+ Status = AcpiRsIrqStream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_DMA:
+ /*
+ * DMA Resource
+ */
+ Status = AcpiRsDmaStream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_START_DPF:
+ /*
+ * Start Dependent Functions Resource
+ */
+ Status = AcpiRsStartDependFnsStream (LinkedList,
+ &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_END_DPF:
+ /*
+ * End Dependent Functions Resource
+ */
+ Status = AcpiRsEndDependFnsStream (LinkedList,
+ &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_IO:
+ /*
+ * IO Port Resource
+ */
+ Status = AcpiRsIoStream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_FIXED_IO:
+ /*
+ * Fixed IO Port Resource
+ */
+ Status = AcpiRsFixedIoStream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_VENDOR:
+ /*
+ * Vendor Defined Resource
+ */
+ Status = AcpiRsVendorStream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_END_TAG:
+ /*
+ * End Tag
+ */
+ Status = AcpiRsEndTagStream (LinkedList, &Buffer, &BytesConsumed);
+
+ /*
+ * An End Tag indicates the end of the Resource Template
+ */
+ Done = TRUE;
+ break;
+
+ case ACPI_RSTYPE_MEM24:
+ /*
+ * 24-Bit Memory Resource
+ */
+ Status = AcpiRsMemory24Stream (LinkedList, &Buffer, &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_MEM32:
+ /*
+ * 32-Bit Memory Range Resource
+ */
+ Status = AcpiRsMemory32RangeStream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_FIXED_MEM32:
+ /*
+ * 32-Bit Fixed Memory Resource
+ */
+ Status = AcpiRsFixedMemory32Stream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS16:
+ /*
+ * 16-Bit Address Descriptor Resource
+ */
+ Status = AcpiRsAddress16Stream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS32:
+ /*
+ * 32-Bit Address Descriptor Resource
+ */
+ Status = AcpiRsAddress32Stream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_ADDRESS64:
+ /*
+ * 64-Bit Address Descriptor Resource
+ */
+ Status = AcpiRsAddress64Stream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ case ACPI_RSTYPE_EXT_IRQ:
+ /*
+ * Extended IRQ Resource
+ */
+ Status = AcpiRsExtendedIrqStream (LinkedList, &Buffer,
+ &BytesConsumed);
+ break;
+
+ default:
+ /*
+ * If we get here, everything is out of sync,
+ * so exit with an error
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n",
+ LinkedList->Id));
+ Status = AE_BAD_DATA;
+ break;
+
+ } /* switch (LinkedList->Id) */
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Set the Buffer to point to the open byte
+ */
+ Buffer += BytesConsumed;
+
+ /*
+ * Point to the next object
+ */
+ LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
+ LinkedList, LinkedList->Length);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c
new file mode 100644
index 0000000..7462de4
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsmemory.c
@@ -0,0 +1,640 @@
+/*******************************************************************************
+ *
+ * Module Name: rsmem24 - Memory resource descriptors
+ * $Revision: 24 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSMEMORY_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsmemory")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsMemory24Resource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsMemory24Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+
+
+ ACPI_FUNCTION_TRACE ("RsMemory24Resource");
+
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ Buffer += 2;
+ *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
+ OutputStruct->Id = ACPI_RSTYPE_MEM24;
+
+ /*
+ * Check Byte 3 the Read/Write bit
+ */
+ Temp8 = *Buffer;
+ Buffer += 1;
+ OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
+
+ /*
+ * Get MinBaseAddress (Bytes 4-5)
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ Buffer += 2;
+ OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
+
+ /*
+ * Get MaxBaseAddress (Bytes 6-7)
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ Buffer += 2;
+ OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
+
+ /*
+ * Get Alignment (Bytes 8-9)
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ Buffer += 2;
+ OutputStruct->Data.Memory24.Alignment = Temp16;
+
+ /*
+ * Get RangeLength (Bytes 10-11)
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ OutputStruct->Data.Memory24.RangeLength = Temp16;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsMemory24Stream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsMemory24Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsMemory24Stream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x81;
+ Buffer += 1;
+
+ /*
+ * The length field is static
+ */
+ Temp16 = 0x09;
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the Information Byte
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the Range minimum base address
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
+ Buffer += 2;
+
+ /*
+ * Set the Range maximum base address
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
+ Buffer += 2;
+
+ /*
+ * Set the base alignment
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
+ Buffer += 2;
+
+ /*
+ * Set the range length
+ */
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
+ Buffer += 2;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsMemory32RangeResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsMemory32RangeResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+
+
+ ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
+
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ Buffer += 2;
+ *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
+
+ OutputStruct->Id = ACPI_RSTYPE_MEM32;
+
+ /*
+ * Point to the place in the output buffer where the data portion will
+ * begin.
+ * 1. Set the RESOURCE_DATA * Data to point to its own address, then
+ * 2. Set the pointer to the next address.
+ *
+ * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
+ * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
+ */
+
+ /*
+ * Check Byte 3 the Read/Write bit
+ */
+ Temp8 = *Buffer;
+ Buffer += 1;
+
+ OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
+
+ /*
+ * Get MinBaseAddress (Bytes 4-7)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
+ Buffer += 4;
+
+ /*
+ * Get MaxBaseAddress (Bytes 8-11)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
+ Buffer += 4;
+
+ /*
+ * Get Alignment (Bytes 12-15)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
+ Buffer += 4;
+
+ /*
+ * Get RangeLength (Bytes 16-19)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsFixedMemory32Resource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsFixedMemory32Resource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+
+
+ ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
+
+
+ /*
+ * Point past the Descriptor to get the number of bytes consumed
+ */
+ Buffer += 1;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ Buffer += 2;
+ *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
+
+ OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32;
+
+ /*
+ * Check Byte 3 the Read/Write bit
+ */
+ Temp8 = *Buffer;
+ Buffer += 1;
+ OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
+
+ /*
+ * Get RangeBaseAddress (Bytes 4-7)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
+ Buffer += 4;
+
+ /*
+ * Get RangeLength (Bytes 8-11)
+ */
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsMemory32RangeStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsMemory32RangeStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x85;
+ Buffer += 1;
+
+ /*
+ * The length field is static
+ */
+ Temp16 = 0x11;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the Information Byte
+ */
+ Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the Range minimum base address
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
+ Buffer += 4;
+
+ /*
+ * Set the Range maximum base address
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
+ Buffer += 4;
+
+ /*
+ * Set the base alignment
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
+ Buffer += 4;
+
+ /*
+ * Set the range length
+ */
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
+ Buffer += 4;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsFixedMemory32Stream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsFixedMemory32Stream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x86;
+ Buffer += 1;
+
+ /*
+ * The length field is static
+ */
+ Temp16 = 0x09;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+
+ /*
+ * Set the Information Byte
+ */
+ Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Set the Range base address
+ */
+ ACPI_MOVE_32_TO_32 (Buffer,
+ &LinkedList->Data.FixedMemory32.RangeBaseAddress);
+ Buffer += 4;
+
+ /*
+ * Set the range length
+ */
+ ACPI_MOVE_32_TO_32 (Buffer,
+ &LinkedList->Data.FixedMemory32.RangeLength);
+ Buffer += 4;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c
new file mode 100644
index 0000000..0aca8a6
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsmisc.c
@@ -0,0 +1,683 @@
+/*******************************************************************************
+ *
+ * Module Name: rsmisc - Miscellaneous resource descriptors
+ * $Revision: 26 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __RSMISC_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsEndTagResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsEndTagResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
+
+
+ ACPI_FUNCTION_TRACE ("RsEndTagResource");
+
+
+ /*
+ * The number of bytes consumed is static
+ */
+ *BytesConsumed = 2;
+
+ /*
+ * Fill out the structure
+ */
+ OutputStruct->Id = ACPI_RSTYPE_END_TAG;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = 0;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsEndTagStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsEndTagStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsEndTagStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x79;
+ Buffer += 1;
+
+ /*
+ * Set the Checksum - zero means that the resource data is treated as if
+ * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
+ */
+ Temp8 = 0;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsVendorResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsVendorResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
+
+
+ ACPI_FUNCTION_TRACE ("RsVendorResource");
+
+
+ /*
+ * Dereference the Descriptor to find if this is a large or small item.
+ */
+ Temp8 = *Buffer;
+
+ if (Temp8 & 0x80)
+ {
+ /*
+ * Large Item, point to the length field
+ */
+ Buffer += 1;
+
+ /* Dereference */
+
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+
+ /* Calculate bytes consumed */
+
+ *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
+
+ /* Point to the first vendor byte */
+
+ Buffer += 2;
+ }
+ else
+ {
+ /*
+ * Small Item, dereference the size
+ */
+ Temp16 = (UINT8)(*Buffer & 0x07);
+
+ /* Calculate bytes consumed */
+
+ *BytesConsumed = (ACPI_SIZE) Temp16 + 1;
+
+ /* Point to the first vendor byte */
+
+ Buffer += 1;
+ }
+
+ OutputStruct->Id = ACPI_RSTYPE_VENDOR;
+ OutputStruct->Data.VendorSpecific.Length = Temp16;
+
+ for (Index = 0; Index < Temp16; Index++)
+ {
+ OutputStruct->Data.VendorSpecific.Reserved[Index] = *Buffer;
+ Buffer += 1;
+ }
+
+ /*
+ * In order for the StructSize to fall on a 32-bit boundary,
+ * calculate the length of the vendor string and expand the
+ * StructSize to the next 32-bit boundary.
+ */
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp16);
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsVendorStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsVendorStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT16 Temp16 = 0;
+ UINT8 Temp8 = 0;
+ UINT8 Index;
+
+
+ ACPI_FUNCTION_TRACE ("RsVendorStream");
+
+
+ /*
+ * Dereference the length to find if this is a large or small item.
+ */
+ if(LinkedList->Data.VendorSpecific.Length > 7)
+ {
+ /*
+ * Large Item, Set the descriptor field and length bytes
+ */
+ *Buffer = 0x84;
+ Buffer += 1;
+
+ Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length;
+
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
+ Buffer += 2;
+ }
+ else
+ {
+ /*
+ * Small Item, Set the descriptor field
+ */
+ Temp8 = 0x70;
+ Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length;
+
+ *Buffer = Temp8;
+ Buffer += 1;
+ }
+
+ /*
+ * Loop through all of the Vendor Specific fields
+ */
+ for (Index = 0; Index < LinkedList->Data.VendorSpecific.Length; Index++)
+ {
+ Temp8 = LinkedList->Data.VendorSpecific.Reserved[Index];
+
+ *Buffer = Temp8;
+ Buffer += 1;
+ }
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsStartDependFnsResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsStartDependFnsResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ UINT8 *Buffer = ByteStreamBuffer;
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ UINT8 Temp8 = 0;
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+
+
+ ACPI_FUNCTION_TRACE ("RsStartDependFnsResource");
+
+
+ /*
+ * The number of bytes consumed are contained in the descriptor (Bits:0-1)
+ */
+ Temp8 = *Buffer;
+
+ *BytesConsumed = (Temp8 & 0x01) + 1;
+
+ OutputStruct->Id = ACPI_RSTYPE_START_DPF;
+
+ /*
+ * Point to Byte 1 if it is used
+ */
+ if (2 == *BytesConsumed)
+ {
+ Buffer += 1;
+ Temp8 = *Buffer;
+
+ /*
+ * Check Compatibility priority
+ */
+ OutputStruct->Data.StartDpf.CompatibilityPriority = Temp8 & 0x03;
+
+ if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
+ }
+
+ /*
+ * Check Performance/Robustness preference
+ */
+ OutputStruct->Data.StartDpf.PerformanceRobustness = (Temp8 >> 2) & 0x03;
+
+ if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
+ }
+ }
+ else
+ {
+ OutputStruct->Data.StartDpf.CompatibilityPriority =
+ ACPI_ACCEPTABLE_CONFIGURATION;
+
+ OutputStruct->Data.StartDpf.PerformanceRobustness =
+ ACPI_ACCEPTABLE_CONFIGURATION;
+ }
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsEndDependFnsResource
+ *
+ * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
+ * stream
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsEndDependFnsResource (
+ UINT8 *ByteStreamBuffer,
+ ACPI_SIZE *BytesConsumed,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *StructureSize)
+{
+ ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
+ ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
+
+
+ ACPI_FUNCTION_TRACE ("RsEndDependFnsResource");
+
+
+ /*
+ * The number of bytes consumed is static
+ */
+ *BytesConsumed = 1;
+
+ /*
+ * Fill out the structure
+ */
+ OutputStruct->Id = ACPI_RSTYPE_END_DPF;
+
+ /*
+ * Set the Length parameter
+ */
+ OutputStruct->Length = (UINT32) StructSize;
+
+ /*
+ * Return the final size of the structure
+ */
+ *StructureSize = StructSize;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsStartDependFnsStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - UINT32 pointer that is filled with
+ * the number of bytes of the
+ * OutputBuffer used
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsStartDependFnsStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+ UINT8 Temp8 = 0;
+
+
+ ACPI_FUNCTION_TRACE ("RsStartDependFnsStream");
+
+
+ /*
+ * The descriptor field is set based upon whether a byte is needed
+ * to contain Priority data.
+ */
+ if (ACPI_ACCEPTABLE_CONFIGURATION ==
+ LinkedList->Data.StartDpf.CompatibilityPriority &&
+ ACPI_ACCEPTABLE_CONFIGURATION ==
+ LinkedList->Data.StartDpf.PerformanceRobustness)
+ {
+ *Buffer = 0x30;
+ }
+ else
+ {
+ *Buffer = 0x31;
+ Buffer += 1;
+
+ /*
+ * Set the Priority Byte Definition
+ */
+ Temp8 = 0;
+ Temp8 = (UINT8) ((LinkedList->Data.StartDpf.PerformanceRobustness &
+ 0x03) << 2);
+ Temp8 |= (LinkedList->Data.StartDpf.CompatibilityPriority &
+ 0x03);
+ *Buffer = Temp8;
+ }
+
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsEndDependFnsStream
+ *
+ * PARAMETERS: LinkedList - Pointer to the resource linked list
+ * OutputBuffer - Pointer to the user's return buffer
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsEndDependFnsStream (
+ ACPI_RESOURCE *LinkedList,
+ UINT8 **OutputBuffer,
+ ACPI_SIZE *BytesConsumed)
+{
+ UINT8 *Buffer = *OutputBuffer;
+
+
+ ACPI_FUNCTION_TRACE ("RsEndDependFnsStream");
+
+
+ /*
+ * The descriptor field is static
+ */
+ *Buffer = 0x38;
+ Buffer += 1;
+
+ /*
+ * Return the number of bytes consumed in this operation
+ */
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c
new file mode 100644
index 0000000..e4e35a9
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsutils.c
@@ -0,0 +1,423 @@
+/*******************************************************************************
+ *
+ * Module Name: rsutils - Utilities for the resource manager
+ * $Revision: 37 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __RSUTILS_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acresrc.h"
+
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetPrtMethodData
+ *
+ * PARAMETERS: Handle - a handle to the containing object
+ * RetBuffer - a pointer to a buffer structure for the
+ * results
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the _PRT value of an object
+ * contained in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetPrtMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetPrtMethodData");
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /*
+ * Execute the method, no parameters
+ */
+ Status = AcpiUtEvaluateObject (Handle, "_PRT", ACPI_BTYPE_PACKAGE, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Create a resource linked list from the byte stream buffer that comes
+ * back from the _CRS method execution.
+ */
+ Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer);
+
+ /* On exit, we must delete the object returned by EvaluateObject */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetCrsMethodData
+ *
+ * PARAMETERS: Handle - a handle to the containing object
+ * RetBuffer - a pointer to a buffer structure for the
+ * results
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the _CRS value of an object
+ * contained in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetCrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetCrsMethodData");
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /*
+ * Execute the method, no parameters
+ */
+ Status = AcpiUtEvaluateObject (Handle, "_CRS", ACPI_BTYPE_BUFFER, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Make the call to create a resource linked list from the
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
+ */
+ Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
+
+ /* On exit, we must delete the object returned by evaluateObject */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetPrsMethodData
+ *
+ * PARAMETERS: Handle - a handle to the containing object
+ * RetBuffer - a pointer to a buffer structure for the
+ * results
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the _PRS value of an object
+ * contained in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetPrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetPrsMethodData");
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /*
+ * Execute the method, no parameters
+ */
+ Status = AcpiUtEvaluateObject (Handle, "_PRS", ACPI_BTYPE_BUFFER, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Make the call to create a resource linked list from the
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
+ */
+ Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
+
+ /* On exit, we must delete the object returned by evaluateObject */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetMethodData
+ *
+ * PARAMETERS: Handle - a handle to the containing object
+ * RetBuffer - a pointer to a buffer structure for the
+ * results
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
+ * object contained in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetMethodData (
+ ACPI_HANDLE Handle,
+ char *Path,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("RsGetMethodData");
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /*
+ * Execute the method, no parameters
+ */
+ Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc);
+ if (ACPI_FAILURE (Status)) {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Make the call to create a resource linked list from the
+ * byte stream buffer that comes back from the method
+ * execution.
+ */
+ Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
+
+ /* On exit, we must delete the object returned by EvaluateObject */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsSetSrsMethodData
+ *
+ * PARAMETERS: Handle - a handle to the containing object
+ * InBuffer - a pointer to a buffer structure of the
+ * parameter
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to set the _SRS of an object contained
+ * in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsSetSrsMethodData (
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *InBuffer)
+{
+ ACPI_OPERAND_OBJECT *Params[2];
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+
+
+ ACPI_FUNCTION_TRACE ("RsSetSrsMethodData");
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /*
+ * The InBuffer parameter will point to a linked list of
+ * resource parameters. It needs to be formatted into a
+ * byte stream to be sent in as an input parameter to _SRS
+ *
+ * Convert the linked list into a byte stream
+ */
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiRsCreateByteStream (InBuffer->Pointer, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Init the param object
+ */
+ Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!Params[0])
+ {
+ AcpiOsFree (Buffer.Pointer);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Set up the parameter object
+ */
+ Params[0]->Buffer.Length = (UINT32) Buffer.Length;
+ Params[0]->Buffer.Pointer = Buffer.Pointer;
+ Params[0]->Common.Flags = AOPOBJ_DATA_VALID;
+ Params[1] = NULL;
+
+ /*
+ * Execute the method, no return value
+ */
+ Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL);
+
+ /*
+ * Clean up and return the status from AcpiNsEvaluateRelative
+ */
+ AcpiUtRemoveReference (Params[0]);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c
new file mode 100644
index 0000000..2785898
--- /dev/null
+++ b/sys/contrib/dev/acpica/rsxface.c
@@ -0,0 +1,499 @@
+/*******************************************************************************
+ *
+ * Module Name: rsxface - Public interfaces to the resource manager
+ * $Revision: 27 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __RSXFACE_C__
+
+#include "acpi.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetIrqRoutingTable
+ *
+ * PARAMETERS: DeviceHandle - a handle to the Bus device we are querying
+ * RetBuffer - a pointer to a buffer to receive the
+ * current resources for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the IRQ routing table for a
+ * specific bus. The caller must first acquire a handle for the
+ * desired bus. The routine table is placed in the buffer pointed
+ * to by the RetBuffer variable parameter.
+ *
+ * If the function fails an appropriate status will be returned
+ * and the value of RetBuffer is undefined.
+ *
+ * This function attempts to execute the _PRT method contained in
+ * the object indicated by the passed DeviceHandle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetIrqRoutingTable (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetIrqRoutingTable ");
+
+
+ /*
+ * Must have a valid handle and buffer, So we have to have a handle
+ * and a return buffer structure, and if there is a non-zero buffer length
+ * we also need a valid pointer in the buffer. If it's a zero buffer length,
+ * we'll be returning the needed buffer size, so keep going.
+ */
+ if (!DeviceHandle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiRsGetPrtMethodData (DeviceHandle, RetBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetCurrentResources
+ *
+ * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * device we are querying
+ * RetBuffer - a pointer to a buffer to receive the
+ * current resources for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the current resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is placed in the buffer
+ * pointed to by the RetBuffer variable parameter.
+ *
+ * If the function fails an appropriate status will be returned
+ * and the value of RetBuffer is undefined.
+ *
+ * This function attempts to execute the _CRS method contained in
+ * the object indicated by the passed DeviceHandle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetCurrentResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetCurrentResources");
+
+
+ /*
+ * Must have a valid handle and buffer, So we have to have a handle
+ * and a return buffer structure, and if there is a non-zero buffer length
+ * we also need a valid pointer in the buffer. If it's a zero buffer length,
+ * we'll be returning the needed buffer size, so keep going.
+ */
+ if (!DeviceHandle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiRsGetCrsMethodData (DeviceHandle, RetBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetPossibleResources
+ *
+ * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * device we are querying
+ * RetBuffer - a pointer to a buffer to receive the
+ * resources for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get a list of the possible resources
+ * for a specific device. The caller must first acquire a handle
+ * for the desired device. The resource data is placed in the
+ * buffer pointed to by the RetBuffer variable.
+ *
+ * If the function fails an appropriate status will be returned
+ * and the value of RetBuffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetPossibleResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetPossibleResources");
+
+
+ /*
+ * Must have a valid handle and buffer, So we have to have a handle
+ * and a return buffer structure, and if there is a non-zero buffer length
+ * we also need a valid pointer in the buffer. If it's a zero buffer length,
+ * we'll be returning the needed buffer size, so keep going.
+ */
+ if (!DeviceHandle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiRsGetPrsMethodData (DeviceHandle, RetBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiWalkResources
+ *
+ * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * device we are querying
+ * Path - method name of the resources we want
+ * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * UserFunction - called for each resource
+ * Context - passed to UserFunction
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ * specified device. The UserFunction is called once for
+ * each resource in the list.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiWalkResources (
+ ACPI_HANDLE DeviceHandle,
+ char *Path,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+ ACPI_RESOURCE *Resource;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiWalkResources");
+
+
+ if (!DeviceHandle ||
+ (ACPI_STRNCMP (Path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) &&
+ ACPI_STRNCMP (Path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS))))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiRsGetMethodData (DeviceHandle, Path, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Resource = (ACPI_RESOURCE *) Buffer.Pointer;
+ for (;;)
+ {
+ if (!Resource || Resource->Id == ACPI_RSTYPE_END_TAG)
+ {
+ break;
+ }
+
+ Status = UserFunction (Resource, Context);
+
+ switch (Status)
+ {
+ case AE_OK:
+ case AE_CTRL_DEPTH:
+
+ /* Just keep going */
+ Status = AE_OK;
+ break;
+
+ case AE_CTRL_TERMINATE:
+
+ /* Exit now, with OK stats */
+
+ Status = AE_OK;
+ goto Cleanup;
+
+ default:
+
+ /* All others are valid exceptions */
+
+ goto Cleanup;
+ }
+
+ Resource = ACPI_NEXT_RESOURCE (Resource);
+ }
+
+Cleanup:
+
+ AcpiOsFree (Buffer.Pointer);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiSetCurrentResources
+ *
+ * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * device we are changing the resources of
+ * InBuffer - a pointer to a buffer containing the
+ * resources to be set for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to set the current resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is passed to the routine
+ * the buffer pointed to by the InBuffer variable.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiSetCurrentResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *InBuffer)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiSetCurrentResources");
+
+
+ /*
+ * Must have a valid handle and buffer
+ */
+ if ((!DeviceHandle) ||
+ (!InBuffer) ||
+ (!InBuffer->Pointer) ||
+ (!InBuffer->Length))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiRsSetSrsMethodData (DeviceHandle, InBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+
+#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field)
+#define ACPI_COPY_ADDRESS(Out, In) \
+ ACPI_COPY_FIELD(Out, In, ResourceType); \
+ ACPI_COPY_FIELD(Out, In, ProducerConsumer); \
+ ACPI_COPY_FIELD(Out, In, Decode); \
+ ACPI_COPY_FIELD(Out, In, MinAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, Attribute); \
+ ACPI_COPY_FIELD(Out, In, Granularity); \
+ ACPI_COPY_FIELD(Out, In, MinAddressRange); \
+ ACPI_COPY_FIELD(Out, In, MaxAddressRange); \
+ ACPI_COPY_FIELD(Out, In, AddressTranslationOffset); \
+ ACPI_COPY_FIELD(Out, In, AddressLength); \
+ ACPI_COPY_FIELD(Out, In, ResourceSource);
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiResourceToAddress64
+ *
+ * PARAMETERS: resource - Pointer to a resource
+ * out - Pointer to the users's return
+ * buffer (a struct
+ * acpi_resource_address64)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: If the resource is an address16, address32, or address64,
+ * copy it to the address64 return buffer. This saves the
+ * caller from having to duplicate code for different-sized
+ * addresses.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiResourceToAddress64 (
+ ACPI_RESOURCE *Resource,
+ ACPI_RESOURCE_ADDRESS64 *Out)
+{
+ ACPI_RESOURCE_ADDRESS16 *Address16;
+ ACPI_RESOURCE_ADDRESS32 *Address32;
+
+
+ switch (Resource->Id) {
+ case ACPI_RSTYPE_ADDRESS16:
+
+ Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
+ ACPI_COPY_ADDRESS(Out, Address16);
+ break;
+
+
+ case ACPI_RSTYPE_ADDRESS32:
+
+ Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
+ ACPI_COPY_ADDRESS(Out, Address32);
+ break;
+
+
+ case ACPI_RSTYPE_ADDRESS64:
+
+ /* Simple copy for 64 bit source */
+
+ ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
+ break;
+
+
+ default:
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c
new file mode 100644
index 0000000..c3502e5
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbconvrt.c
@@ -0,0 +1,647 @@
+/******************************************************************************
+ *
+ * Module Name: tbconvrt - ACPI Table conversion utilities
+ * $Revision: 52 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBCONVRT_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbconvrt")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTableCount
+ *
+ * PARAMETERS: RSDP - Pointer to the RSDP
+ * RSDT - Pointer to the RSDT/XSDT
+ *
+ * RETURN: The number of tables pointed to by the RSDT or XSDT.
+ *
+ * DESCRIPTION: Calculate the number of tables. Automatically handles either
+ * an RSDT or XSDT.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiTbGetTableCount (
+ RSDP_DESCRIPTOR *RSDP,
+ ACPI_TABLE_HEADER *RSDT)
+{
+ UINT32 PointerSize;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+#if ACPI_MACHINE_WIDTH != 64
+
+ if (RSDP->Revision < 2)
+ {
+ PointerSize = sizeof (UINT32);
+ }
+ else
+#endif
+ {
+ PointerSize = sizeof (UINT64);
+ }
+
+ /*
+ * Determine the number of tables pointed to by the RSDT/XSDT.
+ * This is defined by the ACPI Specification to be the number of
+ * pointers contained within the RSDT/XSDT. The size of the pointers
+ * is architecture-dependent.
+ */
+ return ((RSDT->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertToXsdt
+ *
+ * PARAMETERS: TableInfo - Info about the RSDT
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an RSDT to an XSDT (internal common format)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbConvertToXsdt (
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_SIZE TableSize;
+ UINT32 i;
+ XSDT_DESCRIPTOR *NewTable;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Compute size of the converted XSDT */
+
+ TableSize = ((ACPI_SIZE) AcpiGbl_RsdtTableCount * sizeof (UINT64)) +
+ sizeof (ACPI_TABLE_HEADER);
+
+ /* Allocate an XSDT */
+
+ NewTable = ACPI_MEM_CALLOCATE (TableSize);
+ if (!NewTable)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the header and set the length */
+
+ ACPI_MEMCPY (NewTable, TableInfo->Pointer, sizeof (ACPI_TABLE_HEADER));
+ NewTable->Header.Length = (UINT32) TableSize;
+
+ /* Copy the table pointers */
+
+ for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
+ {
+ if (AcpiGbl_RSDP->Revision < 2)
+ {
+ ACPI_STORE_ADDRESS (NewTable->TableOffsetEntry[i],
+ ((RSDT_DESCRIPTOR_REV1 *) TableInfo->Pointer)->TableOffsetEntry[i]);
+ }
+ else
+ {
+ NewTable->TableOffsetEntry[i] =
+ ((XSDT_DESCRIPTOR *) TableInfo->Pointer)->TableOffsetEntry[i];
+ }
+ }
+
+ /* Delete the original table (either mapped or in a buffer) */
+
+ AcpiTbDeleteSingleTable (TableInfo);
+
+ /* Point the table descriptor to the new table */
+
+ TableInfo->Pointer = (ACPI_TABLE_HEADER *) NewTable;
+ TableInfo->Length = TableSize;
+ TableInfo->Allocation = ACPI_MEM_ALLOCATED;
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiTbInitGenericAddress
+ *
+ * PARAMETERS: NewGasStruct - GAS struct to be initialized
+ * RegisterBitWidth - Width of this register
+ * Address - Address of the register
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a GAS structure.
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbInitGenericAddress (
+ ACPI_GENERIC_ADDRESS *NewGasStruct,
+ UINT8 RegisterBitWidth,
+ ACPI_PHYSICAL_ADDRESS Address)
+{
+
+ ACPI_STORE_ADDRESS (NewGasStruct->Address, Address);
+
+ NewGasStruct->AddressSpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
+ NewGasStruct->RegisterBitWidth = RegisterBitWidth;
+ NewGasStruct->RegisterBitOffset = 0;
+ NewGasStruct->Reserved = 0;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertFadt1
+ *
+ * PARAMETERS: LocalFadt - Pointer to new FADT
+ * OriginalFadt - Pointer to old FADT
+ *
+ * RETURN: Populates LocalFadt
+ *
+ * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbConvertFadt1 (
+ FADT_DESCRIPTOR_REV2 *LocalFadt,
+ FADT_DESCRIPTOR_REV1 *OriginalFadt)
+{
+
+
+ /* ACPI 1.0 FACS */
+ /* The BIOS stored FADT should agree with Revision 1.0 */
+
+ /*
+ * Copy the table header and the common part of the tables.
+ *
+ * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
+ * table can be copied first, then expand some fields to 64 bits.
+ */
+ ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR_REV1));
+
+ /* Convert table pointers to 64-bit fields */
+
+ ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl, LocalFadt->V1_FirmwareCtrl);
+ ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt);
+
+ /*
+ * System Interrupt Model isn't used in ACPI 2.0 (LocalFadt->Reserved1 = 0;)
+ */
+
+ /*
+ * This field is set by the OEM to convey the preferred power management
+ * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't
+ * know what kind of 32-bit system this is, we will use "unspecified".
+ */
+ LocalFadt->Prefer_PM_Profile = PM_UNSPECIFIED;
+
+ /*
+ * Processor Performance State Control. This is the value OSPM writes to
+ * the SMI_CMD register to assume processor performance state control
+ * responsibility. There isn't any equivalence in 1.0, leave it zeroed.
+ */
+ LocalFadt->PstateCnt = 0;
+
+ /*
+ * Support for the _CST object and C States change notification.
+ * This data item hasn't any 1.0 equivalence so leave it zero.
+ */
+ LocalFadt->CstCnt = 0;
+
+ /*
+ * Since there isn't any equivalence in 1.0 and since it highly likely
+ * that a 1.0 system has legacy support.
+ */
+ LocalFadt->IapcBootArch = BAF_LEGACY_DEVICES;
+
+ /*
+ * Convert the V1.0 block addresses to V2.0 GAS structures
+ */
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk, LocalFadt->Pm1EvtLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk, LocalFadt->Pm1EvtLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk, LocalFadt->Pm1CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk, LocalFadt->Pm1CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk, LocalFadt->Pm2CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm2CntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk, LocalFadt->PmTmLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_PmTmrBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk, 0,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe0Blk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk, 0,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe1Blk);
+
+ /* Create separate GAS structs for the PM1 Enable registers */
+
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+
+ /* PM1B is optional; leave null if not present */
+
+ if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
+ {
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertFadt2
+ *
+ * PARAMETERS: LocalFadt - Pointer to new FADT
+ * OriginalFadt - Pointer to old FADT
+ *
+ * RETURN: Populates LocalFadt
+ *
+ * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
+ * Handles optional "X" fields.
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbConvertFadt2 (
+ FADT_DESCRIPTOR_REV2 *LocalFadt,
+ FADT_DESCRIPTOR_REV2 *OriginalFadt)
+{
+
+ /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
+
+ ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR_REV2));
+
+ /*
+ * "X" fields are optional extensions to the original V1.0 fields, so
+ * we must selectively expand V1.0 fields if the corresponding X field
+ * is zero.
+ */
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XFirmwareCtrl)))
+ {
+ ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl, LocalFadt->V1_FirmwareCtrl);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XDsdt)))
+ {
+ ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk,
+ LocalFadt->Pm1EvtLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aEvtBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk,
+ LocalFadt->Pm1EvtLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bEvtBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aCntBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk,
+ LocalFadt->Pm1CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aCntBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bCntBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk,
+ LocalFadt->Pm1CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bCntBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPm2CntBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk,
+ LocalFadt->Pm2CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm2CntBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XPmTmrBlk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk,
+ LocalFadt->PmTmLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_PmTmrBlk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe0Blk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk,
+ 0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe0Blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe1Blk.Address)))
+ {
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk,
+ 0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe1Blk);
+ }
+
+ /* Create separate GAS structs for the PM1 Enable registers */
+
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ AcpiGbl_XPm1aEnable.AddressSpaceId = LocalFadt->XPm1aEvtBlk.AddressSpaceId;
+
+ /* PM1B is optional; leave null if not present */
+
+ if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
+ {
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ AcpiGbl_XPm1bEnable.AddressSpaceId = LocalFadt->XPm1bEvtBlk.AddressSpaceId;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertTableFadt
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Converts a BIOS supplied ACPI 1.0 FADT to a local
+ * ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
+ * copied to the local FADT. The ACPI CA software uses this
+ * local FADT. Thus a significant amount of special #ifdef
+ * type codeing is saved.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbConvertTableFadt (void)
+{
+ FADT_DESCRIPTOR_REV2 *LocalFadt;
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ ACPI_FUNCTION_TRACE ("TbConvertTableFadt");
+
+
+ /*
+ * AcpiGbl_FADT is valid
+ * Allocate and zero the 2.0 FADT buffer
+ */
+ LocalFadt = ACPI_MEM_CALLOCATE (sizeof (FADT_DESCRIPTOR_REV2));
+ if (LocalFadt == NULL)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * FADT length and version validation. The table must be at least as
+ * long as the version 1.0 FADT
+ */
+ if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV1))
+ {
+ ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", AcpiGbl_FADT->Header.Length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
+ if (AcpiGbl_FADT->Header.Revision >= FADT2_REVISION_ID)
+ {
+ if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV2))
+ {
+ /* Length is too short to be a V2.0 table */
+
+ ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
+ AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Revision));
+
+ AcpiTbConvertFadt1 (LocalFadt, (void *) AcpiGbl_FADT);
+ }
+ else
+ {
+ /* Valid V2.0 table */
+
+ AcpiTbConvertFadt2 (LocalFadt, AcpiGbl_FADT);
+ }
+ }
+ else
+ {
+ /* Valid V1.0 table */
+
+ AcpiTbConvertFadt1 (LocalFadt, (void *) AcpiGbl_FADT);
+ }
+
+ /*
+ * Global FADT pointer will point to the new common V2.0 FADT
+ */
+ AcpiGbl_FADT = LocalFadt;
+ AcpiGbl_FADT->Header.Length = sizeof (FADT_DESCRIPTOR);
+
+ /* Free the original table */
+
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_FADT].Next;
+ AcpiTbDeleteSingleTable (TableDesc);
+
+ /* Install the new table */
+
+ TableDesc->Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_FADT;
+ TableDesc->Allocation = ACPI_MEM_ALLOCATED;
+ TableDesc->Length = sizeof (FADT_DESCRIPTOR_REV2);
+
+ /* Dump the entire FADT */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+ "Hex dump of common internal FADT, size %d (%X)\n",
+ AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Length));
+ ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_FADT), AcpiGbl_FADT->Header.Length);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertTableFacs
+ *
+ * PARAMETERS: TableInfo - Info for currently installad FACS
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal
+ * table format.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbBuildCommonFacs (
+ ACPI_TABLE_DESC *TableInfo)
+{
+
+ ACPI_FUNCTION_TRACE ("TbBuildCommonFacs");
+
+
+ /* Absolute minimum length is 24, but the ACPI spec says 64 */
+
+ if (AcpiGbl_FACS->Length < 24)
+ {
+ ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", AcpiGbl_FACS->Length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
+ if (AcpiGbl_FACS->Length < 64)
+ {
+ ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
+ AcpiGbl_FACS->Length));
+ }
+
+ /* Copy fields to the new FACS */
+
+ AcpiGbl_CommonFACS.GlobalLock = &(AcpiGbl_FACS->GlobalLock);
+
+ if ((AcpiGbl_RSDP->Revision < 2) ||
+ (AcpiGbl_FACS->Length < 32) ||
+ (!(ACPI_GET_ADDRESS (AcpiGbl_FACS->XFirmwareWakingVector))))
+ {
+ /* ACPI 1.0 FACS or short table or optional X_ field is zero */
+
+ AcpiGbl_CommonFACS.FirmwareWakingVector = ACPI_CAST_PTR (UINT64, &(AcpiGbl_FACS->FirmwareWakingVector));
+ AcpiGbl_CommonFACS.VectorWidth = 32;
+ }
+ else
+ {
+ /* ACPI 2.0 FACS with valid X_ field */
+
+ AcpiGbl_CommonFACS.FirmwareWakingVector = &AcpiGbl_FACS->XFirmwareWakingVector;
+ AcpiGbl_CommonFACS.VectorWidth = 64;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c
new file mode 100644
index 0000000..01fac0e
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbget.c
@@ -0,0 +1,586 @@
+/******************************************************************************
+ *
+ * Module Name: tbget - ACPI Table get* routines
+ * $Revision: 84 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBGET_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbget")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTable
+ *
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * TableInfo - Where table info is returned
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get entire table of unknown size.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetTable");
+
+
+ /*
+ * Get the header in order to get signature and table size
+ */
+ Status = AcpiTbGetTableHeader (Address, &Header);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the entire table */
+
+ Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n",
+ Header.Length, AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTableHeader
+ *
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * ReturnHeader - Where the table header is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an ACPI table header. Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetTableHeader (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *ReturnHeader)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_TABLE_HEADER *Header = NULL;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetTableHeader");
+
+
+ /*
+ * Flags contains the current processor mode (Virtual or Physical addressing)
+ * The PointerType is either Logical or Physical
+ */
+ switch (Address->PointerType)
+ {
+ case ACPI_PHYSMODE_PHYSPTR:
+ case ACPI_LOGMODE_LOGPTR:
+
+ /* Pointer matches processor mode, copy the header */
+
+ ACPI_MEMCPY (ReturnHeader, Address->Pointer.Logical, sizeof (ACPI_TABLE_HEADER));
+ break;
+
+
+ case ACPI_LOGMODE_PHYSPTR:
+
+ /* Create a logical address for the physical pointer*/
+
+ Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (ACPI_TABLE_HEADER),
+ (void **) &Header);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n",
+ ACPI_HIDWORD (Address->Pointer.Physical),
+ ACPI_LODWORD (Address->Pointer.Physical),
+ sizeof (ACPI_TABLE_HEADER)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Copy header and delete mapping */
+
+ ACPI_MEMCPY (ReturnHeader, Header, sizeof (ACPI_TABLE_HEADER));
+ AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER));
+ break;
+
+
+ default:
+
+ ACPI_REPORT_ERROR (("Invalid address flags %X\n",
+ Address->PointerType));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTableBody
+ *
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * Header - Header of the table to retrieve
+ * TableInfo - Where the table info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an entire ACPI table with support to allow the host OS to
+ * replace the table with a newer version (table override.)
+ * Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetTableBody (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetTableBody");
+
+
+ if (!TableInfo || !Address)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Attempt table override.
+ */
+ Status = AcpiTbTableOverride (Header, TableInfo);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Table was overridden by the host OS */
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* No override, get the original table */
+
+ Status = AcpiTbGetThisTable (Address, Header, TableInfo);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbTableOverride
+ *
+ * PARAMETERS: Header - Pointer to table header
+ * TableInfo - Return info if table is overridden
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Attempts override of current table with a new one if provided
+ * by the host OS.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbTableOverride (
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_TABLE_HEADER *NewTable;
+ ACPI_STATUS Status;
+ ACPI_POINTER Address;
+
+
+ ACPI_FUNCTION_TRACE ("TbTableOverride");
+
+
+ /*
+ * The OSL will examine the header and decide whether to override this
+ * table. If it decides to override, a table will be returned in NewTable,
+ * which we will then copy.
+ */
+ Status = AcpiOsTableOverride (Header, &NewTable);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Some severe error from the OSL, but we basically ignore it */
+
+ ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ if (!NewTable)
+ {
+ /* No table override */
+
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /*
+ * We have a new table to override the old one. Get a copy of
+ * the new one. We know that the new table has a logical pointer.
+ */
+ Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
+ Address.Pointer.Logical = NewTable;
+
+ Status = AcpiTbGetThisTable (&Address, NewTable, TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Copy the table info */
+
+ ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n",
+ TableInfo->Pointer->Signature));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetThisTable
+ *
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * Header - Header of the table to retrieve
+ * TableInfo - Where the table info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an entire ACPI table. Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetThisTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_TABLE_HEADER *FullTable = NULL;
+ UINT8 Allocation;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetThisTable");
+
+
+ /*
+ * Flags contains the current processor mode (Virtual or Physical addressing)
+ * The PointerType is either Logical or Physical
+ */
+ switch (Address->PointerType)
+ {
+ case ACPI_PHYSMODE_PHYSPTR:
+ case ACPI_LOGMODE_LOGPTR:
+
+ /* Pointer matches processor mode, copy the table to a new buffer */
+
+ FullTable = ACPI_MEM_ALLOCATE (Header->Length);
+ if (!FullTable)
+ {
+ ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n",
+ Header->Signature, Header->Length));
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the entire table (including header) to the local buffer */
+
+ ACPI_MEMCPY (FullTable, Address->Pointer.Logical, Header->Length);
+
+ /* Save allocation type */
+
+ Allocation = ACPI_MEM_ALLOCATED;
+ break;
+
+
+ case ACPI_LOGMODE_PHYSPTR:
+
+ /*
+ * Just map the table's physical memory
+ * into our address space.
+ */
+ Status = AcpiOsMapMemory (Address->Pointer.Physical, (ACPI_SIZE) Header->Length,
+ (void **) &FullTable);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n",
+ Header->Signature,
+ ACPI_HIDWORD (Address->Pointer.Physical),
+ ACPI_LODWORD (Address->Pointer.Physical), Header->Length));
+ return (Status);
+ }
+
+ /* Save allocation type */
+
+ Allocation = ACPI_MEM_MAPPED;
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n",
+ Address->PointerType));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Validate checksum for _most_ tables,
+ * even the ones whose signature we don't recognize
+ */
+ if (TableInfo->Type != ACPI_TABLE_FACS)
+ {
+ Status = AcpiTbVerifyTableChecksum (FullTable);
+
+#if (!ACPI_CHECKSUM_ABORT)
+ if (ACPI_FAILURE (Status))
+ {
+ /* Ignore the error if configuration says so */
+
+ Status = AE_OK;
+ }
+#endif
+ }
+
+ /* Return values */
+
+ TableInfo->Pointer = FullTable;
+ TableInfo->Length = (ACPI_SIZE) Header->Length;
+ TableInfo->Allocation = Allocation;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
+ FullTable->Signature,
+ ACPI_HIDWORD (Address->Pointer.Physical),
+ ACPI_LODWORD (Address->Pointer.Physical), FullTable));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTablePtr
+ *
+ * PARAMETERS: TableType - one of the defined table types
+ * Instance - Which table of this type
+ * TablePtrLoc - pointer to location to place the pointer for
+ * return
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the pointer to an ACPI table.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetTablePtr (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_TABLE_HEADER **TablePtrLoc)
+{
+ ACPI_TABLE_DESC *TableDesc;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetTablePtr");
+
+
+ if (!AcpiGbl_DSDT)
+ {
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ if (TableType > ACPI_TABLE_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * For all table types (Single/Multiple), the first
+ * instance is always in the list head.
+ */
+ if (Instance == 1)
+ {
+ /* Get the first */
+
+ if (AcpiGbl_TableLists[TableType].Next)
+ {
+ *TablePtrLoc = AcpiGbl_TableLists[TableType].Next->Pointer;
+ }
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Check for instance out of range
+ */
+ if (Instance > AcpiGbl_TableLists[TableType].Count)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Walk the list to get the desired table
+ * Since the if (Instance == 1) check above checked for the
+ * first table, setting TableDesc equal to the .Next member
+ * is actually pointing to the second table. Therefore, we
+ * need to walk from the 2nd table until we reach the Instance
+ * that the user is looking for and return its table pointer.
+ */
+ TableDesc = AcpiGbl_TableLists[TableType].Next;
+ for (i = 2; i < Instance; i++)
+ {
+ TableDesc = TableDesc->Next;
+ }
+
+ /* We are now pointing to the requested table's descriptor */
+
+ *TablePtrLoc = TableDesc->Pointer;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/tbgetall.c b/sys/contrib/dev/acpica/tbgetall.c
new file mode 100644
index 0000000..4ed22b0
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbgetall.c
@@ -0,0 +1,403 @@
+/******************************************************************************
+ *
+ * Module Name: tbgetall - Get all required ACPI tables
+ * $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBGETALL_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbgetall")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetPrimaryTable
+ *
+ * PARAMETERS: Address - Physical address of table to retrieve
+ * *TableInfo - Where the table info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Maps the physical address of table into a logical address
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetPrimaryTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetPrimaryTable");
+
+
+ /* Ignore a NULL address in the RSDT */
+
+ if (!Address->Pointer.Value)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Get the header in order to get signature and table size
+ */
+ Status = AcpiTbGetTableHeader (Address, &Header);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Clear the TableInfo */
+
+ ACPI_MEMSET (TableInfo, 0, sizeof (ACPI_TABLE_DESC));
+
+ /*
+ * Check the table signature and make sure it is recognized.
+ * Also checks the header checksum
+ */
+ TableInfo->Pointer = &Header;
+ Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_PRIMARY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the entire table */
+
+ Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the table */
+
+ Status = AcpiTbInstallTable (TableInfo);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetSecondaryTable
+ *
+ * PARAMETERS: Address - Physical address of table to retrieve
+ * *TableInfo - Where the table info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Maps the physical address of table into a logical address
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetSecondaryTable (
+ ACPI_POINTER *Address,
+ ACPI_STRING Signature,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+
+
+ ACPI_FUNCTION_TRACE_STR ("TbGetSecondaryTable", Signature);
+
+
+ /* Get the header in order to match the signature */
+
+ Status = AcpiTbGetTableHeader (Address, &Header);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Signature must match request */
+
+ if (ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE))
+ {
+ ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n",
+ Signature, Header.Signature));
+ return_ACPI_STATUS (AE_BAD_SIGNATURE);
+ }
+
+ /*
+ * Check the table signature and make sure it is recognized.
+ * Also checks the header checksum
+ */
+ TableInfo->Pointer = &Header;
+ Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_SECONDARY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the entire table */
+
+ Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the table */
+
+ Status = AcpiTbInstallTable (TableInfo);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetRequiredTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load and validate tables other than the RSDT. The RSDT must
+ * already be loaded and validated.
+ *
+ * Get the minimum set of ACPI tables, namely:
+ *
+ * 1) FADT (via RSDT in loop below)
+ * 2) FACS (via FADT)
+ * 3) DSDT (via FADT)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetRequiredTables (
+ void)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 i;
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_POINTER Address;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetRequiredTables");
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
+ AcpiGbl_RsdtTableCount));
+
+
+ Address.PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
+
+ /*
+ * Loop through all table pointers found in RSDT.
+ * This will NOT include the FACS and DSDT - we must get
+ * them after the loop.
+ *
+ * The only tables we are interested in getting here is the FADT and
+ * any SSDTs.
+ */
+ for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
+ {
+ /* Get the table address from the common internal XSDT */
+
+ Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[i]);
+
+ /*
+ * Get the tables needed by this subsystem (FADT and any SSDTs).
+ * NOTE: All other tables are completely ignored at this time.
+ */
+ Status = AcpiTbGetPrimaryTable (&Address, &TableInfo);
+ if ((Status != AE_OK) && (Status != AE_TABLE_NOT_SUPPORTED))
+ {
+ ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n",
+ AcpiFormatException (Status),
+ ACPI_HIDWORD (Address.Pointer.Value),
+ ACPI_LODWORD (Address.Pointer.Value)));
+ }
+ }
+
+ /* We must have a FADT to continue */
+
+ if (!AcpiGbl_FADT)
+ {
+ ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /*
+ * Convert the FADT to a common format. This allows earlier revisions of the
+ * table to coexist with newer versions, using common access code.
+ */
+ Status = AcpiTbConvertTableFadt ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n"));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Get the FACS (Pointed to by the FADT)
+ */
+ Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl);
+
+ Status = AcpiTbGetSecondaryTable (&Address, FACS_SIG, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Create the common FACS pointer table
+ * (Contains pointers to the original table)
+ */
+ Status = AcpiTbBuildCommonFacs (&TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Get/install the DSDT (Pointed to by the FADT)
+ */
+ Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt);
+
+ Status = AcpiTbGetSecondaryTable (&Address, DSDT_SIG, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not get/install the DSDT\n"));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Set Integer Width (32/64) based upon DSDT revision */
+
+ AcpiUtSetIntegerWidth (AcpiGbl_DSDT->Revision);
+
+ /* Dump the entire DSDT */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+ "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
+ AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length, AcpiGbl_IntegerBitWidth));
+ ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length);
+
+ /* Always delete the RSDP mapping, we are done with it */
+
+ AcpiTbDeleteTablesByType (ACPI_TABLE_RSDP);
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c
new file mode 100644
index 0000000..4471e80
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbinstal.c
@@ -0,0 +1,633 @@
+/******************************************************************************
+ *
+ * Module Name: tbinstal - ACPI table installation and removal
+ * $Revision: 69 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __TBINSTAL_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbinstal")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbMatchSignature
+ *
+ * PARAMETERS: Signature - Table signature to match
+ * TableInfo - Return data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compare signature against the list of "ACPI-subsystem-owned"
+ * tables (DSDT/FADT/SSDT, etc.) Returns the TableTypeID on match.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbMatchSignature (
+ char *Signature,
+ ACPI_TABLE_DESC *TableInfo,
+ UINT8 SearchType)
+{
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("TbMatchSignature");
+
+
+ /*
+ * Search for a signature match among the known table types
+ */
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ if (!(AcpiGbl_TableData[i].Flags & SearchType))
+ {
+ continue;
+ }
+
+ if (!ACPI_STRNCMP (Signature, AcpiGbl_TableData[i].Signature,
+ AcpiGbl_TableData[i].SigLength))
+ {
+ /* Found a signature match, return index if requested */
+
+ if (TableInfo)
+ {
+ TableInfo->Type = (UINT8) i;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
+ (char *) AcpiGbl_TableData[i].Signature));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
+ (char *) Signature));
+
+ return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbInstallTable
+ *
+ * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
+ * already be loaded and validated.
+ * Install the table into the global data structs.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbInstallTable (
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_STATUS Status;
+
+ ACPI_FUNCTION_TRACE ("TbInstallTable");
+
+
+ /* Lock tables while installing */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
+ TableInfo->Pointer->Signature, AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the table into the global data structure */
+
+ Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
+ TableInfo->Pointer->Signature, AcpiFormatException (Status)));
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
+ AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer));
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbRecognizeTable
+ *
+ * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check a table signature for a match against known table types
+ *
+ * NOTE: All table pointers are validated as follows:
+ * 1) Table pointer must point to valid physical memory
+ * 2) Signature must be 4 ASCII chars, even if we don't recognize the
+ * name
+ * 3) Table must be readable for length specified in the header
+ * 4) Table checksum must be valid (with the exception of the FACS
+ * which has no checksum for some odd reason)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbRecognizeTable (
+ ACPI_TABLE_DESC *TableInfo,
+ UINT8 SearchType)
+{
+ ACPI_TABLE_HEADER *TableHeader;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("TbRecognizeTable");
+
+
+ /* Ensure that we have a valid table pointer */
+
+ TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer;
+ if (!TableHeader)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * We only "recognize" a limited number of ACPI tables -- namely, the
+ * ones that are used by the subsystem (DSDT, FADT, etc.)
+ *
+ * An AE_TABLE_NOT_SUPPORTED means that the table was not recognized.
+ * This can be any one of many valid ACPI tables, it just isn't one of
+ * the tables that is consumed by the core subsystem
+ */
+ Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo, SearchType);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiTbValidateTableHeader (TableHeader);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Return the table type and length via the info struct */
+
+ TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbInitTableDescriptor
+ *
+ * PARAMETERS: TableType - The type of the table
+ * TableInfo - A table info struct
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Install a table into the global data structs.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbInitTableDescriptor (
+ ACPI_TABLE_TYPE TableType,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ ACPI_TABLE_LIST *ListHead;
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
+
+
+ /* Allocate a descriptor for this table */
+
+ TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
+ if (!TableDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Install the table into the global data structure
+ */
+ ListHead = &AcpiGbl_TableLists[TableType];
+
+ /*
+ * Two major types of tables: 1) Only one instance is allowed. This
+ * includes most ACPI tables such as the DSDT. 2) Multiple instances of
+ * the table are allowed. This includes SSDT and PSDTs.
+ */
+ if (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags))
+ {
+ /*
+ * Only one table allowed, and a table has alread been installed
+ * at this location, so return an error.
+ */
+ if (ListHead->Next)
+ {
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+ }
+
+ /*
+ * Link the new table in to the list of tables of this type.
+ * Just insert at the start of the list, order unimportant.
+ *
+ * TableDesc->Prev is already NULL from calloc()
+ */
+ TableDesc->Next = ListHead->Next;
+ ListHead->Next = TableDesc;
+
+ if (TableDesc->Next)
+ {
+ TableDesc->Next->Prev = TableDesc;
+ }
+
+ ListHead->Count++;
+
+ /* Finish initialization of the table descriptor */
+
+ TableDesc->Type = (UINT8) TableType;
+ TableDesc->Pointer = TableInfo->Pointer;
+ TableDesc->Length = TableInfo->Length;
+ TableDesc->Allocation = TableInfo->Allocation;
+ TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1),
+ TableDesc->AmlLength = (UINT32) (TableDesc->Length -
+ (UINT32) sizeof (ACPI_TABLE_HEADER));
+ TableDesc->TableId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_TABLE);
+ TableDesc->LoadedIntoNamespace = FALSE;
+
+ /*
+ * Set the appropriate global pointer (if there is one) to point to the
+ * newly installed table
+ */
+ if (AcpiGbl_TableData[TableType].GlobalPtr)
+ {
+ *(AcpiGbl_TableData[TableType].GlobalPtr) = TableInfo->Pointer;
+ }
+
+ /* Return Data */
+
+ TableInfo->TableId = TableDesc->TableId;
+ TableInfo->InstalledDesc = TableDesc;
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbDeleteAllTables
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete all internal ACPI tables
+ *
+ ******************************************************************************/
+
+void
+AcpiTbDeleteAllTables (void)
+{
+ ACPI_TABLE_TYPE Type;
+
+
+ /*
+ * Free memory allocated for ACPI tables
+ * Memory can either be mapped or allocated
+ */
+ for (Type = 0; Type < NUM_ACPI_TABLE_TYPES; Type++)
+ {
+ AcpiTbDeleteTablesByType (Type);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbDeleteTablesByType
+ *
+ * PARAMETERS: Type - The table type to be deleted
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete an internal ACPI table
+ * Locks the ACPI table mutex
+ *
+ ******************************************************************************/
+
+void
+AcpiTbDeleteTablesByType (
+ ACPI_TABLE_TYPE Type)
+{
+ ACPI_TABLE_DESC *TableDesc;
+ UINT32 Count;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("TbDeleteTablesByType", Type);
+
+
+ if (Type > ACPI_TABLE_MAX)
+ {
+ return_VOID;
+ }
+
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_TABLES)))
+ {
+ return;
+ }
+
+ /* Clear the appropriate "typed" global table pointer */
+
+ switch (Type)
+ {
+ case ACPI_TABLE_RSDP:
+ AcpiGbl_RSDP = NULL;
+ break;
+
+ case ACPI_TABLE_DSDT:
+ AcpiGbl_DSDT = NULL;
+ break;
+
+ case ACPI_TABLE_FADT:
+ AcpiGbl_FADT = NULL;
+ break;
+
+ case ACPI_TABLE_FACS:
+ AcpiGbl_FACS = NULL;
+ break;
+
+ case ACPI_TABLE_XSDT:
+ AcpiGbl_XSDT = NULL;
+ break;
+
+ case ACPI_TABLE_SSDT:
+ case ACPI_TABLE_PSDT:
+ default:
+ break;
+ }
+
+ /* Free the table */
+ /* Get the head of the list */
+
+ TableDesc = AcpiGbl_TableLists[Type].Next;
+ Count = AcpiGbl_TableLists[Type].Count;
+
+ /*
+ * Walk the entire list, deleting both the allocated tables
+ * and the table descriptors
+ */
+ for (i = 0; i < Count; i++)
+ {
+ TableDesc = AcpiTbUninstallTable (TableDesc);
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbDeleteSingleTable
+ *
+ * PARAMETERS: TableInfo - A table info struct
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Low-level free for a single ACPI table. Handles cases where
+ * the table was allocated a buffer or was mapped.
+ *
+ ******************************************************************************/
+
+void
+AcpiTbDeleteSingleTable (
+ ACPI_TABLE_DESC *TableDesc)
+{
+
+ /* Must have a valid table descriptor and pointer */
+
+ if ((!TableDesc) ||
+ (!TableDesc->Pointer))
+ {
+ return;
+ }
+
+ /* Valid table, determine type of memory allocation */
+
+ switch (TableDesc->Allocation)
+ {
+ case ACPI_MEM_NOT_ALLOCATED:
+ break;
+
+ case ACPI_MEM_ALLOCATED:
+
+ ACPI_MEM_FREE (TableDesc->Pointer);
+ break;
+
+ case ACPI_MEM_MAPPED:
+
+ AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbUninstallTable
+ *
+ * PARAMETERS: TableInfo - A table info struct
+ *
+ * RETURN: Pointer to the next table in the list (of same type)
+ *
+ * DESCRIPTION: Free the memory associated with an internal ACPI table that
+ * is either installed or has never been installed.
+ * Table mutex should be locked.
+ *
+ ******************************************************************************/
+
+ACPI_TABLE_DESC *
+AcpiTbUninstallTable (
+ ACPI_TABLE_DESC *TableDesc)
+{
+ ACPI_TABLE_DESC *NextDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("TbUninstallTable", TableDesc);
+
+
+ if (!TableDesc)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Unlink the descriptor from the doubly linked list */
+
+ if (TableDesc->Prev)
+ {
+ TableDesc->Prev->Next = TableDesc->Next;
+ }
+ else
+ {
+ /* Is first on list, update list head */
+
+ AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next;
+ }
+
+ if (TableDesc->Next)
+ {
+ TableDesc->Next->Prev = TableDesc->Prev;
+ }
+
+ /* Free the memory allocated for the table itself */
+
+ AcpiTbDeleteSingleTable (TableDesc);
+
+ /* Free the table descriptor */
+
+ NextDesc = TableDesc->Next;
+ ACPI_MEM_FREE (TableDesc);
+
+ /* Return pointer to the next descriptor */
+
+ return_PTR (NextDesc);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbrsdt.c b/sys/contrib/dev/acpica/tbrsdt.c
new file mode 100644
index 0000000..c93684c
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbrsdt.c
@@ -0,0 +1,406 @@
+/******************************************************************************
+ *
+ * Module Name: tbrsdt - ACPI RSDT table utilities
+ * $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBRSDT_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbrsdt")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbVerifyRsdp
+ *
+ * PARAMETERS: Address - RSDP (Pointer to RSDT)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbVerifyRsdp (
+ ACPI_POINTER *Address)
+{
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status;
+ RSDP_DESCRIPTOR *Rsdp;
+
+
+ ACPI_FUNCTION_TRACE ("TbVerifyRsdp");
+
+
+ switch (Address->PointerType)
+ {
+ case ACPI_LOGICAL_POINTER:
+
+ Rsdp = Address->Pointer.Logical;
+ break;
+
+ case ACPI_PHYSICAL_POINTER:
+ /*
+ * Obtain access to the RSDP structure
+ */
+ Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
+ (void **) &Rsdp);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ break;
+
+ default:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (ACPI_STRNCMP ((char *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ {
+ /* Nope, BAD Signature */
+
+ Status = AE_BAD_SIGNATURE;
+ goto Cleanup;
+ }
+
+ /* Check the standard checksum */
+
+ if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ {
+ Status = AE_BAD_CHECKSUM;
+ goto Cleanup;
+ }
+
+ /* Check extended checksum if table version >= 2 */
+
+ if (Rsdp->Revision >= 2)
+ {
+ if (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)
+ {
+ Status = AE_BAD_CHECKSUM;
+ goto Cleanup;
+ }
+ }
+
+ /* The RSDP supplied is OK */
+
+ TableInfo.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp);
+ TableInfo.Length = sizeof (RSDP_DESCRIPTOR);
+ TableInfo.Allocation = ACPI_MEM_MAPPED;
+
+ /* Save the table pointers and allocation info */
+
+ Status = AcpiTbInitTableDescriptor (ACPI_TABLE_RSDP, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Save the RSDP in a global for easy access */
+
+ AcpiGbl_RSDP = ACPI_CAST_PTR (RSDP_DESCRIPTOR, TableInfo.Pointer);
+ return_ACPI_STATUS (Status);
+
+
+ /* Error exit */
+Cleanup:
+
+ if (AcpiGbl_TableFlags & ACPI_PHYSICAL_POINTER)
+ {
+ AcpiOsUnmapMemory (Rsdp, sizeof (RSDP_DESCRIPTOR));
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetRsdtAddress
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: RSDT physical address
+ *
+ * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
+ * version of the RSDP
+ *
+ ******************************************************************************/
+
+void
+AcpiTbGetRsdtAddress (
+ ACPI_POINTER *OutAddress)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ OutAddress->PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
+
+ /*
+ * For RSDP revision 0 or 1, we use the RSDT.
+ * For RSDP revision 2 (and above), we use the XSDT
+ */
+ if (AcpiGbl_RSDP->Revision < 2)
+ {
+ OutAddress->Pointer.Value = AcpiGbl_RSDP->RsdtPhysicalAddress;
+ }
+ else
+ {
+ OutAddress->Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbValidateRsdt
+ *
+ * PARAMETERS: TablePtr - Addressable pointer to the RSDT.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate signature for the RSDT or XSDT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbValidateRsdt (
+ ACPI_TABLE_HEADER *TablePtr)
+{
+ int NoMatch;
+
+
+ ACPI_FUNCTION_NAME ("TbValidateRsdt");
+
+
+ /*
+ * For RSDP revision 0 or 1, we use the RSDT.
+ * For RSDP revision 2 and above, we use the XSDT
+ */
+ if (AcpiGbl_RSDP->Revision < 2)
+ {
+ NoMatch = ACPI_STRNCMP ((char *) TablePtr, RSDT_SIG,
+ sizeof (RSDT_SIG) -1);
+ }
+ else
+ {
+ NoMatch = ACPI_STRNCMP ((char *) TablePtr, XSDT_SIG,
+ sizeof (XSDT_SIG) -1);
+ }
+
+ if (NoMatch)
+ {
+ /* Invalid RSDT or XSDT signature */
+
+ ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+
+ ACPI_DUMP_BUFFER (AcpiGbl_RSDP, 20);
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
+ "RSDT/XSDT signature at %X (%p) is invalid\n",
+ AcpiGbl_RSDP->RsdtPhysicalAddress,
+ (void *) (ACPI_NATIVE_UINT) AcpiGbl_RSDP->RsdtPhysicalAddress));
+
+ return (AE_BAD_SIGNATURE);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGetTableRsdt
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbGetTableRsdt (
+ void)
+{
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status;
+ ACPI_POINTER Address;
+
+
+ ACPI_FUNCTION_TRACE ("TbGetTableRsdt");
+
+
+ /* Get the RSDT/XSDT via the RSDP */
+
+ AcpiTbGetRsdtAddress (&Address);
+
+ Status = AcpiTbGetTable (&Address, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
+ AcpiGbl_RSDP,
+ ACPI_HIDWORD (Address.Pointer.Value),
+ ACPI_LODWORD (Address.Pointer.Value)));
+
+ /* Check the RSDT or XSDT signature */
+
+ Status = AcpiTbValidateRsdt (TableInfo.Pointer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the number of tables defined in the RSDT or XSDT */
+
+ AcpiGbl_RsdtTableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo.Pointer);
+
+ /* Convert and/or copy to an XSDT structure */
+
+ Status = AcpiTbConvertToXsdt (&TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Save the table pointers and allocation info */
+
+ Status = AcpiTbInitTableDescriptor (ACPI_TABLE_XSDT, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", AcpiGbl_XSDT));
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c
new file mode 100644
index 0000000..c006a5b
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbutils.c
@@ -0,0 +1,322 @@
+/******************************************************************************
+ *
+ * Module Name: tbutils - Table manipulation utilities
+ * $Revision: 60 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBUTILS_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbHandleToObject
+ *
+ * PARAMETERS: TableId - Id for which the function is searching
+ * TableDesc - Pointer to return the matching table
+ * descriptor.
+ *
+ * RETURN: Search the tables to find one with a matching TableId and
+ * return a pointer to that table descriptor.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbHandleToObject (
+ UINT16 TableId,
+ ACPI_TABLE_DESC **ReturnTableDesc)
+{
+ UINT32 i;
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ ACPI_FUNCTION_NAME ("TbHandleToObject");
+
+
+ for (i = 0; i < ACPI_TABLE_MAX; i++)
+ {
+ TableDesc = AcpiGbl_TableLists[i].Next;
+ while (TableDesc)
+ {
+ if (TableDesc->TableId == TableId)
+ {
+ *ReturnTableDesc = TableDesc;
+ return (AE_OK);
+ }
+
+ TableDesc = TableDesc->Next;
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
+ return (AE_BAD_PARAMETER);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbValidateTableHeader
+ *
+ * PARAMETERS: TableHeader - Logical pointer to the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check an ACPI table header for validity
+ *
+ * NOTE: Table pointers are validated as follows:
+ * 1) Table pointer must point to valid physical memory
+ * 2) Signature must be 4 ASCII chars, even if we don't recognize the
+ * name
+ * 3) Table must be readable for length specified in the header
+ * 4) Table checksum must be valid (with the exception of the FACS
+ * which has no checksum because it contains variable fields)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbValidateTableHeader (
+ ACPI_TABLE_HEADER *TableHeader)
+{
+ ACPI_NAME Signature;
+
+
+ ACPI_FUNCTION_NAME ("TbValidateTableHeader");
+
+
+ /* Verify that this is a valid address */
+
+ if (!AcpiOsReadable (TableHeader, sizeof (ACPI_TABLE_HEADER)))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Cannot read table header at %p\n", TableHeader));
+ return (AE_BAD_ADDRESS);
+ }
+
+ /* Ensure that the signature is 4 ASCII characters */
+
+ ACPI_MOVE_32_TO_32 (&Signature, TableHeader->Signature);
+ if (!AcpiUtValidAcpiName (Signature))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Table signature at %p [%p] has invalid characters\n",
+ TableHeader, &Signature));
+
+ ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
+ (char *) &Signature));
+ ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Validate the table length */
+
+ if (TableHeader->Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid length in table header %p name %4.4s\n",
+ TableHeader, (char *) &Signature));
+
+ ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
+ (UINT32) TableHeader->Length));
+ ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_BAD_HEADER);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbVerifyTableChecksum
+ *
+ * PARAMETERS: *TableHeader - ACPI table to verify
+ *
+ * RETURN: 8 bit checksum of table
+ *
+ * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct
+ * table should have a checksum of 0.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbVerifyTableChecksum (
+ ACPI_TABLE_HEADER *TableHeader)
+{
+ UINT8 Checksum;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("TbVerifyTableChecksum");
+
+
+ /* Compute the checksum on the table */
+
+ Checksum = AcpiTbChecksum (TableHeader, TableHeader->Length);
+
+ /* Return the appropriate exception */
+
+ if (Checksum)
+ {
+ ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
+ TableHeader->Signature, (UINT32) TableHeader->Checksum, (UINT32) Checksum));
+
+ Status = AE_BAD_CHECKSUM;
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbChecksum
+ *
+ * PARAMETERS: Buffer - Buffer to checksum
+ * Length - Size of the buffer
+ *
+ * RETURNS 8 bit checksum of buffer
+ *
+ * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiTbChecksum (
+ void *Buffer,
+ UINT32 Length)
+{
+ const UINT8 *limit;
+ const UINT8 *rover;
+ UINT8 sum = 0;
+
+
+ if (Buffer && Length)
+ {
+ /* Buffer and Length are valid */
+
+ limit = (UINT8 *) Buffer + Length;
+
+ for (rover = Buffer; rover < limit; rover++)
+ {
+ sum = (UINT8) (sum + *rover);
+ }
+ }
+ return (sum);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c
new file mode 100644
index 0000000..ede9724
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbxface.c
@@ -0,0 +1,541 @@
+/******************************************************************************
+ *
+ * Module Name: tbxface - Public interfaces to the ACPI subsystem
+ * ACPI table oriented interfaces
+ * $Revision: 62 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBXFACE_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLoadTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to load the ACPI tables from the
+ * provided RSDT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLoadTables (void)
+{
+ ACPI_POINTER RsdpAddress;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiLoadTables");
+
+
+ /* Get the RSDP */
+
+ Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING,
+ &RsdpAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
+ AcpiFormatException (Status)));
+ goto ErrorExit;
+ }
+
+ /* Map and validate the RSDP */
+
+ AcpiGbl_TableFlags = RsdpAddress.PointerType;
+
+ Status = AcpiTbVerifyRsdp (&RsdpAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
+ AcpiFormatException (Status)));
+ goto ErrorExit;
+ }
+
+ /* Get the RSDT via the RSDP */
+
+ Status = AcpiTbGetTableRsdt ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
+ AcpiFormatException (Status)));
+ goto ErrorExit;
+ }
+
+ /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
+
+ Status = AcpiTbGetRequiredTables ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
+ AcpiFormatException (Status)));
+ goto ErrorExit;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
+
+
+ /* Load the namespace from the tables */
+
+ Status = AcpiNsLoadNamespace ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n",
+ AcpiFormatException (Status)));
+ goto ErrorExit;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+
+
+ErrorExit:
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n",
+ AcpiFormatException (Status)));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLoadTable
+ *
+ * PARAMETERS: TablePtr - pointer to a buffer containing the entire
+ * table to be loaded
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to load a table from the caller's
+ * buffer. The buffer must contain an entire ACPI Table including
+ * a valid header. The header fields will be verified, and if it
+ * is determined that the table is invalid, the call will fail.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLoadTable (
+ ACPI_TABLE_HEADER *TablePtr)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_POINTER Address;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiLoadTable");
+
+
+ if (!TablePtr)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Copy the table to a local buffer */
+
+ Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
+ Address.Pointer.Logical = TablePtr;
+
+ Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Install the new table into the local data structures */
+
+ Status = AcpiTbInstallTable (&TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Free table allocated by AcpiTbGetTableBody */
+
+ AcpiTbDeleteSingleTable (&TableInfo);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Convert the table to common format if necessary */
+
+ switch (TableInfo.Type)
+ {
+ case ACPI_TABLE_FADT:
+
+ Status = AcpiTbConvertTableFadt ();
+ break;
+
+ case ACPI_TABLE_FACS:
+
+ Status = AcpiTbBuildCommonFacs (&TableInfo);
+ break;
+
+ default:
+ /* Load table into namespace if it contains executable AML */
+
+ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
+ break;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* Uninstall table and free the buffer */
+
+ (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUnloadTable
+ *
+ * PARAMETERS: TableType - Type of table to be unloaded
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This routine is used to force the unload of a table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUnloadTable (
+ ACPI_TABLE_TYPE TableType)
+{
+ ACPI_TABLE_DESC *TableDesc;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiUnloadTable");
+
+
+ /* Parameter validation */
+
+ if (TableType > ACPI_TABLE_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+
+ /* Find all tables of the requested type */
+
+ TableDesc = AcpiGbl_TableLists[TableType].Next;
+ while (TableDesc);
+ {
+ /*
+ * Delete all namespace entries owned by this table. Note that these
+ * entries can appear anywhere in the namespace by virtue of the AML
+ * "Scope" operator. Thus, we need to track ownership by an ID, not
+ * simply a position within the hierarchy
+ */
+ AcpiNsDeleteNamespaceByOwner (TableDesc->TableId);
+
+ TableDesc = TableDesc->Next;
+ }
+
+ /* Delete (or unmap) all tables of this type */
+
+ AcpiTbDeleteTablesByType (TableType);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetTableHeader
+ *
+ * PARAMETERS: TableType - one of the defined table types
+ * Instance - the non zero instance of the table, allows
+ * support for multiple tables of the same type
+ * see AcpiGbl_AcpiTableFlag
+ * OutTableHeader - pointer to the ACPI_TABLE_HEADER if successful
+ *
+ * DESCRIPTION: This function is called to get an ACPI table header. The caller
+ * supplies an pointer to a data area sufficient to contain an ACPI
+ * ACPI_TABLE_HEADER structure.
+ *
+ * The header contains a length field that can be used to determine
+ * the size of the buffer needed to contain the entire table. This
+ * function is not valid for the RSD PTR table since it does not
+ * have a standard header and is fixed length.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetTableHeader (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_TABLE_HEADER *OutTableHeader)
+{
+ ACPI_TABLE_HEADER *TblPtr;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetTableHeader");
+
+
+ if ((Instance == 0) ||
+ (TableType == ACPI_TABLE_RSDP) ||
+ (!OutTableHeader))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Check the table type and instance */
+
+ if ((TableType > ACPI_TABLE_MAX) ||
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
+ Instance > 1))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+
+ /* Get a pointer to the entire table */
+
+ Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The function will return a NULL pointer if the table is not loaded
+ */
+ if (TblPtr == NULL)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /*
+ * Copy the header to the caller's buffer
+ */
+ ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr,
+ sizeof (ACPI_TABLE_HEADER));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetTable
+ *
+ * PARAMETERS: TableType - one of the defined table types
+ * Instance - the non zero instance of the table, allows
+ * support for multiple tables of the same type
+ * see AcpiGbl_AcpiTableFlag
+ * RetBuffer - pointer to a structure containing a buffer to
+ * receive the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get an ACPI table. The caller
+ * supplies an OutBuffer large enough to contain the entire ACPI
+ * table. The caller should call the AcpiGetTableHeader function
+ * first to determine the buffer size needed. Upon completion
+ * the OutBuffer->Length field will indicate the number of bytes
+ * copied into the OutBuffer->BufPtr buffer. This table will be
+ * a complete table including the header.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetTable (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_TABLE_HEADER *TblPtr;
+ ACPI_STATUS Status;
+ ACPI_SIZE TableLength;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetTable");
+
+
+ /* Parameter validation */
+
+ if (Instance == 0)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Check the table type and instance */
+
+ if ((TableType > ACPI_TABLE_MAX) ||
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
+ Instance > 1))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+
+ /* Get a pointer to the entire table */
+
+ Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * AcpiTbGetTablePtr will return a NULL pointer if the
+ * table is not loaded.
+ */
+ if (TblPtr == NULL)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Get the table length */
+
+ if (TableType == ACPI_TABLE_RSDP)
+ {
+ /*
+ * RSD PTR is the only "table" without a header
+ */
+ TableLength = sizeof (RSDP_DESCRIPTOR);
+ }
+ else
+ {
+ TableLength = (ACPI_SIZE) TblPtr->Length;
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (RetBuffer, TableLength);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Copy the table to the buffer */
+
+ ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c
new file mode 100644
index 0000000..42c39bc
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbxfroot.c
@@ -0,0 +1,611 @@
+/******************************************************************************
+ *
+ * Module Name: tbxfroot - Find the root ACPI table (RSDT)
+ * $Revision: 68 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __TBXFROOT_C__
+
+#include "acpi.h"
+#include "actables.h"
+
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbxfroot")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbFindTable
+ *
+ * PARAMETERS: Signature - String with ACPI table signature
+ * OemId - String with the table OEM ID
+ * OemTableId - String with the OEM Table ID.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
+ * Signature, OEM ID and OEM Table ID.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_TABLE_HEADER **TablePtr)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *Table;
+
+
+ ACPI_FUNCTION_TRACE ("TbFindTable");
+
+
+ /* Validate string lengths */
+
+ if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) ||
+ (ACPI_STRLEN (OemId) > sizeof (Table->OemId)) ||
+ (ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId)))
+ {
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+ }
+
+ /* Find the table */
+
+ Status = AcpiGetFirmwareTable (Signature, 1,
+ ACPI_LOGICAL_ADDRESSING, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Check OemId and OemTableId */
+
+ if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) ||
+ (OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId)))
+ {
+ return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
+ }
+
+ *TablePtr = Table;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetFirmwareTable
+ *
+ * PARAMETERS: Signature - Any ACPI table signature
+ * Instance - the non zero instance of the table, allows
+ * support for multiple tables of the same type
+ * Flags - Physical/Virtual support
+ * RetBuffer - pointer to a structure containing a buffer to
+ * receive the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get an ACPI table. The caller
+ * supplies an OutBuffer large enough to contain the entire ACPI
+ * table. Upon completion
+ * the OutBuffer->Length field will indicate the number of bytes
+ * copied into the OutBuffer->BufPtr buffer. This table will be
+ * a complete table including the header.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetFirmwareTable (
+ ACPI_STRING Signature,
+ UINT32 Instance,
+ UINT32 Flags,
+ ACPI_TABLE_HEADER **TablePointer)
+{
+ ACPI_POINTER RsdpAddress;
+ ACPI_POINTER Address;
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_TABLE_DESC RsdtInfo;
+ UINT32 TableCount;
+ UINT32 i;
+ UINT32 j;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetFirmwareTable");
+
+
+ /*
+ * Ensure that at least the table manager is initialized. We don't
+ * require that the entire ACPI subsystem is up for this interface
+ */
+
+ /*
+ * If we have a buffer, we must have a length too
+ */
+ if ((Instance == 0) ||
+ (!Signature) ||
+ (!TablePointer))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ RsdtInfo.Pointer = NULL;
+
+ if (!AcpiGbl_RSDP)
+ {
+ /* Get the RSDP */
+
+ Status = AcpiOsGetRootPointer (Flags, &RsdpAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /* Map and validate the RSDP */
+
+ if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ {
+ Status = AcpiOsMapMemory (RsdpAddress.Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
+ (void **) &AcpiGbl_RSDP);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ AcpiGbl_RSDP = RsdpAddress.Pointer.Logical;
+ }
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ {
+ /* Nope, BAD Signature */
+
+ return_ACPI_STATUS (AE_BAD_SIGNATURE);
+ }
+
+ if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ {
+ /* Nope, BAD Checksum */
+
+ return_ACPI_STATUS (AE_BAD_CHECKSUM);
+ }
+ }
+
+ /* Get the RSDT and validate it */
+
+ AcpiTbGetRsdtAddress (&Address);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
+ AcpiGbl_RSDP,
+ ACPI_HIDWORD (Address.Pointer.Value),
+ ACPI_LODWORD (Address.Pointer.Value)));
+
+ /* Insert ProcessorMode flags */
+
+ Address.PointerType |= Flags;
+
+ Status = AcpiTbGetTable (&Address, &RsdtInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiTbValidateRsdt (RsdtInfo.Pointer);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Get the number of table pointers within the RSDT */
+
+ TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo.Pointer);
+
+ Address.PointerType = AcpiGbl_TableFlags | Flags;
+
+ /*
+ * Search the RSDT/XSDT for the correct instance of the
+ * requested table
+ */
+ for (i = 0, j = 0; i < TableCount; i++)
+ {
+ /* Get the next table pointer, handle RSDT vs. XSDT */
+
+ if (AcpiGbl_RSDP->Revision < 2)
+ {
+ Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i];
+ }
+ else
+ {
+ Address.Pointer.Value = ACPI_GET_ADDRESS (
+ ((XSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]);
+ }
+
+ /* Get the table header */
+
+ Status = AcpiTbGetTableHeader (&Address, &Header);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Compare table signatures and table instance */
+
+ if (!ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE))
+ {
+ /* An instance of the table was found */
+
+ j++;
+ if (j >= Instance)
+ {
+ /* Found the correct instance, get the entire table */
+
+ Status = AcpiTbGetTableBody (&Address, &Header, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ *TablePointer = TableInfo.Pointer;
+ goto Cleanup;
+ }
+ }
+ }
+
+ /* Did not find the table */
+
+ Status = AE_NOT_EXIST;
+
+
+Cleanup:
+ AcpiOsUnmapMemory (RsdtInfo.Pointer, (ACPI_SIZE) RsdtInfo.Pointer->Length);
+ return_ACPI_STATUS (Status);
+}
+
+
+/* TBD: Move to a new file */
+
+#if ACPI_MACHINE_WIDTH != 16
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiFindRootPointer
+ *
+ * PARAMETERS: **RsdpAddress - Where to place the RSDP address
+ * Flags - Logical/Physical addressing
+ *
+ * RETURN: Status, Physical address of the RSDP
+ *
+ * DESCRIPTION: Find the RSDP
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiFindRootPointer (
+ UINT32 Flags,
+ ACPI_POINTER *RsdpAddress)
+{
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiFindRootPointer");
+
+
+ /* Get the RSDP */
+
+ Status = AcpiTbFindRsdp (&TableInfo, Flags);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n",
+ AcpiFormatException (Status), Flags));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER;
+ RsdpAddress->Pointer.Physical = TableInfo.PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbScanMemoryForRsdp
+ *
+ * PARAMETERS: StartAddress - Starting pointer for search
+ * Length - Maximum length to search
+ *
+ * RETURN: Pointer to the RSDP if found, otherwise NULL.
+ *
+ * DESCRIPTION: Search a block of memory for the RSDP signature
+ *
+ ******************************************************************************/
+
+UINT8 *
+AcpiTbScanMemoryForRsdp (
+ UINT8 *StartAddress,
+ UINT32 Length)
+{
+ UINT32 Offset;
+ UINT8 *MemRover;
+
+
+ ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
+
+
+ /* Search from given start addr for the requested length */
+
+ for (Offset = 0, MemRover = StartAddress;
+ Offset < Length;
+ Offset += ACPI_RSDP_SCAN_STEP, MemRover += ACPI_RSDP_SCAN_STEP)
+ {
+
+ /* The signature and checksum must both be correct */
+
+ if (ACPI_STRNCMP ((char *) MemRover,
+ RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
+ AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH) == 0)
+ {
+ /* If so, we have found the RSDP */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at physical address %p\n",MemRover));
+ return_PTR (MemRover);
+ }
+ }
+
+ /* Searched entire block, no RSDP was found */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
+ return_PTR (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbFindRsdp
+ *
+ * PARAMETERS: *TableInfo - Where the table info is returned
+ * Flags - Current memory mode (logical vs.
+ * physical addressing)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
+ * pointer structure. If it is found, set *RSDP to point to it.
+ *
+ * NOTE: The RSDP must be either in the first 1K of the Extended
+ * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
+ * 5.2.2; assertion #421).
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbFindRsdp (
+ ACPI_TABLE_DESC *TableInfo,
+ UINT32 Flags)
+{
+ UINT8 *TablePtr;
+ UINT8 *MemRover;
+ UINT64 PhysAddr;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("TbFindRsdp");
+
+
+ /*
+ * Scan supports either 1) Logical addressing or 2) Physical addressing
+ */
+ if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE,
+ (void **) &TablePtr);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
+ ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE));
+ return_ACPI_STATUS (Status);
+ }
+
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
+
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ PhysAddr = ACPI_LO_RSDP_WINDOW_BASE;
+ PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr);
+
+ TableInfo->PhysicalAddress = PhysAddr;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE,
+ (void **) &TablePtr);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
+ ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
+ return_ACPI_STATUS (Status);
+ }
+
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
+
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ PhysAddr = ACPI_HI_RSDP_WINDOW_BASE;
+ PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr);
+
+ TableInfo->PhysicalAddress = PhysAddr;
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /*
+ * Physical addressing
+ */
+ else
+ {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
+ ACPI_LO_RSDP_WINDOW_SIZE);
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
+ ACPI_HI_RSDP_WINDOW_SIZE);
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /* RSDP signature was not found */
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c
new file mode 100644
index 0000000..a05795d
--- /dev/null
+++ b/sys/contrib/dev/acpica/utalloc.c
@@ -0,0 +1,1119 @@
+/******************************************************************************
+ *
+ * Module Name: utalloc - local cache and memory allocation routines
+ * $Revision: 131 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTALLOC_C__
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utalloc")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtReleaseToCache
+ *
+ * PARAMETERS: ListId - Memory list/cache ID
+ * Object - The object to be released
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Release an object to the specified cache. If cache is full,
+ * the object is deleted.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtReleaseToCache (
+ UINT32 ListId,
+ void *Object)
+{
+ ACPI_MEMORY_LIST *CacheInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* If walk cache is full, just free this wallkstate object */
+
+ CacheInfo = &AcpiGbl_MemoryLists[ListId];
+ if (CacheInfo->CacheDepth >= CacheInfo->MaxCacheDepth)
+ {
+ ACPI_MEM_FREE (Object);
+ ACPI_MEM_TRACKING (CacheInfo->TotalFreed++);
+ }
+
+ /* Otherwise put this object back into the cache */
+
+ else
+ {
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return;
+ }
+
+ /* Mark the object as cached */
+
+ ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize);
+ ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
+
+ /* Put the object at the head of the cache list */
+
+ * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead;
+ CacheInfo->ListHead = Object;
+ CacheInfo->CacheDepth++;
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtAcquireFromCache
+ *
+ * PARAMETERS: ListId - Memory list ID
+ *
+ * RETURN: A requested object. NULL if the object could not be
+ * allocated.
+ *
+ * DESCRIPTION: Get an object from the specified cache. If cache is empty,
+ * the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAcquireFromCache (
+ UINT32 ListId)
+{
+ ACPI_MEMORY_LIST *CacheInfo;
+ void *Object;
+
+
+ ACPI_FUNCTION_NAME ("UtAcquireFromCache");
+
+
+ CacheInfo = &AcpiGbl_MemoryLists[ListId];
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
+
+ ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
+
+ /* Check the cache first */
+
+ if (CacheInfo->ListHead)
+ {
+ /* There is an object available, use it */
+
+ Object = CacheInfo->ListHead;
+ CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset])));
+
+ ACPI_MEM_TRACKING (CacheInfo->CacheHits++);
+ CacheInfo->CacheDepth--;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
+ Object, AcpiGbl_MemoryLists[ListId].ListName));
+#endif
+
+ if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
+
+ /* Clear (zero) the previously used Object */
+
+ ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize);
+ }
+
+ else
+ {
+ /* The cache is empty, create a new object */
+
+ /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+
+ if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
+
+ Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
+ ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
+ }
+
+ return (Object);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteGenericCache
+ *
+ * PARAMETERS: ListId - Memory list ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteGenericCache (
+ UINT32 ListId)
+{
+ ACPI_MEMORY_LIST *CacheInfo;
+ char *Next;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ CacheInfo = &AcpiGbl_MemoryLists[ListId];
+ while (CacheInfo->ListHead)
+ {
+ /* Delete one cached state object */
+
+ Next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) CacheInfo->ListHead)[CacheInfo->LinkOffset])));
+ ACPI_MEM_FREE (CacheInfo->ListHead);
+
+ CacheInfo->ListHead = Next;
+ CacheInfo->CacheDepth--;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidateBuffer
+ *
+ * PARAMETERS: Buffer - Buffer descriptor to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform parameter validation checks on an ACPI_BUFFER
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtValidateBuffer (
+ ACPI_BUFFER *Buffer)
+{
+
+ /* Obviously, the structure pointer must be valid */
+
+ if (!Buffer)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Special semantics for the length */
+
+ if ((Buffer->Length == ACPI_NO_BUFFER) ||
+ (Buffer->Length == ACPI_ALLOCATE_BUFFER) ||
+ (Buffer->Length == ACPI_ALLOCATE_LOCAL_BUFFER))
+ {
+ return (AE_OK);
+ }
+
+ /* Length is valid, the buffer pointer must be also */
+
+ if (!Buffer->Pointer)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtInitializeBuffer
+ *
+ * PARAMETERS: RequiredLength - Length needed
+ * Buffer - Buffer to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate that the buffer is of the required length or
+ * allocate a new buffer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtInitializeBuffer (
+ ACPI_BUFFER *Buffer,
+ ACPI_SIZE RequiredLength)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ switch (Buffer->Length)
+ {
+ case ACPI_NO_BUFFER:
+
+ /* Set the exception and returned the required length */
+
+ Status = AE_BUFFER_OVERFLOW;
+ break;
+
+
+ case ACPI_ALLOCATE_BUFFER:
+
+ /* Allocate a new buffer */
+
+ Buffer->Pointer = AcpiOsAllocate (RequiredLength);
+ if (!Buffer->Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+ break;
+
+
+ case ACPI_ALLOCATE_LOCAL_BUFFER:
+
+ /* Allocate a new buffer with local interface to allow tracking */
+
+ Buffer->Pointer = ACPI_MEM_ALLOCATE (RequiredLength);
+ if (!Buffer->Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+ break;
+
+
+ default:
+
+ /* Validate the size of the buffer */
+
+ if (Buffer->Length < RequiredLength)
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ }
+ break;
+ }
+
+ Buffer->Length = RequiredLength;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocate
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtAllocate", Size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtAllocate: Attempt to allocate zero bytes\n"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocate (Size);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtAllocate: Could not allocate size %X\n", (UINT32) Size));
+
+ return_PTR (NULL);
+ }
+
+ return_PTR (Allocation);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCallocate
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtCallocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtCallocate", Size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Attempt to allocate zero bytes\n"));
+ return_PTR (NULL);
+ }
+
+ Allocation = AcpiOsAllocate (Size);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
+ return_PTR (NULL);
+ }
+
+ /* Clear the memory block */
+
+ ACPI_MEMSET (Allocation, 0, Size);
+ return_PTR (Allocation);
+}
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+/*
+ * These procedures are used for tracking memory leaks in the subsystem, and
+ * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
+ *
+ * Each memory allocation is tracked via a doubly linked list. Each
+ * element contains the caller's component, module name, function name, and
+ * line number. AcpiUtAllocate and AcpiUtCallocate call
+ * AcpiUtTrackAllocation to add an element to the list; deletion
+ * occurs in the body of AcpiUtFree.
+ */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component,
+ Module, Line);
+ if (!Allocation)
+ {
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ ACPI_MEM_MALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCallocateAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtCallocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component,
+ Module, Line);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ ACPI_MEM_CALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFreeAndTrack
+ *
+ * PARAMETERS: Allocation - Address of the memory to deallocate
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Frees the memory at Allocation
+ *
+ ******************************************************************************/
+
+void
+AcpiUtFreeAndTrack (
+ void *Allocation,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *DebugBlock;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation);
+
+
+ if (NULL == Allocation)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("AcpiUtFree: Attempt to delete a NULL address\n"));
+
+ return_VOID;
+ }
+
+ DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
+ (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size;
+
+ Status = AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock,
+ Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
+ AcpiFormatException (Status)));
+ }
+
+ AcpiOsFree (DebugBlock);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFindAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ *
+ * RETURN: A list element if found; NULL otherwise.
+ *
+ * DESCRIPTION: Searches for an element in the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+ACPI_DEBUG_MEM_BLOCK *
+AcpiUtFindAllocation (
+ UINT32 ListId,
+ void *Allocation)
+{
+ ACPI_DEBUG_MEM_BLOCK *Element;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (ListId > ACPI_MEM_LIST_MAX)
+ {
+ return (NULL);
+ }
+
+ Element = AcpiGbl_MemoryLists[ListId].ListHead;
+
+ /* Search for the address. */
+
+ while (Element)
+ {
+ if (Element == Allocation)
+ {
+ return (Element);
+ }
+
+ Element = Element->Next;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtTrackAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ * Size - Size of the allocation
+ * AllocType - MEM_MALLOC or MEM_CALLOC
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Inserts an element into the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtTrackAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
+ ACPI_SIZE Size,
+ UINT8 AllocType,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_MEMORY_LIST *MemList;
+ ACPI_DEBUG_MEM_BLOCK *Element;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtTrackAllocation", Allocation);
+
+
+ if (ListId > ACPI_MEM_LIST_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ MemList = &AcpiGbl_MemoryLists[ListId];
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Search list for this address to make sure it is not already on the list.
+ * This will catch several kinds of problems.
+ */
+
+ Element = AcpiUtFindAllocation (ListId, Allocation);
+ if (Element)
+ {
+ ACPI_REPORT_ERROR (("UtTrackAllocation: Allocation already present in list! (%p)\n",
+ Allocation));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", Element, Allocation));
+
+ goto UnlockAndExit;
+ }
+
+ /* Fill in the instance data. */
+
+ Allocation->Size = (UINT32) Size;
+ Allocation->AllocType = AllocType;
+ Allocation->Component = Component;
+ Allocation->Line = Line;
+
+ ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
+
+ /* Insert at list head */
+
+ if (MemList->ListHead)
+ {
+ ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
+ }
+
+ Allocation->Next = MemList->ListHead;
+ Allocation->Previous = NULL;
+
+ MemList->ListHead = Allocation;
+
+
+UnlockAndExit:
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtRemoveAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Deletes an element from the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtRemoveAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_MEMORY_LIST *MemList;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtRemoveAllocation");
+
+
+ if (ListId > ACPI_MEM_LIST_MAX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ MemList = &AcpiGbl_MemoryLists[ListId];
+ if (NULL == MemList->ListHead)
+ {
+ /* No allocations! */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtRemoveAllocation: Empty allocation list, nothing to free!\n"));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Unlink */
+
+ if (Allocation->Previous)
+ {
+ (Allocation->Previous)->Next = Allocation->Next;
+ }
+ else
+ {
+ MemList->ListHead = Allocation->Next;
+ }
+
+ if (Allocation->Next)
+ {
+ (Allocation->Next)->Previous = Allocation->Previous;
+ }
+
+ /* Mark the segment as deleted */
+
+ ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Allocation->Size));
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpAllocationInfo
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print some info about the outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpAllocationInfo (
+ void)
+{
+/*
+ ACPI_MEMORY_LIST *MemList;
+*/
+
+ ACPI_FUNCTION_TRACE ("UtDumpAllocationInfo");
+
+/*
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Current allocations",
+ MemList->CurrentCount,
+ ROUND_UP_TO_1K (MemList->CurrentSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
+ MemList->MaxConcurrentCount,
+ ROUND_UP_TO_1K (MemList->MaxConcurrentSize)));
+
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
+ RunningObjectCount,
+ ROUND_UP_TO_1K (RunningObjectSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
+ RunningAllocCount,
+ ROUND_UP_TO_1K (RunningAllocSize)));
+
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Current Nodes",
+ AcpiGbl_CurrentNodeCount,
+ ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Max Nodes",
+ AcpiGbl_MaxConcurrentNodeCount,
+ ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * sizeof (ACPI_NAMESPACE_NODE)))));
+*/
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpAllocations
+ *
+ * PARAMETERS: Component - Component(s) to dump info for.
+ * Module - Module to dump info for. NULL means all.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print a list of all outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpAllocations (
+ UINT32 Component,
+ char *Module)
+{
+ ACPI_DEBUG_MEM_BLOCK *Element;
+ ACPI_DESCRIPTOR *Descriptor;
+ UINT32 NumOutstanding = 0;
+
+
+ ACPI_FUNCTION_TRACE ("UtDumpAllocations");
+
+
+ /*
+ * Walk the allocation list.
+ */
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
+ {
+ return;
+ }
+
+ Element = AcpiGbl_MemoryLists[0].ListHead;
+ while (Element)
+ {
+ if ((Element->Component & Component) &&
+ ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
+ {
+ /* Ignore allocated objects that are in a cache */
+
+ Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
+ if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED)
+ {
+ AcpiOsPrintf ("%p Len %04X %9.9s-%d ",
+ Descriptor, Element->Size, Element->Module,
+ Element->Line);
+
+ /* Most of the elements will be internal objects. */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiOsPrintf ("ObjType %12.12s R%hd",
+ AcpiUtGetTypeName (Descriptor->Object.Common.Type),
+ Descriptor->Object.Common.ReferenceCount);
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+ AcpiOsPrintf ("ParseObj AmlOpcode %04hX",
+ Descriptor->Op.Asl.AmlOpcode);
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiOsPrintf ("Node %4.4s",
+ Descriptor->Node.Name.Ascii);
+ break;
+
+ case ACPI_DESC_TYPE_STATE:
+ AcpiOsPrintf ("Untyped StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_UPDATE:
+ AcpiOsPrintf ("UPDATE StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_PACKAGE:
+ AcpiOsPrintf ("PACKAGE StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_CONTROL:
+ AcpiOsPrintf ("CONTROL StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_RPSCOPE:
+ AcpiOsPrintf ("ROOT-PARSE-SCOPE StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_PSCOPE:
+ AcpiOsPrintf ("PARSE-SCOPE StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_WSCOPE:
+ AcpiOsPrintf ("WALK-SCOPE StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_RESULT:
+ AcpiOsPrintf ("RESULT StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_NOTIFY:
+ AcpiOsPrintf ("NOTIFY StateObj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_THREAD:
+ AcpiOsPrintf ("THREAD StateObj");
+ break;
+
+ default:
+ /* All types should appear above */
+ break;
+ }
+
+ AcpiOsPrintf ( "\n");
+ NumOutstanding++;
+ }
+ }
+ Element = Element->Next;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+
+ /* Print summary */
+
+ if (!NumOutstanding)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No outstanding allocations.\n"));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "%d(%X) Outstanding allocations\n",
+ NumOutstanding, NumOutstanding));
+ }
+
+ return_VOID;
+}
+
+
+#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
+
diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c
new file mode 100644
index 0000000..42b6422
--- /dev/null
+++ b/sys/contrib/dev/acpica/utclib.c
@@ -0,0 +1,892 @@
+/******************************************************************************
+ *
+ * Module Name: cmclib - Local implementation of C library functions
+ * $Revision: 51 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __CMCLIB_C__
+
+#include "acpi.h"
+
+/*
+ * These implementations of standard C Library routines can optionally be
+ * used if a C library is not available. In general, they are less efficient
+ * than an inline or assembly implementation
+ */
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("cmclib")
+
+
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+
+/*******************************************************************************
+ *
+ * FUNCTION: strlen
+ *
+ * PARAMETERS: String - Null terminated string
+ *
+ * RETURN: Length
+ *
+ * DESCRIPTION: Returns the length of the input string
+ *
+ ******************************************************************************/
+
+
+ACPI_SIZE
+AcpiUtStrlen (
+ const char *String)
+{
+ UINT32 Length = 0;
+
+
+ /* Count the string until a null is encountered */
+
+ while (*String)
+ {
+ Length++;
+ String++;
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strcpy
+ *
+ * PARAMETERS: DstString - Target of the copy
+ * SrcString - The source string to copy
+ *
+ * RETURN: DstString
+ *
+ * DESCRIPTION: Copy a null terminated string
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrcpy (
+ char *DstString,
+ const char *SrcString)
+{
+ char *String = DstString;
+
+
+ /* Move bytes brute force */
+
+ while (*SrcString)
+ {
+ *String = *SrcString;
+
+ String++;
+ SrcString++;
+ }
+
+ /* Null terminate */
+
+ *String = 0;
+ return (DstString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strncpy
+ *
+ * PARAMETERS: DstString - Target of the copy
+ * SrcString - The source string to copy
+ * Count - Maximum # of bytes to copy
+ *
+ * RETURN: DstString
+ *
+ * DESCRIPTION: Copy a null terminated string, with a maximum length
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrncpy (
+ char *DstString,
+ const char *SrcString,
+ ACPI_SIZE Count)
+{
+ char *String = DstString;
+
+
+ /* Copy the string */
+
+ for (String = DstString;
+ Count && (Count--, (*String++ = *SrcString++)); )
+ {;}
+
+ /* Pad with nulls if necessary */
+
+ while (Count--)
+ {
+ *String = 0;
+ String++;
+ }
+
+ /* Return original pointer */
+
+ return (DstString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strcmp
+ *
+ * PARAMETERS: String1 - First string
+ * String2 - Second string
+ *
+ * RETURN: Index where strings mismatched, or 0 if strings matched
+ *
+ * DESCRIPTION: Compare two null terminated strings
+ *
+ ******************************************************************************/
+
+int
+AcpiUtStrcmp (
+ const char *String1,
+ const char *String2)
+{
+
+
+ for ( ; (*String1 == *String2); String2++)
+ {
+ if (!*String1++)
+ {
+ return (0);
+ }
+ }
+
+ return ((unsigned char) *String1 - (unsigned char) *String2);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strncmp
+ *
+ * PARAMETERS: String1 - First string
+ * String2 - Second string
+ * Count - Maximum # of bytes to compare
+ *
+ * RETURN: Index where strings mismatched, or 0 if strings matched
+ *
+ * DESCRIPTION: Compare two null terminated strings, with a maximum length
+ *
+ ******************************************************************************/
+
+int
+AcpiUtStrncmp (
+ const char *String1,
+ const char *String2,
+ ACPI_SIZE Count)
+{
+
+
+ for ( ; Count-- && (*String1 == *String2); String2++)
+ {
+ if (!*String1++)
+ {
+ return (0);
+ }
+ }
+
+ return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
+ (unsigned char) *String2));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Strcat
+ *
+ * PARAMETERS: DstString - Target of the copy
+ * SrcString - The source string to copy
+ *
+ * RETURN: DstString
+ *
+ * DESCRIPTION: Append a null terminated string to a null terminated string
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrcat (
+ char *DstString,
+ const char *SrcString)
+{
+ char *String;
+
+
+ /* Find end of the destination string */
+
+ for (String = DstString; *String++; )
+ { ; }
+
+ /* Concatenate the string */
+
+ for (--String; (*String++ = *SrcString++); )
+ { ; }
+
+ return (DstString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strncat
+ *
+ * PARAMETERS: DstString - Target of the copy
+ * SrcString - The source string to copy
+ * Count - Maximum # of bytes to copy
+ *
+ * RETURN: DstString
+ *
+ * DESCRIPTION: Append a null terminated string to a null terminated string,
+ * with a maximum count.
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrncat (
+ char *DstString,
+ const char *SrcString,
+ ACPI_SIZE Count)
+{
+ char *String;
+
+
+ if (Count)
+ {
+ /* Find end of the destination string */
+
+ for (String = DstString; *String++; )
+ { ; }
+
+ /* Concatenate the string */
+
+ for (--String; (*String++ = *SrcString++) && --Count; )
+ { ; }
+
+ /* Null terminate if necessary */
+
+ if (!Count)
+ {
+ *String = 0;
+ }
+ }
+
+ return (DstString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: memcpy
+ *
+ * PARAMETERS: Dest - Target of the copy
+ * Src - Source buffer to copy
+ * Count - Number of bytes to copy
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Copy arbitrary bytes of memory
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtMemcpy (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+ char *Old = (char *) Src;
+
+
+ while (Count)
+ {
+ *New = *Old;
+ New++;
+ Old++;
+ Count--;
+ }
+
+ return (Dest);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: memset
+ *
+ * PARAMETERS: Dest - Buffer to set
+ * Value - Value to set each byte of memory
+ * Count - Number of bytes to set
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Initialize a buffer to a known value.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtMemset (
+ void *Dest,
+ ACPI_NATIVE_UINT Value,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+
+
+ while (Count)
+ {
+ *New = (char) Value;
+ New++;
+ Count--;
+ }
+
+ return (Dest);
+}
+
+
+#define NEGATIVE 1
+#define POSITIVE 0
+
+const UINT8 _acpi_ctype[257] = {
+ _ACPI_CN, /* 0x0 0. */
+ _ACPI_CN, /* 0x1 1. */
+ _ACPI_CN, /* 0x2 2. */
+ _ACPI_CN, /* 0x3 3. */
+ _ACPI_CN, /* 0x4 4. */
+ _ACPI_CN, /* 0x5 5. */
+ _ACPI_CN, /* 0x6 6. */
+ _ACPI_CN, /* 0x7 7. */
+ _ACPI_CN, /* 0x8 8. */
+ _ACPI_CN|_ACPI_SP, /* 0x9 9. */
+ _ACPI_CN|_ACPI_SP, /* 0xA 10. */
+ _ACPI_CN|_ACPI_SP, /* 0xB 11. */
+ _ACPI_CN|_ACPI_SP, /* 0xC 12. */
+ _ACPI_CN|_ACPI_SP, /* 0xD 13. */
+ _ACPI_CN, /* 0xE 14. */
+ _ACPI_CN, /* 0xF 15. */
+ _ACPI_CN, /* 0x10 16. */
+ _ACPI_CN, /* 0x11 17. */
+ _ACPI_CN, /* 0x12 18. */
+ _ACPI_CN, /* 0x13 19. */
+ _ACPI_CN, /* 0x14 20. */
+ _ACPI_CN, /* 0x15 21. */
+ _ACPI_CN, /* 0x16 22. */
+ _ACPI_CN, /* 0x17 23. */
+ _ACPI_CN, /* 0x18 24. */
+ _ACPI_CN, /* 0x19 25. */
+ _ACPI_CN, /* 0x1A 26. */
+ _ACPI_CN, /* 0x1B 27. */
+ _ACPI_CN, /* 0x1C 28. */
+ _ACPI_CN, /* 0x1D 29. */
+ _ACPI_CN, /* 0x1E 30. */
+ _ACPI_CN, /* 0x1F 31. */
+ _ACPI_XS|_ACPI_SP, /* 0x20 32. ' ' */
+ _ACPI_PU, /* 0x21 33. '!' */
+ _ACPI_PU, /* 0x22 34. '"' */
+ _ACPI_PU, /* 0x23 35. '#' */
+ _ACPI_PU, /* 0x24 36. '$' */
+ _ACPI_PU, /* 0x25 37. '%' */
+ _ACPI_PU, /* 0x26 38. '&' */
+ _ACPI_PU, /* 0x27 39. ''' */
+ _ACPI_PU, /* 0x28 40. '(' */
+ _ACPI_PU, /* 0x29 41. ')' */
+ _ACPI_PU, /* 0x2A 42. '*' */
+ _ACPI_PU, /* 0x2B 43. '+' */
+ _ACPI_PU, /* 0x2C 44. ',' */
+ _ACPI_PU, /* 0x2D 45. '-' */
+ _ACPI_PU, /* 0x2E 46. '.' */
+ _ACPI_PU, /* 0x2F 47. '/' */
+ _ACPI_XD|_ACPI_DI, /* 0x30 48. '0' */
+ _ACPI_XD|_ACPI_DI, /* 0x31 49. '1' */
+ _ACPI_XD|_ACPI_DI, /* 0x32 50. '2' */
+ _ACPI_XD|_ACPI_DI, /* 0x33 51. '3' */
+ _ACPI_XD|_ACPI_DI, /* 0x34 52. '4' */
+ _ACPI_XD|_ACPI_DI, /* 0x35 53. '5' */
+ _ACPI_XD|_ACPI_DI, /* 0x36 54. '6' */
+ _ACPI_XD|_ACPI_DI, /* 0x37 55. '7' */
+ _ACPI_XD|_ACPI_DI, /* 0x38 56. '8' */
+ _ACPI_XD|_ACPI_DI, /* 0x39 57. '9' */
+ _ACPI_PU, /* 0x3A 58. ':' */
+ _ACPI_PU, /* 0x3B 59. ';' */
+ _ACPI_PU, /* 0x3C 60. '<' */
+ _ACPI_PU, /* 0x3D 61. '=' */
+ _ACPI_PU, /* 0x3E 62. '>' */
+ _ACPI_PU, /* 0x3F 63. '?' */
+ _ACPI_PU, /* 0x40 64. '@' */
+ _ACPI_XD|_ACPI_UP, /* 0x41 65. 'A' */
+ _ACPI_XD|_ACPI_UP, /* 0x42 66. 'B' */
+ _ACPI_XD|_ACPI_UP, /* 0x43 67. 'C' */
+ _ACPI_XD|_ACPI_UP, /* 0x44 68. 'D' */
+ _ACPI_XD|_ACPI_UP, /* 0x45 69. 'E' */
+ _ACPI_XD|_ACPI_UP, /* 0x46 70. 'F' */
+ _ACPI_UP, /* 0x47 71. 'G' */
+ _ACPI_UP, /* 0x48 72. 'H' */
+ _ACPI_UP, /* 0x49 73. 'I' */
+ _ACPI_UP, /* 0x4A 74. 'J' */
+ _ACPI_UP, /* 0x4B 75. 'K' */
+ _ACPI_UP, /* 0x4C 76. 'L' */
+ _ACPI_UP, /* 0x4D 77. 'M' */
+ _ACPI_UP, /* 0x4E 78. 'N' */
+ _ACPI_UP, /* 0x4F 79. 'O' */
+ _ACPI_UP, /* 0x50 80. 'P' */
+ _ACPI_UP, /* 0x51 81. 'Q' */
+ _ACPI_UP, /* 0x52 82. 'R' */
+ _ACPI_UP, /* 0x53 83. 'S' */
+ _ACPI_UP, /* 0x54 84. 'T' */
+ _ACPI_UP, /* 0x55 85. 'U' */
+ _ACPI_UP, /* 0x56 86. 'V' */
+ _ACPI_UP, /* 0x57 87. 'W' */
+ _ACPI_UP, /* 0x58 88. 'X' */
+ _ACPI_UP, /* 0x59 89. 'Y' */
+ _ACPI_UP, /* 0x5A 90. 'Z' */
+ _ACPI_PU, /* 0x5B 91. '[' */
+ _ACPI_PU, /* 0x5C 92. '\' */
+ _ACPI_PU, /* 0x5D 93. ']' */
+ _ACPI_PU, /* 0x5E 94. '^' */
+ _ACPI_PU, /* 0x5F 95. '_' */
+ _ACPI_PU, /* 0x60 96. '`' */
+ _ACPI_XD|_ACPI_LO, /* 0x61 97. 'a' */
+ _ACPI_XD|_ACPI_LO, /* 0x62 98. 'b' */
+ _ACPI_XD|_ACPI_LO, /* 0x63 99. 'c' */
+ _ACPI_XD|_ACPI_LO, /* 0x64 100. 'd' */
+ _ACPI_XD|_ACPI_LO, /* 0x65 101. 'e' */
+ _ACPI_XD|_ACPI_LO, /* 0x66 102. 'f' */
+ _ACPI_LO, /* 0x67 103. 'g' */
+ _ACPI_LO, /* 0x68 104. 'h' */
+ _ACPI_LO, /* 0x69 105. 'i' */
+ _ACPI_LO, /* 0x6A 106. 'j' */
+ _ACPI_LO, /* 0x6B 107. 'k' */
+ _ACPI_LO, /* 0x6C 108. 'l' */
+ _ACPI_LO, /* 0x6D 109. 'm' */
+ _ACPI_LO, /* 0x6E 110. 'n' */
+ _ACPI_LO, /* 0x6F 111. 'o' */
+ _ACPI_LO, /* 0x70 112. 'p' */
+ _ACPI_LO, /* 0x71 113. 'q' */
+ _ACPI_LO, /* 0x72 114. 'r' */
+ _ACPI_LO, /* 0x73 115. 's' */
+ _ACPI_LO, /* 0x74 116. 't' */
+ _ACPI_LO, /* 0x75 117. 'u' */
+ _ACPI_LO, /* 0x76 118. 'v' */
+ _ACPI_LO, /* 0x77 119. 'w' */
+ _ACPI_LO, /* 0x78 120. 'x' */
+ _ACPI_LO, /* 0x79 121. 'y' */
+ _ACPI_LO, /* 0x7A 122. 'z' */
+ _ACPI_PU, /* 0x7B 123. '{' */
+ _ACPI_PU, /* 0x7C 124. '|' */
+ _ACPI_PU, /* 0x7D 125. '}' */
+ _ACPI_PU, /* 0x7E 126. '~' */
+ _ACPI_CN, /* 0x7F 127. */
+
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 to 0x8F */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90 to 0x9F */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xA0 to 0xAF */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xB0 to 0xBF */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xC0 to 0xCF */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xD0 to 0xDF */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xE0 to 0xEF */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100 */
+};
+
+#define IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtToUpper
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Convert character to uppercase
+ *
+ ******************************************************************************/
+
+int
+AcpiUtToUpper (
+ int c)
+{
+
+ return (IS_LOWER(c) ? ((c)-0x20) : (c));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtToLower
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Convert character to lowercase
+ *
+ ******************************************************************************/
+
+int
+AcpiUtToLower (
+ int c)
+{
+
+ return (IS_UPPER(c) ? ((c)+0x20) : (c));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strstr
+ *
+ * PARAMETERS: String1 -
+ * String2
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
+ * full implementation of strstr, only sufficient for command
+ * matching
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrstr (
+ char *String1,
+ char *String2)
+{
+ char *String;
+
+
+ if (AcpiUtStrlen (String2) > AcpiUtStrlen (String1))
+ {
+ return (NULL);
+ }
+
+ /* Walk entire string, comparing the letters */
+
+ for (String = String1; *String2; )
+ {
+ if (*String2 != *String)
+ {
+ return (NULL);
+ }
+
+ String2++;
+ String++;
+ }
+
+ return (String1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strtoul
+ *
+ * PARAMETERS: String - Null terminated string
+ * Terminater - Where a pointer to the terminating byte is returned
+ * Base - Radix of the string
+ *
+ * RETURN: Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiUtStrtoul (
+ const char *String,
+ char **Terminator,
+ UINT32 Base)
+{
+ UINT32 converted = 0;
+ UINT32 index;
+ UINT32 sign;
+ const char *StringStart;
+ UINT32 ReturnValue = 0;
+ ACPI_STATUS Status = AE_OK;
+
+
+ /*
+ * Save the value of the pointer to the buffer's first
+ * character, save the current errno value, and then
+ * skip over any white space in the buffer:
+ */
+ StringStart = String;
+ while (IS_SPACE (*String) || *String == '\t')
+ {
+ ++String;
+ }
+
+ /*
+ * The buffer may contain an optional plus or minus sign.
+ * If it does, then skip over it but remember what is was:
+ */
+ if (*String == '-')
+ {
+ sign = NEGATIVE;
+ ++String;
+ }
+ else if (*String == '+')
+ {
+ ++String;
+ sign = POSITIVE;
+ }
+ else
+ {
+ sign = POSITIVE;
+ }
+
+ /*
+ * If the input parameter Base is zero, then we need to
+ * determine if it is octal, decimal, or hexadecimal:
+ */
+ if (Base == 0)
+ {
+ if (*String == '0')
+ {
+ if (AcpiUtToLower (*(++String)) == 'x')
+ {
+ Base = 16;
+ ++String;
+ }
+ else
+ {
+ Base = 8;
+ }
+ }
+ else
+ {
+ Base = 10;
+ }
+ }
+ else if (Base < 2 || Base > 36)
+ {
+ /*
+ * The specified Base parameter is not in the domain of
+ * this function:
+ */
+ goto done;
+ }
+
+ /*
+ * For octal and hexadecimal bases, skip over the leading
+ * 0 or 0x, if they are present.
+ */
+ if (Base == 8 && *String == '0')
+ {
+ String++;
+ }
+
+ if (Base == 16 &&
+ *String == '0' &&
+ AcpiUtToLower (*(++String)) == 'x')
+ {
+ String++;
+ }
+
+
+ /*
+ * Main loop: convert the string to an unsigned long:
+ */
+ while (*String)
+ {
+ if (IS_DIGIT (*String))
+ {
+ index = (UINT32) ((UINT8) *String - '0');
+ }
+ else
+ {
+ index = (UINT32) AcpiUtToUpper (*String);
+ if (IS_UPPER (index))
+ {
+ index = index - 'A' + 10;
+ }
+ else
+ {
+ goto done;
+ }
+ }
+
+ if (index >= Base)
+ {
+ goto done;
+ }
+
+ /*
+ * Check to see if value is out of range:
+ */
+
+ if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) /
+ (UINT32) Base))
+ {
+ Status = AE_ERROR;
+ ReturnValue = 0; /* reset */
+ }
+ else
+ {
+ ReturnValue *= Base;
+ ReturnValue += index;
+ converted = 1;
+ }
+
+ ++String;
+ }
+
+done:
+ /*
+ * If appropriate, update the caller's pointer to the next
+ * unconverted character in the buffer.
+ */
+ if (Terminator)
+ {
+ if (converted == 0 && ReturnValue == 0 && String != NULL)
+ {
+ *Terminator = (char *) StringStart;
+ }
+ else
+ {
+ *Terminator = (char *) String;
+ }
+ }
+
+ if (Status == AE_ERROR)
+ {
+ ReturnValue = ACPI_UINT32_MAX;
+ }
+
+ /*
+ * If a minus sign was present, then "the conversion is negated":
+ */
+ if (sign == NEGATIVE)
+ {
+ ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
+ }
+
+ return (ReturnValue);
+}
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c
new file mode 100644
index 0000000..d385678
--- /dev/null
+++ b/sys/contrib/dev/acpica/utcopy.c
@@ -0,0 +1,1018 @@
+/******************************************************************************
+ *
+ * Module Name: utcopy - Internal to external object translation utilities
+ * $Revision: 113 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTCOPY_C__
+
+#include "acpi.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utcopy")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIsimpleToEsimple
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are examining
+ * *Buffer - Where the object is returned
+ * *SpaceUsed - Where the data length is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to place a simple object in a user
+ * buffer.
+ *
+ * The buffer is assumed to have sufficient space for the object.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCopyIsimpleToEsimple (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_OBJECT *ExternalObject,
+ UINT8 *DataSpace,
+ ACPI_SIZE *BufferSpaceUsed)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
+
+
+ *BufferSpaceUsed = 0;
+
+ /*
+ * Check for NULL object case (could be an uninitialized
+ * package element)
+ */
+ if (!InternalObject)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Always clear the external object */
+
+ ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
+
+ /*
+ * In general, the external object will be the same type as
+ * the internal object
+ */
+ ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
+
+ /* However, only a limited number of external types are supported */
+
+ switch (ACPI_GET_OBJECT_TYPE (InternalObject))
+ {
+ case ACPI_TYPE_STRING:
+
+ ExternalObject->String.Pointer = (char *) DataSpace;
+ ExternalObject->String.Length = InternalObject->String.Length;
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ((ACPI_SIZE) InternalObject->String.Length + 1);
+
+ ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer,
+ (ACPI_SIZE) InternalObject->String.Length + 1);
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ ExternalObject->Buffer.Pointer = DataSpace;
+ ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length);
+
+ ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer,
+ InternalObject->Buffer.Length);
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ ExternalObject->Integer.Value = InternalObject->Integer.Value;
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ /*
+ * This is an object reference. Attempt to dereference it.
+ */
+ switch (InternalObject->Reference.Opcode)
+ {
+ case AML_INT_NAMEPATH_OP:
+
+ /* For namepath, return the object handle ("reference") */
+
+ default:
+ /*
+ * Use the object type of "Any" to indicate a reference
+ * to object containing a handle to an ACPI named object.
+ */
+ ExternalObject->Type = ACPI_TYPE_ANY;
+ ExternalObject->Reference.Handle = InternalObject->Reference.Node;
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_PROCESSOR:
+
+ ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId;
+ ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address;
+ ExternalObject->Processor.PblkLength = InternalObject->Processor.Length;
+ break;
+
+
+ case ACPI_TYPE_POWER:
+
+ ExternalObject->PowerResource.SystemLevel =
+ InternalObject->PowerResource.SystemLevel;
+
+ ExternalObject->PowerResource.ResourceOrder =
+ InternalObject->PowerResource.ResourceOrder;
+ break;
+
+
+ default:
+ /*
+ * There is no corresponding external object type
+ */
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIelementToEelement
+ *
+ * PARAMETERS: ACPI_PKG_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy one package element to another package element
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIelementToEelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
+ ACPI_SIZE ObjectSpace;
+ UINT32 ThisIndex;
+ ACPI_OBJECT *TargetObject;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ ThisIndex = State->Pkg.Index;
+ TargetObject = (ACPI_OBJECT *)
+ &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
+
+ switch (ObjectType)
+ {
+ case ACPI_COPY_TYPE_SIMPLE:
+
+ /*
+ * This is a simple or null object
+ */
+ Status = AcpiUtCopyIsimpleToEsimple (SourceObject,
+ TargetObject, Info->FreeSpace, &ObjectSpace);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ break;
+
+
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /*
+ * Build the package object
+ */
+ TargetObject->Type = ACPI_TYPE_PACKAGE;
+ TargetObject->Package.Count = SourceObject->Package.Count;
+ TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
+
+ /*
+ * Pass the new package object back to the package walk routine
+ */
+ State->Pkg.ThisTargetObj = TargetObject;
+
+ /*
+ * Save space for the array of objects (Package elements)
+ * update the buffer length counter
+ */
+ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
+ (ACPI_SIZE) TargetObject->Package.Count * sizeof (ACPI_OBJECT));
+ break;
+
+
+ default:
+ return (AE_BAD_PARAMETER);
+ }
+
+ Info->FreeSpace += ObjectSpace;
+ Info->Length += ObjectSpace;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIpackageToEpackage
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are returning
+ * *Buffer - Where the object is returned
+ * *SpaceUsed - Where the object length is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to place a package object in a user
+ * buffer. A package object by definition contains other objects.
+ *
+ * The buffer is assumed to have sufficient space for the object.
+ * The caller must have verified the buffer length needed using the
+ * AcpiUtGetObjectSize function before calling this function.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCopyIpackageToEpackage (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ UINT8 *Buffer,
+ ACPI_SIZE *SpaceUsed)
+{
+ ACPI_OBJECT *ExternalObject;
+ ACPI_STATUS Status;
+ ACPI_PKG_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIpackageToEpackage");
+
+
+ /*
+ * First package at head of the buffer
+ */
+ ExternalObject = ACPI_CAST_PTR (ACPI_OBJECT, Buffer);
+
+ /*
+ * Free space begins right after the first package
+ */
+ Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ Info.ObjectSpace = 0;
+ Info.NumPackages = 1;
+
+ ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
+ ExternalObject->Package.Count = InternalObject->Package.Count;
+ ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace);
+
+ /*
+ * Leave room for an array of ACPI_OBJECTS in the buffer
+ * and move the free space past it
+ */
+ Info.Length += (ACPI_SIZE) ExternalObject->Package.Count *
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ Info.FreeSpace += ExternalObject->Package.Count *
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+
+ Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject,
+ AcpiUtCopyIelementToEelement, &Info);
+
+ *SpaceUsed = Info.Length;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIobjectToEobject
+ *
+ * PARAMETERS: *InternalObject - The internal object to be converted
+ * *BufferPtr - Where the object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to build an API object to be returned to
+ * the caller.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIobjectToEobject (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject");
+
+
+ if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)
+ {
+ /*
+ * Package object: Copy all subobjects (including
+ * nested packages)
+ */
+ Status = AcpiUtCopyIpackageToEpackage (InternalObject,
+ RetBuffer->Pointer, &RetBuffer->Length);
+ }
+ else
+ {
+ /*
+ * Build a simple object (no nested objects)
+ */
+ Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
+ (ACPI_OBJECT *) RetBuffer->Pointer,
+ ((UINT8 *) RetBuffer->Pointer +
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
+ &RetBuffer->Length);
+ /*
+ * build simple does not include the object size in the length
+ * so we add it in here
+ */
+ RetBuffer->Length += sizeof (ACPI_OBJECT);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyEsimpleToIsimple
+ *
+ * PARAMETERS: *ExternalObject - The external object to be converted
+ * *InternalObject - Where the internal object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function copies an external object to an internal one.
+ * NOTE: Pointers can be copied, we don't need to copy data.
+ * (The pointers have to be valid in our address space no matter
+ * what we do with them!)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyEsimpleToIsimple (
+ ACPI_OBJECT *ExternalObject,
+ ACPI_OPERAND_OBJECT **RetInternalObject)
+{
+ ACPI_OPERAND_OBJECT *InternalObject;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
+
+
+ /*
+ * Simple types supported are: String, Buffer, Integer
+ */
+ switch (ExternalObject->Type)
+ {
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_INTEGER:
+
+ InternalObject = AcpiUtCreateInternalObject ((UINT8) ExternalObject->Type);
+ if (!InternalObject)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ break;
+
+ default:
+ /*
+ * Whatever other type -- it is not supported
+ */
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+
+ switch (ExternalObject->Type)
+ {
+
+ /* Must COPY string and buffer contents */
+
+ case ACPI_TYPE_STRING:
+
+ InternalObject->String.Pointer =
+ ACPI_MEM_CALLOCATE ((ACPI_SIZE) ExternalObject->String.Length + 1);
+ if (!InternalObject->String.Pointer)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMCPY (InternalObject->String.Pointer,
+ ExternalObject->String.Pointer,
+ ExternalObject->String.Length);
+
+ InternalObject->String.Length = ExternalObject->String.Length;
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ InternalObject->Buffer.Pointer =
+ ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length);
+ if (!InternalObject->Buffer.Pointer)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMCPY (InternalObject->Buffer.Pointer,
+ ExternalObject->Buffer.Pointer,
+ ExternalObject->Buffer.Length);
+
+ InternalObject->Buffer.Length = ExternalObject->Buffer.Length;
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ InternalObject->Integer.Value = ExternalObject->Integer.Value;
+ break;
+
+ default:
+ /* Other types can't get here */
+ break;
+ }
+
+ *RetInternalObject = InternalObject;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+
+/* Code to convert packages that are parameters to control methods */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyEpackageToIpackage
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are returning
+ * *Buffer - Where the object is returned
+ * *SpaceUsed - Where the length of the object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to place a package object in a user
+ * buffer. A package object by definition contains other objects.
+ *
+ * The buffer is assumed to have sufficient space for the object.
+ * The caller must have verified the buffer length needed using the
+ * AcpiUtGetObjectSize function before calling this function.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCopyEpackageToIpackage (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ UINT8 *Buffer,
+ UINT32 *SpaceUsed)
+{
+ UINT8 *FreeSpace;
+ ACPI_OBJECT *ExternalObject;
+ UINT32 Length = 0;
+ UINT32 ThisIndex;
+ UINT32 ObjectSpace = 0;
+ ACPI_OPERAND_OBJECT *ThisInternalObj;
+ ACPI_OBJECT *ThisExternalObj;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyEpackageToIpackage");
+
+
+ /*
+ * First package at head of the buffer
+ */
+ ExternalObject = (ACPI_OBJECT *)Buffer;
+
+ /*
+ * Free space begins right after the first package
+ */
+ FreeSpace = Buffer + sizeof(ACPI_OBJECT);
+
+
+ ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
+ ExternalObject->Package.Count = InternalObject->Package.Count;
+ ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace;
+
+ /*
+ * Build an array of ACPI_OBJECTS in the buffer
+ * and move the free space past it
+ */
+ FreeSpace += ExternalObject->Package.Count * sizeof(ACPI_OBJECT);
+
+
+ /* Call WalkPackage */
+
+}
+
+#endif /* Future implementation */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyEobjectToIobject
+ *
+ * PARAMETERS: *InternalObject - The external object to be converted
+ * *BufferPtr - Where the internal object is returned
+ *
+ * RETURN: Status - the status of the call
+ *
+ * DESCRIPTION: Converts an external object to an internal object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyEobjectToIobject (
+ ACPI_OBJECT *ExternalObject,
+ ACPI_OPERAND_OBJECT **InternalObject)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyEobjectToIobject");
+
+
+ if (ExternalObject->Type == ACPI_TYPE_PACKAGE)
+ {
+ /*
+ * Packages as external input to control methods are not supported,
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Packages as parameters not implemented!\n"));
+
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+ }
+
+ else
+ {
+ /*
+ * Build a simple object (no nested objects)
+ */
+ Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopySimpleObject
+ *
+ * PARAMETERS: SourceDesc - The internal object to be copied
+ * DestDesc - New target object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Simple copy of one internal object to another. Reference count
+ * of the destination object is preserved.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopySimpleObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc)
+{
+ UINT16 ReferenceCount;
+ ACPI_OPERAND_OBJECT *NextObject;
+
+
+ /* Save fields from destination that we don't want to overwrite */
+
+ ReferenceCount = DestDesc->Common.ReferenceCount;
+ NextObject = DestDesc->Common.NextObject;
+
+ /* Copy the entire source object over the destination object*/
+
+ ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc,
+ sizeof (ACPI_OPERAND_OBJECT));
+
+ /* Restore the saved fields */
+
+ DestDesc->Common.ReferenceCount = ReferenceCount;
+ DestDesc->Common.NextObject = NextObject;
+
+ /* Handle the objects with extra data */
+
+ switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+ {
+ case ACPI_TYPE_BUFFER:
+
+ DestDesc->Buffer.Node = NULL;
+ DestDesc->Common.Flags = SourceDesc->Common.Flags;
+
+ /*
+ * Allocate and copy the actual buffer if and only if:
+ * 1) There is a valid buffer pointer
+ * 2) The buffer is not static (not in an ACPI table) (in this case,
+ * the actual pointer was already copied above)
+ */
+ if ((SourceDesc->Buffer.Pointer) &&
+ (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ {
+ DestDesc->Buffer.Pointer = NULL;
+
+ /* Create an actual buffer only if length > 0 */
+
+ if (SourceDesc->Buffer.Length)
+ {
+ DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
+ if (!DestDesc->Buffer.Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the actual buffer data */
+
+ ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Length);
+ }
+ }
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Allocate and copy the actual string if and only if:
+ * 1) There is a valid string pointer
+ * 2) The string is not static (not in an ACPI table) (in this case,
+ * the actual pointer was already copied above)
+ */
+ if ((SourceDesc->String.Pointer) &&
+ (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ {
+ DestDesc->String.Pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
+ if (!DestDesc->String.Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
+ (ACPI_SIZE) SourceDesc->String.Length + 1);
+ }
+ break;
+
+ default:
+ /* Nothing to do for other simple objects */
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIelementToIelement
+ *
+ * PARAMETERS: ACPI_PKG_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy one package element to another package element
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIelementToIelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 ThisIndex;
+ ACPI_OPERAND_OBJECT **ThisTargetPtr;
+ ACPI_OPERAND_OBJECT *TargetObject;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ ThisIndex = State->Pkg.Index;
+ ThisTargetPtr = (ACPI_OPERAND_OBJECT **)
+ &State->Pkg.DestObject->Package.Elements[ThisIndex];
+
+ switch (ObjectType)
+ {
+ case ACPI_COPY_TYPE_SIMPLE:
+
+ /* A null source object indicates a (legal) null package element */
+
+ if (SourceObject)
+ {
+ /*
+ * This is a simple object, just copy it
+ */
+ TargetObject = AcpiUtCreateInternalObject (
+ ACPI_GET_OBJECT_TYPE (SourceObject));
+ if (!TargetObject)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Status = AcpiUtCopySimpleObject (SourceObject, TargetObject);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ *ThisTargetPtr = TargetObject;
+ }
+ else
+ {
+ /* Pass through a null element */
+
+ *ThisTargetPtr = NULL;
+ }
+ break;
+
+
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /*
+ * This object is a package - go down another nesting level
+ * Create and build the package object
+ */
+ TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
+ if (!TargetObject)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ TargetObject->Package.Count = SourceObject->Package.Count;
+ TargetObject->Common.Flags = SourceObject->Common.Flags;
+
+ /*
+ * Create the object array
+ */
+ TargetObject->Package.Elements =
+ ACPI_MEM_CALLOCATE (((ACPI_SIZE) SourceObject->Package.Count + 1) *
+ sizeof (void *));
+ if (!TargetObject->Package.Elements)
+ {
+ ACPI_MEM_FREE (TargetObject);
+ return (AE_NO_MEMORY);
+ }
+
+ /*
+ * Pass the new package object back to the package walk routine
+ */
+ State->Pkg.ThisTargetObj = TargetObject;
+
+ /*
+ * Store the object pointer in the parent package object
+ */
+ *ThisTargetPtr = TargetObject;
+ break;
+
+
+ default:
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIpackageToIpackage
+ *
+ * PARAMETERS: *SourceObj - Pointer to the source package object
+ * *DestObj - Where the internal object is returned
+ *
+ * RETURN: Status - the status of the call
+ *
+ * DESCRIPTION: This function is called to copy an internal package object
+ * into another internal package object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIpackageToIpackage (
+ ACPI_OPERAND_OBJECT *SourceObj,
+ ACPI_OPERAND_OBJECT *DestObj,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage");
+
+
+ DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj);
+ DestObj->Common.Flags = SourceObj->Common.Flags;
+ DestObj->Package.Count = SourceObj->Package.Count;
+
+ /*
+ * Create the object array and walk the source package tree
+ */
+ DestObj->Package.Elements = ACPI_MEM_CALLOCATE (
+ ((ACPI_SIZE) SourceObj->Package.Count + 1) *
+ sizeof (void *));
+ if (!DestObj->Package.Elements)
+ {
+ ACPI_REPORT_ERROR (
+ ("AmlBuildCopyInternalPackageObject: Package allocation failure\n"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Copy the package element-by-element by walking the package "tree".
+ * This handles nested packages of arbitrary depth.
+ */
+ Status = AcpiUtWalkPackageTree (SourceObj, DestObj,
+ AcpiUtCopyIelementToIelement, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ /* On failure, delete the destination package object */
+
+ AcpiUtRemoveReference (DestObj);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIobjectToIobject
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * SourceDesc - The internal object to be copied
+ * DestDesc - Where the copied object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy an internal object to a new internal object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIobjectToIobject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **DestDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIobjectToIobject");
+
+
+ /* Create the top level object */
+
+ *DestDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceDesc));
+ if (!*DestDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the object and possible subobjects */
+
+ if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_PACKAGE)
+ {
+ Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
+ WalkState);
+ }
+ else
+ {
+ Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c
new file mode 100644
index 0000000..f3a5118
--- /dev/null
+++ b/sys/contrib/dev/acpica/utdebug.c
@@ -0,0 +1,710 @@
+/******************************************************************************
+ *
+ * Module Name: utdebug - Debug print routines
+ * $Revision: 109 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTDEBUG_C__
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utdebug")
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF;
+static char *AcpiGbl_FnEntryStr = "----Entry";
+static char *AcpiGbl_FnExitStr = "----Exit-";
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtInitStackPtrTrace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Save the current stack pointer
+ *
+ ****************************************************************************/
+
+void
+AcpiUtInitStackPtrTrace (
+ void)
+{
+ UINT32 CurrentSp;
+
+
+ AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtTrackStackPtr
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Save the current stack pointer
+ *
+ ****************************************************************************/
+
+void
+AcpiUtTrackStackPtr (
+ void)
+{
+ ACPI_SIZE CurrentSp;
+
+
+ CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL);
+
+ if (CurrentSp < AcpiGbl_LowestStackPointer)
+ {
+ AcpiGbl_LowestStackPointer = CurrentSp;
+ }
+
+ if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
+ {
+ AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
+ }
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtDebugPrint
+ *
+ * PARAMETERS: DebugLevel - Requested debug print level
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ *
+ * Format - Printf format field
+ * ... - Optional printf arguments
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print error message with prefix consisting of the module name,
+ * line number, and component ID.
+ *
+ ****************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtDebugPrint (
+ UINT32 RequestedDebugLevel,
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *Format,
+ ...)
+{
+ UINT32 ThreadId;
+ va_list args;
+
+
+ /*
+ * Stay silent if the debug level or component ID is disabled
+ */
+ if (!(RequestedDebugLevel & AcpiDbgLevel) ||
+ !(DbgInfo->ComponentId & AcpiDbgLayer))
+ {
+ return;
+ }
+
+ /*
+ * Thread tracking and context switch notification
+ */
+ ThreadId = AcpiOsGetThreadId ();
+
+ if (ThreadId != AcpiGbl_PrevThreadId)
+ {
+ if (ACPI_LV_THREADS & AcpiDbgLevel)
+ {
+ AcpiOsPrintf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+ AcpiGbl_PrevThreadId, ThreadId);
+ }
+
+ AcpiGbl_PrevThreadId = ThreadId;
+ }
+
+ /*
+ * Display the module name, current line number, thread ID (if requested),
+ * current procedure nesting level, and the current procedure name
+ */
+ AcpiOsPrintf ("%8s-%04ld ", DbgInfo->ModuleName, LineNumber);
+
+ if (ACPI_LV_THREADS & AcpiDbgLevel)
+ {
+ AcpiOsPrintf ("[%04lX] ", ThreadId);
+ }
+
+ AcpiOsPrintf ("[%02ld] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName);
+
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtDebugPrintRaw
+ *
+ * PARAMETERS: RequestedDebugLevel - Requested debug print level
+ * LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Format - Printf format field
+ * ... - Optional printf arguments
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print message with no headers. Has same interface as
+ * DebugPrint so that the same macros can be used.
+ *
+ ****************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtDebugPrintRaw (
+ UINT32 RequestedDebugLevel,
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *Format,
+ ...)
+{
+ va_list args;
+
+
+ if (!(RequestedDebugLevel & AcpiDbgLevel) ||
+ !(DbgInfo->ComponentId & AcpiDbgLayer))
+ {
+ return;
+ }
+
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtTrace
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel
+ *
+ ****************************************************************************/
+
+void
+AcpiUtTrace (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo)
+{
+
+ AcpiGbl_NestingLevel++;
+ AcpiUtTrackStackPtr ();
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s\n", AcpiGbl_FnEntryStr);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtTracePtr
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Pointer - Pointer to display
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel
+ *
+ ****************************************************************************/
+
+void
+AcpiUtTracePtr (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ void *Pointer)
+{
+ AcpiGbl_NestingLevel++;
+ AcpiUtTrackStackPtr ();
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtTraceStr
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * String - Additional string to display
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel
+ *
+ ****************************************************************************/
+
+void
+AcpiUtTraceStr (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *String)
+{
+
+ AcpiGbl_NestingLevel++;
+ AcpiUtTrackStackPtr ();
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %s\n", AcpiGbl_FnEntryStr, String);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtTraceU32
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Integer - Integer to display
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel
+ *
+ ****************************************************************************/
+
+void
+AcpiUtTraceU32 (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ UINT32 Integer)
+{
+
+ AcpiGbl_NestingLevel++;
+ AcpiUtTrackStackPtr ();
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtExit
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel
+ *
+ ****************************************************************************/
+
+void
+AcpiUtExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo)
+{
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s\n", AcpiGbl_FnExitStr);
+
+ AcpiGbl_NestingLevel--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtStatusExit
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Status - Exit status code
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit status also.
+ *
+ ****************************************************************************/
+
+void
+AcpiUtStatusExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ ACPI_STATUS Status)
+{
+
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
+ }
+ else
+ {
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
+ }
+
+ AcpiGbl_NestingLevel--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtValueExit
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Value - Value to be printed with exit msg
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit value also.
+ *
+ ****************************************************************************/
+
+void
+AcpiUtValueExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ ACPI_INTEGER Value)
+{
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
+ ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
+
+ AcpiGbl_NestingLevel--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtPtrExit
+ *
+ * PARAMETERS: LineNumber - Caller's line number
+ * DbgInfo - Contains:
+ * ProcName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Value - Value to be printed with exit msg
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit value also.
+ *
+ ****************************************************************************/
+
+void
+AcpiUtPtrExit (
+ UINT32 LineNumber,
+ ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ UINT8 *Ptr)
+{
+
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
+ "%s %p\n", AcpiGbl_FnExitStr, Ptr);
+
+ AcpiGbl_NestingLevel--;
+}
+
+#endif
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpBuffer
+ *
+ * PARAMETERS: Buffer - Buffer to dump
+ * Count - Amount to dump, in bytes
+ * Display - BYTE, WORD, DWORD, or QWORD display
+ * ComponentID - Caller's component ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ****************************************************************************/
+
+void
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 ComponentId)
+{
+ ACPI_NATIVE_UINT i = 0;
+ ACPI_NATIVE_UINT j;
+ UINT32 Temp32;
+ UINT8 BufChar;
+
+
+ /* Only dump the buffer if tracing is enabled */
+
+ if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
+ (ComponentId & AcpiDbgLayer)))
+ {
+ return;
+ }
+
+ if ((Count < 4) || (Count & 0x01))
+ {
+ Display = DB_BYTE_DISPLAY;
+ }
+
+ AcpiOsPrintf ("\nOffset Value\n");
+
+ /*
+ * Nasty little dump buffer routine!
+ */
+ while (i < Count)
+ {
+ /* Print current offset */
+
+ AcpiOsPrintf ("%05X ", (UINT32) i);
+
+ /* Print 16 hex chars */
+
+ for (j = 0; j < 16;)
+ {
+ if (i + j >= Count)
+ {
+ AcpiOsPrintf ("\n");
+ return;
+ }
+
+ /* Make sure that the INT8 doesn't get sign-extended! */
+
+ switch (Display)
+ {
+ /* Default is BYTE display */
+
+ default:
+
+ AcpiOsPrintf ("%02X ",
+ *((UINT8 *) &Buffer[i + j]));
+ j += 1;
+ break;
+
+
+ case DB_WORD_DISPLAY:
+
+ ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]);
+ AcpiOsPrintf ("%04X ", Temp32);
+ j += 2;
+ break;
+
+
+ case DB_DWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]);
+ AcpiOsPrintf ("%08X ", Temp32);
+ j += 4;
+ break;
+
+
+ case DB_QWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]);
+ AcpiOsPrintf ("%08X", Temp32);
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]);
+ AcpiOsPrintf ("%08X ", Temp32);
+ j += 8;
+ break;
+ }
+ }
+
+ /*
+ * Print the ASCII equivalent characters
+ * But watch out for the bad unprintable ones...
+ */
+ for (j = 0; j < 16; j++)
+ {
+ if (i + j >= Count)
+ {
+ AcpiOsPrintf ("\n");
+ return;
+ }
+
+ BufChar = Buffer[i + j];
+ if ((BufChar > 0x1F && BufChar < 0x2E) ||
+ (BufChar > 0x2F && BufChar < 0x61) ||
+ (BufChar > 0x60 && BufChar < 0x7F))
+ {
+ AcpiOsPrintf ("%c", BufChar);
+ }
+ else
+ {
+ AcpiOsPrintf (".");
+ }
+ }
+
+ /* Done with that line. */
+
+ AcpiOsPrintf ("\n");
+ i += 16;
+ }
+
+ return;
+}
+
diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c
new file mode 100644
index 0000000..56f546b
--- /dev/null
+++ b/sys/contrib/dev/acpica/utdelete.c
@@ -0,0 +1,753 @@
+/*******************************************************************************
+ *
+ * Module Name: utdelete - object deletion and reference count utilities
+ * $Revision: 97 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTDELETE_C__
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utdelete")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteInternalObj
+ *
+ * PARAMETERS: *Object - Pointer to the list to be deleted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Low level object deletion, after reference counts have been
+ * updated (All reference counts, including sub-objects!)
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteInternalObj (
+ ACPI_OPERAND_OBJECT *Object)
+{
+ void *ObjPointer = NULL;
+ ACPI_OPERAND_OBJECT *HandlerDesc;
+ ACPI_OPERAND_OBJECT *SecondDesc;
+ ACPI_OPERAND_OBJECT *NextDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
+
+
+ if (!Object)
+ {
+ return_VOID;
+ }
+
+ /*
+ * Must delete or free any pointers within the object that are not
+ * actual ACPI objects (for example, a raw buffer pointer).
+ */
+ switch (ACPI_GET_OBJECT_TYPE (Object))
+ {
+ case ACPI_TYPE_STRING:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
+ Object, Object->String.Pointer));
+
+ /* Free the actual string buffer */
+
+ if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
+ {
+ /* But only if it is NOT a pointer into an ACPI table */
+
+ ObjPointer = Object->String.Pointer;
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
+ Object, Object->Buffer.Pointer));
+
+ /* Free the actual buffer */
+
+ if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
+ {
+ /* But only if it is NOT a pointer into an ACPI table */
+
+ ObjPointer = Object->Buffer.Pointer;
+ }
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
+ Object->Package.Count));
+
+ /*
+ * Elements of the package are not handled here, they are deleted
+ * separately
+ */
+
+ /* Free the (variable length) element pointer array */
+
+ ObjPointer = Object->Package.Elements;
+ break;
+
+
+ case ACPI_TYPE_DEVICE:
+
+ if (Object->Device.GpeBlock)
+ {
+ (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock);
+ }
+
+ /* Walk the handler list for this device */
+
+ HandlerDesc = Object->Device.AddressSpace;
+ while (HandlerDesc)
+ {
+ NextDesc = HandlerDesc->AddressSpace.Next;
+ AcpiUtRemoveReference (HandlerDesc);
+ HandlerDesc = NextDesc;
+ }
+ break;
+
+
+ case ACPI_TYPE_MUTEX:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
+ Object, Object->Mutex.Semaphore));
+
+ AcpiExUnlinkMutex (Object);
+ (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore);
+ break;
+
+
+ case ACPI_TYPE_EVENT:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
+ Object, Object->Event.Semaphore));
+
+ (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore);
+ Object->Event.Semaphore = NULL;
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", Object));
+
+ /* Delete the method semaphore if it exists */
+
+ if (Object->Method.Semaphore)
+ {
+ (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore);
+ Object->Method.Semaphore = NULL;
+ }
+ break;
+
+
+ case ACPI_TYPE_REGION:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", Object));
+
+ SecondDesc = AcpiNsGetSecondaryObject (Object);
+ if (SecondDesc)
+ {
+ /*
+ * Free the RegionContext if and only if the handler is one of the
+ * default handlers -- and therefore, we created the context object
+ * locally, it was not created by an external caller.
+ */
+ HandlerDesc = Object->Region.AddressSpace;
+ if (HandlerDesc)
+ {
+ if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
+ {
+ ObjPointer = SecondDesc->Extra.RegionContext;
+ }
+
+ AcpiUtRemoveReference (HandlerDesc);
+ }
+
+ /* Now we can free the Extra object */
+
+ AcpiUtDeleteObjectDesc (SecondDesc);
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", Object));
+
+ SecondDesc = AcpiNsGetSecondaryObject (Object);
+ if (SecondDesc)
+ {
+ AcpiUtDeleteObjectDesc (SecondDesc);
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ /* Free any allocated memory (pointer within the object) found above */
+
+ if (ObjPointer)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
+ ObjPointer));
+ ACPI_MEM_FREE (ObjPointer);
+ }
+
+ /* Now the object can be safely deleted */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
+ Object, AcpiUtGetObjectTypeName (Object)));
+
+ AcpiUtDeleteObjectDesc (Object);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteInternalObjectList
+ *
+ * PARAMETERS: *ObjList - Pointer to the list to be deleted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: This function deletes an internal object list, including both
+ * simple objects and package objects
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteInternalObjectList (
+ ACPI_OPERAND_OBJECT **ObjList)
+{
+ ACPI_OPERAND_OBJECT **InternalObj;
+
+
+ ACPI_FUNCTION_TRACE ("UtDeleteInternalObjectList");
+
+
+ /* Walk the null-terminated internal list */
+
+ for (InternalObj = ObjList; *InternalObj; InternalObj++)
+ {
+ AcpiUtRemoveReference (*InternalObj);
+ }
+
+ /* Free the combined parameter pointer list and object array */
+
+ ACPI_MEM_FREE (ObjList);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtUpdateRefCount
+ *
+ * PARAMETERS: *Object - Object whose ref count is to be updated
+ * Action - What to do
+ *
+ * RETURN: New ref count
+ *
+ * DESCRIPTION: Modify the ref count and return it.
+ *
+ ******************************************************************************/
+
+static void
+AcpiUtUpdateRefCount (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT32 Action)
+{
+ UINT16 Count;
+ UINT16 NewCount;
+
+
+ ACPI_FUNCTION_NAME ("UtUpdateRefCount");
+
+
+ if (!Object)
+ {
+ return;
+ }
+
+ Count = Object->Common.ReferenceCount;
+ NewCount = Count;
+
+ /*
+ * Perform the reference count action (increment, decrement, or force delete)
+ */
+ switch (Action)
+ {
+
+ case REF_INCREMENT:
+
+ NewCount++;
+ Object->Common.ReferenceCount = NewCount;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n",
+ Object, NewCount));
+ break;
+
+
+ case REF_DECREMENT:
+
+ if (Count < 1)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
+ Object, NewCount));
+
+ NewCount = 0;
+ }
+ else
+ {
+ NewCount--;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n",
+ Object, NewCount));
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
+ Object, NewCount));
+ }
+
+ Object->Common.ReferenceCount = NewCount;
+ if (NewCount == 0)
+ {
+ AcpiUtDeleteInternalObj (Object);
+ }
+
+ break;
+
+
+ case REF_FORCE_DELETE:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
+ Object, Count));
+
+ NewCount = 0;
+ Object->Common.ReferenceCount = NewCount;
+ AcpiUtDeleteInternalObj (Object);
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", Action));
+ break;
+ }
+
+ /*
+ * Sanity check the reference count, for debug purposes only.
+ * (A deleted object will have a huge reference count)
+ */
+ if (Count > ACPI_MAX_REFERENCE_COUNT)
+ {
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
+ "**** Warning **** Large Reference Count (%X) in object %p\n\n",
+ Count, Object));
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtUpdateObjectReference
+ *
+ * PARAMETERS: *Object - Increment ref count for this object
+ * and all sub-objects
+ * Action - Either REF_INCREMENT or REF_DECREMENT or
+ * REF_FORCE_DELETE
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Increment the object reference count
+ *
+ * Object references are incremented when:
+ * 1) An object is attached to a Node (namespace object)
+ * 2) An object is copied (all subobjects must be incremented)
+ *
+ * Object references are decremented when:
+ * 1) An object is detached from an Node
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtUpdateObjectReference (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ ACPI_GENERIC_STATE *StateList = NULL;
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
+
+
+ /* Ignore a null object ptr */
+
+ if (!Object)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Make sure that this isn't a namespace handle */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object));
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ State = AcpiUtCreateUpdateState (Object, Action);
+
+ while (State)
+ {
+ Object = State->Update.Object;
+ Action = State->Update.Value;
+ AcpiUtDeleteGenericState (State);
+
+ /*
+ * All sub-objects must have their reference count incremented also.
+ * Different object types have different subobjects.
+ */
+ switch (ACPI_GET_OBJECT_TYPE (Object))
+ {
+ case ACPI_TYPE_DEVICE:
+
+ AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action);
+ AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ /*
+ * We must update all the sub-objects of the package
+ * (Each of whom may have their own sub-objects, etc.
+ */
+ for (i = 0; i < Object->Package.Count; i++)
+ {
+ /*
+ * Push each element onto the stack for later processing.
+ * Note: There can be null elements within the package,
+ * these are simply ignored
+ */
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->Package.Elements[i], Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->BufferField.BufferObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->Field.RegionObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->BankField.BankObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->BankField.RegionObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->IndexField.IndexObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ Status = AcpiUtCreateUpdateStateAndPush (
+ Object->IndexField.DataObj, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ break;
+
+
+ case ACPI_TYPE_REGION:
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ default:
+
+ /* No subobjects */
+ break;
+ }
+
+ /*
+ * Now we can update the count in the main object. This can only
+ * happen after we update the sub-objects in case this causes the
+ * main object to be deleted.
+ */
+ AcpiUtUpdateRefCount (Object, Action);
+
+ /* Move on to the next object to be updated */
+
+ State = AcpiUtPopGenericState (&StateList);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+
+
+ErrorExit:
+
+ ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
+ AcpiFormatException (Status)));
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAddReference
+ *
+ * PARAMETERS: *Object - Object whose reference count is to be
+ * incremented
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add one reference to an ACPI object
+ *
+ ******************************************************************************/
+
+void
+AcpiUtAddReference (
+ ACPI_OPERAND_OBJECT *Object)
+{
+
+ ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
+
+
+ /* Ensure that we have a valid object */
+
+ if (!AcpiUtValidInternalObject (Object))
+ {
+ return_VOID;
+ }
+
+ /* Increment the reference count */
+
+ (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtRemoveReference
+ *
+ * PARAMETERS: *Object - Object whose ref count will be decremented
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decrement the reference count of an ACPI internal object
+ *
+ ******************************************************************************/
+
+void
+AcpiUtRemoveReference (
+ ACPI_OPERAND_OBJECT *Object)
+{
+
+ ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
+
+
+ /*
+ * Allow a NULL pointer to be passed in, just ignore it. This saves
+ * each caller from having to check. Also, ignore NS nodes.
+ *
+ */
+ if (!Object ||
+ (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
+
+ {
+ return_VOID;
+ }
+
+ /* Ensure that we have a valid object */
+
+ if (!AcpiUtValidInternalObject (Object))
+ {
+ return_VOID;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n",
+ Object, Object->Common.ReferenceCount));
+
+ /*
+ * Decrement the reference count, and only actually delete the object
+ * if the reference count becomes 0. (Must also decrement the ref count
+ * of all subobjects!)
+ */
+ (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c
new file mode 100644
index 0000000..49ef9e0
--- /dev/null
+++ b/sys/contrib/dev/acpica/uteval.c
@@ -0,0 +1,666 @@
+/******************************************************************************
+ *
+ * Module Name: uteval - Object evaluation
+ * $Revision: 48 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTEVAL_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("uteval")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtEvaluateObject
+ *
+ * PARAMETERS: PrefixNode - Starting node
+ * Path - Path to object from starting node
+ * ExpectedReturnTypes - Bitmap of allowed return types
+ * ReturnDesc - Where a return value is stored
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Evaluates a namespace object and verifies the type of the
+ * return object. Common code that simplifies accessing objects
+ * that have required return objects of fixed types.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtEvaluateObject (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ char *Path,
+ UINT32 ExpectedReturnBtypes,
+ ACPI_OPERAND_OBJECT **ReturnDesc)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ UINT32 ReturnBtype;
+
+
+ ACPI_FUNCTION_TRACE ("UtEvaluateObject");
+
+
+ /* Evaluate the object/method */
+
+ Status = AcpiNsEvaluateRelative (PrefixNode, Path, NULL, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n",
+ PrefixNode->Name.Ascii, Path));
+ }
+ else
+ {
+ ACPI_REPORT_METHOD_ERROR ("Method execution failed",
+ PrefixNode, Path, Status);
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Did we get a return object? */
+
+ if (!ObjDesc)
+ {
+ if (ExpectedReturnBtypes)
+ {
+ ACPI_REPORT_METHOD_ERROR ("No object was returned from",
+ PrefixNode, Path, AE_NOT_EXIST);
+
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Map the return object type to the bitmapped type */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ ReturnBtype = ACPI_BTYPE_INTEGER;
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ ReturnBtype = ACPI_BTYPE_BUFFER;
+ break;
+
+ case ACPI_TYPE_STRING:
+ ReturnBtype = ACPI_BTYPE_STRING;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ ReturnBtype = ACPI_BTYPE_PACKAGE;
+ break;
+
+ default:
+ ReturnBtype = 0;
+ break;
+ }
+
+ /* Is the return object one of the expected types? */
+
+ if (!(ExpectedReturnBtypes & ReturnBtype))
+ {
+ ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
+ PrefixNode, Path, AE_TYPE);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Type returned from %s was incorrect: %X\n",
+ Path, ACPI_GET_OBJECT_TYPE (ObjDesc)));
+
+ /* On error exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /* Object type is OK, return it */
+
+ *ReturnDesc = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtEvaluateNumericObject
+ *
+ * PARAMETERS: *ObjectName - Object name to be evaluated
+ * DeviceNode - Node for the device
+ * *Address - Where the value is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Evaluates a numeric namespace object for a selected device
+ * and stores result in *Address.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtEvaluateNumericObject (
+ char *ObjectName,
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_INTEGER *Address)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
+
+
+ Status = AcpiUtEvaluateObject (DeviceNode, ObjectName,
+ ACPI_BTYPE_INTEGER, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the returned Integer */
+
+ *Address = ObjDesc->Integer.Value;
+
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIdString
+ *
+ * PARAMETERS: Destination - Where to copy the string
+ * Source - Source string
+ * MaxLength - Length of the destination buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
+ * Performs removal of a leading asterisk if present -- workaround
+ * for a known issue on a bunch of machines.
+ *
+ ******************************************************************************/
+
+static void
+AcpiUtCopyIdString (
+ char *Destination,
+ char *Source,
+ ACPI_SIZE MaxLength)
+{
+
+
+ /*
+ * Workaround for ID strings that have a leading asterisk. This construct
+ * is not allowed by the ACPI specification (ID strings must be
+ * alphanumeric), but enough existing machines have this embedded in their
+ * ID strings that the following code is useful.
+ */
+ if (*Source == '*')
+ {
+ Source++;
+ }
+
+ /* Do the actual copy */
+
+ ACPI_STRNCPY (Destination, Source, MaxLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtExecute_HID
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * *Hid - Where the HID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _HID control method that returns the hardware
+ * ID of the device.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_HID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_DEVICE_ID *Hid)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtExecute_HID");
+
+
+ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID,
+ ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ /* Convert the Numeric HID to string */
+
+ AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value);
+ }
+ else
+ {
+ /* Copy the String HID from the returned object */
+
+ AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer,
+ sizeof (Hid->Value));
+ }
+
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtTranslateOneCid
+ *
+ * PARAMETERS: ObjDesc - _CID object, must be integer or string
+ * OneCid - Where the CID string is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return a numeric or string _CID value as a string.
+ * (Compatible ID)
+ *
+ * NOTE: Assumes a maximum _CID string length of
+ * ACPI_MAX_CID_LENGTH.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtTranslateOneCid (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_COMPATIBLE_ID *OneCid)
+{
+
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Convert the Numeric CID to string */
+
+ AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value);
+ return (AE_OK);
+
+ case ACPI_TYPE_STRING:
+
+ if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH)
+ {
+ return (AE_AML_STRING_LIMIT);
+ }
+
+ /* Copy the String CID from the returned object */
+
+ AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer,
+ ACPI_MAX_CID_LENGTH);
+ return (AE_OK);
+
+ default:
+
+ return (AE_TYPE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtExecute_CID
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * *Cid - Where the CID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _CID control method that returns one or more
+ * compatible hardware IDs for the device.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_CID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_COMPATIBLE_ID_LIST **ReturnCidList)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID_LIST *CidList;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("UtExecute_CID");
+
+
+ /* Evaluate the _CID method for this device */
+
+ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID,
+ ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE,
+ &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the number of _CIDs returned */
+
+ Count = 1;
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+ {
+ Count = ObjDesc->Package.Count;
+ }
+
+ /* Allocate a worst-case buffer for the _CIDs */
+
+ Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
+ sizeof (ACPI_COMPATIBLE_ID_LIST));
+
+ CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
+ if (!CidList)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Init CID list */
+
+ CidList->Count = Count;
+ CidList->Size = Size;
+
+ /*
+ * A _CID can return either a single compatible ID or a package of compatible
+ * IDs. Each compatible ID can be one of the following:
+ * -- Number (32 bit compressed EISA ID) or
+ * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
+ */
+
+ /* The _CID object can be either a single CID or a package (list) of CIDs */
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+ {
+ /* Translate each package element */
+
+ for (i = 0; i < Count; i++)
+ {
+ Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i],
+ &CidList->Id[i]);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* Only one CID, translate to a string */
+
+ Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id);
+ }
+
+ /* Cleanup on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_MEM_FREE (CidList);
+ }
+ else
+ {
+ *ReturnCidList = CidList;
+ }
+
+ /* On exit, we must delete the _CID return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtExecute_UID
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * *Uid - Where the UID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _UID control method that returns the hardware
+ * ID of the device.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_UID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_DEVICE_ID *Uid)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtExecute_UID");
+
+
+ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID,
+ ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+ {
+ /* Convert the Numeric UID to string */
+
+ AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value);
+ }
+ else
+ {
+ /* Copy the String UID from the returned object */
+
+ AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer,
+ sizeof (Uid->Value));
+ }
+
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtExecute_STA
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * *Flags - Where the status flags are returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes _STA for selected device and stores results in
+ * *Flags.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_STA (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ UINT32 *Flags)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtExecute_STA");
+
+
+ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA,
+ ACPI_BTYPE_INTEGER, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ if (AE_NOT_FOUND == Status)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "_STA on %4.4s was not found, assuming device is present\n",
+ DeviceNode->Name.Ascii));
+
+ *Flags = 0x0F;
+ Status = AE_OK;
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Extract the status flags */
+
+ *Flags = (UINT32) ObjDesc->Integer.Value;
+
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
new file mode 100644
index 0000000..9a16eea
--- /dev/null
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -0,0 +1,876 @@
+/******************************************************************************
+ *
+ * Module Name: utglobal - Global variables for the ACPI subsystem
+ * $Revision: 185 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTGLOBAL_C__
+#define DEFINE_ACPI_GLOBALS
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utglobal")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiFormatException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiFormatException (
+ ACPI_STATUS Status)
+{
+ const char *Exception = "UNKNOWN_STATUS_CODE";
+ ACPI_STATUS SubStatus;
+
+
+ ACPI_FUNCTION_NAME ("FormatException");
+
+
+ SubStatus = (Status & ~AE_CODE_MASK);
+
+ switch (Status & AE_CODE_MASK)
+ {
+ case AE_CODE_ENVIRONMENTAL:
+
+ if (SubStatus <= AE_CODE_ENV_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
+ break;
+ }
+ goto Unknown;
+
+ case AE_CODE_PROGRAMMER:
+
+ if (SubStatus <= AE_CODE_PGM_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
+ break;
+ }
+ goto Unknown;
+
+ case AE_CODE_ACPI_TABLES:
+
+ if (SubStatus <= AE_CODE_TBL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
+ break;
+ }
+ goto Unknown;
+
+ case AE_CODE_AML:
+
+ if (SubStatus <= AE_CODE_AML_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
+ break;
+ }
+ goto Unknown;
+
+ case AE_CODE_CONTROL:
+
+ if (SubStatus <= AE_CODE_CTRL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
+ break;
+ }
+ goto Unknown;
+
+ default:
+ goto Unknown;
+ }
+
+
+ return ((const char *) Exception);
+
+Unknown:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status));
+ return ((const char *) Exception);
+}
+
+
+/******************************************************************************
+ *
+ * Static global variable initialization.
+ *
+ ******************************************************************************/
+
+/*
+ * We want the debug switches statically initialized so they
+ * are already set when the debugger is entered.
+ */
+
+/* Debug switch - level and trace mask */
+
+#ifdef ACPI_DEBUG_OUTPUT
+UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
+#else
+UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
+#endif
+
+/* Debug switch - layer (component) mask */
+
+UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
+UINT32 AcpiGbl_NestingLevel = 0;
+
+
+/* Debugger globals */
+
+BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
+BOOLEAN AcpiGbl_AbortMethod = FALSE;
+BOOLEAN AcpiGbl_MethodExecuting = FALSE;
+
+/* System flags */
+
+UINT32 AcpiGbl_StartupFlags = 0;
+
+/* System starts uninitialized */
+
+BOOLEAN AcpiGbl_Shutdown = TRUE;
+
+const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
+
+const char *AcpiGbl_DbSleepStates[ACPI_S_STATE_COUNT] = {
+ "\\_S0_",
+ "\\_S1_",
+ "\\_S2_",
+ "\\_S3_",
+ "\\_S4_",
+ "\\_S5_"};
+
+
+/******************************************************************************
+ *
+ * Namespace globals
+ *
+ ******************************************************************************/
+
+
+/*
+ * Predefined ACPI Names (Built-in to the Interpreter)
+ *
+ * Initial values are currently supported only for types String and Number.
+ * Both are specified as strings in this table.
+ *
+ * NOTES:
+ * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
+ * during the initialization sequence.
+ */
+
+const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
+{
+ {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_SB_", ACPI_TYPE_DEVICE, NULL},
+ {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_TZ_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_REV", ACPI_TYPE_INTEGER, "2"},
+ {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
+ {"_GL_", ACPI_TYPE_MUTEX, "0"},
+
+#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
+ {"_OSI", ACPI_TYPE_METHOD, "1"},
+#endif
+ {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
+};
+
+
+/*
+ * Properties of the ACPI Object Types, both internal and external.
+ * The table is indexed by values of ACPI_OBJECT_TYPE
+ */
+
+const UINT8 AcpiGbl_NsProperties[] =
+{
+ ACPI_NS_NORMAL, /* 00 Any */
+ ACPI_NS_NORMAL, /* 01 Number */
+ ACPI_NS_NORMAL, /* 02 String */
+ ACPI_NS_NORMAL, /* 03 Buffer */
+ ACPI_NS_NORMAL, /* 04 Package */
+ ACPI_NS_NORMAL, /* 05 FieldUnit */
+ ACPI_NS_NEWSCOPE, /* 06 Device */
+ ACPI_NS_NORMAL, /* 07 Event */
+ ACPI_NS_NEWSCOPE, /* 08 Method */
+ ACPI_NS_NORMAL, /* 09 Mutex */
+ ACPI_NS_NORMAL, /* 10 Region */
+ ACPI_NS_NEWSCOPE, /* 11 Power */
+ ACPI_NS_NEWSCOPE, /* 12 Processor */
+ ACPI_NS_NEWSCOPE, /* 13 Thermal */
+ ACPI_NS_NORMAL, /* 14 BufferField */
+ ACPI_NS_NORMAL, /* 15 DdbHandle */
+ ACPI_NS_NORMAL, /* 16 Debug Object */
+ ACPI_NS_NORMAL, /* 17 DefField */
+ ACPI_NS_NORMAL, /* 18 BankField */
+ ACPI_NS_NORMAL, /* 19 IndexField */
+ ACPI_NS_NORMAL, /* 20 Reference */
+ ACPI_NS_NORMAL, /* 21 Alias */
+ ACPI_NS_NORMAL, /* 22 Notify */
+ ACPI_NS_NORMAL, /* 23 Address Handler */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */
+ ACPI_NS_NEWSCOPE, /* 26 Scope */
+ ACPI_NS_NORMAL, /* 27 Extra */
+ ACPI_NS_NORMAL, /* 28 Data */
+ ACPI_NS_NORMAL /* 29 Invalid */
+};
+
+
+/* Hex to ASCII conversion table */
+
+static const char AcpiGbl_HexToAscii[] =
+ {'0','1','2','3','4','5','6','7',
+ '8','9','A','B','C','D','E','F'};
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtHexToAsciiChar
+ *
+ * PARAMETERS: Integer - Contains the hex digit
+ * Position - bit position of the digit within the
+ * integer
+ *
+ * RETURN: Ascii character
+ *
+ * DESCRIPTION: Convert a hex digit to an ascii character
+ *
+ ****************************************************************************/
+
+char
+AcpiUtHexToAsciiChar (
+ ACPI_INTEGER Integer,
+ UINT32 Position)
+{
+
+ return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
+}
+
+
+/******************************************************************************
+ *
+ * Table name globals
+ *
+ * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
+ * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
+ * that are not used by the subsystem are simply ignored.
+ *
+ * Do NOT add any table to this list that is not consumed directly by this
+ * subsystem.
+ *
+ ******************************************************************************/
+
+
+ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
+
+
+ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
+{
+ /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
+
+ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
+ /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
+ /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
+ /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
+ /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
+};
+
+
+/******************************************************************************
+ *
+ * Event and Hardware globals
+ *
+ ******************************************************************************/
+
+ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
+{
+ /* Name Parent Register Register Bit Position Register Bit Mask */
+
+ /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS},
+ /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS},
+ /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS},
+ /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS},
+ /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
+ /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
+ /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
+
+ /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
+ /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
+
+ /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
+ /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
+ /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
+ /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE},
+
+ /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE}
+};
+
+
+ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
+{
+ /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0},
+};
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetRegionName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Space ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Region type decoding */
+
+const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
+{
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
+ "SystemMemory",
+ "SystemIO",
+ "PCI_Config",
+ "EmbeddedControl",
+ "SMBus",
+ "CMOS",
+ "PCIBARTarget",
+ "DataTable"
+/*! [End] no source code translation !*/
+};
+
+
+char *
+AcpiUtGetRegionName (
+ UINT8 SpaceId)
+{
+
+ if (SpaceId >= ACPI_USER_REGION_BEGIN)
+ {
+ return ("UserDefinedRegion");
+ }
+
+ else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
+ {
+ return ("InvalidSpaceId");
+ }
+
+ return ((char *) AcpiGbl_RegionTypes[SpaceId]);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetEventName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Event ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Event type decoding */
+
+static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
+{
+ "PM_Timer",
+ "GlobalLock",
+ "PowerButton",
+ "SleepButton",
+ "RealTimeClock",
+};
+
+
+char *
+AcpiUtGetEventName (
+ UINT32 EventId)
+{
+
+ if (EventId > ACPI_EVENT_MAX)
+ {
+ return ("InvalidEventID");
+ }
+
+ return ((char *) AcpiGbl_EventTypes[EventId]);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetTypeName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Type ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/*
+ * Elements of AcpiGbl_NsTypeNames below must match
+ * one-to-one with values of ACPI_OBJECT_TYPE
+ *
+ * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
+ * stored in a table it really means that we have thus far seen no evidence to
+ * indicatewhat type is actually going to be stored for this entry.
+ */
+
+static const char AcpiGbl_BadType[] = "UNDEFINED";
+#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
+
+static const char *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */
+{
+ /* 00 */ "Untyped",
+ /* 01 */ "Integer",
+ /* 02 */ "String",
+ /* 03 */ "Buffer",
+ /* 04 */ "Package",
+ /* 05 */ "FieldUnit",
+ /* 06 */ "Device",
+ /* 07 */ "Event",
+ /* 08 */ "Method",
+ /* 09 */ "Mutex",
+ /* 10 */ "Region",
+ /* 11 */ "Power",
+ /* 12 */ "Processor",
+ /* 13 */ "Thermal",
+ /* 14 */ "BufferField",
+ /* 15 */ "DdbHandle",
+ /* 16 */ "DebugObject",
+ /* 17 */ "RegionField",
+ /* 18 */ "BankField",
+ /* 19 */ "IndexField",
+ /* 20 */ "Reference",
+ /* 21 */ "Alias",
+ /* 22 */ "Notify",
+ /* 23 */ "AddrHandler",
+ /* 24 */ "ResourceDesc",
+ /* 25 */ "ResourceFld",
+ /* 26 */ "Scope",
+ /* 27 */ "Extra",
+ /* 28 */ "Data",
+ /* 39 */ "Invalid"
+};
+
+
+char *
+AcpiUtGetTypeName (
+ ACPI_OBJECT_TYPE Type)
+{
+
+ if (Type > ACPI_TYPE_INVALID)
+ {
+ return ((char *) AcpiGbl_BadType);
+ }
+
+ return ((char *) AcpiGbl_NsTypeNames[Type]);
+}
+
+
+char *
+AcpiUtGetObjectTypeName (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+
+ if (!ObjDesc)
+ {
+ return ("[NULL Object Descriptor]");
+ }
+
+ return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)));
+}
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+/*
+ * Strings and procedures used for debug only
+ */
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetMutexName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+char *
+AcpiUtGetMutexName (
+ UINT32 MutexId)
+{
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return ("Invalid Mutex ID");
+ }
+
+ return (AcpiGbl_MutexNames[MutexId]);
+}
+
+#endif
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtValidObjectType
+ *
+ * PARAMETERS: Type - Object type to be validated
+ *
+ * RETURN: TRUE if valid object type
+ *
+ * DESCRIPTION: Validate an object type
+ *
+ ****************************************************************************/
+
+BOOLEAN
+AcpiUtValidObjectType (
+ ACPI_OBJECT_TYPE Type)
+{
+
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ /* Note: Assumes all TYPEs are contiguous (external/local) */
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateOwnerId
+ *
+ * PARAMETERS: IdType - Type of ID (method or table)
+ *
+ * DESCRIPTION: Allocate a table or method owner id
+ *
+ ***************************************************************************/
+
+ACPI_OWNER_ID
+AcpiUtAllocateOwnerId (
+ UINT32 IdType)
+{
+ ACPI_OWNER_ID OwnerId = 0xFFFF;
+
+
+ ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
+
+
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return (0);
+ }
+
+ switch (IdType)
+ {
+ case ACPI_OWNER_TYPE_TABLE:
+
+ OwnerId = AcpiGbl_NextTableOwnerId;
+ AcpiGbl_NextTableOwnerId++;
+
+ /* Check for wraparound */
+
+ if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
+ {
+ AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
+ ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
+ }
+ break;
+
+
+ case ACPI_OWNER_TYPE_METHOD:
+
+ OwnerId = AcpiGbl_NextMethodOwnerId;
+ AcpiGbl_NextMethodOwnerId++;
+
+ if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
+ {
+ /* Check for wraparound */
+
+ AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return_VALUE (OwnerId);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: AcpiUtInitGlobals
+ *
+ * PARAMETERS: none
+ *
+ * DESCRIPTION: Init library globals. All globals that require specific
+ * initialization should be initialized here!
+ *
+ ***************************************************************************/
+
+void
+AcpiUtInitGlobals (
+ void)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("UtInitGlobals");
+
+ /* Memory allocation and cache lists */
+
+ ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE);
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH;
+
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache");
+ ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache");
+
+ /* ACPI table structure */
+
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ AcpiGbl_TableLists[i].Next = NULL;
+ AcpiGbl_TableLists[i].Count = 0;
+ }
+
+ /* Mutex locked flags */
+
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ AcpiGbl_MutexInfo[i].Mutex = NULL;
+ AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].UseCount = 0;
+ }
+
+ /* GPE support */
+
+ AcpiGbl_GpeXruptListHead = NULL;
+ AcpiGbl_GpeFadtBlocks[0] = NULL;
+ AcpiGbl_GpeFadtBlocks[1] = NULL;
+
+ /* Global notify handlers */
+
+ AcpiGbl_SystemNotify.Handler = NULL;
+ AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_InitHandler = NULL;
+
+ /* Global "typed" ACPI table pointers */
+
+ AcpiGbl_RSDP = NULL;
+ AcpiGbl_XSDT = NULL;
+ AcpiGbl_FACS = NULL;
+ AcpiGbl_FADT = NULL;
+ AcpiGbl_DSDT = NULL;
+
+ /* Global Lock support */
+
+ AcpiGbl_GlobalLockAcquired = FALSE;
+ AcpiGbl_GlobalLockThreadCount = 0;
+ AcpiGbl_GlobalLockHandle = 0;
+
+ /* Miscellaneous variables */
+
+ AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
+ AcpiGbl_RsdpOriginalLocation = 0;
+ AcpiGbl_CmSingleStep = FALSE;
+ AcpiGbl_DbTerminateThreads = FALSE;
+ AcpiGbl_Shutdown = FALSE;
+ AcpiGbl_NsLookupCount = 0;
+ AcpiGbl_PsFindCount = 0;
+ AcpiGbl_AcpiHardwarePresent = TRUE;
+ AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
+ AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
+ AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
+ AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
+
+ /* Hardware oriented */
+
+ AcpiGbl_EventsInitialized = FALSE;
+
+ /* Namespace */
+
+ AcpiGbl_RootNode = NULL;
+
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+ AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+ AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
+#endif
+
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c
new file mode 100644
index 0000000..dca1f78
--- /dev/null
+++ b/sys/contrib/dev/acpica/utinit.c
@@ -0,0 +1,353 @@
+/******************************************************************************
+ *
+ * Module Name: utinit - Common ACPI subsystem initialization
+ * $Revision: 117 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __UTINIT_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utinit")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFadtRegisterError
+ *
+ * PARAMETERS: *RegisterName - Pointer to string identifying register
+ * Value - Actual register contents value
+ * AcpiTestSpecSection - TDS section containing assertion
+ * AcpiAssertion - Assertion number being tested
+ *
+ * RETURN: AE_BAD_VALUE
+ *
+ * DESCRIPTION: Display failure message and link failure to TDS assertion
+ *
+ ******************************************************************************/
+
+static void
+AcpiUtFadtRegisterError (
+ char *RegisterName,
+ UINT32 Value,
+ ACPI_SIZE Offset)
+{
+
+ ACPI_REPORT_WARNING (
+ ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
+ RegisterName, Value, (UINT32) Offset, AcpiGbl_FADT));
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidateFadt
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate various ACPI registers in the FADT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtValidateFadt (
+ void)
+{
+
+ /*
+ * Verify Fixed ACPI Description Table fields,
+ * but don't abort on any problems, just display error
+ */
+ if (AcpiGbl_FADT->Pm1EvtLen < 4)
+ {
+ AcpiUtFadtRegisterError ("PM1_EVT_LEN",
+ (UINT32) AcpiGbl_FADT->Pm1EvtLen,
+ ACPI_FADT_OFFSET (Pm1EvtLen));
+ }
+
+ if (!AcpiGbl_FADT->Pm1CntLen)
+ {
+ AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0,
+ ACPI_FADT_OFFSET (Pm1CntLen));
+ }
+
+ if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))
+ {
+ AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0,
+ ACPI_FADT_OFFSET (XPm1aEvtBlk.Address));
+ }
+
+ if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address))
+ {
+ AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0,
+ ACPI_FADT_OFFSET (XPm1aCntBlk.Address));
+ }
+
+ if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))
+ {
+ AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0,
+ ACPI_FADT_OFFSET (XPmTmrBlk.Address));
+ }
+
+ if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) &&
+ !AcpiGbl_FADT->Pm2CntLen))
+ {
+ AcpiUtFadtRegisterError ("PM2_CNT_LEN",
+ (UINT32) AcpiGbl_FADT->Pm2CntLen,
+ ACPI_FADT_OFFSET (Pm2CntLen));
+ }
+
+ if (AcpiGbl_FADT->PmTmLen < 4)
+ {
+ AcpiUtFadtRegisterError ("PM_TM_LEN",
+ (UINT32) AcpiGbl_FADT->PmTmLen,
+ ACPI_FADT_OFFSET (PmTmLen));
+ }
+
+ /* Length of GPE blocks must be a multiple of 2 */
+
+ if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
+ (AcpiGbl_FADT->Gpe0BlkLen & 1))
+ {
+ AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN",
+ (UINT32) AcpiGbl_FADT->Gpe0BlkLen,
+ ACPI_FADT_OFFSET (Gpe0BlkLen));
+ }
+
+ if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
+ (AcpiGbl_FADT->Gpe1BlkLen & 1))
+ {
+ AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN",
+ (UINT32) AcpiGbl_FADT->Gpe1BlkLen,
+ ACPI_FADT_OFFSET (Gpe1BlkLen));
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtTerminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: free global memory
+ *
+ ******************************************************************************/
+
+void
+AcpiUtTerminate (void)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_BLOCK_INFO *NextGpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
+
+
+ ACPI_FUNCTION_TRACE ("UtTerminate");
+
+
+ /* Free global tables, etc. */
+
+
+ /* Free global GPE blocks and related info structures */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ NextGpeBlock = GpeBlock->Next;
+ ACPI_MEM_FREE (GpeBlock->EventInfo);
+ ACPI_MEM_FREE (GpeBlock->RegisterInfo);
+ ACPI_MEM_FREE (GpeBlock);
+
+ GpeBlock = NextGpeBlock;
+ }
+ NextGpeXruptInfo = GpeXruptInfo->Next;
+ ACPI_MEM_FREE (GpeXruptInfo);
+ GpeXruptInfo = NextGpeXruptInfo;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSubsystemShutdown
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex
+ * objects here -- because the AML debugger may be still running.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtSubsystemShutdown (void)
+{
+
+ ACPI_FUNCTION_TRACE ("UtSubsystemShutdown");
+
+ /* Just exit if subsystem is already shutdown */
+
+ if (AcpiGbl_Shutdown)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n"));
+ return_VOID;
+ }
+
+ /* Subsystem appears active, go ahead and shut it down */
+
+ AcpiGbl_Shutdown = TRUE;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
+
+ /* Close the AcpiEvent Handling */
+
+ AcpiEvTerminate ();
+
+ /* Close the Namespace */
+
+ AcpiNsTerminate ();
+
+ /* Close the globals */
+
+ AcpiUtTerminate ();
+
+ /* Purge the local caches */
+
+ (void) AcpiPurgeCachedObjects ();
+
+ /* Debug only - display leftover memory allocation, if any */
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
+#endif
+
+ return_VOID;
+}
+
+
diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utmath.c
new file mode 100644
index 0000000..f519cd2
--- /dev/null
+++ b/sys/contrib/dev/acpica/utmath.c
@@ -0,0 +1,428 @@
+/*******************************************************************************
+ *
+ * Module Name: utmath - Integer math support routines
+ * $Revision: 12 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __UTMATH_C__
+
+#include "acpi.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utmath")
+
+/*
+ * Support for double-precision integer divide. This code is included here
+ * in order to support kernel environments where the double-precision math
+ * library is not available.
+ */
+
+#ifndef ACPI_USE_NATIVE_DIVIDE
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtShortDivide
+ *
+ * PARAMETERS: InDividend - Pointer to the dividend
+ * Divisor - 32-bit divisor
+ * OutQuotient - Pointer to where the quotient is returned
+ * OutRemainder - Pointer to where the remainder is returned
+ *
+ * RETURN: Status (Checks for divide-by-zero)
+ *
+ * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits)
+ * divide and modulo. The result is a 64-bit quotient and a
+ * 32-bit remainder.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtShortDivide (
+ ACPI_INTEGER *InDividend,
+ UINT32 Divisor,
+ ACPI_INTEGER *OutQuotient,
+ UINT32 *OutRemainder)
+{
+ UINT64_OVERLAY Dividend;
+ UINT64_OVERLAY Quotient;
+ UINT32 Remainder32;
+
+
+ ACPI_FUNCTION_TRACE ("UtShortDivide");
+
+ Dividend.Full = *InDividend;
+
+ /* Always check for a zero divisor */
+
+ if (Divisor == 0)
+ {
+ ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ /*
+ * The quotient is 64 bits, the remainder is always 32 bits,
+ * and is generated by the second divide.
+ */
+ ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor,
+ Quotient.Part.Hi, Remainder32);
+ ACPI_DIV_64_BY_32 (Remainder32, Dividend.Part.Lo, Divisor,
+ Quotient.Part.Lo, Remainder32);
+
+ /* Return only what was requested */
+
+ if (OutQuotient)
+ {
+ *OutQuotient = Quotient.Full;
+ }
+ if (OutRemainder)
+ {
+ *OutRemainder = Remainder32;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDivide
+ *
+ * PARAMETERS: InDividend - Pointer to the dividend
+ * InDivisor - Pointer to the divisor
+ * OutQuotient - Pointer to where the quotient is returned
+ * OutRemainder - Pointer to where the remainder is returned
+ *
+ * RETURN: Status (Checks for divide-by-zero)
+ *
+ * DESCRIPTION: Perform a divide and modulo.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtDivide (
+ ACPI_INTEGER *InDividend,
+ ACPI_INTEGER *InDivisor,
+ ACPI_INTEGER *OutQuotient,
+ ACPI_INTEGER *OutRemainder)
+{
+ UINT64_OVERLAY Dividend;
+ UINT64_OVERLAY Divisor;
+ UINT64_OVERLAY Quotient;
+ UINT64_OVERLAY Remainder;
+ UINT64_OVERLAY NormalizedDividend;
+ UINT64_OVERLAY NormalizedDivisor;
+ UINT32 Partial1;
+ UINT64_OVERLAY Partial2;
+ UINT64_OVERLAY Partial3;
+
+
+ ACPI_FUNCTION_TRACE ("UtDivide");
+
+
+ /* Always check for a zero divisor */
+
+ if (*InDivisor == 0)
+ {
+ ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ Divisor.Full = *InDivisor;
+ Dividend.Full = *InDividend;
+ if (Divisor.Part.Hi == 0)
+ {
+ /*
+ * 1) Simplest case is where the divisor is 32 bits, we can
+ * just do two divides
+ */
+ Remainder.Part.Hi = 0;
+
+ /*
+ * The quotient is 64 bits, the remainder is always 32 bits,
+ * and is generated by the second divide.
+ */
+ ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo,
+ Quotient.Part.Hi, Partial1);
+ ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo,
+ Quotient.Part.Lo, Remainder.Part.Lo);
+ }
+
+ else
+ {
+ /*
+ * 2) The general case where the divisor is a full 64 bits
+ * is more difficult
+ */
+ Quotient.Part.Hi = 0;
+ NormalizedDividend = Dividend;
+ NormalizedDivisor = Divisor;
+
+ /* Normalize the operands (shift until the divisor is < 32 bits) */
+
+ do
+ {
+ ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi,
+ NormalizedDivisor.Part.Lo);
+ ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi,
+ NormalizedDividend.Part.Lo);
+
+ } while (NormalizedDivisor.Part.Hi != 0);
+
+ /* Partial divide */
+
+ ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi,
+ NormalizedDividend.Part.Lo,
+ NormalizedDivisor.Part.Lo,
+ Quotient.Part.Lo, Partial1);
+
+ /*
+ * The quotient is always 32 bits, and simply requires adjustment.
+ * The 64-bit remainder must be generated.
+ */
+ Partial1 = Quotient.Part.Lo * Divisor.Part.Hi;
+ Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo;
+ Partial3.Full = (ACPI_INTEGER) Partial2.Part.Hi + Partial1;
+
+ Remainder.Part.Hi = Partial3.Part.Lo;
+ Remainder.Part.Lo = Partial2.Part.Lo;
+
+ if (Partial3.Part.Hi == 0)
+ {
+ if (Partial3.Part.Lo >= Dividend.Part.Hi)
+ {
+ if (Partial3.Part.Lo == Dividend.Part.Hi)
+ {
+ if (Partial2.Part.Lo > Dividend.Part.Lo)
+ {
+ Quotient.Part.Lo--;
+ Remainder.Full -= Divisor.Full;
+ }
+ }
+ else
+ {
+ Quotient.Part.Lo--;
+ Remainder.Full -= Divisor.Full;
+ }
+ }
+
+ Remainder.Full = Remainder.Full - Dividend.Full;
+ Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi);
+ Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo);
+
+ if (Remainder.Part.Lo)
+ {
+ Remainder.Part.Hi--;
+ }
+ }
+ }
+
+ /* Return only what was requested */
+
+ if (OutQuotient)
+ {
+ *OutQuotient = Quotient.Full;
+ }
+ if (OutRemainder)
+ {
+ *OutRemainder = Remainder.Full;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+#else
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtShortDivide, AcpiUtDivide
+ *
+ * DESCRIPTION: Native versions of the UtDivide functions. Use these if either
+ * 1) The target is a 64-bit platform and therefore 64-bit
+ * integer math is supported directly by the machine.
+ * 2) The target is a 32-bit or 16-bit platform, and the
+ * double-precision integer math library is available to
+ * perform the divide.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtShortDivide (
+ ACPI_INTEGER *InDividend,
+ UINT32 Divisor,
+ ACPI_INTEGER *OutQuotient,
+ UINT32 *OutRemainder)
+{
+
+ ACPI_FUNCTION_TRACE ("UtShortDivide");
+
+
+ /* Always check for a zero divisor */
+
+ if (Divisor == 0)
+ {
+ ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ /* Return only what was requested */
+
+ if (OutQuotient)
+ {
+ *OutQuotient = *InDividend / Divisor;
+ }
+ if (OutRemainder)
+ {
+ *OutRemainder = (UINT32) *InDividend % Divisor;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_STATUS
+AcpiUtDivide (
+ ACPI_INTEGER *InDividend,
+ ACPI_INTEGER *InDivisor,
+ ACPI_INTEGER *OutQuotient,
+ ACPI_INTEGER *OutRemainder)
+{
+ ACPI_FUNCTION_TRACE ("UtDivide");
+
+
+ /* Always check for a zero divisor */
+
+ if (*InDivisor == 0)
+ {
+ ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+
+ /* Return only what was requested */
+
+ if (OutQuotient)
+ {
+ *OutQuotient = *InDividend / *InDivisor;
+ }
+ if (OutRemainder)
+ {
+ *OutRemainder = *InDividend % *InDivisor;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+#endif
+
+
diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c
new file mode 100644
index 0000000..7d927bc
--- /dev/null
+++ b/sys/contrib/dev/acpica/utmisc.c
@@ -0,0 +1,1657 @@
+/*******************************************************************************
+ *
+ * Module Name: utmisc - common utility procedures
+ * $Revision: 97 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __UTMISC_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPrintString
+ *
+ * PARAMETERS: String - Null terminated ASCII string
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
+ * sequences.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtPrintString (
+ char *String,
+ UINT8 MaxLength)
+{
+ UINT32 i;
+
+
+ if (!String)
+ {
+ AcpiOsPrintf ("<\"NULL STRING PTR\">");
+ return;
+ }
+
+ AcpiOsPrintf ("\"");
+ for (i = 0; String[i] && (i < MaxLength); i++)
+ {
+ /* Escape sequences */
+
+ switch (String[i])
+ {
+ case 0x07:
+ AcpiOsPrintf ("\\a"); /* BELL */
+ break;
+
+ case 0x08:
+ AcpiOsPrintf ("\\b"); /* BACKSPACE */
+ break;
+
+ case 0x0C:
+ AcpiOsPrintf ("\\f"); /* FORMFEED */
+ break;
+
+ case 0x0A:
+ AcpiOsPrintf ("\\n"); /* LINEFEED */
+ break;
+
+ case 0x0D:
+ AcpiOsPrintf ("\\r"); /* CARRIAGE RETURN*/
+ break;
+
+ case 0x09:
+ AcpiOsPrintf ("\\t"); /* HORIZONTAL TAB */
+ break;
+
+ case 0x0B:
+ AcpiOsPrintf ("\\v"); /* VERTICAL TAB */
+ break;
+
+ case '\'': /* Single Quote */
+ case '\"': /* Double Quote */
+ case '\\': /* Backslash */
+ AcpiOsPrintf ("\\%c", (int) String[i]);
+ break;
+
+ default:
+
+ /* Check for printable character or hex escape */
+
+ if (ACPI_IS_PRINT (String[i]))
+ {
+ /* This is a normal character */
+
+ AcpiOsPrintf ("%c", (int) String[i]);
+ }
+ else
+ {
+ /* All others will be Hex escapes */
+
+ AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]);
+ }
+ break;
+ }
+ }
+ AcpiOsPrintf ("\"");
+
+ if (i == MaxLength && String[i])
+ {
+ AcpiOsPrintf ("...");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDwordByteSwap
+ *
+ * PARAMETERS: Value - Value to be converted
+ *
+ * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiUtDwordByteSwap (
+ UINT32 Value)
+{
+ union
+ {
+ UINT32 Value;
+ UINT8 Bytes[4];
+ } Out;
+
+ union
+ {
+ UINT32 Value;
+ UINT8 Bytes[4];
+ } In;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ In.Value = Value;
+
+ Out.Bytes[0] = In.Bytes[3];
+ Out.Bytes[1] = In.Bytes[2];
+ Out.Bytes[2] = In.Bytes[1];
+ Out.Bytes[3] = In.Bytes[0];
+
+ return (Out.Value);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSetIntegerWidth
+ *
+ * PARAMETERS: Revision From DSDT header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the global integer bit width based upon the revision
+ * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
+ * For Revision 2 and above, Integers are 64 bits. Yes, this
+ * makes a difference.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtSetIntegerWidth (
+ UINT8 Revision)
+{
+
+ if (Revision <= 1)
+ {
+ AcpiGbl_IntegerBitWidth = 32;
+ AcpiGbl_IntegerNybbleWidth = 8;
+ AcpiGbl_IntegerByteWidth = 4;
+ }
+ else
+ {
+ AcpiGbl_IntegerBitWidth = 64;
+ AcpiGbl_IntegerNybbleWidth = 16;
+ AcpiGbl_IntegerByteWidth = 8;
+ }
+}
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDisplayInitPathname
+ *
+ * PARAMETERS: ObjHandle - Handle whose pathname will be displayed
+ * Path - Additional path string to be appended.
+ * (NULL if no extra path)
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDisplayInitPathname (
+ UINT8 Type,
+ ACPI_NAMESPACE_NODE *ObjHandle,
+ char *Path)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Only print the path if the appropriate debug level is enabled */
+
+ if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
+ {
+ return;
+ }
+
+ /* Get the full pathname to the node */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Print what we're doing */
+
+ switch (Type)
+ {
+ case ACPI_TYPE_METHOD:
+ AcpiOsPrintf ("Executing ");
+ break;
+
+ default:
+ AcpiOsPrintf ("Initializing ");
+ break;
+ }
+
+ /* Print the object type and pathname */
+
+ AcpiOsPrintf ("%-12s %s", AcpiUtGetTypeName (Type), (char *) Buffer.Pointer);
+
+ /* Extra path is used to append names like _STA, _INI, etc. */
+
+ if (Path)
+ {
+ AcpiOsPrintf (".%s", Path);
+ }
+ AcpiOsPrintf ("\n");
+
+ ACPI_MEM_FREE (Buffer.Pointer);
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidAcpiName
+ *
+ * PARAMETERS: Character - The character to be examined
+ *
+ * RETURN: 1 if Character may appear in a name, else 0
+ *
+ * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
+ * 1) Upper case alpha
+ * 2) numeric
+ * 3) underscore
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidAcpiName (
+ UINT32 Name)
+{
+ char *NamePtr = (char *) &Name;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ if (!((NamePtr[i] == '_') ||
+ (NamePtr[i] >= 'A' && NamePtr[i] <= 'Z') ||
+ (NamePtr[i] >= '0' && NamePtr[i] <= '9')))
+ {
+ return (FALSE);
+ }
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidAcpiCharacter
+ *
+ * PARAMETERS: Character - The character to be examined
+ *
+ * RETURN: 1 if Character may appear in a name, else 0
+ *
+ * DESCRIPTION: Check for a printable character
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidAcpiCharacter (
+ char Character)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+ return ((BOOLEAN) ((Character == '_') ||
+ (Character >= 'A' && Character <= 'Z') ||
+ (Character >= '0' && Character <= '9')));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrtoul64
+ *
+ * PARAMETERS: String - Null terminated string
+ * Terminater - Where a pointer to the terminating byte is returned
+ * Base - Radix of the string
+ *
+ * RETURN: Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value.
+ *
+ ******************************************************************************/
+#define NEGATIVE 1
+#define POSITIVE 0
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger)
+{
+ UINT32 Index;
+ ACPI_INTEGER ReturnValue = 0;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_INTEGER Dividend;
+ ACPI_INTEGER Quotient;
+
+
+ *RetInteger = 0;
+
+ switch (Base)
+ {
+ case 0:
+ case 8:
+ case 10:
+ case 16:
+ break;
+
+ default:
+ /*
+ * The specified Base parameter is not in the domain of
+ * this function:
+ */
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * skip over any white space in the buffer:
+ */
+ while (ACPI_IS_SPACE (*String) || *String == '\t')
+ {
+ ++String;
+ }
+
+ /*
+ * If the input parameter Base is zero, then we need to
+ * determine if it is octal, decimal, or hexadecimal:
+ */
+ if (Base == 0)
+ {
+ if (*String == '0')
+ {
+ if (ACPI_TOLOWER (*(++String)) == 'x')
+ {
+ Base = 16;
+ ++String;
+ }
+ else
+ {
+ Base = 8;
+ }
+ }
+ else
+ {
+ Base = 10;
+ }
+ }
+
+ /*
+ * For octal and hexadecimal bases, skip over the leading
+ * 0 or 0x, if they are present.
+ */
+ if (Base == 8 && *String == '0')
+ {
+ String++;
+ }
+
+ if (Base == 16 &&
+ *String == '0' &&
+ ACPI_TOLOWER (*(++String)) == 'x')
+ {
+ String++;
+ }
+
+ /* Main loop: convert the string to an unsigned long */
+
+ while (*String)
+ {
+ if (ACPI_IS_DIGIT (*String))
+ {
+ Index = ((UINT8) *String) - '0';
+ }
+ else
+ {
+ Index = (UINT8) ACPI_TOUPPER (*String);
+ if (ACPI_IS_UPPER ((char) Index))
+ {
+ Index = Index - 'A' + 10;
+ }
+ else
+ {
+ goto ErrorExit;
+ }
+ }
+
+ if (Index >= Base)
+ {
+ goto ErrorExit;
+ }
+
+ /* Check to see if value is out of range: */
+
+ Dividend = ACPI_INTEGER_MAX - (ACPI_INTEGER) Index;
+ (void) AcpiUtShortDivide (&Dividend, Base, &Quotient, NULL);
+ if (ReturnValue > Quotient)
+ {
+ goto ErrorExit;
+ }
+
+ ReturnValue *= Base;
+ ReturnValue += Index;
+ ++String;
+ }
+
+ *RetInteger = ReturnValue;
+ return (Status);
+
+
+ErrorExit:
+ switch (Base)
+ {
+ case 8:
+ Status = AE_BAD_OCTAL_CONSTANT;
+ break;
+
+ case 10:
+ Status = AE_BAD_DECIMAL_CONSTANT;
+ break;
+
+ case 16:
+ Status = AE_BAD_HEX_CONSTANT;
+ break;
+
+ default:
+ /* Base validated above */
+ break;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrupr
+ *
+ * PARAMETERS: SrcString - The source string to convert to
+ *
+ * RETURN: SrcString
+ *
+ * DESCRIPTION: Convert string to uppercase
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrupr (
+ char *SrcString)
+{
+ char *String;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Walk entire string, uppercasing the letters */
+
+ for (String = SrcString; *String; )
+ {
+ *String = (char) ACPI_TOUPPER (*String);
+ String++;
+ }
+
+ return (SrcString);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMutexInitialize
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create the system mutex objects.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtMutexInitialize (
+ void)
+{
+ UINT32 i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtMutexInitialize");
+
+
+ /*
+ * Create each of the predefined mutex objects
+ */
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ Status = AcpiUtCreateMutex (i);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+
+ Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMutexTerminate
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete all of the system mutex objects.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtMutexTerminate (
+ void)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("UtMutexTerminate");
+
+
+ /*
+ * Delete each predefined mutex object
+ */
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ (void) AcpiUtDeleteMutex (i);
+ }
+
+ AcpiOsDeleteLock (AcpiGbl_GpeLock);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be created
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreateMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (!AcpiGbl_MutexInfo[MutexId].Mutex)
+ {
+ Status = AcpiOsCreateSemaphore (1, 1,
+ &AcpiGbl_MutexInfo[MutexId].Mutex);
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[MutexId].UseCount = 0;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be deleted
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtDeleteMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
+
+ AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAcquireMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be acquired
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAcquireMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ UINT32 ThisThreadId;
+
+
+ ACPI_FUNCTION_NAME ("UtAcquireMutex");
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ ThisThreadId = AcpiOsGetThreadId ();
+
+ /*
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than or equal to this one. If so, the thread has violated
+ * the mutex ordering rule. This indicates a coding error somewhere in
+ * the ACPI subsystem code.
+ */
+ for (i = MutexId; i < MAX_MUTEX; i++)
+ {
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
+ {
+ if (i == MutexId)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] already acquired by this thread [%X]\n",
+ AcpiUtGetMutexName (MutexId), ThisThreadId));
+
+ return (AE_ALREADY_ACQUIRED);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (i),
+ AcpiUtGetMutexName (MutexId)));
+
+ return (AE_ACQUIRE_DEADLOCK);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X attempting to acquire Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+
+ Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
+ 1, ACPI_WAIT_FOREVER);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+
+ AcpiGbl_MutexInfo[MutexId].UseCount++;
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId),
+ AcpiFormatException (Status)));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReleaseMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be released
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtReleaseMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ UINT32 ThisThreadId;
+
+
+ ACPI_FUNCTION_NAME ("UtReleaseMutex");
+
+
+ ThisThreadId = AcpiOsGetThreadId ();
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X releasing Mutex [%s]\n", ThisThreadId,
+ AcpiUtGetMutexName (MutexId)));
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Mutex must be acquired in order to release it!
+ */
+ if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] is not acquired, cannot release\n",
+ AcpiUtGetMutexName (MutexId)));
+
+ return (AE_NOT_ACQUIRED);
+ }
+
+ /*
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than this one. If so, the thread has violated the mutex
+ * ordering rule. This indicates a coding error somewhere in
+ * the ACPI subsystem code.
+ */
+ for (i = MutexId; i < MAX_MUTEX; i++)
+ {
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
+ {
+ if (i == MutexId)
+ {
+ continue;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid release order: owns [%s], releasing [%s]\n",
+ AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
+
+ return (AE_RELEASE_DEADLOCK);
+ }
+ }
+
+ /* Mark unlocked FIRST */
+
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId),
+ AcpiFormatException (Status)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateUpdateStateAndPush
+ *
+ * PARAMETERS: *Object - Object to be added to the new state
+ * Action - Increment/Decrement
+ * StateList - List the state will be added to
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreateUpdateStateAndPush (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action,
+ ACPI_GENERIC_STATE **StateList)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Ignore null objects; these are expected */
+
+ if (!Object)
+ {
+ return (AE_OK);
+ }
+
+ State = AcpiUtCreateUpdateState (Object, Action);
+ if (!State)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ AcpiUtPushGenericState (StateList, State);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreatePkgStateAndPush
+ *
+ * PARAMETERS: *Object - Object to be added to the new state
+ * Action - Increment/Decrement
+ * StateList - List the state will be added to
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreatePkgStateAndPush (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index,
+ ACPI_GENERIC_STATE **StateList)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
+ if (!State)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ AcpiUtPushGenericState (StateList, State);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPushGenericState
+ *
+ * PARAMETERS: ListHead - Head of the state stack
+ * State - State object to push
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Push a state object onto a state stack
+ *
+ ******************************************************************************/
+
+void
+AcpiUtPushGenericState (
+ ACPI_GENERIC_STATE **ListHead,
+ ACPI_GENERIC_STATE *State)
+{
+ ACPI_FUNCTION_TRACE ("UtPushGenericState");
+
+
+ /* Push the state object onto the front of the list (stack) */
+
+ State->Common.Next = *ListHead;
+ *ListHead = State;
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPopGenericState
+ *
+ * PARAMETERS: ListHead - Head of the state stack
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Pop a state object from a state stack
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtPopGenericState (
+ ACPI_GENERIC_STATE **ListHead)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtPopGenericState");
+
+
+ /* Remove the state object at the head of the list (stack) */
+
+ State = *ListHead;
+ if (State)
+ {
+ /* Update the list head */
+
+ *ListHead = State->Common.Next;
+ }
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateGenericState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a generic state object. Attempt to obtain one from
+ * the global state cache; If none available, create a new one.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateGenericState (void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ State = AcpiUtAcquireFromCache (ACPI_MEM_LIST_STATE);
+
+ /* Initialize */
+
+ if (State)
+ {
+ State->Common.DataType = ACPI_DESC_TYPE_STATE;
+ }
+
+ return (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateThreadState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Thread State
+ *
+ * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
+ * to track per-thread info during method execution
+ *
+ ******************************************************************************/
+
+ACPI_THREAD_STATE *
+AcpiUtCreateThreadState (
+ void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtCreateThreadState");
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
+ State->Thread.ThreadId = AcpiOsGetThreadId ();
+
+ return_PTR ((ACPI_THREAD_STATE *) State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateUpdateState
+ *
+ * PARAMETERS: Object - Initial Object to be installed in the
+ * state
+ * Action - Update action to be performed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
+ * to update reference counts and delete complex objects such
+ * as packages.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateUpdateState (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
+ State->Update.Object = Object;
+ State->Update.Value = Action;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreatePkgState
+ *
+ * PARAMETERS: Object - Initial Object to be installed in the
+ * state
+ * Action - Update action to be performed
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a "Package State"
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreatePkgState (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE;
+ State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
+ State->Pkg.DestObject = ExternalObject;
+ State->Pkg.Index = Index;
+ State->Pkg.NumPackages = 1;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateControlState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
+ * to support nested IF/WHILE constructs in the AML.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateControlState (
+ void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtCreateControlState");
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the control struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
+ State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteGenericState
+ *
+ * PARAMETERS: State - The state object to be deleted
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Put a state object back into the global state cache. The object
+ * is not actually freed at this time.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteGenericState (
+ ACPI_GENERIC_STATE *State)
+{
+ ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
+
+
+ AcpiUtReleaseToCache (ACPI_MEM_LIST_STATE, State);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteGenericStateCache
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Purge the global state object cache. Used during subsystem
+ * termination.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteGenericStateCache (
+ void)
+{
+ ACPI_FUNCTION_TRACE ("UtDeleteGenericStateCache");
+
+
+ AcpiUtDeleteGenericCache (ACPI_MEM_LIST_STATE);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtWalkPackageTree
+ *
+ * PARAMETERS: ObjDesc - The Package object on which to resolve refs
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk through a package
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtWalkPackageTree (
+ ACPI_OPERAND_OBJECT *SourceObject,
+ void *TargetObject,
+ ACPI_PKG_CALLBACK WalkCallback,
+ void *Context)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *StateList = NULL;
+ ACPI_GENERIC_STATE *State;
+ UINT32 ThisIndex;
+ ACPI_OPERAND_OBJECT *ThisSourceObj;
+
+
+ ACPI_FUNCTION_TRACE ("UtWalkPackageTree");
+
+
+ State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
+ if (!State)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ while (State)
+ {
+ /* Get one element of the package */
+
+ ThisIndex = State->Pkg.Index;
+ ThisSourceObj = (ACPI_OPERAND_OBJECT *)
+ State->Pkg.SourceObject->Package.Elements[ThisIndex];
+
+ /*
+ * Check for:
+ * 1) An uninitialized package element. It is completely
+ * legal to declare a package and leave it uninitialized
+ * 2) Not an internal object - can be a namespace node instead
+ * 3) Any type other than a package. Packages are handled in else
+ * case below.
+ */
+ if ((!ThisSourceObj) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) ||
+ (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE))
+ {
+ Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj,
+ State, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ State->Pkg.Index++;
+ while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count)
+ {
+ /*
+ * We've handled all of the objects at this level, This means
+ * that we have just completed a package. That package may
+ * have contained one or more packages itself.
+ *
+ * Delete this state and pop the previous state (package).
+ */
+ AcpiUtDeleteGenericState (State);
+ State = AcpiUtPopGenericState (&StateList);
+
+ /* Finished when there are no more states */
+
+ if (!State)
+ {
+ /*
+ * We have handled all of the objects in the top level
+ * package just add the length of the package objects
+ * and exit
+ */
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Go back up a level and move the index past the just
+ * completed package object.
+ */
+ State->Pkg.Index++;
+ }
+ }
+ else
+ {
+ /* This is a subobject of type package */
+
+ Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj,
+ State, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Push the current state and create a new one
+ * The callback above returned a new target package object.
+ */
+ AcpiUtPushGenericState (&StateList, State);
+ State = AcpiUtCreatePkgState (ThisSourceObj,
+ State->Pkg.ThisTargetObj, 0);
+ if (!State)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ }
+ }
+
+ /* We should never get here */
+
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGenerateChecksum
+ *
+ * PARAMETERS: Buffer - Buffer to be scanned
+ * Length - number of bytes to examine
+ *
+ * RETURN: checksum
+ *
+ * DESCRIPTION: Generate a checksum on a raw buffer
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiUtGenerateChecksum (
+ UINT8 *Buffer,
+ UINT32 Length)
+{
+ UINT32 i;
+ signed char Sum = 0;
+
+
+ for (i = 0; i < Length; i++)
+ {
+ Sum = (signed char) (Sum + Buffer[i]);
+ }
+
+ return ((UINT8) (0 - Sum));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceEndTag
+ *
+ * PARAMETERS: ObjDesc - The resource template buffer object
+ *
+ * RETURN: Pointer to the end tag
+ *
+ * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
+ *
+ ******************************************************************************/
+
+
+UINT8 *
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT8 BufferByte;
+ UINT8 *Buffer;
+ UINT8 *EndBuffer;
+
+
+ Buffer = ObjDesc->Buffer.Pointer;
+ EndBuffer = Buffer + ObjDesc->Buffer.Length;
+
+ while (Buffer < EndBuffer)
+ {
+ BufferByte = *Buffer;
+ if (BufferByte & ACPI_RDESC_TYPE_MASK)
+ {
+ /* Large Descriptor - Length is next 2 bytes */
+
+ Buffer += ((*(Buffer+1) | (*(Buffer+2) << 8)) + 3);
+ }
+ else
+ {
+ /* Small Descriptor. End Tag will be found here */
+
+ if ((BufferByte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG)
+ {
+ /* Found the end tag descriptor, all done. */
+
+ return (Buffer);
+ }
+
+ /* Length is in the header */
+
+ Buffer += ((BufferByte & 0x07) + 1);
+ }
+ }
+
+ /* End tag not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReportError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ * Message - Error message to use on failure
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print error message
+ *
+ ******************************************************************************/
+
+void
+AcpiUtReportError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId)
+{
+
+
+ AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReportWarning
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ * Message - Error message to use on failure
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print warning message
+ *
+ ******************************************************************************/
+
+void
+AcpiUtReportWarning (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId)
+{
+
+ AcpiOsPrintf ("%8s-%04d: *** Warning: ", ModuleName, LineNumber);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReportInfo
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ * Message - Error message to use on failure
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print information message
+ *
+ ******************************************************************************/
+
+void
+AcpiUtReportInfo (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId)
+{
+
+ AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c
new file mode 100644
index 0000000..cd8d04c
--- /dev/null
+++ b/sys/contrib/dev/acpica/utobject.c
@@ -0,0 +1,726 @@
+/******************************************************************************
+ *
+ * Module Name: utobject - ACPI object create/delete/size/cache routines
+ * $Revision: 83 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTOBJECT_C__
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utobject")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateInternalObjectDbg
+ *
+ * PARAMETERS: ModuleName - Source file name of caller
+ * LineNumber - Line number of caller
+ * ComponentId - Component type of caller
+ * Type - ACPI Type of the new object
+ *
+ * RETURN: Object - The new object. Null on failure
+ *
+ * DESCRIPTION: Create and initialize a new internal object.
+ *
+ * NOTE: We always allocate the worst-case object descriptor because
+ * these objects are cached, and we want them to be
+ * one-size-satisifies-any-request. This in itself may not be
+ * the most memory efficient, but the efficiency of the object
+ * cache should more than make up for this!
+ *
+ ******************************************************************************/
+
+ACPI_OPERAND_OBJECT *
+AcpiUtCreateInternalObjectDbg (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId,
+ ACPI_OBJECT_TYPE Type)
+{
+ ACPI_OPERAND_OBJECT *Object;
+ ACPI_OPERAND_OBJECT *SecondObject;
+
+
+ ACPI_FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type));
+
+
+ /* Allocate the raw object descriptor */
+
+ Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
+ if (!Object)
+ {
+ return_PTR (NULL);
+ }
+
+ switch (Type)
+ {
+ case ACPI_TYPE_REGION:
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /* These types require a secondary object */
+
+ SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
+ if (!SecondObject)
+ {
+ AcpiUtDeleteObjectDesc (Object);
+ return_PTR (NULL);
+ }
+
+ SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA;
+ SecondObject->Common.ReferenceCount = 1;
+
+ /* Link the second object to the first */
+
+ Object->Common.NextObject = SecondObject;
+ break;
+
+ default:
+ /* All others have no secondary object */
+ break;
+ }
+
+ /* Save the object type in the object descriptor */
+
+ Object->Common.Type = (UINT8) Type;
+
+ /* Init the reference count */
+
+ Object->Common.ReferenceCount = 1;
+
+ /* Any per-type initialization should go here */
+
+ return_PTR (Object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateBufferObject
+ *
+ * PARAMETERS: BufferSize - Size of buffer to be created
+ *
+ * RETURN: Pointer to a new Buffer object
+ *
+ * DESCRIPTION: Create a fully initialized buffer object
+ *
+ ******************************************************************************/
+
+ACPI_OPERAND_OBJECT *
+AcpiUtCreateBufferObject (
+ ACPI_SIZE BufferSize)
+{
+ ACPI_OPERAND_OBJECT *BufferDesc;
+ UINT8 *Buffer = NULL;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize);
+
+
+ /*
+ * Create a new Buffer object
+ */
+ BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!BufferDesc)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Create an actual buffer only if size > 0 */
+
+ if (BufferSize > 0)
+ {
+ /* Allocate the actual buffer */
+
+ Buffer = ACPI_MEM_CALLOCATE (BufferSize);
+ if (!Buffer)
+ {
+ ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n",
+ (UINT32) BufferSize));
+ AcpiUtRemoveReference (BufferDesc);
+ return_PTR (NULL);
+ }
+ }
+
+ /* Complete buffer object initialization */
+
+ BufferDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
+ BufferDesc->Buffer.Pointer = Buffer;
+ BufferDesc->Buffer.Length = (UINT32) BufferSize;
+
+ /* Return the new buffer descriptor */
+
+ return_PTR (BufferDesc);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidInternalObject
+ *
+ * PARAMETERS: Object - Object to be validated
+ *
+ * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidInternalObject (
+ void *Object)
+{
+
+ ACPI_FUNCTION_NAME ("UtValidInternalObject");
+
+
+ /* Check for a null pointer */
+
+ if (!Object)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n"));
+ return (FALSE);
+ }
+
+ /* Check the descriptor type field */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (Object))
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+
+ /* The object appears to be a valid ACPI_OPERAND_OBJECT */
+
+ return (TRUE);
+
+ case ACPI_DESC_TYPE_NAMED:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a named obj, not ACPI obj\n", Object));
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a parser obj, not ACPI obj\n", Object));
+ break;
+
+ case ACPI_DESC_TYPE_CACHED:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "**** Obj %p has already been released to internal cache\n", Object));
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "**** Obj %p has unknown descriptor type %X\n", Object,
+ ACPI_GET_DESCRIPTOR_TYPE (Object)));
+ break;
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateObjectDescDbg
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * ComponentId - Caller's component ID (for error output)
+ *
+ * RETURN: Pointer to newly allocated object descriptor. Null on error
+ *
+ * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
+ * error conditions.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocateObjectDescDbg (
+ char *ModuleName,
+ UINT32 LineNumber,
+ UINT32 ComponentId)
+{
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ ACPI_FUNCTION_TRACE ("UtAllocateObjectDescDbg");
+
+
+ Object = AcpiUtAcquireFromCache (ACPI_MEM_LIST_OPERAND);
+ if (!Object)
+ {
+ _ACPI_REPORT_ERROR (ModuleName, LineNumber, ComponentId,
+ ("Could not allocate an object descriptor\n"));
+
+ return_PTR (NULL);
+ }
+
+ /* Mark the descriptor type */
+
+ ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
+ Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT)));
+
+ return_PTR (Object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteObjectDesc
+ *
+ * PARAMETERS: Object - An Acpi internal object to be deleted
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteObjectDesc (
+ ACPI_OPERAND_OBJECT *Object)
+{
+ ACPI_FUNCTION_TRACE_PTR ("UtDeleteObjectDesc", Object);
+
+
+ /* Object must be an ACPI_OPERAND_OBJECT */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Obj %p is not an ACPI object\n", Object));
+ return_VOID;
+ }
+
+ AcpiUtReleaseToCache (ACPI_MEM_LIST_OPERAND, Object);
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteObjectCache
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Purge the global state object cache. Used during subsystem
+ * termination.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteObjectCache (
+ void)
+{
+ ACPI_FUNCTION_TRACE ("UtDeleteObjectCache");
+
+
+ AcpiUtDeleteGenericCache (ACPI_MEM_LIST_OPERAND);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetSimpleObjectSize
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are examining
+ * *ObjLength - Where the length is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ * contain a simple object for return to an external user.
+ *
+ * The length includes the object structure plus any additional
+ * needed space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtGetSimpleObjectSize (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_SIZE *ObjLength)
+{
+ ACPI_SIZE Length;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject);
+
+
+ /* Handle a null object (Could be a uninitialized package element -- which is legal) */
+
+ if (!InternalObject)
+ {
+ *ObjLength = 0;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Start with the length of the Acpi object */
+
+ Length = sizeof (ACPI_OBJECT);
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED)
+ {
+ /* Object is a named object (reference), just return the length */
+
+ *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * The final length depends on the object type
+ * Strings and Buffers are packed right up against the parent object and
+ * must be accessed bytewise or there may be alignment problems on
+ * certain processors
+ */
+ switch (ACPI_GET_OBJECT_TYPE (InternalObject))
+ {
+ case ACPI_TYPE_STRING:
+
+ Length += (ACPI_SIZE) InternalObject->String.Length + 1;
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ Length += (ACPI_SIZE) InternalObject->Buffer.Length;
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+
+ /*
+ * No extra data for these types
+ */
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ switch (InternalObject->Reference.Opcode)
+ {
+ case AML_INT_NAMEPATH_OP:
+
+ /*
+ * Get the actual length of the full pathname to this object.
+ * The reference will be converted to the pathname to the object
+ */
+ Length += ACPI_ROUND_UP_TO_NATIVE_WORD (AcpiNsGetPathnameLength (InternalObject->Reference.Node));
+ break;
+
+ default:
+
+ /*
+ * No other reference opcodes are supported.
+ * Notably, Locals and Args are not supported, but this may be
+ * required eventually.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported Reference opcode=%X in object %p\n",
+ InternalObject->Reference.Opcode, InternalObject));
+ Status = AE_TYPE;
+ break;
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
+ ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject));
+ Status = AE_TYPE;
+ break;
+ }
+
+ /*
+ * Account for the space required by the object rounded up to the next
+ * multiple of the machine word size. This keeps each object aligned
+ * on a machine word boundary. (preventing alignment faults on some
+ * machines.)
+ */
+ *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetElementLength
+ *
+ * PARAMETERS: ACPI_PKG_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the length of one package element.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtGetElementLength (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
+ ACPI_SIZE ObjectSpace;
+
+
+ switch (ObjectType)
+ {
+ case ACPI_COPY_TYPE_SIMPLE:
+
+ /*
+ * Simple object - just get the size (Null object/entry is handled
+ * here also) and sum it into the running package length
+ */
+ Status = AcpiUtGetSimpleObjectSize (SourceObject, &ObjectSpace);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Info->Length += ObjectSpace;
+ break;
+
+
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /* Package object - nothing much to do here, let the walk handle it */
+
+ Info->NumPackages++;
+ State->Pkg.ThisTargetObj = NULL;
+ break;
+
+
+ default:
+
+ /* No other types allowed */
+
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetPackageObjectSize
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are examining
+ * *ObjLength - Where the length is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ * contain a package object for return to an external user.
+ *
+ * This is moderately complex since a package contains other
+ * objects including packages.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtGetPackageObjectSize (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_SIZE *ObjLength)
+{
+ ACPI_STATUS Status;
+ ACPI_PKG_INFO Info;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject);
+
+
+ Info.Length = 0;
+ Info.ObjectSpace = 0;
+ Info.NumPackages = 1;
+
+ Status = AcpiUtWalkPackageTree (InternalObject, NULL,
+ AcpiUtGetElementLength, &Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * We have handled all of the objects in all levels of the package.
+ * just add the length of the package objects themselves.
+ * Round up to the next machine word.
+ */
+ Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
+ (ACPI_SIZE) Info.NumPackages;
+
+ /* Return the total package length */
+
+ *ObjLength = Info.Length;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetObjectSize
+ *
+ * PARAMETERS: *InternalObject - Pointer to the object we are examining
+ * *ObjLength - Where the length will be returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ * contain an object for return to an API user.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtGetObjectSize(
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_SIZE *ObjLength)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) &&
+ (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE))
+ {
+ Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength);
+ }
+ else
+ {
+ Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength);
+ }
+
+ return (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c
new file mode 100644
index 0000000..e0d8500
--- /dev/null
+++ b/sys/contrib/dev/acpica/utxface.c
@@ -0,0 +1,608 @@
+/******************************************************************************
+ *
+ * Module Name: utxface - External interfaces for "global" ACPI functions
+ * $Revision: 104 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#define __UTXFACE_C__
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acdebug.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInitializeSubsystem
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initializes all global variables. This is the first function
+ * called, so any early initialization belongs here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInitializeSubsystem (
+ void)
+{
+ ACPI_STATUS Status;
+
+ ACPI_FUNCTION_TRACE ("AcpiInitializeSubsystem");
+
+
+ ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
+
+
+ /* Initialize all globals used by the subsystem */
+
+ AcpiUtInitGlobals ();
+
+ /* Initialize the OS-Dependent layer */
+
+ Status = AcpiOsInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Create the default mutex objects */
+
+ Status = AcpiUtMutexInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Initialize the namespace manager and
+ * the root of the namespace tree
+ */
+
+ Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+
+ /* If configured, initialize the AML debugger */
+
+ ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnableSubsystem
+ *
+ * PARAMETERS: Flags - Init/enable Options
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Completes the subsystem initialization including hardware.
+ * Puts system into ACPI mode if it isn't already.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnableSubsystem (
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiEnableSubsystem");
+
+
+ /*
+ * We must initialize the hardware before we can enable ACPI.
+ * The values from the FADT are validated here.
+ */
+ if (!(Flags & ACPI_NO_HARDWARE_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n"));
+
+ Status = AcpiHwInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Enable ACPI mode
+ */
+ if (!(Flags & ACPI_NO_ACPI_ENABLE))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
+
+ AcpiGbl_OriginalMode = AcpiHwGetMode();
+
+ Status = AcpiEnable ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiEnable failed.\n"));
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Initialize ACPI Event handling
+ *
+ * NOTE: We must have the hardware AND events initialized before we can execute
+ * ANY control methods SAFELY. Any control method can require ACPI hardware
+ * support, so the hardware MUST be initialized before execution!
+ */
+ if (!(Flags & ACPI_NO_EVENT_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n"));
+
+ Status = AcpiEvInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Install the SCI handler, Global Lock handler, and GPE handlers */
+
+ if (!(Flags & ACPI_NO_HANDLER_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n"));
+
+ Status = AcpiEvHandlerInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInitializeObjects
+ *
+ * PARAMETERS: Flags - Init/enable Options
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Completes namespace initialization by initializing device
+ * objects and executing AML code for Regions, buffers, etc.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInitializeObjects (
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInitializeObjects");
+
+
+ /*
+ * Install the default OpRegion handlers. These are installed unless
+ * other handlers have already been installed via the
+ * InstallAddressSpaceHandler interface.
+ *
+ * NOTE: This will cause _REG methods to be run. Any objects accessed
+ * by the _REG methods will be automatically initialized, even if they
+ * contain executable AML (see call to AcpiNsInitializeObjects below).
+ */
+ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
+
+ Status = AcpiEvInitAddressSpaces ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Initialize the objects that remain uninitialized. This
+ * runs the executable AML that may be part of the declaration of these
+ * objects: OperationRegions, BufferFields, Buffers, and Packages.
+ */
+ if (!(Flags & ACPI_NO_OBJECT_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n"));
+
+ Status = AcpiNsInitializeObjects ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Initialize all device objects in the namespace
+ * This runs the _STA and _INI methods.
+ */
+ if (!(Flags & ACPI_NO_DEVICE_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
+
+ Status = AcpiNsInitializeDevices ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
+ * Empty the caches (delete the cached objects) on the assumption that
+ * the table load filled them up more than they will be at runtime --
+ * thus wasting non-paged memory.
+ */
+ Status = AcpiPurgeCachedObjects ();
+
+ AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTerminate
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTerminate (void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiTerminate");
+
+
+ /* Terminate the AML Debugger if present */
+
+ ACPI_DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE);
+
+ /* Shutdown and free all resources */
+
+ AcpiUtSubsystemShutdown ();
+
+
+ /* Free the mutex objects */
+
+ AcpiUtMutexTerminate ();
+
+
+#ifdef ACPI_DEBUGGER
+
+ /* Shut down the debugger */
+
+ AcpiDbTerminate ();
+#endif
+
+ /* Now we can shutdown the OS-dependent layer */
+
+ Status = AcpiOsTerminate ();
+ return_ACPI_STATUS (Status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiSubsystemStatus
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status of the ACPI subsystem
+ *
+ * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
+ * before making any other calls, to ensure the subsystem initial-
+ * ized successfully.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiSubsystemStatus (void)
+{
+ if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK)
+ {
+ return (AE_OK);
+ }
+ else
+ {
+ return (AE_ERROR);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetSystemInfo
+ *
+ * PARAMETERS: OutBuffer - a pointer to a buffer to receive the
+ * resources for the device
+ * BufferLength - the number of bytes available in the buffer
+ *
+ * RETURN: Status - the status of the call
+ *
+ * DESCRIPTION: This function is called to get information about the current
+ * state of the ACPI subsystem. It will return system information
+ * in the OutBuffer.
+ *
+ * If the function fails an appropriate status will be returned
+ * and the value of OutBuffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetSystemInfo (
+ ACPI_BUFFER *OutBuffer)
+{
+ ACPI_SYSTEM_INFO *InfoPtr;
+ UINT32 i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetSystemInfo");
+
+
+ /* Parameter validation */
+
+ Status = AcpiUtValidateBuffer (OutBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Populate the return buffer
+ */
+ InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
+
+ InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
+
+ /* System flags (ACPI capabilities) */
+
+ InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
+
+ /* Timer resolution - 24 or 32 bits */
+
+ if (!AcpiGbl_FADT)
+ {
+ InfoPtr->TimerResolution = 0;
+ }
+ else if (AcpiGbl_FADT->TmrValExt == 0)
+ {
+ InfoPtr->TimerResolution = 24;
+ }
+ else
+ {
+ InfoPtr->TimerResolution = 32;
+ }
+
+ /* Clear the reserved fields */
+
+ InfoPtr->Reserved1 = 0;
+ InfoPtr->Reserved2 = 0;
+
+ /* Current debug levels */
+
+ InfoPtr->DebugLayer = AcpiDbgLayer;
+ InfoPtr->DebugLevel = AcpiDbgLevel;
+
+ /* Current status of the ACPI tables, per table type */
+
+ InfoPtr->NumTableTypes = NUM_ACPI_TABLE_TYPES;
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ {
+ InfoPtr->TableInfo[i].Count = AcpiGbl_TableLists[i].Count;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiInstallInitializationHandler
+ *
+ * PARAMETERS: Handler - Callback procedure
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install an initialization handler
+ *
+ * TBD: When a second function is added, must save the Function also.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiInstallInitializationHandler (
+ ACPI_INIT_HANDLER Handler,
+ UINT32 Function)
+{
+
+ if (!Handler)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ if (AcpiGbl_InitHandler)
+ {
+ return (AE_ALREADY_EXISTS);
+ }
+
+ AcpiGbl_InitHandler = Handler;
+ return AE_OK;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiPurgeCachedObjects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Empty all caches (delete the cached objects)
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiPurgeCachedObjects (void)
+{
+ ACPI_FUNCTION_TRACE ("AcpiPurgeCachedObjects");
+
+
+ AcpiUtDeleteGenericStateCache ();
+ AcpiUtDeleteObjectCache ();
+ AcpiDsDeleteWalkStateCache ();
+ AcpiPsDeleteParseCache ();
+
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/sys/contrib/dev/ath/COPYRIGHT b/sys/contrib/dev/ath/COPYRIGHT
new file mode 100644
index 0000000..3aa63a2
--- /dev/null
+++ b/sys/contrib/dev/ath/COPYRIGHT
@@ -0,0 +1,42 @@
+All files contained in this distribution are covered by the following
+copyright unless explicitly identified otherwise. Note that this
+copyright does _NOT_ contain a "or GPL" clause and does _NOT_ permit
+redistribution with changes.
+
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: COPYRIGHT,v 1.2 2003/06/25 04:50:21 sam Exp $
+ */
diff --git a/sys/contrib/dev/ath/README b/sys/contrib/dev/ath/README
new file mode 100644
index 0000000..734938f
--- /dev/null
+++ b/sys/contrib/dev/ath/README
@@ -0,0 +1,64 @@
+$Id: README,v 1.2 2003/07/02 01:55:27 sam Exp $
+
+
+WARNING: THIS IS A BETA DISTRIBUTION. THIS SOFTWARE HAS KNOWN PROBLEMS AND
+WARNING: LIMITATIONS THAT WILL BE CORRECTED BEFORE A PRODUCTION RELEASE.
+WARNING: USE AT YOUR OWN RISK!
+
+
+Atheros Hardware Access Layer (HAL)
+===================================
+
+* Copyright (c) 2002, 2003 Sam Leffler.
+* Copyright (c) 2002, 2003 Atheros Communications, Inc.
+* All rights reserved.
+
+Read the file COPYRIGHT for the complete copyright.
+
+This code manages much of the chip-specific operation of the Atheros driver.
+The HAL is provided in a binary-only form in order to comply with FCC
+regulations. In particular, a radio transmitter can only be operated at
+power levels and on frequency channels for which it is approved. The FCC
+requires that a software-defined radio cannot be configured by a user
+to operate outside the approved power levels and frequency channels.
+This makes it difficult to open-source code that enforces limits on
+the power levels, frequency channels and other parameters of the radio
+transmitter. See
+
+http://ftp.fcc.gov/Bureaus/Engineering_Technology/Orders/2001/fcc01264.pdf
+
+for the specific FCC regulation. Because the module is provided in a
+binary-only form it is marked "Proprietary"; this means when you load
+it you will see messages that your system is now "tainted".
+
+If you wish to use this driver on a platform for which an ath_hal
+module is not already provided please contact the author. Note that
+this is only necessary for new _architectures_; the HAL is not tied to
+any specific version of your operating system.
+
+
+Atheros Hardware
+================
+There are currently 3 generations of Atheros 802.11 wireless devices:
+
+5210 supports 11a only
+5211 supports both 11a and 11b
+5212 supports 11a, 11b, and 11g
+
+These parts have been incorporated in a variety of retail products
+including cardbus cards from DLink, Linksys, Netgear, and Proxim; and
+mini-pci cards from some of these same vendors. In addition many
+laptop vendors use Atheros mini-pci cards for their builtin wireless
+support. An (incomplete) list of products that use Atheros parts is:
+
+Netgear WAG511 D-Link DWL-AG520 Linksys WPC55AG
+Netgear WAB501 D-Link DWL-AG650 Linksys WMP55AG
+ D-Link DWL-AB650 Linksys WPC51AB
+
+In general, if a device is identified as ``11a only'' it is almost
+certain to contain an Atheros 5210 part in it. All retail a+b
+products use the 5211. The latest generation of universal a+b+g
+combo products use the 5212. When in doubt check the PCI vendor
+id with a tool like lspci, the Atheros vendor id is 0x168c; e.g.
+
+ 00:13.0 Ethernet controller: Unknown device 168c:0012 (rev 01)
diff --git a/sys/contrib/dev/ath/ah.h b/sys/contrib/dev/ath/ah.h
new file mode 100644
index 0000000..52d987b
--- /dev/null
+++ b/sys/contrib/dev/ath/ah.h
@@ -0,0 +1,548 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: ah.h,v 1.41 2003/11/01 01:05:45 sam Exp $
+ */
+
+#ifndef _ATH_AH_H_
+#define _ATH_AH_H_
+/*
+ * Atheros Hardware Access Layer
+ *
+ * Clients of the HAL call ath_hal_attach to obtain a reference to an ath_hal
+ * structure for use with the device. Hardware-related operations that
+ * follow must call back into the HAL through interface, supplying the
+ * reference as the first parameter.
+ */
+#include "ah_osdep.h"
+
+/*
+ * Status codes that may be returned by the HAL. Note that
+ * interfaces that return a status code set it only when an
+ * error occurs--i.e. you cannot check it for success.
+ */
+typedef enum {
+ HAL_OK = 0, /* No error */
+ HAL_ENXIO = 1, /* No hardware present */
+ HAL_ENOMEM = 2, /* Memory allocation failed */
+ HAL_EIO = 3, /* Hardware didn't respond as expected */
+ HAL_EEMAGIC = 4, /* EEPROM magic number invalid */
+ HAL_EEVERSION = 5, /* EEPROM version invalid */
+ HAL_EELOCKED = 6, /* EEPROM unreadable */
+ HAL_EEBADSUM = 7, /* EEPROM checksum invalid */
+ HAL_EEREAD = 8, /* EEPROM read problem */
+ HAL_EEBADMAC = 9, /* EEPROM mac address invalid */
+ HAL_EESIZE = 10, /* EEPROM size not supported */
+ HAL_EEWRITE = 11, /* Attempt to change write-locked EEPROM */
+ HAL_EINVAL = 12, /* Invalid parameter to function */
+ HAL_ENOTSUPP = 13, /* Hardware revision not supported */
+ HAL_ESELFTEST = 14, /* Hardware self-test failed */
+ HAL_EINPROGRESS = 15, /* Operation incomplete */
+} HAL_STATUS;
+
+typedef enum {
+ AH_FALSE = 0, /* NB: lots of code assumes false is zero */
+ AH_TRUE = 1,
+} HAL_BOOL;
+
+/*
+ * "States" for setting the LED. These correspond to
+ * the possible 802.11 operational states and there may
+ * be a many-to-one mapping between these states and the
+ * actual hardware states for the LED's (i.e. the hardware
+ * may have fewer states).
+ */
+typedef enum {
+ HAL_LED_INIT = 0,
+ HAL_LED_SCAN = 1,
+ HAL_LED_AUTH = 2,
+ HAL_LED_ASSOC = 3,
+ HAL_LED_RUN = 4
+} HAL_LED_STATE;
+
+/*
+ * Transmit queue types/numbers. These are used to tag
+ * each transmit queue in the hardware and to identify a set
+ * of transmit queues for operations such as start/stop dma.
+ */
+typedef enum {
+ HAL_TX_QUEUE_INACTIVE = 0, /* queue is inactive/unused */
+ HAL_TX_QUEUE_DATA = 1, /* data xmit q's */
+ HAL_TX_QUEUE_BEACON = 2, /* beacon xmit q */
+ HAL_TX_QUEUE_CAB = 3, /* "crap after beacon" xmit q */
+ HAL_TX_QUEUE_PSPOLL = 4, /* power-save poll xmit q */
+} HAL_TX_QUEUE;
+
+#define HAL_NUM_TX_QUEUES 10 /* max possible # of queues */
+
+/*
+ * Transmit packet types. This belongs in ah_desc.h, but
+ * is here so we can give a proper type to various parameters
+ * (and not require everyone include the file).
+ *
+ * NB: These values are intentionally assigned for
+ * direct use when setting up h/w descriptors.
+ */
+typedef enum {
+ HAL_PKT_TYPE_NORMAL = 0,
+ HAL_PKT_TYPE_ATIM = 1,
+ HAL_PKT_TYPE_PSPOLL = 2,
+ HAL_PKT_TYPE_BEACON = 3,
+ HAL_PKT_TYPE_PROBE_RESP = 4,
+} HAL_PKT_TYPE;
+
+/* Rx Filter Frame Types */
+typedef enum {
+ HAL_RX_FILTER_UCAST = 0x00000001, /* Allow unicast frames */
+ HAL_RX_FILTER_MCAST = 0x00000002, /* Allow multicast frames */
+ HAL_RX_FILTER_BCAST = 0x00000004, /* Allow broadcast frames */
+ HAL_RX_FILTER_CONTROL = 0x00000008, /* Allow control frames */
+ HAL_RX_FILTER_BEACON = 0x00000010, /* Allow beacon frames */
+ HAL_RX_FILTER_PROM = 0x00000020, /* Promiscuous mode */
+ HAL_RX_FILTER_PROBEREQ = 0x00000080, /* Allow probe request frames */
+ HAL_RX_FILTER_PHYERR = 0x00000100, /* Allow phy errors */
+ HAL_RX_FILTER_PHYRADAR = 0x00000200, /* Allow phy radar errors*/
+} HAL_RX_FILTER;
+
+typedef enum {
+ HAL_PM_UNDEFINED = 0,
+ HAL_PM_AUTO = 1,
+ HAL_PM_AWAKE = 2,
+ HAL_PM_FULL_SLEEP = 3,
+ HAL_PM_NETWORK_SLEEP = 4
+} HAL_POWER_MODE;
+
+/*
+ * NOTE WELL:
+ * These are mapped to take advantage of the common locations for many of
+ * the bits on all of the currently supported MAC chips. This is to make
+ * the ISR as efficient as possible, while still abstracting HW differences.
+ * When new hardware breaks this commonality this enumerated type, as well
+ * as the HAL functions using it, must be modified. All values are directly
+ * mapped unless commented otherwise.
+ */
+typedef enum {
+ HAL_INT_RX = 0x00000001, /* Non-common mapping */
+ HAL_INT_RXDESC = 0x00000002,
+ HAL_INT_RXNOFRM = 0x00000008,
+ HAL_INT_RXEOL = 0x00000010,
+ HAL_INT_RXORN = 0x00000020,
+ HAL_INT_TX = 0x00000040, /* Non-common mapping */
+ HAL_INT_TXDESC = 0x00000080,
+ HAL_INT_TXURN = 0x00000800,
+ HAL_INT_MIB = 0x00001000,
+ HAL_INT_RXPHY = 0x00004000,
+ HAL_INT_RXKCM = 0x00008000,
+ HAL_INT_SWBA = 0x00010000,
+ HAL_INT_BMISS = 0x00040000,
+ HAL_INT_BNR = 0x00100000, /* Non-common mapping */
+ HAL_INT_GPIO = 0x01000000,
+ HAL_INT_FATAL = 0x40000000, /* Non-common mapping */
+ HAL_INT_GLOBAL = 0x80000000, /* Set/clear IER */
+
+ /* Interrupt bits that map directly to ISR/IMR bits */
+ HAL_INT_COMMON = HAL_INT_RXNOFRM
+ | HAL_INT_RXDESC
+ | HAL_INT_RXEOL
+ | HAL_INT_RXORN
+ | HAL_INT_TXURN
+ | HAL_INT_TXDESC
+ | HAL_INT_MIB
+ | HAL_INT_RXPHY
+ | HAL_INT_RXKCM
+ | HAL_INT_SWBA
+ | HAL_INT_BMISS
+ | HAL_INT_GPIO,
+ HAL_INT_NOCARD = 0xffffffff /* To signal the card was removed */
+} HAL_INT;
+
+typedef enum {
+ HAL_RFGAIN_INACTIVE = 0,
+ HAL_RFGAIN_READ_REQUESTED = 1,
+ HAL_RFGAIN_NEED_CHANGE = 2
+} HAL_RFGAIN;
+
+/*
+ * Channels are specified by frequency.
+ */
+typedef struct {
+ u_int16_t channel; /* setting in Mhz */
+ u_int16_t channelFlags; /* see below */
+} HAL_CHANNEL;
+
+#define CHANNEL_RAD_INT 0x0001 /* Radar interference detected on channel */
+#define CHANNEL_CW_INT 0x0002 /* CW interference detected on channel */
+#define CHANNEL_BUSY 0x0004 /* Busy, occupied or overlap with adjoin chan */
+#define CHANNEL_TURBO 0x0010 /* Turbo Channel */
+#define CHANNEL_CCK 0x0020 /* CCK channel */
+#define CHANNEL_OFDM 0x0040 /* OFDM channel */
+#define CHANNEL_2GHZ 0x0080 /* 2 GHz spectrum channel. */
+#define CHANNEL_5GHZ 0x0100 /* 5 GHz spectrum channel */
+#define CHANNEL_PASSIVE 0x0200 /* Only passive scan allowed in the channel */
+#define CHANNEL_DYN 0x0400 /* dynamic CCK-OFDM channel */
+
+#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
+#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
+#define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM)
+#ifdef notdef
+#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN)
+#else
+#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
+#endif
+#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
+#define CHANNEL_ALL \
+ (CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_5GHZ|CHANNEL_2GHZ|CHANNEL_TURBO)
+#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO)
+
+typedef struct {
+ u_int32_t ackrcv_bad;
+ u_int32_t rts_bad;
+ u_int32_t rts_good;
+ u_int32_t fcs_bad;
+ u_int32_t beacons;
+} HAL_MIB_STATS;
+
+typedef u_int16_t HAL_CTRY_CODE; /* country code */
+typedef u_int16_t HAL_REG_DOMAIN; /* regulatory domain code */
+
+enum {
+ CTRY_DEBUG = 0x1ff, /* debug country code */
+ CTRY_DEFAULT = 0 /* default country code */
+};
+
+enum {
+ HAL_MODE_11A = 0x001,
+ HAL_MODE_TURBO = 0x002,
+ HAL_MODE_11B = 0x004,
+ HAL_MODE_PUREG = 0x008,
+#ifdef notdef
+ HAL_MODE_11G = 0x010,
+#else
+ HAL_MODE_11G = 0x008,
+#endif
+ HAL_MODE_ALL = 0xfff
+};
+
+typedef struct {
+ u_int16_t rateCount;
+ u_int8_t rateCodeToIndex[32]; /* back mapping */
+ struct {
+ u_int8_t valid; /* valid for rate control use */
+ u_int8_t phy; /* CCK/OFDM/XR */
+ u_int16_t rateKbps; /* transfer rate in kbs */
+ u_int8_t rateCode; /* rate for h/w descriptors */
+ u_int8_t shortPreamble; /* mask for enabling short
+ * preamble in CCK rate code */
+ u_int8_t dot11Rate; /* value for supported rates
+ * info element of MLME */
+ u_int8_t controlRate; /* index of next lower basic
+ * rate; used for dur. calcs */
+ } info[32];
+} HAL_RATE_TABLE;
+
+typedef struct {
+ u_int rs_count; /* number of valid entries */
+ u_int8_t rs_rates[32]; /* rates */
+} HAL_RATE_SET;
+
+typedef enum {
+ HAL_ANT_VARIABLE = 0, /* variable by programming */
+ HAL_ANT_FIXED_A = 1, /* fixed to 11a frequencies */
+ HAL_ANT_FIXED_B = 2, /* fixed to 11b frequencies */
+} HAL_ANT_SETTING;
+
+typedef enum {
+ HAL_M_STA = 1, /* infrastructure station */
+ HAL_M_IBSS = 0, /* IBSS (adhoc) station */
+ HAL_M_HOSTAP = 6, /* Software Access Point */
+ HAL_M_MONITOR = 8 /* Monitor mode */
+} HAL_OPMODE;
+
+typedef struct {
+ int wk_len;
+ u_int8_t wk_key[16]; /* XXX big enough for WEP */
+} HAL_KEYVAL;
+
+typedef enum {
+ HAL_CIPHER_WEP = 0,
+ HAL_CIPHER_AES_CCM = 1,
+ HAL_CIPHER_CKIP = 2
+} HAL_CIPHER;
+
+enum {
+ HAL_SLOT_TIME_9 = 9,
+ HAL_SLOT_TIME_20 = 20,
+};
+
+/*
+ * Per-station beacon timer state.
+ */
+typedef struct {
+ u_int32_t bs_nexttbtt; /* next beacon in TU */
+ u_int32_t bs_nextdtim; /* next DTIM in TU */
+ u_int16_t bs_intval; /* beacon interval/period */
+ u_int8_t bs_dtimperiod;
+ u_int8_t bs_cfpperiod; /* # of DTIMs between CFPs */
+ u_int16_t bs_cfpmaxduration; /* max CFP duration in TU */
+ u_int16_t bs_cfpduremain; /* remaining CFP duration */
+ u_int16_t bs_timoffset;
+ u_int16_t bs_sleepduration; /* max sleep duration */
+ u_int16_t bs_bmissthreshold; /* beacon miss threshold */
+} HAL_BEACON_STATE;
+
+struct ath_desc;
+
+/*
+ * Hardware Access Layer (HAL) API.
+ *
+ * Clients of the HAL call ath_hal_attach to obtain a reference to an
+ * ath_hal structure for use with the device. Hardware-related operations
+ * that follow must call back into the HAL through interface, supplying
+ * the reference as the first parameter. Note that before using the
+ * reference returned by ath_hal_attach the caller should verify the
+ * ABI version number.
+ */
+struct ath_hal {
+ u_int32_t ah_magic; /* consistency check magic number */
+ u_int32_t ah_abi; /* HAL ABI version */
+#define HAL_ABI_VERSION 0x03103100 /* YYMMDDnn */
+ u_int16_t ah_devid; /* PCI device ID */
+ u_int16_t ah_subvendorid; /* PCI subvendor ID */
+ HAL_SOFTC ah_sc; /* back pointer to driver/os state */
+ HAL_BUS_TAG ah_st; /* params for register r+w */
+ HAL_BUS_HANDLE ah_sh;
+ HAL_CTRY_CODE ah_countryCode;
+
+ u_int32_t ah_macVersion; /* MAC version id */
+ u_int16_t ah_macRev; /* MAC revision */
+ u_int16_t ah_phyRev; /* PHY revision */
+ u_int16_t ah_analog5GhzRev;/* 2GHz radio revision */
+ u_int16_t ah_analog2GhzRev;/* 5GHz radio revision */
+
+ const HAL_RATE_TABLE *(*ah_getRateTable)(struct ath_hal *, u_int mode);
+ void (*ah_detach)(struct ath_hal*);
+
+ /* Reset functions */
+ HAL_BOOL (*ah_reset)(struct ath_hal *, HAL_OPMODE,
+ HAL_CHANNEL *, HAL_BOOL bChannelChange,
+ HAL_STATUS *status);
+ HAL_BOOL (*ah_setPCUConfig)(struct ath_hal *, HAL_OPMODE);
+ HAL_BOOL (*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *);
+
+ /* Transmit functions */
+ HAL_BOOL (*ah_updateTxTrigLevel)(struct ath_hal*,
+ HAL_BOOL incTrigLevel);
+ int (*ah_setupTxQueue)(struct ath_hal *, HAL_TX_QUEUE type,
+ HAL_BOOL irq);
+ HAL_BOOL (*ah_releaseTxQueue)(struct ath_hal *ah, u_int q);
+ HAL_BOOL (*ah_resetTxQueue)(struct ath_hal *ah, u_int q);
+ u_int32_t (*ah_getTxDP)(struct ath_hal*, u_int);
+ HAL_BOOL (*ah_setTxDP)(struct ath_hal*, u_int, u_int32_t txdp);
+ HAL_BOOL (*ah_startTxDma)(struct ath_hal*, u_int);
+ HAL_BOOL (*ah_stopTxDma)(struct ath_hal*, u_int);
+ HAL_BOOL (*ah_setupTxDesc)(struct ath_hal *, struct ath_desc *,
+ u_int pktLen, u_int hdrLen,
+ HAL_PKT_TYPE type, u_int txPower,
+ u_int txRate0, u_int txTries0,
+ u_int keyIx, u_int antMode, u_int flags,
+ u_int rtsctsRate, u_int rtsctsDuration);
+ HAL_BOOL (*ah_setupXTxDesc)(struct ath_hal *, struct ath_desc *,
+ HAL_BOOL shortPreamble,
+ u_int txRate1, u_int txTries1,
+ u_int txRate2, u_int txTries2,
+ u_int txRate3, u_int txTries3);
+ HAL_BOOL (*ah_fillTxDesc)(struct ath_hal *, struct ath_desc *,
+ u_int segLen, HAL_BOOL firstSeg,
+ HAL_BOOL lastSeg);
+ HAL_STATUS (*ah_procTxDesc)(struct ath_hal *, struct ath_desc *);
+ HAL_BOOL (*ah_hasVEOL)(struct ath_hal *);
+
+ /* Receive Functions */
+ u_int32_t (*ah_getRxDP)(struct ath_hal*);
+ void (*ah_setRxDP)(struct ath_hal*, u_int32_t rxdp);
+ void (*ah_enableReceive)(struct ath_hal*);
+ HAL_BOOL (*ah_stopDmaReceive)(struct ath_hal*);
+ void (*ah_startPcuReceive)(struct ath_hal*);
+ void (*ah_stopPcuReceive)(struct ath_hal*);
+ void (*ah_setMulticastFilter)(struct ath_hal*,
+ u_int32_t filter0, u_int32_t filter1);
+ HAL_BOOL (*ah_setMulticastFilterIndex)(struct ath_hal*,
+ u_int32_t index);
+ HAL_BOOL (*ah_clrMulticastFilterIndex)(struct ath_hal*,
+ u_int32_t index);
+ u_int32_t (*ah_getRxFilter)(struct ath_hal*);
+ void (*ah_setRxFilter)(struct ath_hal*, u_int32_t);
+ HAL_BOOL (*ah_setupRxDesc)(struct ath_hal *, struct ath_desc *,
+ u_int32_t size, u_int flags);
+ HAL_STATUS (*ah_procRxDesc)(struct ath_hal *, struct ath_desc *);
+ void (*ah_rxMonitor)(struct ath_hal *);
+
+ /* Misc Functions */
+ void (*ah_dumpState)(struct ath_hal *);
+ void (*ah_dumpEeprom)(struct ath_hal *);
+ void (*ah_dumpRfGain)(struct ath_hal *);
+ void (*ah_dumpAni)(struct ath_hal *);
+ void (*ah_getMacAddress)(struct ath_hal *, u_int8_t *);
+ HAL_BOOL (*ah_setRegulatoryDomain)(struct ath_hal*,
+ u_int16_t, HAL_STATUS *);
+ void (*ah_setLedState)(struct ath_hal*, HAL_LED_STATE);
+ void (*ah_writeAssocid)(struct ath_hal*,
+ const u_int8_t *bssid, u_int16_t assocId,
+ u_int16_t timOffset);
+ u_int32_t (*ah_gpioGet)(struct ath_hal*, u_int32_t gpio);
+ void (*ah_gpioSetIntr)(struct ath_hal*, u_int, u_int32_t);
+ u_int32_t (*ah_getTsf32)(struct ath_hal*);
+ u_int64_t (*ah_getTsf64)(struct ath_hal*);
+ void (*ah_resetTsf)(struct ath_hal*);
+ u_int16_t (*ah_getRegDomain)(struct ath_hal*);
+ u_int (*ah_getWirelessModes)(struct ath_hal*);
+ HAL_BOOL (*ah_getRfKill)(struct ath_hal*);
+ u_int32_t (*ah_getRandomSeed)(struct ath_hal*);
+ HAL_BOOL (*ah_detectCardPresent)(struct ath_hal*);
+ void (*ah_updateMibCounters)(struct ath_hal*, HAL_MIB_STATS*);
+ HAL_BOOL (*ah_isHwCipherSupported)(struct ath_hal*, HAL_CIPHER);
+ HAL_RFGAIN (*ah_getRfGain)(struct ath_hal*);
+#if 0
+ u_int32_t (*ah_getCurRssi)(struct ath_hal*);
+ u_int32_t (*ah_getDefAntenna)(struct ath_hal*);
+ void (*ah_setDefAntenna)(struct ath_hal*, u_int32_t antenna);
+#endif
+ HAL_BOOL (*ah_setSlotTime)(struct ath_hal*, u_int);
+
+ /* Key Cache Functions */
+ u_int32_t (*ah_getKeyCacheSize)(struct ath_hal*);
+ HAL_BOOL (*ah_resetKeyCacheEntry)(struct ath_hal*, u_int16_t);
+ HAL_BOOL (*ah_isKeyCacheEntryValid)(struct ath_hal *, u_int16_t);
+ HAL_BOOL (*ah_setKeyCacheEntry)(struct ath_hal*,
+ u_int16_t, const HAL_KEYVAL *, u_int8_t *, int);
+ HAL_BOOL (*ah_setKeyCacheEntryMac)(struct ath_hal*,
+ u_int16_t, u_int8_t *);
+
+ /* Power Management Functions */
+ HAL_BOOL (*ah_setPowerMode)(struct ath_hal*,
+ HAL_POWER_MODE mode, int setChip,
+ u_int16_t sleepDuration);
+ HAL_POWER_MODE (*ah_getPowerMode)(struct ath_hal*);
+ HAL_BOOL (*ah_queryPSPollSupport)(struct ath_hal*);
+ HAL_BOOL (*ah_initPSPoll)(struct ath_hal*);
+ HAL_BOOL (*ah_enablePSPoll)(struct ath_hal *,
+ u_int8_t *, u_int16_t);
+ HAL_BOOL (*ah_disablePSPoll)(struct ath_hal *);
+
+ /* Beacon Management Functions */
+ void (*ah_beaconInit)(struct ath_hal *, HAL_OPMODE,
+ u_int32_t, u_int32_t);
+ void (*ah_setStationBeaconTimers)(struct ath_hal*,
+ const HAL_BEACON_STATE *, u_int32_t tsf,
+ u_int32_t dtimCount, u_int32_t cfpCcount);
+ void (*ah_resetStationBeaconTimers)(struct ath_hal*);
+ HAL_BOOL (*ah_waitForBeaconDone)(struct ath_hal *,
+ HAL_BUS_ADDR);
+
+ /* Interrupt functions */
+ HAL_BOOL (*ah_isInterruptPending)(struct ath_hal*);
+ HAL_BOOL (*ah_getPendingInterrupts)(struct ath_hal*, HAL_INT *);
+ HAL_INT (*ah_getInterrupts)(struct ath_hal*);
+ HAL_INT (*ah_setInterrupts)(struct ath_hal*, HAL_INT);
+};
+
+/*
+ * Check the PCI vendor ID and device ID against Atheros' values
+ * and return a printable description for any Atheros hardware.
+ * AH_NULL is returned if the ID's do not describe Atheros hardware.
+ */
+extern const char *ath_hal_probe(u_int16_t vendorid, u_int16_t devid);
+
+/*
+ * Attach the HAL for use with the specified device. The device is
+ * defined by the PCI device ID. The caller provides an opaque pointer
+ * to an upper-layer data structure (HAL_SOFTC) that is stored in the
+ * HAL state block for later use. Hardware register accesses are done
+ * using the specified bus tag and handle. On successful return a
+ * reference to a state block is returned that must be supplied in all
+ * subsequent HAL calls. Storage associated with this reference is
+ * dynamically allocated and must be freed by calling the ah_detach
+ * method when the client is done. If the attach operation fails a
+ * null (AH_NULL) reference will be returned and a status code will
+ * be returned if the status parameter is non-zero.
+ */
+extern struct ath_hal *ath_hal_attach(u_int16_t devid, HAL_SOFTC,
+ HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status);
+
+/*
+ * Return a list of channels available for use with the hardware.
+ * The list is based on what the hardware is capable of, the specified
+ * country code, the modeSelect mask, and whether or not outdoor
+ * channels are to be permitted.
+ *
+ * The channel list is returned in the supplied array. maxchans
+ * defines the maximum size of this array. nchans contains the actual
+ * number of channels returned. If a problem occurred or there were
+ * no channels that met the criteria then AH_FALSE is returned.
+ */
+extern HAL_BOOL ath_hal_init_channels(struct ath_hal *,
+ HAL_CHANNEL *chans, u_int maxchans, u_int *nchans,
+ HAL_CTRY_CODE cc, u_int16_t modeSelect, int enableOutdoor);
+
+/*
+ * Return bit mask of wireless modes supported by the hardware.
+ */
+extern u_int ath_hal_getwirelessmodes(struct ath_hal *ah, HAL_CTRY_CODE cc);
+
+/*
+ * Return rate table for specified mode (11a, 11b, 11g, etc).
+ */
+extern const HAL_RATE_TABLE *ath_hal_getratetable(struct ath_hal *,
+ u_int mode);
+
+/*
+ * Calculate the transmit duration of a frame.
+ */
+extern u_int16_t ath_hal_computetxtime(struct ath_hal *,
+ const HAL_RATE_TABLE *rates, u_int32_t frameLen,
+ u_int16_t rateix, HAL_BOOL shortPreamble);
+
+/*
+ * Convert between IEEE channel number and channel frequency
+ * using the specified channel flags; e.g. CHANNEL_2GHZ.
+ */
+extern u_int ath_hal_mhz2ieee(u_int mhz, u_int flags);
+extern u_int ath_hal_ieee2mhz(u_int ieee, u_int flags);
+
+/*
+ * Return a version string for the HAL release.
+ */
+extern char ath_hal_version[];
+#endif /* _ATH_AH_H_ */
diff --git a/sys/contrib/dev/ath/ah_desc.h b/sys/contrib/dev/ath/ah_desc.h
new file mode 100644
index 0000000..baa330e
--- /dev/null
+++ b/sys/contrib/dev/ath/ah_desc.h
@@ -0,0 +1,172 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: ah_desc.h,v 1.11 2003/06/25 04:50:22 sam Exp $
+ */
+
+#ifndef _DEV_ATH_DESC_H
+#define _DEV_ATH_DESC_H
+
+/*
+ * Transmit descriptor status. This structure is filled
+ * in only after the tx descriptor process method finds a
+ * ``done'' descriptor; at which point it returns something
+ * other than HAL_EINPROGRESS.
+ *
+ * Note that ts_antenna may not be valid for all h/w. It
+ * should be used only if non-zero.
+ */
+struct ath_tx_status {
+ u_int16_t ts_seqnum; /* h/w assigned sequence number */
+ u_int16_t ts_tstamp; /* h/w assigned timestamp */
+ u_int8_t ts_status; /* frame status, 0 => xmit ok */
+ u_int8_t ts_rate; /* h/w transmit rate index */
+ int8_t ts_rssi; /* tx ack RSSI */
+ u_int8_t ts_shortretry; /* # short retries */
+ u_int8_t ts_longretry; /* # long retries */
+ u_int8_t ts_virtcol; /* virtual collision count */
+ u_int8_t ts_antenna; /* antenna information */
+};
+
+#define HAL_TXERR_XRETRY 0x01 /* excessive retries */
+#define HAL_TXERR_FILT 0x02 /* blocked by tx filtering */
+#define HAL_TXERR_FIFO 0x04 /* fifo underrun */
+
+/*
+ * Receive descriptor status. This structure is filled
+ * in only after the rx descriptor process method finds a
+ * ``done'' descriptor; at which point it returns something
+ * other than HAL_EINPROGRESS.
+ *
+ * If rx_status is zero, then the frame was received ok;
+ * otherwise the error information is indicated and rs_phyerr
+ * contains a phy error code if HAL_RXERR_PHY is set.
+ *
+ * Note that the receive timestamp is expanded using the TSF to
+ * a full 16 bits (regardless of what the h/w provides directly).
+ */
+struct ath_rx_status {
+ u_int16_t rs_datalen; /* rx frame length */
+ u_int16_t rs_tstamp; /* h/w assigned timestamp */
+ u_int8_t rs_status; /* rx status, 0 => recv ok */
+ u_int8_t rs_phyerr; /* phy error code */
+ int8_t rs_rssi; /* rx frame RSSI */
+ u_int8_t rs_keyix; /* key cache index */
+ u_int8_t rs_rate; /* h/w receive rate index */
+ u_int8_t rs_antenna; /* antenna information */
+ u_int8_t rs_more; /* more descriptors follow */
+};
+
+#define HAL_RXERR_CRC 0x01 /* CRC error on frame */
+#define HAL_RXERR_PHY 0x02 /* PHY error, rs_phyerr is valid */
+#define HAL_RXERR_FIFO 0x04 /* fifo overrun */
+#define HAL_RXERR_DECRYPT 0x08 /* non-Michael decrypt error */
+#define HAL_RXERR_MIC 0x10 /* Michael MIC decrypt error */
+
+enum {
+ HAL_PHYERR_UNDERRUN = 0, /* Transmit underrun */
+ HAL_PHYERR_TIMING = 1, /* Timing error */
+ HAL_PHYERR_PARITY = 2, /* Illegal parity */
+ HAL_PHYERR_RATE = 3, /* Illegal rate */
+ HAL_PHYERR_LENGTH = 4, /* Illegal length */
+ HAL_PHYERR_RADAR = 5, /* Radar detect */
+ HAL_PHYERR_SERVICE = 6, /* Illegal service */
+ HAL_PHYERR_TOR = 7, /* Transmit override receive */
+ /* NB: these are specific to the 5212 */
+ HAL_PHYERR_OFDM_TIMING = 17, /* */
+ HAL_PHYERR_OFDM_SIGNAL_PARITY = 18, /* */
+ HAL_PHYERR_OFDM_RATE_ILLEGAL = 19, /* */
+ HAL_PHYERR_OFDM_LENGTH_ILLEGAL = 20, /* */
+ HAL_PHYERR_OFDM_POWER_DROP = 21, /* */
+ HAL_PHYERR_OFDM_SERVICE = 22, /* */
+ HAL_PHYERR_OFDM_RESTART = 23, /* */
+ HAL_PHYERR_CCK_TIMING = 25, /* */
+ HAL_PHYERR_CCK_HEADER_CRC = 26, /* */
+ HAL_PHYERR_CCK_RATE_ILLEGAL = 27, /* */
+ HAL_PHYERR_CCK_SERVICE = 30, /* */
+ HAL_PHYERR_CCK_RESTART = 31, /* */
+};
+
+/* value found in rs_keyix to mark invalid entries */
+#define HAL_RXKEYIX_INVALID ((u_int8_t) -1)
+/* value used to specify no encryption key for xmit */
+#define HAL_TXKEYIX_INVALID ((u_int) -1)
+
+/* XXX rs_antenna definitions */
+
+/*
+ * Definitions for the software frame/packet descriptors used by
+ * the Atheros HAL. This definition obscures hardware-specific
+ * details from the driver. Drivers are expected to fillin the
+ * portions of a descriptor that are not opaque then use HAL calls
+ * to complete the work. Status for completed frames is returned
+ * in a device-independent format.
+ */
+struct ath_desc {
+ /*
+ * The following definitions are passed directly
+ * the hardware and managed by the HAL. Drivers
+ * should not touch those elements marked opaque.
+ */
+ u_int32_t ds_link; /* phys address of next descriptor */
+ u_int32_t ds_data; /* phys address of data buffer */
+ u_int32_t ds_ctl0; /* opaque DMA control 0 */
+ u_int32_t ds_ctl1; /* opaque DMA control 1 */
+ u_int32_t ds_hw[4]; /* opaque h/w region */
+ /*
+ * The remaining definitions are managed by software;
+ * these are valid only after the rx/tx process descriptor
+ * methods return a non-EINPROGRESS code.
+ */
+ union {
+ struct ath_tx_status tx;/* xmit status */
+ struct ath_rx_status rx;/* recv status */
+ } ds_us;
+} __attribute__((__packed__));
+
+#define ds_txstat ds_us.tx
+#define ds_rxstat ds_us.rx
+
+/* flags passed to tx descriptor setup methods */
+#define HAL_TXDESC_CLRDMASK 0x0001 /* clear destination filter mask */
+#define HAL_TXDESC_NOACK 0x0002 /* don't wait for ACK */
+#define HAL_TXDESC_RTSENA 0x0004 /* enable RTS */
+#define HAL_TXDESC_CTSENA 0x0008 /* enable CTS */
+#define HAL_TXDESC_INTREQ 0x0010 /* enable per-descriptor interrupt */
+#define HAL_TXDESC_VEOL 0x0020 /* mark virtual EOL */
+
+/* flags passed to rx descriptor setup methods */
+#define HAL_RXDESC_INTREQ 0x0020 /* enable per-descriptor interrupt */
+#endif /* _DEV_ATH_AR521XDMA_H */
diff --git a/sys/contrib/dev/ath/ah_devid.h b/sys/contrib/dev/ath/ah_devid.h
new file mode 100644
index 0000000..1483881
--- /dev/null
+++ b/sys/contrib/dev/ath/ah_devid.h
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: ah_devid.h,v 1.7 2003/10/22 21:17:40 sam Exp $
+ */
+
+#ifndef _DEV_ATH_DEVID_H_
+#define _DEV_ATH_DEVID_H_
+
+#define ATHEROS_VENDOR_ID 0x168c /* Atheros PCI vendor ID */
+/*
+ * NB: all Atheros-based devices should have a PCI vendor ID
+ * of 0x168c, but some vendors, in their infinite wisdom
+ * do not follow this so we must handle them specially.
+ */
+#define ATHEROS_3COM_VENDOR_ID 0xa727 /* 3Com PCI vendor ID */
+
+/* AR5210 (for reference) */
+#define AR5210_DEFAULT 0x1107 /* No eeprom HW default */
+#define AR5210_PROD 0x0007 /* Final device ID */
+#define AR5210_AP 0x0207 /* Early AP11s */
+
+/* AR5211 */
+#define AR5211_DEFAULT 0x1112 /* No eeprom HW default */
+#define AR5311_DEVID 0x0011 /* Final ar5311 devid */
+#define AR5211_DEVID 0x0012 /* Final ar5211 devid */
+#define AR5211_LEGACY 0xff12 /* Original emulation board */
+#define AR5211_FPGA11B 0xf11b /* 11b emulation board */
+
+/* AR5212 */
+#define AR5212_DEFAULT 0x1113 /* No eeprom HW default */
+#define AR5212_DEVID 0x0013 /* Final ar5212 devid */
+#define AR5212_FPGA 0xf013 /* Emulation board */
+#define AR5212_DEVID_IBM 0x1014 /* IBM minipci ID */
+
+#define AR_SUBVENDOR_ID_NOG 0x0e11 /* No 11G subvendor ID */
+#endif /* _DEV_ATH_DEVID_H */
diff --git a/sys/contrib/dev/ath/freebsd/ah_if.m b/sys/contrib/dev/ath/freebsd/ah_if.m
new file mode 100644
index 0000000..5f6ffe8
--- /dev/null
+++ b/sys/contrib/dev/ath/freebsd/ah_if.m
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+# Communications, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms are permitted
+# provided that the following conditions are met:
+# 1. The materials contained herein are unmodified and are used
+# unmodified.
+# 2. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following NO
+# ''WARRANTY'' disclaimer below (''Disclaimer''), without
+# modification.
+# 3. Redistributions in binary form must reproduce at minimum a
+# disclaimer similar to the Disclaimer below and any redistribution
+# must be conditioned upon including a substantially similar
+# Disclaimer requirement for further binary redistribution.
+# 4. Neither the names of the above-listed copyright holders nor the
+# names of any contributors may be used to endorse or promote
+# product derived from this software without specific prior written
+# permission.
+#
+# NO WARRANTY
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+# FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGES.
+#
+# $Id: ah_if.m,v 1.4 2003/06/25 04:55:02 sam Exp $
+#
+
+INTERFACE ath_hal;
+
+METHOD const char* ath_hal_probe {
+ u_int16_t vendorID;
+ u_int16_ deviceID;
+};
+
+METHOD struct ath_hal* ath_hal_attach {
+ u_int16_t deviceID;
+ HAL_SOFTC sc;
+ HAL_BUS_TAG st;
+ HAL_BUS_HANDLE sh;
+ HAL_STATUS* error;
+};
+
+METHOD u_int ath_hal_init_channels {
+ struct ath_hal* ah;
+ HAL_CHANNEL* chans;
+ u_int maxchans;
+ u_int* nchans;
+ HAL_CTRY_CODE cc;
+ u_int16_t modeSelect;
+ int enableOutdoor;
+};
+
+METHOD u_int ath_hal_getwirelessmodes {
+ struct ath_hal* ah;
+ HAL_CTRY_CODE cc;
+};
+
+METHOD const HAL_RATE_TABLE* ath_hal_getratetable {
+ struct ath_hal* ah;
+ u_int mode;
+};
+
+METHOD u_int16_t ath_hal_computetxtime {
+ struct ath_hal* ah;
+ const HAL_RATE_TABLE* rates;
+ u_int32_t frameLength;
+ u_int16_t rateIndex;
+ HAL_BOOL shortPreamble;
+};
+
+METHOD u_int ath_hal_mhz2ieee {
+ u_int mhz;
+ u_int flags;
+};
+
+METHOD u_int ath_hal_ieee2mhz {
+ u_int ieee;
+ u_int flags;
+};
diff --git a/sys/contrib/dev/ath/freebsd/ah_osdep.c b/sys/contrib/dev/ath/freebsd/ah_osdep.c
new file mode 100644
index 0000000..692f581
--- /dev/null
+++ b/sys/contrib/dev/ath/freebsd/ah_osdep.c
@@ -0,0 +1,394 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: ah_osdep.c,v 1.28 2003/11/01 01:43:21 sam Exp $
+ */
+#include "opt_ah.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
+#include <sys/bus.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+
+#include <machine/stdarg.h>
+
+#include <net/ethernet.h> /* XXX for ether_sprintf */
+
+#include <contrib/dev/ath/ah.h>
+
+extern void ath_hal_printf(struct ath_hal *, const char*, ...)
+ __printflike(2,3);
+extern void ath_hal_vprintf(struct ath_hal *, const char*, __va_list)
+ __printflike(2, 0);
+extern const char* ath_hal_ether_sprintf(const u_int8_t *mac);
+extern void *ath_hal_malloc(size_t);
+extern void ath_hal_free(void *);
+#ifdef AH_ASSERT
+extern void ath_hal_assert_failed(const char* filename,
+ int lineno, const char* msg);
+#endif
+#ifdef AH_DEBUG
+extern void HALDEBUG(struct ath_hal *ah, const char* fmt, ...);
+extern void HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...);
+#endif /* AH_DEBUG */
+
+/* NB: put this here instead of the driver to avoid circular references */
+SYSCTL_NODE(_hw, OID_AUTO, ath, CTLFLAG_RD, 0, "Atheros driver parameters");
+SYSCTL_NODE(_hw_ath, OID_AUTO, hal, CTLFLAG_RD, 0, "Atheros HAL parameters");
+
+#ifdef AH_DEBUG
+static int ath_hal_debug = 0; /* XXX */
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, debug, CTLFLAG_RW, &ath_hal_debug,
+ 0, "Atheros HAL debugging printfs");
+#endif /* AH_DEBUG */
+
+SYSCTL_STRING(_hw_ath_hal, OID_AUTO, version, CTLFLAG_RD, ath_hal_version, 0,
+ "Atheros HAL version");
+
+int ath_hal_dma_beacon_response_time = 2; /* in TU's */
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, dma_brt, CTLFLAG_RW,
+ &ath_hal_dma_beacon_response_time, 0,
+ "Atheros HAL DMA beacon response time");
+int ath_hal_sw_beacon_response_time = 10; /* in TU's */
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, sw_brt, CTLFLAG_RW,
+ &ath_hal_sw_beacon_response_time, 0,
+ "Atheros HAL software beacon response time");
+int ath_hal_additional_swba_backoff = 0; /* in TU's */
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, swba_backoff, CTLFLAG_RW,
+ &ath_hal_additional_swba_backoff, 0,
+ "Atheros HAL additional SWBA backoff time");
+
+void*
+ath_hal_malloc(size_t size)
+{
+ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
+}
+
+void
+ath_hal_free(void* p)
+{
+ return free(p, M_DEVBUF);
+}
+
+void
+ath_hal_vprintf(struct ath_hal *ah, const char* fmt, va_list ap)
+{
+ vprintf(fmt, ap);
+}
+
+void
+ath_hal_printf(struct ath_hal *ah, const char* fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ ath_hal_vprintf(ah, fmt, ap);
+ va_end(ap);
+}
+
+const char*
+ath_hal_ether_sprintf(const u_int8_t *mac)
+{
+ return ether_sprintf(mac);
+}
+
+#ifdef AH_DEBUG
+void
+HALDEBUG(struct ath_hal *ah, const char* fmt, ...)
+{
+ if (ath_hal_debug) {
+ __va_list ap;
+ va_start(ap, fmt);
+ ath_hal_vprintf(ah, fmt, ap);
+ va_end(ap);
+ }
+}
+
+void
+HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...)
+{
+ if (ath_hal_debug >= level) {
+ __va_list ap;
+ va_start(ap, fmt);
+ ath_hal_vprintf(ah, fmt, ap);
+ va_end(ap);
+ }
+}
+#endif /* AH_DEBUG */
+
+#ifdef AH_DEBUG_ALQ
+/*
+ * ALQ register tracing support.
+ *
+ * Setting hw.ath.hal.alq=1 enables tracing of all register reads and
+ * writes to the file /tmp/ath_hal.log. The file format is a simple
+ * fixed-size array of records. When done logging set hw.ath.hal.alq=0
+ * and then decode the file with the arcode program (that is part of the
+ * HAL). If you start+stop tracing the data will be appended to an
+ * existing file.
+ *
+ * NB: doesn't handle multiple devices properly; only one DEVICE record
+ * is emitted and the different devices are not identified.
+ */
+#include <sys/alq.h>
+#include <sys/pcpu.h>
+#include <contrib/dev/ath/ah_decode.h>
+
+static struct alq *ath_hal_alq;
+static int ath_hal_alq_emitdev; /* need to emit DEVICE record */
+static u_int ath_hal_alq_lost; /* count of lost records */
+static const char *ath_hal_logfile = "/tmp/ath_hal.log";
+static u_int ath_hal_alq_qsize = 64*1024;
+
+static int
+ath_hal_setlogging(int enable)
+{
+ int error;
+
+ if (enable) {
+ error = suser(curthread);
+ if (error == 0) {
+ error = alq_open(&ath_hal_alq, ath_hal_logfile,
+ curthread->td_ucred,
+ sizeof (struct athregrec), ath_hal_alq_qsize);
+ ath_hal_alq_lost = 0;
+ ath_hal_alq_emitdev = 1;
+ printf("ath_hal: logging to %s enabled\n",
+ ath_hal_logfile);
+ }
+ } else {
+ if (ath_hal_alq)
+ alq_close(ath_hal_alq);
+ ath_hal_alq = NULL;
+ printf("ath_hal: logging disabled\n");
+ error = 0;
+ }
+ return (error);
+}
+
+static int
+sysctl_hw_ath_hal_log(SYSCTL_HANDLER_ARGS)
+{
+ int error, enable;
+
+ enable = (ath_hal_alq != NULL);
+ error = sysctl_handle_int(oidp, &enable, 0, req);
+ if (error || !req->newptr)
+ return (error);
+ else
+ return (ath_hal_setlogging(enable));
+}
+SYSCTL_PROC(_hw_ath_hal, OID_AUTO, alq, CTLTYPE_INT|CTLFLAG_RW,
+ 0, 0, sysctl_hw_ath_hal_log, "I", "Enable HAL register logging");
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, alq_size, CTLFLAG_RW,
+ &ath_hal_alq_qsize, 0, "In-memory log size (#records)");
+SYSCTL_INT(_hw_ath_hal, OID_AUTO, alq_lost, CTLFLAG_RW,
+ &ath_hal_alq_lost, 0, "Register operations not logged");
+
+static struct ale *
+ath_hal_alq_get(struct ath_hal *ah)
+{
+ struct ale *ale;
+
+ if (ath_hal_alq_emitdev) {
+ ale = alq_get(ath_hal_alq, ALQ_NOWAIT);
+ if (ale) {
+ struct athregrec *r =
+ (struct athregrec *) ale->ae_data;
+ r->op = OP_DEVICE;
+ r->reg = 0;
+ r->val = ah->ah_devid;
+ alq_post(ath_hal_alq, ale);
+ ath_hal_alq_emitdev = 0;
+ } else
+ ath_hal_alq_lost++;
+ }
+ ale = alq_get(ath_hal_alq, ALQ_NOWAIT);
+ if (!ale)
+ ath_hal_alq_lost++;
+ return ale;
+}
+
+void
+ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
+{
+ if (ath_hal_alq) {
+ struct ale *ale = ath_hal_alq_get(ah);
+ if (ale) {
+ struct athregrec *r = (struct athregrec *) ale->ae_data;
+ r->op = OP_WRITE;
+ r->reg = reg;
+ r->val = val;
+ alq_post(ath_hal_alq, ale);
+ }
+ }
+#if _BYTE_ORDER == _BIG_ENDIAN
+ if (reg >= 0x4000 && reg < 0x5000)
+ bus_space_write_4(ah->ah_st, ah->ah_sh, reg, htole32(val));
+ else
+#endif
+ bus_space_write_4(ah->ah_st, ah->ah_sh, reg, val);
+}
+
+u_int32_t
+ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
+{
+ u_int32_t val;
+
+ val = bus_space_read_4(ah->ah_st, ah->ah_sh, reg);
+#if _BYTE_ORDER == _BIG_ENDIAN
+ if (reg >= 0x4000 && reg < 0x5000)
+ val = le32toh(val);
+#endif
+ if (ath_hal_alq) {
+ struct ale *ale = ath_hal_alq_get(ah);
+ if (ale) {
+ struct athregrec *r = (struct athregrec *) ale->ae_data;
+ r->op = OP_READ;
+ r->reg = reg;
+ r->val = val;
+ alq_post(ath_hal_alq, ale);
+ }
+ }
+ return val;
+}
+
+void
+OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v)
+{
+ if (ath_hal_alq) {
+ struct ale *ale = ath_hal_alq_get(ah);
+ if (ale) {
+ struct athregrec *r = (struct athregrec *) ale->ae_data;
+ r->op = OP_MARK;
+ r->reg = id;
+ r->val = v;
+ alq_post(ath_hal_alq, ale);
+ }
+ }
+}
+#elif defined(AH_DEBUG) || defined(AH_REGOPS_FUNC)
+/*
+ * Memory-mapped device register read/write. These are here
+ * as routines when debugging support is enabled and/or when
+ * explicitly configured to use function calls. The latter is
+ * for architectures that might need to do something before
+ * referencing memory (e.g. remap an i/o window).
+ *
+ * NB: see the comments in ah_osdep.h about byte-swapping register
+ * reads and writes to understand what's going on below.
+ */
+
+void
+ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
+{
+#if _BYTE_ORDER == _BIG_ENDIAN
+ if (reg >= 0x4000 && reg < 0x5000)
+ bus_space_write_4(ah->ah_st, ah->ah_sh, reg, htole32(val));
+ else
+#endif
+ bus_space_write_4(ah->ah_st, ah->ah_sh, reg, val);
+}
+
+u_int32_t
+ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
+{
+ u_int32_t val;
+
+ val = bus_space_read_4(ah->ah_st, ah->ah_sh, reg);
+#if _BYTE_ORDER == _BIG_ENDIAN
+ if (reg >= 0x4000 && reg < 0x5000)
+ val = le32toh(val);
+#endif
+ return val;
+}
+#endif /* AH_DEBUG || AH_REGOPS_FUNC */
+
+#ifdef AH_ASSERT
+void
+ath_hal_assert_failed(const char* filename, int lineno, const char *msg)
+{
+ printf("Atheros HAL assertion failure: %s: line %u: %s\n",
+ filename, lineno, msg);
+ panic("ath_hal_assert");
+}
+#endif /* AH_ASSERT */
+
+/*
+ * Delay n microseconds.
+ */
+void
+ath_hal_delay(int n)
+{
+ DELAY(n);
+}
+
+u_int32_t
+ath_hal_getuptime(struct ath_hal *ah)
+{
+ struct bintime bt;
+ getbinuptime(&bt);
+ return (bt.sec * 1000) +
+ (((uint64_t)1000 * (uint32_t)(bt.frac >> 32)) >> 32);
+}
+
+/*
+ * Module glue.
+ */
+
+static int
+ath_hal_modevent(module_t mod, int type, void *unused)
+{
+ switch (type) {
+ case MOD_LOAD:
+ if (bootverbose)
+ printf("ath_hal: <Atheros Hardware Access Layer>"
+ "version %s\n", ath_hal_version);
+ return 0;
+ case MOD_UNLOAD:
+ return 0;
+ }
+ return EINVAL;
+}
+
+static moduledata_t ath_hal_mod = {
+ "ath_hal",
+ ath_hal_modevent,
+ 0
+};
+DECLARE_MODULE(ath_hal, ath_hal_mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
+MODULE_VERSION(ath_hal, 1);
diff --git a/sys/contrib/dev/ath/freebsd/ah_osdep.h b/sys/contrib/dev/ath/freebsd/ah_osdep.h
new file mode 100644
index 0000000..51c3e5f
--- /dev/null
+++ b/sys/contrib/dev/ath/freebsd/ah_osdep.h
@@ -0,0 +1,125 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: ah_osdep.h,v 1.10 2003/11/01 01:21:31 sam Exp $
+ */
+#ifndef _ATH_AH_OSDEP_H_
+#define _ATH_AH_OSDEP_H_
+/*
+ * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/endian.h>
+
+#include <machine/bus.h>
+
+typedef void* HAL_SOFTC;
+typedef bus_space_tag_t HAL_BUS_TAG;
+typedef bus_space_handle_t HAL_BUS_HANDLE;
+typedef bus_addr_t HAL_BUS_ADDR;
+
+/*
+ * Delay n microseconds.
+ */
+extern void ath_hal_delay(int);
+#define OS_DELAY(_n) ath_hal_delay(_n)
+
+#define OS_INLINE __inline
+#define OS_MEMZERO(_a, _size) bzero((_a), (_size))
+#define OS_MEMCPY(_dst, _src, _size) bcopy((_src), (_dst), (_size))
+#define OS_MACEQU(_a, _b) \
+ (bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
+
+struct ath_hal;
+extern u_int32_t ath_hal_getuptime(struct ath_hal *);
+#define OS_GETUPTIME(_ah) ath_hal_getuptime(_ah)
+
+/*
+ * Register read/write; we assume the registers will always
+ * be memory-mapped. Note that register accesses are done
+ * using target-specific functions when debugging is enabled
+ * (AH_DEBUG) or we are explicitly configured this way. The
+ * latter is used on some platforms where the full i/o space
+ * cannot be directly mapped.
+ */
+#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ)
+#define OS_REG_WRITE(_ah, _reg, _val) ath_hal_reg_write(_ah, _reg, _val)
+#define OS_REG_READ(_ah, _reg) ath_hal_reg_read(_ah, _reg)
+
+extern void ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val);
+extern u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int reg);
+#else
+/*
+ * The hardware registers are native little-endian byte order.
+ * Big-endian hosts are handled by enabling hardware byte-swap
+ * of register reads and writes at reset. But the PCI clock
+ * domain registers are not byte swapped! Thus, on big-endian
+ * platforms we have to byte-swap thoese registers specifically.
+ * Most of this code is collapsed at compile time because the
+ * register values are constants.
+ */
+#define AH_LITTLE_ENDIAN 1234
+#define AH_BIG_ENDIAN 4321
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define OS_REG_WRITE(_ah, _reg, _val) do { \
+ if ( (_reg) >= 0x4000 && (_reg) < 0x5000) \
+ bus_space_write_4((_ah)->ah_st, (_ah)->ah_sh, \
+ (_reg), htole32(_val)); \
+ else \
+ bus_space_write_4((_ah)->ah_st, (_ah)->ah_sh, \
+ (_reg), (_val)); \
+} while (0)
+#define OS_REG_READ(_ah, _reg) \
+ (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \
+ le32toh(bus_space_read_4((_ah)->ah_st, (_ah)->ah_sh, \
+ (_reg))) : \
+ bus_space_read_4((_ah)->ah_st, (_ah)->ah_sh, (_reg)))
+#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
+#define OS_REG_WRITE(_ah, _reg, _val) \
+ bus_space_write_4((_ah)->ah_st, (_ah)->ah_sh, (_reg), (_val))
+#define OS_REG_READ(_ah, _reg) \
+ ((u_int32_t) bus_space_read_4((_ah)->ah_st, (_ah)->ah_sh, (_reg)))
+#endif /* _BYTE_ORDER */
+#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */
+
+#ifdef AH_DEBUG_ALQ
+extern void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
+#else
+#define OS_MARK(_ah, _id, _v)
+#endif
+
+#endif /* _ATH_AH_OSDEP_H_ */
diff --git a/sys/contrib/dev/ath/freebsd/i386-elf.hal.o.uu b/sys/contrib/dev/ath/freebsd/i386-elf.hal.o.uu
new file mode 100644
index 0000000..f3b9f88
--- /dev/null
+++ b/sys/contrib/dev/ath/freebsd/i386-elf.hal.o.uu
@@ -0,0 +1,3296 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ * unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following NO
+ * ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ * modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ * disclaimer similar to the Disclaimer below and any redistribution
+ * must be conditioned upon including a substantially similar
+ * Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote
+ * product derived from this software without specific prior written
+ * permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGES.
+ *
+ * $Id: i386-elf.hal.o.uu,v 1.7 2003/11/01 02:01:29 sam Exp $
+ */
+begin 644 hal.o
+M?T5,1@$!`0D```````````$``P`!``````````````!0ZP$``````#0`````
+M`"@`#0`*`````````````````%6)Y0^W50B!^A00``!T<8'Z%!```'\9@_H2
+M?PR#^A%]5(/Z!W1(ZU^#^A-T4^M8D('Z$Q$``'1(@?H3$0``?Q*!^@<1``!T
+M)H'Z$A$``'0EZS6X`````('Z$_```'0QN!0```"!^AOQ``!T).L9N"@```#K
+M&[@U````ZQ2-="8`N$(```#K";@`````C70F`%W#C;0F`````(V\)P````!5
+MB>6#[`0/MU4(#[=-#&:!^HP6=`RX`````&:!^B>G=0B)#"3H-____XGL7<.-
+M=@!5B>6#[!R)7?B)=?R+=0R+71"+312+51@/MT4(/100``!T73T4$```?R>#
+M^!)_$8/X$7UL@_@'ZQ&-M"8`````@_@3=$`]!P(``'1NZ8,````]$Q$``'0M
+M/1,1``!_$3T'$0``=%0]$A$``.L/C78`/1/P``!T#CT;\0``="+K5+@3````
+MB50D$(E,)`R)7"0(B70D!(D$).C\____ZT&0B50D$(E,)`R)7"0(B70D!(D$
+M).C\____ZR:)5"00B4PD#(E<)`B)="0$B00DZ/S____K#+@`````QP(!````
+MD(M=^(MU_(GL7<.-M@````!5B>575E.#[`2+?0B[`````(MU#(VV`````(V_
+M`````(M'%(-_$`!U!XT4!NWK!)"+!`8C11"Z`0```#M%%'0:QP0D"@```.C\
+M____0X'[YP,``'[+N@````")T(/$!%M>7UW#C;8`````C;\`````58GE5E.+
+M30B+=0R[`````+@`````.?!S&(VT)@````"-%`")R(/@`0G0T>E#.?-R[UM>
+M7<.-="8`C;PG`````%6)Y8/L#(D<)(ET)`2)?"0(BTT,BW40#[=5%`^W7-$D
+M#[9$T2.#^`)T9H/X`G\)A<!T'>G;````@_@#='J#^`0/A)@```#IR````)"-
+M="8`O\````"#?1@`=!6`?-$G`'0.OV````")]HV\)P````"-!/4`````:<#H
+M`P``N@````#W\XU$.`KIBP```(UV`(T4G0````"XTTUB$/?BP>H&C43R%8G1
+MN@````#W\8T$A20```#K88T4W0````"XTTUB$/?BP>H&C43R%8G1N@````#W
+M\8T$A18```#K.HT4G0````"XTTUB$/?BP>H&C43R%8G1N@````#W\<'@`H'[
+MYP,``'<'!;T```#K"H/`7.L%N``````/M\"+'"2+="0$BWPD"(GL7<.-M@``
+M``!5B>6+30SV00(@=`>Z`@```.M*#[=!`B7`````N@,````]P````'0U#[=!
+M`B70````N@0````]T````'0@]D$"$'0-N@$```#K$XVV`````/9!`P@/E<`/
+MMM"-%)*)T%W#ZPV0D)"0D)"0D)"0D)"058GEBU4(BT4,A,!Y%[@.````@?JT
+M"0``=%V!^K,)``!W+NL:]L0!=3RX#@```('ZM`D``'1!@?JS"0``=PB!ZF<)
+M``#K)8'ZAQ,``'<7B?:!ZM`)``"XS<S,S/?BP>H$C4(/ZQ*!ZH@3``"XS<S,
+MS/?BB=#!Z`)=PXVT)@````!5B>6+50B+10R$P'D3N+0)``"#^@YT68/Z#788
+MZS*)]O;$`74[N+0)``"#^@YT08/Z#7<,C022!6<)``#K,HGV@_H:=QN-="8`
+MC;PG`````(T$DHT$A:0(``#K%(UT)@"-!)(%B!,``)"-M"8`````7<.-M"8`
+M````C;PG`````%6)Y593BUT,@'L"`'52N0````"-M@````"-O"<`````QD09
+M`O]!@_D??O6Y``````^W`XG&.<%])XVT)@`````/MD3+)@^VT(A,&@(*1,LG
+M#[;`B$P8`D$Y\7SDC70F`%M>7<.-M@````"-OP````!5B>575E.#[$"+=0B+
+M70R-0Q")P3M%$`^'Z@```(UV`(M6%(-^$`!U"`'*[8E%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_51"Z`````(7`#X0=`@``#[9%\V:)A%\V`0``#[9%\F:)A%\X
+M`0``@\,"#[>'2@$``#G#?+'IL0$``(U%\HE$)`B^`0$``,=$)`0``0``BT4(
+MB00D_U40N@````"%P`^$R`$```^W5?*)T,'H"6:)AS8!``")T,'H`H/@?V:)
+MAS@!``#!X@6#XG]FB9<Z`0``C47RB40D"(GRC48!#[?PB50D!(M%"(D$)/]5
+M$+H`````A<`/A',!```/MU7RB='!Z0L/MX<Z`0``"<AFB8<Z`0``B=#!Z`2#
+MX']FB8<\`0``P>(#@^)_9HF7/@$``(U%\HE$)`B)\HU&`0^W\(E4)`2+10B)
+M!"3_51"Z`````(7`#X05`0``#[=5\HG1P>D-#[>'/@$```G(9HF'/@$``(G0
+MP>@&@^!_9HF'0`$```'2@^)_9HF70@$``(U%\HE$)`B)\HU&`0^W\(E4)`2+
+M10B)!"3_51"Z`````(7`#X2X````#[=5\HG1P>D/#[>'0@$```G(9HF'0@$`
+M`(G0P>@(@^!_9HF'1`$``(G0T>B#X']FB8=&`0``P>(&@^)_9HF72`$``(U%
+M\HE$)`B)="0$BT4(B00D_U40N@````"%P'18#[=5\L'J"@^WAT@!```)T&:)
+MAT@!``"[`````&:#OTH!````="T/M[=*`0``D(UT)@`/MX1?-@$``(E$)`2)
+M/"3H'/W__V:)A%\V`0``0SGS?-^Z`0```(G0@\006UY?7<-5B>575E.#["3'
+M1>0`````BT4,9H$X`C!V![Y0`0``ZP6^``$``(-]Y`%T0(-]Y`%_#H-]Y`!T
+M$.F*````C78`@WWD`G13ZW^#Q@6+50P/MY)*`0``B57LBUT,@<-,`0``BTT,
+M@<$V`0``ZU:+10QF@W@8``^$7P(``(/&-P^WD%0#``")5>R)PX'#_@,```5<
+M`P``B47@ZSB+30QF@WD8``^$,@(``(/&1@^W@50#``")1>R)RX'#8@,``('!
+M5@,``(E-X.L*N@````#I&@(``,=%Z`````"+5>PY5>@/C?4!``"-??*)]HV\
+M)P````"+3>B+5>`/MP1*9HD#B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#X#]FB41^+@^W1?+!
+MX`2#X#]FB41^:HU%\HE$)`B)7"0$0XM5"(D4)/]5$+H`````A<`/A`L&```/
+MMU7RP>H,#[=$?FH)T&:)1'YJ#[=%\L'H!H/@/V:)1'YP#[=%\H/@/V:)1'YV
+MC47RB40D"(E<)`1#BU4(B10D_U40N@````"%P`^$NP4```^W1?+!Z`IFB41^
+M?`^W1?+!Z`2#X#]FB81^@@````^W1?+!X`*#X#]FB81^B````(U%\HE$)`B)
+M7"0$0XM5"(D4)/]5$+H`````A<`/A&D%```/MU7RP>H.#[>$?H@````)T&:)
+MA'Z(````#[9%\X/@/V:)A'Z.````#[=%\L'H`H/@/V:)A'Z4````#[=%\L'@
+M!(/@/V:)A'Z:````C47RB40D"(E<)`1#BU4(B10D_U40N@````"%P`^$^P0`
+M``^W5?+!Z@P/MX1^F@````G09HF$?IH````/MT7RP>@&@^`_9HF$?J`````/
+MMT7R@^`_9HF$?J8```"-1?*)1"0(B5PD!$.+50B)%"3_51"Z`````(7`#X2?
+M!```#[9%\XA$/DR#_P%T28/_`7\-A?]T$.D4`0``C70F`(/_`G13ZWD/MT7R
+MB<+!Z@6#X@=FB9;$````B<+!Z@*#X@=FB9;&`````<"#X`=FB8;`````ZTD/
+MMT7RP>@$@^`'9HF&R`````^W1?*#X`=FB8;*````ZR@/MT7RP>@$@^`'9HF&
+MS`````^W1?*#X`=FB8;.````B?:-O"<`````A?\/A8@```"-1?*)1"0(B5PD
+M!$.+50B)%"3_51"Z`````(7`#X36`P``#[=5\HG1P>D/#[>&P`````G(9HF&
+MP````(G0P>@,@^`'9HF&P@```(G0P>@)@^`'9HF&O````(G0P>@&@^`'9HF&
+MO@```,'J`X/B!V:)EK@````/MT7R@^`'9HF&N@```)"-="8`C47RB40D"(E<
+M)`1#BU4(B10D_U40N@````"%P`^$3@,```^V1?-FB41^-`^V1?)FB41^.HU%
+M\HE$)`B)7"0$0XM5"(D4)/]5$+H`````A<`/A!H#```/MD7S9HE$?D`/MD7R
+M9HE$?D:-1?*)1"0(B5PD!$.+50B)%"3_51"Z`````(7`#X3F`@``#[9%\XA$
+M/D\/MD7R9HE$?E*`?'Y2`'D*#0#___]FB41^4HU%\HE$)`B)7"0$0XM5"(D4
+M)/]5$+H`````A<`/A*("```/MT7RP>@%)?\```!FB41^6`^W1?+1Z(/@#V:)
+M1'Y>#[=%\H/@`6:)1'YD9H$^`C`/AIP```"-1?*)1"0(B5PD!$.+50B)%"3_
+M51"Z`````(7`#X1*`@``#[=%\L'H!H/@?V:)A'ZL````@_\!=!*#_P%_!H7_
+M=$OK6(/_`G0CZU$/MT7R@^`'9HF&T`````^W1?+!Z`.#X`=FB8;4````ZS`/
+MMT7R@^`'9HF&T@````^W1?+!Z`.#X`=FB8;6````ZP\/MT7R@^`_9HE&$HUT
+M)@!F@3X#,'9A#[=%\L'H#6:)A'ZR````C47RB40D"(E<)`2+50B)%"3_51"Z
+M`````(7`#X29`0``#[=5\L'B`X/B.`^WA'ZR````"=!FB81^L@```(/_`G4>
+M#[=%\L'H`XA&((3`=1#K"F;'A'ZR````"@#&1B`/1X/_`@^.T/K__V:!/@(P
+M#X>(````C47RB40D",=$)`3L````BT4(B00D_U40N@````"%P`^$(`$```^W
+M1?*#X`=FB8;0````#[=%\L'H`X/@!V:)AM0```"-1?*)1"0(QT0D!.T```"+
+M50B)%"3_51"Z`````(7`#X3<````#[=%\H/@!V:)AM(````/MT7RP>@#@^`'
+M9HF&U@```&;'AC0!```$`&;'AC(!```!`&;'AC`!```!`&;'ABX!`````(M%
+M[(M8%+\`````9H.^V`````!T2(UT)@"-1?*)1"0(B5PD!$.+50B)%"3_51"Z
+M`````(7`=&(/MD7S9HF$?MH````/MD7R9HF$?MP```"#QP(/MX;8````.<=\
+MO&:!/@(P=R9FQT92RO]FQT94__]FQT96__]W$F;'1CH/`&;'1CP<`&;'1CX<
+M`+H!````C78`C;PG`````(G0@\046UY?7<.-M@````!5B>6#[!B)7?2)=?B)
+M??R+?0B+=0R+71")7"0(B70D!(D\).A(^/__N@````"%P'1?B5PD"(ET)`2)
+M/"3HC^S__[H`````A<!T1HE<)`B)="0$B3PDZ/;N__^Z`````(7`="V)7"0(
+MB70D!(D\).C=\?__N@````"%P'04B5PD"(ET)`2)/"3H)/3__XG"B?:)T(M=
+M](MU^(M]_(GL7<.058GE@^P$BT4(B00D_Y!4`0``)?^_``")[%W#D(UT)@!5
+MB>53#[==#+H`````C78`C012B=%F.9P`0`@``'01C4(!#[_09H/Z'W;EN?__
+M__^)R%M=PXUT)@"-O"<`````58GE4P^W70RZ`````(UV`(T$DHG19CD<A:``
+M``!T$8U"`0^_T&:#^F!VY;G_____B<A;7<.-="8`C;PG`````%6)Y593@^P$
+MBUT,BW40BT4(B00DZ$?___\/M\BX`````&:%R7A,@>'_#P``9H7)=#RZ````
+M`(UV`(V\)P````"-!-4`````*=!F.0S%(`T``'44A=MT`V:)"X7V=`*)%K@!
+M````ZPM"@_H%=M.X`````(/$!%M>7<.-M"8`````58GE@^P4B5WTB77XB7W\
+MBW4(#[=%#`^W?1!FA<!U0<=$)`00````B30DZ-'^__\/O]B)-"3HIO[__P^W
+MP&:%P'1%B40D!(DT).BR_O__F&:#^/]T,HG#ZRZ-M"8`````B40D!(DT).C4
+M_O__F(T$@`^W!(6B````B40D!(DT).A\_O__#[_8B?B$P'D3C01;#[>$`$0(
+M``#K$8VV`````(T$6P^WA`!""```BUWTBW7XBWW\B>Q=PY"-M"8`````58GE
+M#[=%#+HH````J!!U"@^^P)F#XO&#PA2)T%W#B?95B>6+50SVQ@%T%?;"$`^4
+MP`^VP$B#X/.#P`_K(XUV`+@`````A-)Y%_;"$`^4P`^VP(/`!XUT)@"-O"<`
+M````7<.-M"8`````C;PG`````%6)Y8M5#/;&`705N.`*``#VPA!U*[@`"0``
+MZR2-="8`N`````"$TGD7N"`+``#VPA!U#;@`#```D(VT)@````!=PXVT)@``
+M``"-O"<`````58GE5U93@^PD#[=%#(E%\`^W51")5>S'1>0$$```@7WD&!``
+M``^#%@$``)"-="8`BTWD#[<!(T7P9H7`#X3N````#[=9`HE<)`2+10B)!"3H
+M6____XE%Z(E<)`2+50B)%"3H^?[__XE%W(E<)`2+30B)#"3HQ_[__P^WP(E%
+MX+\`````.WW<#XVC````B?C!X`0I^+L`````BU7H9H-\0@(`='2)^,'@!"GX
+M#[=$0@*)1=B-M@````"-O"<`````C01;BTWHC01!#[=0!F8Y4`AR/XT$6XTT
+M08VT)@````!F.U7L=0J+5>0/MT("ZU>0C8(P]O__9CW<`'8(BTW@C001ZP.-
+M0A0/M\")PF8Y1@ASSD,[7=A\J$<[?=P/C&O___^-M"8`````C;PG`````(-%
+MY`2!?>08$```#X+O_O__N`````"#Q"1;7E]=PXGV58GEBT4,@_@@=RK_)(48
+M$```N$`!``#K(;B@````ZQJXP````.L3N%`!``#K#+C0````ZP6X`````%W#
+MC70F`%6)Y5=64X/L$`^W10R)1?`/MUT0B5PD!(M%"(D$).C]_?__B<:)7"0$
+MBT4(B00DZ)S]__^)QXE<)`B+1?")1"0$BT4(B00DZ*3\__\/M\BZ`````#GZ
+M?2&0C;0F`````(G0P>`$*=`!P&8Y#`9U!8T$,.L*0CGZ?.>X\`P``(/$$%M>
+M7UW#C78`C;PG`````%6)Y8/L#`^W50P/MT40B40D"(E4)`2+10B)!"3H3___
+M_P^W`(GL7<.0C;0F`````%6)Y8/L#(E=^(EU_(M%"(D$).CY^O__#[?89H7;
+M>3&)WH'F_W\``+H`````C70F`(T$DHGQ9CDTA:````!T-$*#^F!VZXUT)@"-
+MO"<`````N8@!``"#^T%T&8/[07\%@_M`ZPBYB0$``(/[0W0%N0````")R(M=
+M^(MU_(GL7<.058GE#[=-"+H`````C70F`(T$DL'@`F8YB*````!U"(N`K```
+M`.L+0H/Z8';CN`````!=PXVV`````(V_`````%6)Y0^W30BZ`````(UT)@"-
+M!)+!X`)F.8B@````=0B+@+````#K"T*#^F!VX[@`````7<.-M@````"-OP``
+M``!5B>575E.#[`0/MWT,O@````"-M"8`````C;PG`````(T$=HT<`&8YNZ`0
+M``!U08M%"(D$).C6^?__9CF#HA```'0*9H.[HA````!U(XT$=@^WA`"D$```
+MN@$````[11!T&8VT)@````"-O"<`````1H/^#':JN@````")T(/$!%M>7UW#
+MC70F`(V\)P````!5B>6+10P]J`D``'0:/:@)``!W##VC"0``ZPJ0C70F`#VT
+M"0``=1F+10B#N'`!````#Y7`#[;`ZPR-M"8`````N`$```!=PXGVC;PG````
+M`%6)Y8/L#,=$)`@`````QT0D!`````"+10B)!"3HK_G__XGL7<.-="8`C;PG
+M`````%6)Y8/L$(E=_(M="(D<)/^35`$``+H!````]L1`=2''1"0(`````,=$
+M)`0`````B1PDZ&GY__^)PHVT)@````")T(M=_(GL7<.-M"8`````58GE@^P,
+MB5WXB77\#[==#+D!````9H7;=':+10B)!"3HB_C__P^W\&:%]GD3B?`E_W__
+M_SG##Y3`#[;(ZU*)]F:!_O\!=`JZ`````&:%]G4'N0$```#K.(T$DL'@`F8Y
+MF*````!U&;D!````9CFPH@```'0;C70F`(V\)P````!"@_I@=M*Y`````)"-
+M="8`B<B+7?B+=?R)[%W#C70F`%6)Y5.#[`2+10B)!"3H_O?__P^WT+D`````
+M9H72>3&!XO]_``"-="8`C;PG`````(T$B;L!````9CD4A:````!T*T&#^6!V
+MZ.L>C;8`````C01)NP$```!F.90`0`@``'0+08/Y'W;HNP````")V(/$!%M=
+MPXUT)@"-O"<`````58GE5U93@^PP#[=%&(E%Z(U%[(E$)`B-1?*)1"0$BU4(
+MB10DZ`?X__^Z`````(7`#X2<`0``BT7LC13%`````"G"P>(#BX(D#0``BTT(
+MB8%L`0``@[EP`0```'4+@<*`#@``B57DZQ:+5>R-!-4`````*="-!,4@#0``
+MB47DBT4(B00D_Y!8`0``B47<QT78`````,=%X`````"+3>1F@WD,``^$&0$`
+M`(VT)@````"+1=B+5>2+=((0#[<>OP````"+1@1F@S@`#X3@````D(5=W`^$
+MQP```(5=Z'4BB5PD!(M-"(D,).B3^O__A,`/B:L```#V1>@L#X2A````D(M%
+M$#E%X`^#M@```(M&!`^W!'B)1=0/MT74B40D"`^WPXE$)`2+50B)%"3H`/G_
+M_P^WP(E%T(3`>38ET````#W0````="J!9=`/_O__]D7H"'0)@4W0P````.L4
+M@4W0H````(VV`````(V\)P````"#?=``="J+5=2+3>"+10QFB12(BT70#0`"
+M``"+50QFB42*`D&)3>")]HV\)P````!'BT8$9H,\>``/A2'_____1=B+3>0/
+MMT$,.478#XSN_O__BT44BU7@B1"%T@^5P`^VT(G0@\0P6UY?7<.-="8`58GE
+MBU4(BTT,#[<"9CL!=0\/MU("#[=!`NL+D(UT)@`/MQ(/MP$IPHG07<.-="8`
+M58GE5U93@^P\BWT(#[==&`^W11R)1>S'1>18&P``B3PDZ$K]__^Z`````(7`
+M#X0=`P``B3PDZ#7Z__]FB8=H`0``B3PDZ`;\__^%P'0*QX=T`0```0```&:#
+MOV@!````=2")7"0$B3PDZ&+\__^Z`````(7`#X35`@``9HF?:`$```^WAV@!
+M``")1"0$B3PDZ/S___^)1>B)/"3HX/O__X7`=$&+1>PC1>B)1"00BU44B50D
+M#(M-$(E,)`B+10R)1"0$B3PDZ"7]__^Z`````(7`#X1X`@``BU44BQ*)5>#I
+MZ@$``(-](`!U%6:!^T@#=0['1>1=%@``C;0F`````,=%X`````"^!!```('^
+M&!````^#MP$``)"-M"8`````#[<&(T7L9H7`#X21`0``#[<&A47H#X2%`0``
+MC47RB40D#(U%\(E$)`@/MT8"B40D!(D\)/^73`$``(7`#X1>`0``#[=&`HE$
+M)`@/MX=H`0``B40D!(D\).@S^/__B47<#[=>`HE<)`2)/"3HT/7__P^WP(E%
+MV(E<)`@/MX=H`0``B40D!(D\).B3^/__#[?`B474QT70`````(M-W&:#>0(`
+M#X3X````D(VT)@````"+5="-!%*+3=R-!$$/MU@&9CE8"`^"P````(T$4@'`
+MB47,C;0F`````(V\)P````!F.5WP#X>&````9CE=\@^"?````&8[7>1W=F:!
+M^[0)=0AF@7X"P`!T9XE<)`2)/"3HR_G__X7`=%>+11`Y1>`/@XH```"+5>"+
+M30QFB1R1#[=&`F:)1)$"#[=&`HE$)`B+1=2)1"0$B3PDZ`'Y__^%P'05BU7@
+MBTT,#[=$D0(-``(``&:)1)$"_T7@D(UT)@"+5=B-!!H/M]B+3<R+1=QF.5P(
+M"`^#5O____]%T(M5W`^W0@(Y1=`/@A/___^-=@"#Q@2!_A@0```/@E'^__^#
+M?>``=%O'1"0,P"D``,=$)`@$````BTW@B4PD!(M%#(D$).C9!0``@WW@0'8'
+MQT7@0````(M5X(F7?`(``(G0P>`"B40D"(V'?`$``(E$)`2+30R)#"3H_/__
+M_Y"-="8`BT7@BU44B0(/MX=H`0``9HE'&(-]X``/E<`/MM"-=@")T(/$/%M>
+M7UW#C;8`````58GE5U93BT4(C;!\`0``BXA\`@``A<ET4(M%#`^W.)")R-'X
+MC1R&#[<#B?HIPG4MBU4,#[="`@^W4P(AT(M5#&8Y0@)U"K@!````ZR&-=@"+
+M10P/MU`"#[=#`BG"A=)^!(US!$G1^76WN`````!;7E]=PXVV`````(V\)P``
+M``!5B>575E.#[!R+10P/MP")1?"+50AF@[IH`0````^%'0$``(D4).AU\?__
+M#[?`B47LN`````!F@WWL`'@2BT7L)?\/``#K"(M%Y.E3`0``B47L9H-][``/
+MA.,```"_`````(VT)@````"-O"<`````C03]`````"GXBUWL9CD<Q2`-```/
+MA:8```"+10P/MU@"B5PD!(M5"(D4).A0\___B<:)7"0$BUT(B1PDZ._R__^)
+M1>B[`````#G#?7.-=@")V,'@!(G"*=BY`````&:#?$8"`'1&C78`C;PG````
+M`(G0*=B-%$F-!`*-!$:-4`:)5>2+5?!F.5`&=PV+1>1F.5`"#X,^____08G:
+MP>($B=`IV`^W1$8".<%\Q$,[7>A\GHVT)@````"-O"<`````1X/_!0^&-O__
+M_XVV`````(M=#`^W0P*)1"0(BU4(#[>":`$``(E$)`2)%"3H;_3__XG&OP``
+M``!F@W@"`'0N#[=(`HVV`````(V\)P````"-!'^-%$:-0@:+7?!F.5H&=P9F
+M.5H(<PI'.<]\X[@`````@\0<6UY?7<.-M@````!5B>6#[`B+10R)1"0$BT4(
+MB00DZ#C^__^Z`````(7`=!D/ME40#[9`!0'`*,(/OLJ)R,'H'TB)RB'"B=")
+M[%W#58GE@^P0B5WXB77\BW4(BUT,B5PD!(DT).CR_?__N@4```"%P'0O@[YT
+M`0```'0B#[<#+1X4``"Z#@```&:#^&1V$X![`@`/F,`/MM"#PA'K!`^V4`2)
+MT(M=^(MU_(GL7<.-M"8`````C;PG`````%6)Y5=64X/L((M%"&:#N&@!````
+M#X4F`0``B00DZ![O__\/M\")1?"+50P/MQ*)5>RX`````&:#??``>!*+1?`E
+M_P\``.L(C00^Z1(!``")1?!F@WWP``^$XP```,=%Z`````"-M@````"-OP``
+M``"+1>C!X`,K1>B+5?!F.13%(`T```^%I@```(M%#`^W6`*)7"0$BU4(B10D
+MZ/#P__^)QXE<)`2+10B)!"3HC_#__XE%Y+L`````.<-]<XUV`(G8P>`$B<(I
+MV+D`````9H-\1P(`=$B-=@"-O"<`````B=`IV(TT`(T$28T$1@'XC5`&B57@
+MBU7L9CE0!G<-BT7@9CE0`@^#//___T&)VL'B!(G0*=@/MT1'`CG!?,)#.UWD
+M?)R-M@````"-OP````#_1>B#?>@%#X8S____C78`BU4,#[="`HE$)`B+50@/
+MMX)H`0``B40D!(D4).@/\O__@\0@6UY?7<.-M"8`````58GE@^P,B5W\BUT,
+MB5PD!(M%"(D$).AU_O__#[90!`^W0P(EP````#W`````=1&)T(/@#X/X`74'
+M@^+P@\H"D(G0BUW\B>Q=PXVT)@````!5B>6#[`R)7?B)=?R+10@/MW4,B00D
+M_Y!8`0``B<.H`G0>B30DZ`;S__^%P'42@^/]ZPV0D)"0D)"0D)"0D)"0]L,(
+M=!N)-"3HH_+__X7`=0^#X_>-M@````"-OP````")V(M=^(MU_(GL7<.-="8`
+M58GE4X/L#(M5"(M%#`^W0`*)1"0(#[>":`$``(E$)`2)%"3H".[__P^WP+H`
+M````N^X0``"-="8`C;PG`````+D!````9CD$4W0+0H/Z`G;ON0````")R(/$
+M#%M=PXGV58GE5U93@^P4BT4(B47L`T40B47HBT4,2(E%\'14BWWHBT7L.<=V
+M/Y"-M"8`````B?XK=1")?"0$B30D_U44A<!^)(GYBUT0D(VT)@`````/MA8/
+MM@&(!D:($4%+=?$K?1`[?>QWR8M%$`%%Z/]-\'6L@\046UY?7<.0D)"0D)!5
+MB>575E.![)P````/MT4(B85L____QP0D@`,``.C\____B85H____O@(```"%
+MP`^$X08``(N=:/___XG?O@`1``"X@`(``/:%:/___P1T&J$`$0``B0.+O6C_
+M__^#QP2^!!$``+A\`@``_(G!P>D"\Z6+E6S___]FB5,(9L=#"@``BT4,B4,,
+MBT40B4,0BT44B4,4BX5H____QX`P`P```````,>`8`,```````#'@&0#````
+M````QX!H`P```````,>`<`,```H```#'@'0#```"````9L>`?`,`````QT0D
+M!`````")'"3H_/___[X#````A<`/A!H&``#'@UP!```!````BT,4@WL0`'4)
+MC9`@0```[>L&BX`@0```)?\```!FB8-@`0``BT,4@WL0`'4)C9`8F```[>L&
+MBX`8F```9HF#8@$``(M#%(-[$`!U#HV0T)@``+@6'```[^L*QX#0F```%AP`
+M`+X`````OX"8``"Y```!`(VT)@````"+0Q2#>Q``=0N-D("8``")R._K`XD,
+M!T:#_@-VXXM#%(-[$`!U"8V0`)P``.WK!HN``)P``,'H',=$)`0$````B00D
+MZ/S___]`9HF#9`$``(M#%(-[$`!U"8V0$$```.WK!HN`$$```(F%9/___XM3
+M%(/(`8-[$`!U"8'"$$```._K!HF"$$```(V%<O___XE$)`C'1"0$/0```(D<
+M).C\____O@@```"%P`^$P`0``&:!O7+___^E6G0*O@0```#IJP0``(V%<O__
+M_XE$)`C'1"0$/P```(D<).C\____O@@```"%P`^$A`0```^WA7+___^+E6C_
+M__]FB8*"`@``C85R____B40D",=$)`3!````B1PDZ/S___^^"````(7`#X1)
+M!```#[>%<O___\'H#(N5:/___V:)@H`"``"^!0```&:#^`$/A2,$``"_````
+M`+X`````C81U=/___XE$)`B-AL````")1"0$B1PDZ/S___^%P`^$X`,```^W
+MA'5T____,<=&@_X_=LN^!P```('___\```^%TP,``(V%<O___XE$)`C'1"0$
+MOP```(D<).C\____O@@```"%P`^$K`,```^VA7+___^+E6C___^(@H@"``"+
+MA7C___]FB8*$`@``#[>%>O___V:)@H8"```/MH5\____B(*)`@``#[:%??__
+M_XB"B@(```^VA7[___^(@HP"```/MH5_____B(*+`@``#[9%@8B"CP(```^V
+M18"(@I`"```/MD6#B(*1`@``#[9%@HB"D@(```^V180D`8B"C0(```^W1831
+MZ"0'B(*.`@``O@````"_"0```(T4]0`````I\HT4E@.5:/___XV*DP(```^W
+MA'UT____P>@*)#^(@I,"```/MX1]=/___\'H!"0_B$$+#[>$?73____!X`*(
+MPH#B/`^WA'UV____P>@."-"(00$/MH1]=____R0_B$$,#[>$?7;____!Z`(D
+M/XA!`@^WA'UV____P>`$B,*`XC`/MX1]>/___\'H#`C0B$$-#[>$?7C____!
+MZ`8D/XA!`P^VA'UX____)#^(00X/MX1]>O___\'H"B0_B$$$#[>$?7K____!
+MZ`0D/XA!#P^WA'UZ____P>`"B,*`XCP/MX1]?/___\'H#@C0B$$%#[:$?7W_
+M__\D/XA!$`^WA'U\____P>@")#^(008/MX1]?/___\'@!(C"@.(P#[>$?7[_
+M___!Z`P(T(A!$0^WA'U^____P>@&)#^(00</MH1]?O___R0_B$$2#[=$?8#!
+MZ`HD/XA!"`^W1'V`P>@$)#^(01,/MT1]@,'@`HC"@.(\#[=$?8+!Z`X(T(A!
+M"0^V1'V#)#^(010/MT1]@L'H`B0_B$$*#[=$?8+!X`2(PH#B,`^W1'V$P>@,
+M"-"(014/MT1]A,'H!B0_B$$6#[9$?80D/XA!%P^W1'V&P>@*)#^(01@/MT1]
+MAL'H!"0_B$$9#[=$?8;!X`*(PH#B/`^W1'V(P>@."-"(01H/MD1]B20_B$$;
+M#[=$?8C!Z`(D/XA!'$:#QPN#_@0/AMW]__^_`````+X`````C85R____B40D
+M"+@?````*?")1"0$B1PDZ/S___^%P`^$Q`````^WA7+___\!Q\'H"(N5:/__
+M_XB$<B0#```/MH5R____B(1R)0,``$:#_@)VKH7_=`B!__W_`@!U![X)````
+MZVR+4Q2+A63___^#>Q``=0F!PA!```#OZP:)@A!```"+@UP!``")0QP/MX-@
+M`0``9HE#(`^W@V(!``"#X`^#R!!FB4,B#[>#9`$``&:)0R1FQT,F``")V.MA
+MO@@```#K#9"0D)"0D)"0D)"0D)"+4Q2+A63___^#>Q``=1&!PA!```#OZPZ^
+M"````.L'D(F"$$```(.]:/___P!T#HN%:/___XD$).C\____@WT8`'0%BU48
+MB3*X`````('$G````%M>7UW#D(VT)@````!5B>6#[`2+10B)!"3H_/___XGL
+M7<.-="8`C;PG`````%6)Y5W#C70F`(V\)P````!5B>7V10T!=!>+11!FQP``
+M%(M%%&;'`#85N`$```#K!;@`````7<.0D)"0D)"0D)!5B>575E.#[`B+70B+
+M?0R+31"+=12)7?"+4Q2)R(-[$`!U#8'"+(```._K"HUT)@")BBR```"#_P%T
+M>(M3%(G(*P4`````P>`#@WL0`'4)@<(P@```[^L&B8(P@```BU,4B<@K!0``
+M``#!X`.#>Q``=0Z!PC2```#OZPN0C70F`(F"-(```(M#%(E%[(G(BU7P`X)H
+M`P``@WL0`'4+BU7L@<(X@```ZVB+5>R)@CB```#K;8M#%(-[$`!U%(V0,(``
+M`+C_____[^L0C;8`````QX`P@```_____XM#%(-[$`!U#HV0-(```+C_____
+M[^L*QX`T@```_____XM#%(-[$`!U#XV0.(```+@!````D._K#<>`.(````$`
+M``"-=@"!YO__``"#_P%T%8/_`7(8@_\&=!N#_PAU%HVV`````('.`````>L8
+M@<X``(``ZQ"!S@``@`&-=@"-O"<`````BU,4B?"#>Q``=0F!PB2```#OZP:)
+MLB2```"#Q`A;7E]=PXVT)@````"-O"<`````58GE5U93@^P$BUT(OC(```"_
+M+````.M(QP0D`0```.C\____3G4YBU,4BT4,@WL0`'4&@\($[^L#B4($BT,4
+M@WL0`'4+C5`HN`H```#OZP?'0"@*````N`````#K0HGVBT,4@WL0`'4'C5`L
+M[>L$D(L$!Z@$=:&+0Q2#>Q``=0:-4`CMZP.+0`BH`G6+N`$```"-M"8`````
+MC;PG`````(/$!%M>7UW#D(VT)@````!5B>6+30B+012#>1``=1&-D"R```"X
+M`````._K#8UV`,>`+(````````"+012#>1``=0V-D`2```#MZPJ-="8`BX`$
+M@```#0``$`"+410E__]?_X-Y$`!U"8'"!(```._K!HF"!(```(M!%(-Y$`!U
+M#XV0)(```+C__P``[^L+D,>`)(```/__``!=PXUT)@!5B>575E.+=0B+10R`
+M>`L`#X32````BUX0BTX4OP2```"%VW4+C9$$@```[>L(B?:+@02````E__]_
+M_PT``"``A=MU#(T4#^_K"8VV`````(D$#XM5#`^V6@L/MD(*#Z_8#[=""`^O
+MV(M6%(G8@WX0`'4-@<(H@```[^L*C70F`(F:*(```(M6%(M-#`^W00R#?A``
+M=0J!PDB```#OZP>0B8)(@```BU4,#[9""HM-&`^OR`--%`^W0@@/K\B%R74"
+MB=F+5A2+11`!R,'@`X-^$`!U#('"-(```.LVC70F`(F"-(```.LXBUX0BTX4
+MOP2```"%VW4)C9$$@```[>L&BX$$@```)?__7_^%VW4&C10/[^L+B00/D(VT
+M)@````"+5A2+30R+`8-^$`!U"8'"+(```._K!HF"+(```(M^$(M>%(7_=0F-
+MDR2```#MZP:+@R2```")PH'B``"`_XM-#`^W00B)T0G!BT4,9H-X$`!T$0^W
+M0!"#P`3!X!`E``!_``G!A?]U"XV3)(```(G([^L&B8LD@```9H.^8`$```-V
+M78M5#/9"%`=T5(M^$(M>%+X8@```A?]U"8V3&(```.WK!HN#&(```(G!@>'_
+M^/__BU4,#[="%,'@""4`!P``"<&%_W4)C10>B<COZQ&0B0P>C;8`````C;PG
+M`````%M>7UW#D)"0D)"0D)"0D)!5B>6+10B+4!2#>!``=0F!P@A```#MZP:+
+M@@A```"%P`^5P`^VP%W#D(VT)@````!5B>53BUT,BTT(BT$4@WD0`'4-C5`<
+M[>L*C;0F`````(M`'(G"@_C_=0W'`P````"X`````.LT(X$L`P``);K8!0&)
+M`_?"(`!P`'0'#0```$")`_;"!70#@PL!]\)``0``=`.#"T"X`0```%M=PXGV
+M58GEBT4(BX`L`P``7<.)]E6)Y8/L#(D<)(ET)`2)?"0(BUT(BTT,B=^+LRP#
+M``"%]GD=BT,4@WL0`'4+C5`DN`````#OZPG'0"0`````B?:)R"6ZV`4!]L$!
+M=`.#R`7VP4!T!0U``0``BU,4@WL0`'4&@\(@[^L#B4(@B8\L`P``A<EY*XM#
+M%(-[$`!U$HU0)+@!````[^L7C;0F`````,=`)`$```")]HV\)P````")\(L<
+M)(MT)`2+?"0(B>Q=PY"0D)"0D)"0D)"0D)"0D%6)Y;A`````7<.-M@````!5
+MB>6+30@/MT4,9H/X/W<HBU$4P>`%!1R0``"#>1``=04!PNWK`XL$$"4`@/__
+MN@$```!FA<!U!;H`````B=!=P^L-D)"0D)"0D)"0D)"0D%6)Y5.+70@/MTT,
+MN`````!F@_D_#X<*`0``BU,4B<C!X`4%`)```(-[$`!U"@'"N`````#OZP?'
+M!!``````BU,4B<C!X`4%!)```(-[$`!U#P'"N`````#OZPR0C70F`,<$$```
+M``"+4Q2)R,'@!04(D```@WL0`'4*`<*X`````._K!\<$$`````"+4Q2)R,'@
+M!040D```@WL0`'4*`<*X`````._K!\<$$`````"+4Q2)R,'@!044D```@WL0
+M`'4.`<*X`````._K"XUT)@#'!!``````BU,4B<C!X`4%&)```(-[$`!U"@'"
+MN`````#OZP?'!!``````BU,4B<C!X`4%')```(-[$`!U"@'"N`````#OZP?'
+M!!``````N`$```!;7<.)]HV\)P````!5B>6#[`R)'"2)="0$B7PD"(M5$`^W
+M=0RX`````&:#_C\/AZ$```"%TG0X#[9:!<'C"`^V0@0)PP^V2@/!X1@/MD("
+MP>`0"<$/MD(!P>`("<$/M@()P='IB=C!X!\)P='KZPV[`````+D`````C78`
+MBT4(BW@4B?#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`!H``#MB<+K!HN0`&@``(M%$&:)$+H!````B="+7?R)[%W#B?95B>6+31"+
+M50AF#[:"B`(``&8Y10QU";@,````ZQ:)]H"Z@@(````/F,`/ML"-!,4#````
+MA<ET`HD!N`````!=P^L-D)"0D)"0D)"0D)"0D%6)Y8M%"`^V@(@"``!=PY!5
+MB>6X`0```%W#C;8`````58GEBT4(@+B-`@````^5P`^VP%W#C70F`(V\)P``
+M``!5B>6#[!")7?R+70C'1"0$`````(D<).C\____A<`/E,`/ML")1"0(QT0D
+M!`````")'"3H_/___XM=_(GL7<.058GEBU4(BTT,N/____^#^05W((M"%(-Z
+M$`!U"8V0'$```.WK!HN`'$```(/@+]/H@^`!7<.-="8`C;PG`````%6)Y593
+M@^P(BUT(BTT,BT,4@WL0`'4+C9`40```[8G&ZP:+L!1```")RL'B#`')N`,`
+M``#3X`G0#0"``0#WT"'P"=`-`(```(-]$`!T!0T```$`BU,4@WL0`'4)@<(4
+M0```[^L&B8(40```BX,L`P``#0````&)1"0$B1PDZ/S___^#Q`A;7EW#C;0F
+M`````%6)Y5.+30B+70R+012#>1``=0V-D!!```#MZPJ-="8`BX`00```A=MT
+M!X/[!'0'ZP^#X)_K$(/@WX/(0.L(B?:#R""#X+^+412#>1``=0F!PA!```#O
+MZP:)@A!```!;7</K#9"0D)"0D)"0D)"0D)!5B>6+10B+4!2#>!``=0F!P@2`
+M``#MZP:+@@2```"I``"```^5P`^VP$!=PXUT)@!5B>575E.#[!2+70@/MT40
+MB47P#[=%%(E%[(G?QT0D"`8```"+10R)1"0$C8,X`P``B00DZ/S___^+4Q0/
+MMHLX`P``#[:#.0,``,'@"`G!#[:#.@,``,'@$`G!#[:#.P,``,'@&`G!@WL0
+M`'4+@<((@```B<COZP:)B@B```"+<Q0/MH<]`P``P>`(#[:7/`,``(G1"<&+
+M1?`E_S\``,'@$`G!@WL0`'4+C98,@```B<COZP:)C@R```!F@WWP`'1PBT,4
+M@WL0`'4)C9`D@```[>L&BX`D@```B<&+1>R#P`1F@WWL``^4P@^VTDHAT('A
+M__^`_\'@$"4``'\`BU,4"<B#>Q``=0F!PB2```#OZP:)@B2```#'1"0(````
+M`,=$)`0`````B1PDZ/S____K#XD<).C\____C;0F`````(/$%%M>7UW#D(VT
+M)@````!5B>6#[`R)'"2)="0$B7PD"(M5"(M"%(-Z$`!U"8V0<(```.WK!HN`
+M<(```(G'O@````"+50B+0A2#>A``=0F-D&R```#MZP:+@&R```"Z`````(GQ
+M"<&)^PG3B<B)VHL<)(MT)`2+?"0(B>Q=PXGV58GEBT4(BU`4@W@0`'4)@<)L
+M@```[>L&BX)L@```7<-5B>6+30B+012#>1``=0F-D"2```#MZP:+@"2```"+
+M410-`````8-Y$`!U"8'")(```._K!HF")(```%W#C78`58GE@^P(B1PDB70D
+M!(M="(M#%(-[$`!U"8V09)@``.WK!HN`9)@``(G!P>D3@>'_`0``]L4!=`:!
+M\0#^__^+0Q2#>Q``=0N-D'"```#MB<;K!HNP<(```(M3%(-[$`!U#X'";(``
+M`.WK#(VV`````(N";(```#'P,<B+'"2+="0$B>Q=PXUT)@"-O"<`````58GE
+MBT4(#[>(8`$``(M0%(-X$`!U"H'"($```.WK!Y"+@B!````E_P```#G!#Y3`
+M#[;`7<.-="8`C;PG`````%6)Y5.+30B+70R+012#>1``=0V-D)B```#MZPJ-
+M="8`BX"8@````0.+012#>1``=0^-D)2```#MZPR-M@````"+@)2````!0P2+
+M012#>1``=0Z-D)R```#MZPN0C70F`(N`G(````%##(M!%(-Y$`!U#HV0D(``
+M`.WK"Y"-="8`BX"0@````4,(BT$4@WD0`'4.C9"@@```[>L+D(UT)@"+@*"`
+M```!0Q!;7<.-="8`58GEN`$```!=PXVV`````%6)Y8M-"(M!%(-Y$`!U"8V0
+M:(```.WK!HN`:(```(M1%(/@YX-Y$`!U"8'":(```._K!HF":(```%W#D(UT
+M)@!5B>6+30B+012#>1``=0F-D&B```#MZP:+@&B```!F@[E@`0``!7<(@\@0
+MZP:-=@"#R!B+412#>1``=0F!PFB```#OZP:)@FB```!=PXUV`%6)Y5.+30B)
+MRXM!%(-Y$`!U#HU0)+@`````[^L*C78`QT`D`````(N#+`,```T`0```B8,L
+M`P``BU$4@WD0`'4&@\(@[^L#B4(@BT$4@WD0`'4-C5`DN`$```#OZPF)]L=`
+M)`$```!;7<.-M@````!5B>6X`````%W#C;8`````58GEN`````!=PXVV````
+M`%6)Y5W#C70F`(V\)P````!5B>5=PXUT)@"-O"<`````58GE@^P,QT0D!)8'
+M``#'!"0`````Z/S____'1"0$KP<``,<$)`````#H_/___\=$)`@]````QT0D
+M!(`3``"+10B)!"3H_/___XGL7<.0D)!5B>53BTT(#[==$(M!%(-Y$`!U#(V0
+M!(```.WK"8UV`(N`!(```(M1%"7__W__#0``!`"#>1``=0F!P@2```#OZP:)
+M@@2```"#?0P`="*+412)V`T```,`@WD0`'4)@<($0```[^L)B8($0```C78`
+M6UW#C;8`````C;PG`````%6)Y5=64X/L!(M="(-]#``/A*$```"+0Q2#>Q``
+M=0Z-D`1```"X`````._K"L>`!$````````#'!"30!P``Z/S___^^"@```+\0
+M0```C78`BT,4@WL0`'4)C9`00```[>L#BP0'J0```0!T,\<$),@```#H_/__
+M_XM#%(-[$`!U#XV0!$```+@`````[^L+D,>`!$````````!.=;/K$87V=12-
+MM@````"-O"<`````N`````#K.HM#%(-[$`!U"8V0!(```.WK!HN`!(```(M3
+M%"7__WO_@WL0`'4)@<($@```[^L&B8($@```N`$```"#Q`1;7E]=PXVT)@``
+M``!5B>6+30B+012#>1``=0F-D`2```#MZP:+@`2```"+410E__]__PT```0`
+M@WD0`'4/@<($@```[^L,C;8`````B8($@```@WT,`'0DBT$4@WD0`'4.C9`$
+M0```N````0#OZPW'@`1```````$`C78`7<.-M"8`````C;PG`````%6)Y8/L
+M&(E=](EU^(E]_(M%"(M=#(M-$`^W512)QK\!````@_L"="B#^P)W!X/[`70)
+MZSR#^P-T)^LUB50D"(E,)`2)!"3HM?W__^LJC78`B4PD!(D$).@D_O__B<?K
+M%XE,)`2)!"3H%/___^L)B?:X`````.L)B9XP`P``B?B0BUWTBW7XBWW\B>Q=
+MPXUV`%6)Y8M%"(N`,`,``%W#B?95B>6X`0```%W#C;8`````58GEN`````!=
+MPXVV`````%6)Y8M-"(M!%(-Y$`!U"8V0!(```.WK!HN`!(```(M1%"7__V__
+M@WD0`'4)@<($@```[^L&B8($@```N`$```!=PXVT)@````"-O"<`````58GE
+MBTT(BT$4@WD0`'4)C9`$@```[>L&BX`$@```BU$4)?__?_\-```0`(-Y$`!U
+M#X'"!(```._K#(VV`````(F"!(```+@!````7<.0D)!5B>6#[`R)7?R+10R#
+M^`%T#[L`````@_@"=!7K"HUV`+L`````ZPFX`````.L3B?:)7"0$BT4(B00D
+MZ/S___^)V(M=_(GL7<.0D)"0D)"0D%6)Y8M%"(M0%(-X$`!U!H/"#.WK`XM"
+M#%W#C;8`````58GEBTT(BU$4BT4,@WD0`'4&@\(,[^L#B4(,7<.-=@!5B>6+
+M10B+4!2#>!``=1&#P@BX!````._K#8VV`````,=""`0```!=PXVT)@````!5
+MB>575E.#[`2+=0B+1A2#?A``=0N-4`BX(````._K!\=`""````"[`````+\(
+M````ZPV0D)"0D)"0D)"0D)"0BT84@WX0`'4'C5`([>L$D(L$![H!````J`1T
+M&L<$)`H```#H_/___T.!^^<#``!^S[H`````B="#Q`1;7E]=PU6)Y8/L"(D<
+M)(ET)`2+10B+6!"+2!2^:(```(7;=0F-D6B```#MZP:+@6B```"#X+^%VW4+
+MC10.[^L(D(UT)@")!`Z+'"2+="0$B>Q=PXGV58GE@^P(B1PDB70D!(M%"(M8
+M$(M(%+YH@```A=MU"8V1:(```.WK!HN!:(```(/(0(7;=0N-%`[OZPB0C70F
+M`(D$#HL<)(MT)`2)[%W#B?95B>6+30B+412+10R#>1``=0Z!PE"```#OZPN0
+MC70F`(F"4(```(M1%(M%$(-Y$`!U#H'"5(```._K"Y"-="8`B8)4@```7<.0
+MC;0F`````%6)Y8/L"(D<)(ET)`2+70B+30RX`````(/Y/P^'E````(/Y'W9*
+MBT,4@WL0`'41C9!4@```[8G"ZPR-M@````"+D%2```"+<Q2#Z2"X_O___]/`
+M(="#>Q``=0B-EE2```#K/XF&5(```.M%D(UT)@"+0Q2#>Q``=0N-D%"```#M
+MB<+K!HN04(```(MS%+C^____T\`AT(-[$`!U"8V64(```._K"XF&4(```)"-
+M="8`N`$```"+'"2+="0$B>Q=PU6)Y8/L"(D<)(ET)`2+70B+30RX`````(/Y
+M/P^'E````(/Y'W9*BT,4@WL0`'41C9!4@```[8G"ZPR-M@````"+D%2```"+
+M<Q2#Z2"X`0```-/@"="#>Q``=0B-EE2```#K/XF&5(```.M%D(UT)@"+0Q2#
+M>Q``=0N-D%"```#MB<+K!HN04(```(MS%+@!````T^`)T(-[$`!U"8V64(``
+M`._K"XF&4(```)"-="8`N`$```"+'"2+="0$B>Q=PU6)Y8M%"(M0%(-X$`!U
+M"8'"3(```.WK!HN"3(```%W#58GEBTT(BT4,]L0"=`@E__W__X/(((M1%(-Y
+M$`!U"8'"3(```._K!HF"3(```%W#58GEBU40BTT,QT$(`````(G0)?\/``")
+M00PYT'0'N`````#K*_9%%"!T!X%)#``@``#'010`````QT$0`````+@!````
+MC70F`(V\)P````!=PXVT)@````"-O"<`````58GE5E.+50B+=0R)\_9&%`%U
+M#;@/````Z0,!``"-=@`/MT80)?\/``!FB48@BTX4@>$`@/\/P>D/BT(4@WH0
+M`'4.C9!L@```[>L+D(UT)@"+@&R```")PL'J"H'B__\``(G0)?\?```YR',4
+MC8(`X/__)?__```)P>L'D(UT)@`)T8G()?]_``!FB48BQD8D`(M#%*@"=3BH
+M!'0&QD8D`>LN]D,4$'0(@$XD".LBB?;V0Q0(=`:`3B0$ZQ2`3B0"BT,4)>``
+M``#!Z`6(1B6)]HM#$"4``/@'P>@3B$8FBT,4]L0!=`TE`'X``,'H"8A&)^L$
+MQD8G_XM#$"4`@`<`P>@/B$8HBT,0P>@.)`&(1BF+0Q#!Z`PD`8A&*K@`````
+M6UY=PY"0D)"0D)"0D)"0D%6)Y5=64X/L&(M]"(M=#(E]\(M%$/9``P$/A/8!
+M``"+1Q2#?Q``=0F-D!!```#MZP:+@!!```"#X&")1>R+51")5"0$B3PDZ/S_
+M__^Z`P```(7`#X0G"0``BU<4BW7P#[:.)`,```^VAB4#``#!X`@)P0^VAB8#
+M``#!X!`)P0^VAB<#``#!X!@)P8-_$`!U"X'"`(```(G([^L&B8H`@```@_L!
+M#X2*````@_L!<C:#^P9T#H/["`^$YP```.E3`0``BT\4BU7P#[:"*0,``,'@
+M"`^VDB@#```)T`T``%$`Z=T```"+3Q2+7?`/MH,I`P``P>`(#[:3*`,```G0
+M#0``4@"#?Q``=0F-D02```#OZP:)@02```"+1Q2#?Q``=0J-4"BX`0```.M-
+MQT`H`0```.M.BT\4BW7P#[:&*0,``,'@"`^VEB@#```)T`T``!0`@W\0`'4)
+MC9$$@```[^L&B8$$@```BT<4@W\0`'4+C5`HN`````#OZP?'0"@`````BT<4
+M@W\0`'4-C9`00```N"00``#K;L>`$$```"00``#K?(M/%(M5\`^V@BD#``#!
+MX`@/MI(H`P``"=`-```0`(-_$`!U"8V1!(```._K!HF!!(```(M'%(-_$`!U
+M"XU0*+@`````[^L'QT`H`````(M'%(-_$`!U#HV0$$```+A`$```[^L7QX`0
+M0```0!```.L+N@P```#I80<``)"+7Q"+3Q2^$$```(7;=0F-D1!```#MZP:+
+M@1!````+1>R%VW4&C10.[^L#B00.BU<4BUWP#[:+.`,```^V@SD#``#!X`@)
+MP0^V@SH#``#!X!`)P0^V@SL#``#!X!@)P8-_$`!U"X'""(```(G([^L&B8H(
+M@```BT\4BU7P#[:"/0,``,'@"`^VDCP#```)T(-_$`!U"8V1#(```._K!HF!
+M#(```(M7%(-_$`!U"+@`````[^L&QP(`````BT<4@W\0`'4+C5`$N`````#O
+MZP?'0`0`````BT<4@W\0`'4+C5`,N`````#OZP?'0`P`````BT<4@W\0`'4&
+MC5`<[>L#BT`<BT<4@W\0`'4+C5`@N`````#OZP?'0"``````BT<4@W\0`'4+
+MC5`DN`````#OZP?'0"0`````BUWPQX,L`P```````(M'%(-_$`!U!HU0+.WK
+M`XM`+(M'%(-_$`!U"XU0,+@%````[^L'QT`P!0```(M'%(-_$`!U"XU0-+@%
+M````[^L'QT`T!0```(M'%(-_$`!U"XU01+@(````[^L'QT!$"````(M'%(-_
+M$`!U"XU02+@(````[^L'QT!("````(M'%(-_$`!U"XU04+@`````[^L'QT!0
+M`````(M'%(-_$`!U"XU03+@`````[^L'QT!,`````(M'%(-_$`!U#HV0#$``
+M`+@`````[^L*QX`,0````````(M'%(-_$`!U"XU00+@`````[^L'QT!`````
+M`(M'%(-_$`!U#HV0&(```+@`!P``[^L*QX`8@`````<``(M'%(-_$`!U#HV0
+M2(```+@`````[^L*QX!(@````````,=$)`0`````B3PDZ/S___^+1Q2#?Q``
+M=0Z-D%"```"X`````._K"L>`4(````````"+1Q2#?Q``=0Z-D%2```"X````
+M`._K"L>`5(````````"+1Q2#?Q``=0Z-D%B```"X`````._K"L>`6(``````
+M``"+1Q2#?Q``=0Z-D%R```"X`````._K"L>`7(````````"+1Q2#?Q``=0Z-
+MD&"```"X`0```._K"L>`8(````$```"+1Q2#?Q``=0Z-D&2```"X`0```._K
+M"L>`9(````$```"+1Q2#?Q``=0Z-D&B```"X`````._K"L>`:(````````"+
+M1Q2#?Q``=0Z-D"B```"X`````._K"L>`*(````````"+1Q2#?Q``=0Z-D"R`
+M``"X`````._K"L>`+(````````"+1Q2#?Q``=0Z-D&R```"X`````._K"L>`
+M;(````````"+1Q2#?Q``=0Z-D#"```"X_____^_K"L>`,(```/____^+1Q2#
+M?Q``=0Z-D#2```"X_____^_K"L>`-(```/____^+1Q2#?Q``=0Z-D#B```"X
+M`0```._K"L>`.(````$```"[`````(VV`````(L,W8`5``"#?10`=`V-@0"`
+M__\]_P\``'89BW<4BP3=A!4``(-_$`!U!HT4,>_K`XD$,4.!^Z8```!VQ(MU
+M$(ET)`2)/"3H_/___[H#````A<`/A,@"``"+=Q"+7Q2%]G4)C9,HF```[>L&
+MBX,HF```B<&!X?\`__^+5?`/MH**`@``P>`("<&%]G4+C9,HF```B<COZP:)
+MBRB8``"+7Q2+5?`/MHJ+`@``P>$8#[:"BP(``,'@$`G!#[:2C`(``(G0P>`(
+M"<$)T8-_$`!U"XV3-)@``(G([^L&B8LTF```BW<0BU\4A?9U"8V31)@``.WK
+M!HN#1)@``(G!@>%_P/__BU7P#[>"A`(``-'H)8`_```)P87V=0N-DT28``")
+MR._K!HF+1)@``(MW$(M?%(7V=0F-DTB8``#MZP:+@TB8``")P8'A_P_\_XM5
+M\`^W@H0"``#!X`HE`/`#``G!A?9U"XV32)@``(G([^L&B8M(F```BW<0BU\4
+MA?9U"8V39)@``.WK!HN#9)@``(G!@>'_#_C_BU7P#[:"B0(``,'@#"4`\`<`
+M"<&%]G4+C9-DF```B<COZP:)BV28``"+=Q"+7Q2%]G4)C9,0F0``[>L&BX,0
+MF0``B<&#X?R+5?`/MX*$`@``@^`#"<&%]G4+C9,0F0``B<COZP:)BQ"9``"+
+M51")5"0$B3PDZ+(0``"Z`P```(7`#X0%`0``BT<4@W\0`'4.C9`<F```N`$`
+M``#OZPK'@!R8```!````QP0DZ`,``.C\____BU\0BT\4OF"8``"%VW4)C9%@
+MF```[>L&BX%@F```@\@!A=MU!HT4#N_K`XD$#L=$)`P`````QT0D"`$```#'
+M1"0$8)@``(D\).C\____BUT0B5PD!(D\).C\____NP````"%P'45BW40#[=&
+M`H/(`F:)1@*Z`P```.M=B5PD!(D\).C\____0X/[`7;NBT7P@+B-`@```'0(
+MB3PDZ/S___^+7Q"+3Q2^)(```(7;=0F-D22```#MZP:+@22````E__]__H7;
+M=0:-%`[OZP.)!`ZX`0```.L/BUT8@SL`=`*)$[@`````@\086UY?7<.)]HV\
+M)P````!5B>53BTT(BUT,BT$4@WD0`'4-C9`$@```[>L*C70F`(N`!(```"7_
+M_P``@_L!=#"#^P%R&X/[!G0'@_L(="OK5XM1%`T``%$`ZS60C70F`(M1%`T`
+M`%(`ZR:-M@````"+410-```4`.L6BU$4#0``$`"-M"8`````C;PG`````(-Y
+M$`!U"H'"!(```._K$9")@@2```#K"+@`````ZP:0N`$```!;7<.0C;0F````
+M`%6)Y8/L#,=$)`@*````QT0D!`@```"+10B)!"3HWP4``(GL7<.-="8`C;PG
+M`````%6)Y8/L%(E=_(M=",=$)`P`````QT0D"`$```#'1"0$`@```(D<).C\
+M____N@````"%P'1;QT0D""!.``#'1"0$#P```(D<).B#!0``N@````"%P'0Z
+MQP0DZ`,``.C\____QT0D""!.``#'1"0$'P```(D<).A6!0``QP0D-`@``.C\
+M____N@$```"0C70F`(G0BUW\B>Q=PXVT)@````!5B>6#[!R)7?2)=?B)??R+
+M70B+=0S'1"0,`````,=$)`@!````QT0D!`(```")'"3H_/___[H`````A<`/
+MA-X```"+2Q"+4Q2_!)@``+@`````A?9T"_9&`A!T!;@!````A<EU"P'Z[^L)
+MC;8`````B007QT0D""!.``#'1"0$#P```(D<).BE!```N@````"%P`^$B```
+M`,<$).@#``#H_/___\=$)`@@3@``QT0D!!\```")'"3H=`0``+H`````A<!T
+M6\<$)#0(``#H_/___\=$)`P`````QT0D"`$```#'1"0$`@```(D<).C\____
+MN@````"%P'0FQT0D"`H```#'1"0$`````(D<).@>!```B<*-M@````"-OP``
+M``")T(M=](MU^(M]_(GL7<.058GE5U93@^P@BW4(BUX0BTX4OVB```"%VW4)
+MC9%H@```[>L&BX%H@```@\A@A=MU!HT4#^_K`XD$#XM&%(-^$`!U#8V0)(``
+M`.WK"HUT)@"+@"2```")1?"+5A0E__]__X-^$`!U"8'")(```._K!HF")(``
+M`,<$)*`/``#H_/___XM>$(M.%+\(F```A=MU#XV1")@``.WK#(VV`````(N!
+M")@```T````(A=MU!HT4#^_K`XD$#\<$)`H```#H_/___XM%#(E$)`2)-"3H
+M_0L``+H`````A<`/A!`#``#'!"3H`P``Z/S___^+7A"+3A2_")@``(7;=0F-
+MD0B8``#MZP:+@0B8```E____]X7;=0V-%`_OZPJ-M"8`````B00/BT84@WX0
+M`'4)C9!8F```[>L&BX!8F```B47LBT84@WX0`'4)C9!<F```[>L&BX!<F```
+MB47HBT84@WX0`'4.C9!HF```[>L+D(UT)@"+@&B8``")1>2+5A2+1>P-``#\
+M`X-^$`!U"8'"6)@``._K!HF"6)@``(M6%(M%Z"5_`,#_#8#`/P"#?A``=0F!
+MPER8``#OZP:)@ER8``"+5A2+1>0E'P#^_PV`$0``@WX0`'4,@<)HF```[^L)
+MC78`B8)HF```QP0D%````.C\____BUX0BTX4OPB8``"%VW4/C9$(F```[>L,
+MC;8`````BX$(F```#0````B%VW4&C10/[^L#B00/QP0D"@```.C\____BT84
+M@WX0`'43C9#4F```N"$```#OZP^0C70F`,>`U)@``"$```"+7A"+3A2_")@`
+M`(7;=0F-D0B8``#MZP:+@0B8```E____]X7;=0:-%`_OZP.)!`_'!"3H`P``
+MZ/S___^+7A"+3A2_8)@``(7;=0N-D6"8``#MZPB)]HN!8)@``(/(`87;=0:-
+M%`_OZP.)!`_'1"0,`````,=$)`@!````QT0D!&"8``")-"3H_/___XM6%(M%
+M[(-^$`!U#H'"6)@``._K"Y"-="8`B8)8F```BU84BT7H@WX0`'4.@<)<F```
+M[^L+D(UT)@")@ER8``"+5A2+1>2#?A``=0Z!PFB8``#OZPN0C70F`(F":)@`
+M`(M5#(E4)`2)-"3H_/___X7`=3?'!"2($P``Z/S___^+10R)1"0$B30DZ/S_
+M__^%P'48BU4,#[="`H/(`F:)0@*-=@"-O"<`````BUX0BTX4OVB```"%VW4)
+MC9%H@```[>L&BX%H@```@^"?A=MU"XT4#^_K")"-="8`B00/BU84BT7P@WX0
+M`'4)@<(D@```[^L&B8(D@```N@$```"-M@````"-O"<`````B="#Q"!;7E]=
+MPXVV`````%6)Y5=64X/L$(M]"(M=#(7;#Y7`#[;`2(G>"<:+5Q2)V(-_$`!U
+M"8'"`$```._K!HF:`$```(M%$(D$).C\____@^,/B5PD#(GP@^`/B40D",=$
+M)`0`0```B3PDZ/S___^)P?;#!'4HBT<4@W\0`'4/C5`4N`````#OZQ2-="8`
+MQT`4`````(GVC;PG`````(G(@\006UY?7<.-M@````!5B>564X/L!(M-#`^V
+M11"(1?>[`````+H*````#[;`C7`!C;0F`````(V\)P````"-!!($`SA%]W4,
+M@#P*/P^%@@```.M*C002!`,/ML`YQG5%A=)^08`\"C]T-(!\$?\_="T/MAP*
+M#[9,$?\IRVG;7@$``('#YP,``+K336(0B=CWXL'J!HT<$0^VP^M-B?:[`0``
+M`.L9@_L!=12`/`H_=22-M"8`````C;PG`````$H/B7G___^Z`````(UT)@"`
+M/`H_=`H/M@0*ZP^-="8`0H/Z"G[JN`$```"#Q`1;7EW#C;0F`````(V\)P``
+M``!5B>575E.#[`2+70P/ME40O_____^^_____[D`````D(`\&3]T&CH4&71%
+M.A09=@*)SCH4&7,)B<^#_O]U"NLP08/Y"G[:ZPB#^0I^-(UV`+@_````@_[_
+M='V#^0I^(HT$-@0#BTT4B`$/MD0>"^MGC00)!`.+512(`@^V1!D+ZU:)\`'X
+M!`.+312(`0^VR@^V!!XIP6G)Z`,```^V%!\IPHE5\(G(F?=]\(G!#[9$'PL/
+MME0>"RG0#Z_(@<'G`P``NM--8A")R/?BP>H&#[9$'@L`T`^VP(/$!%M>7UW#
+MD%6)Y5=64X/L&(M5#(M]"`^WAX8"``#!Z`0D!XM-$(A!#P^VAX8"```D!XA!
+M$`^W`BTR%```N0````!F/98`#X?V`@``NP`````/MH>(`@``.H0?CP(``'0&
+M0X/[`W;QN0````"#^P0/A,T"```/MPJ!Z3(4``"Z9V9F9HG(]^K!^@*)R,'X
+M'XG1*<&#^0MV`4FZJZJJJHG(]^*)T='IC03-`````"G(C02!C;0XDP(```^V
+M1#,9BU40B$(.#[9&%CI$,QEV!0^V1#,9BTT0B$$)#[9&%SI$,QEV!0^V1#,9
+MBU40B$((#[9&&#I$,QEV!0^V1#,9BTT0B$$'C47SB40D#`^V1#,9B40D"(ET
+M)`2+10B)!"3H!O[__XC#C47RB40D#(M5$`^V0@F)1"0(B70D!(M-"(D,).CC
+M_?__B$7NC47QB40D#(M5$`^V0@B)1"0(B70D!(M-"(D,).B__?__B$7MC47P
+MB40D#(M5$`^V0@>)1"0(B70D!(M-"(D,).B;_?__B,)F@[]\`P````^$70$`
+M``^WAWP#``"#^`)T'H/X`G\'@_@!=`[K(H/X`W03@_@$=!3K%H!M\P/K$(!M
+M\P;K"H!M\PGK!,9%\P,/MD7SB40D"(ET)`2+10B)!"3H2OS__XM5$(A"#HU%
+M[XE$)`P/MD(.B40D"(ET)`2+30B)#"3H%OW__XC##[9%\SI%\G8$#[9%\HA%
+M\@^VP(E$)`B)="0$BT4(B00DZ/[[__^+51"(0@F-1>^)1"0,#[9""8E$)`B)
+M="0$BTT(B0PDZ,K\__^(1>X/MD7S.D7Q=@0/MD7QB$7Q#[;`B40D"(ET)`2+
+M10B)!"3HL?O__XM5$(A""(U%[XE$)`P/MD((B40D"(ET)`2+30B)#"3H??S_
+M_XA%[0^V1?,Z1?!V!`^V1?"(1?`/ML")1"0(B70D!(M%"(D$).AD^___BU40
+MB$('C47OB40D#`^V0@>)1"0(B70D!(M-"(D,).@P_/__B,(/MD7SB8=X`P``
+MBTT0#[9!#HA!"HA!"XA!#(A!#8C8*-"(`8C8*D7MB$$!B-@J1>Z(00+&008`
+MQD$%`,9!!`#&00,`N0$```")R(/$&%M>7UW#C;8`````C;\`````58GE5U93
+M@^Q\C7V$OLP:``#\N1$```#SI<=$)`@1````C5W4B5PD!,<$)+@:``#H_/__
+M_XE<)`B+10R)1"0$BT4(B00DZ&;\__^Z`````(7`#X2I`@``#[9%X_[(N@``
+M```\!`^'E@(```^V1>3^R+H`````/`0/AX,"``"[`````(VT)@````"-O"<`
+M````QT0D!`4````/MD0KU(D$).C\____B$0KU(U#`0^WV&:#^P9VV[L'````
+MC;8`````QT0D!`8````/MD0KU(D$).C\____B$0KU(U#`0^WV&:#^PYVVP^V
+M1=7!X`4EX`````^V5=2#XA\)T`E%A`^V5=?!X@>!XH`````/MD76P>`"@^!\
+M"<(/MD75P.@#@^`#"<()58@/ME78P>($@>+P````#[9%U]#H@^`/"<()58P/
+MME7:P>(&@>+`````#[9%V0'`@^`^"<(/MD78P.@$@^`!"<()59`/ME7;P>(#
+M@>+X````#[9%VL#H`H/@!PG""564#[95W<'B!X'B@`````^V1=P!P(/@?@G"
+M#[9%V\#H!8/@`0G""568#[95WL'B!8'BX`````^V1=W0Z(/@'PG""56<#[95
+MW\'B`X'B^`````^V1=[`Z`.#X`<)P@E5H`^V5>`!TH/B?@^V1=_`Z`6#X`$)
+MP@E5I`^V1>'!X`4EX`````E%J`^V5>+!X@.!XO@````/MD7AP.@#@^`'"<()
+M5:P/MD7BP.@%@^`!"46PQT0D!`,````/MD7CB00DZ/S____!X`<E@`````E%
+MI,=$)`0#````#[9%XXD$).C\____T>B#X`,)1:C'1"0$`P````^V1>2)!"3H
+M_/___\'@`H/@'`E%J+L`````N9R8``"-M@````"-O"<`````BW4(BU84BT2=
+MA(-^$`!U$('"G)@``._K"HVT)@````")!!&-0P$/M]AF@_L/=M&+10B+4!2+
+M1)V$BTT(@WD0`'4)@<+4F```[^L&B8+4F```N@$```"-=@"-O"<`````B="#
+MQ'Q;7E]=PXVV`````%6)Y8/L%(E=](EU^(E]_(M="(MU#(G?B70D!(D<).C\
+M____N@````"%P`^$@````,=$)`0%````#[<&C8@`[/__NF=F9F:)R/?JP?H"
+MB<C!^!\IPHD4).C\____`<"+4Q2#R$&#>Q``=0F!PIR8``#OZP:)@IR8``"+
+M0Q2#>Q``=0Z-D,"8``"X`````._K"L>`P)@```````"+!HF'-`,``+H!````
+MB?:-O"<`````B="+7?2+=?B+??R)[%W#D%6)Y5=64X/L$(MU"(M>$(M.%+]@
+MF```A=MU"8V18)@``.WK!HN!8)@``(/(`H7;=0:-%`_OZP.)!`_'1"0,````
+M`,=$)`@"````QT0D!&"8``")-"3H_/___[D`````A<!T8KL`````OV28``"-
+M=@#'!"3H`P``Z/S___^+1A2#?A``=0N-D&28``#MZP6)]HL$!\'H$XG"@>+_
+M`0``]L0!=`:!\@#^__]#@_L4?P>#^KA_O.L*N0````"#^KA_!;D!````B<B#
+MQ!!;7E]=PY!5B>6X`````%W#C;8`````58GE7<.0D)"0D)"0D)"0D%6)Y5.+
+M50R+70B#^@%T$8/Z`7(3N0$```"#^@-V$NL'N0````#K";C_____ZR^)]HG(
+MP>`$`=B)D$`#``#'@$0#````````QX!(`P```````,>`3`,```````")R%M=
+MPU6)Y8M%#(M5"+D`````@_@!=RW!X`2-A!!``P``@S@`=0ZY`````.L7C;0F
+M`````,<``````+D!````D(UT)@")R%W#C;8`````C;\`````58GE@^P8B5WT
+MB77XB7W\BUT(BT4,B=Z-BS0#``"Z`````(/X`0^'-0,``,'@!(V\&$`#``"#
+M/P!U"KH`````Z1P#``"#/P$/A0,#``"#NV`#````=13'@W0#```"````QX-L
+M`P``#P```(N&=`,```-'!(E%\/9!`A`/A!0!``"+0Q2#>Q``=0Z-D!"```"X
+MX`$``._K"L>`$(```.`!``"+0Q2#>Q``=0Z-D!2```"X``@`"._K"L>`%(``
+M```(``B+0Q2#>Q``=0Z-D""```"XSX_=`>_K"L>`((```,^/W0&+4Q2+1?#!
+MX`0K1?#!X!"-@```#P`-X`$``(-[$`!U"8'"0(```._K!HF"0(```(M#%(-[
+M$`!U#HV01(```+C``ZX%[^L*QX!$@```P`.N!8M#$(E%[(M+%(-][`!U"8V1
+M1)@``.WK!HN!1)@``(/@@(/(.(-][`!U"8V11)@``._K!HF!1)@``(M#%(-[
+M$`!U$(V0!)@``+@C(`!OZ0X!``#'@`28```C(`!OZ0P!``"+0Q2#>Q``=0Z-
+MD!"```"X:`$``._K"L>`$(```&@!``"+0Q2#>Q``=0Z-D!2```"X``0`!._K
+M"L>`%(`````$``2+0Q2#>Q``=0Z-D""```"XIX_=`>_K"L>`((```*>/W0&+
+M4Q2+1?!IP&@!```%,`(``,'@"PTP`@``@WL0`'4)@<)`@```[^L&B8)`@```
+MBT,4@WL0`'4.C9!$@```N)@#UP3OZPK'@$2```"8`]<$BT,0B47HBTL4@WWH
+M`'4)C9%$F```[>L&BX%$F```@^"`@\@<@WWH`'4)C9%$F```[^L&B8%$F```
+MBT,4@WL0`'4.C9`$F```N"`0`&_OZPK'@`28```@$`!ON`$````[AFP#``!S
+M'(N6;`,``(VV`````(V\)P`````!P(/(`3G0<O>#?P@`>0F+3PCWV=/HZPH/
+MMD\(C4`!T^!(@[YD`P```'04BY9P`P``@_H/=@6Z#P```(G6ZPJZ"@```+X*
+M````BWL4B<'!X12)T,'@!"7P````"<&)\(/@#PG!@<D`(`@`@WL0`'4+C9<<
+M@```B<COZQ6)CQR```#K#9"0D)"0D)"0D)"0D)"Z`0```(UT)@"-O"<`````
+MB="+7?2+=?B+??R)[%W#D%6)Y5.+70B+30RX_____X/Y`7<QB<C!X`2+A!A`
+M`P``A<!T'(/X`747BU,4@WL0`'4#[>L0BP+K#(VT)@````"X_____UM=PY"-
+MM"8`````58GE4XM="(M-#+@`````@_D!=UR)R,'@!(N$&$`#``"#^`%T#(/X
+M`7(N@_@#=RGK$(M3%(M%$(-[$`!T$XD"ZQ^+4Q2+11"#>Q``=0:#P@3OZPV)
+M0@3K"+@`````ZQ&0N`$```"-="8`C;PG`````%M=PXVV`````(V\)P````!5
+MB>6#[!")7?B)=?R+70B)'"3H_/___XG&)?___W^)1"0$B1PDZ/S___^+0Q2#
+M>Q``=0V-D&2```#MZPJ-="8`BX!D@```B<*#?0P`=!*X)0```"G0T>@!PNLE
+MD(UT)@"#^`%V`TKK&(ET)`2)'"3H_/___[@`````ZS"0C70F`(M+%(G0@WL0
+M`'4)C9%D@```[^L&B9%D@```B70D!(D<).C\____N`$```"+7?B+=?R)[%W#
+MC70F`(V\)P````!5B>53BUT(BT4,N0````"#^`$/A[@```#!X`2+A!A``P``
+M@_@!=!F#^`$/@I````"#^`)T7H/X`W0BZ8$```"0BT,4@WL0`'4*C5`(N`$`
+M``#K7<=`"`$```#K:XM#%(-[$`!U"XU0"+@"````[^L'QT`(`@```(M#%(-[
+M$`!U"HU0*+@.````ZR;'0"@.````ZS2+0Q2#>Q``=1>-4"BX"@```(VV````
+M`(V_`````._K%,=`*`H```#K"XUT)@"Y`````.L)N0$```"-="8`B<A;7<.-
+M="8`C;PG`````%6)Y5.+70B+30RX`````(/Y`7<VB<C!X`2+A!A``P``A<!T
+M(8/X`74<BT,4@WL0`'4&C5`4[>L#BT`4)0!X``#!Z`OK!;@`````6UW#C78`
+M58GE@^P<B5WTB77XB7W\BUT(BTT,N`````"#^0$/A]T```")R,'@!(N$&$`#
+M``"#^`%T'(/X`0^"NP```(/X`@^$D````.FM````D(UT)@"+0Q2#>Q``=0N-
+M4`BX"````._K!\=`"`@```"^`````+\4````C70F`(V\)P````"+0Q2#>Q``
+M=0>-4!3MZP20BP0']L1X=!7'!"0*````Z/S___]&@?[G`P``?M.+0Q2#>Q``
+M=0N-4`BX`````._K!\=`"`````"!_N<#```/GL`/ML#K*L=$)`P`````QT0D
+M"`0```#'1"0$+````(D<).C\____ZPBX`````(UV`(M=](MU^(M]_(GL7<.-
+M=@!5B>6X`````%W#C;8`````58GE@^P,B1PDB70D!(E\)`B+51B+?2B+=3"+
+M30R#?20`=0VX`````.FK````C78`@_H"=A"X`````(/Z!`^'E0```.L+B=/!
+MXQKK"8UT)@"[````#(M%$"7_#P``BU4@P>(2"="+513!X@R!X@#P`P`)T`G8
+M]\8!````=`4-`````8G"@WTL`'0&@<H````"B5$(@___=!F)^,'@#24`X`<`
+MB4$,B=`-````0(E!".L/QT$,`````)"-M"8`````]\8$````=`N+13@E``#X
+M_PE!#+@!````BQPDBW0D!(M\)`B)[%W#B?:-O"<`````58GEN`$```!=PXVV
+M`````%6)Y5.+11"+30R)PH'B_P\``+L`````.<)U18-]%`!T!0E1#.L*QT$(
+M`````(E1#(-]&`!T"H%A#/_O___K")"!20P`$```QT$4`````,=!$`````"[
+M`0```(VV`````(G86UW#C70F`(V\)P````!5B>6+30R)RO9!%`%U"K@/````
+MZ8D````/MT$4)?X?``!FB4$@#[=!$F:)02+&020`BT$0J`%U**@"=`3&020!
+M]D(0"'0$@$DD`O9"$`1T$(!))`2-M@````"-OP````"+0@@E```\`,'H$HA!
+M)8M"%"4`X!\`P>@-B$$FBT(0)?````#!Z`2(02>+0A`E``\``,'H"(A!*,9!
+M*@"X`````%W#D)"0D)"0D)"0D)"0D%6)Y5=64X/L"(MU"(M&%(-^$`!U#HV0
+MT)@``+@6'```[^L*QX#0F```%AP``+D`````OX"8``"[```!`(UT)@"+1A2#
+M?A``=0N-D("8``")V._K`XD<!T&#^0=^XXM&%(-^$`!U"8V0`)P``.WK!HN`
+M`)P``(G"P>H8B=#!Z`2#X@_!X@0)PL=$)`0(````B10DZ/S___^#Q`A;7E]=
+MPY!5B>575E.#[!P/MT4(B47HQP0DZ`P``.C\____B47DA<!U#<=%[`(```#I
+M404``)"+7>2)W[X@&P``N(`"``#V1>0$=!>A(!L``(D#BWWD@\<$OB0;``"X
+M?`(``/R)P<'I`O.EBU7H9HE3"&;'0PH``(M%#(E##(M%$(E#$(M%%(E#%(M-
+MY,>!M`P```````#'@<@,````````QX&@#````````,>!S`P```H```#'@9P,
+M````````QX'0#```"@```,>!L`P```(```#'@<`,````````QT0D!`````")
+M'"3H_/___X7`=0S'1>P#````Z8H$``!F@7L(&_%U4HM#%(-[$`!U#HV0`*(`
+M`+@`````[^L*QX``H@```````(M#%(-[$`!U#HV0?)@``+@9````[^L*QX!\
+MF```&0```,<$).@#``#H_/___XUT)@"+0Q2#>Q``=0N-D"!```#MB<'K!HN(
+M($````^VP<'H!(F#7`$``(G*@^(/9HF38`$``(/H`H/X`@^'X@(``(M#%(-[
+M$`!U"8V0&)@``.WK!HN`&)@``&:)@V(!``")'"3H&P0``(7`=0S'1>P.````
+MZ;L#``"#NUP!```#=B*+0Q2#>Q``=0V-D`"8``"X!P```.L@QX``F```!P``
+M`.LPBT,4@WL0`'4.C9``F```N$<```#OZQG'@`"8``!'````ZPV0D)"0D)"0
+MD)"0D)"0QP0DT`<``.C\____B1PDZ"S]__]FB8-D`0``#[?`)?````"#^!`/
+MA20"``"-1?*)1"0(QT0D!,$```")'"3H_/___X7`#X0)`P``9H%]\O\O=PS'
+M1>P%````Z0$#```/MT7RBU7D9HF"@`(``(M#%(-[$`!U"8V0$$```.WK!HN`
+M$$```(/@&,'H`X/X`G0,QT7L"@```.G$`@``C47RB40D",=$)`0_````B1PD
+MZ/S___^%P`^$F0(```^W1?*+3>1FB8&"`@``OP````"^`````(U%\HE$)`B-
+MAL````")1"0$B1PDZ/S___^%P`^$8`(```^W1?(QQT:!_C\#``!VT('___\`
+M`'0,QT7L!P```.E)`@``BU7D9L>"R@,```H`9L>"U`4```,`O@````"-!':-
+M!(:+3>1FQX2!T@,```L`1H/^"7;GO@````"ZH!T```^W!'*+3>1FB81QW`4`
+M`&:)A''6!0``C01VC02&C02!9L>`A`8```L`9L>`Z`4```L`1H/^`G;(QT0D
+M"`````")R`6``@``B40D!(D<).C\____A<`/A*4!``"#NUP!```##X:@````
+MBT7D9H.XF`(````/A(\```"+0Q2#>Q``=0Z-D`"8``"X!T```._K"L>``)@`
+M``=```#'!"30!P``Z/S___^)'"3H/OO__V:)@V8!``"+0Q2#>Q``=0Z-D`"8
+M``"X!P```._K"L>``)@```<```#'!"30!P``Z/S___\/MX-F`0``)?````"#
+M^"!T(8GVC;PG`````,=%[`T```#I!`$``(M5Y&;'@I@"`````(U%\HE$)`C'
+M1"0$OP```(D<).C\____A<`/A,T````/MT7RBTWD9HF!A`(``&:#^`%U%XU%
+M[(E$)`C'1"0$$````(D<).C\____B1PDZ/S___^_`````+X`````C47RB40D
+M"+@?````*?")1"0$B1PDZ/S___^%P'1R#[=%\@''P>@(BU7DB(1RY`L```^V
+M1?*(A'+E"P``1H/^`G:^A?]T"('__?\"`'4)QT7L"0```.M%BX-<`0``B4,<
+M#[>#8`$``&:)0R`/MX-B`0``9HE#(@^W@V0!``!FB4,D#[>#9@$``&:)0R:)
+MV.LPQT7L"````)"-="8`@WWD`'0+BTWDB0PDZ/S___^#?1@`=`B+1>R+51B)
+M`K@`````@\0<6UY?7<.-="8`58GE@^P$BT4(B00DZ/S___^)[%W#C70F`(V\
+M)P````!5B>575E.#[#B+?0C'1=P`@```QT7@()@``,=%Y%55557'1>BJJJJJ
+MQT7L9F9F9L=%\)F9F9G'1=``````BT70P>`"BW0%W(G#BT\4@W\0`'4&C10.
+M[>L#BP0.B40=U+L`````B77,B?:-O"<`````B=C!X!`)V(E%Q(M7%(E%P(-_
+M$`!U"@'R[^L.D(UT)@"+3<"+1<R)#!"+3Q2#?Q``=0Z-%`[MB<+K"8VV````
+M`(L4#KD`````.U7$#X6@````0X'[_P```'ZFNP````")=<B-M"8`````C;PG
+M`````(M,G>2)3<2+5Q2#?Q``=0<!\HG([^L&BT7(B0P0BT\4@W\0`'4*C10.
+M[8G"ZP6)]HL4#KD`````.57$=41#@_L#?KV+3Q2+1=#!X`*+5`7<BT0%U(-_
+M$`!U!HT4"N_K`XD$"O]%T(-]T`$/CNW^___'!"1D````Z/S___^Y`0```(G(
+M@\0X6UY?7<.0C70F`%6)Y5W#C70F`(V\)P````!5B>6+51"+310/MT4,]L0!
+M=`YFQP(X$V;'`=07ZR*)]H3`>2.+10AF@[B8`@```'069L<""`EFQP&L"I"-
+M="8`N`$```#K!;@`````7<.0D%6)Y5=64X/L"(M="(M-#(M]$(MU%(E=\(M3
+M%(GX@WL0`'4-@<(H@```[^L*C70F`(FZ*(```('F__\``(/Y`70?@_D!<FJ#
+M^08/A+,```"#^0@/A?@```"0C;0F`````(M#%(-[$`!U#HV0+(```+C__P``
+M[^L*QX`L@```__\``(M#%(-[$`!U#HV0,(```+C__P<`[^L*QX`P@```__\'
+M`('.`````>FC````C78`BU,4B?@K!0````#!X`.#>Q``=0R!PBR```#OZPF-
+M=@")@BR```"+0Q2#>Q``=1&-D#"```"X__\'`._K#8UV`,>`,(```/__!P"!
+MS@``@`#K3HM3%(GX*P4`````P>`#@WL0`'4)@<(L@```[^L&B8(L@```BU,4
+MB?@K!0````#!X`.#>Q``=0F!PC"```#OZP:)@C"```"!S@``@`&)]HM+$(M#
+M%(E%[(M5\(.ZG`P```!T"XGX`X*<#```ZP20C4<!A<EU#(M5[('"-(```._K
+M"8M5[(F"-(```(M3%(GP@WL0`'4)@<(@@```[^L&B;(@@```@\0(6UY?7<.)
+M]E6)Y593@^P(BW4(NP````#'1"0$`@```(DT).C\____A<!T%<<$)`H```#H
+M_/___T.!^^<#``!^UX'[YP,```^>P`^VP(/$"%M>7<.-="8`58GEBTT(BT$4
+M@WD0`'41C9`H@```N`````#OZPV-=@#'@"B`````````BT$4@WD0`'4-C9`$
+M@```[>L*C70F`(N`!(````T```0`BU$4)?__S_^#>1``=0F!P@2```#OZP:)
+M@@2```"+012#>1``=0^-D""```"X__\``._K"Y#'@""```#__P``7<.-="8`
+M58GE5U93BW4(BT4,@'@+``^$N@```(M>$(M.%+\$@```A=MU"XV1!(```.WK
+M"(GVBX$$@```#0``$`"%VW4&C10/[^L#B00/BU4,#[9""P^V4@H/K\*+30P/
+MMU$(BTX4#Z_"@WX0`'4)C9$D@```[^L&B8$D@```BU84BTT,#[=!#(-^$`!U
+M"8'".(```._K!HF".(```(M5#`^V0@H/KT48`T44#[=2"`^OPHM6%`-%$,'@
+M`X-^$`!U"('",(```.LWB8(P@```ZT60C70F`(M>$(M.%+\$@```A=MU"8V1
+M!(```.WK!HN!!(```"7__^__A=MU"8T4#^_K$XUV`(D$#XVV`````(V\)P``
+M``"+5A2+30R+`8-^$`!U"8'"*(```._K!HF"*(```(M^$(M>%(7_=0F-DR"`
+M``#MZP:+@R"```")PH'B``"`_XM-#`^W00B)T0G!BT4,9H-X$`!T$0^W0!"#
+MP`3!X!`E``!_``G!A?]U"XV3((```(G([^L&B8L@@```BWX0BUX4A?]U#8V3
+M&(```.WK"HUT)@"+@QB```")P8'A_P#__XM5#`^W0A3!X`@E`/\```G!A?]U
+M#8V3&(```(G([^L(B?:)BQB```"+?A"+7A2^!$```(7_=0N-DP1```#MZPB)
+M]HN#!$```(G!@>$``/__BU4,#[="$HT$Q>C___\E__\```G!A?]U"8T4'HG(
+M[^L$D(D,'EM>7UW#D)"0D)"0D)!5B>6+10B+4!2#>!``=0F!P@A```#MZP:+
+M@@A```"%P`^5P`^VP%W#D(VT)@````!5B>6+10B+30R+4!2#>!``=0Z!PL``
+M``#MZPN0C70F`(N"P````(G"@_C_=1/'`0````"X`````.L_C;8`````);K8
+M!0&)`??"```(`'0'#0```$")`?;"!70#@PD!]\)``0``=`.#"4#VPB!T!H$)
+M````0+@!````7<.0C70F`%6)Y8M%"(N`\`L``%W#B?95B>6#[`R)'"2)="0$
+MB7PD"(M="(M-#(G?B[/P"P``A?9Y/8M#%(-[$`!U"XU0)+@`````[^L'QT`D
+M`````(M#%(-[$`!U"8U0).WK$XUV`(M`)(VV`````(V\)P````")R"6ZV`4!
+M]L%`=`4-P`$``/;!`70#@\@']\$```!`=`4-```(`(M3%(-[$`!U"8'"H```
+M`._K!HF"H````(F/\`L``(7)>2B+0Q2#>Q``=0^-4"2X`0```._K%(UT)@#'
+M0"0!````B?:-O"<`````B?"+'"2+="0$BWPD"(GL7<.0D)"0D)"0D)"0D)"0
+MD)!5B>6X@````%W#C;8`````58GEBTT(#[=%#&:#^']W*(M1%,'@!04<B```
+M@WD0`'4%`<+MZP.+!!`E`(#__[H!````9H7`=06Z`````(G07</K#9"0D)"0
+MD)"0D)"0D)!5B>53BUT(#[=-#+@`````9H/Y?P^'"@$``(M3%(G(P>`%!0"(
+M``"#>Q``=0H!PK@`````[^L'QP00`````(M3%(G(P>`%!02(``"#>Q``=0\!
+MPK@`````[^L,D(UT)@#'!!``````BU,4B<C!X`4%"(@``(-[$`!U"@'"N```
+M``#OZP?'!!``````BU,4B<C!X`4%$(@``(-[$`!U"@'"N`````#OZP?'!!``
+M````BU,4B<C!X`4%%(@``(-[$`!U#@'"N`````#OZPN-="8`QP00`````(M3
+M%(G(P>`%!1B(``"#>Q``=0H!PK@`````[^L'QP00`````(M3%(G(P>`%!1R(
+M``"#>Q``=0H!PK@`````[^L'QP00`````+@!````6UW#B?:-O"<`````58GE
+M@^P,B1PDB70D!(E\)`B+51`/MW4,N`````!F@_Y_#X>A````A=)T.`^V6@7!
+MXP@/MD($"<,/MDH#P>$8#[9"`L'@$`G!#[9"`<'@"`G!#[8""<'1Z8G8P>`?
+M"<'1Z^L-NP````"Y`````(UV`(M%"(MX%(GPP>`%C9`8B```B<B+30B#>1``
+M=0:-%#KOZP.)!#J+10B+2!2)\,'@!8V0'(@``(G8#0"```"+70B#>Q``=0J-
+M%`KOZP>-="8`B00*N`$```"+'"2+="0$BWPD"(GL7<.)]HV\)P````!5B>57
+M5E.#[!R+71`/MT4,B47P@WT8``^4P`^VR$F!X:JJJJJX`````&:#??!_#X?L
+M`0``@SL$?PJX`````.G=`0``#[9S!`^V0P7!X`@)Q@^V0P;!X!`)Q@^V0P?!
+MX!@)QC'.#[9#"<'@"`^V4P@)PHE5[#%-[(%E[/__```/MD,*B47H#[9#"\'@
+M"`E%Z`^V0PS!X!`)1>@/MD,-P>`8"47H,4WH#[9##\'@"`^V4PX)PHE5Y#%-
+MY(%EY/__```/MGL0#[9#$<'@"`G'#[9#$L'@$`G'#[9#$\'@&`G',<^#.PU_
+M!H'G_P```(,[!7\'NP````#K&(,[#7\'NP$```#K#+L#````C;0F`````(M%
+M"(M(%(M%\,'@!8V0`(@``(GPBW4(@WX0`'4&C10*[^L#B00*BT4(BT@4BT7P
+MP>`%C9`$B```BT7LBW4(@WX0`'4,C10*[^L)C;8`````B00*BT4(BT@4BT7P
+MP>`%C9`(B```BT7HBW4(@WX0`'4&C10*[^L#B00*BT4(BT@4BT7PP>`%C9`,
+MB```BT7DBW4(@WX0`'4(C10*[^L%B?:)!`J+10B+2!2+1?#!X`6-D!"(``")
+M^(MU"(-^$`!U!HT4"N_K`XD\"HM%"(M(%(M%\,'@!8V0%(@``(G8BUT(@WL0
+M`'4*C10*[^L'C70F`(D$"HM%%(E$)`B+=?")="0$BT4(B00DZ/S___^-="8`
+M@\0<6UY?7<.0D)"0D)"0D%6)Y8/L#,=$)`@&````BT4(!>0+``")1"0$BT4,
+MB00DZ/S___^)[%W#C;0F`````%6)Y8/L%(E=_(M="(M3%(M%#(-[$`!U"8'"
+M`&```._K!HF"`&```(M#%(-[$`!U$(V0"&```+@!````[^L,B?;'@`A@```!
+M````QT0D#`(```#'1"0(`P```,=$)`0,8```B1PDZ/S___^Z`````(7`="6+
+M0Q2#>Q``=0N-D`1@``#MB<+K!HN0!&```(M%$&:)$+H!````B="+7?R)[%W#
+MZPV0D)"0D)"0D)"0D)"058GEBTT0#[=%#(M5"&8Y@H0"``!U"K@,````ZQ>-
+M=@"`NH("````#YC`#[;`C03%`P```(7)=`*)`;@`````7</K#9"0D)"0D)"0
+MD)"0D)!5B>6+10@/MX"$`@``7<.058GEBU4(N`````!F@[J6`@```'0;N`$`
+M``!F@[J&`@```'4,N`,```"-M"8`````9H.ZF`(```!T`X/(!%W#D%6)Y8/L
+M%(E=_(M="&:#NXH"````=$J-1?J)1"0(QT0D!`\```")'"3H_/___[H`````
+MA<!T5@^W5?J)T(/@','X`HF#V`P``(/B`M'ZB9/<#```QX/D#````0```.L?
+MD,>#W`P```````#'@]@,````````QX/D#````````&:#NXH"````#Y7`#[;0
+MB="+7?R)[%W#C70F`(V\)P````!5B>564X/L#(M="(G>QT0D!`````")'"3H
+M_/___X7`#Y3`#[;`B40D",=$)`0`````B1PDZ/S___^+@]@,``")1"0$B1PD
+MZ/S___^+0Q2#>Q``=0R-D`"8``#MZPF-=@"+@`"8``"+4Q0E_]___X-[$`!U
+M#('"`)@``._K"8UV`(F"`)@``(N&V`P``(E$)`2)'"3H_/___XF&X`P``#N&
+MW`P```^5P`^VP(E$)`B+AM@,``")1"0$B1PDZ/S___^#Q`Q;7EW#B?:-O"<`
+M````58GE4XM="(M#%(-[$`!U$(V0%$```.V)PNL+D(UT)@"+D!1```"+30P!
+MR;@#````T^#WT"'0N@(```#3XHM+%`G0@WL0`'4)C9$40```[^L&B8$40```
+MN`$```!;7<.058GE@^P(B1PDB70D!(M="(M#%(-[$`!U"XV0%$```.V)QNL&
+MB[`40```BTT,`<FX`P```-/@]]"+4Q0A\(-[$`!U#8'"%$```._K"HUT)@")
+M@A1```"X`0```(L<)(MT)`2)[%W#C78`C;PG`````%6)Y5.+70B+30R+0Q2#
+M>Q``=0V-D!A```#MZPJ-="8`BX`80```NO[____3PB'"BT40@^`!T^"+2Q0)
+MT(-[$`!U#HV1&$```._K"Y"-="8`B8$80```N`$```!;7<.)]E6)Y8M5"(M-
+M#+C_____@_D%=R"+0A2#>A``=0F-D!Q```#MZP:+@!Q```"#X"_3Z(/@`5W#
+MC70F`(V\)P````!5B>6#[`B+30B+012#>1``=0Z-D!1```#MZPN0C70F`(N`
+M%$```"7\?_[_#0"```"#?1``=`4-```!`(M1%(-Y$`!U#('"%$```._K"8UV
+M`(F"%$```(N!\`L```T````!B40D!(D,).C\____B>Q=P^L-D)"0D)"0D)"0
+MD)"0D%6)Y8/L#(D<)(ET)`2)?"0(BT4(BW`0BU@4OQ!```"%]G4-C9,00```
+M[>L*C70F`(N#$$```(G!@>&?__'_BT4,@^`'"PR%P!T``(7V=0B-%!^)R._K
+M`XD,'XL<)(MT)`2+?"0(B>Q=PXVT)@````!5B>575E.#[!2+70@/MT40B47P
+M#[=%%(E%[(G?QT0D"`8```"+10R)1"0$C8/J"P``B00DZ/S___^+4Q0/MHOJ
+M"P``#[:#ZPL``,'@"`G!#[:#[`L``,'@$`G!#[:#[0L``,'@&`G!@WL0`'4+
+M@<((@```B<COZP:)B@B```"+<Q0/MH?O"P``P>`(#[:7[@L``(G1"<&+1?`E
+M_S\``,'@$`G!@WL0`'4+C98,@```B<COZP:)C@R```!F@WWP`'1?BT,4@WL0
+M`'4)C9`@@```[>L&BX`@@```B<&+1>R#P`1F@WWL``^4P@^VTDHAT('A__^`
+M_\'@$"4``'\`BU,4"<B#>Q``=0F!PB"```#OZP^)@B"```")]HV\)P````"#
+MQ!1;7E]=PY"-M"8`````58GE@^P,B1PDB70D!(E\)`B+50B+0A2#>A``=0F-
+MD%"```#MZP:+@%"```")Q[X`````BU4(BT(4@WH0`'4)C9!,@```[>L&BX!,
+M@```N@````")\0G!B?L)TXG(B=J+'"2+="0$BWPD"(GL7<.)]E6)Y8M%"(M0
+M%(-X$`!U"8'"3(```.WK!HN"3(```%W#58GEBTT(BT$4@WD0`'4)C9`@@```
+M[>L&BX`@@```BU$4#0````&#>1``=0F!PB"```#OZP:)@B"```!=PXUV`%6)
+MY8/L"(D<)(ET)`2+70B+0Q2#>Q``=0F-D&28``#MZP:+@&28``")P<'I$X'A
+M_P$``/;%`70&@?$`_O__BT,4@WL0`'4+C9!0@```[8G&ZP:+L%"```"+4Q2#
+M>Q``=0^!PDR```#MZPR-M@````"+@DR````Q\#'(BQPDBW0D!(GL7<.-="8`
+MC;PG`````%6)Y5.+30B+012#>1``=1"-D"!```#MZPV-M"8`````BX`@0```
+M)?\```")PL'J!(/@#[L`````.9%<`0``=1!F.8%@`0``=0>[`0```(GVB=A;
+M7<.-="8`C;PG`````%6)Y5.+30B+70R+012#>1``=0V-D)"```#MZPJ-="8`
+MBX"0@````0.+012#>1``=0^-D(R```#MZPR-M@````"+@(R````!0P2+012#
+M>1``=0Z-D)2```#MZPN0C70F`(N`E(````%##(M!%(-Y$`!U#HV0B(```.WK
+M"Y"-="8`BX"(@````4,(BT$4@WD0`'4.C9"8@```[>L+D(UT)@"+@)B````!
+M0Q!;7<.-="8`58GEN`````!=PXVV`````%6)Y8/L"(M-"(M!%(-Y$`!U#HV0
+M5)D``+@!````[^L*QX!4F0```0```(N!\`L```T`0```B40D!(D,).C\____
+MB>Q=PXUT)@"-O"<`````58GEN`````!=PXVV`````%6)Y;@`````7<.-M@``
+M``!5B>5=PXUT)@"-O"<`````58GE7<.-="8`C;PG`````%6)Y8M%"(M0%(-X
+M$`!U"8'"')P``.WK!HN"')P``"7_````7<.-="8`C;PG`````%6)Y8M%"(M0
+M%(-X$`!U"8'"6(```.WK!HN"6(```(/@!UW#C;8`````C;PG`````%6)Y8M-
+M"(M1%(M%#(/@!X-Y$`!U"X'"6(```._K"(GVB8)8@```7<.0C;0F`````%6)
+MY5=64XM]"(G[BT40#[=``B7@`0``/<````!T,CW`````?PP]H````'06Z;\`
+M``"^`````#U``0``=!CIK@```+X!````ZPR-M"8`````O@(````/MY1S\`(`
+M``^WA'/V`@``P>`&"<(/MX1S_`(``,'@#`G"#[>$<P(#``#!X!()P@^WA',(
+M`P``P>`8"<(/MXQS#@,```^WA',4`P``P>`&"<$/MX1S&@,``,'@#`G!#[>$
+M<R`#``#!X!()P0^WA',F`P``P>`8"<&#?0P!=`Z#?0P!<AZ#?0P"=`;K#XG1
+MZQ*)RNL.C;0F`````+@`````ZT2+10R)@Z`,``"+7Q2)T(-_$`!U"8V38)D`
+M`._K!HF38)D``(M7%(G(@W\0`'4+@<)DF0``[^L(B?:)BF29``"X`0```%M>
+M7UW#58GE5U93@^Q0BW4(QT0D!#\)``#'!"0`````Z/S____'1"0$6`D``,<$
+M)`````#H_/___\=$)`@Z````QT0D!.`=``")-"3H_/___XM&%(-^$`!U"8V0
+MM````.WK!HN`M````(E%[(M&%(-^$`!U"8V0L````.WK!HN`L````(E%Z(M&
+M%(-^$`!U"XV0K````.V)Q^L&B[BL````BT84@WX0`'4+C9"H````[8G#ZP:+
+MF*@```"+1A2#?A``=0N-D*0```#MB<'K!HN(I````(M&%(-^$`!U"8V0H```
+M`.WK!HN`H````(M5[(E4)!R+5>B)5"08B7PD%(E<)!")3"0,B40D",=$)`1:
+M"0``QP0D`````.C\____BT84@WX0`'4)C9#`````[>L&BX#`````B47PBT84
+M@WX0`'4)C9#4````[>L&BX#4````B47DBT84@WX0`'4+C9#0````[8G'ZP:+
+MN-````"+1A2#?A``=0N-D,P```#MB</K!HN8S````(M&%(-^$`!U"XV0R```
+M`.V)P>L&BXC(````BT84@WX0`'4)C9#$````[>L&BX#$````BU7DB50D'(E\
+M)!B)7"04B4PD$(E$)`R+1?")1"0(QT0D!(T)``#'!"0`````Z/S____'1"0$
+M6`D``,<$)`````#H_/___XM&%(-^$`!U"XV00`H``.V)P^L&BYA`"@``BT84
+M@WX0`'4+C9"`"```[8G!ZP:+B(`(``"+1A2#?A``=0F-D$`(``#MZP:+@$`(
+M``")7"0<QT0D&,`)``")3"04QT0D$,P)``")1"0,QT0D"-()``#'1"0$V`D`
+M`,<$)`````#H_/___XM&%(-^$`!U"XV0@`D``.V)P>L&BXB`"0``BT84@WX0
+M`'4)C9!`"0``[>L&BX!`"0``B4PD#(E$)`C'1"0$^0D``,<$)`````#H_/__
+M_[L`````C;8`````C;PG`````(M6%(T$G0`*``"#?A``=0@!PNV)1>#K!HL4
+M$(E5X(M6%(T$G<`)``"#?A``=0@!PNV)1=SK!HL4$(E5W(M6%(T$G0`)``"#
+M?A``=0<!PNV)Q^L#BSP0BU84C02=P`@``(-^$`!U"@'"[8G!ZP:-=@"+#!"+
+M5A2-!)T`"```@WX0`'4%`<+MZP.+!!"+5>")5"0<BU7<B50D&(E\)!2)3"00
+MB40D#(E<)`C'1"0$)0H``,<$)`````#H_/___T.#^PD/CCG____'1"0$6`D`
+M`,<$)`````#H_/___[L`````BU84C02=0!$``(-^$`!U"`'"[8E%V.L&BQ00
+MB578BU84C02=`!$``(-^$`!U"`'"[8E%U.L&BQ00B574BU84C02=P!```(-^
+M$`!U"`'"[8E%T.L&BQ00B570BU84C02=@!```(-^$`!U!P'"[8G'ZP.+/!"+
+M5A2-!)U`$```@WX0`'4,`<+MB<'K")"-="8`BPP0BU84C02=`!```(-^$`!U
+M!0'"[>L#BP00BU78B50D((M5U(E4)!R+5=")5"08B7PD%(E,)!")1"0,B5PD
+M",=$)`1<"@``QP0D`````.C\____0X/["0^.$O___[L`````C;8`````C;PG
+M`````(M6%(G8P>`(!3@0``"#?A``=04!PNWK`XL$$(E%S(M.%(G:P>((@\I`
+M@<(X$```@WX0`'4+C10*[>L(D(UT)@"+!`J)1<B+3A2)VL'B"('*@````('"
+M.!```(-^$`!U!HT4"NWK`XL$"HG'BTX4B=K!X@B!RL````"!PC@0``"#?A``
+M=0N-%`KMZPB0C70F`(L$"HG"@WW,`'45@WW(`'4/A?]U"X7`=#6-M"8`````
+MB50D&(E\)!2+1<B)1"00BU7,B50D#(E<)`C'1"0$G0H``,<$)`````#H_/__
+M_T.#^PD/CAC___^#Q%!;7E]=PU6)Y5.+30@/MUT0BT$4@WD0`'4,C9`$@```
+M[>L)C78`BX`$@```BU$4)?__W_\-```$`(-Y$`!U"8'"!(```._K!HF"!(``
+M`(-]#`!T(HM1%(G8#0```@"#>1``=0F!P@1```#OZPF)@@1```"-=@!;7<.-
+MM@````"-O"<`````58GE5U93@^P$BUT(@WT,``^$H0```(M#%(-[$`!U#HV0
+M!$```+@`````[^L*QX`$0````````,<$)`H```#H_/___[X*````OQ!```"-
+M=@"+0Q2#>Q``=0F-D!!```#MZP.+!`>I```!`'0SQP0DR````.C\____BT,4
+M@WL0`'4/C9`$0```N`````#OZPN0QX`$0````````$YUL^L1A?9U%(VV````
+M`(V\)P````"X`````.LUBW,0BTL4NP2```"%]G4)C9$$@```[>L&BX$$@```
+M)?__^_^%]G4&C10+[^L#B00+N`$```"#Q`1;7E]=PXVV`````(V_`````%6)
+MY8/L#(D<)(ET)`2)?"0(BW4(BUX0BTX4OP2```"%VW4-C9$$@```[>L*C70F
+M`(N!!(````T```0`A=MU!HT4#^_K`XD$#X-]#`!T(HM&%(-^$`!U#HV0!$``
+M`+@```$`[^L+QX`$0``````!`)"+'"2+="0$BWPD"(GL7<.058GE@^P0B5WT
+MB77XB7W\BW4(#[=%$(E%\(M>$(M.%+\$@```A=MU"8V1!(```.WK!HN!!(``
+M``T```0`A=MU!HT4#^_K`XD$#X-]#`!T,8M6%(M%\`T```(`@WX0`'40@<($
+M0```[^L7C;0F`````(F"!$```(UV`(V\)P````"+7?2+=?B+??R)[%W#C78`
+M58GE@^P8B5WTB77XB7W\BT4(BUT,BTT0#[=5%(G&OP$```"#^P)T*H/[`G<'
+M@_L!=`[K3H/[`W0I@_L$=#+K0HE4)`B)3"0$B00DZ"#]___K/HE,)`2)!"3H
+MDOW__XG'ZRZ)3"0$B00DZ(+^___K((E4)`B)3"0$B00DZ/#^___K#K@`````
+MZQ>-M"8`````B9Z8#```B?B0C;0F`````(M=](MU^(M]_(GL7<.-=@!5B>6+
+M10B+@)@,``!=PXGV58GEN`````!=PXVV`````%6)Y;@`````7<.-M@````!5
+MB>6X`````%W#C;8`````58GEN`````!=PY"0D)"0D%6)Y8/L#(E=_(M%#(/X
+M`G0F@_@"=PJ#^`%T#.LCC78`@_@$=`OK&;L`````ZQF)]KL`````ZQ"[````
+M`.L)B?:X`````.L1B5PD!(M%"(D$).C\____B=B+7?R)[%W#D%6)Y8M%"(M0
+M%(-X$`!U!H/"#.WK`XM"#%W#C;8`````58GEBTT(BU$4BT4,@WD0`'4&@\(,
+M[^L#B4(,7<.-=@!5B>6+10B+4!2#>!``=1&#P@BX!````._K#8VV`````,="
+M"`0```!=PXVT)@````!5B>6#[!"+30B+012#>1``=0Z-4`BX(````._K"HUV
+M`,=`""````#'1"0,`````,=$)`@$````QT0D!`@```")#"3H_/___X7`#Y7`
+M#[;`B>Q=PXVV`````(V\)P````!5B>6#[`B)'"2)="0$BT4(BU@0BT@4ODB`
+M``"%VW4)C9%(@```[>L&BX%(@```@^#?A=MU"XT4#N_K")"-="8`B00.BQPD
+MBW0D!(GL7<.)]E6)Y8/L"(D<)(ET)`2+10B+6!"+2!2^2(```(7;=0F-D4B`
+M``#MZP:+@4B```"#R""%VW4+C10.[^L(D(UT)@")!`Z+'"2+="0$B>Q=PXGV
+M58GEBTT(BU$4BT4,@WD0`'4.@<)`@```[^L+D(UT)@")@D"```"+412+11"#
+M>1``=0Z!PD2```#OZPN0C70F`(F"1(```%W#D(VT)@````!5B>6#[`B)'"2)
+M="0$BUT(BTT,N`````"#^3\/AY0```"#^1]V2HM#%(-[$`!U$8V01(```.V)
+MPNL,C;8`````BY!$@```BW,4@^D@N/[____3P"'0@WL0`'4(C99$@```ZS^)
+MAD2```#K19"-="8`BT,4@WL0`'4+C9!`@```[8G"ZP:+D$"```"+<Q2X_O__
+M_]/`(="#>Q``=0F-ED"```#OZPN)AD"```"0C70F`+@!````BQPDBW0D!(GL
+M7<-5B>6#[`B)'"2)="0$BUT(BTT,N`````"#^3\/AY0```"#^1]V2HM#%(-[
+M$`!U$8V01(```.V)PNL,C;8`````BY!$@```BW,4@^D@N`$```#3X`G0@WL0
+M`'4(C99$@```ZS^)AD2```#K19"-="8`BT,4@WL0`'4+C9!`@```[8G"ZP:+
+MD$"```"+<Q2X`0```-/@"="#>Q``=0F-ED"```#OZPN)AD"```"0C70F`+@!
+M````BQPDBW0D!(GL7<-5B>6+10B+4!2#>!``=0F!PCR```#MZP:+@CR```!=
+MPU6)Y8M-"(M1%(M%#(-Y$`!U#H'"/(```._K"Y"-="8`B8(\@```7<.0C;0F
+M`````%6)Y8M5$(M-#,=!"`````")T"7_#P``B4$,.=!T![@`````ZROV110@
+M=`>!20P`(```QT$4`````,=!$`````"X`0```(UT)@"-O"<`````7<.-M"8`
+M````C;PG`````%6)Y8M-#(G*]D$4`74*N`\```#INP````^W01`E_P\``&:)
+M02"+010E`(#_#\'H#V:)02+&020`BT$4J`)U0:@$=`W&020!ZS>-M"8`````
+M]D$4$'0*@$DD".LDC70F`(!))`*+010EX````,'H!8A!)8VT)@````"-O"<`
+M````BT(0)0``^`?!Z!.(02:+0A3VQ`%T#24`?@``P>@)B$$GZP3&02?_BT(0
+M)0"`!P#!Z`^(02B+0A`E````.,'H&XA!*8M"$,'H#"0!B$$JN`````!=PY"0
+MD)"0D)"0D)"058GE5U93@^QHBWT(B7W`QT6T`````,=%L`````#'1:P`````
+MQT6H`````(M5$`^W0@+VQ`%T":F`````ZQ&)]HM-$`^W00+!Z`>#\`&H`0^%
+M*P8``(M=$`^W0P*H('0$J$#K#XM5$`^W0@+!Z`:#\`&H`0^%!P8``(-]%``/
+MA(T```"+1Q2#?Q``=0F-D$R```#MZP:+@$R```")1:R+1Q2#?Q``=0F-D%"`
+M``#MZP:+@%"```")1:B#OUP!```#=AV+1Q2#?Q``=0F-D$`1``#MZP:+@$`1
+M``")1<3K,;D`````BW<0BU\4C;8`````C02-0!$``(7V=0:-%!CMZP.+!!B)
+M1(W$08/Y"7;BB?:+1Q2#?Q``=0F-D%B```#MZP:+@%B```")1:2%P'4'QT6D
+M`0```(M'%(-_$`!U"8V0!(```.WK!HN`!(```"4````"B46XBT<4@W\0`'4)
+MC9`00```[>L&BX`00```)6``_@")1;R+31`/MT$"B40D!(D\).C\____N@,`
+M``"%P`^$N@D``(M=$`^W0P(E\`$``#W`````=$(]P````'\)/:````!T*^M`
+M/4`!``!T"3U0`0``=`OK,,=%M`$```#K!\=%M`(```#'1;`!````ZQ?'1;0#
+M````ZP?'1;0$````QT6P`@```(._7`$```-V(HM'%(-_$`!U#8V0`)@``+@'
+M````ZR#'@`"8```'````ZRR+1Q2#?Q``=0Z-D`"8``"X1P```._K%<>``)@`
+M`$<```"-="8`C;PG`````(._7`$```,/AOP```"+11"`>`(`#XFO````BU7`
+M9H&Z@`(````P#X:=````]D`"('03#[>R4`,```^WBE0#``")3:#K%(M=P`^W
+MLU(#```/MX-6`P``B46@QT0D!`,```")-"3H_/___XG&QT0D!`,```"+5:")
+M%"3H_/___XE%H+D,"0``BUVPBQ29@>(_____B?#!X`8EP`````G"B129NQ@)
+M``"+1;"+#(.#X?")\L'J`H/B`8M%H`'`@^`."<()T8M5L(D,D[D`````ON`'
+M``"-M@````"-O"<`````BU\4C01)BQ2%X`<```-%L(L$AH-_$`!U!XT4&N_K
+M!)")!!I!@_D;=M>+31")3"0$B3PDZ$@2``"Y`````+[`'P``C;0F`````(V\
+M)P````"+7Q2-!(F+%(7`'P```T6TBP2&@W\0`'4'C10:[^L$D(D$&D&#^2)V
+MU[D`````ON`G``"-M@````"-O"<`````BU\4C01)BQ2%X"<```-%L(L$AH-_
+M$`!U!XT4&N_K!)")!!I!@_D_=M>Y`````(GVBQS-@"(``(-]%`!T#8V#`(#_
+M_SW_#P``=AF+=Q2+!,V$(@``@W\0`'4&C10S[^L#B00S08'YJ@```';$@[]<
+M`0```P^'IP```(M'%(-_$`!U"8V0'(```.WK!HN`'(```(M7%"7__P\`#0``
+MT`&#?Q``=0F!PAR```#OZP:)@AR```"+1Q2#?Q``=0N-4%RX`````._K!\=`
+M7`````"+1Q2#?Q``=0Z-D'B8``"X"````._K"L>`>)@```@```"+7Q"+3Q2^
+M2(```(7;=0F-D4B```#MZP:+@4B````-``0``(7;=0:-%`[OZP2)!`Z0@WT4
+M``^$E@```(M7%(M%K(-_$`!U"8'"3(```._K!HF"3(```(M7%(M%J(-_$`!U
+M"8'"4(```._K!HF"4(```(._7`$```-V'8M7%(M%Q(-_$`!U"8'"0!$``._K
+M0HF"0!$``.LZN0````"0C70F`(M?%(T4C4`1``"+1(W$@W\0`'4,C10:[^L)
+MC;8`````B00:08/Y"7;7C;0F`````(M7%(M=P`^VB^0+```/MH/E"P``P>`(
+M"<$/MH/F"P``P>`0"<$/MH/G"P``P>`8"<&#?Q``=0N!P@"```")R._K!HF*
+M`(```(-]#`%T6H-]#`%R-(-]#`9T"X-]#`AT8^F;````BT\4BU7`#[:"Z0L`
+M`,'@"`^VDN@+```)T`M%N`T``($`ZUR+3Q2+7<`/MH/I"P``P>`(#[:3Z`L`
+M``G0#0``@@#K/(M/%(M5P`^V@ND+``#!X`@/MI+H"P``"=#K'(M/%(M=P`^V
+M@^D+``#!X`@/MI/H"P``"=`+1;@-```@`(-_$`!U"8V1!(```._K%XF!!(``
+M`.L/D(UT)@"Z#````.G&!```BU\0BT\4OA!```"%VW4)C9$00```[>L&BX$0
+M0```"T6\A=MU!HT4#N_K`XD$#HM7%(M%I(-_$`!U"8'"6(```._K!HF"6(``
+M`(M7%(M%P`^VB.H+```/MH#K"P``P>`("<&+7<`/MH/L"P``P>`0"<$/MH/M
+M"P``P>`8"<&#?Q``=0N!P@B```")R._K!HF*"(```(M/%(M5P`^V@N\+``#!
+MX`@/MI+N"P``"="#?Q``=0F-D0R```#OZP:)@0R```"+1Q2#?Q``=0Z-D(``
+M``"X_____^_K"L>`@````/____^#OUP!```$=31F@[]@`0```7<JBU\0BT\4
+MOA0```"%VW4&C5$4[>L#BT$4#0`$``"%VW4&C10.[^L#B00.BT<4@W\0`'4.
+MC9`8@```N``'``#OZPK'@!B`````!P``BTT0B4PD!(D\).C\____N@,```"%
+MP`^$:0,``(M=$(E<)`2)/"3H&A$``(E<)`2)/"3H_@@``+H#````A<`/A$$#
+M``!F@7\(&_%U*HM%$(!X`@!Y(8M'%(-_$`!U#HV0"-@``+@"!0``[^L*QX`(
+MV````@4``(M'%(-_$`!U#HV0')@``+@!````[^L*QX`<F````0```(M'%(-_
+M$`!U"8V0%)D``.WK!HN`%)D``"7_/P``BU40]D("('05C12%`````+BCBRZZ
+M]^*)T,'H!.L,NLW,S,SWXHG0P>@#@\!DB00DZ/S___^+7Q"+3Q2^8)@``(7;
+M=0F-D6"8``#MZP:+@6"8``"#R`&%VW4&C10.[^L#B00.QT0D#`````#'1"0(
+M`0```,=$)`1@F```B3PDZ/S___^+31")3"0$B3PDZ/S___^%P'4>BUT0]D,"
+M('4+#[=#`H/(`F:)0P*Z`P```.D=`@``BT7`@[BD#````'0NBT<4@W\0`'4.
+MC9`@F0``N`#P`0#OZPK'@""9````\`$`BU7`QX*H#````0```+L`````O@$`
+M``")]HV\)P````"+3Q2)39R-%)T`$```B?"(V=/@@W\0`'4'`U6<[^L'D(M-
+MG(D$"D.#^PE^U+L`````ZPV0D)"0D)"0D)"0D)"0B5PD!(D\).C\____0X/[
+M"7[NBT<4@W\0`'4.C9"D````N`$``0#OZPK'@*0````!``$`BT<4@W\0`'4.
+MC9"H````N`$```#OZPK'@*@````!````BT<4@W\0`'4.C9"L````N`$```#O
+MZPK'@*P````!````BU\0BT\4OK`0``"%VW4)C9&P$```[>L&BX&P$```A=MU
+M!HT4#N_K`XD$#HM'%(-_$`!U#HV0H````+AE"0@`[^L*QX"@````90D(`(M=
+MP,>#\`L``&4)"`"+7Q"+3Q2^K````(7;=0F-D:P```#MZP:+@:P````-```'
+M`(7;=0:-%`[OZP.)!`Z#?0P&=3V+7Q"+3Q2^H````(7;=0F-D:````#MZP:+
+M@:`````-`!```(7;=0:-%`[OZP.)!`Z+1<"!B/`+````$```B3PDZ/S___^%
+MP'0(B3PDZ/S___^+7Q"+3Q2^((```(7;=0F-D2"```#MZP:+@2"````E__]_
+M_H7;=0:-%`[OZP.)!`ZX`0```.L3C70F`(M-&(,Y`'0"B1&X`````(/$:%M>
+M7UW#B?:-O"<`````58GE@^P(QT0D!`(```"+10B)!"3HQP0``(GL7<.-=@!5
+MB>6#[!2)7?R+70C'1"0,`````,=$)`@!````QT0D!`(```")'"3H_/___[H`
+M````A<!T*\=$)`03````B1PDZ'L$``"Z`````(7`=!+'!"0T"```Z/S___^Z
+M`0```)")T(M=_(GL7<.-M"8`````58GE@^P8B5WXB77\BW4(#[==#,=$)`P`
+M````QT0D"`$```#'1"0$`@```(DT).C\____N@````"%P`^$8`(``(G8)?`!
+M```]P`````^$Q````#W`````?Q<]H````'1"/;````!T.^G4`0``C70F`#U`
+M`0``#X0<`0``/4`!``!_$#W0````#X2)````Z:X!```]4`$```^$^@```.F>
+M`0``BT84@WX0`'4.C9`$F```N`````#OZPK'@`28````````BT84@WX0`'4.
+MC9``H@``N`,```#OZPK'@`"B```#````BT84@WX0`'4.C9!\F```N!D```#O
+MZPK'@'R8```9````QP0D+`$``.C\____Z2H!``"+1A2#?A``=0Z-D`28``"X
+M`````._K"L>`!)@```````!F@WX($@^%_@```(M&%(-^$`!U#HV0?)@``+@8
+M````[^L*QX!\F```&````,<$)"P!``#H_/___XM&%(-^$`!U$(V0`*(``+@"
+M````Z9\```#'@`"B```"````Z:D```#VPQ!T(HM&%(-^$`!U#8V0!)@``+@#
+M````ZR#'@`28```#````ZR&+1A2#?A``=0Z-D`28``"X`````._K"L>`!)@`
+M``````!F@WX($G5:BT84@WX0`'4.C9!\F```N!@```#OZPK'@'R8```8````
+MQP0D+`$``.C\____BT84@WX0`'4.C9``H@``N`````#OZQ;'@`"B````````
+MC;8`````C;\`````QT0D!!,```")-"3H``(``+H`````A<!T1\<$)#0(``#H
+M_/___\=$)`P`````QT0D"`$```#'1"0$`@```(DT).C\____N@````"%P'02
+MQT0D!`````")-"3HL@$``(G"B="+7?B+=?R)[%W#C70F`%6)Y8/L'(E=](EU
+M^(E]_(M="(MU#(G9@[NH#`````^$_````(M#%(-[$`!U"8V0()D``.WK!HN`
+M()D``*D```$`#X79````QX&H#````````(M#%(-[$`!U"8V0$)P``.WK!HN`
+M$)P``(E%\(M#%(-[$`!U"XV0%)P``.WK"(GVBX`4G```B<&+0Q2#>Q``=0^-
+MD!B<``#MB<?K"HUT)@"+N!B<``"+1?#1Z(G*T>H!T,'I!HG"P>H'=&6%R71A
+M]]^)^(G7F??_@^`_B47LBT7PF??YB<&#X1^+0Q2#>Q``=0N-D""9``#MB<+K
+M!HN0()D``(M%[,'@!0G0"<B+4Q0-``@``(-[$`!U"8'"()D``._K#(F"()D`
+M`(VV`````(ET)`2)'"3H=`0``(7`=#")="0$B1PDZ/S___^%P'4XQP0DB!,`
+M`.C\____B70D!(D<).C\____A<!U'(UT)@#V1@(@=0L/MT8"@\@"9HE&`K@`
+M````ZQB)'"3H0!P``+@!````C70F`(V\)P````"+7?2+=?B+??R)[%W#C78`
+M58GE5U93@^P0BW4(BUT,A=L/E<`/ML!(B=\)QXM&%(-^$`!U"XU0#.WK")"-
+M="8`BT`,BU84B=B#?A``=0F!P@!```#OZP:)F@!```#'!"0/````Z/S___^#
+MXP.)7"0,B?B#X`.)1"0(QT0D!`!```")-"3H_/___XG!]L,!=2"+1A2#?A``
+M=0N-4!2X`````._K#,=`%`````"0C70F`(G(@\006UY?7<.-M@````!5B>6#
+M[!B)7?2)=?B)??R+=0B+10R)1"0$B30DZ/S___^Z`````(7`#X1"`0``BU4,
+M#[="`HE$)`0/MP*)!"3H_/___YB+50R`>@(`>4*-'$#!XP*-@\0K``")1?#'
+M1"0$"````(M`!(D$).C\____B<>!Y_\```#!YP6+@\0K``#!X`0)QXM5\`^_
+M0@CK!I"_`````&8]D`!_!*@!="+'1"0$"````(/H&(D$).C\____B<.!X_\`
+M``"X`0```.LOQT0D!`@```"#Z!B)PL'J'P'0T?B)!"3H_/___XG#@>/_````
+MN`````"-M@````#!XP(!P`G#@<L!!```BT4(BU`4B?F!X?\```#!X0@/ML,)
+MP8M%"(-X$`!U"X'"G)@``(G([^L&B8J<F```BT4(BU`4B?F!X0#_```/ML<)
+MP8M%"(-X$`!U"X'"T)@``(G([^L&B8K0F```BU4,BP*)AK@,``"Z`0```(VV
+M`````(G0BUWTBW7XBWW\B>Q=PY!5B>575E.#[!B+?0@/MD4,B$7D#[]%$(E%
+MX(MW$(M?%(7V=0F-DV28``#MZP:+@V28``")P8'A`/#__P^V1>3!X`DE``X`
+M``G!BT7@)?\!```)P87V=0N-DV28``")R._K!HF+9)@``(M?$(M/%+Y@F```
+MA=MU"8V18)@``.WK!HN!8)@``(/(`H7;=0:-%`[OZP.)!`Z^.````(!]Y`!T
+M$@^V=>2-!/4`````*?")QL'F";L`````D(VT)@````"+1Q2#?Q``=0F-D&"8
+M``#MZP:+@&"8``"H`G06B30DZ/S___^-0P$/O]AF@_L[?M#K#F:#^SM^#Y"-
+MM"8`````N`````#K.8M'%(-_$`!U"8V09)@``.WK!HN`9)@``,'H$R7_`0``
+M]L0!=!0-`/[__^L-D)"0D)"0D)"0D)"0D(/$&%M>7UW#D(VT)@````!5B>6+
+M31"+50B+10P/MT`")>`!```]P````'0T/<````!_#3V@````=!;K-(UT)@`]
+M0`$``'4I#[>"T@(``.LG#[>"U`(``.L>C;0F``````^W@M8"``#K#HVT)@``
+M``"X`````.L(9HD!N`$```!=P^L-D)"0D)"0D)"0D)"0D%6)Y8/L%(E=_(M=
+M"(U%^HE$)`B+10R)1"0$B1PDZ%[___^Z`````(7`=$^+0Q2#>Q``=0R-D&"8
+M``#MZPF-=@"+@&"8``"+0Q2#>Q``=0F-D&28``#MZP:+@&28``#!Z!,E_P$`
+M`/;$`70%#0#^__]F.47Z#YW`#[;0B="+7?R)[%W#C;8`````C;PG`````%6)
+MY8/L&(E=^(EU_(MU"(M=#(.^7`$```-W98E<)`2)-"3H_/___X7`=%6-1?:)
+M1"0(B5PD!(DT).BR_O__N@````"%P'1QNP````"-="8`QT0D"``````/MH,(
+M+0``B40D!(DT).@U_?__0X/[`G;?@_L##Y;`#[;0ZSR-="8`BUX0BTX4OF"8
+M``"%VW4)C9%@F```[>L&BX%@F```@\@"A=MU"XT4#N_K")"-="8`B00.N@$`
+M``")T(M=^(MU_(GL7<.-M@````"-OP````!5B>575E.#[""+50R+10B)1?"`
+M>@(`#YC`#[;X1P^W0@(EX`$``#W`````#X26`0``/<````!_$#V@````#X1#
+M`0``Z<D!```]0`$```^%O@$```^W`BVA#P``9CWJ!'<9BUWP#[>;.`,``(E=
+MX(MU\`^WMCH#``#K<@^W`BV,%```9CWO`'<<BT7P#[>`/`,``(E%X(M=\`^W
+MFSX#``")7=SK6P^W`BU\%0``9CW@`'<<BW7P#[>V0`,``(EUX(M%\`^W@$(#
+M``")1=SK,6:!.EP6=AR+7?`/MYM$`P``B5W@BW7P#[>V1@,``(EUW.L.QT7<
+M`````,=%X`````"+1?`/MX#>`@``B47LBUWP#[>;Y`(``(E=Z(MU\&:#ON0"
+M````#Y3`#[;`B47DN7P)``"+%+F!XO___^\/MX:P`P``P>`<"<*)%+FYB`D`
+M`(L4N8'B____^P^WAK(#``#!X!H)PHD4N;D\"@``BQ2Y@^+W#[>&K@,``,'@
+M`PG"B12YZ9H```"+1?`/MX!(`P``B47@BUWP#[>;2@,``(E=W(MU\`^WMN`"
+M``")=>R+1?`/MX#F`@``B47HBUWP9H.[Y@(```#K/XMU\`^WMDP#``")=>"+
+M1?`/MX!.`P``B47<BUWP#[>;X@(``(E=[(MU\`^WMN@"``")=>B+1?!F@[CH
+M`@````^4P`^VP(E%Y.L/N`````#I-0$``)"-="8`OL0)``"+'+Z!XS_____'
+M1"0$!````(M%[(D$).C\____P>`'BU7DP>(&"=`EP`````G#B1R^OM`)``"+
+M'+Z#X_C'1"0$!````(M%[(D$).C\____T>B#X`<)PXD<OH'C?____\=$)`0#
+M````BT7@B00DZ/S____!X`<E@`````G#B1R^OMP)``"+'+Z#X_S'1"0$`P``
+M`(M%X(D$).C\____T>B#X`,)PXD<OH/CX\=$)`0#````BT7<B00DZ/S____!
+MX`*#X!P)PXD<OKD,"@``BQ2Y@^+WBT7HP>`#@^`("<*)%+FY`````)"-="8`
+MBW4(BUX4C01)BQ2%0`D```'XBP2%0`D``(-^$`!U!HT4&N_K`XD$&D&#^1AV
+MTHM%\,>`O`P```````"X`0```(/$(%M>7UW#D(VT)@````!5B>575E.#[#"+
+M?0B)_HM5#`^W0@(EX`$``#W`````='`]P````'\)/:````!T6>MO/4`!``!U
+M:,=%\`````"+3Q")3>B+7Q2%R74)C9-$F0``[>L&BX-$F0``B<&#X<</MX:T
+M`P``P>`#@^`X"<&#?>@`=0N-DT29``")R._K,(F+1)D``.LHQT7P`0```.L?
+MQT7P`@```.L6C;8`````N`````#I;@,``(VV`````(._7`$```-W.8M?$(M/
+M%(7;=0V-D1"9``#MZPJ-="8`BX$0F0``@\@#C9$0F0``A=L/A)P```")@1"9
+M``#IG@```(M7$(E5Y(M?%(72=0F-DQ"9``#MZP:+@Q"9``")P8'A!OS__XM5
+M\`^WA%;J`@``P>`$"<&#R0&#?>0`=1&-DQ"9``")R._K#(VV`````(F+$)D`
+M`(M5#(E4)`B+AJ`,``")1"0$B3PDZ/S___^+5Q2+3?`/OX1.T@(``"7_`0``
+M#0`"``"#?Q``=0F!PFB9``#OZPJ)@FB9``"-="8`BT<0B47@BU\4@WW@`'4)
+MC9-$F```[>L&BX-$F```B<&!X7_`__^+5?`/MX16J`(``,'@!R6`/P``"<&#
+M?>``=0^-DT28``")R._K"HUT)@")BT28``"+5Q")5=R+7Q2%TG4-C9-(F```
+M[>L*C70F`(N#2)@``(G!@>'_#_S_BU7P#[>$5JX"``#!X`PE`/`#``G!@WW<
+M`'4+C9-(F```B<COZP:)BTB8``"+5Q")5=B+7Q2%TG4)C9-0F```[>L&BX-0
+MF```B<&!X0``__^+5?`/OH06SP(``,'@""4`_P``"<$/MH06S`(```G!@WW8
+M`'4-C9-0F```B<COZPB)]HF+4)@``(M?%(M5\`^WC%;``@``P>$8#[>$5L`"
+M``#!X!`)P0^WE%;&`@``B=#!X`@)P0G1@W\0`'4+C9,TF```B<COZP:)BS28
+M``"+5Q")5=2+7Q2%TG4)C9,HF```[>L&BX,HF```B<&!X?\`__^+5?`/MX16
+MM`(``,'@"`G!@WW4`'4+C9,HF```B<COZP:)BRB8``"+5Q")5="+7Q2%TG4,
+MC9-DF```[>L)C78`BX-DF```B<&!X?\/^/^+5?`/MX16N@(``,'@#"4`\`<`
+M"<&#?=``=0N-DV28``")R._K!HF+9)@``,=%[`(```!F@;Z``@```C!W&F:!
+M?PHB$'4\BU4,]D("0'0SQT7L"````.LJBTT,#[<!@^`?=!^#Z`J#^`QV%XM5
+M\`^WA%8L`P```47LB?:-O"<`````BW<0BU\4OR29``"%]G4)C9,DF0``[>L&
+MBX,DF0``B<&!X0'___^+1>P!P"7W````"<&%]G4*C10?B<COZP6)]HD,'[@!
+M````@\0P6UY?7<-5B>575E.#[#"+70B+50P/MT(")>`!```]P````'11/<``
+M``!_##V@````='+IG@```#U``0``#X63````#[>#R@,``&:)1>B-@[8#``")
+M1>2-@\P#``")1>P/MX,:!P``B47<C9,<!P``ZWR-="8`#[>#U`4``&:)1>B-
+M@]8%``")1>2-@^(%``")1>P/MX-L!P``B47<C9-N!P``ZTD/MX/4!0``9HE%
+MZ(V#W`4``(E%Y(V#?@8``(E%[`^W@XP'``")1=R-DXX'``#K&HGVN`````#I
+MO@```(G0P>`&C;P8I`<``.MTB57@BU4,#[<"B40D"(U%Y(E$)`2+10B)!"3H
+MF0```(M5#(E4)`2+10B)!"3H_/___XG&N@````"_`````&:#NU@#````="T/
+MMXM8`P``C78`C;PG`````&:#O%-:`P```'0,#[>$4UH#```Y\'2#0CG*?.2+
+M@\`,```/MX0`#"T``(E$)!2+50R)5"00#[=%W(E$)`R+1>")1"0(B7PD!(M5
+M"(D4).B]`P``N`$```"#Q#!;7E]=PU6)Y5=64X/L-`^W11")1?#'1>@`````
+MQT7D/P```,=$)`0(`0``QP0D`````.C\____QT0D!(````#'!"0@`0``Z/S_
+M__^_B````+L!````O@````"-="8`C;PG`````&:)G#8(````C4,!#[?8C48!
+M#[?P9H/[/W;F9HDU!@```&;'!0(````!`&;'!00````_`+X`````9H,]!@``
+M``!V/XVT)@````"-O"<`````BU4,B50D"`^WA#8(````B40D!(M-\(D,).A"
+M!P``9HD$=XU&`0^W\&8Y-08```!WSP^_#P^W!08````/OT1'_HE%[+X`````
+M9H,]!@`````/AH@```"-=@"-O"<`````9CD,=W\'#[\,=XEUZ`^W!08````I
+M\$@/M]AFA=MT(P^W1%_^9CL$7WX)#[<$7V:)1%_^C48!#[?P9CDU!@```'>^
+MO@````!F@ST&`````'8M#[<5!@```)"-M"8`````BUWL9CD<=WX*#[\$=XE%
+M[(EUY(U&`0^W\&8Y\G?BC5D9N1^%ZU&)V/?IP?H$B=C!^!\IPHT4DHT4D@'2
+M#[_RQT7@`````+L`````B?#WZ<'Z!(GPP?@?B<$IPHG00#G#?3^Z'X7K48GP
+M]^K!^@0IRHU*`8VV`````(V\)P````"+1>")PD(/M]*)5>"+5>AFB90`(`$`
+M`(U#`0^WV#G+?-^[``````^W!08```")PF8Y=$?^#X[A````C;8`````C48R
+M#[_PB57<9CET5_Y^2@^_!%^)\2G!#[]47P*)\"G0B<*)R`^OPH7`?BZ-="8`
+MC4,!#[?8BU7<9CET5_Y^&@^_!%^)\2G!B<@/OU1?`HGQ*=$/K\&%P'_6QT0D
+M%``````/MX0;"@````'`#[?`B40D$`^WA!L(`````<`/M\")1"0,#[=$7P*)
+M1"0(#[<$7XE$)`0/M\:)!"3HL`<``$`/M\"Z(`$``-'HBTW@9HD$2HM%Y&8Y
+M!$IV!&:)!$J+1>!`#[?`B47@#[<5!@```&8Y=%?^#X\E____9H-]X#]W*+D@
+M`0``NAX!``"-="8`BUW@#[<$6F:)!%F)V$`/M\")1>!F@_@_=N:_@*$``+L`
+M````C;8`````C;\`````#[<4G2(!``#!XAB!R@``_P`/MP2=(`$``,'@"`W_
+M````)?__``"+30B+<10)T(M5"(-Z$`!U"8T4-^_K!HUV`(D$-X/'!(U#`0^W
+MV&:#^Q]VKH/$-%M>7UW#C;8`````58GE5U93@^Q8BW48#[=]%`^W11R)1=R+
+M50B)5=C'1=0`````QT70`````,=%S`````#'1<@`````QT7$/P```,=%N```
+M``")="0$B10DZ/S___\!P`^WP(E%O/9&`P%T%(M5"`^V@IP"``#K$HE=S.EA
+M`0``BTW8#[:!G0(```^^P(E$)`B)="0$BT4(B00DZ/S___^(1;>#?0P`#X2E
+M````NP````")]HV\)P````"+50QF@SS:`'05#[<$VF:)1%W@C4,!#[?89H/[
+M!W;AB5W`C47PB40D$(U%\HE$)`R)7"0(C47@B40D!`^W!HD$).BJ!@``NP``
+M``!F.UW`<R(/MU7RC70F`(V\)P````!F.U1=X'0,C4,!#[?89CM=P'+M#[=%
+M\F8[1?!U!68[!G0*BTT,@WS9!`!T"XM%#`^W7-@"B5W$NP````!F.?MS*NL-
+MD)"0D)"0D)"0D)"0D(T$FXM5$`^W1$((9HE$7>"-0P$/M]AF.?MRY8U%\(E$
+M)!"-1?*)1"0,B7PD"(U%X(E$)`0/MP:)!"3H`08``+L`````9CG[<RT/MTWR
+MBU7P9CM,7>!U"8E=U(VV`````&8[5%W@#X2B_O__C4,!#[?89CG[<MJ[````
+M`)"-="8`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#``"-1>2)
+M1"0,B7PD"`^W1>R)1"0$#[=%\(D$).@1`0``C47BB40D#(E\)`@/MT7JB40D
+M!`^W1?")!"3H\@```,=$)!0`````#[=%XHE$)!`/MT7DB40D#`^W1>J)1"0(
+M#[=%[(E$)`2)-"3H8@$```^WP(E%W(U%Y(E$)`R)?"0(#[=%Z(E$)`0/MT7N
+MB00DZ)T```"-1>*)1"0,B7PD"`^W1>:)1"0$#[=%[HD$).A^````QT0D%```
+M```/MT7BB40D$`^W1>2)1"0,#[=%YHE$)`@/MT7HB40D!(DT).CN````#[?`
+MQT0D%`````")1"00BT7<B40D#`^W1>Z)1"0(#[=%\(E$)`2)'"3HP`````^W
+MP(VV`````(V\)P````"#Q#!;7E]=PY"-M"8`````58GE5U93@^P$BW40#[=%
+M"(E%\`^W?0R+3@B[`````&:#?@0`=FF-=@"-O"<`````BT7P9CD!=4B-40BX
+M`````&:#>08`=CF)]HV\)P````!F.3IU$@^W5$$>BT449HD0N`$```#K+8/"
+M`D`/M\!F.4$&=]R-M@````"-OP````"#P32-0P$/M]AF.5X$=Z&X`````(/$
+M!%M>7UW#C70F`%6)Y8/L%(E=](EU^(E]_`^W10B)1?`/MU4,#[=]$`^W=10/
+MMUT8QT7L9````(GP#Z_#N0````"%P'1[@WT<`'0'QT7L`0```&8YUW13BT7P
+M*="-!("-!(#!X`(IUYGW_P^_R&:%R7D(#[?&ZS6-=@!F@_ED?@X/M\.#?1P`
+M=#6-!)OK)XG(#Z_#NF0````IR@^OU@'0F?=][.L6D(UT)@")\(-]'`!T#(T$
+MMHT$@,'@`@^WP(G!B<B+7?2+=?B+??R)[%W#C70F`(V\)P````!5B>575E.+
+M70R+?10/MW40#[=,<_X/MU4(C022C02`C12%``````^W`XT$@(T$@(T$A?;_
+M__\YPG,+#[<#9HD'#[<#ZSN-!(F-!("-!(4*````.<)V,F:)#XM%&&:)".M_
+M#[<$2V:)!P^W!$OK$@^W!$MFB0</MT1+`HVV`````(M5&&:)`NM8N0`````Y
+M\7U/ZPV0D)"0D)"0D)"0D)"0#[<$2XT$@(T$@,'@`BG0>0_WV(VV`````(V\
+M)P````"#^`E^G`^W1$L"C02`C02`C02%]O___SG"<I-!.?%\P%M>7UW#C70F
+M`(V\)P````!5B>575E.#[!2+11`/MWT(#[=U#(M0"+D`````#[=`!(G#.<%]
+M%XUV`(V\)P````!F.3)T"(/"-$$YV7SSBT48B40D$(M%%(E$)`P/MT(&B40D
+M"(U""(E$)`2)/"3HKO[__X/$%%M>7UW#C;8`````58GEBT4(C8C("P``BQ5$
+M+0``B9#("P``C035`````"G0C02%2"T``(E!&,=!%`$```#'00P4````QT$0
+M(P```%W#C;0F`````(V\)P````!5B>6#[`R)'"2)="0$B7PD"(M5#(M%"`6X
+M#```]D`"('0DOP````"['````+E`````OG(```#'0@P`````QT(0=P```.LB
+MOP````"[,@```+D`````OC(```#'0@P4````QT(0(P```(M2!+@`````.?IR
+M!#G:=@TYRG($.?)V!;@!````BQPDBW0D!(M\)`B)[%W#C;8`````C;\`````
+M58GEBTT(BU$4BX'$#```P>`))0!^```-`(```(-Y$`!U#H'",)D``._K"Y"-
+M="8`B8(PF0``QX&\#````0```%W#C;0F`````(V\)P````!5B>6#[!2)7?2)
+M=?B)??R+?0B)^XVWR`L``(-^%`!U$+@`````Z9P```"-M@````"#O[P,```!
+M#X6#````BT<4@W\0`'4+C9`PF0``[8G"ZP:+D#"9``")T"4`@/__9H7`=5V)
+MT,'H&8E&!,>#O`P```````")="0$B3PDZ(_^__^%P'4[B70D!(D\).A/````
+MA<!T*XET)`2)/"3H7P```(7`?AN)="0$B3PDZ(\!``#'@[P,```"````D(UT
+M)@"+@[P,``"+7?2+=?B+??R)[%W#C;8`````C;PG`````%6)Y8M-#+@`````
+MBU$$.U$,=@4[41!R!;@!````7<.058GE5E.+70R#>Q0`="*+`XT4Q0`````I
+MPHT4E4@M``")4QB+0P0[0Q!R=8,[`'40N/_____I]@```(VV`````(M#!(E#
+M"#M#$')%@SL`=$"+`TB)`XT4Q0`````IPL'B`HM+&(N"4"T``"M!"`'`BTL(
+M*<&)2PB!PD@M``")4Q@[2Q!R"X,[`'7&C;8`````N`$```#IE@```(VV````
+M`(M#!#M##'=_H4`M``!(.0-U#KC^____ZW>-M"8`````BT,$B4,(.T,,=U6A
+M0"T``$@Y`W-+B<:)]HV\)P````"+`T")`XT4Q0`````IPL'B`HM+&(N"4"T`
+M`"M!"`'`BTL(*<&)2PB!PD@M``")4Q@[2PQW"SDS<L>-M"8`````N`(```#K
+M";@`````C70F`%M>7<.-M@````"-OP````!5B>6+30B+50R#>A0`=#>+0A@/
+MMP!FB8&T`P``BT(8#[=``F:)@;(#``"+0A@/MT`$9HF!L`,``(M"&`^W0`9F
+MB8&N`P``7<.0C;0F`````%6)Y5W#C70F`(V\)P````!5B>53BTT(BUT,BT$4
+M@WD0`'4-C9`$@```[>L*C70F`(N`!(```"7__P``@_L!=#"#^P%R&X/[!G0'
+M@_L(="'K/XM1%`T``($`ZQV0C70F`(M1%`T``$(`ZPZ-M@````"+410-```@
+M`(-Y$`!U"8'"!(```._K$(F"!(```.L(D+@`````ZP6X`0```%M=PY!5B>53
+MBUT,BU4(@_L"="&#^P)W#(/[`70LZU:0C70F`(/[`W02@_L$=!3K18UT)@"Y
+M"0```.M!N0@```#K.KD!````ZS.Y`````(VV`````(G(P>`$@[P"^`L```!T
+M!D&#^0E^Z[C_____@_D*=$_K![C_____ZT:)R,'@!(F<`O@+``"#?1``=`VX
+M`0```-/@"8+T"P``B<C!X`0!T,>`_`L```````#'@``,````````QX`$#```
+M`````(G(6UW#ZPV0D)"0D)"0D)"0D)"058GEBTT,BU4(N`````"#^0EW38G(
+MP>`$@[P"^`L```!U#K@`````ZS>-M"8`````B<C!X`3'A`+X"P```````+C^
+M____T\`A@O0+``"X`0```(VT)@````"-O"<`````7<.-M"8`````C;PG````
+M`%6)Y5=64X/L#(M]"(V7N`P``+@`````@WT,"0^'%`0``(M%#,'@!(VT./@+
+M``"#/@`/A/D#``"#O[0,````=32%TG0<#[="`B6@````/:````!U#,>'K`P`
+M`!\```#K"L>'K`P```\```#'A[`,```"````BX>P#````T8$B47PNP$````[
+MGZP,``!S'XN7K`P``(VV`````(V\)P````"-!!N)PX/+`3G3<O2#?@@`>0Z+
+M3@CWV=/KZQ&0C70F``^V3@B-0P&)P]/C2[C\#P``@WX,`'D)BTX,]]G3Z.L*
+M#[9.#(U``=/@2(M5"(M2%(E5[(M-#(T4C4`0``")V8'A_P,``,'@"B4`_`\`
+M"<&+1?#!X!0E``#P#PG!BUT(@WL0`'4(`U7LB<COZP:+7>R)#!J#O\@,````
+M=!2+A\P,``"#^`]V!;@/````B<+K"K@*````N@H```#!X`0E\````(/B#PG0
+MBU4(BTH4BUT,C12=@!````T`(`@`BUT(@WL0`'4&C10*[^L#B00*BT4(BU`4
+MBTT,C02-P`D``(M="(-[$`!U"@'"N``(``#OZP?'!!``"```BT4(@[A<`0``
+M`W<LBU`4BTT,C02-`!$``(M="(-[$`!U"@'"N`````'OZPS'!!`````!D(UT
+M)@"+!H/X`P^$D0```(/X`W<*@_@"=!/I=@$``(/X!`^$*0$``.EH`0``BW4(
+MBUX0BTX4BT4,C32%P`D``(E-Z(7;=0:-%`[MZP:+5>B+!!8-H@```(7;=0:-
+M%`[OZP.)!`ZX```E`(M-"(.Y7`$```-W!;@``"4!BW4(BUX4BTT,C12-`!$`
+M`(-^$`!U"(T4&NGH````B00:Z?0```"+=0B+7A"+3A2+10R--(7`"0``B4WH
+MA=MU!HT4#NWK!HM5Z(L$%@UB`@``A=MU!HT4#N_K`XD$#J$`````*P4`````
+MBY?4#```*<*)T"L%`````,'@"HM="(M+%(MU#(T4M0`)```-`````8-[$`!U
+M!HT4"N_K`XD$"K@```0`BU4(@[I<`0```W<%N```!`&+70B+2Q2+=0R-%+7`
+M"0``@WL0`'4%C10*ZS6)!`KK1(M%"(M8$(M(%(M5#(TTE<`)``")3>B%VW4&
+MC10.[>L&BU7HBP06@\@CA=MU!HT4#N_K$8D$#HVT)@````"-O"<`````BTT(
+MBU$4BX?T"P``B<&!X?\#``#!X!`E``#_`PG!BUT(@WL0`'4+@<*D````B<CO
+MZP:)BJ0```"+30B+412+A_0+```E_P,``(-Y$`!U"8'"J````._K!HF"J```
+M`(M="(MS$(M;%(7V=0F-DZP```#MZP:+@ZP```")P8'A`/S__XN']`L``"7_
+M`P``"<&%]G4+C9.L````B<COZQ*)BZP```"-M@````"-OP````"X`0```(/$
+M#%M>7UW#C78`58GE4XM="(M-#+C_____@_D)=Q^+4Q2-!(T`"```@WL0`'4,
+M`<+MZPJ-M"8`````BP006UW#C78`C;PG`````%6)Y8/L"(D<)(ET)`2+=0B+
+M30RX`````(/Y"7<ABUX4C12-``@``(M%$(-^$`!U!HT4&N_K`XD$&K@!````
+MBQPDBW0D!(GL7<.-M"8`````58GE5U93@^P(BW4(B30DZ/S___^)QR7___]_
+MB40D!(DT).C\____BT84@WX0`'4&C5`P[>L#BT`PB<.)P8'A\`,``,'I!(-]
+M#`!T%+@E````*<C1Z`'!ZR>-M"8`````@_D!=@-)ZQB)?"0$B30DZ/S___^X
+M`````.L\D(UT)@"+5A2!XP_\__^)R,'@!"7P`P``"<.#?A``=0B#PC")V._K
+M`XE:,(E\)`2)-"3H_/___[@!````@\0(6UY?7<.058GE4XM="(M-#+@`````
+M@_D)=R>+4Q2X`0```-/@@WL0`'4,@<)`"```[^L)C78`B8)`"```N`$```!;
+M7<.)]E6)Y8/L"(D<)(ET)`2+70B+30RX_____X/Y"7=EB<C!X`2#O`/X"P``
+M`'4'N/_____K3XM3%(T$C0`*``"#>Q``=04!PNWK`XL$$(G&@^8#=2Z+0Q2#
+M>Q``=0N-D$`(``#MB<+K!HN00`@``+@!````T^"%T'0)O@$```"-="8`B?"+
+M'"2+="0$B>Q=PXUV`%6)Y8/L%(E=](EU^(E]_(M]"(M=#+@`````@_L)#X>M
+M````B=C!X`2#O`?X"P```'4.N`````#IE````(UT)@"+5Q2X`0```(C9T^"#
+M?Q``=0F!PH`(``#OZP:)@H`(``"^`````(UV`(V\)P````")7"0$B3PDZ/S_
+M__^%P'05QP0D"@```.C\____1H'^#R<``'[;BT<4@W\0`'4.C9"`"```N```
+M``#OZPK'@(`(````````@?X/)P``#Y[`#[;`C;0F`````(V\)P````"+7?2+
+M=?B+??R)[%W#C78`58GEN`$```!=PXVV`````%6)Y8/L#(D<)(ET)`2)?"0(
+MBW48BWTHBUTPBTT,@WTD`'4-N`````#K=HVV`````+@`````@_X$=V:+11`E
+M_P\``(M5(,'B$@G0BU4LP>(9"=#VPP%T!0T````!]L,$=`4-``!``(E!"(GR
+MP>(:]L,"=`:!R@``@`")40R#__]T%HGXP>`-)0#@#P`)T(E!#(%)"````$"X
+M`0```(UT)@"+'"2+="0$BWPD"(GL7<.058GEN`$```!=PXVV`````%6)Y8/L
+M"(D<)(ET)`2+=0R+11")\8G"@>+_#P``NP`````YPG5:@WT4`'04BT8,)0#P
+M__\)T(E&#.L/D(UT)@#'1@@`````B58,@WT8`'00@6$,_^___^L.C;0F````
+M`(%)#``0``#'010`````QT$0`````+L!````C;8`````B=B+'"2+="0$B>Q=
+MPXUV`%6)Y5.+30R)RO9!%`%U$;@/````Z9X```"-M"8`````BT$4)?X?``#1
+MZ&:)02`/MT$29HE!(L9!)`"+01"H`74?J`)T!,9!)`'V0A`(=`2`220"]D(0
+M!'0'@$DD!(UV`(M"""4``#P`P>@2B$$EBT(4)0#@'P#!Z`V(02:+0A`E\```
+M`(G#P>L$B%DGBT(0)0`/``#!Z`B(02C&02H`A-MT!XC8_L"(02>`>2@`=`/^
+M02BX`````%M=PY"0D)"0D%6)Y8/L"(E=_(M=",<$)"PG``#H_/___XF#B!``
+M`,<$)"PG``#H_/___XF#J!```+@`````@[N($````'02@[NH$````'0)N`$`
+M``"-="8`BUW\B>Q=PXGVC;PG`````%6)Y593@^P$BW4(NP````"#O)Y$$```
+M`'0FBX2>1!```(D$).C\____QX2>1!````````"-M@````"-OP````!#@_L?
+M=LJ#Q`1;7EW#C78`58GE5U93@^P4BW4(C;[T"P``BYY`#0``A=MT*P^W`V8[
+MAO0+``!U'^L6B9Y`#0``ZPZ+!XF"1`T``(VV`````(G8Z84```"Y`````(UT
+M)@"-!$F-!(:-F$0-```/MX!$#0``9CL'=,)!@_D_=N*Y`````(VV`````(V\
+M)P````"-!$F-%(:-FD0-``!F@[I$#0```'2<08/Y/W;D#[='`HE$)!`/MP>)
+M1"0,QT0D"&`N``#'1"0$P@H``(M%"(D$).C\____C89$#0``@\046UY?7<.-
+MM@````"-OP````!5B>575E.![-0```"+=0B+50R+31"X`````(/Z!0^'<@8`
+M`/\DE7PN``#'1=3>____QT78U____\=%W-#____'1>#)____QT7DPO___\=%
+MM.[____'1;CN____QT6\\/___\=%P/+____'1<3T____QT64S/___\=%F,C_
+M___'19S$____QT6@P/___\=%I+K____'A73___^Z____QX5X____N/___\>%
+M?/___[7____'18"R____QT6$L/___XF-,/___[@`````@_D$#X?"!0``BWX0
+MBUX4A?]U"8V34)@``.WK!HN#4)@``(G!@>'__P_PBY4P____BT25U,'@%"4`
+M`/`/"<&%_W4+C9-0F```B<COZP:)BU"8``"+?A"+7A2%_W4)C9-<F```[>L&
+MBX-<F```B<&!X7^`__^+E3#___^+1)64P>`')8!_```)P87_=0N-DUR8``")
+MR._K!HF+7)@``(M^$(M>%(7_=0F-DUR8``#MZP:+@UR8``")P8'A_W_`_XN5
+M,/___XM$E;3!X`\E`(`_``G!A?]U"XV37)@``(G([^L&B8M<F```BWX0BUX4
+MOEB8``"%_W4)C9-8F```[>L&BX-8F```B<&!X?__`_R+E3#___^+A)5T____
+MP>`2)0``_`/IWP,``,>%;/___W\```#'A7#___\R````QX5D____?P```,>%
+M:/___R@```#'A5S___]_````QX5@____30```,>%5/___W\```#'A5C___]`
+M````QX5,____'P```,>%4/___Q````#'A43___\_````QX5(____,````,>%
+M//___P(```#'A4#___\"````A<D/E<`/ML")A2S___^+?A"+7A2%_W4)C9-L
+MF```[>L&BX-LF```B<&!X?\_X/^+E2S___^+A)5L____P>`.)0#`'P`)P87_
+M=0N-DVR8``")R._K!HF+;)@``(M^$(M>%(7_=0F-DVR8``#MZP:+@VR8``")
+MP8'A__\?\(N5+/___XN$E63____!X!4E``#@#PG!A?]U"XV3;)@``(G([^L&
+MB8MLF```BWX0BUX4A?]U"8V3:)@``.WK!HN#:)@``(G!@>'__P'_BY4L____
+MBX257/___\'@$24``/X`"<&%_W4+C9-HF```B<COZP:)BVB8``"+?A"+7A2%
+M_W4)C9-HF```[>L&BX-HF```B<&!X?___X"+E2S___^+A)54____P>`8)0``
+M`'\)P87_=0N-DVB8``")R._K!HF+:)@``(M^$(M>%(7_=0F-DVB8``#MZP:+
+M@VB8``")P8/AX(N5+/___XN$E4S___^#X!\)P87_=0N-DVB8``")R._K!HF+
+M:)@``(M^$(M>%(7_=0F-DVR8``#MZP:+@VR8``")P8'A_\#__XN5+/___XN$
+ME43____!X`@E`#\```G!A?]U"XV3;)@``(G([^L&B8MLF```BWX0BUX4A?]U
+M"8V3))D``.WK!HN#))D``(G!@>$!____BY4L____BX25//___P'`)?X````)
+MP87_=0N-DR29``")R._K!HF+))D``(.]+/___P!T(XM>$(M.%+YLF```A=MU
+M"8V1;)@``.WK!HN!;)@``(/(`>LABUX0BTX4OFR8``"%VW4)C9%LF```[>L&
+MBX%LF```@^#^C10.A=L/A((!``")!`[IDP$``,>%-/___P@```#'A3C___\&
+M````A<D/E<`/ML")A2C___^+?A"+7A2^"*(``(7_=0F-DPBB``#MZP:+@PBB
+M``")P8/AP(N5*/___XN$E33___^#X#_K?,>%=/___P````#'A7C___\$````
+MQX5\____"````(F-)/___[@`````@_D"#X</`0``BWX0BUX4OEB8``"%_W4)
+MC9-8F```[>L&BX-8F```B<&!X?\/_/^+E23___^+A)5T____P>`,)0#P`P#K
+M#9"0D)"0D)"0D)"0D)`)P87_Z9<```#'A73___\"````QX5X____!````,>%
+M?/___P8```#'18`(````QT6$"@```,=%B`P```#'18P.````QT60$````(G/
+MN`````"#^0=W;XM6$(F5(/___XM>%+XDF0``A=)U"8V3))D``.WK!HN#))D`
+M`(G!@>$!____BX2]=/___P'`)?X````)P8.](/___P"-M"8`````=0Z-%!Z)
+MR._K%HVV`````(D,'HVV`````(V\)P````"X`0```('$U````%M>7UW#58GE
+M4X/L"(M=#*$`````:<"($P``B0.A`````&G`0$(/`(E#!(M%$(,]``````!T
+M!P^O!0````")0PC'0PP`````BT4(B00DZ/S___^)P;K336(0BT,$]^+!Z@:)
+MR"G0B4,0QT,4`````,=#&`````"+0PC!X`*)1"0$C4,<B00DZ/S___^#Q`A;
+M7<.-="8`58GE5U93@^P(BWT(BUT,BW40B3PDZ/S___^)P8M3&(M##"M$DQR)
+M0PR)R"M#$&G`Z`,``(E$DQP]+W4``'<0#[=&`BM#%"7_!P``B423'(E+$`^W
+M1@*)0Q2+4QB+0PP#1),<B4,,0HE3&#M3"'41QT,8`````(UV`(V\)P````"+
+M0PP[0P1S&`^V1@6)1"0$B3PDZ%@"``"0C;0F`````(/$"%M>7UW#D(VT)@``
+M``!5B>6#[!B)7?2)=?B)??R+=0B)]X.^/`T````/A`\"``")-"3H_/___XG#
+MBX:H$```B=HK4!"+2`QIR>@#```!RCL0#X;G`0``BX:($```B=HK4!"+2`QI
+MR>@#```!RCL0#X;)`0``_X;\"P``B30DZ,OV__^)PX!X"@!T*,9`"@")-"3H
+M_/___PT``0``B40D!(DT).C\_____X8P#```Z48!``"-AO0+``")1"0$B30D
+MZ/S___^#^`%W5(![!P!T3H![!0!U2,9#!P#'1"0(`0```,=$)`0"````B30D
+MZ/S_____AA0,``#^0P4/MD,%B40D",=$)`0%````B30DZ/S_____A@P,``#I
+MVP```(![!`!T)OY+!`^V0P2)1"0(QT0D!`$```")-"3H_/____^'"`P``.FO
+M````@'L&`'0F_DL&#[9#!HE$)`C'1"0$!````(DT).C\_____X<H#```Z8,`
+M``"`>P@`="3&0P@`QT0D"`````#'1"0$`P```(DT).C\_____X<@#```ZUF`
+M>P4`="?&0PD!_DL%#[9#!8E$)`C'1"0$!0```(DT).C\_____X<0#```ZRR`
+M>P<`=&O&0PD!QD,'`,=$)`@!````QT0D!`(```")-"3H_/____^'%`P``*$`
+M````B40D"(N'B!```(E$)`2)-"3HNOS__Z$`````B40D"(N'J!```(E$)`2)
+M-"3HG_S__^L-D)"0D)"0D)"0D)"0D(M=](MU^(M]_(GL7<.-=@!5B>575E.#
+M[`R+?0B)_HD\).CJ]/__B</_A_@+``")]H![!`!U+8!["0!U)\9#!`3'1"0(
+M!````,=$)`0!````B3PDZ/S_____A@`,``#I<0$``(![!`-W+(!["0!U)OY#
+M!`^V0P2)1"0(QT0D!`$```")/"3H_/____^&!`P``.D=`0``C8;T"P``B40D
+M!(D\).C\____@_@!=@>#^`)T-^MB#[93!8C0_L@\!7=6B-#^P(A#!0^VP(E$
+M)`C'1"0$!0```(D\).C\_____X8,#```Z>P```"`>P<`=2?&0P<!QT0D"```
+M``#'1"0$`@```(D\).C\_____X88#```Z;\```"`>PD`=`G&0PD`Z0S___^-
+MAO0+``")1"0$B3PDZ/S___^#Z`*#^`%W48!["`!U(L9#"`''1"0(`0```,=$
+M)`0#````B3PDZ/S_____AAP,``"`>P8!=R/^0P8/MD,&B40D",=$)`0$````
+MB3PDZ/S_____AB0,``#K1<9#"@&)/"3H_/___R7__O__B40D!(D\).C\____
+M_X8L#```H0````")1"0(BX:($```B40D!(D\).C#^O__H0````#K(*$`````
+MB40D"(N&B!```(E$)`2)/"3HH?K__Z$`````B40D"(N&J!```(E$)`2)/"3H
+MAOK__X/$#%M>7UW#C;0F`````(V\)P````!5B>575E.#[`R+=0B)]XDT).C:
+M\O__B<.`>`0`="(/MD`$B40D",=$)`0!````B30DZ/S___^-=@"-O"<`````
+M@'L%`'0:#[9#!8E$)`C'1"0$!0```(DT).C\____B?:`>P<`=!H/E,`/ML")
+M1"0(QT0D!`(```")-"3H_/___X!["`!T&@^V0PB)1"0(QT0D!`,```")-"3H
+M_/___XGV@'L&`'0:#[9#!HE$)`C'1"0$!````(DT).C\____B?:`>PH`=!J)
+M-"3H_/___R7__O__B40D!(DT).C\____D*$`````B40D"(N'B!```(E$)`2)
+M-"3H=?G__Z$`````B40D"(N'J!```(E$)`2)-"3H6OG__XDT).C\____#0`!
+M``")1"0$B30DZ/S___^#Q`Q;7E]=PXGVC;PG`````%6)Y5W#D)"0D)"0D)"0
+MD)!5B>575E.#[`B+=0B+1A2#?A``=0Z-D-"8``"X%AP``._K"L>`T)@``!8<
+M``"Y`````+^`F```NP```0"-="8`BT84@WX0`'4+C9"`F```B=COZP.)'`=!
+M@_D'?N.+1A2#?A``=0F-D`"<``#MZP:+@`"<``")PL'J&(G0P>@$@^(/P>($
+M"<+'1"0$"````(D4).C\____@\0(6UY?7<.058GE5U93@^P8#[=%"(E%[,<$
+M),00``#H_/___XG#O@(```"%P`^$-04``(E%Z(G'OJ`N``"X@`(``/;#!'04
+MH:`N``")`XU[!+ZD+@``N'P"``#\B<'!Z0+SI8M%[(M5Z&:)0@AFQT(*``"+
+M10R)0@R+11")0A"+112)0A3&@^0,```0QX/@#````````,:#Y0P```3'@^@,
+M````````QX/L#````````,>#^`P```````#'@P0-```"````QX,(#0``````
+M`,>##`T```````#'@Q`-```*````QX,4#0``"@```,>#&`T``&0```#'@QP-
+M````````QH,J#0```,=$)`0`````B10DZ/S___^^`P```(7`#X1#!```BU7H
+MBT(4@WH0`'4+C9`@0```[8G!ZP:+B"!````/ML'!Z`2+5>B)@EP!``")R(/@
+M#V:)@F`!``"#NEP!```%=`J^#0```.GX`P``BU7HBT(4@WH0`'4,C9`8F```
+M[>L)C78`BX`8F```BU7H9HF"8@$``(D4).@H!```O@X```"%P`^$NP,``(M5
+MZ(M"%(-Z$`!U#XV0`)@``+@'````[^L+D,>``)@```<```"+1>B)!"3HB_W_
+M_XM5Z&:)@F0!```/M\`E\````(/X$'0.O@T```"#^#`/A68#``"-1?*)1"0(
+MQT0D!,$```"+1>B)!"3H_/___[X(````A<`/A#\#``!F@7WR`3!W"KX%````
+MZ2T#```/MT7R9HF#@`(``(M5Z(M"%(-Z$`!U"8V0$$```.WK!HN`$$```(/@
+M&,'H`[X*````@_@"#X7S`@``C47RB40D",=$)`0_````BT7HB00DZ/S___^^
+M"````(7`#X3,`@``#[=%\F:)@X("``"_`````+X`````C57RB50D"(V&P```
+M`(E$)`2+1>B)!"3H_/___X7`#X2)`@``#[=%\C''1H'^/P,``';-O@<```"!
+M____```/A7,"``!FQX/*`P``"@!FQX/4!0```P"^`````(T$=HT$AF;'A(/2
+M`P``"P!&@_X)=NJ^`````+D@,0``NB8Q```/MP1Q9HF$<]P%```/MP1R9HF$
+M<]8%``"-!':-!(:-!(-FQX"$!@``"P!FQX#H!0``"P!&@_X"=L?'1"0(````
+M`(V#@`(``(E$)`2+5>B)%"3H_/___[X(````A<`/A-0!``!F@[N8`@````^$
+MI````(M5Z`^W@F0!```E\````(/X$`^%C````(M"%(-Z$`!U#HV0`)@``+@'
+M0```[^L*QX``F```!T```,<$)-`'``#H_/___XM%Z(D$).AV^___BU7H9HF"
+M9@$``(M"%(-Z$`!U#HV0`)@``+@'````[^L*QX``F```!P```,<$)-`'``#H
+M_/___XM5Z`^W@F8!```E\````+X-````@_@@#X4B`0``C47RB40D",=$)`2_
+M````BT7HB00DZ/S___^^"````(7`#X3[````#[=%\F:)@X0"``"+5>B)%"3H
+M_/___[\`````O@````"-1?*)1"0(N!\````I\(E$)`2+1>B)!"3H_/___X7`
+M#X2L````#[=%\@''P>@(B(1SY`L```^V1?*(A'/E"P``1H/^`G:ZA?]T"('_
+M_?\"`'4*O@D```#I?P```(M5Z(N"7`$``(E"'`^W@F`!``!FB4(@#[>"8@$`
+M`&:)0B(/MX)D`0``9HE")`^W@F8!``!FB4(F#[>"9`$``"7P````@_@O?@S'
+M@S0,````````ZPK'@S0,````````BT7HB00DZ/S___^)@SP-``"+1>CK)KX(
+M````D(UT)@"%VW0(B1PDZ/S___^#?1@`=`6+51B),K@`````@\086UY?7<.-
+MM@````"-OP````!5B>6#[`B)7?R+70B)'"3H_/___XD<).C\____BUW\B>Q=
+MPXVV`````(V\)P````!5B>575E.#[#B+?0C'1=P`@```QT7@()@``,=%Y%55
+M557'1>BJJJJJQT7L9F9F9L=%\)F9F9G'1=``````BT70P>`"BW0%W(G#BT\4
+M@W\0`'4&C10.[>L#BP0.B40=U+L`````B77,B?:-O"<`````B=C!X!`)V(E%
+MQ(M7%(E%P(-_$`!U"@'R[^L.D(UT)@"+3<"+1<R)#!"+3Q2#?Q``=0Z-%`[M
+MB<+K"8VV`````(L4#KD`````.U7$#X6@````0X'[_P```'ZFNP````")=<B-
+MM"8`````C;PG`````(M,G>2)3<2+5Q2#?Q``=0<!\HG([^L&BT7(B0P0BT\4
+M@W\0`'4*C10.[8G"ZP6)]HL4#KD`````.57$=41#@_L#?KV+3Q2+1=#!X`*+
+M5`7<BT0%U(-_$`!U!HT4"N_K`XD$"O]%T(-]T`$/CNW^___'!"1D````Z/S_
+M__^Y`0```(G(@\0X6UY?7<.0C70F`%6)Y5W#C70F`(V\)P````!5B>6+51"+
+M310/MT4,]L0!=`YFQP(X$V;'`=07ZR*)]H3`>2.+10AF@[B8`@```'069L<"
+M"`EFQP&L"I"-="8`N`$```#K!;@`````7<.0D%6)Y5=64X/L"(M="(M-#(M]
+M$(MU%(E=\(M3%(GX@WL0`'4-@<(H@```[^L*C70F`(FZ*(```('F__\``(/Y
+M`70?@_D!<FJ#^08/A+,```"#^0@/A?@```"0C;0F`````(M#%(-[$`!U#HV0
+M+(```+C__P``[^L*QX`L@```__\``(M#%(-[$`!U#HV0,(```+C__P<`[^L*
+MQX`P@```__\'`('.`````>FC````C78`BU,4B?@K!0````#!X`.#>Q``=0R!
+MPBR```#OZPF-=@")@BR```"+0Q2#>Q``=1&-D#"```"X__\'`._K#8UV`,>`
+M,(```/__!P"!S@``@`#K3HM3%(GX*P4`````P>`#@WL0`'4)@<(L@```[^L&
+MB8(L@```BU,4B?@K!0````#!X`.#>Q``=0F!PC"```#OZP:)@C"```"!S@``
+M@`&)]HM+$(M#%(E%[(M5\(.ZX`P```!T"XGX`X+@#```ZP20C4<!A<EU#(M5
+M[('"-(```._K"8M5[(F"-(```/?&`````70LBT,4@WL0`'43C9`@@```N```
+M``'OZQ60C70F`,>`((````````&-M@````"+4Q2)\(-[$`!U"8'"((```._K
+M!HFR((```(/$"%M>7UW#C;0F`````(V\)P````!5B>564X/L"(MU"+L`````
+MQT0D!`(```")-"3H_/___X7`=!7'!"0*````Z/S___]#@?OG`P``?M>!^^<#
+M```/GL`/ML"#Q`A;7EW#C70F`%6)Y8M-"(M!%(-Y$`!U$8V0*(```+@`````
+M[^L-C78`QX`H@````````(M!%(-Y$`!U#8V0!(```.WK"HUT)@"+@`2````-
+M```$`(M1%"7__\__@WD0`'4)@<($@```[^L&B8($@```BT$4@WD0`'4/C9`@
+M@```N/__``#OZPN0QX`@@```__\``%W#C70F`%6)Y5=64X/L#(M]"(MU#(!^
+M"P`/A*\```"+7Q"+3Q2%VW4-C9$$@```[>L*C70F`(N!!(````T``!``A=MU
+M"8V1!(```._K!HF!!(````^V1@L/ME8*#Z_"#[=6"(M/%`^OPH-_$`!U"8V1
+M)(```._K!HF!)(```(M7%`^W1@R#?Q``=0N!PCB```#OZPB)]HF".(````^V
+M1@H/KT48`T44#[=6"`^OPHM7%`-%$,'@`X-_$`!U"8'",(```.LVD(F",(``
+M`.LXBU\0BT\4A=MU#HV1!(```.WK"Y"-="8`BX$$@```)?__[_^%VW4)C9$$
+M@```[^L(B8$$@```B?:+5Q2+!H-_$`!U"8'"*(```._K!HF"*(```(M'$(E%
+M[(M?%(-][`!U"8V3((```.WK!HN#((```(G"@>(``(#_#[=&"(G1"<%F@WX0
+M`'01#[=&$(/`!,'@$"4``'\`"<&#?>P`=0N-DR"```")R._K!HF+((```(M'
+M$(E%Z(M?%(-]Z`!U"HV3&(```.WK!Y"+@QB```")P8'A_P#__P^W1A3!X`@E
+M`/\```G!@WWH`'4.C9,8@```B<COZPF-=@")BQB````/MUX(#[=&$CG8=@*)
+MPP^V3@H/MU82.<IV`HG1.<MU"HM&!.L'D(UT)@"+!HE%\(M7%(M&!(/H`\'@
+M`R7__P<`#0``&`J#?Q``=0^!PM2```#OZPR-M@````")@M2```"+5Q2+=?"-
+M!/7H____)?__!P`-````"H-_$`!U#8'"V(```._K"HUT)@")@MB```"+5Q2)
+MR,'@$`G8@W\0`'4*@<+<@```[^L'D(F"W(```(/$#%M>7UW#D)!5B>6+10B+
+M4!2#>!``=0F!P@A```#MZP:+@@A```"#^`$/E,`/ML!=PXVT)@````!5B>6+
+M10B+30R+4!2#>!``=0Z!PL````#MZPN0C70F`(N"P````(G"@_C_=1/'`0``
+M``"X`````.L_C;8`````);K8!0&)`??"```(`'0'#0```$")`?;"!70#@PD!
+M]\)``0``=`.#"4#VPB!T!H$)````0+@!````7<.0C70F`%6)Y8M%"(N`\`L`
+M`%W#B?95B>6#[`R)'"2)="0$B7PD"(M="(M-#(G?B[/P"P``A?9Y/8M#%(-[
+M$`!U"XU0)+@`````[^L'QT`D`````(M#%(-[$`!U"8U0).WK$XUV`(M`)(VV
+M`````(V\)P````")R"6ZV`4!]L%`=`4-P`$``/;!`70#@\@']\$```!`=`4-
+M```(`(M3%(-[$`!U"8'"H````._K!HF"H````(F/\`L``(7)>2B+0Q2#>Q``
+M=0^-4"2X`0```._K%(UT)@#'0"0!````B?:-O"<`````B?"+'"2+="0$BWPD
+M"(GL7<.0D)"0D)"0D)"0D)"0D)!5B>6X@````%W#C;8`````58GEBTT(#[=%
+M#&:#^']W*(M1%,'@!04<B```@WD0`'4%`<+MZP.+!!`E`(#__[H!````9H7`
+M=06Z`````(G07</K#9"0D)"0D)"0D)"0D)!5B>53BUT(#[=-#+@`````9H/Y
+M?P^'"@$``(M3%(G(P>`%!0"(``"#>Q``=0H!PK@`````[^L'QP00`````(M3
+M%(G(P>`%!02(``"#>Q``=0\!PK@`````[^L,D(UT)@#'!!``````BU,4B<C!
+MX`4%"(@``(-[$`!U"@'"N`````#OZP?'!!``````BU,4B<C!X`4%$(@``(-[
+M$`!U"@'"N`````#OZP?'!!``````BU,4B<C!X`4%%(@``(-[$`!U#@'"N`<`
+M``#OZPN-="8`QP00!P```(M3%(G(P>`%!1B(``"#>Q``=0H!PK@`````[^L'
+MQP00`````(M3%(G(P>`%!1R(``"#>Q``=0H!PK@`````[^L'QP00`````+@!
+M````6UW#B?:-O"<`````58GE@^P,B1PDB70D!(E\)`B+51`/MW4,N`````!F
+M@_Y_#X>A````A=)T.`^V6@7!XP@/MD($"<,/MDH#P>$8#[9"`L'@$`G!#[9"
+M`<'@"`G!#[8""<'1Z8G8P>`?"<'1Z^L-NP````"Y`````(UV`(M%"(MX%(GP
+MP>`%C9`8B```B<B+30B#>1``=0:-%#KOZP.)!#J+10B+2!2)\,'@!8V0'(@`
+M`(G8#0"```"+70B#>Q``=0J-%`KOZP>-="8`B00*N`$```"+'"2+="0$BWPD
+M"(GL7<.)]HV\)P````!5B>575E.#[!R+71`/MT4,B47P@WT8``^4P`^VR$F!
+MX:JJJJJX`````&:#??!_#X?L`0``@SL$?PJX`````.G=`0``#[9S!`^V0P7!
+MX`@)Q@^V0P;!X!`)Q@^V0P?!X!@)QC'.#[9#"<'@"`^V4P@)PHE5[#%-[(%E
+M[/__```/MD,*B47H#[9#"\'@"`E%Z`^V0PS!X!`)1>@/MD,-P>`8"47H,4WH
+M#[9##\'@"`^V4PX)PHE5Y#%-Y(%EY/__```/MGL0#[9#$<'@"`G'#[9#$L'@
+M$`G'#[9#$\'@&`G',<^#.PU_!H'G_P```(,[!7\'NP````#K&(,[#7\'NP$`
+M``#K#+L#````C;0F`````(M%"(M(%(M%\,'@!8V0`(@``(GPBW4(@WX0`'4&
+MC10*[^L#B00*BT4(BT@4BT7PP>`%C9`$B```BT7LBW4(@WX0`'4,C10*[^L)
+MC;8`````B00*BT4(BT@4BT7PP>`%C9`(B```BT7HBW4(@WX0`'4&C10*[^L#
+MB00*BT4(BT@4BT7PP>`%C9`,B```BT7DBW4(@WX0`'4(C10*[^L%B?:)!`J+
+M10B+2!2+1?#!X`6-D!"(``")^(MU"(-^$`!U!HT4"N_K`XD\"HM%"(M(%(M%
+M\,'@!8V0%(@``(G8BUT(@WL0`'4*C10*[^L'C70F`(D$"HM%%(E$)`B+=?")
+M="0$BT4(B00DZ/S___^-="8`@\0<6UY?7<.0D)"0D)"0D%6)Y8/L#,=$)`@&
+M````BT4(!>0+``")1"0$BT4,B00DZ/S___^)[%W#C;0F`````%6)Y8/L%(E=
+M_(M="(M3%(M%#(-[$`!U"8'"`&```._K!HF"`&```(M#%(-[$`!U$(V0"&``
+M`+@!````[^L,B?;'@`A@```!````QT0D#`(```#'1"0(`P```,=$)`0,8```
+MB1PDZ/S___^Z`````(7`="6+0Q2#>Q``=0N-D`1@``#MB<+K!HN0!&```(M%
+M$&:)$+H!````B="+7?R)[%W#ZPV0D)"0D)"0D)"0D)"058GEBTT0#[=%#(M5
+M"&8Y@H0"``!U"K@,````ZQ>-=@"`NH("````#YC`#[;`C03%`P```(7)=`*)
+M`;@`````7</K#9"0D)"0D)"0D)"0D)!5B>6+10@/MX"$`@``7<.058GEBTT(
+MB<JX`````&:#N98"````=!FX`0```&:#N88"````=0JX`P```)"-="8`9H.Z
+MF`(```!T`X/(!&:#NIH"````=`MF@7D*$0YT`X/("%W#C;8`````C;\`````
+M58GE@^P4B5W\BUT(9H.[B@(```!T2HU%^HE$)`C'1"0$#P```(D<).C\____
+MN@````"%P'16#[=5^HG0@^`<P?@"B8,L#0``@^("T?J)DS`-``#'@S@-```!
+M````ZQ^0QX,L#0```````,>#,`T```````#'@S@-````````9H.[B@(````/
+ME<`/MM")T(M=_(GL7<.-="8`C;PG`````%6)Y5=64X/L#(M="(G>BX,L#0``
+MB40D!(D<).C\____BWL0BTL4A?]U"8V1`)@``.WK!HN!`)@```T`(```A?]U
+M#HV1`)@``._K"Y"-="8`B8$`F```BX8L#0``B40D!(D<).C\____B88T#0``
+M.X8P#0``#Y7`#[;`B40D"(N&+`T``(E$)`2)'"3H_/___X/$#%M>7UW#D(VT
+M)@````!5B>6#[`R)'"2)="0$B7PD"(M%"(MX$(MP%(7_=1*-EA1```#MB<+K
+M#8VT)@````"+EA1```"+30P!R;@#````T^#WT(G3(<.X`@```-/@"<.%_W4+
+MC9840```B=COZP:)GA1```"X`0```(L<)(MT)`2+?"0(B>Q=PXVV`````%6)
+MY8/L#(D<)(ET)`2)?"0(BT4(BW`0BU@4OQ1```"%]G4-C9,40```[8G"ZPB)
+M]HN3%$```(M-#`')N`,```#3X/?0(="%]G4&C10?[^L#B00?N`$```"+'"2+
+M="0$BWPD"(GL7<.)]HV\)P````!5B>53BUT(BTT,BT,4@WL0`'4-C9`80```
+M[>L*C70F`(N`&$```+K^____T\(APHM%$(/@`=/@BTL4"="#>Q``=0Z-D1A`
+M``#OZPN0C70F`(F!&$```+@!````6UW#B?95B>6+50B+30RX_____X/Y!7<@
+MBT(4@WH0`'4)C9`<0```[>L&BX`<0```@^`OT^B#X`%=PXUT)@"-O"<`````
+M58GE5E.#[`B+70B+=0R+0Q2#>Q``=0N-D!1```#MB<+K!HN0%$```(T,-K@#
+M````T^`-`/`!`/?0(<*)\,'@#`G"@<H`@```@WT0`'0&@<H```$`BTL4B="#
+M>Q``=0F-D11```#OZP:)D11```"+@_`+```-`````8E$)`2)'"3H_/___X/$
+M"%M>7<.-="8`58GE@^P,B1PDB70D!(E\)`B+10B+<!"+6!2_$$```(7V=0V-
+MDQ!```#MZPJ-="8`BX,00```B<&!X9__\?^+10R#X`<+#(5`,0``A?9U"(T4
+M'XG([^L#B0P?BQPDBW0D!(M\)`B)[%W#C;0F`````%6)Y5=64X/L%(M="`^W
+M11")1?`/MT44B47LB=_'1"0(!@```(M%#(E$)`2-@^H+``")!"3H_/___XM3
+M%`^VB^H+```/MH/K"P``P>`("<$/MH/L"P``P>`0"<$/MH/M"P``P>`8"<&#
+M>Q``=0N!P@B```")R._K!HF*"(```(MS%`^VA^\+``#!X`@/MI?N"P``B=$)
+MP8M%\"7_/P``P>`0"<&#>Q``=0N-E@R```")R._K!HF.#(```(MS$(M+%+\,
+M@```A?9U"8V1#(```.WK!HN!#(```"7__P``A?9U!HT4#^_K`XD$#V:#??``
+M=%^+<Q"+6Q2_((```(7V=1"-DR"```#MZPV-M"8`````BX,@@```B<&!X?__
+M@/]F@WWL`'00BT7L@\`$P>`0)0``?P`)P87V=0B-%!^)R._K#XD,'XVV````
+M`(V_`````(/$%%M>7UW#D(VT)@````!5B>6#[`R)'"2)="0$B7PD"(M5"(M"
+M%(-Z$`!U"8V04(```.WK!HN`4(```(G'O@````"+50B+0A2#>A``=0F-D$R`
+M``#MZP:+@$R```"Z`````(GQ"<&)^PG3B<B)VHL<)(MT)`2+?"0(B>Q=PXGV
+M58GEBT4(BU`4@W@0`'4)@<),@```[>L&BX),@```7<-5B>53BTT(BT$4@WD0
+M`'40C9`@@```[>L-C;0F`````(N`((```(G#BU$4#0````&#>1``=0J!PB"`
+M``#OZP>0B8(@@```BU$4B=@-`````8-Y$`!U"H'"((```._K!Y")@B"```!;
+M7<.-M"8`````58GE4X/L!(M="(M%#/:#]@L``"`/A)8```#&1?L`N0`````[
+M"',NB?:-O"<`````#[94`02$TGD7@.)_.E7[<@^(5?N-M@````"-OP````!!
+M.PARVXM3%(-[$`!U"8'"!(```.WK!HN"!(```(G!@'W[`'0;#[9%^]#H/`)W
+M$8M3%(G(#0````+K#Y"-="8`BU,4B<@E_____8-[$`!U"8'"!(```._K!XF"
+M!(```)"#Q`1;7<.-=@"-O"<`````58GE@^P(B1PDB70D!(M="(M#%(-[$`!U
+M"8V09)@``.WK!HN`9)@``(G!P>D3@>'_`0``]L4!=`:!\0#^__^+0Q2#>Q``
+M=0N-D%"```#MB<;K!HNP4(```(M3%(-[$`!U#X'"3(```.WK#(VV`````(N"
+M3(```#'P,<B+'"2+="0$B>Q=PXUT)@"-O"<`````58GE4XM-"(M!%(-Y$`!U
+M$(V0($```.WK#8VT)@````"+@"!````E_P```(G"P>H$@^`/NP`````YD5P!
+M``!U$&8Y@6`!``!U![L!````B?:)V%M=PXUT)@"-O"<`````58GE4XM-"(M=
+M#(M!%(-Y$`!U#8V0D(```.WK"HUT)@"+@)"````!`XM!%(-Y$`!U#XV0C(``
+M`.WK#(VV`````(N`C(````%#!(M!%(-Y$`!U#HV0E(```.WK"Y"-="8`BX"4
+M@````4,,BT$4@WD0`'4.C9"(@```[>L+D(UT)@"+@(B````!0PB+012#>1``
+M=0Z-D)B```#MZPN0C70F`(N`F(````%#$(M!%(-Y$`!U#HV0[(```+@`````
+M[^L*QX#L@````````(M!%(-Y$`!U#HV0\(```+@`````[^L*QX#P@```````
+M`(M!%(-Y$`!U#HV0](```+@`````[^L*QX#T@````````(M!%(-Y$`!U#HV0
+M^(```+@`````[^L*QX#X@````````%M=PU6)Y8M5#(/Z`706N`$```"#^@%R
+M*[@`````@_H"="'K$XM%"&:#N&`!```##Y?`#[;`ZPRX`````(VT)@````!=
+MPXVT)@````"-O"<`````58GEN`$```!=PXVV`````%6)Y8/L"(D<)(ET)`2+
+M10B+6!"+2!2^5)D``(7;=0F-D529``#MZP:+@529``"#R`&%VW4+C10.[^L(
+MD(UT)@")!`Z+'"2+="0$B>Q=PXGV58GEBT4(BU`4@W@0`'4)@<(<G```[>L&
+MBX(<G```)?\```!=PXUT)@"-O"<`````58GEBT4(BU`4@W@0`'4)@<)8@```
+M[>L&BX)8@```@^`'7<.-M@````"-O"<`````58GE4XM=#(M-"(M1%(G8@^`'
+M@WD0`'4)@<)8@```[^L&B8)8@```B-@D!XB!)`T``&;'@28-`````%M=PXUV
+M`%6)Y5=64XM]"(G[BT40#[=``B7@`0``/<````!T,CW`````?PP]H````'06
+MZ;\```"^`````#U``0``=!CIK@```+X!````ZPR-M"8`````O@(````/MY1S
+M\`(```^WA'/V`@``P>`&"<(/MX1S_`(``,'@#`G"#[>$<P(#``#!X!()P@^W
+MA',(`P``P>`8"<(/MXQS#@,```^WA',4`P``P>`&"<$/MX1S&@,``,'@#`G!
+M#[>$<R`#``#!X!()P0^WA',F`P``P>`8"<&#?0P!=`Z#?0P!<AZ#?0P"=`;K
+M#XG1ZQ*)RNL.C;0F`````+@`````ZT2+10R)@^@,``"+7Q2)T(-_$`!U"8V3
+M8)D``._K!HF38)D``(M7%(G(@W\0`'4+@<)DF0``[^L(B?:)BF29``"X`0``
+M`%M>7UW#58GEN`$```!=PXVV`````%6)Y5.+70B+30RX`````(/Y"'8GBU,4
+MC02)C01!P>`"@WL0`'4*@<)P$```[^L'D(F"<!```+@!````6UW#B?95B>6#
+M[!B)7?2)=?B)??R+70B+30R)7?"+0Q2#>Q``=0^-D`2```#MZPR-M@````"+
+M@`2````/M_"#^0$/A(X```"#^0%R';@`````@_D&#X6P````BU,4B?`-``"!
+M`.EV````BWL0BTL4A?]U!HU1%.WK`XM!%(/(((7_=0:-413OZP.)012+4Q2)
+M\`T``((`@WL0`'4)@<($@```[^L&B8($@```BU7P#[>"]@L``"7`````/<``
+M``!U1,=$)`04````B1PDZ/S____K,HGVBU,4B?`-```@`(-[$`!U$('"!(``
+M`._K%XVT)@````")@@2```"-=@"-O"<`````N`$```"+7?2+=?B+??R)[%W#
+MC;0F`````(V\)P````!5B>575E.#[%"+=0C'1"0$Q@P``,<$)`````#H_/__
+M_\=$)`3?#```QP0D`````.C\____QT0D"$,```#'1"0$8#$``(DT).C\____
+MBT84@WX0`'4)C9"T````[>L&BX"T````B47LBT84@WX0`'4)C9"P````[>L&
+MBX"P````B47HBT84@WX0`'4+C9"L````[8G'ZP:+N*P```"+1A2#?A``=0N-
+MD*@```#MB</K!HN8J````(M&%(-^$`!U"XV0I````.V)P>L&BXBD````BT84
+M@WX0`'4)C9"@````[>L&BX"@````BU7LB50D'(M5Z(E4)!B)?"04B5PD$(E,
+M)`R)1"0(QT0D!.$,``#'!"0`````Z/S___^+1A2#?A``=0F-D,````#MZP:+
+M@,````")1?"+1A2#?A``=0F-D-0```#MZP:+@-0```")1>2+1A2#?A``=0N-
+MD-````#MB<?K!HNXT````(M&%(-^$`!U"XV0S````.V)P^L&BYC,````BT84
+M@WX0`'4+C9#(````[8G!ZP:+B,@```"+1A2#?A``=0F-D,0```#MZP:+@,0`
+M``"+5>2)5"0<B7PD&(E<)!2)3"00B40D#(M%\(E$)`C'1"0$%`T``,<$)```
+M``#H_/___\=$)`3?#```QP0D`````.C\____BT84@WX0`'4+C9!`"@``[8G#
+MZP:+F$`*``"+1A2#?A``=0N-D(`(``#MB<'K!HN(@`@``(M&%(-^$`!U"8V0
+M0`@``.WK!HN`0`@``(E<)!S'1"081PT``(E,)!3'1"004PT``(E$)`S'1"0(
+M60T``,=$)`1?#0``QP0D`````.C\____BT84@WX0`'4+C9"`"0``[8G!ZP:+
+MB(`)``"+1A2#?A``=0F-D$`)``#MZP:+@$`)``")3"0,B40D",=$)`2`#0``
+MQP0D`````.C\____NP````"-M@````"-O"<`````BU84C02=``H``(-^$`!U
+M"`'"[8E%X.L&BQ00B57@BU84C02=P`D``(-^$`!U"`'"[8E%W.L&BQ00B57<
+MBU84C02=``D``(-^$`!U!P'"[8G'ZP.+/!"+5A2-!)W`"```@WX0`'4*`<+M
+MB<'K!HUV`(L,$(M6%(T$G0`(``"#?A``=04!PNWK`XL$$(M5X(E4)!R+5=R)
+M5"08B7PD%(E,)!")1"0,B5PD",=$)`2L#0``QP0D`````.C\____0X/["0^.
+M.?___\=$)`3?#```QP0D`````.C\____NP````"+5A2-!)U`$0``@WX0`'4(
+M`<+MB478ZP:+%!")5=B+5A2-!)T`$0``@WX0`'4(`<+MB474ZP:+%!")5=2+
+M5A2-!)W`$```@WX0`'4(`<+MB470ZP:+%!")5="+5A2-!)V`$```@WX0`'4'
+M`<+MB<?K`XL\$(M6%(T$G4`0``"#?A``=0P!PNV)P>L(D(UT)@"+#!"+5A2-
+M!)T`$```@WX0`'4%`<+MZP.+!!"+5=B)5"0@BU74B50D'(M5T(E4)!B)?"04
+MB4PD$(E$)`R)7"0(QT0D!.,-``#'!"0`````Z/S___]#@_L)#XX2____NP``
+M``"-M@````"-O"<`````BU84B=C!X`@%.!```(-^$`!U!0'"[>L#BP00B47,
+MBTX4B=K!X@B#RD"!PC@0``"#?A``=0N-%`KMZPB0C70F`(L$"HE%R(M.%(G:
+MP>((@<J`````@<(X$```@WX0`'4&C10*[>L#BP0*B<>+3A2)VL'B"('*P```
+M`('".!```(-^$`!U"XT4"NWK")"-="8`BP0*B<*#?<P`=16#?<@`=0^%_W4+
+MA<!T-8VT)@````")5"08B7PD%(M%R(E$)!"+5<R)5"0,B5PD",=$)`0D#@``
+MQP0D`````.C\____0X/["0^.&/___X/$4%M>7UW#58GE7<.0D)"0D)"0D)"0
+MD%6)Y5=64X/L!(M="(-]#``/A*$```"+0Q2#>Q``=0Z-D`1```"X`````._K
+M"L>`!$````````#'!"0*````Z/S___^^"@```+\00```C78`BT,4@WL0`'4)
+MC9`00```[>L#BP0'J0```0!T,\<$),@```#H_/___XM#%(-[$`!U#XV0!$``
+M`+@`````[^L+D,>`!$````````!.=;/K$87V=12-M@````"-O"<`````N```
+M``#K-8MS$(M+%+L$@```A?9U"8V1!(```.WK!HN!!(```"7___O_A?9U!HT4
+M"^_K`XD$"[@!````@\0$6UY?7<.-M@````"-OP````!5B>6#[`R)'"2)="0$
+MB7PD"(MU"(M>$(M.%+\$@```A=MU#8V1!(```.WK"HUT)@"+@02````-```$
+M`(7;=0:-%`_OZP.)!`^#?0P`="*+1A2#?A``=0Z-D`1```"X`0```._K"\>`
+M!$````$```"0BQPDBW0D!(M\)`B)[%W#D%6)Y8/L$(E=](EU^(E]_(MU"`^W
+M11")1?"+7A"+3A2_!(```(7;=0F-D02```#MZP:+@02````-```$`(7;=0:-
+M%`_OZP.)!`^#?0P`="&+5A2+1?"#R`*#?A``=0F!P@1```#OZPF)@@1```"-
+M=@"+7?2+=?B+??R)[%W#C78`58GE@^P8B5WTB77XB7W\BT4(BUT,BTT0#[=5
+M%(G&OP$```"#^P-T*(/[`W<'@_L"=`GK/(/[!'0EZS6)3"0$B00DZ+G]__^)
+MQ^LLD(UT)@")3"0$B00DZ*3^___K&8E4)`B)3"0$B00DZ!+____K![@`````
+MZPF)GMP,``")^)"+7?2+=?B+??R)[%W#C78`58GEBT4(BU`4@W@0`'4)@<($
+M0```[>L&BX($0```)0```P#!Z!!=PY"-M"8`````58GEBT4(BU`4@W@0`'4)
+M@<(00```[>L&BX(00```P>@0@^`!7<.-=@"-O"<`````58GEN`````!=PXVV
+M`````%6)Y;@`````7<.-M@````!5B>6X`````%W#C;8`````58GEN`````!=
+MPY"0D)"0D%6)Y8/L#(E=_(M%#(/X('<O_R2%>#,``+L`````ZRB0NP````#K
+M(+L`````ZQF)]KL`````ZQ"[`````.L)B?:X`````.L1B5PD!(M%"(D$).C\
+M____B=B+7?R)[%W#D%6)Y8M%"(M0%(-X$`!U!H/"#.WK`XM"#%W#C;8`````
+M58GEBTT(BU$4BT4,@WD0`'4&@\(,[^L#B4(,7<.-=@!5B>6+10B+4!2#>!``
+M=1&#P@BX!````._K#8VV`````,=""`0```!=PXVT)@````!5B>6#[!"+30B+
+M012#>1``=0Z-4`BX(````._K"HUV`,=`""````#'1"0,`````,=$)`@$````
+MQT0D!`@```")#"3H_/___X7`#Y7`#[;`B>Q=PXVV`````(V\)P````!5B>6#
+M[!")7?2)=?B)??R+=0B)]XM>$(M.%(7;=0F-D4B```#MZP:+@4B```"#X-^%
+MVW4,C9%(@```[^L)C78`B8%(@```@[\\#0```'01B30DZ/S___^)]HV\)P``
+M``"+7?2+=?B+??R)[%W#C78`58GE@^P(B1PDB70D!(M%"(M8$(M(%+Y(@```
+MA=MU"8V12(```.WK!HN!2(```(/(((7;=0N-%`[OZPB0C70F`(D$#HL<)(MT
+M)`2)[%W#B?95B>6+30B+412+10R#>1``=0Z!PD"```#OZPN0C70F`(F"0(``
+M`(M1%(M%$(-Y$`!U#H'"1(```._K"Y"-="8`B8)$@```7<.0C;0F`````%6)
+MY8/L"(D<)(ET)`2+70B+30RX`````(/Y/P^'E````(/Y'W9*BT,4@WL0`'41
+MC9!$@```[8G"ZPR-M@````"+D$2```"+<Q2#Z2"X_O___]/`(="#>Q``=0B-
+MED2```#K/XF&1(```.M%D(UT)@"+0Q2#>Q``=0N-D$"```#MB<+K!HN00(``
+M`(MS%+C^____T\`AT(-[$`!U"8V60(```._K"XF&0(```)"-="8`N`$```"+
+M'"2+="0$B>Q=PU6)Y8/L"(D<)(ET)`2+70B+30RX`````(/Y/P^'E````(/Y
+M'W9*BT,4@WL0`'41C9!$@```[8G"ZPR-M@````"+D$2```"+<Q2#Z2"X`0``
+M`-/@"="#>Q``=0B-ED2```#K/XF&1(```.M%D(UT)@"+0Q2#>Q``=0N-D$"`
+M``#MB<+K!HN00(```(MS%+@!````T^`)T(-[$`!U"8V60(```._K"XF&0(``
+M`)"-="8`N`$```"+'"2+="0$B>Q=PU6)Y5.+70B+0Q2#>Q``=1"-D#R```#M
+MZPV-M"8`````BX`\@```B<&+0Q2#>Q``=0^-D`R!``#MZPR-M@````"+@`R!
+M``")PJ@@=`:!R0`"``#WP@```@)T!H')``$``(G(6UW#C70F`(V\)P````!5
+MB>564XM="(M-#(M3%`^VP8-[$`!U"8'"/(```._K!HF"/(```+@`````]L4"
+M=`6X(````/;%`70%#0```@*+4Q2#>Q``=0F!P@R!``#OZP:)@@R!``"%P'0=
+MBW,0BTL4NS0```"%]G4&C5$T[>L#BT$T@\@0ZQZ+<Q"+2Q2[-````(7V=0F-
+M433MZP:-=@"+032#X.^%]G4&C10+[^L#B00+6UY=PXGVC;PG`````%6)Y8M5
+M$(M-#,=!"`````")T"7_#P``B4$,.=!T![@`````ZROV110@=`>!20P`(```
+MQT$4`````,=!$`````"X`0```(UT)@"-O"<`````7<.-M"8`````C;PG````
+M`%6)Y593@^P,BTT(BW4,B?/V1A0!=0JX#P```.G3````#[=&$"7_#P``9HE&
+M((M&%"4``/]_P>@09HE&(L9&)`"+1A2H`G59J`1T!,9&)`'V0Q0(=`2`3B0(
+M]D,4('0$@$XD$/9#%!!T-X!.)`(/ME,5B%8E@[R11!````!T(HU&((E$)`B+
+MA)%$$```B40D!(D,).C\____D(VT)@````"+0Q`E``#P#\'H%(A&)HM#%/;$
+M`70-)0#^``#!Z`F(1B?K!,9&)_^+0Q`E`(`/`,'H#XA&*(M#$"4```#PP>@<
+MB$8IBT,0P>@,)`&(1BJX`````(/$#%M>7<.0D)"0D)!5B>575E.#["R+10B)
+M1?"_`````(M5$`^W0@+VQ`%T!ZF`````ZP^+31`/MT$"P>@'@_`!J`$/A24'
+M``"+71`/MT,"J"!T":A`ZQ20C70F`(MU$`^W1@+!Z`:#\`&H`0^%_`8``,=%
+M[`````"#?10`=!Z+50B+0A2#>A``=0F-D$`1``#MZP:+@$`1``")1>R+30B+
+M012#>1``=0F-D%B```#MZP:+@%B```")1>B%P'4'QT7H`0```(M="(M#%(-[
+M$`!U"XV0!(```.WK"(GVBX`$@```)0````*)1>"+=0B+1A2#?A``=0F-D!!`
+M``#MZP:+@!!````E8`#^`(E%Y(M%$(E$)`2+50B)%"3H_/___[H#````A<`/
+MA*`*``"+31`/MT$")?`!```]T````'1E/=````!_$SV@````=$4]P````'1'
+MZ10&```]4`$``'0B/5`!``!_!SU``0``ZP4]0`D```^%]`4``,=%W`$```#K
+M!\=%W`(```#'1=@!````ZR#'1=P#````ZQ#'1=P$````ZP?'1=P%````QT78
+M`@```(M="(M#%(-[$`!U#HV0`)@``+@'````[^L*QX``F```!P```+L`````
+MD(MU"(M.%(T$6XL4Q0`T``"+==R-!$:+!(4`-```BW4(@WX0`'4*C10*[^L'
+MC70F`(D$"D?WQS\```!U%,<$)`$```#H_/___Y"-M"8`````0X/['G:JNP``
+M``"0C70F`(L,W:`X``"#?10`=`V-@0"`__\]_P\``'8VBT4(BW`4B<J+!-VD
+M.```BTT(@WD0`'4&C10R[^L#B00R1_?'/P```'4,QP0D`0```.C\____0X'[
+M]@```':GBUT(#[>#9`$``"7P````NP````"#^"\/CAH!``"-=@"-O"<`````
+MBW4(BTX4C01;BQ3%P#<``(MUW(T$1HL$A<`W``"+=0B#?A``=0J-%`KOZP>-
+M="8`B00*1_?'/P```'44QP0D`0```.C\____D(VT)@````!#@_L(=JJ[````
+M`)"-="8`BT4(BT@4BQ3=8$(``(L$W61"``"+=0B#?A``=0:-%`KOZP.)!`I'
+M]\<_````=1''!"0!````Z/S___^0C70F`$.#^SIVNKL`````D(UT)@"+10B+
+M2!2-!%N+%(7@2````T78BP2%X$@``(MU"(-^$`!U#8T4"N_K"HVT)@````")
+M!`I']\<_````=13'!"0!````Z/S___^0C;0F`````$.#^S]VJND+`0``D(UT
+M)@"+10B+2!2-!%N+%,4`-P``BW7<C01&BP2%`#<``(MU"(-^$`!U"HT4"N_K
+M!XUT)@")!`I']\<_````=13'!"0!````Z/S___^0C;0F`````$.#^P9VJKL`
+M````D(UT)@"+10B+2!2+%-U@0```BP3=9$```(MU"(-^$`!U!HT4"N_K`XD$
+M"D?WQS\```!U$<<$)`$```#H_/___Y"-="8`0X/[/':ZNP````"0C70F`(M%
+M"(M(%(T$6XL4A>!%```#1=B+!(7@10``BW4(@WX0`'4-C10*[^L*C;0F````
+M`(D$"D?WQS\```!U%,<$)`$```#H_/___Y"-M"8`````0X/[/W:JBT40B40D
+M!(M5"(D4).AX-0``BTT(9H.Y8@$``$$/AK<```"+012#>1``=0Z-D"R8``"X
+M`N`"`._K"L>`+)@```+@`@"+70B+0Q2#>Q``=0Z-D$R9``"X0`P,`._K"L>`
+M3)D``$`,#`"+=0B+7A"+3A2^**(``(7;=0F-D2BB``#MZP:+@2BB```-``(`
+M`(7;=0:-%`[OZP.)!`Z+10B+6!"+2!2^**(``(7;=0F-D2BB``#MZP:+@2BB
+M```E_P/^_PT`"```A=MU!HT4#N_K"HD$#HVT)@````"+51")5"0$BTT(B0PD
+MZ&X=``"Z`P```(7`#X0!!@``BUWPBX,T#```#[=5W(E4)`B+=1")="0$BU4(
+MB10D_U`$N@,```"%P`^$TP4``(M-$/9!`D!T#XE,)`2+70B)'"3H"QP``(MU
+M$(ET)`2+10B)!"3HB1<``+H#````A<`/A)P%``"#?10`=!Z+30B+412+1>R#
+M>1``=0F!PD`1``#OZP:)@D`1``"+70B+4Q2+=?`/MH[D"P``#[:&Y0L``,'@
+M"`G!#[:&Y@L``,'@$`G!#[:&YPL``,'@&`G!@WL0`'4+@<(`@```B<COZP:)
+MB@"```"#?0P!=&:#?0P!<CJ#?0P&=`N#?0P(='OIL0```(M5"(M*%(M=\`^V
+M@^D+``#!X`@/MI/H"P``"=`+1>`-``"!"(MU".M'BT4(BT@4BU7P#[:"Z0L`
+M`,'@"`^VDN@+```)T`T``(((BUT(ZTN+=0B+3A2+5?`/MH+I"P``P>`(#[:2
+MZ`L```G0#0``@`B#?A``ZRB+70B+2Q2+=?`/MH;I"P``P>`(#[:6Z`L```G0
+M"T7@#0``@`"#>Q``=0F-D02```#OZQ*)@02```#K"KH,````Z54$``"+50B+
+M0A2#>A``=0Z-D."```"X_____^_K"L>`X(```/____^+30B+012#>1``=0Z-
+MD.2```"X_____^_K"L>`Y(```/____^+=0B+7A"+3A2^$$```(7;=0F-D1!`
+M``#MZP:+@1!````+1>2%VW4&C10.[^L#B00.BT4(BU`4BT7HBTT(@WD0`'4)
+M@<)8@```[^L&B8)8@```BUT(BU,4BW7P#[:.Z@L```^VANL+``#!X`@)P0^V
+MANP+``#!X!`)P0^VANT+``#!X!@)P8-[$`!U"X'""(```(G([^L&B8H(@```
+MBU4(BTH4BUWP#[:#[PL``,'@"`^VD^X+```)T(MU"(-^$`!U"8V1#(```._K
+M!HF!#(```(M5"(M"%(-Z$`!U#HV0@````+C_____[^L*QX"`````_____XM-
+M"(M!%(-Y$`!U#HV0&(```+@`!P``[^L*QX`8@`````<``(M=\(N#-`P``(MU
+M$(ET)`2+50B)%"3_$+H#````A<`/A,\"``"+30B+012#>1``=0F-D%B```#M
+MZP:+@%B```"+7?"(@R0-``!FQX,F#0````"+=0B+1A2#?A``=0F-D`BB``#M
+MZP:+@`BB``#!Z`V#X`&+5?")@B`-``"+30B+012#>1``=0Z-D!R8``"X`0``
+M`._K"L>`')@```$```"+70B+0Q2#>Q``=0F-D!29``#MZP:+@!29```E_S\`
+M`(MU$/9&`B!T%8T4A0````"XHXLNNO?BB=#!Z`3K#+K-S,S,]^*)T,'H`X/`
+M9(D$).C\____BT4(BU@0BT@4OF"8``"%VW4)C9%@F```[>L&BX%@F```@\@#
+MA=MU!HT4#N_K`XD$#HM5$`^W0@(EH````#V@````='.+30B+61"+212^()D`
+M`(7;=0F-D2"9``#MZP:+@2"9```-`/```(7;=0:-%`[OZP.)!`Z+10B+6!"+
+M2!2^()D``(7;=0F-D2"9``#MZP:+@2"9```-```!`(7;=0:-%`[OZP.)!`Z+
+M5?#'@NP,```!````NP````"^`0```(VT)@````"-O"<`````BTT(BWD4C12=
+M`!```(GPB-G3X(M-"(-Y$`!U!HT4.N_K`XD$.D.#^PE^U;L`````B5PD!(MU
+M"(DT).C\____0X/["7[KBT7PQX#P"P``90D(`(-]#`9U"L>`\`L``&49"`"+
+M30B+412+7?"+@_`+``"#>1``=0F!PJ````#OZP:)@J````"+=0B+7A"+3A2^
+MK````(7;=0F-D:P```#MZP:+@:P````-```'`(7;=0:-%`[OZP.)!`Z+10B)
+M!"3H_/___X7`=`N+50B)%"3H_/___\=$)`P`````QT0D"`$```#'1"0$8)@`
+M`(M-"(D,).C\____BW4(BUX0BTX4OB"```"%VW4)C9$@@```[>L&BX$@@```
+M)?__?_Z%VW4&C10.[^L#B00.N`$```#K#XM%&(,X`'0"B1"X`````(/$+%M>
+M7UW#B?:-O"<`````58GE@^P(QT0D!`(```"+10B)!"3H)P0``(GL7<.-=@!5
+MB>6#[!2)7?R+70C'1"0,`````,=$)`@!````QT0D!`(```")'"3H_/___[H`
+M````A<!T&\=$)`03````B1PDZ-L#``")PHGVC;PG`````(G0BUW\B>Q=PXVT
+M)@````!5B>6#[!B)7?B)=?R+70B+=0S'1"0$$P```(D<).B>`P``N@````"%
+MP`^$P0$``,=$)`P`````QT0D"`$```#'1"0$`@```(D<).C\____N@````"%
+MP`^$E`$``,=$)`0`````B1PDZ%0#``"Z`````(7`#X1W`0``A?8/A&,!```/
+MMT8")>`!```]P`````^$W@```#W`````?Q`]H`````^$B0```.DX`0``/4`!
+M```/A2T!``"+0Q2#>Q``=0Z-D'R8``"XJ@```._K"L>`?)@``*H```#'!"0L
+M`0``Z/S___^+0Q2#>Q``=0Z-D`"B``"X`````._K"L>``*(```````"+4Q2Y
+M!)@``/9&`A`/E<`/ML"-!$"#>Q``=0@!RN_IO````(D$$>FT````BT,4@WL0
+M`'4.C9`$F```N`````#OZPK'@`28````````BT,4@WL0`'4-C9``H@``N`,`
+M``#K0\>``*(```,```#K1(M3%+D$F```]D8"$`^5P`^VP(T$0(-[$`!U!0'*
+M[^L#B001BT,4@WL0`'4.C9``H@``N`8```#OZPK'@`"B```&````BT,4@WL0
+M`'4.C9!\F```N*L```#OZPK'@'R8``"K````QP0D+`$``.C\____N@$```"-
+MM"8`````B="+7?B+=?R)[%W#C70F`%6)Y5=64X/L&(M="(MU#(G9@[OL#```
+M``^$`@$``(M#%(-[$`!U"8V0()D``.WK!HN`()D``*D```$`#X7?````QX'L
+M#````````(M#%(-[$`!U#(V0$)P``.WK"8UV`(N`$)P``(E%[(M#%(-[$`!U
+M#HV0%)P``.WK"Y"-="8`BX`4G```B<&+0Q2#>Q``=0^-D!B<``#MB<?K"HUT
+M)@"+N!B<``"+1>S1Z(G*T>H!T,'I!HG"P>H'=&6%R71A]]^)^(G7F??_@^`_
+MB47DBT7LF??YB<&#X1^)3?"+>Q")?>B+2Q2%_W4+C9$@F0``[8G"ZP:+D2"9
+M``"+1>3!X`4)T`M%\`T`"```@WWH`'4)C9$@F0``[^L'B8$@F0``D(ET)`2)
+M'"3H-`4``(7`=#")="0$B1PDZ)0%``"%P'4XQP0DB!,``.C\____B70D!(D<
+M).AX!0``A<!U'(UT)@#V1@(@=0L/MT8"@\@"9HE&`K@`````ZS@/MT8"J"!U
+M("7`````/<````!T%(D<).A\)P``C;8`````C;\`````N`$```"-="8`C;PG
+M`````(/$&%M>7UW#D(VT)@````!5B>575E.#[!"+=0B+70R%VP^5P`^VP$B)
+MWPG'BT84@WX0`'4+C5`,[>L(D(UT)@"+0`R+5A2)V(-^$`!U"8'"`$```._K
+M!HF:`$```,<$)`\```#H_/___X/C`XE<)`R)^(/@`XE$)`C'1"0$`$```(DT
+M).C\____B<'VPP%U((M&%(-^$`!U"XU0%+@`````[^L,QT`4`````)"-="8`
+MB<B#Q!!;7E]=PXVV`````%6)Y5=64X/L#(M%"(E%\(M5#(E4)`2)!"3H_/__
+M_[H`````A<`/A*4!``"+50P/MT("B40D!`^W`HD$).C\____F(M-#(!Y`@`/
+MB90```"-'$#!XP*-LV18``#'1"0$"````(M&!(D$).C\____B<>!Y_\```#!
+MYP6+@V18``#!X`0)QP^_=@B+10B+4!2#>!``=0N!P@2B``#MB<+K!HN2!*(`
+M`(M-#&:!.;0)=0V+10B+6!2)T8/)$.L.BTT(BUD4B=&#X>^+10B#>!``=0N-
+MDP2B``")R._K#XF+!*(``.L'B<:_`````&:!_I``?PCWQ@$```!T(L=$)`0(
+M````C4;HB00DZ/S___^)PX'C_P```+@!````ZS7'1"0$"````(U&Z(G"P>H?
+M`=#1^(D$).C\____B<.!X_\```"X`````(VV`````(V_`````,'C`@'`"<.!
+MRP$$``"+30B+412)^8'A_P```,'A"`^VPPG!BT4(@W@0`'4+@<*<F```B<CO
+MZP:)BIR8``"+30B+412)^8'A`/\```^VQPG!BT4(@W@0`'4+@<+0F```B<CO
+MZP:)BM"8``"+50R+`HM-\(F!]`L``+H!````C78`B="#Q`Q;7E]=PXVV````
+M`%6)Y8/L",=$)`1)#@``BT4(B00DZ/S___^X`````(GL7<.-M"8`````C;PG
+M`````%6)Y8M%"(M0%(-X$`!U"8'"9)@``.WK!HN"9)@``,'H$R7_`0``]L0!
+M=`4-`/[__UW#C;0F`````(V\)P````!5B>575E.#[!B+?0@/MD4,B$7D#[]%
+M$(E%X(MW$(M?%(7V=0F-DV28``#MZP:+@V28``")P8'A`/#__P^V1>3!X`DE
+M``X```G!BT7@)?\!```)P87V=0N-DV28``")R._K!HF+9)@``(M?$(M/%+Y@
+MF```A=MU"8V18)@``.WK!HN!8)@``(/(`H7;=0:-%`[OZP.)!`Z^.````(!]
+MY`!T$@^V=>2-!/4`````*?")QL'F";L`````D(VT)@````"+1Q2#?Q``=0F-
+MD&"8``#MZP:+@&"8``"H`G00B30DZ/S___]#@_L[?M;K%(/[.WX6ZPV0D)"0
+MD)"0D)"0D)"0N`````#K"8D\).BQ_O__F(/$&%M>7UW#D(VT)@````!5B>6+
+M31"+50B+10P/MT`")>`!```]P````'0T/<````!_#3V@````=!;K-(UT)@`]
+M0`$``'4I#[>"T@(``.LG#[>"U`(``.L>C;0F``````^W@M8"``#K#HVT)@``
+M``"X`````.L(9HD!N`$```!=P^L-D)"0D)"0D)"0D)"0D%6)Y8/L%(E=_(M=
+M"(M#%(-[$`!U"XV08)@``.WK"(GVBX!@F```N@$```"H`G4QC47ZB40D"(M%
+M#(E$)`2)'"3H.____[H`````A<!T$HD<).C*_?__9CM%^@^>P`^VT(G0BUW\
+MB>Q=PXVT)@````!5B>6#[!B)7?B)=?R+=0B+70R#OEP!```#=V6)7"0$B30D
+MZ/S___^%P'15C47VB40D"(E<)`2)-"3HTO[__[H`````A<!T<;L`````C70F
+M`,=$)`@`````#[:#J%D``(E$)`2)-"3HA?W__T.#^P)VWX/[`P^6P`^VT.L\
+MC70F`(M>$(M.%+Y@F```A=MU"8V18)@``.WK!HN!8)@``(/(`H7;=0N-%`[O
+MZPB0C70F`(D$#KH!````B="+7?B+=?R)[%W#C;8`````C;\`````58GE5U93
+M@>R0````BWT(#[=%$(E%H(E]G+X`````BU4,#[="`B7P`0``/<`````/A)T!
+M```]P````'\0/:`````/A!<!``#I]P$``#U``0``=`L]4`$```^%Y0$``(M-
+M#`^W`2VA#P``9CWJ!'<9BT6<#[>`.`,``(E%B(M5G`^WDCH#``#K=8M-#`^W
+M`2V,%```9CWO`'<9BT6<#[>`/`,``(E%B(M5G`^WDCX#``#K2XM-#`^W`2U\
+M%0``9CW@`'<9BT6<#[>`0`,``(E%B(M5G`^WDD(#``#K(8M-#&:!.5P6=AR+
+M19P/MX!$`P``B46(BU6<#[>21@,``(E5A.L.QT6$`````,=%B`````#'18``
+M````QX5\____`````(M-G`^WB=X"``")39B+19P/MX#D`@``B464BU6<9H.Z
+MY`(````/E,`/ML")19`/MXHR`P``B4V,Z?(```"+19P/MX!(`P``B46(BU6<
+M#[>22@,``(E5A(M-G`^WB5`#``")C7S___^+19P/MX!4`P``B46`BU6<#[>2
+MX`(``(E5F(M-G`^WB>8"``")392+19QF@[CF`@````^4P`^VP(E%D(M5G`^W
+MDC0#``")58SK?HM-G`^WB4P#``")38B+19P/MX!.`P``B46$BU6<#[>24@,`
+M`(F5?/___XM-G`^WB58#``")38"+19P/MX#B`@``B468BU6<#[>2Z`(``(E5
+ME(M-G&:#N>@"````#Y3`#[;`B460#[>!-@,``(E%C.L-N`````#I6P0``(UV
+M`+L`````ND!$``"-M@````"-!%N+3:"-!$&+!(*)1)VD0X/[$';JBT4,@'@"
+M`'EAQT0D$`````#'1"0,=P```,=$)`@#````BY5\____B50D!(U=I(D<).A$
+M!```QT0D$`````#'1"0,>@```,=$)`@#````BTV`B4PD!(D<).@=!```C;8`
+M````C;PG`````+L`````C70F`(V\)P````"+3Q2-!%N+%,5`1```BT2=I(-_
+M$`!U"8T4"N_K!HUV`(D$"D;WQC\```!U%,<$)`$```#H_/___Y"-M"8`````
+M0X/[$':ZNP````"0C70F`(M/%(L4W>!+``"+!-WD2P``@W\0`'4)C10*[^L&
+MC78`B00*1O?&/P```'44QP0D`0```.C\____D(VT)@````!#=+V[`````)"-
+MM"8`````BT\4C01;BQ3%\$L``(F5>/___XM5H(T$0HL$A?!+``"#?Q``=0L#
+MC7C___^)RN_K"8N5>/___XD$"D;WQC\```!U#<<$)`$```#H_/___Y!#=*V[
+M`````)"-M"8`````BT\4C01;BQ3%($P``(F5>/___XM5H(T$0HL$A2!,``"#
+M?Q``=0L#C7C___^)RN_K"8N5>/___XD$"D;WQC\```!U#<<$)`$```#H_/__
+M_Y!#=*V[`````+I@3```C78`C01;BTV@C01!BP2"B42=I$.#^Q!VZHM5#`^W
+M0@(E0`$``#U``0``=6?'1"00`P```,=$)`PS````QT0D"`$```"+39P/MX&P
+M`P``B40D!(U=I(D<).A&`@``QT0D$`,```#'1"0,+0```,=$)`@!````BU6<
+M#[>"L@,``(E$)`2)'"3H&`(``)"-M"8`````QT0D$`````#'1"0,7P```,=$
+M)`@!````BTV0B4PD!(U=I(D<).CF`0``QT0D$`````#'1"0,8````,=$)`@$
+M````BT68B40D!(D<).B_`0``QT0D$`````#'1"0,:````,=$)`@#````BU6(
+MB50D!(D<).B8`0``QT0D$`````#'1"0,:P```,=$)`@#````BTV$B4PD!(D<
+M).AQ`0``NP````"-M@````"-OP````"+3Q2-!%N+%,5@3```BT2=I(-_$`!U
+M"8T4"N_K!HUV`(D$"D;WQC\```!U%,<$)`$```#H_/___Y"-M"8`````0X/[
+M$':ZNP````"Z8%4``(T$6XM-H(T$08L$@HE$G:1#@_L'=NK'1"00`````,=$
+M)`P=````QT0D"`8```"+18R)1"0$C5VDB1PDZ-````#'1"00`````,=$)`P$
+M````QT0D"`$```"+592)5"0$B1PDZ*D```"[`````(UT)@"+3Q2-!%N+%,5@
+M50``BT2=I(-_$`!U"8T4"N_K!HUV`(D$"D;WQC\```!U%,<$)`$```#H_/__
+M_Y"-M"8`````0X/[!W:ZBTV<QX'T#````````+@!````@<20````6UY?7<.-
+MM@````"-O"<`````58GE@^P(QT0D!$D.``"+10B)!"3H_/___[@`````B>Q=
+MPXVT)@````"-O"<`````58GE5U93@^P4BW40BUT4B70D!(M%#(D$).C\____
+MB47PC7O_P>\#2X/C!X7V?G6+11C!X`.)1>R0C;0F`````(T,'H/Y"'X%N0@`
+M``"Z`0```-/B2K@!````B-G3X$@QP@^V3>S3XHG1]]&+10@C#+B)3>B+1?"(
+MV=/@#[9-[-/@(=`+1>B+50B)!+J-=#/XN0@````IV=-M\+L`````1X7V?YR#
+MQ!1;7E]=PXUT)@!5B>575E.#[$"+?0B)_HM%#`^W0`+!Z`>#X`&)1>B+50P/
+MMT(")?`!```]T`````^$FP```#W0````?Q<]H````'1]/<`````/A((```#I
+MC0```#U0`0``=!4]4`$``'\'/4`!``#K!3U`"0``=7''1?``````BT\0B4WD
+MBU\4A<EU"8V31)D``.WK!HN#1)D``(G!@^''#[>&M`,``,'@`X/@.`G!@WWD
+M`'4+C9-$F0``B<COZSF)BT29``#K,9#'1?`!````ZR>-M"8`````QT7P`@``
+M`.L7C;0F`````+@`````Z7X#``"-M@````"+5Q")5>"+7Q2%TG4)C9,0F0``
+M[>L&BX,0F0``B<&!X0;\__^+5?`/MX16Z@(``,'@!`G!@\D!@WW@`'4+C9,0
+MF0``B<COZP:)BQ"9``"+50R)5"0(BX;H#```B40D!(D\).C\____BU<4BTWP
+M#[^$3M("```E_P$```T``@``@W\0`'4+@<)HF0``[^L(B?:)@FB9``"+1Q")
+M1=R+7Q2#?=P`=0N-DT28``#MZPB)]HN#1)@``(G!@>%_P/__BU7P#[>$5J@"
+M``#!X`<E@#\```G!@WW<`'4+C9-$F```B<COZP:)BT28``"+5Q")5=B+7Q2%
+MTG4)C9-(F```[>L&BX-(F```B<&!X?\/_/^+5?`/MX16K@(``,'@#"4`\`,`
+M"<&#?=@`=0N-DTB8``")R._K!HF+2)@``(M7$(E5U(M?%(72=0F-DU"8``#M
+MZP:+@U"8``")P8'A``#__XM5\`^^A!;/`@``P>`()0#_``")1<`/MI06S`(`
+M``G0"<&#?=0`=0N-DU"8``")R._K!HF+4)@``(M?%(M5\`^WC%;``@``P>$8
+M#[>$5L`"``#!X!`)P0^WE%;&`@``B=#!X`@)P0G1@W\0`'4+C9,TF```B<CO
+MZP:)BS28``"+5Q")5="+7Q2%TG4)C9,HF```[>L&BX,HF```B<&!X?\`__^+
+M5?`/MX16M`(``,'@"`G!@WW0`'4+C9,HF```B<COZP:)BRB8``"+5Q")5<R+
+M7Q2%TG4+C9-DF```[>L(B?:+@V28``")P8'A_P_X_XM5\`^WA%:Z`@``P>`,
+M)0#P!P`)P8-]S`!U"XV39)@``(G([^L&B8MDF```QT7L`@```&:!OH`"```"
+M,'<:9H%_"B(0=3R+50SV0@)`=#/'1>P(````ZRJ+30P/MP&#X!]FA<!T'(/H
+M"F:#^`QV$XM5\`^WA%8L`P```47LD(UT)@"+3Q")3<B+7Q2%R74)C9,DF0``
+M[>L&BX,DF0``B<&!X0'___^+1>P!P"7W````"<&#?<@`=0N-DR29``")R._K
+M!HF+))D``(M7$(E5Q(M?%+\@F0``A=)U"XV3()D``.V)PNL&BY,@F0``BTWH
+M#[>$3IH#``#!X`6)T0G!BU7H#[>$5IX#```)P8')``@``(-]Q`!U"XT4'XG(
+M[^L&C78`B0P?N`$```"#Q$!;7E]=PU6)Y5=64X/L!(M5#/9"`A`/E<`/ML!(
+M@^#8C82`D`$``,'@&(G#T>L/MQ*)V(G1N@````#W\8G#OA\```"-=@")V(GQ
+MT^BH`74#3G7SN"8````I\(G&N!<```")PBGRN`$```"(T=/@C008NA@```")
+MTRGSB<>(V=/O@^X0B77PBT4(BW`0BU@4A?9U"8V3%)@``.WK!HN#%)@``(G!
+M@>'__P$`B?C!X!$)P87V=0N-DQ28``")R._K!HF+%)@``(M-"(MQ$(M9%+\4
+MF```A?9U"8V3%)@``.WK!HN#%)@``(G!@>'_'_[_BT7PP>`-)0#@`0`)P87V
+M=0B-%!^)R._K`XD,'X/$!%M>7UW#C78`58GE5U93@>S`````BWT(BW4,B;U,
+M____QT0D!(````"-A73___^)!"3H_/___\=$)`0@````C9U4____B1PDZ/S_
+M__^-A5#___^)1"04C852____B40D$(N'^`P```^WA`"L60``B40D#(ET)`B)
+M7"0$B3PDZ%8'``"Z`````(7`#X1Y`@``BX5,____BY`T#```B70D$(V%4/__
+M_XE$)`R-A5+___^)1"0(C85T____B40D!(D\)/]2"+H`````A<`/A#@"``!F
+M@[]B`0``07=>#[=&`B7`````/<````!U3HN53/___P^VBJ`"``"Z9V9F9HG(
+M]^K1^HG(P?@?*<*)5"0,C85T____B40D"(V%5/___XE$)`2)/"3H3PH``.L-
+MD)"0D)"0D)"0D)"0D+D`````C70F`(V\)P````"+=Q2-'(V`H0``#[>4C7;_
+M___!XAB!R@``_P`/MX2-=/___\'@"`W_````)?__```)T(-_$`!U"(T4,^_K
+M!8GVB00S08/Y'WZWBU<4#[>-6O___X/A/\'A&`^WA5C___^#X#_!X!`)P0^W
+MA5;___^#X#_!X`@)P0^WA53___^#X#\)P8-_$`!U"X'"-)D``(G([^L&B8HT
+MF0``BU<4#[>-8O___X/A/\'A&`^WA6#___^#X#_!X!`)P0^WA5[___^#X#_!
+MX`@)P0^WA5S___^#X#\)P8-_$`!U"X'".)D``(G([^L&B8HXF0``BU<4#[>-
+M:/___X/A/\'A&`^WA6;___^#X#_!X!`)P0^WA7+___^#X#_!X`@)P0^WA63_
+M__^#X#\)P8-_$`!U"X'"-*(``(G([^L&B8HTH@``BU<4#[>-</___X/A/\'A
+M&`^WA6[___^#X#_!X!`)P0^WA6S___^#X#_!X`@)P0^WA6K___^#X#\)P8-_
+M$`!U"X'".*(``(G([^L&B8HXH@``BT<4@W\0`'4.C9`\F0``N#P```#OZPK'
+M@#R9```\````N@$```"-M@````"-O"<`````B="!Q,````!;7E]=PXUV`%6)
+MY5=64X'L1`$``(M5",>%T/[__P````#'A<S^__\_````BTT8#[=!`B7P`0``
+M/=````!T>CW0````?Q,]H````'1*/<````!T9>F"````/5`!``!T%3U0`0``
+M?P<]0`$``.L%/4`)``!U9@^W@LH#``!FB878_O__C8*V`P``B874_O__C8+,
+M`P``ZU(/MX+4!0``9HF%V/[__XV"W`4``(F%U/[__XV"?@8``.LP#[>"U`4`
+M`&:)A=C^__^-@M8%``")A=3^__^-@N(%``#K#K@`````Z4D#``"-="8`B87<
+M_O__C;W4_O__QT0D!`@!``"-A>3^__^)!"3H_/___[X!````NP````"-="8`
+M9HFT7>S^__]&0X/^/W[Q9HF=ZO[__V;'A>;^__\!`&;'A>C^__\_`+L`````
+M9H.]ZO[__P!T.XGVC;PG`````(E\)`@/MX1=[/[__XE$)`2+=1@/MP:)!"3H
+M,@L``&:)A%UL____0P^WA>K^__\YPWS.#[^5;/___P^WA>K^__\/OXQ%:O__
+M_[L`````.<,/C9L```"-="8`C;PG`````&8YE%UL____?Q$/OY1=;/___P^W
+MPXF%T/[__P^WA>K^__\IV$@/M_"%]G0N#[>$=6K___]F.X1U;/___WX0#[>$
+M=6S___]FB81U:O___T,/MX7J_O__.<-\IKL`````9H.]ZO[__P!T)P^WA>K^
+M__]F.8Q=;/___WX1#[^,76S___\/M_.)M<S^__]#.<-\X(U:&;D?A>M1B=CW
+MZ<'Z!(G8P?@?*<*-%)*-%)(!T@^_VK\`````O@````")V/?IP?H$B=C!^!^)
+MP2G"B=!`.<=]/+H?A>M1B=CWZL'Z!"G*0HF5R/[__XGVC;PG`````(GZC4<!
+M#[?XBX70_O__BTT,9HD$448[M<C^__]\XKX`````#[>%ZO[__XG"9CF<16K_
+M__\/CAP!``!F@_\_#X<\`0``C;8`````C;\`````C4,R#[_8B97(_O__9CF<
+M56K___]^;`^_A'5L____B=HIPHF5Q/[__P^_E'5N____B=DIT8N%Q/[__P^O
+MP87`?D'K#9"0D)"0D)"0D)"0D)!&BX7(_O__9CF<16K___]^(0^_A'5L____
+MB=HIPHG0#[^4=6[___^)V2G1#Z_!A<!_S@^WA'7N_O__`<`/M\")1"00#[>$
+M=>S^__\!P`^WP(E$)`P/MX1U;O___XE$)`@/MX1U;/___XE$)`0/M\.)!"3H
+MB08``$`/M\#1Z(M5#&:)!'J+C<S^__]F.<AV!&:)#'J-1P$/M_@/MY7J_O__
+M9CF<56K___]^#&:#_S\/AOS^___K*F:#_S]W)(UT)@"+50P/MT1Z_F:)!'J-
+M1P$/M_AF@_\_=NB0C;0F`````+@!````@<1$`0``6UY?7<-5B>6#[`C'1"0$
+M20X``(M%"(D$).C\____N`````")[%W#C;0F`````(V\)P````!5B>564XMU
+M#(M-"+H`````9H.Y6`,```!T.P^WF5@#``#K#9"0D)"0D)"0D)"0D)`/MX11
+M6@,``#GP=12)T,'@!HV$"*0'``#K$(VV`````$(YVGS;N`````!;7EW#B?95
+MB>575E.#[$R+70R+?1`/MT44B470BW4(B7PD!(DT).C\____`<`/M\")1<R+
+M51QFQP+._XM-&&;'`3(`B7PD!(DT).C\____B$7"#[;`B40D!(DT).A%____
+MQT7(/````(7`=!6)1"0$#[<'B00DZ%L$```/M\")1<@/MT<")<````"+5<B)
+M5<0]P````'4_@&7"_(!-P@$/MD7"B40D!(M-"(D,).CT_O__QT7$/````(7`
+M=!F)1"0$#[<'B00DZ`H$```/M\")1<2-="8`]D<#`70*#[:&G`(``.L(D`^V
+MAIT"```/OL")1"0(B7PD!(M%"(D$).C\____B$7##[=7`HG0)<`````]P```
+M`'0NB=`E0`$``#U``0``="")T"50`0``/5`!```/A3T!``"-M"8`````C;PG
+M``````^W1P(EP````#W`````=2B-1>2)1"00#[>&;`<``(E$)`R-AFX'``")
+M1"0(B7PD!(M5"(D4).LFC47DB40D$`^WAAH'``")1"0,C88<!P``B40D"(E\
+M)`2+30B)#"3HC00``(M%R&8[1>IV!`^W1>IFB0/V1P(0="=F@;Z``@```#!V
+M'`^WEHX"``!F.<)V`HG"9HD3C70F`(V\)P`````/MQ,/OD7#BTW,*<&)R#G1
+M?@*)T`^_T(M%T`'`*<(/O]*)T&:%TG\(N`$```"-=@!FB0-FB4,(9HE#!F:)
+M0P1FB4,"BU7H9CG"=@*)PF:)4PH/MT7F9CL#=@,/MP-FB4,,BU7D9CL3=@,/
+MMQ-FB5,.#[<#9HE#'HM%&&:)$`^W`XM5'&:)`@^W`XF&_`P```^W5P*)T"7`
+M````/<````!T$HG0):`````]H`````^%W0```(U%U(E$)!`/MX:,!P``B40D
+M#(V&C@<``(E$)`B)?"0$BTT(B0PDZ'(#``"+1<1F.T7:=@0/MT7:9HE#$`^W
+MT`^^1<.+3<PIP8G(.=%^`HG0#[_0BT70`<`IP@^_THG19H72?PFY`0```(UT
+M)@!FB4L0BT789CG(=@*)R&:)0Q)FB4,4#[=%UF8[0Q!V!`^W0Q!FB4,69HE#
+M&(M-U&8[2Q!V!`^W2Q!FB4L:9HE+'`^WT8M%&`^_`#G"?0:+51AFB0H/MU,2
+MBTT<#[\!.<)^#@^W0Q)FB0&-M"8`````#[='`B6@````/:````!U$`^W0Q")
+MAOP,``"-M@````"X`0```(/$3%M>7UW#C78`58GE5U93@^PLBWT,QT0D""``
+M``"-1=2)1"0$B3PDZ/S___^["````)"-M"8`````#[=$7=2#Z`]FB41=U+D`
+M````O@````")]HV\)P````!F@WQ=U`!Y"&;'1%W4``"09H/Y"'4*N0\```#K
+M2XUV``^_5%W4#[<$3SG"=35F@SQ/`'0&9H/^,G8(#[=$7=1`ZPX/MT1=U$B0
+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___\YP7(;#[="_HT$@(T$@(T$A0H````Y
+MP78@#[="_NL##[<#9HD&9HD'ZV\/MP-FB0</MT,"9HD&ZV`YTW-<C;8`````
+MC;\`````#[<#C02`C02`P>`"*<AY$/?8C;0F`````(V\)P````"#^`E^L0^W
+M0P*-!("-!("-!(7V____.<%RIX/#`CG3<K_K#9"0D)"0D)"0D)"0D)!;7E]=
+MPXUT)@"-O"<`````58GE5U93@^P4BT40#[=]"`^W=0R+4`BY``````^W0`2)
+MPSG!?1>-=@"-O"<`````9CDR=`B#PC1!.=E\\XM%&(E$)!"+112)1"0,#[="
+M!HE$)`B-0@B)1"0$B3PDZ+[^__^#Q!1;7E]=PXVV`````%6)Y8M%"(V(R`L`
+M`(L5Q%D``(F0R`L``(T$U0`````IT(T$A<A9``")01C'010!````QT$,%```
+M`,=!$",```!=PXVT)@````"-O"<`````58GE@^P,B1PDB70D!(E\)`B+50R+
+M10@%]`L``/9``B!T)+\`````NQP```"Y0````+YR````QT(,`````,="$'<`
+M``#K(K\`````NS(```"Y`````+XR````QT(,%````,="$",```"+4@2X````
+M`#GZ<@0YVG8-.<IR!#GR=@6X`0```(L<)(MT)`2+?"0(B>Q=PXVV`````(V_
+M`````%6)Y8M-"(M1%(N!_`P``,'@"24`?@``#0"```"#>1``=0Z!PC"9``#O
+MZPN0C70F`(F",)D``,>!]`P```$```!=PXVT)@````"-O"<`````58GE@^P4
+MB5WTB77XB7W\BWT(B?N-M\@+``"#?A0`=1"X`````.F<````C;8`````@[_T
+M#````0^%@P```(M'%(-_$`!U"XV0,)D``.V)PNL&BY`PF0``B=`E`(#__V:%
+MP'5=B=#!Z!F)1@3'@_0,````````B70D!(D\).B/_O__A<!U.XET)`2)/"3H
+M3P```(7`="N)="0$B3PDZ%\```"%P'X;B70D!(D\).B/`0``QX/T#````@``
+M`)"-="8`BX/T#```BUWTBW7XBWW\B>Q=PXVV`````(V\)P````!5B>6+30RX
+M`````(M1!#M1#'8%.U$0<@6X`0```%W#D%6)Y593BUT,@WL4`'0BBP.-%,4`
+M````*<*-%)7(60``B5,8BT,$.T,0<G6#.P!U$+C_____Z?8```"-M@````"+
+M0P2)0P@[0Q!R18,[`'1`BP-(B0.-%,4`````*<+!X@*+2QB+@M!9```K00@!
+MP(M+""G!B4L(@<+(60``B5,8.TL0<@N#.P!UQHVV`````+@!````Z98```"-
+MM@````"+0P0[0PQW?Z'`60``2#D#=0ZX_O___^MWC;0F`````(M#!(E#"#M#
+M#'=5H<!9``!(.0-S2XG&B?:-O"<`````BP-`B0.-%,4`````*<+!X@*+2QB+
+M@M!9```K00@!P(M+""G!B4L(@<+(60``B5,8.TL,=PLY,W+'C;0F`````+@"
+M````ZPFX`````(UT)@!;7EW#C;8`````C;\`````58GEBTT(BU4,@WH4`'0W
+MBT(8#[<`9HF!M`,``(M"&`^W0`)FB8&R`P``BT(8#[=`!&:)@;`#``"+0A@/
+MMT`&9HF!K@,``%W#D(VT)@````!5B>575E.#[#B+10SV0`(0#Y3`#[;`2(/@
+MXH/`((E$)`2+50B)%"3H_/___XG&OP````!F@S@`=&R-M"8`````BTT(BTD0
+MB4WPBT4(BT`4B47L#[9$_B:-'(4`AP``QT0D$``````/MD3^*8E$)`S'1"0(
+M#@```(ET)`2+50B)%"3H_/___P^WP(-]\`!U"(M5[`':[^L&BTWLB00+1P^W
+M!CG'?)N+10SV0`(0#X4>`0``QT0D!`0```"+50B)%"3H_/___XG&OP````!F
+M@S@`#X3Z````C78`C;PG``````^V1/XFC02%`(<``(E%Z(M-"(M)$(E-Y(M%
+M"(M`%(E%X(M5Z(E5W,=$)!``````#[9$_BF)1"0,QT0D"`X```")="0$BTT(
+MB0PDZ/S___\/M\"#?>0`=0F+5>`#5>COZPF+5>"+3=R)!!&`?/XG`'1O#[9$
+M_B>+50B+4A")5=B+30B+212)3=2+5>B-!(*)1=#'1"00`0````^V1/XIB40D
+M#,=$)`@.````B70D!(M-"(D,).C\____#[?`@WW8`'4)BU74`U70[^L5BU74
+MBTW0B001C;8`````C;\`````1P^W!CG'#XP4____C70F`(/$.%M>7UW#D)"0
+MD)"0D)!5B>575E.#[!"+?0B+A_`+```E____?XE$)`2)/"3H_/___XE%\(M'
+M%(-_$`!U!HU0,.WK`XM`,(G"B<.!X_`#``#!ZP2)WH-]#`!T$[@E````*=C1
+MZ(TT&.L5D(UT)@"#^P%V"TZ-=@"-O"<`````.=YT,HM'%(E%[(G1@>$/_/__
+MB?#!X`0E\`,```G!@W\0`'4,BU7L@\(PB<COZP>0BT7LB4@PBT7PB40D!(D\
+M).C\____.=X/E<`/ML"#Q!!;7E]=PXUT)@"-O"<`````58GE4XM=#(M5"(/[
+M`G0A@_L"=PR#^P%T+.M6D(UT)@"#^P-T$H/[!'04ZT6-="8`N0D```#K0;D(
+M````ZSJY`0```.LSN0````"-M@````")R,'@!(.\`CP,````=`9!@_D)?NNX
+M_____X/Y"G1/ZP>X_____^M&B<C!X`2)G`(\#```@WT0`'0-N`$```#3X`F"
+M.`P``(G(P>`$`=#'@$`,````````QX!$#````````,>`2`P```````")R%M=
+MP^L-D)"0D)"0D)"0D)"0D%6)Y8M-#(M5"+@`````@_D)=TV)R,'@!(.\`CP,
+M````=0ZX`````.LWC;0F`````(G(P>`$QX0"/`P```````"X_O___]/`(8(X
+M#```N`$```"-M"8`````C;PG`````%W#C;0F`````(V\)P````!5B>575E.#
+M[!"+?0B-E_0+``"X`````(-]#`D/A\0#``"+10S!X`2-M#@\#```@SX`#X2I
+M`P``@[\(#0```'4TA=)T'`^W0@(EH````#V@````=0S'AP`-```?````ZPK'
+MAP`-```/````QX<$#0```@```(N'!`T```-&!(E%\+L!````.Y\`#0``<Q^+
+MEP`-``"-M@````"-O"<`````C00;B<.#RP$YTW+T@WX(`'D.BTX(]]G3Z^L1
+MD(UT)@`/MDX(C4,!B</3XTNX_P,``(-^#`!Y"8M.#/?9T^CK"@^V3@R-0`'3
+MX$B+50B+4A2)5>R+30R-%(U`$```B=F!X?\#``#!X`HE`/P/``G!BT7PP>`4
+M)0``\`\)P8M="(-[$`!U"`-5[(G([^L&BUWLB0P:@[\,#0```'05BX\0#0``
+M@_D/=@6Y#P```(E-Z.L,N00```#'1>@$````BT4(BU@4BT4,C12%@!```,'A
+M!('A\````(M%Z(/@#PG!@<D`(`@`BT4(@W@0`'4(C10:B<COZP.)#!J+30B+
+M412+70R-!)W`"0``@WD0`'4*`<*X``@``._K!\<$$``(``"+!H/X`P^$A0``
+M`(/X`W<*@_@"=!/I5P$``(/X!`^$%`$``.E)`0``BT4(BU@0BT@4BU4,C325
+MP`D``(E-Y(7;=0:-%`[MZP:+5>2+!!8-H@```(7;=0:-%`[OZP.)!`Z+30B+
+M61"+212+50R--)4`$0``B4WDA=MU!HT4#NWK!HM5Y(L$%@T``"4`Z=````"+
+M30B+61"+212+50R--)7`"0``B4WDA=MU!HT4#NWK!HM5Y(L$%H/(8H7;=0:-
+M%`[OZP.)!`Z+%0`````K%0````"+AQ@-```IT"L%`````,'@"HM="(M+%(M=
+M#(T4G0`)```-`````8M="(-[$`!U!HT4"N_K`XD$"HM%"(M8$(M(%(M5#(TT
+ME0`1``")3>2%VW4&C10.[>L&BU7DBP06#0``!`#K*8M-"(M9$(M)%(M5#(TT
+ME<`)``")3>2%VW4&C10.[>L&BU7DBP06@\@@A=MU!HT4#N_K!XD$#HUT)@"+
+M30B+412+AS@,``")P8'A_P,``,'@$"4``/\#"<&+70B#>Q``=0N!PJ0```")
+MR._K!HF*I````(M-"(M1%(N'.`P``"7_`P``@WD0`'4)@<*H````[^L&B8*H
+M````BUT(BW,0BUL4A?9U"8V3K````.WK!HN#K````(G!@>$`_/__BX<X#```
+M)?\#```)P87V=0N-DZP```")R._K$HF+K````(VV`````(V_`````+@!````
+M@\006UY?7<.-=@!5B>53BUT(BTT,N/____^#^0EW'XM3%(T$C0`(``"#>Q``
+M=0P!PNWK"HVT)@````"+!!!;7<.-=@"-O"<`````58GE@^P(B1PDB70D!(M=
+M"(M-#+@`````@_D)=T.)R,'@!(.\`SP,````=0>X`````.LMBW,4C12-``@`
+M`(M%$(-[$`!U"HT4,N_K!XUT)@")!#*X`0```)"-M"8`````BQPDBW0D!(GL
+M7<.0C70F`%6)Y5.+70B+30RX`````(/Y"7=,B<C!X`2#O`,\#````'4-N```
+M``#K-HVV`````(M3%+@!````T^"#>Q``=1"!PD`(``#OZPV-M"8`````B8)`
+M"```N`$```"0C70F`%M=PXVV`````(V\)P````!5B>6#[`B)'"2)="0$BUT(
+MBTT,N`````"#^0EW<XG(P>`$@[P#/`P```!U![@`````ZUV+4Q2-!(T`"@``
+M@WL0`'4%`<+MZP.+!!")QH/F`W4NBT,4@WL0`'4+C9!`"```[8G"ZP:+D$`(
+M``"X`0```-/@A=!T";X!````C70F`(GPC;0F`````(V\)P````"+'"2+="0$
+MB>Q=PY"-="8`58GE@^P4B5WTB77XB7W\BWT(BUT,N`````"#^PD/AYT```")
+MV,'@!(.\!SP,````=0ZX`````.F$````C70F`(M7%+@!````B-G3X(-_$`!U
+M"8'"@`@``._K!HF"@`@``+[H`P``C78`C;PG`````(E<)`2)/"3H_/___X7`
+M=`_'!"1D````Z/S___].=>&+1Q2#?Q``=0Z-D(`(``"X`````._K"L>`@`@`
+M``````"%]@^5P`^VP)"-M"8`````BUWTBW7XBWW\B>Q=PXUV`%6)Y;@!````
+M7<.-M@````!5B>6#[!")7?2)=?B)??R+=22+?2B+73"+10R)1?"Z`````(7V
+M#X0E`0``N!\````/MDT8T_BZ`````*@!#X0-`0``N`#_`'\/MDT@T_BZ````
+M`*@!#X3U````B=B#X`RZ`````(/X#`^$X@```(M5$('B_P\``(M%','@$`G"
+M]L,@=`:!R@``@`"+12S!X!DE````'@G0]L,!=`4-`````?;#$'0%#0```""+
+M5?")0@B+51C!XA3VPP)T!H'*`````8M-\(E1#(GPP>`0)0``#P")01"+12")
+M012#__]T%HGXP>`-)0#@#P`)T(E!#(%)"````$#VPPQT1[@`_P!_#[9---/X
+MN@````"H`71!]L,(#Y3`#[;`2"4```"`]L,$=`4-``!``(M5\`E""(M%."7_
+M?P``"4(0BT4TP>`4"4(4N@$```")]HV\)P````")T(M=](MU^(M]_(GL7<.0
+M58GE@^P,B1PDB70D!(E\)`B+312+71B+?2"+50R%VW0EN`#_`'_3^+X`````
+MJ`%T=(G8P>`4)0``\``)0A")R,'@!0E"%(7_="JX`/\`?P^V31S3^+X`````
+MJ`%T1XGXP>`8)0````\)0A"+11S!X`H)0A2#?2@`=":X`/\`?P^V3233^+X`
+M````J`%T%XM%*,'@'`E"$(M%),'@#PE"%+X!````B?"+'"2+="0$BWPD"(GL
+M7<.-=@"-O"<`````58GE4XM=#(M-$(G:N`````#WP0#P__]U6(-]%`!T$8M#
+M#"4`\/__"<B)0PSK&HGVQT,(`````(E+#,=#$`````#'0Q0`````@WT8`'0)
+M@6(,_^___^L'@4H,`!```,="'`````#'0A@`````N`$```!;7<.-M@````"-
+MOP````!5B>6+30R)RO9!'`%U"K@/````Z>@```"+01PE_A\``-'H9HE!(`^W
+M01IFB4$BQD$D`(M!&*@!=2>H`G0$QD$D`?9"&`AT!(!))`+V0A@$=`^`220$
+MC70F`(V\)P````"+0APE``!@`,'H%8/X`70@@_@!<@R#^`)T(X/X`W0KZT(/
+MMD(4)!_K-XVT)@````"+0A0EX`,``,'H!>LCBT(4)0!\``#!Z`KK%HM"%"4`
+M@`\`P>@/C70F`(V\)P````"(026+0APE`.`?`,'H#8A!)HM"&"7P````P>@$
+MB$$GBT(8)0`/``#!Z`B(02CV0A\!#Y3`L@(HPHA1*K@`````7<,`````````
+M````````````!0`*`!0`'@`R`$8`50!:`%\`9`````H`%``>`"@`,@`\`$8`
+M4`!:`&0`P@```,0```#%````T````-H```#D````P@```,,```#4````\@``
+M``T!```H`0```````$Y/3D4```````#_`49#0P``````$`!(`TU+2P``````
+M0`"(`4544TD`````,``Z`P````````````````````#_`0``8@$``&4!```!
+M`````0``````$`!K`0``;@$```$````!````"``#`'T!``"``0```0``````
+M```,``,`B`$``(L!```!`````````"``1P"3`0``E@$`````````````,P`P
+M`*`!``"C`0```0`````````D`"$`JP$``*X!```!`````````"@`.0"X`0``
+MNP$```$`````````'P`P`,,!``#&`0```0````$````P``,`T0$``-0!```!
+M`````````'```P#<`0``WP$```$`````````.``P`.<!``#J`0```0``````
+M``!4`%4`\@$``/4!```!`````0```$0`50#\`0``_P$```$````!````3``(
+M``8"```)`@````````````!@`%(`$`(``!,"```!`````0```&0`-``E`@``
+M*`(```$`````````?``@`#$"```T`@```0````$```"8``,`.P(``#X"```!
+M`````````)P`4@!$`@``1P(```$````!````J@`0`$T"``!0`@```0``````
+M``"\``,`60(``%P"```!`````````+\`-@!G`@``:@(```$`````````Q``W
+M`'("``!U`@```0````$```#+`#8`?`(``'\"`````````````-``-P".`@``
+MD0(```$`````````U@`0`)D"``"<`@```0````$```#:``,`KP(``+("````
+M`````````#(#`P"Z`@``O0(```$`````````Z0`W`,,"``#&`@```0``````
+M``#V`#<`S@(``-$"```!`````````/H`-@#9`@``W`(```$`````````#`$P
+M`.,"``#F`@```0````$````4`3D`[@(``/$"```!`````````"P!`P#Y`@``
+M_`(```$`````````0`$0``,#```&`P```0````$```!8`2$`$`,``!,#```!
+M`````0```%P!-0`=`P``(`,```$`````````8`$W`"@#```K`P```0``````
+M``!D`0,`,P,``#8#```!`````````&@!`P`\`P``/P,```$`````````;`%2
+M`$D#``!,`P```0````$```!T`3``40,``%0#```!`````````'@!!P!<`P``
+M7P,```$`````````?`$W`&8#``!I`P```0````````"(`4``;P,``'(#```!
+M`````````(D!0P!X`P``>P,```$`````````D`$#`((#``"%`P```0``````
+M``".`0,`C`,``(\#```!`````````)@!10":`P``G0,```$````!````F@%%
+M`*D#``"L`P```0````$```";`4D`NP,``+X#```!`````0```)X!`P#.`P``
+MT0,```$`````````K`$#`-@#``#;`P```0````````"F`0,`X@,``.4#```!
+M`````````+8!-0#M`P``\`,```$`````````N`$W`/X#```!!````0``````
+M``"Z`3<`"P0```X$```!`````````+X!(0`9!```'`0```$````!````)P,#
+M`"($```E!````0````````#*`0,`+P0``#($`````````````.0!$``[!```
+M/@0```$````!````[`$P`$4$``!(!````0````$```#X`0,`3P0``%($```!
+M`````````!`"-P!:!```700```$`````````*@(B`&D$``!L!````0````$`
+M``!"`C<`>`0``'L$```!```````````"`P""!```A00```$`````````2@(#
+M`(H$``"-!````0````````!/`A``E@0``)D$```!`````0```%P"`P"@!```
+MHP0```$`````````8`(1`*@$``"K!````0````$```!H`C<`MP0``+H$```!
+M`````````&P"-P#!!```Q`0```$`````````=@(0`,T$``#0!````0````$`
+M``!Z`@,`W`0``-\$```!`````````(("`P#E!```Z`0```$`````````@P(#
+M`/`$``#S!````0````````"J`@,`^@0``/T$```!`````````+X"0@`*!0``
+M#04```$````!````OP(V`!<%```:!0```0````````#!`C<`*@4``"T%```!
+M`````````,8"-P`V!0``.04```$````!````U`(#`$8%``!)!0```0``````
+M``#P`C<`3P4``%(%```!`````````/0"-0!9!0``7`4```$`````````^`(#
+M`&@%``!K!0```0````````">`$<`<04``'0%```!`````0```/P"10![!0``
+M?@4```$````!````&`,V`(<%``"*!0```0`````````D`P,`D04``)0%```!
+M`````````!`#`P"<!0``GP4```$`````````.@,P`+0%``"W!0```0``````
+M``!(`Q``Q@4``,D%```!`````0```%H#10#7!0``V@4```$`````````7@-6
+M`.(%``#E!0````````````#``@,`[P4``/(%```!````````````````````
+M````````_P'_`0,`F`&9`0<`F`$P"P@`F`$P#"``(`$0"B$`(`&9`2(`(`$P
+M##<`,`&9`34`,`*9`38`,`.9`3``,`29`3D`,`69`30`,`:9`3(`,`,P"A$`
+M$`&9`1``$`$0"E(`4`&9`44`4`*9`4<`4`.9`4(`4`29`54`4`$P#%8`4`(P
+M#$D`4`)0#4``0`%`"D$`0`%`"D,`0`)`"F``8`!@`&$`80!A`&(`8@!B`&,`
+M8P!C`&0`9`!D`&4`90!E`/\!`@`0```41!8%!G$6P18%!@``````````````
+M`%`!`0`0`'$6P18>`````````````````````````%`"`0`0`'$6K187````
+M`````````````````````%`#`@`0`(P4R!01!G$6P18>!@``````````````
+M`%`$`@`0`#P4>!04`'$6P184`````````````````#`!`@`P`#P4R!04`'P5
+M1!8;`````````````````#`"`0`P`#P4R!02````````````````````````
+M`#`#`0`P`#P4R!04`````````````````````````#`$`0`P`#P4R!02````
+M`````````````````````#`%`0`P`#P4>!0/````````````````````````
+M`#`&`@`P`#P4H!07`'P51!8>`````````````````!`!`P`0`(P4R!07!CP4
+M>!01!G$6P18>!@```````"`!`@`0`#P4R!07!G$6P18>!@``````````````
+M`$`!`0!``#(4;A07`````````````````````````$`"`P!``#(4;A07`+`3
+MV!,7`#@3=!,7````````````````````````````````````````````````
+M`/\!`@`3``H4)A8%!AX4$A8%!@```````````````!`!`P`3`((4JA07!EH4
+M6A01!H`6J!8>!@````````````#_`0,`_P"%"84)!0:T";0)!0;0":P*!08`
+M```````0"@$`$0"%"84)%`8````````````````````````P"@$`,0"%"84)
+M%`8````````````````````````P"P$`,0"%"84)%`8`````````````````
+M```````P#`$`,0"%"84)%`8```````````````````````!`"@(`00"%"84)
+M%`8```````````````````````"9`0$`,0"%"84)%`8`````````````````
+M`````````````````````````/\!`P#_`&P)J`D%!K0)M`D%!M`)K`H%!@``
+M`````%`-`@#_`&P)J`D4``@)1`D4`````````````````#`*`0#_`)D)J`D4
+M`````````````````````````#`+`0`Q`(`)B@D4````````````````````
+M`````#`,`0`Q`&P)J`D>`````````````````````````!`*`0`1`&P)G@D;
+M!@```````````````````````$`*`@!!`&P)J`D4`+0)M`D4````````````
+M`````)D!`0`Q`&P)J`D4``````````````````````````````#_````````
+M`````````````````````````````````````````````````&`````!````
+M``````H```#8````X````.@````(`0``$`$``!@!```@`0``*`$``$@!``!0
+M`0``80``````````````"````-@```#@````Z`````@!```@`0``*`$``$@!
+M``!0`0````````````!B`````@```,X````*````V````.````#H````"`$`
+M`!`!```8`0``(`$``"@!``!(`0``4`$``&,````!``````````@```#8````
+MX````.@````(`0``$`$``!@!```H`0``4`$`````````````9```````````
+M````!P```-@```#X````"`$``!`!```8`0``.`$``%`!````````````````
+M``!E```````````````%````V````.@````(`0``*`$``%`!````````````
+M``````````````````````````````````````!@`````0`````````)````
+MV````.````#P````"`$``!`!```8`0``(`$``#`!``!0`0```````&$`````
+M``````````<```#8````X````/`````(`0``(`$``#`!``!0`0``````````
+M````````8@````(```#.````"0```-@```#@````\`````@!```0`0``&`$`
+M`"`!```P`0``4`$```````!C`````0`````````(````V````.````#P````
+M"`$``!`!```8`0``,`$``%`!`````````````&0```````````````<```#8
+M``````$```@!```0`0``&`$``$`!``!0`0``````````````````90``````
+M````````!@```-@``````0``"`$``$`!``!0`0``````````````````````
+M````````````````````````````0`&(`4`!``!8`0``$`%(`U`!``!B`0``
+M,`$0`D`!``!N`0```@!0`0$`0`$$`*``"`#``"``T`"5(P``<B,``(<C``"5
+M(P``>2,``)4C``"5(P``E2,``(`C``"5(P``E2,``)4C``"5(P``E2,``)4C
+M``"5(P``E2,``)4C``"5(P``E2,``)4C``"5(P``E2,``)4C``"5(P``E2,`
+M`)4C``"5(P``E2,``)4C``"5(P``E2,``(XC````````,`$``$`!,`(``$`!
+M,`,``$`!,`0``$`!,`4``$`!,`8``$`!,`H``$`!,`L``$`!,`P``$`!0`)#
+M`$`!0`)#`*``0`%!`$`!0`I!`*``0`!#`$$`````````````````)`&8&0`Q
+M$`,`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````#`.@``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````/L%`````````08```0````'!@``"`````H&```,````#P8``!0````3
+M!@``'````!<&```@````&P8``"0````?!@``*````",&```P````*08``#0`
+M```O!@``0````#0&``!$````.08``$@```!`!@``3````$<&``!0````308`
+M`%0```!3!@``6````%@&````0```6P8```1```!?!@``"$```&<&```,0```
+M:P8``!!```!R!@``%$```'D&```@0```?@8```"```"&!@``!(```(X&```(
+M@```E@8```R```">!@``$(```*<&```4@```L`8``!B```"Y!@``'(```,(&
+M```@@```QP8``"2```#.!@``*(```-8&```L@```W08``#"```#D!@``-(``
+M`.L&```X@```\@8``$"```#W!@``1(```/P&``!(@```!`<``$R````-!P``
+M4(```!4'``!4@```'0<``%B````E!P``7(```"T'``!D@```-0<``&B````]
+M!P``;(```$4'``!P@```30<``("```!6!P``A(```%\'``"(@```9P<``(R`
+M``!K!P``D(```'('``"4@```>P<``)B```"$!P``G(```(T'``"@@```````
+M`````````````````````````````)@``$<````(F`````````R8``"FCH0)
+M$)@```#@,CT4F```:P<``!R8````````()@````"`@(DF```#@X``"B8```!
+M`@(*+)@``/QO`P`PF````````#28```.#@``.)@```<````\F`````$"`$"8
+M`````&.)1)@``)P6<A-(F```,[88`$R8```\88024)@``."XZ`U4F```64@'
+M`%B8``"ZOH!^7)@``%YF.C%@F```"!T``&28````S@$`:)@``)!!FD!PF```
+M#P```'28``"`````>)@```0`````F0````````29````````")D````````,
+MF0````"``!"9```#`````)L````````$FP``(`````B;```0````#)L``#``
+M```0FP``"````!2;```H````&)L``"@````<FP``!````"";```D````))L`
+M`!0````HFP``-````"R;```,````,)L``"P````TFP```@```#B;```B````
+M/)L``!(```!`FP``,@```$2;```*````2)L``"H```!,FP```0```%";```A
+M````5)L``!$```!8FP``,0```%R;```)````8)L``"D```!DFP``!0```&B;
+M```E````;)L``!4```!PFP``-0```'2;```-````>)L``"T```!\FP```P``
+M`(";```C````A)L``!,```"(FP``,P```(R;```+````D)L``"L```"4FP``
+M!P```)B;```G````G)L``!<```"@FP``-P```*2;```/````J)L``"\```"L
+MFP``+P```+";```O````M)L``"\```"XFP``+P```+R;```O````P)L``"\`
+M``#$FP``+P```,B;```O````S)L``"\```#0FP``+P```-2;```O````V)L`
+M`"\```#<FP``+P```.";```O````Y)L``"\```#HFP``+P```.R;```O````
+M\)L``"\```#TFP``+P```/B;```O````_)L``"\`````F@``'0````2:``!=
+M````")H``)T````,F@``W0```!":```=`0``%)H``"$````8F@``80```!R:
+M``"A````()H``.$````DF@``,0```"B:``!Q````+)H``+$````PF@``'```
+M`#2:``!<````.)H``"D````\F@``:0```$":``"I````1)H``"````!(F@``
+M&0```$R:``!9````4)H``)D```!4F@``,````%B:```%````7)H``"4```!@
+MF@``90```&2:``"E````:)H``"@```!LF@``:````'":```?````=)H``!X`
+M``!XF@``&````'R:``!8````@)H``)@```"$F@```P```(B:```$````C)H`
+M`$0```"0F@``A````)2:```3````F)H``!(```"<F@``4@```*":``"2````
+MI)H``-(```"HF@``*P```*R:```J````L)H``&H```"TF@``J@```+B:```;
+M````O)H``!H```#`F@``6@```,2:``":````R)H``-H```#,F@``!@```-":
+M```&````U)H```8```#8F@``!@```-R:```&````X)H```8```#DF@``!@``
+M`.B:```&````[)H```8```#PF@``!@```/2:```&````^)H```8```#\F@``
+M!@```-28```@````S)@```0```#(F```!@$&`)R8``!M````P)@```````#0
+MF```%`````D)```````"`@8&!@8&!@("````````````````````````````
+M``````#P````S`````````````````````KB````(```"@(```$8```!````
+M0!@$````````````````````````!017&0`Q$`,`````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````#@@P``````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````&P)CPFT"0``````````
+M`````````````````````````````"`````@````0````$````````8````&
+M````!@"Q!P``"````+0'```,````N0<``!0```"]!P``)````,$'```H````
+MQP<``"P```#-!P``,````-,'```T````V0<``#@```#?!P``0````.0'``!$
+M````Z0<``$@```#P!P``3````/<'``!0````_0<``%0````#"```6`````@(
+M```P$```#P@``'`0```6"```L!```!T(``#P$```)`@``'`2```L"````$``
+M`"\(```$0```,P@```A````["```#$```#\(```00```1@@``!1```!-"```
+M($```%((````@```6@@```2```!B"```"(```&H(```,@```<@@``!"```![
+M"```%(```(0(```8@```C0@``!R```"2"```((```)D(```D@```H0@``"B`
+M``"H"```+(```*\(```P@```M@@``#2```"]"```.(```,4(```\@```S@@`
+M`$"```#6"```1(```-X(``!(@```Y@@``$R```#N"```4(```/8(``!4@```
+M_P@``%B````'"0``@(```!`)``"$@```%`D``(B````;"0``C(```"0)``"0
+M@```+0D``)2````V"0``F(`````````````````````````P````%0```!4`
+M```=````%0```$`0```/_"\`#_PO`!_\+P`/_"\`1!````_\+P`/_"\`'_PO
+M``_\+P!($```#_PO``_\+P`?_"\`#_PO`$P0```/_"\`#_PO`!_\+P`/_"\`
+M4!````_\+P`/_"\`'_PO``_\+P!4$```#_PO``_\+P`?_"\`#_PO`%@0```/
+M_"\`#_PO`!_\+P`/_"\`7!````_\+P`/_"\`'_PO``_\+P!@$```#_PO``_\
+M+P`?_"\`#_PO`&00```/_"\`#_PO`!_\+P`/_"\`<!```&@!``#@`0``N`$`
+M`&@!```P$```,`(``.`!``"P````,`(``+`0``"8#0``@!$``$@?``"8#0``
+M\!```."@``!H0`$`@%@``."@```4@`````0`!``(``@`,``@``0`!!R```"G
+MCXT.SX^-#I6/8`&GCXT.!)@````````#```````````````@F`````("`@`"
+M`@(``@$"``("`B28```.#@``#@X```<'```.#@``*)@```$``@H!``(*```!
+M!0$``@HTF```#@X```X.```.#@``#@X``#B8```'````!P````L````+````
+M1)@``)P6<A.E%G(3J!9R$YP6<A-(F```9[H8`&>Z&`!INA@`:;H8`%"8``#@
+MM"@,X+0H#."T*`S@M"@,6)@``"X-@'XN#8!^+@W`?BX-@'Y<F```7ETW,5Y=
+M-S%>73HQ7ETW,6"8```0O0``$+T``#B]```0O0``9)@```#.`0``S@$``,X!
+M``#.`0`4F0``$"<``!`G``!\%0``$"<``!B9``"0`0``D`$``(0```"0`0``
+M1)D``"`0X&\@$.!O(`G@;R`0X&^`H0``_Q3_!?\4_P7_%/\%_QG_!=28```0
+M````%````!`````0``````````P`````````*````)R<A(0L````?'Q\?#0`
+M```%````0`````````!$````"````$@````(````3````!````!0````````
+M`%0````?``````@````````$"`````````@(````````#`@````````0"```
+M`````!0(````````&`@````````<"````````"`(````````)`@````````P
+M$@````````2`````````"(`````````,@````````!B`````````)(``````
+M```H@```,````"R```#__P<`,(```/___P$T@```,0```#B`````````/(``
+M``````!`@````````$2````"````2(````````!4@````````%B`````````
+M")@````````,F```DY"$+1"8````X#)]%)@``&L/```<F````````"R8``#^
+M;P(`,)@````````\F`````$"`$"8``!Z`6H@3)@``#QAA!)4F```60@``&B8
+M``"009I`;)@``(&P#`5PF```#P```'28``"`````>)@```P`````F0``````
+M``29````````")D````````,F0````"``!"9```!````')D``"H)```@F0``
+M`````"29```%B@4`*)D```$````LF0```````#"9````````-)D````````X
+MF0```````#R9```_````0)D```0```!(F0```````$R9````````4)D`````
+M``!4F0``3/%075B9```8````7)D``(YJ2P"$H0``_P7_!HBA``#_!_\'C*$`
+M`/\(_PB0H0``_PG_"92A``#_"O\*F*$``/\+_PN<H0``_PS_#*"A``#_#?\-
+MI*$``/\._P^HH0``_Q+_$JRA``#_$_\4L*$``/\5_Q:TH0``_Q?_&;BA``#_
+M&O\;O*$``/\=_Q[`H0``_R#_(\2A``#_)?\GR*$``/\I_RS,H0``_R__,="A
+M``#_-/\WU*$``/\Z_SK8H0``_SK_.MRA``#_.O\ZX*$``/\Z_SKDH0``_SK_
+M.NBA``#_.O\Z[*$``/\Z_SKPH0``_SK_.O2A``#_.O\Z^*$``/\Z_SK\H0``
+M_SK_.@";````````!)L``"`````(FP``$`````R;```P````$)L```@````4
+MFP``*````!B;```$````')L``"0````@FP``%````"2;```T````*)L```P`
+M```LFP``+````#";```"````-)L``"(````XFP``$@```#R;```R````0)L`
+M``H```!$FP``*@```$B;```&````3)L``"8```!0FP``%@```%2;```V````
+M6)L```X```!<FP``+@```&";```!````9)L``"$```!HFP``$0```&R;```Q
+M````<)L```D```!TFP``*0```'B;```%````?)L``"4```"`FP``%0```(2;
+M```U````B)L```T```",FP``+0```)";```#````E)L``",```"8FP``$P``
+M`)R;```S````H)L```L```"DFP``*P```*B;```K````K)L``"L```"PFP``
+M*P```+2;```K````N)L``"L```"\FP``*P```,";```K````Q)L``"L```#(
+MFP``*P```,R;```K````T)L``"L```#4FP``*P```-B;```K````W)L``"L`
+M``#@FP``*P```.2;```K````Z)L``"L```#LFP``*P```/";```K````])L`
+M`"L```#XFP```@```/R;```6````U)@``"````#8F```:!!@````````````
+M`)H``*D!````````!)H``.D!``!`````")H``"D```"`````#)H``&D```!0
+M`0``$)H``)D!``"0`0``%)H``-D!``#0`0``&)H``!D````0````')H``%D`
+M``!$````()H``)D```"$````))H``*4!``!(`0``*)H``.4!``"(`0``+)H`
+M`"4```#(`0``,)H``,@!```4````-)H```@```!"````.)H``$@```""````
+M/)H``(@```!X`0``0)H``)@!``"X`0``1)H``-@!``#X`0``2)H``!@````2
+M````3)H``%@```!2````4)H``)@```"2````5)H``*0!``!\`0``6)H``.0!
+M``"\`0``7)H``"0```#\`0``8)H``&0````*````9)H``*0```!*````:)H`
+M`.0```"*````;)H```H!``!:`0``<)H``$H!``":`0``=)H``(H!``#:`0``
+M>)H``,H!```.````?)H```H```!.````@)H``$H```".````A)H``(H```!>
+M`0``B)H``+H!``">`0``C)H``/H!``#>`0``D)H``#H````)````E)H``'H`
+M``!)````F)H``(8!``")````G)H``,8!``!Y`0``H)H```8```"Y`0``I)H`
+M`$8```#Y`0``J)H``(8````Y````K)H``,8```!Y````L)H``,8```"Y````
+MM)H``,8```"]`0``N)H``,8```#]`0``O)H``,8````]````P)H``,8```!]
+M````Q)H``,8```"]````R)H``,8```#]````S)H``,8```#]````T)H``,8`
+M``#]````U)H``,8```#]````V)H``,8```#]````W)H``,8```#]````X)H`
+M`,8```#]````Y)H``,8```#]````Z)H``,8```#]````[)H``,8```#]````
+M\)H``,8```#]````])H``,8```#]````^)H``,8```#]````_)H``,8```#]
+M`````0```$8```!@`````0```$8```!A`````0```$8```!B`````0```$8`
+M``!C`````0```$8```!D`````0```$8```!E`````0```$8```!F`````0``
+M`$8```!G`````0```$8```!H`````0```$8```!I`````0```$8```!J````
+M`0```$8```!K`````0```$8```!L`````0```$8```!T`````0```$8```!T
+M`````0```$8```!T`````0```$8```!T`````0```$8```!T`````0```$8`
+M``!T`````0```$8```!T`````0```$8```!T`````0```$8```!U`````0``
+M`$8```!V`````0```$8```!W`````0```$8```!X`````0```$8```!Y````
+M`0```$8```!Z`````0```$8```![`````0```$8```!\`````0```$8```!]
+M`````0```$8```!^`````0```$8```!_`````0```$8```"``````0```$0`
+M``!\`````0```$8```"(`````0```$8```",`````0```$8```"0`````0``
+M`$8```"4`````0```$8```"8`````0```$8```"<`````0```$8```"@````
+M`0```$8```"D`````0```$8```"H`````0```$8```"L`````0```$8```"P
+M`````0```$8```"T``````('`````P`&``D`/P```*3-``"DS0``PLT``,+-
+M``#@S0``X,T``/[-``#^S0`````````````)````!`````0``0`!``$`!@``
+M`$9'.``````````````````$`````0`!``0```!&1S<`````````````````
+M`P`!``$``0`#````1D<V``````````````````0```````$``0```$9'-0``
+M```````````````$``$``0````````!&1S0`````````````````!`````$`
+M``#^____1D<S``````````````````,``0`!````_?___T9',@``````````
+M```````$`````````/S___]&1S$``````````````````@`!``$```#Z____
+M1D<P``````````````````````````````````````````````````````!A
+M<C4R,3)!;FE'971#=7)R96YT4W1A=&4`````P.L``%KE```AYP``+>H``(3J
+M```)ZP``````````````````%!!4&0`Q$`,`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````"0^@``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````&P)CPFT"0@);`FT"0``````
+M`````````````````````````"`````@````0````$````````8````&````
+M!@#V"@``"````/D*```,````_@H``!0````""P``)`````8+```P````#`L`
+M`#0````2"P``0````!<+``!$````'`L``$@````C"P``3````"H+``!0````
+M,`L``%0````V"P``6````#X+```P$```10L``'`0``!,"P``L!```%,+``#P
+M$```6@L``#`2``!B"P``<!(``&H+````0```;0L```1```!Q"P``"$```'D+
+M```,0```?0L``!!```"$"P``%$```(L+```@0```D`L```"```"8"P``!(``
+M`*`+```(@```J`L```R```"P"P``$(```+D+```4@```P@L``!B```#+"P``
+M'(```-`+```@@```UPL``"2```#?"P``*(```.8+```L@```[0L``#"```#T
+M"P``-(```/L+```X@````PP``#R````,#```0(```!0,``!$@```'`P``$B`
+M```D#```3(```"P,``!0@```-`P``%2````]#```6(```$4,``"`@```3@P`
+M`(2```!2#```B(```%D,``",@```8@P``)"```!K#```E(```'0,``"8@```
+M?0P``-2```"$#```V(```(L,``#<@```D@P``."```":#```Y(```*(,``#H
+M@```I@P```R!``"N#```[(```+0,``#P@```N@P``/2```#`#```^(```&`>
+M`0`X'@$`4!X!`&`>`0!`'@$`8!X!`&`>`0!@'@$`1QX!`&`>`0!@'@$`8!X!
+M`&`>`0!@'@$`8!X!`&`>`0!@'@$`8!X!`&`>`0!@'@$`8!X!`&`>`0!@'@$`
+M8!X!`&`>`0!@'@$`8!X!`&`>`0!@'@$`8!X!`&`>`0!@'@$`5QX!```````P
+M````%0```!4````5````%0```!4```!`$```#_PO``_\+P`?_"\`#_PO``_\
+M+P!$$```#_PO``_\+P`?_"\`#_PO``_\+P!($```#_PO``_\+P`?_"\`#_PO
+M``_\+P!,$```#_PO``_\+P`?_"\`#_PO``_\+P!0$```#_PO``_\+P`?_"\`
+M#_PO``_\+P!4$```#_PO``_\+P`?_"\`#_PO``_\+P!8$```#_PO``_\+P`?
+M_"\`#_PO``_\+P!<$```#_PO``_\+P`?_"\`#_PO``_\+P!@$```#_PO``_\
+M+P`?_"\`#_PO``_\+P!D$```#_PO``_\+P`?_"\`#_PO``_\+P`P$```,`(`
+M`.`!``"P````8`$``.`!``!P$```:`$``.`!``"X`0``C`$``.`!``"P$```
+M8`X``(`1```<'P``.#X``(`1``#P$```X*```&A``0"`6```X+```&A``0`4
+M@```Z`/H`^`&X`8@!"`$0`A`".`&X`8$F`````````,```````````````,`
+M```@F`````("`@`"`@(``@$"``("`@`"`@(TF```#@X```X.```.#@``#@X`
+M``X.```XF```!P````<````+````"P````L```!$F```'!9R$R4<<A,H%W(3
+MHA9R$R4<<A-0F```X+3H#>"TZ`W@M.@-X+3H#>"TZ`U8F```+@V`?BX-@'XN
+M3>A^+DWH?BX-@'Y@F```$)T``!"=```8G0``$)T``!"=``!DF````,X!``#.
+M`0``S@$``,X!``#.`0!HF```D$&:0)!!FD"009I`D$&:0)!!FD`8F0``N`$`
+M`+@!``"$````"`$``+@!```DF0``!8H%$`6*!1`%B@40!8H%$`6*!1!$F0``
+M(!"X_R`0N/\@#;C_(!"X_R`0N/^`H0``_Q3_$/\4_Q#_$/\0_QG_$/\9_Q`P
+MH@``````````````````"`$`````````````````````````````````````
+M```<@```IX^-$L\/B`F5#^`$JX^-$L\/B`DDF```#@X```X.```'!P``#@X`
+M``X.```HF````0`""@$``@H``0$%`0`""@$``@I(F```6MH8`%K:&`!IRA@`
+M:<H8`&G*&`!<F```7F8W,5YF-S%>9C<Q7F8W,5YA-S%LF```@;`,!8&P#`6!
+ML`P%@+`,!8"P#`44F0``$"<``!`G``!\%0``^"H``!`G````````````````
+M```````````````````<@```IY.-$L\3B`F5$^`$JY.-$L\3B`DDF```#@X`
+M``X.```.#@``#@X```X.```HF````0`""@$``@H``0(%`0`""@$``@I(F```
+M;=H8`&W:&`!URA@`=<H8`'7*&`!<F```7F8W,5YF-S%>9C<Q7F8W,5YF-S%L
+MF```@;`,!8&P#`6!L`P%@;`,!8&P#`44F0``T`<``-`'``!,!```F`@``-`'
+M```(H@``B&>^UHAGOM:(9S[0B&<^T(AG/M`,H@``0`$L9$`!+&1@P4)D8,%"
+M9&#!0F0```````````P`````````-`````4```!``````````$0````(````
+M2`````@```!,````$````%``````````5````!\`````"`````````0(````
+M````"`@````````,"````````!`(````````%`@````````8"````````!P(
+M````````(`@````````D"````````#`2````````<!(````````X$```````
+M`'@0````````N!````````#X$````````#@1````````>!$```````"X$0``
+M`````/@1````````.!(```````!X$@```````+@2````````^!(````````X
+M$P```````'@3````````N!,```````#X$P```````#@4````````>!0`````
+M``"X%````````/@4````````.!4```````!X%0```````+@5````````^!4`
+M```````X%@```````'@6````````N!8```````#X%@```````#@7````````
+M>!<```````"X%P```````/@7````````/!````````!\$````````+P0````
+M````_!`````````\$0```````'P1````````O!$```````#\$0```````#P2
+M````````?!(```````"\$@```````/P2````````/!,```````!\$P``````
+M`+P3````````_!,````````\%````````'P4````````!(`````````(@```
+M``````R`````````&(`````````@@````````"2`````````*(```#`````L
+M@```__\'`#"```#___\!-(```#$````X@````````#R`````````2(``````
+M``!4@````````%B`````````7(```/_'__^`@````````(2`````````B(``
+M``````",@````````)"`````````E(````````"8@````````,"````:,((J
+MQ(```.`!W`7(@```$"=`'\R``````/0!T(```!P>``#4@```JJH"`-B```!5
+M50`"W(````````#@@```_____^2```#__P``Z(````````#L@````````/"`
+M````````](````````#X@````````/R```"(`````(<````````$AP``C```
+M``B'``#D````#(<``-4"```0AP```````!2'````````&(<``*`````<AP``
+MR0$``""'```L````)(<``"P````HAP``,````"R'```\````,(<``"P````T
+MAP``+````#B'```P````/(<``#P```!`AP```````$2'````````2(<`````
+M``!,AP```````%"'````````5(<```````!8AP```````%R'````````8(<`
+M`-4```!DAP``WP```&B'```"`0``;(<``#H!``!PAP``=0```'2'``!_````
+M>(<``*(```!\AP````````"!```"``$`!($```$````(@0``P`````R!````
+M````$($``&@!```4@0```````,"'`````0(#Q(<```0%!@?(AP``"`D*"\R'
+M```,#0X/T(<``!`1$A/4AP``%!46%]B'```8&1H;W(<``!P='A_@AP````$"
+M`^2'```$!08'Z(<```@)"@OLAP``#`T.#_"'```0$1(3](<``!05%A?XAP``
+M&!D:&_R'```<'1X?")@````````,F```&8Z$K1"8````X"A]%)@``&N?"IP<
+MF````````"R8``#^+P(`/)@````!`@!`F```>@%J($R8```\88025)@``%D(
+M````F0````````29````````")D````````,F0````"``!"9```!````')D`
+M`"H)```@F0`````0!2B9```!````+)D```0````TF0``(B`?'CB9```-#`L*
+M/)D``#\```!`F0``!````$B9```2LH"25)D``$SQ4%U8F0``_P```%R9``".
+M:DL`:)D``,X#``!PF0``%;4O&729````````>)D```$```!\F0```````(2A
+M``#_$/\0B*$``/\0_Q",H0``_Q#_$)"A``#_$/\0E*$``/\0_Q"8H0``_Q#_
+M$)RA``#_$/\0H*$``/\0_Q"DH0``_Q#_$*BA``#_$/\0K*$``/\0_Q"PH0``
+M_Q#_$+2A``#_$/\0N*$``/\0_Q"\H0``_Q#_$,"A``#_$/\0Q*$``/\0_Q#(
+MH0``_Q#_$,RA``#_$/\0T*$``/\0_Q#4H0``_Q#_$-BA``#_$/\0W*$``/\0
+M_Q#@H0``_Q#_$.2A``#_$/\0Z*$``/\0_Q#LH0``_Q#_$/"A``#_$/\0]*$`
+M`/\0_Q#XH0``_Q#_$/RA``#_$/\0!*(````````0H@``,Z.``!2B```0;"``
+M&*(``&!`G``<H@``"H"#%""B``!A$(,!)*(````$```HH@``M0$``"RB````
+M````-*(``"`@("`XH@``("`@(#RB``"OB<@30*(``"`*23A$H@``MGL``$BB
+M``#\/_\/`)L````````HFP``#````#B;```2````9)L``"$```",FP``+0``
+M`)R;```S```````````````PF0``@T@```BB``"(9S[0#*(``&I!2&0$FP``
+M(`````B;```0````#)L``#`````0FP``"````!2;```H````&)L```0````<
+MFP``)````"";```4````))L``#0````LFP``+````#";```"````-)L``"(`
+M```\FP``,@```$";```*````1)L``"H```!(FP``!@```$R;```F````4)L`
+M`!8```!4FP``-@```%B;```.````7)L``"X```!@FP```0```&B;```1````
+M;)L``#$```!PFP``"0```'2;```I````>)L```4```!\FP``)0```(";```5
+M````A)L``#4```"(FP``#0```)";```#````E)L``",```"8FP``$P```*";
+M```+````I)L``"L```"HFP``*P```*R;```K````L)L``"L```"TFP``*P``
+M`+B;```K````O)L``"L```#`FP``*P```,2;```K````R)L``"L```#,FP``
+M*P```-";```K````U)L``"L```#8FP``*P```-R;```K````X)L``"L```#D
+MFP``*P```.B;```K````[)L``"L```#PFP``*P```/2;```K````^)L```(`
+M``#\FP``%@```````````````````````````````````#"9``""2```!)L`
+M``$````(FP```@````R;```#````$)L```0````4FP``!0```!B;```(````
+M')L```D````@FP``"@```"2;```+````+)L```T````PFP``$````#2;```1
+M````/)L``!,```!`FP``%````$2;```5````2)L``!@```!,FP``&0```%";
+M```:````5)L``!L```!8FP``'````%R;```=````8)L``"````!HFP``(@``
+M`&R;```C````<)L``"0```!TFP``)0```'B;```H````?)L``"D```"`FP``
+M*@```(2;```K````B)L``"P```"0FP``,````)2;```Q````F)L``#(```"@
+MFP``-````*2;```U````J)L``#4```"LFP``-0```+";```U````M)L``#4`
+M``"XFP``-0```+R;```U````P)L``#4```#$FP``-0```,B;```U````S)L`
+M`#4```#0FP``-0```-2;```U````V)L``#4```#<FP``-0```.";```U````
+MY)L``#4```#HFP``-0```.R;```U````\)L``#4```#TFP``-0```/B;```0
+M````_)L``!H``````````````)R8`````````````````````````````)R8
+M`````````````````````````````)R8````````````````````````````
+M`)R8`````````````````````````````)R8````````````````````````
+M`````)R8`````````````````````````````)R8````````````````````
+M`````````)R8`````````````````````````````)R8````````````````
+M`````````````)R8`````````````````````````````)R8````````````
+M`````````````````)R8`````#@````X````.````#@````X`)R8````````
+M`````````````````````)R8`````````````````````````````)R8````
+M`````````,````"`````@````)R8``#Y``0`^0`$`/\`!`#]``0`_0`$`-28
+M``````````````0````$````!````````````````)H``*D!````````!)H`
+M`.D!``!`````")H``"D```"`````#)H``&D```!0`0``$)H``)D!``"0`0``
+M%)H``-D!``#0`0``&)H``!D````0````')H``%D```!$````()H``)D```"$
+M````))H``*4!``!(`0``*)H``.4!``"(`0``+)H``"4```#(`0``,)H``,@!
+M```4````-)H```@```!"````.)H``$@```""````/)H``(@```!X`0``0)H`
+M`)@!``"X`0``1)H``-@!``#X`0``2)H``!@````2````3)H``%@```!2````
+M4)H``)@```"2````5)H``*0!``!\`0``6)H``.0!``"\`0``7)H``"0```#\
+M`0``8)H``&0````*````9)H``*0```!*````:)H``.0```"*````;)H```H!
+M``!:`0``<)H``$H!``":`0``=)H``(H!``#:`0``>)H``,H!```.````?)H`
+M``H```!.````@)H``$H```".````A)H``(H```!>`0``B)H``+H!``">`0``
+MC)H``/H!``#>`0``D)H``#H````)````E)H``'H```!)````F)H``(8!``")
+M````G)H``,8!``!Y`0``H)H```8```"Y`0``I)H``$8```#Y`0``J)H``(8`
+M```Y````K)H``,8```!Y````L)H``,8```"Y````M)H``,8```"]`0``N)H`
+M`,8```#]`0``O)H``,8````]````P)H``,8```!]````Q)H``,8```"]````
+MR)H``,8```#]````S)H``,8```#]````T)H``,8```#]````U)H``,8```#]
+M````V)H``,8```#]````W)H``,8```#]````X)H``,8```#]````Y)H``,8`
+M``#]````Z)H``,8```#]````[)H``,8```#]````\)H``,8```#]````])H`
+M`,8```#]````^)H``,8```#]````_)H``,8```#]`````)H```<````'````
+M!)H``$<```!'````")H``(<```"'````#)H``*`!``"@`0``$)H``.`!``#@
+M`0``%)H``"`````@````&)H``&````!@````')H``*$!``"A`0``()H``.$!
+M``#A`0``))H``"$````A````*)H``&$```!A````+)H``&(!``!B`0``,)H`
+M`*(!``"B`0``-)H``.(!``#B`0``.)H``"(````B````/)H``&(```!B````
+M0)H``&,!``!C`0``1)H``*,!``"C`0``2)H``.,!``#C`0``3)H``",````C
+M````4)H``&,```!C````5)H``(0!``"$`0``6)H``,0!``#$`0``7)H```0`
+M```$````8)H``.H!```+````9)H``"H```!+````:)H``&H```"+````;)H`
+M`*H```"L`0``<)H``*L!``#L`0``=)H``.L!```L````>)H``"L````2````
+M?)H``&L```!2````@)H``*L```"2````A)H``*P!``"3`0``B)H``.P!``#3
+M`0``C)H``"P````3````D)H``#H```!3````E)H``'H```"3````F)H``+H`
+M``"4`0``G)H``+L!``#4`0``H)H``/L!```4````I)H``#L````Z````J)H`
+M`'L```!Z````K)H``+L```"Z````L)H``+P!``"[`0``M)H``/P!``#[`0``
+MN)H``#P````[````O)H``'P```![````P)H``+P```"[````Q)H``/P```"\
+M`0``R)H``/P```#\`0``S)H``/P````\````T)H``/P```!\````U)H``/P`
+M``"\````V)H``/P```#\````W)H``/P```#\````X)H``/P```#\````Y)H`
+M`/P```#\````Z)H``/P```#\````[)H``/P```#\````\)H``/P```#\````
+M])H``/P```#\````^)H``/P```#\````_)H``/P```#\````U)@``"````#4
+MF```(````-28```0````%````!`````0````%````-"8```(!`8#"`0'`P@$
+M!@,(!`8#"`0'`]B8``!H$&``:!!@`&@08`!H$&``:!!@`-R8``#`P*``P,"@
+M`,#`X`#`P.``P,#@``````````````````````"<F```````````````````
+M``````````"<F`````````````````````````````"<F```````````````
+M``````````````"<F`````````````````````````````"<F```````````
+M``````````````````"<F```````$````!`````0````$````!"<F```````
+M!`````0````$````!`````2<F`````````````````````````````"<F```
+M``````````````````````````"<F`````````````````````````````"<
+MF``````````````````*``````````"<F```P``X`(``.`#``#@"P``X`,``
+M.`"<F```!@`"``8``@`&````!@`"``8``@"<F```B0```(D```")````B0``
+M`(D```"<F```H````*````"@````H````*````"<F```!P`$``<`!``'``0`
+M!P`$``<`!`#4F```&@```!H````:````&@```!H``````````````)R8````
+M`*````"@````H````*````"@`)R8``````H````*````"@````H````*`)R8
+M`````````````````````````````)R8````````````````````````````
+M`)R8`````&8```!F````9@```&8```!F`)R8`````-L```#;````VP```-L`
+M``#;`)R8`````/$```#Q````\0```/$```#Q`)R8`````!(````2````$@``
+M`!(````2`)R8`````!(````2````$@```!(````2`)R8`````',```!S````
+M<P```',```!S`)R8`````````````````````````````)R8``````P````,
+M````#`````P````,`)R8`````/\```#_````_P```/\```#_`)R8`````/\`
+M``#_````_P```/\```#_`)R8`````(L```"+````BP```(L```"+`)R8````
+M`&````!@````8````&````!@`)R8``````P````,````#`````P````,`)R8
+M`````(0```"$````A````(0```"$`)R8`````&0```!D````9````&0```!D
+M`)R8`````"`````@````(````"`````@`)R8`````"0````D````)````"0`
+M```D`)R8`````"4````E````)0```"4````E`)R8`````!$````1````$0``
+M`!$````1`)R8`````!$````1````$0```!$````1`)R8`````%$```!1````
+M40```%$```!1`)R8``````0<```$'```!!P```0<```$')R8``````H````*
+M````"@````H````*`)R8`````*$```"A````H0```*$```"A`)R8`````$``
+M``!`````0````$````!``)R8``````D#```)`P``"0,```D#```)`YR8````
+M```&````!@````8````&````!IR8``"P````L````*@```"H````J````)R8
+M```N````+@```"X````N````+@```)R8``!!2FP`04IL`/%*;`!A2FP`84IL
+M`)R8```JB5``*HE0`"N)4``KB5``*XE0`)R8````)(0``"2$```DA```)(0`
+M`"2$`)R8````DL8``)+&``"2Q@``DL8``)+&`-"8```,``(`#``"``P``@`,
+M``(`#``"``````````````````````"<F```````"@````H````*````"@``
+M``J<F`````````````````````````````"<F`````"`````@````(````"`
+M````@`"<F``````J````*@```"H````J````*@"<F```````````````````
+M``````````"<F`````````````````````````````"<F`````"8````F```
+M`)@```"8````F`"<F`````!M````;0```&T```!M````;0"<F`````#'````
+MQP```,<```#'````QP"<F`````!+````2P```$L```!+````2P"<F`````!(
+M8```2&```$A@``!(8```2&"<F`````#,````S````,P```#,````S`"<F```
+M```!`````0````$````!`````0"<F``````P````,````#`````P````,`"<
+MF`````#\P```_,```/S```#\P```_,"<F`````#_````_P```/\```#_````
+M_P"<F``````O````+P```"\````O````+P"<F`````""````@@```((```""
+M````@@"<F``````Q````,0```#$````Q````,0"<F``````0````$````!``
+M```0````$`"<F`````"2````D@```)(```"2````D@"<F`````"!````@0``
+M`($```"!````@0"<F`````"0````D````)````"0````D`"<F`````"4````
+ME````)0```"4````E`"<F`````!$````1````$0```!$````1`"<F`````!$
+MP```1,```$3```!$P```1,"<F`````!$`0``1`$``$0!``!$`0``1`&<F```
+M```1````$0```!$````1````$0"<F``````H````*````"@````H````*`"<
+MF`````"$,```A#```(0P``"$,```A#"<F``````"`````@````(````"````
+M`@"<F``````E````)0```"4````E````)0"<F```````````````````````
+M``````"<F```@````(````"`````@````(````"<F```N@```+H```"Z````
+MN@```+H```"<F```!"BP``0HL`#$*+``A"BP`(0HL`"<F```J25!`*DE00"O
+M)4$`K25!`*TE00"<F````)(1``"2$0``DA$``)(1``"2$0"<F````$@:``!(
+M&@``2!H``$@:``!(&@#8F```,`(+`#`""P`P`@L`,`(+`#`""P"<F```0```
+M`$@```!`````0````$````"<F```$````!`````0````$````!````"<F```
+M"`````@````(````"`````@```"<F```3P```$\```!/````3P```$\```"<
+MF```\0```/$```!A````\0```/$```"<F```3Y```$^0``!,D```3Y```$^0
+M``"<F```6A(``%H2``":$@``6A(``%H2``#,F```#@````X````/````#@``
+M``X```"<F```E````)0```"4````E````)0```"<F```D0```)$```"1````
+MD0```)$```"<F```"@````H````*````"@````H```"<F```@````(````"`
+M````@````(````"<F```P0```,$```#!````P0```,$```"<F```8````&``
+M``!@````8````&````"<F```\````/````#P````\````/````"<F```(@``
+M`"(````B````(@```"(```"<F```D@```)(```"2````D@```)(```"<F```
+MU````-0```#4````U````-0```"<F```S!0``,P4``#,%```S!0``,P4``"<
+MF```C`0``(P$``",!```C`0``(P$``#$F````P````,````#`````P````,`
+M```P-0$`8#H!`)!*`0`0-P$`($$!`,!.`0```````````````````````0``
+M`$8```!@`````0```$8```!A`````0```$8```!B`````0```$8```!C````
+M`0```$8```!D`````0```$8```!E`````0```$8```!F`````0```$8```!G
+M`````0```$8```!H`````0```$8```!I`````0```$8```!J`````0```$8`
+M``!K`````0```$8```!L`````0```$8```!T`````0```$8```!T`````0``
+M`$8```!T`````0```$8```!T`````0```$8```!T`````0```$8```!T````
+M`0```$8```!T`````0```$8```!T`````0```$8```!U`````0```$8```!V
+M`````0```$8```!W`````0```$8```!X`````0```$8```!Y`````0```$8`
+M``!Z`````0```$8```![`````0```$8```!\`````0```$8```!]`````0``
+M`$8```!^`````0```$8```!_`````0```$8```"``````0```$0```!\````
+M`0```$8```"(`````0```$8```",`````0```$8```"0`````0```$8```"4
+M`````0```$8```"8`````0```$8```"<`````0```$8```"@`````0```$8`
+M``"D`````0```$8```"H`````0```$8```"L`````0```$8```"P`````0``
+M`$8```"T``````('`````P`&``D`/```````````````"0````0````$``$`
+M`0`!``8```!&1S@`````````````````!`````$``0`$````1D<W````````
+M``````````,``0`!``$``P```$9'-@`````````````````$```````!``$`
+M``!&1S4`````````````````!``!``$`````````1D<T````````````````
+M``0````!````_O___T9',P`````````````````#``$``0```/W___]&1S(`
+M````````````````!`````````#\____1D<Q``````````````````(``0`!
+M````^O___T9',```````````````````````````````````````````````
+M````````071H97)O<R`U,C$R("A&4$=!*0!!=&AE<F]S(#4R,3$@*$901T$I
+M`$%T:&5R;W,@-3(Q,`!!=&AE<F]S(#4R,3$`071H97)O<R`U,C$R`"4P-'@@
+M)3`X>"`@)3`T>"`E,#AX("`E,#1X("4P.'@@("4P-'@@)3`X>"`@)3`T>"`E
+M,#AX"@`E,#1X("4P.'@@("4P-'@@)3`X>"`@)3`T>"`E,#AX("`E,#1X("4P
+M.'@*`"4P-'@@)3`X>"`@)3`T>"`E,#AX("`E,#1X("4P.'@*`"4P-'@@)3`X
+M>"`@)3`T>"`E,#AX"@`E,#1X("4P.'@*`"4M.',@)3`X>"`@)2TX<R`E,#AX
+M("`E+3AS("4P.'@@("4M.',@)3`X>`H`)2TX<R`E,#AX("`E+3AS("4P.'@@
+M("4M.',@)3`X>`H`)2TX<R`E,#AX("`E+3AS("4P.'@*`"4M.',@)3`X>`H`
+M1$(`1$5"54<`3D$`3D]?0T]53E1265]3150`04P`04Q"04Y)00!$6@!!3$=%
+M4DE!`$%2`$%21T5.5$E.00!!30!!4DU%3DE!`$%5`$%54U1204Q)00!!5`!!
+M55-44DE!`$%:`$%:15)"04E*04X`0D@`0D%(4D%)3@!"60!"14Q!4E53`$)%
+M`$)%3$=)54T`0EH`0D5,25I%`$)/`$)/3%9)00!"4@!"4D%:24P`0DX`0E)5
+M3D5)($1!4E534T%,04T`0D<`0E5,1T%224$`0T$`0T%.041!`$-,`$-(24Q%
+M`$-.`$-(24Y!`$-/`$-/3$]-0DE!`$-2`$-/4U1!(%))0T$`2%(`0U)/051)
+M00!#60!#65!255,`0UH`0UI%0T@@4D5054),24,`1$L`1$5.34%22P!$3P!$
+M3TU)3DE#04X@4D5054),24,`14,`14-5041/4@!%1P!%1UE05`!%10!%4U1/
+M3DE!`$9)`$9)3DQ!3D0`1E(`1E)!3D-%`$=%`$=%3U)'24$`1$4`1T5234%.
+M60!'4@!'4D5%0T4`1U0`1U5!5$5-04Q!`$A+`$A/3D<@2T].1P!(50!(54Y'
+M05)9`$E3`$E#14Q!3D0`24X`24Y$24$`240`24Y$3TY%4TE!`$E2`$E204X`
+M244`25)%3$%.1`!)3`!)4U)!14P`250`251!3%D`2E``2D%004X`2C,`2D%0
+M04XS`$I/`$I/4D1!3@!+6@!+05I!2TA35$%.`$M0`$Y/4E1(($M/4D5!`$M2
+M`$M/4D5!(%)%4%5"3$E#`$LR`$M/4D5!(%)%4%5"3$E#,@!+5P!+55=!250`
+M3%8`3$%45DE!`$Q"`$Q%0D%.3TX`3$D`3$E%0TA414Y35$5)3@!,5`!,251(
+M54%.24$`3%4`3%5814U"3U521P!-3P!-04-!50!-2P!-04-%1$].24$`35D`
+M34%,05E324$`35@`345824-/`$U#`$U/3D%#3P!-00!-3U)/0T-/`$Y,`$Y%
+M5$A%4DQ!3D13`$Y:`$Y%5R!:14%,04Y$`$Y/`$Y/4E=!60!/30!/34%.`%!+
+M`%!!2TE35$%.`%!!`%!!3D%-00!010!015)5`%!(`%!(24Q)4%!)3D53`%!,
+M`%!/3$%.1`!05`!03U)454=!3`!04@!054525$\@4DE#3P!100!1051!4@!2
+M3P!23TU!3DE!`%)5`%)54U-)00!300!3055$22!!4D%"24$`4T<`4TE.1T%0
+M3U)%`%-+`%-,3U9!2R!215!50DQ)0P!320!33$]614Y)00!:00!33U542"!!
+M1E))0T$`15,`4U!!24X`4T4`4U=%1$5.`$-(`%-7251:15),04Y$`%-9`%-9
+M4DE!`%17`%1!25=!3@!42`!42$%)3$%.1`!44@!455)+15D`54$`54M204E.
+M10!!10!53DE4140@05)!0B!%34E2051%4P!'0@!53DE4140@2TE.1T1/30!5
+M4P!53DE4140@4U1!5$53`%59`%5254=505D`5D4`5D5.15I514Q!`%9.`%9)
+M150@3D%-`%181%`P`%181%`Q`$-2`%)81%``0T9'`$E34@!)35(`2452`$)#
+M4@!46$-&1P!26$-&1P!-24)#`%1/4%,`4EA.3T92`%183D]&4@!24$=43P!2
+M1D-.5`!-25-#`%)#`%-#4@!)3E1014Y$`%-&4@!00TE#1D<`1U!)3T-2`%-2
+M158`4U1!7TE$,`!35$%?240Q`$)34U])1#``0E-37TE$,0!33$]47U1)30!4
+M24U%7T]55`!24U-)7U1(4@!2151265],30!54T5#`$)%04-/3@!#1E!?4$52
+M`%1)3452,`!424U%4C$`5$E-15(R`%1)3452,P!)1E,P`$E&4S$`0T907T15
+M4@!26%]&24Q44@!-0T%35%\P`$U#05-47S$`5%A-05-+,`!46$U!4TLQ`%12
+M24=,158`1$E!1U]35P!44T9?3#,R`%131E]5,S(`3$%35%]44U0`4D544EE#
+M3E0`0D%#2T]&1@!.058`4E137T]+`%)44U]&04E,`$%#2U]&04E,`$9#4U]&
+M04E,`$)%04-?0TY4``IA<C4R,3`@<F5G:7-T97(@<W1A=&4Z"@`*`$-2`%)8
+M1%``0T9'`$E%4@!25%-$,`!25%-$,0!46$-&1P!26$-&1P!*3$%35`!-24)#
+M`%1/4%,`4EA.4%1/`%183E!43P!21D=43P!21D-.5`!-25-#`$1?4TE&4P!$
+M7U-,3U0`1%]%2493`$1?34E30P!$7U184%-%`%)#`%-#4@!)3E1014Y$`%-&
+M4@!00TE#1D<`1U!)3T-2`%-2158`4U1!7TE$,`!35$%?240Q`$)34U])1#``
+M0E-37TE$,0!33$]47U1)30!424U%7T]55`!24U-)7U1(4@!54T5#`$)%04-/
+M3@!#1E!?4$52`%1)3452,`!424U%4C$`5$E-15(R`%1)3452,P!#1E!?1%52
+M`%)87T9)3%12`$U#05-47S``34-!4U1?,0!$24%'7U-7`%131E],,S(`5%-&
+M7U4S,@!44U1?041!0P!$149?04Y4`$Q!4U1?5%-4`$Y!5@!25%-?3TL`4E13
+M7T9!24P`04-+7T9!24P`1D-37T9!24P`0D5!0U]#3E0`"F%R-3(Q,2!R96=I
+M<W1E<B!S=&%T93H*``H`24U2.B`E,#AX(%,P("4P.'@@4S$@)3`X>"!3,B`E
+M,#AX(%,S("4P.'@@4S0@)3`X>`H`25-2.B`E,#AX(%,P("4P.'@@4S$@)3`X
+M>"!3,B`E,#AX(%,S("4P.'@@4S0@)3`X>`H`45]21%E424U32$0`45]46$0`
+M45]46$4`)2TX<R`E,#AX("`E+3AS("4P.'@@("4M.',@)3`X>`H`45]/3D53
+M2$]405)-7U-#("4P.'@@(%%?3TY%4TA/5$%235]#0R`E,#AX"@!16R5U72!4
+M6$10("4P.'@@0T)2("4P.'@@4D195"`E,#AX($U)4T,@)3`X>"!35%,@)3`X
+M>`H`1%LE=5T@34%32R`E,#AX($E&4R`E,#AX(%)44ED@)3`X>"!#2$Y4("4P
+M.'@@34E30R`E,#9X(%-%42`E,#-X"@!$6R5U72!834E4($U!4TL@)3`X>"`E
+M,#AX("4P.'@@)3`X>`H`)7,Z($]U="!O9B!S<&%C92!I;B!!3DD@=&%B;&4@
+M9F]R(&-H86YN96P@)74O,'@E>"$*`$-2`%)81%``0T9'`$E%4@!46$-&1P!2
+M6$-&1P!-24)#`%1/4%,`4EA.4%1/`%183E!43P!24$=43P!24$-.5`!-04--
+M25-#`$1?4TE&4P!$7U-,3U0`1%]%2493`$1?34E30P!$7T900U1,`$1?5%A0
+M4T4`4D,`4T-2`$E.5%!%3D0`4T92`%!#24-&1P!'4$E/0U(`4U)%5@!35$%?
+M240P`%-405])1#$`0E-37TE$,`!"4U-?240Q`%-,3U1?5$E-`%1)345?3U54
+M`%)34TE?5$A2`%5314,`0D5!0T].`$-&4%]015(`5$E-15(P`%1)3452,0!4
+M24U%4C(`5$E-15(S`$-&4%]$55(`4EA?1DE,5%(`34-!4U1?,`!-0T%35%\Q
+M`$1)04=?4U<`5%-&7TPS,@!44T9?53,R`%135%]!1$%#`$1%1E]!3E0`3$%3
+M5%]44U0`3D%6`%)44U]/2P!25%-?1D%)3`!!0TM?1D%)3`!&0U-?1D%)3`!"
+M14%#7T-.5`!33$5%4#$`4TQ%15`R`%-,1450,P!"4U--4TM,`$)34TU32U4`
+M5%!#`%!(65]%4E(`5$9#3E0`4D9#3E0`4D-#3E0`0T-#3E0`"F%R-3(Q,B!R
+M96=I<W1E<B!S=&%T93H*``H`24U2.B`E,#AX(%,P("4P.'@@4S$@)3`X>"!3
+M,B`E,#AX(%,S("4P.'@@4S0@)3`X>`H`25-2.B`E,#AX(%,P("4P.'@@4S$@
+M)3`X>"!3,B`E,#AX(%,S("4P.'@@4S0@)3`X>`H`45]21%E424U32$0`45]4
+M6$0`45]46$4`)2TX<R`E,#AX("`E+3AS("4P.'@@("4M.',@)3`X>`H`45]/
+M3D532$]405)-7U-#("4P.'@@(%%?3TY%4TA/5$%235]#0R`E,#AX"@!16R5U
+M72!46$10("4P.'@@0T)2("4P.'@@4D195"`E,#AX($U)4T,@)3`X>"!35%,@
+M)3`X>`H`1%LE=5T@34%32R`E,#AX($E&4R`E,#AX(%)44ED@)3`X>"!#2$Y4
+M("4P.'@@34E30R`E,#9X(%-%42`E,#-X"@!$6R5U72!834E4($U!4TL@)3`X
+M>"`E,#AX("4P.'@@)3`X>`H`3F\@<W5P<&]R="!F;W(@=&AE(#4Q,3(@>65T
+M(0H``````````````````````````````````#`N.2XU+C$W`````(P4H!2T
+M%,@4/!10%&04>!0``#(41A1:%&X4``!L"84)G@F*":@)``!L"84)G@F*"0``
+M;`F%"9X)B@D``&P)A0F>"8H)``!Q%H46F1:M%L$6``!:%((4JA0``(`6J!8`
+M`'P5D!6D%;@5S!7@%?05"!8<%C`61!8``'$)=@E["8`)CPF4"9D)HPD``'$)
+M=@E["8`)CPF4"9D)``!Q"78)>PF`"8\)E`F9"0``<0EV"7L)@`F/"90)F0D`
+M`+0)``"%"0``/!10%&04>!0```$````,`````0```!X````$````*`````0`
+M```T````!````#X````$````2`````$```!2`````@```%X````"````9@``
+M``$```!L````!````(0````$````E@````0```"F````!````+8````$````
+MQ@```"````#*````,A1&%%H4;A0``%H4@A2J%(`6J!8``'P5D!6D%;@5S!7@
+M%?05"!8<%C`61!8`````````````````````````````````````"```````
+M``````````````````````````````````````$"<!<+`(P``0(H(P\`$@`!
+M`N`N"@"8`@$"4$8.`"0"`0+`70D`L`0!`J",#0!(!`$"@+L(`&`$`0+PT@P`
+M;`0`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````````(
+M`````````````````````````````````````````````0-P%PL`C``!`R@C
+M#P`2``$#X"X*`)@"`0-01@X`)`(!`\!="0"P!`$#H(P-`$@$`0.`NP@`8`0!
+M`_#2#`!L!```````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````@````````````````````````````````````````````!`G`7"P",
+M``$"*",/`!(``0+@+@H`F`(!`E!&#@`D`@$"P%T)`+`$`0*@C`T`2`0!`H"[
+M"`!@!`$"\-(,`&P$````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````"`````````````````````````````````````````````$#
+M<!<+`(P``0,H(P\`$@`!`^`N"@"8`@$#4$8.`"0"`0/`70D`L`0!`Z",#0!(
+M!`$#@+L(`&`$`0/PT@P`;`0`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````$````````````````````````````````````````
+M`````0#H`PL`@@`!`-`'"@2$`0$`?!4)!(L!`0#X*@@$E@$`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````2B``````````````BB``!&1CY01D8^4`RB
+M``!L08!D;$&`9!"B```#H)D!`Z"9`12B```0UDP$$-9,!!BB``!``(`30`"`
+M$QRB``!@`.`;8`#@&R"B```*@%,,"H!3#"2B```[WQ0`.]\4`"BB``"U`0``
+MM0$``"RB```@````(````)R8`````````````)R8`````````````)R8````
+M`````````)R8`````````````)R8`````````````)R8`````````````)R8
+M`````````````)R8`````````````)R8`````````````)R8````````````
+M`)R8`````````````)R8`````#@````X`)R8`````````````)R8````````
+M`````)R8`````````````)R8``#Y``0`^0`$`-28````````!```````````
+M``````````````"<F`````````````"<F`````````````"<F```````````
+M``"<F`````````````"<F`````````````"<F```````$````!"<F```````
+M!`````2<F`````````````"<F`````````````"<F`````````````"<F```
+M``````````J<F```@``X`(``.`*<F```!@`"``8```"<F```D@```)(```"<
+MF```H````*````"<F```!P`$``<`!`#4F```&@```!H```"<F```2````$@`
+M``"<F```$````!````"<F```"`````@```"<F```#P````\```"<F```\@``
+M`&(```"<F```3Y```$R0``"<F```6A(``)H2``#,F```#@````\````!````
+MW`4``/0!``#T`0``R`````@`````````````````````````````````````
+M```````!`G`7"P",``$"*",/`!(``0+@+@H`F`(!`E!&#@`D`@$"P%T)`+`$
+M`0*@C`T`2`0!`H"["`!@!`$"\-(,`&P$````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````"```````````````````````````````
+M``````````````$#<!<+`(P``0,H(P\`$@`!`^`N"@"8`@$#4$8.`"0"`0/`
+M70D`L`0!`Z",#0!(!`$#@+L(`&`$`0/PT@P`;`0`````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````$````````````````````````
+M`````````````````````0#H`QL`@@`!`-`'&@2$`0$`?!49!(L!`0#X*A@$
+ME@$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````P`````````````````
+M```````````````````````````!`.@#&P`"``$`T`<:!`0!`0!\%1D$"P$!
+M`/@J&`06`0`"<!<+``P$``(H(P\`$@0!`N`N"@`8!@$"4$8.`"0&`0+`70D`
+M,`@!`J",#0!("`$"@+L(`&`(`0+PT@P`;`@`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````#```````````
+M``````````````````````````````````$$]`$'`($``03H`P(`BP$!!-`'
+M!@"6`@$$N`L!`)8#`0)P%PL`C`0!`B@C#P`2!`$"X"X*`)@&`0)01@X`)`8!
+M`L!="0"P"`$"H(P-`$@(`0*`NP@`8`@!`O#2#`!L"```````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````1T-#
+M.B`H1TY5*2`S+C,N,2!;1G)E94)31%T``$=#0SH@*$=.52D@,RXS+C$@6T9R
+M965"4T1=``!'0T,Z("A'3E4I(#,N,RXQ(%M&<F5E0E-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31%T``$=#0SH@*$=.52D@,RXS+C$@6T9R965"4T1=``!'0T,Z("A'
+M3E4I(#,N,RXQ(%M&<F5E0E-$70``1T-#.B`H1TY5*2`S+C,N,2!;1G)E94)3
+M1%T``"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E;"YT97AT`"YR96PN
+M<F]D871A`"YR;V1A=&$N<W1R,2XQ`"YR96PN9&%T80`N8G-S`"YC;VUM96YT
+M```````````````````````````````````````````````````````?````
+M`0````8`````````0````-)L`0```````````!``````````&P````D`````
+M`````````)00`@!@$@``"P````$````$````"````"D````!`````@``````
+M```@;0$`X%H`````````````(``````````E````"0``````````````]"("
+M`-@8```+`````P````0````(````,0````$````R``````````#(`0!G#@``
+M```````````!`````0```$0````!`````P````````"`U@$`I!``````````
+M````(`````````!`````"0``````````````S#L"`(`````+````!@````0`
+M```(````2@````@````#`````````$#G`0"P`0`````````````@````````
+M`$\````!``````````````!`YP$`N`,``````````````0`````````1````
+M`P``````````````^.H!`%@```````````````$``````````0````(`````
+M`````````%CM`0#`%```#`````<````$````$`````D````#````````````
+M```8`@(`>@X``````````````0``````````````````````````````````
+M`````````````P`!``````````````````,``P`````````````````#``4`
+M`````````````````P`&``````````````````,`"``````````````````#
+M``D``0```#"$``"N`0``$@`!``P```"P<0``"@```!(``0`7````(`@!`)4`
+M```2``$`(@```,`]```%`@``$@`!`"T```!D5P``#````!$``P`X````;`H`
+M``0````1``8`0P```*`!```B`0``$0`&`$X```#`'P$`3@```!(``0!9````
+M4$$``$$````2``$`9````*`Q``!)````$@`!`&\```#@$0$`)0```!(``0!Z
+M````X`$!``H````2``$`A0```'@*```$````$0`&`)````#@X@``N@```!(`
+M`0";````?`H```0````1``8`I@```-#5``#3````$@`!`+$```#PO0``Q```
+M`!(``0"\````0*0``!H````2``$`QP```/!U``!(````$@`!`-(````0'@$`
+M"@```!(``0#=````0.(```H````2``$`Z````#```0`I````$@`!`/,```"@
+MB@``"@```!(``0#^````4&L!`'0````2``$`"0$``,!Z```*````$@`!`!0!
+M``!@I```'0```!(``0`?`0``@`H``"(!```1``8`*@$``"!I`0`*````$@`!
+M`#4!``"`=P``U0```!(``0!``0``,`(``#4````2``$`2P$`````````````
+M$````&P!```P2```80```!(``0!W`0``$-\``+\````2``$`@@$``(!+```U
+M````$@`!`(T!``"@DP``<0```!(``0"8`0``T'H``&4````2``$`HP$``-`3
+M`0`^````$@`!`*X!``!@,`$`60```!(``0"Y`0``0$$```H````2``$`Q`$`
+M`$`S``!(!P``$@`!`,\!``!@F0``0`$``!(``0#:`0``4`T!`&X````2``$`
+MY0$``,`!``!D````$@`!`/`!```@7`$`TP```!(``0#[`0```!X!``H````2
+M``$`!@(``.`)`0!G````$@`!`!$"``!@V```!0```!(``0`<`@``L$H``#T`
+M```2``$`)P(```"+```G`0``$@`!`#("``!@D0``QP```!(``0`]`@``8`@`
+M`#@"```2``$`2`(``)!@`0#%````$@`!`%,"``!08P``^@,``!(``0!>`@``
+MH$T```4````2``$`:0(``-"#```%````$@`!`'0"``"`<@``;P,``!(``0!_
+M`@``T````.H````2``$`C@(`````````````$````)4"```@'@$`7P```!(`
+M`0"@`@```)D``",````2``$`JP(``*`>`0`=````$@`!`+8"```PE@``(```
+M`!(``0#!`@```-D``,$````2``$`S`(``*"T``!I````$@`!`-<"``"0.@``
+M%0```!(``0#B`@``\$H``(4````2``$`[0(``'`"```J`0``$@`!``,#``!`
+M>P``HP```!(``0`.`P``\(@``"@````2``$`&0,``$`P`0`=````$@`!`"0#
+M``!0!`$`*`(``!(``0`O`P``X``!``X````2``$`.@,``-!"``#7````$@`!
+M`$4#`````````````!````!7`P``,(8``(P````2``$`8@,``'!,```*````
+M$@`!`&T#````Y```30```!(``0!X`P``P)@```4````2``$`@P,``$`"`0`G
+M`0``$@`!`(X#``"PF```!0```!(``0"9`P``H$<``(D````2``$`I`,``,"0
+M``"5````$@`!`*\#``!PV```CP```!(``0"Z`P``4/,``(0%```2``$`Q0,`
+M`(`1`0`*````$@`!`-`#```@(0$`P````!(``0#;`P``,&D!`%\!```2``$`
+MY@,``*"C```*````$@`!`/$#``#0IP``4@```!(``0#\`P``($<``#\````2
+M``$`!P0``.#X```C````$@`!`!($``#`W@``20```!(``0`=!```L$T```4`
+M```2``$`*`0``/`=`0`*````$@`!`#,$`````````````!````!`!```,'(`
+M`$0````2``$`2P0``'!5``!2````$@`!`%8$``!0#@$`M@```!(``0!A!```
+M$`0``'D````2``$`<@0``*!B`0#M`P``$@`!`'T$``#`2P``K````!(``0"(
+M!```L'@```T!```2``$`DP0``!`2`0`C````$@`!`)X$`````````````!``
+M``"D!```8%0``,`````2``$`KP0``+`'`0`/````$@`!`+H$``"PB@``00``
+M`!(``0#%!```P+<``)T!```2``$`T`0``.!P``#/````$@`!`-L$``#`"P``
+M(@$``!$`!@#F!````",!`%(````2``$`\00``."%``!,````$@`!`/P$```P
+MJ```U0```!(``0`'!0``D)@```H````2``$`$@4``-"8```E````$@`!`!T%
+M``!@80$`P0```!(``0`H!0``,.4``*`&```2``$`,P4``'!````.````$@`!
+M`#X%``#`A@``*`(``!(``0!)!0``T/P``$P````2``$`5`4``(`+`0!I````
+M$@`!`%\%``"@#P$`50```!(``0!J!0````T``"(!```1``8`=04``*#@``#=
+M````$@`!`(`%``"`3```.P```!(``0"+!0``P'$```4````2``$`E@4``("D
+M```I````$@`!`*$%``#050``)`$``!(``0"L!0``\`L!`%@!```2``$`MP4`
+M`(`\``"H````$@`!`,(%``"@XP``5P```!(``0#-!0``4&$``"4````2``$`
+MV`4``.!1```=````$@`!`.,%``#02```2`$``!(``0#N!0``0%4``#`````2
+M``$`^04``,`(`0"8````$@`!``0&``#`,@$`N`$``!(``0`/!@``4&@!`,T`
+M```2``$`&@8``"!1``!-````$@`!`"4&``"`X0``"@```!(``0`P!@``(`0`
+M`"(!```1``8`.P8``#"8```*````$@`!`$8&``"P0P``*`(``!(``0!1!@``
+M(%4``"`````2``$`7`8`````````````$````'P&``!@[```J````!(``0"'
+M!@```%<``)<)```2``$`D@8````````)````$0`&`*(&``"0!```<@```!(`
+M`0"S!@``,)(``%\````2``$`O@8``.`-`0!I````$@`!`,D&``"@F```"@``
+M`!(``0#4!@``D*,```X````2``$`WP8``#",``#7````$@`!`.H&``"`$@$`
+M0`$``!(``0#U!@``P%````H````2``$```<`````````````$`````\'````
+MDP``7@```!(``0`:!P``L!T!`"8````2``$`)0<``(`=`0`H````$@`!`#`'
+M```@_0``C````!(``0`[!P``H&```*@````2``$`1@<``)`1`0!.````$@`!
+M`%$'``#P``$`X0```!(``0!<!P``$!0!`!(!```2``$`9P<``,"5``!N````
+M$@`!`'('``!0(@$`IP```!(``0!]!P``8/$``#<!```2``$`B`<``!"-```H
+M`@``$@`!`),'``#`>0``"@```!(``0">!P```%,``$X````2``$`J0<``""0
+M``!!````$@`!`+0'``!@(`$`P````!(``0"_!P``P$P``$T````2``$`R@<`
+M`)"2``!F````$@`!`-4'``"0E```*`$``!(``0#@!P``($H``&X````2``$`
+MZP<``-!F`0!K````$@`!`/8'``#`!P$`5````!(``0`!"```8`4``"(!```1
+M``8`#`@``("G```@````$@`!`!<(```@B0``>P```!(``0`B"```H````"T`
+M```2``$`,`@``*#R```%````$@`!`#L(````1P``%0```!(``0!&"```X`(`
+M`"(!```1``8`40@``,!-``!-````$@`!`%P(``#`I@``P````!(``0!G"```
+M```````````0````;0@``*")```.````$@`!`'@(``#@&@$`!0```!(``0"#
+M"```\`$!`$$````2``$`C@@``!!0``"-````$@`!`)D(```0[0``/0(``!(`
+M`0"D"```X!T!``H````2``$`KP@``*!0```.````$@`!`+H(``!0'P$`;0``
+M`!(``0#%"```4"T``',````2``$`T`@``)!F`0`V````$@`!`-L(````I@``
+MP````!(``0#F"```\!X!`%,````2``$`\0@``-#?```^````$@`!`/P(``"P
+MB0``X0```!(``0`'"0``4.(``(T````2``$`$@D``*`&```B`0``$0`&`!T)
+M``"P4@``3@```!(``0`H"0```$```&X````2``$`,PD``'!1``!(````$@`!
+M`#X)``!`V@``/00``!(``0!)"0``P*,```H````2``$`5`D``+#]``!^`@``
+M$@`!`%\)``"@IP``*````!(``0!J"0``@"\``$`````2``$`=0D``/`*`0",
+M````$@`!`(`)``"PHP``"@```!(``0"+"0``8`D!`'H````2``$`E@D``,!1
+M```:````$@`!`*$)``!PD```#P```!(``0"L"0``<`H```0````1``8`MPD`
+M`$"8``!%````$@`!`,()``#@6@$`0@```!(``0#-"0``H`,``&$````2``$`
+MV`D``&`'`0!!````$@`!`.,)``!`Q@``H`$``!(``0#N"0``T#\``"@````2
+M``$`^0D``)!J`0"V````$@`!``0*``!@1P``-0```!(``0`/"@``@`4``-@"
+M```2``$`&@H``'`#`0#7````$@`!`"4*``"`EP``K````!(``0`P"@``D.$`
+M`*\````2``$`.PH`````````````$````%L*```0!0``9````!(``0!F"@``
+M$$8``'X````2``$`<0H``)!&``!!````$@`!`'P*``"P4```"@```!(``0"'
+M"@``@)```#\````2``$`D@H``*!!```G`0``$@`!`)T*```@E```:0```!(`
+M`0"H"@``,!4!`+`%```2``$`LPH``#"9```H````$@`!`+X*``!@(P$`^@``
+M`!(``0#)"@``X$4``"D````2``$`U`H`````````````$````.(*``!`CP``
+M*0```!(``0#M"@``L*4``$@````2``$`^`H``"!B```O`0``$@`!``,+``!0
+M4P``2````!(``0`."P``@`8!`"D````2``$`&0L``,`>`0`I````$@`!`"0+
+M``!@DP``-0```!(``0`O"P``L`H!`#4````2``$`.@L``!!-``!J````$@`!
+M`$4+``"02@``(````!(``0!0"P``X*,``%\````2``$`6PL``%"6```]````
+M$@`!`&8+``#0>0``YP```!(``0!Q"P``<(\``*$````2``$`?`L``*!(```L
+M````$@`!`(<+``#0<0``8````!(``0"2"P``0`X``"(!```1``8`G0L``#`]
+M``",````$@`!`*@+``"`0```L0```!(``0"S"P``4`H!`%X````2``$`O@L`
+M`,`3`0`*````$@`!`,D+```@EP``50```!(``0#4"P``T*,```H````2``$`
+MWPL``."B``"M````$@`!`.H+```0J0``9PL``!(``0#U"P``@`\``"(!```1
+M``8```P``-!K`0`"`0``$@`!``L,```P8@$`8@```!(``0`6#```T%```$(`
+M```2``$`(0P```!2```I````$@`!`"P,``"`'@$`&@```!(``0`W#```,%(`
+M`(`````2``$`0@P``$""```5````$@`!`$T,``!`=@``<P```!(``0!8#```
+M$*4``$X````2``$`8PP``)!-```*````$@`!`&X,``"@F@``L`4``!(``0!Y
+M#```T-D``&(````2``$`A`P``!`@`0!(````$@`!`(\,``!@,@``7@```!(`
+M`0":#```\"D``%H#```2``$`L`P``.`A`0!E````$@`!`+L,``"P.@``!0``
+M`!(``0#&#```H%,``,`````2``$`T0P``&`D`0#7"P``$@`!`-P,``!@``$`
+M>P```!(``0#G#```$.```(T````2``$`\@P``&"E``!.````$@`!`/T,``#`
+M=@``M0```!(``0`(#0``T!X``)\````2``$`$PT``#`1`0!"````$@`!`!X-
+M``"`80``F0```!(``0`I#0``L*0``%,````2``$`-`T``("T```=````$@`!
+M`#\-``#P.@``@@$``!(``0!*#0``@$T```H````2``$`50T``.!&```/````
+M$@`!`&`-``"0U```0@```!(``0!K#0``\!P!`(T````2``$`=@T````0`0`P
+M`0``$@`!`($-``"0E@``A0```!(``0",#0``D'P``*P%```2``$`EPT``(#Z
+M```%````$@`!`*(-```0;0``"@,``!(``0"M#0``0!(!`#T````2``$`N`T`
+M`'0*```$````$0`&`,,-``"`W@``-@```!(``0#.#0``6%<```P````1``,`
+MV0T``,`O``!B````$@`!`.0-```0#P$`A0```!(``0#O#0``L`8!`*$````2
+M``$`^@T``,`P`0#\`0``$@`!``4.``!`9P$`8P```!(``0`0#@``X/H``.(!
+M```2``$`&PX`````````````$````"H.``#P1@``"@```!(``0`U#@``8'@`
+M`$T````2``$`0`X``,`-`0`@````$@`!`$L.```0M0``K`(``!(``0!6#@``
+M\#$``&P````2``$`;PX``+!G`0";````$@`!``!Z>C`P-6(U.#0V`'IZ,#`R
+M9&(Q,6,`>GHP,#)D8C0V,`!Z>C!B-V(X,S8X`'IZ,#`P,F1A9CD`>GHP8V9A
+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8`>GHP-F0Y-65B-@!Z>C`Q-F1F8C@W`'IZ,#`Q-F1A-#@`>GHP
+M,#)D8C`Y,@!A=&A?:&%L7V=E='=I<F5L97-S;6]D97,`>GHP,39E,6(X-P``
+M`%,````!`P``8`````$#``!O`````0,``'8````!`P``@0````$#``!I`0``
+M`EH``(0!```".`$`G@$```(N```(`@```OH``&@&```!`P``=`8```)%`0!#
+M!P```0,``$\'```"10$`N0<```$#``#%!P```D4!``X(```!`P``&@@```)%
+M`0`]"````0,``$D(```"10$`(PD```$#```O"0```D4!`-\)```!`P``ZPD`
+M``)%`0`]"@```0,``$D*```"10$`<PH```$#``!_"@```D4!`,0*```!`@``
+MS0H```$"``!6%P```0(``&@7```!`@``J1\```$"``#I'P```0(``%T@```!
+M`@``!"$```$"```D(0```0(``#<A```!`@``S"$```$"``#6(0```0(``.HA
+M```!`@``]"$```$"```J(@```0(``#$B```!`@``1R,```$"``!N(P```0(`
+M`!HD```!`@``F20```$"``#Y)````0(```$E```!`@``.24```$"``!!)0``
+M`0(``(DE```!`@``G24```$"``"F)0```0(``+0E```!`@``(2<```$"```O
+M)P```0(``)PG```!`@``O"<```$"```G*````0(``#\H```!`@``5R@```$"
+M``"!*@```DH!`/@J```!`@``_BH```$"``"U+````0(``,DL```!`0``%RT`
+M``+#``!0+@```0(``+`P```!`@``D3(```$"``!>,P```J,``'XS```!`@``
+MD3,```$"``"A,P```0(``"LT```"_0``!#4```(D``!?-0```O```)LU```"
+M\```UC4```+P```P-@```O```',V```"\```>#D```+P``!I.@```F4``)TZ
+M```"90``,CL```$E``!5.P```>X``*`\```"^@``R$4```)/```!1@```D``
+M`%-&```",0``.$<```+I``!41P```E<``!Y(```"#0$`!4D```)```#[20``
+M`A<!``5*```"D0``RDT```$#``#630```D4!`-Y-```!`P``ZDT```)%`0#Z
+M30```0(```5.```".0``STX```+Z```$3P```OH``()1```!P```D5$```$-
+M``"K40```N\``)12```"^@``2%<```+]``"D6P```HT``&-=```!`@``@%T`
+M``$"``"G70```CH!`*1?```"^@``\E\```(Q```!8````G,``"M@```"/@``
+M16````)@``"H80```L<``-YA```"^@```F(```+Z``!18@```L<``,!B```"
+M^@``[6(```+Z```-8P```L<``,YC```"^@``$&0```+Z```X9````OH``#YE
+M```"^@``@&4```+Z``#B90```OH``#)F```",0``H68```)S``"Q9@```OH`
+M`,!F```"<P``C6<```+Z``"M9P```C$``!UM```!`@``.VT```$"``!`;0``
+M`L,``+%M```")```X6T```(D``!1;P```B0``'!O```")```C&\```(D```_
+M<````LP``'AP```")```-G$```(Q``!8<0```OH``--V```"?```YG8```(-
+M`0`P=P```@T!`&)W```"#0$`4'D```+Z``"B>0```C$``(-\```")```J'P`
+M``*C``#&?````0(``-9\```!`@``XWP```$"``!R?0```DD!`-A]```"^@``
+MN'X```+Z``#O?@```@@!`%]_```""`$`F'\```((`0``@````0(``$"````!
+M"`$`4X````(L`0"F@````OH``.*````"^@``*X$```((`0!>@0```K(``&:!
+M```"-`$`BH$```((`0`=@@```AL!`$V"```"90``N(,```+Z``#GA````24`
+M`#F%```!)0``7(4```'N``#\A0```BD!``R&```"^@``*(\```*@``!ACP``
+M`D```-:/```",0``Z9````((`0!YD0```@$!`)61```"*0``IY$```*U``#T
+MD0```@$!`!R2```"I```"90```+1``!GE````0(``,64```"0```?9@```+1
+M``"PF@```0,``+R:```"10$`Q)H```$#``#0F@```D4!`.":```!`@``Z)H`
+M``(Y``"JFP```0,``+:;```"10$`>)P```$#``"$G````D4!`(R<```!`P``
+MF)P```)%`0#PG````0,``/R<```!`P``")T```$#```0G0```0,``!R=```"
+M10$`7IT```$#``!JG0```D4!`"V>```!`P``.9X```)%`0!+G@```0,``%>>
+M```"10$`-)\```$#``!`GP```D4!`"Z@```!`P``.J````)%`0`/H0```OH`
+M`$2A```"^@``"*0```&3```1I````=,``!BD```!N@``,J0```+O``#SI```
+M`C$``)6J```"20$`Q:L```(D``#:JP```B0``.*K```!!````JP```$$```O
+MK````00``$FL```!!```?JP```$"``"9K````0(``+^L```!`@``V:P```$"
+M```#K0```0(``""M```!`@``YK````+F``#`L0```OH```ZR```",0``';(`
+M``(7``#8L@```M<``!6T```"6```(;0```(X``#(M````A(!`/:T```"^@``
+M/[4```(2`0`=M@```OH``'NV```"^@``'[<```+Z``!QMP```OH``)&W```"
+M$@$`^+@```(7```(N0```OH``!2Y```"%P``M;D```+Z``#5N0```C$``"VZ
+M```"S```4+H```)I``!FN@```0(``'RZ```")```C;H```$"``"^N@```B0`
+M`.FZ```")```<+P```+Z```3O@```B(!`$N^```!`@``[K\```$$```+P```
+M`00``"C````!!```X<````$$``#]P````B0``!?!```!!```,,$```(D``!3
+MP0```B0``&7!```!!```?L$```(D``">P0```B0``*[!```!!```W,$```$$
+M``#EP0```00``'O#```"+P``5<<```(0``"FQP```0(```G(```!!0``#L@`
+M``)N```=R````04``"+(```";@``)\@```$%``!$R````04``%W(```!!0``
+M9,@```$%``!MR````04``'O(```!!0``F\@```$%``"[R````04``,?(```!
+M!0``V\@```$%````R0```04``"S)```!!0``.LD```$%``!$R0```04``./)
+M```!!0``^<D```$%``!VR@```04``(?*```!!0``M<H```$%``#<R@```04`
+M`//*```!!0``^,H```$%```TRP```04``$7+```!!0``W\L```(_`0`AS```
+M`ML``*#-```!`@``I<X```$%``"VS@```04``-3.```!!0``Y<X```$%``#\
+MS@```04``!+/```!!0``(<\```$%```PSP```04``#_/```!!0``:\\```$%
+M``!ZSP```04``(G/```!!0``F,\```$%``#$SP```04``)[4```!`@``M-0`
+M``$"``#LU@```0(``#;7```!`@``2=<```$"``!YUP```0(``)S7```!`@``
+MQM<```$"``#9UP```0(```7=```![@``"]T```$E```;W0```9<``"#?```"
+MQ```,]\```+1``"`WP```M$``+[?```"T0``&.$```(I`0`HX0```OH``+3C
+M```"HP``QN,```*C```EY````F4``/_D```!`@``!^4```$#```2Y0```D4!
+M`%;E```!`@``V^L```$,``#HZP```0P``/KK```!#```!.P```$,```9[```
+M`E```%+L```";@``=NP```)0```U[0```E```)7M```")`$`INT```*M``##
+M[0```N0``/#M```">P``$>X```)[```][@```GL``&GN```">P``ENX```)[
+M``##[@```GL``/'N```">P``_.X```$\`0`7[P```14``)3O```">P``QN\`
+M``)[``#C[P```N0``!GP```">P``1O````)[``!R\````N0``)SP```">P``
+MP_````)[``#7\````B0!`.CP```"K0``\_````'A```.\0```1,``!7Q```!
+M/`$`,/$```$5``"2\0```GL``+KQ```">P``W/$```)[``#Z\0```GL``!KR
+M```">P``*O(```(D`0`[\@```JT``$'R```!X0``7/(```$3``!Z\@```B0!
+M`(OR```"K0``0_,```(D``!H\P```J,``('S```!`@``D/,```$"``":\P``
+M`0(``%ST```"0@$`8/4```)!`0#3]0```D$!`!'V```"00$`</8```$"``!U
+M]@```0(``+;V```!00$`R_8```(L`0`K]P```OH``&WW```"^@``I/<```)!
+M`0#']P```N,``.[W```"00$`@/@```$+``",^````3X!`)?X```"B0``N/@`
+M``)A``#P^````E,``/CX```"90``:/H```+Z``"7^P```24``.G[```!)0``
+M#/P```'N``#L_````DL!`/S\```"^@``:`8!``+K``"A!@$``D```!8'`0`"
+M,0``20@!``)!`0#<"`$``C0``"0)`0`"`@$`3`D!``+<``!Q"P$``JH``,<+
+M`0`!`@``)0P!``)```#8%`$``BL``$`5`0`!`P``3!4!``)%`0!4%0$``0,`
+M`&`5`0`"10$`<!4!``$"``!X%0$``CD``#H6`0`!`P``1A8!``)%`0`(%P$`
+M`0,``!07`0`"10$`'!<!``$#```H%P$``D4!`(`7`0`!`P``C!<!``$#``"8
+M%P$``0,``*`7`0`!`P``K!<!``)%`0#N%P$``0,``/H7`0`"10$`O1@!``$#
+M``#)&`$``D4!`-L8`0`!`P``YQ@!``)%`0#$&0$``0,``-`9`0`"10$`OAH!
+M``$#``#*&@$``D4!`"\;`0`"^@``9!L!``+Z```T'@$``0(``#D>`0`!(0``
+M01X!``&!``!('@$``0L!`%$>`0`!=```6!X!``$4`0!R'@$``N\``#,?`0`"
+M,0``HQ\!``*N``#T(P$``I@``&\E`0`"0@$`/"8!``$"``!))@$``0(``'0F
+M`0`"^@``DR8!``$"``"U)@$``0(``-PF`0`"^@``'"<!``$"```I)P$``0(`
+M`%0G`0`"^@``>2<!``$"``"`)P$``0(``*<G`0`"^@``S"<!``$"``#6)P$`
+M`0(```0H`0`"^@``+"@!``$"```Y*`$``0(``&0H`0`"^@``B2@!``$"``"0
+M*`$``0(``+<H`0`"^@``W"@!``$"``#F*`$``0(``!0I`0`"^@``'2X!``+Z
+M```K+P$``FH``+`O`0`""0``OR\!``*.``#B+P$``C$``(@P`0`"-0$`"S$!
+M``(U`0"@,0$``OH``*`R`0`"^@``"#0!``+Z``#5-`$``OH``/4T`0`",0``
+M2C4!``+,``!M-0$``FD``(<U`0`!`@``FC4!``(D``"K-0$``0(``#@V`0`"
+M)```8S8!``(D```:-P$``0,``"4W`0`"10$`8#@!``+Z``"S.0$``B(!`.LY
+M`0`!`@``MCP!``$"``!9/0$``0(``(0]`0`"^@``ICT!``$"``"M/0$``0(`
+M`-0]`0`"^@``^3T!``$"```,/@$``0(``#L^`0`"^@``63X!``$"``!L/@$`
+M`0(``)L^`0`"^@``J3X!``$"``#Y/P$``0(``"1``0`"^@``/$`!``$"``"Y
+M0`$``0(``.1``0`"^@``*D$!``$#```U00$``D4!`&I!`0`")```4T,!``*A
+M``"J1P$``FX``,!'`0`";@``XD<!``$"``".2P$``FX``,I.`0`!`P``U4X!
+M``)%`0!Q3P$``C\!`)5/`0`"$```25`!``+;```/4P$``L,``.Y:`0`!`@``
+M!%L!``$"```\70$``0(``(9=`0`!`@``F5T!``$"``#)70$``0(``.Q=`0`!
+M`@``%EX!``$"```I7@$``0(``-A>`0`"00``,E\!``))``!Q7P$``D$``-M?
+M`0`"20``16`!``))``"O8`$``JH``$%A`0`"J@``)V4!``'N```M90$``24`
+M`#ME`0`!EP``R&@!``)+`0#8:`$``OH``*0````!`P``J`````$#``"X````
+M`0,``+P````!`P``S`````$#``#0`````0,``.`````!`P``Y`````$#``#T
+M`````0,``/@````!`P``"`$```$#```,`0```0,``!P!```!`P``(`$```$#
+M```P`0```0,``#0!```!`P``1`$```$#``!(`0```0,``%@!```!`P``7`$`
+M``$#``!L`0```0,``'`!```!`P``@`$```$#``"$`0```0,``)0!```!`P``
+MF`$```$#``"H`0```0,``*P!```!`P``O`$```$#``#``0```0,``-`!```!
+M`P``U`$```$#``#D`0```0,``.@!```!`P``^`$```$#``#\`0```0,```P"
+M```!`P``$`(```$#```@`@```0,``"0"```!`P``-`(```$#```X`@```0,`
+M`$@"```!`P``3`(```$#``!<`@```0,``&`"```!`P``<`(```$#``!T`@``
+M`0,``(0"```!`P``B`(```$#``"8`@```0,``)P"```!`P``K`(```$#``"P
+M`@```0,``,`"```!`P``Q`(```$#``#4`@```0,``-@"```!`P``Z`(```$#
+M``#L`@```0,``/P"```!`P````,```$#```0`P```0,``!0#```!`P``)`,`
+M``$#```H`P```0,``#@#```!`P``/`,```$#``!,`P```0,``%`#```!`P``
+M8`,```$#``!D`P```0,``'0#```!`P``>`,```$#``"(`P```0,``(P#```!
+M`P``G`,```$#``"@`P```0,``+`#```!`P``M`,```$#``#$`P```0,``,@#
+M```!`P``V`,```$#``#<`P```0,``.P#```!`P``\`,```$#````!````0,`
+M``0$```!`P``%`0```$#```8!````0,``"@$```!`P``+`0```$#```\!```
+M`0,``$`$```!`P``4`0```$#``!4!````0,``&0$```!`P``:`0```$#``!X
+M!````0,``'P$```!`P``C`0```$#``"0!````0,``*`$```!`P``I`0```$#
+M``"T!````0,``+@$```!`P``R`0```$#``#,!````0,``-P$```!`P``X`0`
+M``$#``#P!````0,``/0$```!`P``!`4```$#```(!0```0,``!@%```!`P``
+M'`4```$#```L!0```0,``#`%```!`P``0`4```$#``!$!0```0,``%0%```!
+M`P``6`4```$#``!H!0```0,``&P%```!`P``?`4```$#``"`!0```0,``)`%
+M```!`P``E`4```$#``"D!0```0,``*@%```!`P``N`4```$#``"\!0```0,`
+M`,P%```!`P``T`4```$#``#@!0```0,``.0%```!`P``]`4```$#``#X!0``
+M`0,```@&```!`P``#`8```$#```<!@```0,``"`&```!`P``,`8```$#```T
+M!@```0,``$0&```!`P``2`8```$#``!8!@```0,``%P&```!`P``;`8```$#
+M``!P!@```0,``(`&```!`P``A`8```$#``"4!@```0,``)@&```!`P``J`8`
+M``$#``"L!@```0,``+P&```!`P``P`8```$#``#0!@```0,``-0&```!`P``
+MY`8```$#``#H!@```0,``/@&```!`P``_`8```$#```,!P```0,``!`'```!
+M`P``(`<```$#```D!P```0,``#0'```!`P``.`<```$#``!(!P```0,``$P'
+M```!`P``7`<```$#``!@!P```0,``'`'```!`P``=`<```$#``"$!P```0,`
+M`(@'```!`P``F`<```$#``"<!P```0,``*P'```!`P``L`<```$#``#`!P``
+M`0,``,0'```!`P``U`<```$#``#8!P```0,``.@'```!`P``[`<```$#``#\
+M!P```0,````(```!`P``$`@```$#```4"````0,``"0(```!`P``*`@```$#
+M```P#0```00``#0-```!!```.`T```$$```\#0```00``$`-```!!```1`T`
+M``$$``!(#0```00``$P-```!!```4`T```$$``!4#0```00``&@-```!!```
+M;`T```$$``!P#0```00``'0-```!!```>`T```$$``!\#0```00``(`-```!
+M!```A`T```$$``"8#0```00``*`-```!!```I`T```$$``"H#0```00``*P-
+M```!!```L`T```$$``"T#0```00``+@-```!!```O`T```$$``#`#0```00`
+M`,0-```!!```V`T```$$``#<#0```00``.`-```!!```Y`T```$$``#H#0``
+M`00``.P-```!!```\`T```$$``#T#0```00``!`.```!!```%`X```$$```8
+M#@```00``!P.```!!```(`X```$$```D#@```00``"@.```!!```2`X```$$
+M``!,#@```00``%`.```!!```5`X```$$``!8#@```00``)`.```!!```E`X`
+M``$$``"8#@```00``)P.```!!```H`X```$$``"D#@```00``*@.```!!```
+MK`X```$$``"P#@```00``,@.```!!```S`X```$$``#0#@```00``-0.```!
+M!```V`X```$$``#<#@```00``.`.```!!```^`X```$$````#P```00```0/
+M```!!```"`\```$$```,#P```00``!`/```!!```%`\```$$```8#P```00`
+M`!P/```!!```(`\```$$```X#P```00``#P/```!!```0`\```$$``!$#P``
+M`00``$@/```!!```3`\```$$``!0#P```00``%0/```!!```<`\```$$``!T
+M#P```00``'@/```!!```?`\```$$``"`#P```00``(0/```!!```B`\```$$
+M``"H#P```00``*P/```!!```L`\```$$``"T#P```00``+@/```!!```Z`\`
+M``$$``#T#P```00````0```!!```&!````$!```<$````0$``"`0```!`0``
+M)!````$!```H$````0$``"P0```!`0``,!````$!```T$````0$``#@0```!
+M`0``/!````$!``!`$````0$``$00```!`0``2!````$!``!,$````0$``%`0
+M```!`0``5!````$!``!8$````0$``%P0```!`0``8!````$!``!D$````0$`
+M`&@0```!`0``;!````$!``!P$````0$``'00```!`0``>!````$!``!\$```
+M`0$``(`0```!`0``A!````$!``"($````0$``(P0```!`0``D!````$!``"4
+M$````0$``)@0```!`0``*!$```'6```L$0```4<``#`1```!F0``-!$```&H
+M```X$0```3L``#P1```!*P$`0!$```$*`0!$$0```68``$@1```!/@``3!$`
+M``$9``!0$0```1P!`%01```!(P``6!$```%L``!<$0```0<!`&`1```!'P``
+M9!$```$J``!H$0```4H``&P1```!L```<!$```'?``!T$0```8L``'@1```!
+M&`$`?!$```$:`0"`$0```=0``(01```!L0``B!$```'^``",$0```6\``)`1
+M```!)@$`E!$```&6``"8$0```8T``)P1```!9P``H!$```&&``"D$0```3P`
+M`*@1```!P0``K!$```$E`0"P$0```80``+01```!8P``N!$```'Y``"\$0``
+M`?$``,`1```!)@``Q!$```&,``#($0```>D``,P1```!5P``T!$```$$`0#4
+M$0```;<``-@1```!-@``W!$```$S`0#@$0```48!`.01```!OP``Z!$```%(
+M``#L$0```2@``/`1```!:P``]!$```%2``#X$0```0@``/P1```!,@$``!(`
+M``$M```$$@```?0```@2```!#P``#!(```&5```0$@```4\``!02```!QP``
+M&!(```'*```<$@```?(``"`2```!H@``)!(```$7`0`H$@```9$``"P2```!
+M,0$`,!(```$*```T$@```0P!`#@2```!B```/!(```'G``!`$@```=4``$02
+M```!?```2!(```$-`0!,$@```0$``%`2```!`P$`5!(```$S`0!8$@```48!
+M`(`3```!`P``B!,```$#``"0$P```0,``)@3```!`P``H!,```$#``"H$P``
+M`0,``+`3```!`P``N!,```$#``#`$P```0,``,@3```!`P``T!,```$#``#8
+M$P```0,``.`3```!`P``Z!,```$#``#P$P```0,``/@3```!`P```!0```$#
+M```(%````0,``!`4```!`P``&!0```$#```@%````0,``"@4```!`P``,!0`
+M``$#```X%````0,``$`4```!`P``2!0```$#``!0%````0,``%@4```!`P``
+M8!0```$#``!H%````0,``'`4```!`P``>!0```$#``"`%````0,``(@4```!
+M`P``D!0```$#``"8%````0,``*`4```!`P``J!0```$#``"P%````0,``+@4
+M```!`P``P!0```$#``#(%````0,``-`4```!`P``V!0```$#``#@%````0,`
+M`.@4```!`P``\!0```$#``#X%````0,````5```!`P``"!4```$#```0%0``
+M`0,``!@5```!`P``(!4```$#```H%0```0,``#`5```!`P``.!4```$#``!`
+M%0```0,``$@5```!`P``4!4```$#``!8%0```0,``&`5```!`P``2!L```$%
+M`0!,&P```1L!`%`;```!$P$`5!L```%9``!8&P```7(``%P;```!)P``8!L`
+M``%%``!D&P```2`!`&@;```!UP``;!L```$]`0!P&P```6(``'0;```!T```
+M>!L```&"``!\&P```>T``(`;```!&P``A!L```'2``"(&P```10``(P;```!
+MD@``D!L```$8``"4&P```2```)@;```!A0``G!L```$O`0"@&P```1T!`*0;
+M```!*@$`J!L```'\``"L&P```<(``+`;```!S@``M!L```&[``"X&P```=H`
+M`+P;```!7P``P!L```%W``#$&P```58``,@;```!'P$`S!L```$]``#0&P``
+M`34``-0;```!5```V!L```'[``#<&P```;(``.`;```!]0``Y!L```&V``#H
+M&P```0$!`.P;```!*0``\!L```%$``#T&P```:P``/@;```!!@$`_!L```'@
+M````'````?,```0<```!6```"!P```$W`0`,'````1`!`!`<```![```%!P`
+M``&4```8'````18``!P<```!>```(!P```$=```D'````3<``"@<```!<0``
+M+!P```&O```P'````:```#0<```!$@$`.!P```&?```\'````5X``$`<```!
+MW0``1!P```'8``!('````1$!`$P<```!!P``4!P```%]``!4'````5$``%@<
+M```!=@``7!P```%+``!@'````;P``&0<```!Q```:!P```'1``!L'````0$`
+M`'`<```!X@``=!P```'@``!X'````?,``.`=```!`P``Z!T```$#``#P'0``
+M`0,``/@=```!`P```!X```$#```('@```0,``!`>```!`P``&!X```$#```@
+M'@```0,``"@>```!`P``,!X```$#```X'@```0,``$`>```!`P``2!X```$#
+M``!0'@```0,``%@>```!`P``8!X```$#``!H'@```0,``'`>```!`P``>!X`
+M``$#``"`'@```0,``(@>```!`P``D!X```$#``"8'@```0,``*`>```!`P``
+MJ!X```$#``"P'@```0,``+@>```!`P``P!X```$#``#('@```0,``-`>```!
+M`P``V!X```$#``#@'@```0,``.@>```!`P``\!X```$#``#X'@```0,````?
+M```!`P``"!\```$#```0'P```0,``!@?```!`P``(!\```$#```H'P```0,`
+M`#`?```!`P``.!\```$#``!`'P```0,``$@?```!`P``4!\```$#``!8'P``
+M`0,``&`?```!`P``:!\```$#``!P'P```0,``'@?```!`P``@!\```$#``"(
+M'P```0,``)`?```!`P``F!\```$#``"@'P```0,``*@?```!`P``&"T```$!
+M```<+0```0$``"`M```!`0``)"T```$!```H+0```0$``"PM```!`0``,"T`
+M``$!```T+0```0$``'PN```!`0``@"X```$!``"$+@```0$``(@N```!`0``
+MC"X```$!``"0+@```0$``,@N```!00``S"X```%A``#0+@```2<!`-0N```!
+MJP``V"X```&/``#<+@```3H``.`N```!>@``Y"X```$6`0#H+@```6H``.PN
+M```!S0``\"X```&X``#T+@```4,!`/@N```!D```_"X```%=````+P```>@`
+M``0O```!'@``""\```$5`0`,+P```2(``!`O```!&0$`%"\```%#```8+P``
+M`0`!`!PO```!SP``("\```'+```D+P```0X``"@O```!(0$`+"\```%<```P
+M+P```;,``#0O```!)`$`."\```&M```\+P```74``$`O```!^```1"\```'(
+M``!(+P```?8``$PO```!.0$`4"\```'%``!4+P```;X``%@O```!_P``7"\`
+M``'E``!@+P```7\``&0O```!AP``:"\```$"`0!L+P```=P``'`O```!2`$`
+M="\```$P``!X+P```9T``'PO```!<```@"\```&Y``"$+P```0D``(@O```!
+M0`$`C"\```&```"0+P```38!`)0O```!+0$`F"\```$R``"<+P```2L``*`O
+M```!$@``I"\```%5``"H+P```<8``*PO```!30``L"\```'K``"T+P```34!
+M`+@O```!I@``O"\```')``#`+P```60``,0O```!,P``R"\```$:``#,+P``
+M`40!`-`O```!V0``U"\```&G``#8+P```7X``-PO```!'```X"\```$H`0#D
+M+P```4X``.@O```!J@``["\```$!``#P+P```:D``/0O```!<```^"\```&Y
+M``!@,0```0,``&@Q```!`P``<#$```$#``!X,0```0,``(`Q```!`P``B#$`
+M``$#``"0,0```0,``)@Q```!`P``H#$```$#``"H,0```0,``+`Q```!`P``
+MN#$```$#``#`,0```0,``,@Q```!`P``T#$```$#``#8,0```0,``.`Q```!
+M`P``Z#$```$#``#P,0```0,``/@Q```!`P```#(```$#```(,@```0,``!`R
+M```!`P``&#(```$#```@,@```0,``"@R```!`P``,#(```$#```X,@```0,`
+M`$`R```!`P``2#(```$#``!0,@```0,``%@R```!`P``8#(```$#``!H,@``
+M`0,``'`R```!`P``>#(```$#``"`,@```0,``(@R```!`P``D#(```$#``"8
+M,@```0,``*`R```!`P``J#(```$#``"P,@```0,``+@R```!`P``P#(```$#
+M``#(,@```0,``-`R```!`P``V#(```$#``#@,@```0,``.@R```!`P``\#(`
+M``$#``#X,@```0,````S```!`P``"#,```$#```0,P```0,``!@S```!`P``
+M(#,```$#```H,P```0,``#`S```!`P``.#,```$#``!`,P```0,``$@S```!
+M`P``4#,```$#``!8,P```0,``&`S```!`P``:#,```$#``!P,P```0,``'@S
+M```!`0``?#,```$!``"`,P```0$``(0S```!`0``B#,```$!``",,P```0$`
+M`)`S```!`0``E#,```$!``"8,P```0$``)PS```!`0``H#,```$!``"D,P``
+M`0$``*@S```!`0``K#,```$!``"P,P```0$``+0S```!`0``N#,```$!``"\
+M,P```0$``,`S```!`0``Q#,```$!``#(,P```0$``,PS```!`0``T#,```$!
+M``#4,P```0$``-@S```!`0``W#,```$!``#@,P```0$``.0S```!`0``Z#,`
+M``$!``#L,P```0$``/`S```!`0``]#,```$!``#X,P```0$``%A7```!`0``
+M7%<```$!``!@5P```0$``&17```!`0``:%<```$!``!L5P```0$``-P````!
+M!```Y`````$$``#L`````00``/0````!!```_`````$$```$`0```00```P!
+M```!!```%`$```$$```<`0```00``"0!```!!```+`$```$$```T`0```00`
+A`#P!```!!```1`$```$$``!,`0```00``%0!```!!```
+`
+end
diff --git a/sys/contrib/dev/ath/freebsd/opt_ah.h b/sys/contrib/dev/ath/freebsd/opt_ah.h
new file mode 100644
index 0000000..eb1ae6c
--- /dev/null
+++ b/sys/contrib/dev/ath/freebsd/opt_ah.h
@@ -0,0 +1,3 @@
+#define AH_SUPPORT_AR5210 1
+#define AH_SUPPORT_AR5211 1
+#define AH_SUPPORT_AR5212 1
diff --git a/sys/contrib/dev/ath/version.h b/sys/contrib/dev/ath/version.h
new file mode 100644
index 0000000..2d7e881
--- /dev/null
+++ b/sys/contrib/dev/ath/version.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $Id: version.h,v 1.22 2003/11/01 01:43:21 sam Exp $
+ */
+#define ATH_HAL_VERSION "0.9.5.17"
diff --git a/sys/contrib/dev/fla/COPYRIGHT b/sys/contrib/dev/fla/COPYRIGHT
new file mode 100644
index 0000000..9618a67
--- /dev/null
+++ b/sys/contrib/dev/fla/COPYRIGHT
@@ -0,0 +1,102 @@
+
+SOFTWARE LICENSE AGREEMENT
+
+IMPORTANT! READ CAREFULLY:
+THIS SOFTWARE LICENSE AGREEMENT (the ``Agreement'') is a legal
+agreement between you (either an individual or a single entity) and
+M-Systems Flash Disk Pioneers Ltd. ("M-Systems").
+This Agreement relates to the M-Systems' software accompanying this
+Agreement, which includes computer software and may include associated
+media, printed materials, and ``online'' or electronic documentation
+(the ``Licensed Software'').
+By downloading, installing, copying, or otherwise using the Licensed
+Software, you agree to be bound by the terms of this Agreement.
+If you do not agree to the terms of this Agreement, do not install,
+copy or use the Licensed Software.
+
+The Licensed Software is protected by copyright laws and international
+copyright treaties, as well as other intellectual property laws and
+treaties. The Licensed Software is licensed, not sold.
+The Licensed Software is being provided solely for use with M-Systems'
+DiskOnChip® product lines.
+1. License Grant.
+(a) Grant of License. Subject to the terms and conditions of this
+ Agreement, M-Systems hereby grants you a nonexclusive,
+ royalty-free, worldwide license (including the right to
+ sublicense) to use, copy and distribute the Licensed Software
+ with M-Systems DiskOnChip® products.
+(b) Restrictions on Use. The Licensed Software is licensed solely
+ for use with and to support M-Systems' DiskOnChip® products.
+ Use of this Licensed Software with, or to support, any other
+ flash disk, flash card, resident flash array or solid state
+ disk of any kind is expressly prohibited, and constitutes an
+ illegal infringement of M-Systems' patent, copyright and other
+ rights in and to the Licensed Software.
+2. Limitations on Reverse Engineering, Decompilation, and
+ Disassembly. You may not reverse engineer, decompile, or
+ disassemble the Licensed Software, except and only to the
+ extent that such activity is expressly permitted by applicable
+ law notwithstanding this limitation.
+3. Termination. Without prejudice to any other rights, M-Systems
+ may terminate this Agreement if you fail to comply with the
+ terms and conditions of this Agreement. In such event, you must
+ destroy all copies of the Licensed Software and all of its
+ component parts.
+4. Intellectual Property Rights. Title to the Licensed Software,
+ and all rights with respect to the Software not specifically
+ granted under this Agreement, including without limitation
+ all rights of modification, disassembly and decompilation and
+ all copyright, patent, trademark, trade secret and other
+ proprietary rights and interests are reserved to M-Systems.
+ You may not remove or alter the "README" or "COPYRIGHT" files
+ or copyright notices in the Licensed Software.
+5. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by
+ applicable law, M-Systems and its suppliers provide the Product
+ and any (if any) support services related to the Product
+ ("Support Services") AS IS AND WITH ALL FAULTS, and hereby
+ disclaim all warranties and conditions, either express,
+ implied or statutory, including, but not limited to, any
+ (if any) implied warranties or conditions of merchantability,
+ of fitness for a particular purpose, of lack of viruses, of
+ accuracy or completeness of responses, of results, and of lack
+ of negligence or lack of workmanlike effort, all with regard
+ to the Product, and the provision of or failure to provide
+ Support Services. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+ TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO
+ DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE PRODUCT.
+ THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR
+ PERFORMANCE OF THE PRODUCT AND SUPPORT SERVICES, IF ANY,
+ REMAINS WITH YOU.
+6. EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER
+ DAMAGES. To the maximum extent permitted by applicable law,
+ in no event shall M-Systems or its suppliers be liable for
+ any special, incidental, indirect, or consequential damages
+ whatsoever (including, but not limited to, damages for loss
+ of profits or confidential or other information, for business
+ interruption, for personal injury, for loss of privacy, for
+ failure to meet any duty including of good faith or of
+ reasonable care, for negligence, and for any other pecuniary
+ or other loss whatsoever) arising out of or in any way related
+ to the use of or inability to use the Product, the provision
+ of or failure to provide Support Services, or otherwise under
+ or in connection with any provision of Agreement, even in the
+ event of the fault, tort (including negligence), strict
+ liability, breach of contract or breach of warranty of
+ M-Systems or any supplier, and even if M-Systems or any
+ supplier has been advised of the possibility of such damages.
+7. LIMITATION OF LIABILITY AND REMEDIES. Notwithstanding any
+ damages that you might incur for any reason whatsoever
+ (including, without limitation, all damages referenced above
+ and all direct or general damages), the entire liability of
+ M-Systems and any of its suppliers under any provision of this
+ Agreement and your exclusive remedy for all of the foregoing
+ shall be limited to the greater of the amount actually paid by
+ you for the Product or U.S.$5.00. The foregoing limitations,
+ exclusions and disclaimers shall apply to the maximum extent
+ permitted by applicable law, even if any remedy fails its
+ essential purpose.
+8. Miscellaneous
+ The laws of the State of California, United States of America,
+ exclusive of conflict-of-laws provisions, shall govern this
+ Agreement in all respects.
+
diff --git a/sys/contrib/dev/fla/README b/sys/contrib/dev/fla/README
new file mode 100644
index 0000000..78433de
--- /dev/null
+++ b/sys/contrib/dev/fla/README
@@ -0,0 +1,198 @@
+ README and FAQ for the fla driver.
+ ==================================
+
+
+[0] COPYRIGHT & LICENSE
+
+ Please read the COPYRIGHT file carefully. If you cannot
+ agree to be bound by the terms of this license, please
+ contact M-systems and make arrangements with them.
+
+[1] What does this driver do ?
+
+ This driver supports up to eight M-systems DiskOnChip
+ devices.
+
+ The driver has been tested with the following devices:
+
+ DiskOnChip2000 (8, 12, 24, 32, 40, 72, 144 MB)
+ DiskOnChipMillenium (8 MB)
+ DiskOnChipMillenium TSOP (8 MB)
+
+ You can find full details, specs etc on M-systems homepage:
+ http://www.m-sys.com
+
+[2] Which firmware version ?
+
+ The driver has only been tested with version 1.21.
+
+[3] How many devices ?
+
+ The driver supports up to 8 devices but have been tested only
+ with 5 due to hardware limitations in my test setup.
+
+[4] Which FreeBSD versions ?
+
+ The driver is tested for 4.0-CURRENT and 3.3-RELEASE.
+
+ Porting to earlier versions of FreeBSD should be a simple
+ matter of modifying the fla.c file. [patches are welcome]
+
+[5] Can I install FreeBSD with sysinstall ?
+
+ Yes, it has been tested in FreeBSD-4.0-CURRENT and it works.
+ You will need to build a kernel with the fla driver since
+ the default "GENERIC" kernel doesn't contain the fla driver.
+
+[6] How to boot from a fla device ?
+
+ FreeBSD 4.0 and forward find their root device by reading
+ the /etc/fstab, so the DiskOnChip devices will work just
+ like any other device.
+
+ Earlier FreeBSD kernels recognizes the root device using
+ various hacks. These hacks doesn't recognize the fla device
+ so some "real" hacks are needed to boot from your fla
+ device.
+
+ In pre 4.0 versions specifying the boot device in the kernel
+ config file this way is the easiest way to do it:
+
+ config kernel root on major 28 minor 65538
+
+[7] How to disklabel a fla device ?
+
+ Look at the script in prep.fla.sh, it will do the job for you.
+
+[8] Who to contact ?
+
+ doc2k@phk.freebsd.dk will offer limited best-effort help
+ to the extent time permits. Further support for special
+ projects or configurations available at reasonable hourly
+ rates.
+
+[9] Getting detailed
+
+ The DiskOnChip product gets out in some odd corners of the
+ PC-architecture, and chances are that things don't do what
+ you expect. Here are some hints and random observations
+ I've made during my work with these devices.
+
+[9a] Choosing an address for the DOC
+
+ Each DOC needs a 8K memory window starting on an 8K boundary.
+ The lowest possible address is C000:0, the highest is DE00:0
+
+ If your hardware puts the DOC another place, you will need
+ to modify the doc2k_probe() call in fla.c.
+
+ It is important that you set the BIOS to not do "fancy things"
+ with this window, in particular no kind of cache or shadowing
+ can be enabled.
+
+ Be aware that some hardware will decode a 32k memory window
+ for the DOC device.
+
+ If everything is OK, the DOC will print a message during
+ the BIOS startup.
+
+ For large devices it can take some time to check the flash
+ data structures, but if it takes more than 3 minutes
+ something is wrong.
+
+ If you boot a MSDOS floppy and run FDISK you should be able
+ to see the DOC device.
+
+ If it doesnt work:
+
+ If you machine never gets to the point where it will boot,
+ but just hangs it could be because you have a BIOS which
+ need the "slightly special" DOC firmware. Obviously you
+ will need to put the DOC in another machine to load this
+ firmware. You can download the firmware and utilities
+ from M-systems website http://www.m-sys.com
+
+ If the machine boots, but the device isn't visible it can
+ be because some other device uses the same memory window,
+ or because the BIOS prevents it from being used. If you
+ boot MSDOS and enter DEBUG, you should be able to find a
+ BIOS extension signature at the address using the 'd'
+ command, for instance 'd d800:0'.
+
+ A special case is when the DOC prints the BIOS message
+ but disappears afterwards, this can happen because another
+ card (NCR SCSI controllers for instance) steal the memory
+ window later in the boot process. In such a case the
+ above check with DEBUG will not show the BIOS signature.
+
+[9b] So just who is drive 'C' here anyway ?
+
+ Using the DUPDATE program you can choose to have the DOC
+ add itself at the front or the back of the device list.
+
+ This is, unfortunately not the only thing affecting the
+ drive order, the above mentioned NCR SCSI controllers also
+ have some builtin AI, and the result can be very confusing
+ because the DOC will come before even the floppy as a result.
+
+ There is no simple solution for this case, only variuos
+ work-arounds. But chances are good that most users will
+ not use both a DOC and a SCSI in the same system, except
+ maybe for initial programming.
+
+[9c] MBR/fdisk
+
+ The boot firmware in the DOC and/or the FreeBSD bootblocks
+ mandate that the first MBR slice/(partition in FDISK lingo)
+ start exactly at "sector #1, head #1, cylinder #0." You
+ will have problems booting from the fla if you don't get this
+ right. The prep.fla.sh script will do this for you.
+
+ DO NOT WRITE JUNK IN THE MBR! The DOC firmware relies on
+ various fields and can get utterly confused if they don't
+ make sense.
+
+[9d] Getting the FreeBSD kernel to use the fla as root
+
+ Please see above under item 6.
+
+[9e] I turned the machine off while it was running and now my
+ DOC hangs during boot/panics the machine/does weird things.
+
+ If a write operation to the DOC gets interrupted by reset
+ or power-failure, it can happen that the flash data structures
+ are left in a state the sofware cannot cope with.
+
+ Your best chance is to DUPDATE, DFORMAT the device again.
+
+ If it hangs during boot, you can use this particular dirty
+ trick ENTIRELY AT YOUR OWN RISK! DO NOT COMPLAIN IF THIS
+ DOESN'T WORK FOR YOU OR IF YOU DESTROY YOUR COMPUTER OR
+ DOC DEVICE DOING IT!
+
+ Jumper the DOC for an address which will not work, but which
+ will not interfere with the system either, C000:0 seems to
+ work pretty universally for this.
+
+ Boot MSDOS and rejumper the DOC for its real (working) address.
+
+ Run DUPDATE and use the /win:xxxx argument to point it at the
+ DOC device.
+
+[9f] Apart from that...
+
+ ...the DOC is just like any other disk, but it is silent,
+ has better MTBF and doesn't take up a lot of space.
+
+
+[10] History
+
+ The fla driver was written by Poul-Henning Kamp <phk@FreeBSD.org>
+ under contract for M-systems, and using their "OSAK"
+ development kit.
+
+Good Luck,
+
+Poul-Henning
+
+$FreeBSD$
diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c
new file mode 100644
index 0000000..789db78
--- /dev/null
+++ b/sys/contrib/dev/fla/fla.c
@@ -0,0 +1,285 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sysctl.h>
+#include <sys/kernel.h>
+#include <sys/bio.h>
+#include <sys/malloc.h>
+#include <sys/conf.h>
+#include <sys/module.h>
+#include <machine/resource.h>
+#include <geom/geom_disk.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_param.h>
+
+#include <sys/bus.h>
+
+#define LEAVE()
+#define ENTER()
+
+#include <contrib/dev/fla/msysosak.h>
+
+static MALLOC_DEFINE(M_FLA, "fla driver", "fla driver storage");
+
+void *
+doc2k_malloc(int bytes)
+{
+ return malloc(bytes, M_FLA, M_WAITOK);
+}
+
+void
+doc2k_free(void *ptr)
+{
+ free(ptr, M_FLA);
+}
+
+void
+doc2k_delay(unsigned msec)
+{
+ DELAY(1000 * msec);
+}
+
+void
+doc2k_memcpy(void *dst, const void *src, unsigned len)
+{
+ bcopy(src, dst, len);
+}
+
+int
+doc2k_memcmp(const void *dst, const void *src, unsigned len)
+{
+ return (bcmp(src, dst, len));
+}
+
+void
+doc2k_memset(void *dst, int c, unsigned len)
+{
+ u_char *p = dst;
+ while (len--)
+ *p++ = c;
+}
+
+static struct fla_s {
+ int busy;
+ int unit;
+ unsigned nsect;
+ struct doc2k_stat ds;
+ struct bio_queue_head bio_queue;
+ struct disk disk;
+ dev_t dev;
+} softc[8];
+
+static int
+flaopen(struct disk *dp)
+{
+ struct fla_s *sc;
+ int error;
+ u_int spu, ncyl, nt, ns;
+
+ sc = dp->d_drv1;
+
+ error = doc2k_open(sc->unit);
+
+ if (error) {
+ printf("doc2k_open(%d) -> err %d\n", sc->unit, error);
+ return (EIO);
+ }
+
+ error = doc2k_size(sc->unit, &spu, &ncyl, &nt, &ns);
+ sc->disk.d_sectorsize = DEV_BSIZE;
+ sc->disk.d_mediasize = (off_t)spu * DEV_BSIZE;
+ sc->disk.d_fwsectors = ns;
+ sc->disk.d_fwheads = nt;
+
+ return (0);
+}
+
+static int
+flaclose(struct disk *dp)
+{
+ int error;
+ struct fla_s *sc;
+
+ sc = dp->d_drv1;
+
+ error = doc2k_close(sc->unit);
+ if (error) {
+ printf("doc2k_close(%d) -> err %d\n", sc->unit, error);
+ return (EIO);
+ }
+ return (0);
+}
+
+static void
+flastrategy(struct bio *bp)
+{
+ int unit, error;
+ struct fla_s *sc;
+ enum doc2k_work what;
+
+ sc = bp->bio_disk->d_drv1;
+
+
+ bioq_disksort(&sc->bio_queue, bp);
+
+ if (sc->busy) {
+ return;
+ }
+
+ sc->busy++;
+
+ while (1) {
+ bp = bioq_first(&sc->bio_queue);
+ if (bp)
+ bioq_remove(&sc->bio_queue, bp);
+ if (!bp)
+ break;
+
+ bp->bio_resid = bp->bio_bcount;
+ unit = sc->unit;
+
+ if (bp->bio_cmd == BIO_DELETE)
+ what = DOC2K_ERASE;
+ else if (bp->bio_cmd == BIO_READ)
+ what = DOC2K_READ;
+ else
+ what = DOC2K_WRITE;
+
+ LEAVE();
+
+ error = doc2k_rwe( unit, what, bp->bio_pblkno,
+ bp->bio_bcount / DEV_BSIZE, bp->bio_data);
+
+ ENTER();
+
+ if (error) {
+ printf("fla%d: %d = rwe(%p, %d, %d, %jd, %ld, %p)\n",
+ unit, error, bp, unit, what,
+ (intmax_t)bp->bio_pblkno,
+ bp->bio_bcount / DEV_BSIZE, bp->bio_data);
+ }
+ if (error) {
+ bp->bio_error = EIO;
+ bp->bio_flags |= BIO_ERROR;
+ } else {
+ bp->bio_resid = 0;
+ }
+ biodone(bp);
+
+ }
+ sc->busy = 0;
+ return;
+}
+
+static int
+flaprobe (device_t dev)
+{
+ int unit;
+ struct fla_s *sc;
+ int i;
+
+ unit = device_get_unit(dev);
+ if (unit >= 8)
+ return (ENXIO);
+ sc = &softc[unit];
+
+ /* This is slightly ugly */
+ i = doc2k_probe(unit, KERNBASE + 0xc0000, KERNBASE + 0xe0000);
+ if (i)
+ return (ENXIO);
+
+ i = doc2k_info(unit, &sc->ds);
+ if (i)
+ return (ENXIO);
+
+ bus_set_resource(dev, SYS_RES_MEMORY, 0,
+ sc->ds.window - KERNBASE, 8192);
+
+ return (0);
+}
+
+static int
+flaattach (device_t dev)
+{
+ int unit;
+ int i, j, k, l, m, error;
+ struct fla_s *sc;
+
+ unit = device_get_unit(dev);
+ sc = &softc[unit];
+
+ error = doc2k_open(unit);
+ if (error) {
+ printf("doc2k_open(%d) -> err %d\n", unit, error);
+ return (EIO);
+ }
+
+ error = doc2k_size(unit, &sc->nsect, &i, &j, &k );
+ if (error) {
+ printf("doc2k_size(%d) -> err %d\n", unit, error);
+ return (EIO);
+ }
+
+ printf("fla%d: <%s %s>\n", unit, sc->ds.product, sc->ds.model);
+
+ error = doc2k_close(unit);
+ if (error) {
+ printf("doc2k_close(%d) -> err %d\n", unit, error);
+ return (EIO);
+ }
+
+ m = 1024L * 1024L / DEV_BSIZE;
+ l = (sc->nsect * 10 + m/2) / m;
+ printf("fla%d: %d.%01dMB (%u sectors),"
+ " %d cyls, %d heads, %d S/T, 512 B/S\n",
+ unit, l / 10, l % 10, sc->nsect, i, j, k);
+
+ if (bootverbose)
+ printf("fla%d: JEDEC=0x%x unitsize=%ld mediasize=%ld"
+ " chipsize=%ld interleave=%d window=%lx\n",
+ unit, sc->ds.type, sc->ds.unitSize, sc->ds.mediaSize,
+ sc->ds.chipSize, sc->ds.interleaving, sc->ds.window);
+
+ bioq_init(&sc->bio_queue);
+
+ sc->disk.d_open = flaopen;
+ sc->disk.d_close = flaclose;
+ sc->disk.d_strategy = flastrategy;
+ sc->disk.d_drv1 = sc;
+ sc->disk.d_name = "fla";
+ sc->disk.d_maxsize = MAXPHYS;
+ sc->unit = unit;
+ disk_create(unit, &sc->disk, DISKFLAG_CANDELETE, NULL, NULL);
+
+ return (0);
+}
+
+static device_method_t fla_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, flaprobe),
+ DEVMETHOD(device_attach, flaattach),
+ {0, 0}
+};
+
+static driver_t fladriver = {
+ "fla",
+ fla_methods,
+ sizeof(struct fla_s),
+};
+
+static devclass_t fla_devclass;
+
+DRIVER_MODULE(fla, isa, fladriver, fla_devclass, 0, 0);
diff --git a/sys/contrib/dev/fla/i386/msysosak.o.uu b/sys/contrib/dev/fla/i386/msysosak.o.uu
new file mode 100644
index 0000000..0654caf
--- /dev/null
+++ b/sys/contrib/dev/fla/i386/msysosak.o.uu
@@ -0,0 +1,823 @@
+
+$FreeBSD$
+
+SOFTWARE LICENSE AGREEMENT
+
+IMPORTANT! READ CAREFULLY:
+THIS SOFTWARE LICENSE AGREEMENT (the ``Agreement'') is a legal
+agreement between you (either an individual or a single entity) and
+M-Systems Flash Disk Pioneers Ltd. ("M-Systems").
+This Agreement relates to the M-Systems' software accompanying this
+Agreement, which includes computer software and may include associated
+media, printed materials, and ``online'' or electronic documentation
+(the ``Licensed Software'').
+By downloading, installing, copying, or otherwise using the Licensed
+Software, you agree to be bound by the terms of this Agreement.
+If you do not agree to the terms of this Agreement, do not install,
+copy or use the Licensed Software.
+
+The Licensed Software is protected by copyright laws and international
+copyright treaties, as well as other intellectual property laws and
+treaties. The Licensed Software is licensed, not sold.
+The Licensed Software is being provided solely for use with M-Systems'
+DiskOnChip® product lines.
+1. License Grant.
+(a) Grant of License. Subject to the terms and conditions of this
+ Agreement, M-Systems hereby grants you a nonexclusive,
+ royalty-free, worldwide license (including the right to
+ sublicense) to use, copy and distribute the Licensed Software
+ with M-Systems DiskOnChip® products.
+(b) Restrictions on Use. The Licensed Software is licensed solely
+ for use with and to support M-Systems' DiskOnChip® products.
+ Use of this Licensed Software with, or to support, any other
+ flash disk, flash card, resident flash array or solid state
+ disk of any kind is expressly prohibited, and constitutes an
+ illegal infringement of M-Systems' patent, copyright and other
+ rights in and to the Licensed Software.
+2. Limitations on Reverse Engineering, Decompilation, and
+ Disassembly. You may not reverse engineer, decompile, or
+ disassemble the Licensed Software, except and only to the
+ extent that such activity is expressly permitted by applicable
+ law notwithstanding this limitation.
+3. Termination. Without prejudice to any other rights, M-Systems
+ may terminate this Agreement if you fail to comply with the
+ terms and conditions of this Agreement. In such event, you must
+ destroy all copies of the Licensed Software and all of its
+ component parts.
+4. Intellectual Property Rights. Title to the Licensed Software,
+ and all rights with respect to the Software not specifically
+ granted under this Agreement, including without limitation
+ all rights of modification, disassembly and decompilation and
+ all copyright, patent, trademark, trade secret and other
+ proprietary rights and interests are reserved to M-Systems.
+ You may not remove or alter the "README" or "COPYRIGHT" files
+ or copyright notices in the Licensed Software.
+5. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by
+ applicable law, M-Systems and its suppliers provide the Product
+ and any (if any) support services related to the Product
+ ("Support Services") AS IS AND WITH ALL FAULTS, and hereby
+ disclaim all warranties and conditions, either express,
+ implied or statutory, including, but not limited to, any
+ (if any) implied warranties or conditions of merchantability,
+ of fitness for a particular purpose, of lack of viruses, of
+ accuracy or completeness of responses, of results, and of lack
+ of negligence or lack of workmanlike effort, all with regard
+ to the Product, and the provision of or failure to provide
+ Support Services. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+ TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO
+ DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE PRODUCT.
+ THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR
+ PERFORMANCE OF THE PRODUCT AND SUPPORT SERVICES, IF ANY,
+ REMAINS WITH YOU.
+6. EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER
+ DAMAGES. To the maximum extent permitted by applicable law,
+ in no event shall M-Systems or its suppliers be liable for
+ any special, incidental, indirect, or consequential damages
+ whatsoever (including, but not limited to, damages for loss
+ of profits or confidential or other information, for business
+ interruption, for personal injury, for loss of privacy, for
+ failure to meet any duty including of good faith or of
+ reasonable care, for negligence, and for any other pecuniary
+ or other loss whatsoever) arising out of or in any way related
+ to the use of or inability to use the Product, the provision
+ of or failure to provide Support Services, or otherwise under
+ or in connection with any provision of Agreement, even in the
+ event of the fault, tort (including negligence), strict
+ liability, breach of contract or breach of warranty of
+ M-Systems or any supplier, and even if M-Systems or any
+ supplier has been advised of the possibility of such damages.
+7. LIMITATION OF LIABILITY AND REMEDIES. Notwithstanding any
+ damages that you might incur for any reason whatsoever
+ (including, without limitation, all damages referenced above
+ and all direct or general damages), the entire liability of
+ M-Systems and any of its suppliers under any provision of this
+ Agreement and your exclusive remedy for all of the foregoing
+ shall be limited to the greater of the amount actually paid by
+ you for the Product or U.S.$5.00. The foregoing limitations,
+ exclusions and disclaimers shall apply to the maximum extent
+ permitted by applicable law, even if any remedy fails its
+ essential purpose.
+8. Miscellaneous
+ The laws of the State of California, United States of America,
+ exclusive of conflict-of-laws provisions, shall govern this
+ Agreement in all respects.
+
+begin 664 msysosak.o
+M?T5,1@$!`0E&<F5E0E-$``$``P`!```````````````0:````````#0`````
+M`"@`#``)`%6)Y8/L"(/$^/\U`````/\U`````.C\____@\00A<!U#.C\____
+MZ/S___\QP,G#D%6)Y8/L"(M%#(M5$*,`````B14`````_P4`````@ST`````
+M`74)Z/S___^%P'46BT4(.P4`````<P8QP.L'B?:X``$``,G#D%6)Y8/L+%=6
+M4XM="(M]#(/$_&I$:@!7Z/S___^)7>B)??2#Q/B-1>A0:@KH_/___XE%Y(M/
+M"(7)?0:!P?__#P")SL'^%(U?',='&`````"#_F-^';H?A>M1B=#W[L'Z!8G(
+MP?@?*,*(T`0PB$<<C5\=@_X)?C6_9V9F9HGP]^^)T8G(P?@"B?'!^1\IR(G!
+M]^^)T,'X`HG*P?H?*="-!(`!P"C!B,@$,(@#0[IG9F9FB=#W[HG0P?@"B?+!
+M^A\IT(T$@`'`B?(HPHC0!#"(`T/&`TU#Q@-"QD,!`(M%Y(UER%M>7\G#B?95
+MB>6#[#Q75E.+10B+70R+?12+=1B)1>B#Q/B-1>A0:@_H_/___XG!BT7XB0.+
+M11#'```$``#'!Q````"+$,'B!(E5W(L#B478,=+W==R)!HL3B=`QTO=UW(72
+M=$'_!HM5$(L"#Z\&B47<BQ.)5=B)T#'2]W7<B0>+$XG0,=+W==R%TG09_P>+
+M/P^O/HE]W(L3B=`QTO?WB<.+51")&HG(C66X6UY?R<-5B>6#["B+10B)1>B#
+MQ/B-1>A0:@3H_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=S</
+MMU7^BT,L_@0"@WWT`'0W#[?&BTLL]@0(?W0;_@P(ZR:0@WWT`'4?#[?&BU,L
+MB@00)'\\/W8'N!\```#K"P^WUHM#+/X$`C'`C6786UY?R<.058GE@^P,5U93
+MBUT(OQT```"#.P!T"K@7````Z8(```"+10P[0R1R"+@;````ZW.09H.[E@``
+M`/]T*V;_@Y0```!F@;N4````_@!V&6;'@Y0``````(/$]%/H_/___X/$$(7`
+M=3W_0TPQ]H/_'74QD(M%##E#/'4'QT,\_____X/$_(M%$%"+10Q04^AX_?__
+MB<>#Q!!&@_X#?P6#_QUTT(GXC67H6UY?R<.)]E6)Y8/L'%=64XM="(M]#(,[
+M`'0,N!<```#I'0$``(GVBU40C00Z.T,D=AFX&P```.D&`0``C78`N!\```#I
+M^0```(GVQT7X`````.G=````@\3X5U/H>NW__XG&@\00@_[_#X2^````B?@Q
+MTO=S&&:)1?8/M\B+0S`/MQ1(BT,L@#P"_W0MB@0")'\\0'8D@\3X45/H@_;_
+M_X/$$(7`#X67````@\3X5U/H)NW__XG&@\00#[=%_K0`9HE%_L9%_@"#Q/QJ
+M`%93Z-_K__^#Q/1J!&H"C47^4(U&!E"-0UQ0BX.$````_]"+2R#3[HGQ#[?1
+MBT,L@\0P@#P"`'T+#[=5]HM#,`^W#%`/MU7V9CE3*G83#[?1BT,L]@0"?P^$
+M%?____X,`O]%^$?_0U"+11`Y1?@/@A?___\QP(UEV%M>7\G#D%6)Y3'`R<.0
+M58GEBT4(BT`DR<.058GE@^P44XM="(-[+`!T#H/$]/]S+.C\____@\00@WLP
+M`'0.@\3T_W,PZ/S___^#Q!#'0RP`````QT,P`````(-[-`!T#H/$]/]S-.C\
+M____@\00@WLX`'0+@\3T_W,XZ/S____'0S0`````QT,X`````(M=Z,G#58GE
+MBU4(C022P>`#*="-!(4@````R<.058GE4XM5"(M=#(M")(D##[="'HM*(-/@
+MB4,$BX*8````B4,(,<!;R<.-=@!5B>6#[#Q75E.+50B+71"-!)+!X`,IT(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''-`B?8/M].+1BR*!`($ECP!=B>#Q/R-
+M1=Q04E;HB_;__XG'@\00A?\/A5;___^+1=P!1=@!AI@```!F0V8[7AQRPF;'
+M1@@```^W7AYF.UX<<S:)]@^WPP-&+(`X$'0%@#B0=12#Q/@/M\-05N@3\/__
+M@\00ZPJ)]H`X[W4#Q@#_9D-F.UX<<LQFQT8(```/MUX>9CM>'',9BU8LD`^W
+MPX`\$/]U!&;_1@AF0V8[7AQRZP^W1AYFB48HQT90`````,=&3`````#'1D@`
+M````QT98`````,=&5`````"+70R),\=#!.`3``#'0PC8%P``QT,4A!@``,=#
+M(-`9``#'0R1L&@``QT,8R!D``,=#'-P9``#'0PP`````QT,0`````(/$]`^W
+M1AS!X`)0Z/S___^)1C2#Q!"%P'0H,=MF.UX<<R")]@^WPXM6-&;'!(*MWHM6
+M-&;'1(("K=YF0V8[7AQRX@^W7AR+3B"#P?73XX/$]%/H_/___XE&.(7`=!6Q
+M53'2.=IS#8GVBT8XB`P"0CG:<O6+1=CW)2````#!Z@>)T,'@""G0BU78*<*)
+MT"7_````9HF&E`````^W5A"+1=B)TS'2]_-FB9:6````,<"-9;A;7E_)PY!5
+MB>575E.#/0`````"?@FX9@```.MIB?:A`````,'@`\>``````)@:``#'@`0`
+M````````_P4`````,=*_3````+Y0````NU0```"Y6````(T$DL'@`RG0P>`"
+MQP0X`````,<$,`````#'!!@`````QP0(`````$*#^@=VTS'`6UY?R<-5B>6X
+M`0```,G#B?95B>7)PXUV`%6)Y<G#C78`58GE,<#)PY!5B>7)PXUV`%6)Y3'`
+MR<.058GER<.-=@!5B>7)PXUV`%6)Y3'`R<.058GE,<#)PY!5B>7)PXUV`%6)
+MY8/L#%=64XM]#(,]``````=V"[AF````Z<8```"0,?:#/0`````'#X>G````
+MD(/$]/\U`````.C\____B<.A`````(D#@\3X:@)3Z/S___^#Q""#Q/Q7BT4(
+M4/\SZ/S___^)0RB#Q!"%P'1HQT-`("```,=#1"P@``#'0T@T(```QT-,/"``
+M`,=#4$0@``#'0U1,(```QT-85"```,=#7%P@``#'0V!D(```QT-D;"```,=#
+M:`````#'0VQT(```1O\%`````(,]``````</AEK___^%]G0&,<#K!XGVN#P`
+M``"-9>A;7E_)PY"0D%6)Y8M5"(M"&(M`*,:`!A````"+0AB+0"C&@`80```*
+MR<.)]E6)Y8M5"(M"&(M`*,:`!A````"+0AB+0"C&@`80```JR<.)]E6)Y8M%
+M"(M`&(M`*,:`!A````+)PXUV`%6)Y8/L$%93BW4(QD7_`(M&&/9`'`AT+#')
+MB<.+0RB*5?^*@`80````PHA5_T&#^0%^Z8M&&(M`*(J`!A```.LNC78`,<F+
+M7AB-=@"+0RB*5?^*@`<0````PHA5_T&#^0%^Z8M&&(M`*(J`!Q```"2`)?\`
+M``!;7LG#B?95B>575E.+70B+=0R+31"+?13V0Q4!=33WQP0```!T)(L1@>+_
+M`0``QP90````@_H'=PF!`0`!``#K:Y"#`?CK98UV`,<&`````.M:BT,8#[<1
+M9B-0"(G0#[?0*1'WQP0```!T!H'"``(``(M#&`^W0`HYPG,*QP8`````ZQR)
+M]HM#&`^W0`8YPG,)QP8!````ZP>0QP90````BT,8#[=`"D@AP@$16UY?R<.0
+M58GE@^P05E.+=0C&1?\`,<F+7AB+0RB*5?^*@"`0````PHA5_T&#^0-^Z8M&
+M&(M`*(J`!!```(A%_C')BUX8D(M#*(I5_XJ`(!````#"B%7_08/Y`7[IBD7^
+MP.@'-`$E_P```%M>R<-5B>6#[!!64XMU"#';C78`@\3T5NA_____@\00A<!U
+M"+@!````ZPR00X'[+W4``'[?,<"-9>A;7LG#B?95B>6#[`Q75E.+?0B+30PQ
+MV[IG9F9FB=#WZ8G0P?@"B<K!^A\IT#G#?3^Z9V9F9HG0]^G!^@*)R,'X'XG6
+M*<:0@\3T:@KH_/___X/$]%?H"?___X/$((7`=0JX`0```.L*C78`0SGS?-<Q
+MP(UEZ%M>7\G#D%6)Y8/L%%.+30B+50S&1?\`BT$8BT`HB)`$$```,=N+21B)
+M]HM!*(I5_XJ`(!````#"B%7_0X/[`7[I6\G#B?95B>6+10B+50R+0!B+0"B(
+MD`40``#)PY!5B>6+30B+01B+4"B*@@$0``"$P'4;QH("$```A8M!&(M`*,:`
+M`A```(6+01C&0!4`R<.058GE@^P44XM%"(M=#(/$^&H`_W`<Z/S___^(F`(0
+M``"(F`(0``"+7>C)PY!5B>6#[!B+50R*@@`0```\,'45BH(&$```B$7_BD7_
+MBI(&$```ZQ.0BH('$```B$7_BD7_BI('$```,-"(1?Z*1?ZH!'0&,<#K!XGV
+MN`$```#)PY!5B>6#[`B+50S&@@(0``"$QH("$```A,:"`A```(7&@@(0``"%
+MBH(`$```/"!T"HJ"`!```#PP=1>#Q/A2_W4(Z&?___^%P'4'N`$```#K`C'`
+MR<-5B>6#[!Q75E.+=0R+?1#'1?@`````A?9U"KX`@`P`OP``#P`Y-00```!S
+M.(DU!````#G^=RB)]HL=!````,:#`A```(3&@P(0``"$@04$`````"```#D]
+M!````';:B34$````.3T$````#X?E````BQT$````Z:H```"0@WWX`'5"@\3X
+M4XM%"%#HR?[__X/$$(7`=7J*@P`0``"$P'0,QH,;$```&NL*C78`QH,%$```
+M&L=%^`$```"+-00```#K3HGVBH,`$```/"!T"HJ#`!```#PP=7V#Q/A3BT4(
+M4.AS_O__@\00A<!U:8J#`!```#PP=0J*@QL0``#K"(GVBH,%$```B$7_BD7_
+M/!IU1:$$````!0`@``"C!````#GX=S*)P\:#`A```(7&@P(0``"%BH,`$```
+M/"`/A#O___^*@P`0```\,`^$+?___X-]^`%UNX-]^`!T"8GPP>@,ZP2)]C'`
+MC6786UY?R<.)]E6)Y8/L$%93BW4(BT8(#Z]&$$B+70PAP_9&%0%T#XG8P>@)
+MP>`(#[;3B<,)TX/$^&H55NCX_/__BT88BU`HBT`DB!P0BT88BT@HBU`DB=C!
+MZ`B(!`J+1AB+2"B+4"2)V,'H$(@$"H/$$/9&%01T$8M&&(M(*(M0)(G8P>@8
+MB`0*BT88]D`<"'0*BT`HQH`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+01AFQT`$``+'00@``(``@$D5`>F-`0``B?9FQP%S
+M[(M!&&;'0`0``L=!"`````&`214!ZS:09L<!=>R+01AFQT`$``+'00@````"
+M@$D5`>L:D&;'`7;LBT$89L=`!``"QT$(````!(!)%06+01@/MU`2`=)FB5`2
+MZ2@!``"0#[9%_X/X=0^$NP```'\A@_AK=&!_"H/X9'0_Z1`!``"#^',/A(,`
+M``#I`@$``(GV/>4```!T/7\/@_AV#X2B````Z>D```"0/>8```!T03WJ````
+M#X76````9L<!9)B+01AFQT`$``''00@``"``Z98```!FQP'EF(!)%0&+01AF
+MQT`$``+'00@``$``ZWN09L<!YIB`214!BT$89L=`!``"QT$(``"``.M?D&;'
+M`7.8BT$89L=`!``"QT$(`````8!)%0'K-I!FQP%UF(M!&&;'0`0``L=!"```
+M``*`214!ZQJ09L<!=IB+01AFQT`$``+'00@````$@$D5!8M!&`^W4!(!TF:)
+M4!*`214"ZQ=F#[;#BU$89CL"=11F#[9%_V8[0@)U";@!````ZP2)]C'`6\G#
+MC78`58GE@^P,5U93BUT(BWT,QD7_`(/$^&B0````4^CW\?__@\3X:AU3Z'3N
+M__^+0QB+4"B+0"3&!!``BT,8@\0@]D`<"'0*BT`HQH`>$````(/$^&H94^A&
+M[O__@\3T:@KH_/___XM#&(M0*(I%_XJ2#1````#0B$7_,<F#Q""+<QB+1BB*
+M5?^*@"`0````PHA5_T&#^0%^Z8M#&(M0*(M`)(H4$(A5_H/$]&H*Z/S___^+
+M0QB+4"B*1?^*D@T0````T(A%_S')@\00BW,8BT8HBE7_BH`@$````,*(5?]!
+M@_D!?NF+0QB+4"B+0"2*!!!7)?\```!0#[9%_E!3Z$O\__^#Q!"#^`%T!S'`
+MZ84```#_0PR#Q/AJ$%/H@NW__XM#&(!X%0!U:87_=65FQT`*``&+4Q@/MT($
+M9HE"!O9#%0%T#HM#&&;'0`P0`.L,C78`BT,89L=`#`@`BT,8#[=0!DIFB5`(
+MBTL8#[=!$@^W408/K\*)0P2+0PB9]WL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#/0`````$?QRA`````,'@`L>```````PW``#_!0`````QP.L%
+MN&8```#)PY!5B>6#[!13BUT(]@,(=":#Q/3_LY@```#H_/___X/$$(7`=`/&
+M`P"#Q/3_<VR+@X@```#_T,8#`#'`BUWHR<.058GE@^P05E.+70@Q]H-]#`%U
+M68/$](U#-%#H_/___X/$$(7`=0JX"0```.F%````@\3X:@'_LY@```#H_/__
+M_X/$]/^SF````.C\____@\0@]@,(=%V#Q/AJ`?]S;(N#A````/_0B<;K28GV
+M]@,(=!6#Q/AJ`/]S;(N#A````/_0B<:#Q!"#Q/3_LY@```#H_/___X/$^&H`
+M_[.8````Z/S___^#Q""#Q/2-0S10Z/S___^)\(UEZ%M>R<-5B>6#[`B+10B#
+MQ/QJ`/]U#/]P;(M`</_0R<.058GE@^P44XM="(/$]%/H_/___X/$$(7`=3V#
+MQ/QJ`8U#;%")V"T`````:<"7;_F6P?@"4.C\____A<!U&L=#$`````#'0Q@`
+M````QT,4`````(`+"#'`BUWHR<-5B>6#["Q75E.+?0C'1>``````QT7<`0``
+M`(/$]%?H@?___X/$$(7`#X5;`@``QT7H`````,=%Y`````#I]P```(UV`,=%
+MW`````"#Q/B+1>105^C\____B<.#Q!"%VP^$[P$``('[``````^$^P$``&:!
+MN_X!``!5J@^%R````,=%[`````"#?>``#X6>````@WW<``^%E````(UU^(GV
+MBU7LP>($BX0:O@$``(E%\(N$&L(!``")1?2+A!K&`0``B47XBX0:R@$``(E%
+M_(I%]#P$=!-_"3P!=`WK.8UV`#P%=!P\!G4NQT7@`0```(/$]%;H_/___XE'
+M$.L6C78`QT7<`0```(/$]%;H_/___XE%Y(/$$/]%[(-][`-W$(-]X`!U"H-]
+MW``/A''_____1>B#?>@'=Q"#?>``=0J#?=P!#X3\_O__@\3X_W<05^C\____
+MB<.#Q!"%VW4+N!L```#I(@$``)"!^P````!U#+@9````Z0\!``")]H`[Z70;
+MBP,E_P#_`#WK`)``=`VX"@```.GP````C78`@\3TC4,+4.C\____@\009CT`
+M`@^%SP````^V0PV)1P0/MD,0B4<<#[=#%HE'(`^W2PX#3Q")3Q0/MT,6`<B)
+M1Q@/MD,0#[=3%@^OP@'(B4<D@\3TC4,14.C\____)?__``#!X`5(P>@)0(E'
+M*`-')(E'+(/$](U#$U#H_/___R7__P``A<!U`XM#(`-'$"M'+#'2]W<$0(E'
+M"#WT#P``=D>+1P3!X`F)1PS'1S`"````@`\",<#K-8/$]/]W;(N'B````/_0
+MN!L```#K((UV`(/$]/]W;(N'B````/_0N!D```#K"(UV`+@+````C67(6UY?
+MR<.-=@!5B>6#[!!64XM="(MU#(/$]/]S;(N#C````/_0.T,0=@LK0Q")1A`Q
+MP.L-D,=&$`````"X'P```(UEZ%M>R<.058GE@^P,5U93BWT,BW<,BT<0BU4(
+MBUH0`<.+1Q2)1?S'1Q0`````.4<4#X.%````@\3X4XM5"%+H_/___X/$$(7`
+M="0]`````'4)N!D```#K98GV@\3\:``"``!05NC\____ZS>-=@"#Q/2+10C_
+M<&R)PHN"C````/_0@\00.=AW"K@;````ZRZ-=@"#Q/QH``(``&H`5NC\____
+M@\00_T<40X'&``(``(M%_#E'%`^">____S'`C67H6UY?R<.058GE@^P,5U93
+MBWT(@\3XBT4,4%?H_/___XG"@\00A=)T"('Z`````'4&,<#K:(GVBT4,*T<4
+MP>`(C5C^#Z]?!`-?+#'VC78`BTT0#[<$#F:#/!8`=!YFA<!U&8/$_/]W!%/_
+M=VR+AX````#_T(/$$(7`=2*#Q/B+10Q05^C\____B<*#Q!`#7P2#Q@*!_O\!
+M``!VM#'`C67H6UY?R<.)]E6)Y8/L#%=64XM%#(MP#(M`$(M5"(M:$`'#BT4,
+MBT`4B47\.UH8<TD!V#M"%'9",?\[??QS*HGVBU4(.UH4<A,[6AAS#H/$_%93
+M4NC\____@\001T.!Q@`"```[??QRV(M%#(MP#(M`$(M5"(M:$`'#BT4,QT`4
+M`````.LIC78`@\3\5E.+10C_<&R)PHM"=/_0@\00A<!U%XM%#/]`%$.!Q@`"
+M``"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QD7'`8L`B47H]@8!=1B#Q/16Z*O]__^#
+MQ!"%P`^%"0$``,9%QP"-1=2)1?2#Q/B-1>A05NC1_?__@\00A<`/A><```"+
+M1=1FB4,,BT789HE#%(M%W(E#$(I%UHA#%H/$_&H(:"0```"-0QA0Z/S___^#
+MQ/QJ!&@L````C4,B4.C\____@\0@@\3XC4,(4%;HWO[__X/$$(7`#X6,````
+M@\3XC47(4/]V;(N&D````/_0@\00A<!U<XM%R(D#BT7,B4,$C4,T4(U#,%"-
+M0RQ0_W7(Z/S___^#Q!"_0$(/`(!]U@!U!;^@A@$`BT7<F?=]V(G!#Z_/BU70
+MB=`QTO?QB<'W)3````")T,'H`XT$@`'`*<&)R/[`B$,7@'W'`'4)@\3T5NC\
+M____,<"-9:A;7E_)PXUV`%6)Y8/L#%=64XM]#(,]``````!U#>C\____A<`/
+MA1L"``"+!SL%`````'(,N!0```#I!P(``(GVBQ>-!)+!X`,IT(TTA0````"#
+MQ/AJ`5;H_/___X/$$(7`#X7>`0``@WT($'=WBT4(_R2%-````)#V!@$/A*\`
+M``"#Q/16Z/S___^#Q!#IG@```(GV]@8(=`N['P```.F5`0``D/8&`708@\3T
+M_[:8````Z/S___^)PX/$$(/[(G4.@\3T5NC*^___B<.#Q!"%VW1=@\3T5NC\
+M____@\00Z4$!``#V!@AT/(/$]/^VF````.C\____@\00A<!T#(/$]%;H_/__
+M_X/$$/8&"'06BT4(2(/X$7<(_R2%>````)#V!@)U"[LW````Z0D!``"0@WT(
+M$@^'Y@```(M%"/\DA<````"#Q/16Z)OU___IQ````(GV@\3T5NC\____Z;0`
+M``")]H/$^/]W#(/$]/\WZ/S___^#Q!!0Z/S____IE````(GV@\3X5U;H[O?_
+M_^F#````D(/$]%;H[_3__^MWD(/$^%=6Z!+X___K:H/$^%=6Z&;Y___K7H/$
+M^%=6Z!+Z___K4H/$^%=6Z%+Z___K1H/$^%=6Z&[Z___K.H/$^%=6Z/;Z___K
+M+H/$^%=6Z$K[___K(H/$^%=6Z)K[___K%H/$^%=6Z.K[___K"H/$^%=6Z*K\
+M__^)PX/$$.L(C78`NP$```"%VW4/@\3X:@!6Z/S___^)P^L+@\3X:@!6Z/S_
+M__^)V(UEZ%M>7\G#C78`58GE@^P05E.#/0``````#X61````O@`````QVX/$
+M]%/H_/___XF&F````(D8Q@8`@\000X'&G````(/[!W;=QP4``````0```.C\
+M____QP4``````````.C\____A<!U1^C\____A<!T"NL\N!\```#K-9`QV[X`
+M````.QT`````<R.0@\3TC48T4.C\____@\00A<!UU4.!QIP````['0````!R
+MWC'`C67H6U[)PY!5B>6#[`Q75E.^`````#'_.ST`````<U^#Q/AJ`5;H_/__
+M_X/$$(7`=3Z#Q/16Z/S___^#Q/16Z/S___^#Q""#Q/3_MI@```#H_/___X/$
+M](U>-%/H_/___X/$((/$]%/H_/___X/$$$>!QIP````[/0````!RH<<%````
+M``````"-9>A;7E_)PY"0D%6)Y5.+30B+70QF#[81BD$!)`/!X`@)PF:)$P^^
+M40&!XOP```#!^@**00(D#V:8P>`&"=!FB4,"#[Y1`H'B\````,'Z!(I!`R0_
+M9IC!X`0)T&:)0P0/OE$#@>+`````P?H&9@^V003!X`()T&:)0P9;R<.058GE
+M5E.+30B+70P/O\,!P`-%$(/`_C'29CG:?1F-=@")SH/F`6:),(/`_F;!^0%F
+M0F8YVGSJ6U[)PXGV58GE5U93BU4,B=$/O\&-!$7^____BUT(`<,Q_[X!````
+M9DEFA=)^&`^W`X/#_F:%P'0""?<!]HG(9DEFA<!_Z`^_QUM>7\G#58GE@^P(
+M@\3T@\3T#[]%"%#HL@$``(G"N/\#```IT)A0Z&H!``"8R<.-=@!5B>6#[!!6
+M4XM%"(M5#(G!B=9FA<!T!6:%TG4$,<#K-H/$]`^_P5#H<`$``(G#@\3T#[_&
+M4.AB`0``C008@\0@9CW_`WX%!0'\__^#Q/284.@/`0``F(UEZ%M>R<.-=@!5
+MB>6#[!13BUT(@\3X@\3T#[]%#%#H6O___YA0#[_;4^A[____F(M=Z,G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:)````"+1PP/KT<(`T40`=A05XM%
+M#/_0@\00ZP3&!#.0B@0SB<+!X@B)V`-'$(H$,"7_````"<)F.Q=U'XI%_X@$
+M,T,[7Q!\L(M'$`%'#(%_#,\'```/CE'___^#Q/QJ`(M%$%!7BT<@_]")QHI%
+M_X@&,<"#?PP`=06X&@```(UEZ%M>7\G#B?95B>6#[!13BT4(@\3X:@#_<!SH
+M_/___XG!B@&(1?NS`(3`=0*S_\=%_`````"+1?R('`B+1?R*!`@/MM`/OL,Y
+MPG0%,<#K#Y"+1?R*5?N(%`BX`0```(M=Z,G#D%6)Y8/L#%=64XM%"(MU#+\:
+M````B48<@\3T4.C\____@\3T_W8<Z/S___^#Q""%P`^%GP```(/$]%;H9?__
+M_X/$$(7`#X6&````9L<&``#&1@(`QT84`````,=&(#Q4``#'1B185```QT8H
+MC%0``,=&+)A4``#'1C"D5```,=L['0````!])(7_="20@\3T5HL$G0````#_
+MT(G'@\000SL=`````'T$A?]UX87_=04QP.LBD,=&"```$`#'1@0`$```QT8,
+M`0```,=&$`$```"X&@```(UEZ%M>7\G#D)"058GEBTT(BU4,B=!FP>@(B$$!
+MB!')PXGV58GEBT4(9@^V4`'!X@AF#[8``<(/M\+)PXUV`%6)Y8/L$%93BW4(
+MBUT,@\3X#[?#4%;H_/___X/$^,'K$%.#Q@)6Z/S___^-9>A;7LG#B?95B>6#
+M[!!64XM="(/$]%/H_/___XG&@\3T@\,"4^C\____#[?6P>`0`<*)T(UEZ%M>
+MR<.058GE@^P(BT4(@\3\_W44BT`8BT`H`T4,4/]U$.C\____R<.058GE@^P(
+MBT4(@\3\_W40_W4,BU`8BT(D`T(H4.C\____R<.058GE@^P(BU4(@\3\_W4,
+M#[9%$%"+4AB+0B0#0BA0Z/S____)PY"0D%6)Y8M%"(L`R<.)]E6)Y8M%",'@
+M`RM%",'@!`5@!@``R<.)]E6)Y8M%",'@`HN`X`D``,G#C78`58GE@^P(BT4(
+M@\3T4(M`9/_0R<-5B>6#[!13BUT(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_0@\00@WL,`'4G@WL4`G4+QT,4`0```.L8B?:#>Q0!
+M=1#'0Q0`````@\3T4XM#2/_0BUWHR<.058GE@^P(BT4(@WAH`'0,@\3X_W4,
+M4(M`:/_0,<#)PY!5B>6#[!13BUT(@\3X:@!3Z/S___^#Q/13Z/S___^#Q""#
+MQ/AJ`%/H_/___X/$]%.+0VS_T(/$((/$](L#P>`"_[#@"0``Z/S___^+7>C)
+MPTTM4WES=&5M<R!$:7-K3VY#:&EP`````$%.04Y$````@8"`@$9R965"4T0`
+M-"XQ`,W,S,PT10``H$4``*!%``"@10``-$4``*!%``"@10``H$4``*!%``"@
+M10``4$4``%!%``!010``4$4``.Q%``"@10``-$4``.Q%``#L10``[$4``-Q%
+M``#L10``[$4``-Q%``#L10``W$4``-Q%``#<10``W$4``-Q%``#<10``[$4`
+M`-Q%``#<10``[$4```!&```01@``Y48``-Q&``!01@``7$8``&A&``!T1@``
+M@$8``(Q&``"81@``I$8``+!&``"\1@``($8``$!&``#<1@``W$8``,A&````
+M`````````````````````````````````````!%5_P````!550``````````
+M``````$``P`'``\`'P`_`'\`_P``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````6T%335]&24Q%7T5.1%U'0T,Z("AC*2`R+CDU+C,@,C`P,3`S
+M,34@*')E;&5A<V4I``!;05--7T9)3$5?14Y$74=#0SH@*&,I(#(N.34N,R`R
+M,#`Q,#,Q-2`H<F5L96%S92D``%M!4TU?1DE,15]%3D1=1T-#.B`H8RD@,BXY
+M-2XS(#(P,#$P,S$U("AR96QE87-E*0``6T%335]&24Q%7T5.1%U'0T,Z("AC
+M*2`R+CDU+C,@,C`P,3`S,34@*')E;&5A<V4I``!;05--7T9)3$5?14Y$74=#
+M0SH@*&,I(#(N.34N,R`R,#`Q,#,Q-2`H<F5L96%S92D``%M!4TU?1DE,15]%
+M3D1=1T-#.B`H8RD@,BXY-2XS(#(P,#$P,S$U("AR96QE87-E*0``6T%335]&
+M24Q%7T5.1%U'0T,Z("AC*2`R+CDU+C,@,C`P,3`S,34@*')E;&5A<V4I``!;
+M05--7T9)3$5?14Y$74=#0SH@*&,I(#(N.34N,R`R,#`Q,#,Q-2`H<F5L96%S
+M92D``%M!4TU?1DE,15]%3D1=1T-#.B`H8RD@,BXY-2XS(#(P,#$P,S$U("AR
+M96QE87-E*0``6T%335]&24Q%7T5.1%U'0T,Z("AC*2`R+CDU+C,@,C`P,3`S
+M,34@*')E;&5A<V4I``!;05--7T9)3$5?14Y$74=#0SH@*&,I(#(N.34N,R`R
+M,#`Q,#,Q-2`H<F5L96%S92D``%M!4TU?1DE,15]%3D1=1T-#.B`H8RD@,BXY
+M-2XS(#(P,#$P,S$U("AR96QE87-E*0``6T%335]&24Q%7T5.1%U'0T,Z("AC
+M*2`R+CDU+C,@,C`P,3`S,34@*')E;&5A<V4I``!;05--7T9)3$5?14Y$74=#
+M0SH@*&,I(#(N.34N,R`R,#`Q,#,Q-2`H<F5L96%S92D`"``````````!````
+M,#$N,#$````(``````````$````P,2XP,0````@``````````0```#`Q+C`Q
+M````"``````````!````,#$N,#$````(``````````$````P,2XP,0````@`
+M`````````0```#`Q+C`Q````"``````````!````,#$N,#$````(````````
+M``$````P,2XP,0````@``````````0```#`Q+C`Q````"``````````!````
+M,#$N,#$````(``````````$````P,2XP,0````@``````````0```#`Q+C`Q
+M````"``````````!````,#$N,#$````(``````````$````P,2XP,0`````N
+M<WEM=&%B`"YS=')T86(`+G-H<W1R=&%B`"YT97AT`"YR96PN=&5X=``N<F]D
+M871A`"YR96PN<F]D871A`"YD871A`"YB<W,`+F-O;6UE;G0`+FYO=&4`````
+M`````````````````````````````````````````````````````!L````!
+M````!@`````````T````)%T`````````````!``````````A````"0``````
+M````````$'0``/`'```*`````0````0````(````*P````$````"````````
+M`%A=```,`0`````````````$`````````#,````)````````````````?```
+ML`$```H````#````!`````@````_`````0````,`````````@%X``&`%````
+M`````````"``````````10````@````#`````````.!C````"@``````````
+M```@`````````$H````!``````````````#@8P``O`(``````````````0``
+M``````!3````!P``````````````G&8``!@!``````````````$`````````
+M$0````,``````````````+1G``!9```````````````!``````````$````"
+M``````````````#P:0``\`4```L```!2````!````!`````)`````P``````
+M````````X&\``"X$``````````````$`````````````````````````````
+M``````````````````,``0`````````````````#``(`````````````````
+M`P`#``````````````````,`!``````````````````#``4`````````````
+M`````P`&``````````````````,`!P`````````````````#``@`````````
+M`````````P`)``````````````````,`"@`````````````````#``L``0``
+M`+1<```?`````@`!`!@````\60``%`````(``0`I````H%H``%H````"``$`
+M+P```"P[```;`````@`!`#H```!@6```,P````(``0!'````+%@``#(````"
+M``$`4@```$0````4`````0`%`%L```#<6```)0````(``0!B````7`````0`
+M```!``4`<````"A9```1`````@`!`'L````0````!`````$`!0"$````4%L`
+M`"P````"``$`E````+A8```C`````@`!`)T````X/P``G@````(``0"N````
+M!%D```H````"``$`NP```(Q!```+`````@`!`,P````D4P``#@$```(``0#4
+M````_%H``!4````"``$`Z````,!4``#+`````@`!`/@````07```%`````(`
+M`0`-`0``S%D``,8````"``$`&P$``,P"```*`````@`!`"<!``!@````!```
+M``$`!0`O`0``G!\``(0````"``$`/@$``-1<``!0`````@`!`$L!``!4&@``
+M%P````(``0!7`0``6`````0````!``4`9@$``'Q;```\`````@`!`'`!``"X
+M6P``$0````(``0!^`0``P%(``&0````"``$`CP$``!!9```6`````@`!`)H!
+M```,1P``KP````(``0"A`0``;"4``&X!```"``$`N`$``"P````$`````0`%
+M`,,!```P.@``/P````(``0#2`0``%%L``!4````"``$`XP$``+Q'``")````
+M`@`!`.H!```D7```CP````(``0#\`0``$%@``!D````"``$`!0(``)18```C
+M`````@`!``T"```,````!`````$`!0`;`@``_%L``!$````"``$`*0(``&PU
+M``"=`0```@`!`#4"``!060``)0````(``0!(`@``?"```.T````"``$`60(`
+M`"Q;```A`````@`!`&D"``#$1```10(```(``0!P`@``Q`(```4````"``$`
+M?`(``!Q#``!?`````@`!`(P"``#X5P``%@````(``0"3`@``&%<``-T````"
+M``$`HP(``&0````8`````0`%`*L"``!P.@``O`````(``0"S`@``0`````0`
+M```!``4`PP(``(````#@!````0`%`,@"``#@40``W0````(``0#4`@``X`(`
+M`!`````"``$`X@(``/`"```%`````@`!`.\"````.@``+P````(``0`!`P``
+MS%L``"X````"``$`"P,``(Q5```N`0```@`!`!<#``!X60``5`````(``0`D
+M`P```````"\````"``$`.0,``)1:```+`````@`!`$T#``!H,@``%0````(`
+M`0!;`P``V`(```4````"``$`:0,``!@E``!4`````@`!`'@#```H````!```
+M``$`!0"!`P``F`X```4!```"``$`BP,``#14```'`````@`!`)0#````````
+M`````!````"A`P`````````````0````K`,`````````````$````+D#``!`
+M`@``<````!(``0##`P`````````````0````T`,```@"```<````$@`!`-L#
+M``!@`0``J````!(``0#F`P``L`(``!,````2``$`\@,``"0"```<````$@`!
+M`/X#`````````````!`````+!``````````````0````%P0``'@```#F````
+M$@`!`"($```P````1P```!(``0``=7!D871E4V]C:V5T4&%R86UE=&5R<P!F
+M;%=R:71E4')O=&5C=&5D`&9L36%P`&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F=#;VYT97AT`&=E=$Y&1$,R,59A<G,`9FQ$96QE=&5-=71E>`!C:&5C:U=I
+M;D9O<D1/0P!N;T]F351$<P!S=V%P56YI=',`;F]&;W)M870`9&]C,FM?;65M
+M<V5T`&1O8S)K7V9R964`9&]C,FM?;65M8W!Y`&1O8S)K7W)W90!D;V,R:U]M
+M86QL;V,`9&]C,FM?;W!E;@!D;V,R:U]S:7IE`&1O8S)K7W-L965P`&1O8S)K
+M7V-L;W-E`&1O8S)K7VUE;6-M<`!D;V,R:U]D96QA>0!D;V,R:U]I;F9O`&1O
+M8S)K7W!R;V)E````"P````$F```1`````10``!8````".```(@````)&```G
+M`````B,``#T````!%```0P````$F``!)`````08``$\````!!@``5P````(K
+M``!D`````2T``)`````"4@``I`````(Z``##`````0,``((!```".@``'@(`
+M``(Z```Z`@```CH``'X"```".@``C@(```(Z``">`@```CH``+T"```"7```
+M*04```$%```>"0```AH``"0)```"%0``5PD```)6``!I"0```E8``$(4```!
+M00``,A@```)0``#S&0```E,```<:```"4P``*1H```)3```]&@```E,``&4:
+M```!!@``LAH```$&``#)&@```E(``#T;```!`P``0QL```);``"Q&P```0,`
+M`+<;```"6P``Z1L```(0``!='````A```*@>```!`0``KQX```$!``"V'@``
+M`0$``+T>```!`0``Q!X```$!``#+'@```0$``-(>```!`0``\!X```)6```W
+M'P```E8``%P?```!`P``I!\```$B``"U'P```2(``+X?```!/P``PA\```$!
+M``#('P```3\``,P?```!40``TA\```$B``#9'P```08``-X?```!!@``XQ\`
+M``$&``#H'P```08``(H@```!+0``H"````$M``"Q(````2T``+8@```"*@``
+MO2````$M``#*(````CD``-P@```"+```[2````$!``#T(````0$``/L@```!
+M`0```B$```$!```)(0```0$``!`A```!`0``%R$```$!```>(0```0$``"4A
+M```!`0``+"$```$!```Z(0```0$``$$A```!+0``1R$```$M``#>(P```ED`
+M`*XD```"#@``DB4```$%``":)0```04``*8E```!!0``NB4```$%``#$)0``
+M`04``,PE```!!0``TB4```$%``#>)0```04``"@F```!!0``?28```$%``"'
+M)@```04``!\H```"#@``JB@```(S``#-*````C,```DI```"&```/RD```(3
+M``#_*@```@T``,PL```",P``\2P```$%```]+P```C,``&0O```"*0``AC``
+M``(-``!W,@```08``,PU```"7```&#8```)<```J-P```AH``#DW```!!@``
+M2C<```(:``!0-P```A4``'8W```"'0``AC<```(O``#`-P```@X``"$Y```"
+M-@``S3D```$!``#4.0```0$``-LY```!`0``XCD```$!```%.@```4\```TZ
+M```!3P``%CH```$2```:.@```0$``"`Z```!3P``23H```))``"+.@```B$`
+M`*PZ```"%P``NCH```(G````.P```B@``!`[```"%P``'SL```([``!7.P``
+M`BX``&X[```!0@``?3L```(<``#X.P```@\```L\```!00``F#P```(0``"P
+M/````A```/0\```"#P``#CT```%!``!(/0```C(``)D]```",@``NST```(R
+M``"Q/@```@\``+T^```!00``USX```)4```0/P```E(``$T_```"#P``7#\`
+M``%!``"U/P```@\``"1````"&0``M$````%!```=00```@\``"U!```!00``
+M:4$```(^``#R0P```0,``/M#```"5```!40```$#```.1````E0``&%$```"
+M/```D40```$#``"S1````AL``-)$```!%@``VD0```(K``#J1````2T```E%
+M```!0@``%$4```)````O10```0,``$)%```"&P``;T4```))``"410```AL`
+M`*]%```"20``OT4```(N``#710```0,``/Q%```!`P``%48```(N```L1@``
+M`BH``#5&```"#```[$8```)```#[1@```D```!9'```!%@``(D<```%"```M
+M1P```BH``$U'```!%@``5D<```)%``!<1P```2(``&5'```"2@``;D<```(@
+M``"#1P```4(``(E'```!+0``F$<```)$``"L1P```2T``,9'```!0@``SD<`
+M``$M``#;1P```D```.M'```"+@``]$<```(;```%2````B0``!%(```".P``
+M'4@```)-```M2````2T``#5(```!%@``/TP```$%``!_3````04``-E2```"
+M0P``/%,```(J``!04P```CX``()3```!(@``CU,```$_``">4P```3\``,53
+M```!(@``]U,```$B```&5````3\``!M4```!/P``3U0```(.``!_5````E0`
+M`+A4```"'P``VU0```(.``#/5@```@X``#17```"-P``/U<```))``!U5P``
+M`0$``'Q7```!`0``@U<```$!``"*5P```0$``)%7```!`0``F5<```%/``"K
+M5P```1(``+E7```!3P``0U@```(]``!36````CT``'!8```",@``?E@```(R
+M``"Q6````E0``-58```"5```^U@```)2```@60```08``#-9```!!@``U5D`
+M``$&``#=60```2T``/)9```"+P``_5D```(=```+6@```CD``!]:```"5@``
+M)EH```$&``!_6@```2T``&1;```",0``Y5P```(.``#N7````B@``/Q<```"
+M%P``%ET```$&```;70```E,``#0````!`0``.`````$!```\`````0$``$``
+M```!`0``1`````$!``!(`````0$``$P````!`0``4`````$!``!4`````0$`
+M`%@````!`0``7`````$!``!@`````0$``&0````!`0``:`````$!``!L````
+M`0$``'`````!`0``=`````$!``!X`````0$``'P````!`0``@`````$!``"$
+M`````0$``(@````!`0``C`````$!``"0`````0$``)0````!`0``F`````$!
+M``"<`````0$``*`````!`0``I`````$!``"H`````0$``*P````!`0``L```
+M``$!``"T`````0$``+@````!`0``O`````$!``#``````0$``,0````!`0``
+MR`````$!``#,`````0$``-`````!`0``U`````$!``#8`````0$``-P````!
+M`0``X`````$!``#D`````0$``.@````!`0``[`````$!``#P`````0$``/0`
+M```!`0``^`````$!``#\`````0$````!```!`0``!`$```$!```(`0```0$`
+!```!
+`
+end
diff --git a/sys/contrib/dev/fla/msysosak.h b/sys/contrib/dev/fla/msysosak.h
new file mode 100644
index 0000000..11d4c51
--- /dev/null
+++ b/sys/contrib/dev/fla/msysosak.h
@@ -0,0 +1,135 @@
+/*-
+SOFTWARE LICENSE AGREEMENT
+
+IMPORTANT! READ CAREFULLY:
+THIS SOFTWARE LICENSE AGREEMENT (the ``Agreement'') is a legal
+agreement between you (either an individual or a single entity) and
+M-Systems Flash Disk Pioneers Ltd. ("M-Systems").
+This Agreement relates to the M-Systems' software accompanying this
+Agreement, which includes computer software and may include associated
+media, printed materials, and ``online'' or electronic documentation
+(the ``Licensed Software'').
+By downloading, installing, copying, or otherwise using the Licensed
+Software, you agree to be bound by the terms of this Agreement.
+If you do not agree to the terms of this Agreement, do not install,
+copy or use the Licensed Software.
+
+The Licensed Software is protected by copyright laws and international
+copyright treaties, as well as other intellectual property laws and
+treaties. The Licensed Software is licensed, not sold.
+The Licensed Software is being provided solely for use with M-Systems'
+DiskOnChip® product lines.
+1. License Grant.
+(a) Grant of License. Subject to the terms and conditions of this
+ Agreement, M-Systems hereby grants you a nonexclusive,
+ royalty-free, worldwide license (including the right to
+ sublicense) to use, copy and distribute the Licensed Software
+ with M-Systems DiskOnChip® products.
+(b) Restrictions on Use. The Licensed Software is licensed solely
+ for use with and to support M-Systems' DiskOnChip® products.
+ Use of this Licensed Software with, or to support, any other
+ flash disk, flash card, resident flash array or solid state
+ disk of any kind is expressly prohibited, and constitutes an
+ illegal infringement of M-Systems' patent, copyright and other
+ rights in and to the Licensed Software.
+2. Limitations on Reverse Engineering, Decompilation, and
+ Disassembly. You may not reverse engineer, decompile, or
+ disassemble the Licensed Software, except and only to the
+ extent that such activity is expressly permitted by applicable
+ law notwithstanding this limitation.
+3. Termination. Without prejudice to any other rights, M-Systems
+ may terminate this Agreement if you fail to comply with the
+ terms and conditions of this Agreement. In such event, you must
+ destroy all copies of the Licensed Software and all of its
+ component parts.
+4. Intellectual Property Rights. Title to the Licensed Software,
+ and all rights with respect to the Software not specifically
+ granted under this Agreement, including without limitation
+ all rights of modification, disassembly and decompilation and
+ all copyright, patent, trademark, trade secret and other
+ proprietary rights and interests are reserved to M-Systems.
+ You may not remove or alter the "README" or "COPYRIGHT" files
+ or copyright notices in the Licensed Software.
+5. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by
+ applicable law, M-Systems and its suppliers provide the Product
+ and any (if any) support services related to the Product
+ ("Support Services") AS IS AND WITH ALL FAULTS, and hereby
+ disclaim all warranties and conditions, either express,
+ implied or statutory, including, but not limited to, any
+ (if any) implied warranties or conditions of merchantability,
+ of fitness for a particular purpose, of lack of viruses, of
+ accuracy or completeness of responses, of results, and of lack
+ of negligence or lack of workmanlike effort, all with regard
+ to the Product, and the provision of or failure to provide
+ Support Services. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+ TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO
+ DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE PRODUCT.
+ THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR
+ PERFORMANCE OF THE PRODUCT AND SUPPORT SERVICES, IF ANY,
+ REMAINS WITH YOU.
+6. EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER
+ DAMAGES. To the maximum extent permitted by applicable law,
+ in no event shall M-Systems or its suppliers be liable for
+ any special, incidental, indirect, or consequential damages
+ whatsoever (including, but not limited to, damages for loss
+ of profits or confidential or other information, for business
+ interruption, for personal injury, for loss of privacy, for
+ failure to meet any duty including of good faith or of
+ reasonable care, for negligence, and for any other pecuniary
+ or other loss whatsoever) arising out of or in any way related
+ to the use of or inability to use the Product, the provision
+ of or failure to provide Support Services, or otherwise under
+ or in connection with any provision of Agreement, even in the
+ event of the fault, tort (including negligence), strict
+ liability, breach of contract or breach of warranty of
+ M-Systems or any supplier, and even if M-Systems or any
+ supplier has been advised of the possibility of such damages.
+7. LIMITATION OF LIABILITY AND REMEDIES. Notwithstanding any
+ damages that you might incur for any reason whatsoever
+ (including, without limitation, all damages referenced above
+ and all direct or general damages), the entire liability of
+ M-Systems and any of its suppliers under any provision of this
+ Agreement and your exclusive remedy for all of the foregoing
+ shall be limited to the greater of the amount actually paid by
+ you for the Product or U.S.$5.00. The foregoing limitations,
+ exclusions and disclaimers shall apply to the maximum extent
+ permitted by applicable law, even if any remedy fails its
+ essential purpose.
+8. Miscellaneous
+ The laws of the State of California, United States of America,
+ exclusive of conflict-of-laws provisions, shall govern this
+ Agreement in all respects.
+*/
+
+#ifndef MSYSOSAK_H
+#define MSYSOSAK_H 1
+
+struct doc2k_stat {
+ unsigned short type;
+ long unitSize;
+ long mediaSize;
+ long chipSize;
+ int interleaving;
+ unsigned long window;
+
+ /* Non-OSAK members Below this point */
+ char *product;
+ char model[40];
+};
+
+enum doc2k_work { DOC2K_READ, DOC2K_WRITE, DOC2K_ERASE };
+
+int doc2k_probe(int drive, unsigned lowaddr, unsigned highaddr);
+int doc2k_info(int drive, struct doc2k_stat *info);
+int doc2k_size(int drive, unsigned *capacity, unsigned *ncyl, unsigned *nhead, unsigned *nsect);
+int doc2k_open(int drive);
+int doc2k_close(int drive);
+int doc2k_rwe(int drive, enum doc2k_work what, unsigned block, unsigned len, void *ptr);
+void doc2k_memcpy(void *dst, const void *src, unsigned len);
+void doc2k_memset(void *dst, int c, unsigned len);
+int doc2k_memcmp(const void *dst, const void *src, unsigned len);
+void *doc2k_malloc(int bytes);
+void doc2k_free(void *ptr);
+void doc2k_delay(unsigned usec);
+
+#endif
diff --git a/sys/contrib/dev/fla/patch.00 b/sys/contrib/dev/fla/patch.00
new file mode 100644
index 0000000..90841e6
--- /dev/null
+++ b/sys/contrib/dev/fla/patch.00
@@ -0,0 +1,23 @@
+Index: files.i386
+===================================================================
+RCS file: /home/ncvs/src/sys/i386/conf/files.i386,v
+retrieving revision 1.220.2.8
+diff -u -r1.220.2.8 files.i386
+--- files.i386 1999/05/27 03:06:33 1.220.2.8
++++ files.i386 1999/08/01 12:44:00
+@@ -34,6 +34,13 @@
+ no-obj no-implicit-rule before-depend \
+ clean "ukbdmap.h"
+ #
++contrib/dev/fla/fla.c optional fla
++msysosak.o optional fla \
++ dependency "$S/contrib/dev/fla/i386/msysosak.o.uu" \
++ compile-with "uudecode < $S/contrib/dev/fla/i386/msysosak.o.uu" \
++ no-implicit-rule
++
++#
+ dev/fb/fb.c optional fb device-driver
+ dev/fb/fb.c optional vga device-driver
+ dev/fb/splash.c optional splash
+
+
diff --git a/sys/contrib/dev/fla/prep.fla.sh b/sys/contrib/dev/fla/prep.fla.sh
new file mode 100644
index 0000000..5d27717
--- /dev/null
+++ b/sys/contrib/dev/fla/prep.fla.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# $FreeBSD$
+
+dev=fla0
+
+grep "$dev.*sectors" /var/run/dmesg.boot | tr -d '(:)' | awk '
+ {
+ v = $3
+ c = $5
+ h = $7
+ s = $9
+ ss = c * h * s - s
+
+ print "#",$0 > "_"
+ print "g c"c" h"h" s"s > "_"
+ print "p 1 165",s,ss > "_"
+ print "a 1" > "_"
+
+ print "#",$0 > "__"
+ print "type: ESDI" > "__"
+ print "disk:", $1 > "__"
+ print "label:" > "__"
+ print "flags:" > "__"
+ print "bytes/sector: 512" > "__"
+ print "sectors/track:", s > "__"
+ print "tracks/cylinder:", h > "__"
+ print "sectors/cylinder:", s * h > "__"
+ print "cylinders:", c > "__"
+ print "sectors/unit:", ss > "__"
+ print "rpm: 3600" > "__"
+ print "interleave: 1" > "__"
+ print "trackskew: 0" > "__"
+ print "cylinderskew: 0" > "__"
+ print "headswitch: 0 # milliseconds" > "__"
+ print "track-to-track seek: 0 # milliseconds" > "__"
+ print "drivedata: 0 " > "__"
+ print "8 partitions:" > "__"
+ print "# size offset fstype [fsize bsize bps/cpg]" > "__"
+ print "a:",ss,"0 4.2BSD 512 4096 " > "__"
+ print "c:",ss,"0 unused 0 0" > "__"
+ }
+'
+fdisk -f _ -i -v $dev
+disklabel -BrR ${dev} __
+newfs /dev/r${dev}a
diff --git a/sys/contrib/dev/oltr/COPYRIGHT b/sys/contrib/dev/oltr/COPYRIGHT
new file mode 100644
index 0000000..668a641
--- /dev/null
+++ b/sys/contrib/dev/oltr/COPYRIGHT
@@ -0,0 +1,62 @@
+The oltr driver uses objects and microcode from Olicom's
+OC-3300 PowerMACH Works Kit.
+
+As the Linux driver says..
+==================================================================
+*
+* This driver uses the Token Ring Low Level Driver (TRlld,
+* PowerMach Works) as the lower level driver. The PMW kit is
+* (C) Olicom. The executable object may be distributed along
+* with this driver for the purpose of linking this driver.
+*
+=================================================================
+The low level driver is combined with a FreeBSD specific driver
+supplied in source, which provides all OS dependent functions.
+
+files from olicom are:
+
+trlld.o - Olicom low-level driver interface
+
+trlldmac.o - TMS 380 Microcode for Olicom TMS380 based cards
+trlldbm.o - "bullseye" Microcode for Olicom "bullseye" based cards
+trlldhm.o - "hawkeye" Microcode for Olicom "hawkeye" based cards
+
+The file trlld.o is stored in uuencode format as trlld.o.uu
+It represents a state machine of some kind that has no OS dependencies
+and communicates with the firmware on the cards via a proprietary interface.
+All communication with this module is achieved via functions supplied in
+the FreeBSD specific driver.
+
+The other 3 files have been encoded using file2c(1)
+and represent only microcode to be loaded into the appropriate board
+when found.
+
+Here is the release notice from Olicom regarding these files:
+-------------------------------------------------------------------------------
+OC-3300 PowerMach Works and its components are wholly owned products of
+Olicom A/S
+Nybrovej 114
+2800 Lyngby
+Denmark
+(45) 45 27 00 00
+and are used and distributed with permission. (#SS022499)
+-------------------------------------------------------------------------------
+
+A supporting email is also included.
+---------- Forwarded message ----------
+Date: Wed, 24 Feb 1999 17:07:14 +0100
+From: Starla Scott <sscott@olicom.com>
+To: 'Larry Lile' <lile@stdio.com>
+Subject: RE: FreeBSD Token-ring driver
+
+Larry,
+
+You may freely distribute the driver and/or kit. However, we do request that
+you include an acknowledgement of Olicom's copyright and ownership as
+related to your driver.
+
+Thanks,
+Starla
+Olicom Tech Support
+------------------------------------------------------------------------------
+
diff --git a/sys/contrib/dev/oltr/i386-elf.trlld.o.uu b/sys/contrib/dev/oltr/i386-elf.trlld.o.uu
new file mode 100644
index 0000000..02fabcd
--- /dev/null
+++ b/sys/contrib/dev/oltr/i386-elf.trlld.o.uu
@@ -0,0 +1,1850 @@
+begin 644 trlld.o
+M?T5,1@$!`0````````````$``P`!``````````````#<0@$``````#0`````
+M`"@`"P`'`````````````````(/L%%>+?"0<5E-5BT0D+"7__P``@\`$B]@E
+M__\``%#_5QR+\('C__\``$.!X___``!3_U<<P>`(@\0(9@OP@>;__P``9O?&
+M`0!FB70D(`^%>`(``(M$)"PE__\``%#_5QR(1"0G@\0$BT0D+"7__P``@\`"
+MB]@E__\``%#_5QR+\('C__\``$.!X___``!3_U<<BU0D*(/$",'@"('B__\`
+M`&8+\(M$)"`E__\``('F__\``(/``H/""HOH)?__```[P@^-\0```(M$)"PE
+M__\``(/`!&:+\(M$)"`E__\``(/`"HE$)!B+QB7__P``4/]7'(O8B\8E__\`
+M`$`E__\``%#_5QS!X`B#Q`AF"]B+Q8'C__\``"7__P``.\,/A:@!``"+1"0L
+M)?__``"#P`HE__\``%!7Z!1N``"#Q`B+U8'B__\``#O0#X5]`0``BT0D+"7_
+M_P``4/]7'(A$)"=J8?]7'(M$)#0E__\``(/``B7__P``4/]7'#/2@\0,BE0D
+M(SO0#X5!`0``BT0D+"7__P``@\`#)?__``!0_U<<BU0D'(/$!&:#Q0*+Q27_
+M_P``.\(/C"[___]F,_:-7QR)?"00BVPD+('E__\``(M$)"R#Q00E__\``(/`
+M"F:)1"0<C4<$B_B+QB7_````4(O%)?__``!0_Q=J8?\3BT0D*"7__P``4/\3
+MBM`SP(K"]]`E_P```%"+1"0P)?__``!0_Q=J8?\3B\4E__\``%#_$XK0,\"*
+MPHO6-?X```"#Q"`E__\``('B__\``#O"=7R#Q@)F@?X``7*-BW0D+(M\)!"+
+M1"0@@>;__P``)?\```"#Q@10B\8E__\``%#_5P2+1"0H@>;__P``)?__``!&
+MP?@(@>;__P``)?\```!05O]7!#/`@\00BD0D(U"+1"0P)?__``!0_U<$N`$`
+M``"#Q`A=6UY?@\04PSO_75M>,\!?@\04PSO_._^!_P````"#[%!7BWPD6%93
+M56:+AW(+``!FJ1``=$0SP&:+1Q:#P`PE__\``%"+AUP+``#_4!R+\#/`9HM'
+M%H/`#27__P``4(N'7`L``/]0','@"&8+\('F__\``(/$".LDD#/`9HM'%H/`
+M#"7__P``4(N'7`L``/]0((OP@>;__P``@\0$9HN'<@L``&:I$`!FB70D7G1#
+M,\!FBT<6@\`*)?__``!0BX=<"P``_U`<B_`SP&:+1Q:#P`LE__\``%"+AUP+
+M``#_4!S!X`AF"_"!YO__``"#Q`CK(S/`9HM'%H/`"B7__P``4(N'7`L``/]0
+M((OP@>;__P``@\0$9HN'<@L``&:I$`!FB70D7'0[:@$SP&:+1Q:#P`PE__\`
+M`%"+AUP+``#_4`1J`#/`9HM'%H/`#27__P``4(N'7`L``/]0!(/$$.L?._]J
+M`3/`9HM'%H/`#"7__P``4(N'7`L``/]0"(/$"&:+=S2+QH'F__\``,'F""7_
+M_P``P?@(@>8`_P``)?\````+QHOP9HN'<@L``('F__\``&:I$`!T3HO&)?\`
+M``!0,\!FBT<6@\`*)?__``!0BX=<"P``_U`$@>;__P``,\#!_@B!YO\```!6
+M9HM'%H/`"R7__P``4(N'7`L``/]0!(/$$.LCD('F__\``#/`5F:+1Q:#P`HE
+M__\``%"+AUP+``#_4`B#Q`AJ"HN'7`L``/]0-+Z\____@\0$O1````!FA:]R
+M"P``=$4SP&:+1Q:#P`(E__\``%"+AUP+``#_4!R+V#/`9HM'%H/``R7__P``
+M4(N'7`L``/]0','@"&8+V('C__\``(/$".LE._\SP&:+1Q:#P`(E__\``%"+
+MAUP+``#_4""+V('C__\``(/$!(O#@>/__P``P>,()?__``#!^`B!XP#_```E
+M_P````O#9HE$-%2#Q@(/C&'___]FBX=R"P``OD0```!FJ1``=$TSP(I$)%Y0
+M,\!FBT<6@\`,)?__``!0BX=<"P``_U`$,\!FBT0D9L'X""7_````4#/`9HM'
+M%H/`#27__P``4(N'7`L``/]0!(/$$.LDD#/`9HM$)%Y0,\!FBT<6@\`,)?__
+M``!0BX=<"P``_U`(@\0(9HN'<@L``&:I$`!T5(M$)%PE_P```%`SP&:+1Q:#
+MP`HE__\``%"+AUP+``#_4`2+1"1D)?__``#!^`@E_P```%`SP&:+1Q:#P`LE
+M__\``%"+AUP+``#_4`2#Q!#K*(/'`(M$)%PE__\``%`SP&:+1Q:#P`HE__\`
+M`%"+AUP+``#_4`B#Q`B+1"04B(?<$```BD0D%8B'W1```(I$)!:(A]X0``"*
+M1"07B(??$```BT0D&(B'X!```(I$)!F(A^$0``"+1"0\9HF'XA```&:+1"0V
+M9JD`0'11BD0D1HB'Y!```(I$)$>(A^40``"+1"1(B(?F$```BD0D28B'YQ``
+M`(I$)$J(A^@0``"*1"1+B(?I$```9HM$)#9FB8>."P``75M>7X/$4,.0,\F(
+MC^00``"(C^40``"(C^80``"(C^<0``"(C^@0``"(C^D0``#KPX'_`````('_
+M`````(/L&%>+?"0@9HN'H`L``&:I(``/A(\```!FQT<0``G'1V@`````9B7?
+M_V:)AZ`+``"+AY0+``")1Q(SP&B0````9HM'%H/`!R7__P``4(N'7`L``/]0
+M!(/$"%^#Q!C#D&;'1Q``",=':`````!F);__9HF'H`L``(N'D`L``(E'$C/`
+M:)````!FBT<6@\`')?__``!0BX=<"P``_U`$@\0(7X/$&,,[_V:+AZ`+``!F
+MJ4``=:MFBX>@"P``9JF``'1F9B5__V:)AZ`+``!FBX=R"P``9JD`@'0&C4=8
+MZPJ0BX=D"P``@\!84.AA9P``9L='$``*B4<2,\"Z`````(/$!(E7:&B0````
+M9HM'%H/`!R7__P``4(N'7`L``/]0!(/$"%^#Q!C#9HN'H`L``&:I`(!T;V8E
+M_W]FB8>@"P``9HN'F@L``&:I`@!T"S/`9HN'F`L``.L.,\!FBX>8"P``#0``
+M`(!0Z.1F``!FQT<0``;'1V@`````B4<2,\"#Q`1HD````&:+1Q:#P`<E__\`
+M`%"+AUP+``#_4`2#Q`A?@\08PV:+AZ`+``!FJ0`!#X3L_O__9B7__C/)9HF'
+MH`L``&:+AW(+``!FJ0$`=01FN1``,\"*AWT+``")1"04J0$```!T!&:#R0*+
+M1"04J0(```!T!&:#R01FBX>:"P``9JD$`'4.9H/)0&:I"`!T!&:#R2!FQT<0
+M``W'1V@`````B\&!X?__``#!X0@E__\``,'X"('A`/\``"7_````"\$E__\`
+M`(E'$C/`:)````!FBT<6@\`')?__``!0BX=<"P``_U`$@\0(7X/$&,,[_X/L
+M"%>+?"009HM'"F8]@`!T8F:+1P)F/4,`=%@SP&:+1PQ0,\!FBT<*4#/`9HM'
+M"%!J!&H!:@97Z)-<``"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M'%H/``R7__P``4(N'7`L``/]0','@"&8+\('F__\``(/$".LDD#/`
+M9HM'%H/``B7__P``4(N'7`L``/]0((OP@>;__P``@\0$B\:(1"1&9HN'<@L`
+M`&:I$`!T1C/`9HM'%H/``B7__P``4(N'7`L``/]0'(OP,\!FBT<6@\`#)?__
+M``!0BX=<"P``_U`<P>`(9@OP@>;__P``@\0(ZR:#QP`SP&:+1Q:#P`(E__\`
+M`%"+AUP+``#_4""+\('F__\``(/$!(O&B$0D16:+AYH+``!FJ0$`='MFBX=R
+M"P``9JD0`'1%,\!FBT<6@\`")?__``!0BX=<"P``_U`<B_`SP&:+1Q:#P`,E
+M__\``%"+AUP+``#_4!S!X`AF"_"!YO__``"#Q`CK)3O_,\!FBT<6@\`")?__
+M``!0BX=<"P``_U`@B_"!YO__``"#Q`2+QHA$)$3&1"1#`3/`,]**1"1&BI>Z
+M"P``.\(/A%X#``"+[XV%F@L``(V]MPL``(E$)"R-A;H+``")1"0TB40D*(V%
+MF`L``(E$)#"+1"0TNA\```"*""+1BD0D0XORA,!U"(7V#X6.````C02UJ!``
+M`&:+\&:+A7(+``!FJ1``=%"+QB7_````4#/`9HM%%H/`"B7__P``4(N%7`L`
+M`/]0!('F__\``#/`P?X(@>;_````5F:+11:#P`LE__\``%"+A5P+``#_4`2#
+MQ!#K)8/'`('F__\``#/`5F:+11:#P`HE__\``%"+A5P+``#_4`B#Q`C&1"1#
+M`(M$)"C^`+H?````(A>-%%+!X@.-A!6\"P``B40D'&:+A7(+``!FJ1``=$8S
+MP&:+11:#P`(E__\``%"+A5P+``#_4!R+V#/`9HM%%H/``R7__P``4(N%7`L`
+M`/]0','@"&8+V('C__\``(/$".LF@\<`,\!FBT46@\`")?__``!0BX5<"P``
+M_U`@B]B!X___``"#Q`2+1"0<9HE8"F:+A7(+``!FJ1``=$0SP&:+11:#P`(E
+M__\``%"+A5P+``#_4!R+V#/`9HM%%H/``R7__P``4(N%7`L``/]0','@"&8+
+MV('C__\``(/$".LDD#/`9HM%%H/``B7__P``4(N%7`L``/]0((O8@>/__P``
+M@\0$9O?#`/YU"HM$)!S&0`X`ZR"*A7T+``"H!'0*N`(```#K"(/'`+@!````
+MBU0D'(A"#HM$)!R+5"0P9HM`"F:+$B7__P``@>+__P``.\)^#HM$)!S&0`X#
+M_X7$$```9O?#`!YU#6;WPP!`=`;_A<@0``!F]\,`$'0&_X7,$```N@,```"+
+M1"0<9B/3B%`/BT0D+&;W``(`=11F]\,`_G0NBT0D'&:+0`IFA<!U(8J5MPL`
+M`(M$)!S^PHB5MPL``,=`$`$```#ID0```(/'`#/2BT0D',=`$`````"+1"0P
+M9HL0BT0D'&:+2`J!X?__``"+PCO(?P*+P8O(BT0D'(E$)#B%R7Y&C9VW"P``
+MC7`0BT0D.+H?````9HM`""7__P``*\B*`_[`B`.*!R+0C112P>(#C805O`L`
+M`(E$)#B+1"0<BT`00(7)B09_PXM$)!QFBU`*9H/J!&:)4`HSP(M4)#2*1"1&
+MBA*!XO\````[P@^%SOS__XO]9HN'F@L``&:I`0`/A!D"``"*AYP+```\`G5S
+M,]*+1"1$)?\```"*E\,.```[PG14B^^-G<,.``"-O<,.``"-M;X.``"*"[@?
+M````(L&-%$"*A<,.``#!X@+^P(@'C8P5Q`X``&;'008``(H6BD$$`L(STH@&
+MBT0D1"7_````BA,[PG7`75M>7X/$.,,[_\9$)$,!,]*+1"1$)?\```"*E\,.
+M```[PG3<B^^-A<,.``"-G<,.``")1"0TC446C;V^#@``B40D+(H3N!\````B
+MPHOPC11VP>("C805Q`X``(E$)"2*1"1#A,!U"(7V#X6*````C8:($```9HOP
+M9HN%<@L``&:I$`!T38O&)?\```!0,\!FBT46@\`*)?__``!0BX5<"P``_U`$
+M@>;__P``,\#!_@B!YO\```!69HM%%H/`"R7__P``4(N%7`L``/]0!(/$$.LB
+M@>;__P``,\!69HM%%H/`"B7__P``4(N%7`L``/]0"(/$",9$)$,`BI7##@``
+MBT0D-/["B!"+1"0L9HL`)?__``"#P`(E__\``%"+A5P+``#_4!R#Q`0EB```
+M`#V(````=`Z+1"0D9L=`!@(`ZSP[_XM$)"QFBP`E__\``(/``B7__P``4(N%
+M7`L``/]0'(/$!(/@1(/X1'0'N`,```#K`C/`BU0D)&:)0@8STHM$)"2*#XI`
+M!`+!B`>+1"1$)?\```"*$SO"#X6E_O__75M>7X/$.,.*E\,.``"X'P```"+"
+M,]**E\`.``"-!$#!X`*-G`?$#@``,\"*1"1%.\(/A"K^__^+ZXV?O@X``(E\
+M)#"-M\`.``"!Q\`.```SP(I5!?["BL*(504STHI5!#O"=2AFQT4&``"+;"0P
+MN1\```#^A<,.```BC<,.``"-#$G!X0*-K`W$#@``,]*+1"0PBH"^#@``_L"(
+M`XM$)#"*@,`.``#^P(@',\"*1"1%BA8[PG6975M>7X/$.,.0C70F`%=6BW0D
+M#&:+?@J+QX'G__\``,'G""7__P``P?@(@><`_P``)?\````+QXOX@>?__P``
+M9O?'``5T7VH`:@!J`('G__\``%=J`&H#5NAP40``5N@J4```9L=&`D4`:@!6
+MBX9L"P``_U`$9L=&!`,`@\0H7E_#5N@&4```9L=&`D4`:@!6BX9L"P``_U`$
+M9L=&!`,`@\0,7E_#:@!J`&H`B\<E__\``%!J`&H#5N@040``@\0<9O?'``AU
+MNL:&CQ````!>7\.!_P````"!_P````"#[!0SP%>+?"0<5E/&1QH`QT0D%`$`
+M``!FBT<6@\`&)?__``!0BX=<"P``_U`<@\0$BMCVPX!U##/`6UY?@\04PX/'
+M`+A_````(L,E_P```%`SP&:+1Q:#P`8E__\``%"+AUP+``#_4`1FBX=R"P``
+M@\0(9JD"``^$F@$``&:I$`!T23/`9HM'%H/`""7__P``4(N'7`L``/]0'(OP
+M,\!FBT<6@\`))?__``!0BX=<"P``_U`<P>`(9@OP@>;__P``B70D&(/$".LF
+M._\SP&:+1Q:#P`@E__\``%"+AUP+``#_4"`E__\``(E$)!2#Q`2+1"009HE$
+M)!XE__\```T`"```9HE$)!IFBX=R"P``9JD0`'1/,\"*1"0:4#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0P%05?_6@\0(A<!U"U-5_]:#Q`B%P'0*
+MQT0D(`$```#K",=$)"``````BT0D((7`#X3<````Z=\#``"#QP"-;"0VN`$`
+M```#Q5!3_]:#Q`B%P'4+55/_UH/$"(7`=`>]`0```.L",^V%[0^$<@(``.FE
+M`P``D(M$)#!F_TPD,&:%P`^$6@(``(OKC5PD-K@!`````\-05?_6@\0(A<!U
+M"U-5_]:#Q`B%P'0'NP$```#K`C/;A=L/A5X#``"+1"0P9O],)#!FA<!UP.M&
+M._]FBT0D+F:%P'2>Z6'___^0:B8SP&:+1Q:#P`@E__\``%"+AUP+``#_4`1F
+MQT<"(@!FQT<$```SP(/$"%U;7E^#Q"S#D(O=Z<D!``"0C6PD-K@!`````\50
+M4__6@\0(A<!U"U53_]:#Q`B%P'0'O0$```#K`C/MA>T/A<X"``"+1"0P9O],
+M)#!FA<`/A(0!``")="00OA````!FA;=R"P``B^MFBUPD-G1+,\"*PU`SP&:+
+M1Q:#P`(E__\``%"+AUP+``#_4`2!X___```SP,'["('C_P```%-FBT<6@\`#
+M)?__``!0BX=<"P``_U`$@\00ZR.0@>/__P``,\!39HM'%H/``B7__P``4(N'
+M7`L``/]0"(/$"(M$)#"+W6;_3"0P9H7`#X5O____BW0D$.GA````D(M$)#!F
+M_TPD,&:%P`^$S@```(OKC5PD-K@!`````\-05?_6@\0(A<!U"U-5_]:#Q`B%
+MP'0'NP$```#K`C/;A=L/A=(!``!FBX=R"P``9JD0`&:+7"0V=$PSP(K#4#/`
+M9HM'%H/``B7__P``4(N'7`L``/]0!('C__\``#/`P?L(@>/_````4V:+1Q:#
+MP`,E__\``%"+AUP+``#_4`2#Q!#K)#O_@>/__P``,\!39HM'%H/``B7__P``
+M4(N'7`L``/]0"(/$"(M$)#!F_TPD,&:%P`^%//___^DS_O__@\<`C6PD,K@!
+M`````\504__6@\0(A<!U"U53_]:#Q`B%P'0'O0$```#K`C/MA>T/A08!``"-
+M;"0TN`$````#Q5!3_]:#Q`B%P'4+55/_UH/$"(7`=`F]`0```.L$._\S[87M
+M#X72````C6PD,+@!`````\504__6@\0(A<!U"U53_]:#Q`B%P'0)O0$```#K
+M!#O_,^V%[0^%G@```+@!````9B-$)#!FB40D+HM$)#`E__\``,'X`6:)1"0P
+M9H7`#X0Y_?__BT0D.&:%1"0R#X4:_?__9HM$)#)FB40D*F:+AW(+``!FJ1``
+M=%\SP(I$)"I0,\!FBT<6@\`,)?__``!0BX=<"P``_U`$,\!FBT0D,L'X""7_
+M````4#/`9HM'%H/`#27__P``4(N'7`L``/]0!(/$$.LV@\<`75M>N`$```!?
+M@\0LPX/'`#/`9HM$)"I0,\!FBT<6@\`,)?__``!0BX=<"P``_U`(@\0(BT0D
+M-&:)1"0J9HN'<@L``&:I$`!T3S/`BD0D*E`SP&:+1Q:#P`HE__\``%"+AUP+
+M``#_4`0SP&:+1"0RP?@()?\```!0,\!FBT<6@\`+)?__``!0BX=<"P``_U`$
+M@\00ZR:#QP`SP&:+1"0J4#/`9HM'%H/`"B7__P``4(N'7`L``/]0"(/$"&:+
+M1"0N9H7`#X0?_?__Z3+\__\[_X/L(%>+1"0LQT0D$`````!6BW0D+%-5QD0D
+M+P%FBP`S_V:%P`^$Q`,``(V&F@L``(E$)!2+1"0XC5@$9HM#"&:%P`^$C@,`
+M`+@?````BHZ_#@``(L&+5"0<9HE$)"R*1"0O0H3`B50D'`^$P0```(M$)!1F
+M]P`0`'0*BT,$N@@```#K!8M#!#/2B!"+1"0L)?__``"-!,4`$@``9HE$)"AF
+MBX9R"P``9JD0`'13BT0D*"7_````4#/`9HM&%H/`!"7__P``4(N&7`L``/]0
+M!(M$)#`E__\``,'X""7_````4#/`9HM&%H/`!27__P``4(N&7`L``/]0!(/$
+M$.LG._^+1"0H)?__``!0,\!FBT86@\`$)?__``!0BX9<"P``_U`(@\0(QD0D
+M+P#IV0```)!FBX9R"P``9JD0`'0[:@`SP&:+1A:#P`(E__\``%"+AEP+``#_
+M4`1J$#/`9HM&%H/``R7__P``4(N&7`L``/]0!(/$$.LB._]H`!```#/`9HM&
+M%H/``B7__P``4(N&7`L``/]0"(/$"(M$)"QFA<!U9V:+AG(+``!FJ1``=#IJ
+M`#/`9HM&%H/`!"7__P``4(N&7`L``/]0!&H2,\!FBT86@\`%)?__``!0BX9<
+M"P``_U`$@\00ZR&0:``2```SP&:+1A:#P`0E__\``%"+AEP+``#_4`B#Q`@S
+MR6:+CG(+``#WP2((``!T!XMK!.L$._^+*XO%P>@0]\$0````9HE$)"AT5(M$
+M)"@E_P```%`SP&:+1A:#P`(E__\``%"+AEP+``#_4`2+1"0P)?__``#!^`@E
+M_P```%`SP&:+1A:#P`,E__\``%"+AEP+``#_4`2#Q!#K*(/'`(M$)"@E__\`
+M`%`SP&:+1A:#P`(E__\``%"+AEP+``#_4`B#Q`AFBX9R"P``9JD0`&:);"0H
+M=%&+1"0H)?\```!0,\!FBT86@\`")?__``!0BX9<"P``_U`$@>7__P``,\#!
+M_0B!Y?\```!59HM&%H/``R7__P``4(N&7`L``/]0!(/$$.LG._^+1"0H)?__
+M``!0,\!FBT86@\`")?__``!0BX9<"P``_U`(@\0(9HM#"&:)1"0H9HN&<@L`
+M`&:I$`!T48M$)"@E_P```%`SP&:+1A:#P`(E__\``%"+AEP+``#_4`2+1"0P
+M)?__``#!^`@E_P```%`SP&:+1A:#P`,E__\``%"+AEP+``#_4`2#Q!#K)8M$
+M)"@E__\``%`SP&:+1A:#P`(E__\``%"+AEP+``#_4`B#Q`AF_XZ\#@``BH:_
+M#@``_L"(AK\.``"#PPR+1"0X1V:+`"7__P``._@/C$W\__]FBX::"P``9JD!
+M`'0)9K\`<.L'@\<`9K\`T&:+AG(+``!FJ1``=%>+QR7_````4#/`9HM&%H/`
+M`B7__P``4(N&7`L``/]0!('G__\``#/`P?\(@>?_````5V:+1A:#P`,E__\`
+M`%"+AEP+``#_4`2#Q!!=6UZ+1"007X/$(,.!Y___```SP%=FBT86@\`")?__
+M``!0BX9<"P``_U`(@\0(Z]"#[!2X'P```%>+?"0<5E.*E[D+``"+7"0H(L(#
+MP(T$0`4H$0``9HOP9HN'<@L``&:I$`!T3XO&)?\```!0,\!FBT<6@\`$)?__
+M``!0BX=<"P``_U`$@>;__P``,\#!_@B!YO\```!69HM'%H/`!27__P``4(N'
+M7`L``/]0!(/$$.LD._^!YO__```SP%9FBT<6@\`$)?__``!0BX=<"P``_U`(
+M@\0(_H>Y"P``,\!FBX=R"P``B40D%*D""```=`2+,^L#BW,$B\;!Z!!FB40D
+M'(M$)!2I$````'14BT0D'"7_````4#/`9HM'%H/``B7__P``4(N'7`L``/]0
+M!(M$)"0E__\``,'X""7_````4#/`9HM'%H/``R7__P``4(N'7`L``/]0!(/$
+M$.LH@\<`BT0D'"7__P``4#/`9HM'%H/``B7__P``4(N'7`L``/]0"(/$"&:+
+MAW(+``!FJ1``=$Z+QB7_````4#/`9HM'%H/``B7__P``4(N'7`L``/]0!(O&
+M)?__``#!^`@E_P```%`SP&:+1Q:#P`,E__\``%"+AUP+``#_4`2#Q!#K))"+
+MQB7__P``4#/`9HM'%H/``B7__P``4(N'7`L``/]0"(/$"&:+AW(+``!FJ1``
+M9HMS"'10B\8E_P```%`SP&:+1Q:#P`(E__\``%"+AUP+``#_4`2+QB7__P``
+MP?@()?\```!0,\!FBT<6@\`#)?__``!0BX=<"P``_U`$@\00ZR:#QP"+QB7_
+M_P``4#/`9HM'%H/``B7__P``4(N'7`L``/]0"(/$"&:+1P)F/5``#X6*````
+M:@$SP&:+1Q:#P`<E__\``%"+AUP+``#_4`1FB[>@"P``@\0(B\9F#0"`9H7V
+M9HF'H`L``'5.9HM'`F8]4`!R1,:'NPL```!FBT<09H7`="O'1VP`````:(@`
+M```SP&:+1Q:#P`<E__\``%"+AUP+``#_4`2#Q`CK"SO_5^@:X?__@\0$9L='
+M`F``6UY?@\04PSO_._^!_P````"#[!!7BWPD&%939HN'<@L``&:I$`!T.6H!
+M,\!FBT<6@\`,)?__``!0BX=<"P``_U`$:@`SP&:+1Q:#P`TE__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q:#P`(E__\``%"+AUP+``#_4`B#
+MQ`AFBX=R"P``9JD0`'0Y:@4SP&:+1Q:#P`(E__\``%"+AUP+``#_4`1J!3/`
+M9HM'%H/``R7__P``4(N'7`L``/]0!(/$$.L@:`4%```SP&:+1Q:#P`(E__\`
+M`%"+AUP+``#_4`B#Q`@STF:+EW(+``#WP@"```!T"XUW$(U?".L/@\8`BX=D
+M"P``C7`0C5@(B\;!Z!#WPA````!FB40D&'12BT0D&"7_````4#/`9HM'%H/`
+M`B7__P``4(N'7`L``/]0!(M$)"`E__\``,'X""7_````4#/`9HM'%H/``R7_
+M_P``4(N'7`L``/]0!(/$$.LFD(M$)!@E__\``%`SP&:+1Q:#P`(E__\``%"+
+MAUP+``#_4`B#Q`AFBX=R"P``9JD0`'1.B\8E_P```%`SP&:+1Q:#P`(E__\`
+M`%"+AUP+``#_4`2+QB7__P``P?@()?\```!0,\!FBT<6@\`#)?__``!0BX=<
+M"P``_U`$@\00ZR20B\8E__\``%`SP&:+1Q:#P`(E__\``%"+AUP+``#_4`B#
+MQ`B+P\'H$&:+\&:+AW(+``!FJ1``=%"+QB7_````4#/`9HM'%H/``B7__P``
+M4(N'7`L``/]0!(O&)?__``#!^`@E_P```%`SP&:+1Q:#P`,E__\``%"+AUP+
+M``#_4`2#Q!#K)H/'`(O&)?__``!0,\!FBT<6@\`")?__``!0BX=<"P``_U`(
+M@\0(9HN'<@L``&:I$`!FB_-T38O&)?\```!0,\!FBT<6@\`")?__``!0BX=<
+M"P``_U`$@>;__P``,\#!_@B!YO\```!69HM'%H/``R7__P``4(N'7`L``/]0
+M!(/$$.LB@>;__P``,\!69HM'%H/``B7__P``4(N'7`L``/]0"(/$"&:+AW(+
+M``!FJ1``=$5H@````#/`9HM'%H/`!B7__P``4(N'7`L``/]0!&B0````,\!F
+MBT<6@\`')?__``!0BX=<"P``_U`$@\006UY?@\00PY!H@)```#/`9HM'%H/`
+M!B7__P``4(N'7`L``/]0"(/$"%M>7X/$$,.0._^!_P````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.0,\!FBT0D%E`SP&:+1Q:#P`HE__\``%"+
+MAUP+``#_4`B#Q`CKS(/'`('_`````('_`````(/L#%>+?"045E-59HN'H`L`
+M`&:%P'0^9HM'$&:%P'0LQT=L`````&B(````,\!FBT<6@\`')?__``!0BX=<
+M"P``_U`$@\0(ZPR#QP!7Z,[6__^#Q`1FBX>T"P``9H7`#X3/````,^VX'P``
+M`"*'M@L``(OP9HN'M`L``&:%P'XIC9^T"P``C01VP>`#C80'O`L``%!7Z(;R
+M__]&@\0(@^8?10^_`SOH?-UJ`3/`9HM'%H/`!R7__P``4(N'7`L``/]0!&;'
+M1P)@`&:+MZ`+``"#Q`B+QF8-`(!FA?9FB8>@"P``=55FBT<"9CU0`')+QH>[
+M"P```&:+1Q!FA<!T*<=';`````!HB````#/`9HM'%H/`!R7__P``4(N'7`L`
+M`/]0!(/$".L25^CRU?__@\0$ZP>09L='`E``5^A`T?__9HNWC@L``(/$!(O&
+M@>;__P``P>8(:@`E__\``('F`/\``,'X""7_````"\:+\#/`@>;__P``BH><
+M"P``4&:+AW(+``!FJ0$`=`JX$````.L(@\<`N`0````E__\``%"+QB7__P``
+M4&H`:@!7Z*\T``"#Q!R*AWT+``"H`W1J5^CL^O__9HF'D!```(/$!&:+MZ`+
+M``"+QF8-``%FA?9FB8>@"P``=4%FBT<"9CU0`'(WQH>["P```&:+1Q!FA<!T
+M+\=';`````!HB````#/`9HM'%H/`!R7__P``4(N'7`L``/]0!(/$"%U;7E^#
+MQ`S#5^CJU/__@\0$75M>7X/$#,.#QP"!_P````"!_P````!0BU0D"(M$)`QF
+MBXJ@"P``9@O!9H7)9HF"H`L``'5!9HM"`F8]4`!R-\:"NPL```!FBT(09H7`
+M="O'0FP`````:(@````SP&:+0A:#P`<E__\``%"+@EP+``#_4`2#Q`B#Q`3#
+M4NAFU/__@\0$@\0$PX/'`('_`````('_`````(/L%+C_````5XM\)!Q39B-'
+M"HK8,\"*PSV`````#X2!````@_@"="1J`&H`:@`-``8``"7__P``4&H!:@)7
+MZ$TS``"#Q!Q;7X/$%,-J`&H`:@`SP&:+1PK!^`@-``<``"7__P``4&H`:@)7
+MZ"`S``!H_P```#/`9HM'%H/`!R7__P``4(N'7`L``/]0!&;'1P)%`&;'1P0%
+M`(/$)%M?@\04PSO_9HM'"F:I`(!T"L:'G`L```+K")#&AYP+```!9HN'<@L`
+M`&:I`@AT!#/`ZP6X`$```(E$)`AFBX>:"P``9JD!`'0*N`"```#K!8/'`#/`
+M9L='$``$QT=H``````M$)`B+R"7__P``P?@(@>'__P``P>$()?\```"!X0#_
+M```+P8E'$C/`:)````!FBT<6@\`')?__``!0BX=<"P``_U`$@\0(,\#'1VP`
+M````9L='!`$`9L='`D0`:(@```!FBT<6@\`')?__``!0BX=<"P``_U`$@\0(
+M6U^#Q!3#D(/L#%>+?"045E-FBX=R"P``9JD!`'0)9L='.```ZP>09L='.``0
+M9HN'F@L``&:I!`!U(F:+1SAF#0!`9HN7F@L``&;WP@@`9HE'.'0(9@T`(&:)
+M1SAFB[>8"P``N0`:``!FB4](BH>("P``9HE/2KD9````B$<ZBH>)"P``B$<[
+MBH>*"P``B$<\BH>+"P``B$<]BH>,"P``B$<^BH>-"P``B$<_BX>0"P``B4=`
+MBX>4"P``B4=$B\8E__\``('F__\``,'X"(A/4L'F""7_````@>8`_P``B$]3
+M"\8SR6:)1TR^`@```&:)3TYFB4]0H`````"(1QR@`0```(A''8J&`````(A$
+M-QR*A@$```"(1#<=BH8"````B$0W'HJ&`P```(/&!(/^$HA$-QM\T&:+AW(+
+M``!FJ0"`#X28````C7<<B]:+QL'J",'H&('B`/\```O"B];!X@C!YAB!X@``
+M_P`+P@O&C7<XB4=49L='$``#9L='!#P`9L='`D,`B]:+QL'H&+L`````P>H(
+MB5]H@>(`_P``"\*+UL'B",'F&('B``#_``O""\:)1Q(SP&B0````9HM'%H/`
+M!R7__P``4(N'7`L``/]0!(/$"%M>7X/$#,.#Q@"+AV0+``"^'`````/PB]:+
+MQL'J",'H&('B`/\```O"B];!X@C!YAB!X@``_P`+P@O&B4=4BX=D"P``C7`X
+MZ5/___\[_XUT)@"#[!@SP%>+?"0@5E-59HM'`H/X0P^$@00```^/6`0``(/X
+M)'1O#X\M`0``@_@B#X2(````#X^>````@_@A#X6=!P``,\!FBT<6@\`&)?__
+M``!0BX=<"P``_U`<BMBX<````(/$!"+#@_AP#X1D`@``5^@Z,```9L='!```
+M9L='`B0`N.@#``"#Q`1=6UY?@\08PSO_9HM'!&;_1P1F/0(`=@QFQT<$``!F
+MQT<")0!=6UZXZ`,``%^#Q!C#D&:+1P1F_T<$9CT"`';D9L='!```9L='`B,`
+MZ]:#^",/A?\&``!FBT<$9O]'!&8]'@`/AXL````SP&:+1Q:#P`8E__\``%"+
+MAUP+``#_4!R*V+@P````@\0$(L.#^#`/A+4```"X?P```"+#@_A`#X6D`0``
+M9L='`C``:@!J`&H`:@!J`&H!5^BH+@``@\0<N.@#``!=6UY?@\08PX/X00^$
+MYP````^/V0(``(/X)0^%<`8``&:+1P1F_T<$9CT>`'8N9L='`A``:@!J`&H`
+M:``"``!J`&H!5^A7+@``@\0<N.@#``!=6UY?@\08PX/'`#/`9HM'%H/`!B7_
+M_P``4(N'7`L``/]0'(K8N#````"#Q`0BPX/X,'4[9L='`A``:@!J`&H`N!\`
+M```BPPT``0``)?__``!0:@!J`5?H\RT``(/$'+CH`P``75M>7X/$&,.#QP"X
+M?P```"+#@_A`#X6T````9L='`C``BY=@"P``4HN'7`L``/]0/(/$!+CH`P``
+M75M>7X/$&,,[_S/`9HM'%H/`!B7__P``4(N'7`L``/]0'(/$!(K8]L,0=#)J
+M`&H`:@"X#P```"+##0`!```E__\``%!J`6H"5^AD+0``@\0<N.@#``!=6UY?
+M@\08P_;#8'1#9HM'!&;_1P1F/60`=B5J`&H`:@!H``(``&H!:@)7Z"PM``"#
+MQ!RXZ`,``%U;7E^#Q!C#75M>N&0```!?@\08PX/&`&:+1Q!FA<!U/HM'$CW!
+MXM2+=30SP&:+1P@]__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"+1"08527__P``4&H`:``%``!J`6H"5^BS*0``@\0<Z6GZ__^#QP"#
+M^&`/A8\!``!FBX>@"P``9H7`#X0_`0``BH>["P``BLC^P3P"B(^["P``#XXG
+M`0``9HN'<@L``&:I$`!T2C/`9HM'%H/`""7__P``4(N'7`L``/]0'(OP,\!F
+MBT<6@\`))?__``!0BX=<"P``_U`<P>`(9@OP@>;__P``B70D((/$".LG@\<`
+M,\!FBT<6@\`()?__``!0BX=<"P``_U`@)?__``")1"0<@\0$9HN'<@L``&:I
+M$`!T0S/`9HM'%H/`!B7__P``4(N'7`L``/]0'(OH,\!FBT<6@\`')?__``!0
+MBX=<"P``_U`<P>`(9@OH@>7__P``@\0(ZR,SP&:+1Q:#P`8E__\``%"+AUP+
+M``#_4""+Z('E__\``(/$!('E__\``(M$)!A5)?__``!0,\!FBX>@"P``4&H!
+M:@%J!U?H8B@``(/$'+CH`P``75M>7X/$&,,[_XI'&X3`#X0#^?__BD<:BM#^
+MPCP"B%<:#X[Q^/__:@!J`&H`:@-J`6H'5^@A*```@\0<N.@#``!=6UY?@\08
+MPY!=6UXSP%^#Q!C#._^-="8`@^P85XM\)"!6BW0D*%-5B\8E__\``%#_5QPS
+MTB7^````BA4`````"\(E^P```(K8,\"*PU"+QB7__P``4/]7!+@!````@\0,
+M(L.B`````(O&)?__``!0_U<<,](E_@```(H5``````O")?T```"*V#/`BL-0
+MB\8E__\``%#_5P2X`0```(/$#"+#H@````"+QB7__P``4/]7'#/2)?X```"*
+M%0`````+PB7^````BM@SP(K#4(O&)?__``!0_U<$N`$```"#Q`PBPZ(`````
+MB\8E__\``%#_5QPSTB7^````BA4`````"\(E[P```(K8,\"*PU"+QB7__P``
+M4/]7!+@!````@\0,(L.B`````(O&)?__``!0_U<<B\:#Q`0E__\``%#_5QR+
+MQH/$!"7__P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\``%#_5QPSTB7^
+M````BA4`````"\*#R!"*V#/`BL-0B\8E__\``%#_5P2X`0```(/$#"+#H@``
+M``"+QB7__P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\``%#_5QR+QH/$
+M!"7__P``4/]7'(O&@\0$)?__``!0_U<<,](E_@```(H5``````O"@\@"BM@S
+MP(K#4(O&)?__``!0_U<$N`$```"#Q`PBPZ(`````B\8E__\``%#_5QR+QH/$
+M!"7__P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\``%#_5QR+7"0X@\0$
+M@>/_````QT0D'`$```#!XPB!RX````!FA=L/A'<!``"+1"0<A<!T(8O&B^LE
+M__\``%#_5QPSTB7^````BA4`````"\*#R`'K(8O&B^LE__\``%#_5QPSTB7^
+M````BA4`````"\(E_@```(K8,\"*PU"+QB7__P``4/]7!+@!````@\0,(L.B
+M`````(O&)?__``!0_U<<,](E_@```(H5``````O")?T```"*V#/`BL-0B\8E
+M__\``%#_5P2X`0```(/$#"+#H@````"+QB7__P``4/]7'(O&@\0$)?__``!0
+M_U<<B\:#Q`0E__\``%#_5QR+QH/$!"7__P``4/]7'(O&@\0$)?__``!0_U<<
+M,](E_@```(H5``````O"@\@"BM@SP(K#4(O&)?__``!0_U<$N`$```"#Q`PB
+MPZ(`````B\8E__\``%#_5QR+QH/$!"7__P``4/]7'(O&@\0$)?__``!0_U<<
+MB\:#Q`0E__\``%#_5QR+Q8'E__\``"4`@```@\0$C5PM`(E$)!QFA=L/A8G^
+M__]=6UY?@\08PSO_._^!_P````"#[!17BWPD'%:+="0D4U6+QB7__P``4/]7
+M'(A$)"<E_P```(/(("7_````4(O&)?__``!0_U<$Q@4``````(M4)#RX/P``
+M`"+"#8`````E_P```%"+QB7__P``4%?HOOO__XM$)$R#Q!B%P(U0_XE4)#0/
+MA$P!```S[8EL)!B+QB7__P``4/]7'#/2)?X```"*%0`````+PB7]````BM@S
+MP(K#4(O&)?__``!0_U<$N`$```"#Q`PBPZ(`````B\8E__\``%#_5QR+QH/$
+M!"7__P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\``%#_5QR+QH/$!"7_
+M_P``4/]7'#/2)?X```"*%0`````+PH/(`HK8,\"*PU"+QB7__P``4/]7!+@!
+M````@\0,(L.B`````(O&)?__``!0_U<<B\:#Q`0E__\``%#_5QR+QH/$!"7_
+M_P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\``('E__\``%#_5QP#[8/@
+M`3/;@\0$BMB%VW0$9H/-`8M,)!A!B4PD&(/Y$`^,V_[__XM$)#AFB2B-2`*+
+M1"0TB4PD.(7`C5#_B50D-`^%M/[__XO&)?__``!0_U<<,](E_@```(H5````
+M``O")>\```"*V#/`BL-0B\8E__\``%#_5P2X`0```(/$#"+#H@````"+QB7_
+M_P``4/]7'#/2)?X```"*%0`````+PB7[````BM@SP(K#4(O&)?__``!0_U<$
+MN`$```"#Q`PBPX'F__\``*(`````,\"*1"0C4%;_5P2#Q`A=6UY?@\04PX/L
+M#%>+?"045HMT)!R+QB7__P``4/]7'(O&@\0$)?__``!0_U<<B\:#Q`0E__\`
+M`%#_5QR#Q`2!YO__``!6_U<<@\0$7E^#Q`S#._^-="8`@^P(5U93BUPD&&8S
+M_X/#`HO/@\,"@\,"9HMS^HO&@>;__P``P>8()?__``#!^`B!Y@#_```E_P``
+M``O&B_!FBT/Z@>;__P``9@/^9@O(9HMS_(O&@>;__P``P>8()?__``#!^`B!
+MY@#_```E_P````O&B_!FBT/\@>;__P``9@/^9@O(9HMS_HO&@>;__P``P>8(
+M)?__``#!^`B!Y@#_```E_P````O&B_!FBT/^@>;__P``9@/^9@O(@>?__P``
+M9HLSB\:!YO__``#!Y@@E__\``,'X"('F`/\``"7_````"\:+\('F__\``#O^
+M=`DSP%M>7X/$",,STHO!9HL36R7__P``7@O"7X/$",.#QP"#["17BWPD+%93
+M58ML)$"+1"0\)?__``!0_U<<B$0D-X/$!(M$)#PE__\``(/`#&:)1"0JB]@E
+M__\``%#_5QR+\('C__\``$.!X___``!3_U<<P>`(@\0(9@OPBT0D/('F__\`
+M`&:)="0P)?__``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^-1"0F@>7__P``4(M$)#1J`6H&@\41@>7__P``55#HC?C__S/`@\049HM$
+M)":I``$``'0<J0`"``!U#HM$)#1FBT`$9JD$`'4'N`$```#K`C/`A<!UEL9'
+M'P#&1R'_BD<>#`*(1QZ+1"0T9HM`!&:I!`!U$%U;7K@"````7X/$',.#QP!=
+M6UXSP%^#Q!S#._^#[`Q7BWPD((U$)`2+5"044(M$)"!J!"7_````4(M$)"0E
+M__\``%!2Z//W__^-1"084.B9^O__@\08A<!T-D>-3"0$04=!1T%'04%'BD'[
+MB$?[BD'\B$?\BD']B$?]BD'^B$?^BD'_B$?_B@&(!U^#Q`S#D+@&````N04`
+M``"%P'3LB\%)Q@<`1X7`=?5?@\0,PSO_@?\`````@?\`````@^P(5S/_5HMT
+M)!135<9&&P!J"%;HQR0``(/$"*D`"```#X2L````O1````"+QT<]Z`,``'XB
+M:@!J`&H`:@%J`6H&5NA8&P``N`$```"#Q!Q=6UY?@\0(PV:%KG(+``!T0S/`
+M9HM&%H/`""7__P``4(N&7`L``/]0'(O8,\!FBT86@\`))?__``!0BX9<"P``
+M_U`<P>`(9@O8@>/__P``@\0(ZR,SP&:+1A:#P`@E__\``%"+AEP+``#_4""+
+MV('C__\``(/$!/?#``@```^%6?___UU;7C/`7X/$",.#QP"#[`A7BWPD$%9F
+MBX=R"P``9JD0`'1&,\!FBT<6@\`&)?__``!0BX=<"P``_U`<B_`SP&:+1Q:#
+MP`<E__\``%"+AUP+``#_4!S!X`AF"_"+_H'G__\``(/$".LDD#/`9HM'%H/`
+M!B7__P``4(N'7`L``/]0((OX@>?__P``@\0$]\>`````7K@`````#Y7`7X/$
+M",.0@?\`````@?\`````@^P(5XM\)!!69HN'<@L``&:I$`!T1C/`9HM'%H/`
+M""7__P``4(N'7`L``/]0'(OP,\!FBT<6@\`))?__``!0BX=<"P``_U`<P>`(
+M9@OP@>;__P``@\0(ZR:#QP`SP&:+1Q:#P`@E__\``%"+AUP+``#_4""+\('F
+M__\``(/$!(O&@^#W9HOP9HN'<@L``&:I$`!T4(O&)?\```!0,\!FBT<6@\`(
+M)?__``!0BX=<"P``_U`$@>;__P``,\#!_@B!YO\```!69HM'%H/`"27__P``
+M4(N'7`L``/]0!(/$$.LE@\<`@>;__P``,\!69HM'%H/`""7__P``4(N'7`L`
+M`/]0"(/$"&:+AW(+``!FJ1``=$4SP&:+1Q:#P`8E__\``%"+AUP+``#_4!R+
+M\#/`9HM'%H/`!R7__P``4(N'7`L``/]0','@"&8+\(O^@>?__P``@\0(ZR,S
+MP&:+1Q:#P`8E__\``%"+AUP+``#_4""+^('G__\``(/$!/?'@````%ZX````
+M``^5P%^#Q`C#D(/L"%>+?"005F:+AW(+``!FJ1``=$8SP&:+1Q:#P`@E__\`
+M`%"+AUP+``#_4!R+\#/`9HM'%H/`"27__P``4(N'7`L``/]0','@"&8+\('F
+M__\``(/$".LF@\<`,\!FBT<6@\`()?__``!0BX=<"P``_U`@B_"!YO__``"#
+MQ`2+QH/("&:+\&:+AW(+``!FJ1``=%2+QB7_````4#/`9HM'%H/`""7__P``
+M4(N'7`L``/]0!('F__\``#/`P?X(@>;_````5F:+1Q:#P`DE__\``%"+AUP+
+M``#_4`2#Q!!>7X/$",.#QP"!YO__```SP%9FBT<6@\`()?__``!0BX=<"P``
+M_U`(@\0(7E^#Q`C#@^P,5XM\)!16BD<;A,`/A9@```!FBX=R"P``9JD0`'1'
+M,\!FBT<6@\`()?__``!0BX=<"P``_U`<B_`SP&:+1Q:#P`DE__\``%"+AUP+
+M``#_4!S!X`AF"_"!YO__``")="04@\0(ZR0SP&:+1Q:#P`@E__\``%"+AUP+
+M``#_4"`E__\``(E$)!"#Q`2+1"0,)0`+```]``,``'4<N`$```"(1QM>7X/$
+M#,,[_[@!````7E^#Q`S#D&:+AW(+``!FJ1``=$<SP&:+1Q:#P`8E__\``%"+
+MAUP+``#_4!R+\#/`9HM'%H/`!R7__P``4(N'7`L``/]0','@"&8+\(O^@>?_
+M_P``@\0(ZR4[_S/`9HM'%H/`!B7__P``4(N'7`L``/]0((OX@>?__P``@\0$
+M]\>`````#X5Q____7C/`7X/$#,.0@?\`````@?\`````@^P85XM\)"!64U5F
+MBX=R"P``9JD0`'1$,\!FBT<6@\`()?__``!0BX=<"P``_U`<B_`SP&:+1Q:#
+MP`DE__\``%"+AUP+``#_4!S!X`AF"_"!YO__``"#Q`CK))`SP&:+1Q:#P`@E
+M__\``%"+AUP+``#_4""+\('F__\``(/$!+@``P``9B/&/0`#```/A6P#``!F
+MBX=R"P``B]Z!X_?_``"!RP`(``!FJ1``=$LSP(K#4#/`9HM'%H/`""7__P``
+M4(N'7`L``/]0!('C__\``#/`P?L(@>/_````4V:+1Q:#P`DE__\``%"+AUP+
+M``#_4`2#Q!#K(Y"!X___```SP%-FBT<6@\`()?__``!0BX=<"P``_U`(@\0(
+M9HN'<@L``&:I$`!T13/`9HM'%H/`#B7__P``4(N'7`L``/]0'(OH,\!FBT<6
+M@\`/)?__``!0BX=<"P``_U`<P>`(9@OH@>7__P``@\0(ZR4[_S/`9HM'%H/`
+M#B7__P``4(N'7`L``/]0((OH@>7__P``@\0$9HEL)"9FA>T/A$\!``!FBX=R
+M"P``9JD0`'1&,\!FBT<6@\`&)?__``!0BX=<"P``_U`<B^@SP&:+1Q:#P`<E
+M__\``%"+AUP+``#_4!S!X`AF"^B!Y?__``"#Q`CK)H/'`#/`9HM'%H/`!B7_
+M_P``4(N'7`L``/]0((OH@>7__P``@\0$9HN'<@L``&:I$`!FB6PD)'1#,\!F
+MBT<6@\`$)?__``!0BX=<"P``_U`<B^@SP&:+1Q:#P`4E__\``%"+AUP+``#_
+M4!S!X`AF"^B!Y?__``"#Q`CK(S/`9HM'%H/`!"7__P``4(N'7`L``/]0((OH
+M@>7__P``@\0$@>7__P``BT0D)"7__P``P>`0"\5F]\8`!(E$)!AT(C/`BU0D
+M&&:+1"0F4#/`4F:+1Q90BX=<"P``_U`H@\0,ZR`SP(M,)!AFBT0D)E`SP%%F
+MBT<64(N'7`L``/]0$(/$#%?HGO?__X/$!(7`=`LSP%U;7E^#Q!C#D&:+AW(+
+M``!FJ1``=$,SP&:+1Q:#P`@E__\``%"+AUP+``#_4!R+\#/`9HM'%H/`"27_
+M_P``4(N'7`L``/]0','@"&8+\('F__\``(/$".LC,\!FBT<6@\`()?__``!0
+MBX=<"P``_U`@B_"!YO__``"#Q`2+QH/("&:+\&:+AW(+``!FJ1``=%"+QB7_
+M````4#/`9HM'%H/`""7__P``4(N'7`L``/]0!('F__\``#/`P?X(@>;_````
+M5F:+1Q:#P`DE__\``%"+AUP+``#_4`2#Q!#K)8/'`('F__\``#/`5F:+1Q:#
+MP`@E__\``%"+AUP+``#_4`B#Q`A7Z#S!__^#Q`2#R`%=6UY?@\08PSO_@?\`
+M````@?\`````@^P(5XM\)!!69HN'H`L``&:%P`^$[@(``#/`9HN'/@L``(/`
+M!`T```"`4#/`9HN'<`L``(/`%"7__P``4(N'7`L``/]0#&:+AZ`+``"#Q`AF
+MJ0(`=!YFQX>B"P```@!7Z(LT``"^`0```(/$!.DJ`@``._]FBX>@"P``9JD$
+M`'039L>'H@L```0`O@(```#I"`(``&:+AZ`+``!FJ0@`=!]FQX>B"P``"`!7
+MZ&`U``"^`P```(/$!.G?`0``@\8`9HN'H`L``&:I(`!T'V;'AZ(+```@`%?H
+MY#8``+X%````@\0$Z;,!``"#Q@!FBX>@"P``9JE``'0?9L>'H@L``$``5^@(
+M-P``O@8```"#Q`3IAP$``(/&`&:+AZ`+``!FJ8``=$=FQX>B"P``@`!J$C/`
+M9HN'<`L``(/`&"7__P``4(N'7`L``/]0#(/$"+X'````9HN'H`L``&8-`0!F
+MB8>@"P``Z3(!```[_V:+AZ`+``!FJ0`!=!]FQX>B"P````%7Z(@X``"^"```
+M`(/$!.D'`0``@\8`9HN'H`L``&:I$`!T,V;'AZ(+```0`&H(,\!FBX=P"P``
+M@\`8)?__``!0BX=<"P``_U`,@\0(O@0```#IQ````&:+AZ`+``!FJ0!`=#-F
+MQX>B"P```$!J"#/`9HN'<`L``(/`&"7__P``4(N'7`L``/]0#(/$"+X.````
+MZ80```!FBX>@"P``9JD!`'0O9L>'H@L```$`:@@SP&:+AW`+``"#P!@E__\`
+M`%"+AUP+``#_4`R#Q`@S]NM*._]J`VH`,\!FBX>@"P``4&H%:@!J!E?HH@\`
+M`(/$'#/`9L>'H@L```$`:@AFBX=P"P``@\`8)?__``!0BX=<"P``_U`,@\0(
+M,_8SP&:+ASX+``!0,\!FBX=P"P``@\`4)?__``!0BX=<"P``_U`,5C/`9HN'
+M<`L``(/`&"7__P``4(N'7`L``/]0##/`,\EFBX>B"P``B(^["P``]]!F(X>@
+M"P``@\009HF'H`L``(B/3`L``%Y?@\0(PX/'`(/L"#/`BTPD#&:+00*#^$%T
+M=H/X0G1]@_A##X2`````@_A$#X2#````@_A%#X2&````@_A&#X2)````@_A0
+M=`6#^&!U/F;'00(S`&:+D:`+``!F@\H09HN!H@L``&:)D:`+``!FA<!U&F:+
+M00)F/3``<A#&@;L+````4>AP_/__@\0$@\0(PY!FQT$",0"#Q`C#._]FQT$"
+M,@"#Q`C#._]FQT$",P"#Q`C#._]FQT$"-`"#Q`C#._]FQT$"-0"#Q`C#._]F
+MQT$"-@"#Q`C#._^#[!0SP%>+?"0<4V:+1P*#^$0/A(P````/C]("``"#^#8/
+MA.$!```/CY\"``"#^#1T<@^/6`(``(/X(0^%MP0``&:+1P1F_T<$9CT*``^&
+MI00``#/`9HN'<`L``(/`,B7__P``4(N'7`L``/]0((/(#R7__P``4%>+AVP+
+M``#_4#1FQT<"$`!J`&H`:@!H``(``&H`:@%7Z)0-``"#Q"CI5`0``#/`9HN'
+M<`L``(/`,B7__P``4(N'7`L``/]0((/$!(O09O?"`@`/A?$```"*A[L+``"*
+MR/[!/`.(C[L+```/CA$$``!FQT<"$`!7Z/T-``"+AV`+``!0BX=<"P``_U`\
+M@\0(,\!J!&H`9HM'`E!J!6H`:@97Z!,-```SP&:+ASX+``!0,\!FBX=P"P``
+M@\`4)?__``!0BX=<"P``_U`,,\!FBX=`"P``4#/`9HN'<`L``(/`%"7__P``
+M4(N'7`L``/]0#(/$+&H/5XN';`L``/]0-&H`,\!FBX=P"P``@\`()?__``!0
+MBX=<"P``_U`,@\005^A4#0``BY=@"P``4HN'7`L``/]0/,>'4`L```````"#
+MQ`CI.@,``#O_@>+__P``@\H!@>+__P``4E>+AVP+``#_4#1F_T<",\EFB4\$
+MB8]0"P``5XN';`L``/]0+&;'1P0``&;_1P*#Q`SI\@(``#O_9HM'!&;_1P1F
+M/0H`#X;>`@``,\!FBX=P"P``@\`R)?__``!0BX=<"P``_U`@@\@!)?__``!0
+M5XN';`L``/]0-,>'4`L```````!FQT<"$`!J`&H`:@!H``(``&H`:@%7Z,,+
+M``"#Q"A7Z'H,``"+CV`+``!1BX=<"P``_U`\@\0(Z6H"```[_X/X-0^%7P(`
+M`&:+1P1F_T<$9CT!``^&30(``%>+AVP+``#_4"QFQT<"-@!FQT<$``"#Q`3I
+M+P(``(/'`(/X0G0/#X\A`@``@_A!#X48`@``9HM'!&;_1P3I"P(``(/'`(/X
+M4`^$-P$``'\U@_A%#X7T`0``9HM'!&;_1P1F/04`#X;B`0``5XN';`L``/]0
+M+&;'1P)&`(/$!.G*`0``._^#^&`/A;\!``!FBX=R"P``BI=,"P``_L)FJ2``
+MB)=,"P``#X38````9HN'M`L``&:%P`^$R````(J'3@L``*@!#X2Z````:@$S
+MP&:+AW`+``"#P"XE__\``%"+AUP+``#_4`0SP&:+AW`+``"#P!HE__\``%"+
+MAUP+``#_4"!J`"4`#P``B]@SP&:+AW`+``"#P"XE__\``%"+AUP+``#_4`2#
+MQ!1F@?L``7949L='`D,`_X?8$```9HN'H`L``&8-$`!FB8>@"P``9HN'H@L`
+M`&:%P`^%[@```&:+1P)F/3``#X+@````QH>["P```%?H^_?__X/$!.G+````
+M@\8`9HN'H`L``&:%P'1$BH>["P``BM#^PCP>B)>["P``?C!J`#/`9HN'H@L`
+M`%`SP&:+AZ`+``!0:@%J`6H'5^B^"0``N.@#``"#Q!Q;7X/$%,,SP#/2BH?!
+M#@``BI?"#@``.\)T!OZ'30L``(N'1`L``*D!````C5`!B9=$"P``=$AH%`,`
+M`#/`9HN'<`L``(/`%"7__P``4(N'7`L``/]0#(N'1`L``,'H`5`SP&:+AW`+
+M``"#P!@E__\``%"+AUP+``#_4`R#Q!!;N.@#``!?@\04PY"!_P````"!_P``
+M``"#[`A7BWPD$&H/5XN';`L``/]0-(M$)!R#Q`B%P'0Y:@`SP&:+AW`+``"#
+MP`@E__\``%"+AUP+``#_4`R#Q`A7Z)L)``"+EV`+``!2BX=<"P``_U`\@\0(
+MQX=0"P```````%^#Q`C#D#O_@?\`````@^PT5XM\)#Q64U5FBT<"9CTA`'5R
+M:``#`(`SP&:+AW`+``"#P!0E__\``%"+AUP+``#_4`QJ!8U$)"!0,\!FBX=P
+M"P``@\`8)?__``!0BX=<"P``_U`PBT0D+&:)ASP+``!FBT0D+F:)ASX+``"+
+M1"0P9HF'0`L``(M$)#AFB8=""P``@\04,\!FBX=`"P``#0```(!0,\!FBX=P
+M"P``@\`4)?__``!0BX=<"P``_U`,,\!FBX=P"P``@\`8)?__``!0BX=<"P``
+M_U`DB_"X_P```&8CQH/$#$B#^`9W;_\DA<0````[_S/`9HN'<`L``(/`&"7_
+M_P``4(N'7`L``/]0)(/$!(O0@_H(#X2;````9L='`A``:@`E__\``,'J$%"!
+MXO__``!2:``!``!J`&H!5^AX!P``@\0<ZQ&#QP"#^$9U"5?H93@``(/$!#/`
+M9HN'0`L``%`SP&:+AW`+``"#P!0E__\``%"+AUP+``#_4`R!YO__```SP('.
+M`(```('F__\``%9FBX=P"P``@\`8)?__``!0BX=<"P``_U`(@\0075M>7X/$
+M-,,SP&:+1P*#^"%T*8/X-G6$9L='`C``5^BH!P``BY=@"P``4HN'7`L``/]0
+M/(/$".EN____9L='`C``:@!J`&H`:@!J`&H!5^BX!@``@\0<Z4[___\SP&:+
+MAW`+``"#P!@E__\``%"+AUP+``#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Z`+``!F#0!`9HF'H`L``&:+AZ(+``!FA<`/A?K[__]FBT<"9CTP
+M``^"[/O__\:'NPL```!7Z#'Q__^#Q`3IU_O__Y!J`(O&)?__``!0,\!FBT<"
+M4&H%:@!J!E?H&P,``(/$'.FQ^___@\<`,\!FBX=P"P``@\`8)?__``!0BX=<
+M"P``_U`D:@!J`,'H$&H`B]@E__\``%!J`&H#5^C:`@``9HM'`H/$(&8]4``/
+M@F?[__]F]\,+#W0.9L='`D,`Z57[__^#Q@#&AX\0````Z4;[___&ATP+````
+MZ3K[__^!_P````"!_P````"#[`@SP%>+?"005E-FBX<^"P``#0```(!0,\!F
+MBX=P"P``@\`4)?__``!0BX=<"P``_U`,,\!FBX=P"P``@\`8)?__``!0BX=<
+M"P``_U`DB_`SP&:+AW`+``"#P!@E__\``%"+AUP+``#_4"0STH/$$&:+EZ(+
+M``"+SH/A?[@!````T^"+V"7__P``.\)T'VH!,\!FB\)0B\,E__\``%!J!6H`
+M:@97Z.4!``"#Q!QFQX>B"P````!FBT<"9CTQ`'539L='`C``5^B#`@``BY=@
+M"P``4HN'7`L``/]0/(/$"%M>7X/$",.0B\:#X'^#^`=U"5?HZ"<``(/$!(/F
+M?X/^#G0)5^AW[___@\0$6UY?@\0(PY"+QL'H$*D`(```=<AJ`H'C__\``,'N
+M$('F__\``%93:@5J`&H&5^A1`0``@\0<6UY?@\0(PX/'`(UT)@"#[!0STC/)
+M5XM\)!Q64U6*E\$.``"*A[8+``"(C[D+``"(A[<+```SP(J'P@X``(B/N@L`
+M`#O"#X2)````B^^-A6`+``"-M<(.``")1"0<C87"#@``C;W!#@``B40D&(V=
+MO`X``(J5P@X``+D?````(LIJ`8T,2<'A`HV$#<0.``")1"08BPB+1"0@48L`
+M4(N%7`L``/]01(M$)"2#Q`R*E<(.``#^PH@0,]*+1"049@^V0`1F`P-FB0,S
+MP(H&BA<[PG6AB_UFBY>\#@``BH?"#@``9H/Z((B'PPX``'0D)?\```!0,\"*
+MA\$.``!0,\!FB\)0:@)J`6H&5^A`````@\0<9L>'O`X``"``,\F(C[X.``"(
+MC[\.``"(C\`.``"(C\$.``"(C\,.``"(C\(.``!=6UY?@\04PSO_C70F`(/L
+M$%>+1"0<5HMT)!QFB40D"(M$)"0S_XA$)`IFBX:8"P``9HE$)`R+1"0H9HE$
+M)!"+1"0L9HE$)!*+1"0P9HE$)!2+1"0T9HE$)!:+1"0DA,!T+L:&G`L```!F
+MBT8"9L=&`C``9CU``+@`````#Y?`:@"+^%:+AFP+``#_4`2#Q`B*AIP+``"(
+M1"0+C40D"%"+EF`+``!2BX9<"P``_U`X@\0(A?]T"5;H$@```(/$!%Y?@\00
+MPY`[_X'_`````(/L%#/`,])7BWPD'%9358J7N`L``(J'M@L``#O"#X2'````
+MB^^-A;8+``"-G;8+``")1"0<C86T"P``C;6X"P``C;U@"P``B40D&(J5M@L`
+M`+D?````(LIJ`8T,2<'A`XV$#;P+``"+2!11:@%J`(L'4(N%7`L``/]02(M$
+M)#"#Q!2*E;8+``#^PH@0BT0D&&:+E;0+``!F2F:)$#/2,\"*%HH#.\)UHXO]
+M9HN'M`L``&:%P'0K,\"*A[H+``!0,\"*A[<+``!0,\!FBX>T"P``4&H#:@%J
+M!E?H8O[__X/$'#/)9HF/M`L``(B/M@L``(B/MPL``(B/N`L``%?H_OS__X/$
+M!%U;7E^#Q!3#@\<`5U:+="0,N!\```"+3"00(H;!#@``C01`P>`"C;P&Q`X`
+M`(M$)!2)!XI$)!C&1P4`B$<(BH;!#@``_L"(AL$.``!15HN&;`L``/]0((A'
+M!(/$"%Y?PX/'`#O_@?\`````QP7\`P``````_X/L#%>_@````%93QT0D%```
+M``!5B_>!YH"`@(`S_HO6P>H/`_\S^O?&@````'0&@?<$P1VWBTPD&+X!````
+MT^:[``$``"O>@?L``0``#XVC````B\.+#)T`````*\:+US/10XD4A0````"!
+M^_T```!]78O#BPR=`````"O&B]<ST8D4A0````"+UXO#@\,$*\:-+(4`````
+MBP2=]/___S/0B94$````B]<S%)WX____B94(````B]>+#)W\____,]&!^_T`
+M``")E0P```!\HX'[``$``'T?B\.+#)T`````*\:+US/10XD4A0````"!^P`!
+M``!\X8M4)!A"B50D&(/Z"`^,#/___UU;7E^#Q`S#._^-="8`5U93BT0D&%6+
+M="08BUPD%(/^$(LX#XR2````]\,#````="2+QS/2P>@(BA.!Y_\```!.,]=#
+M,P25`````/?#`P```(OX==R+QL'X`H7`C6C_=%>#PP0S>_R+QX'G_P```,'H
+M"#,$O0````"+^,'H"('G_P```#,$O0````"+^,'H"('G_P```#,$O0````"+
+M^,'H"('G_P```#,$O0````"+^(O%387`=:F#Y@.+QDZ%P'0BB\<STL'H"(H3
+M@>?_````0S/7,P25`````(OXB\9.A<!UWHM$)!R).%U;7E_#@\<`@?\`````
+M@?\`````4(M$)!3'!"0`````5[\!````5HUP_U-5BVPD((7`=%.+5"0<BUPD
+M&(U$)!"-2@&#XA^)3"0<C1124,'B`X7VC9P3O`L``'0(,\!FBT,(ZP*+Q2O'
+M4(L+`_E7Z+'^__\SP(/$#&:+0P@S_ROHB\9.A<!UK5U;7HM$)`0]./LBA+@`
+M````#Y7`7X/$!,.-="8`5U93BT0D%(M,)!"+.(I`#Z@!#X2'````BD<(J(!T
+M#;L?````BE<.(MKK`Y`SVXM$)!2-4Q5FBT`*)?__```[PG5=OOK___\SP#/2
+MBH0QB`L``(I4-P@[PG5"1GSJ,\"-?!\.O@8```"*!R7O````/>0```!U*3/`
+MBD<!)>\````]Y````'48BD<"/`-U$8M'`ST`!)`'=!#K!3O_@\8&,\!;7E_#
+M@\<`6UZX`0```%_#@\<`@?\`````@?\`````5XM\)`Q6BW0D#&:+1PAF/34`
+M<S**AGT+```D_(B&?0L``&@``0``5HN&;`L``/]0'&H`:@!J`&H#:@!J!5;H
+M+?K__X/$)#/`BQ>*0@$EP````(/X0'595U;HXO[__X/$"(7`=#**AGT+```D
+M_(B&?0L``&@``0``5HN&;`L``/]0'&H`:@!J`&H!:@!J!5;HW/G__X/$)(J&
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=R"P``9JD0`'15
+M,\`STF:+1Q9FBU0D$`/")?__``!0BX=<"P``_U`<B_`SP&:+1Q8STF:+5"04
+MC400`27__P``4(N'7`L``/]0','@"&8+\(O&)?__``"#Q`A>7\,[_S/`,])F
+MBT<69HM4)!`#PB7__P``4(N'7`L``/]0("7__P``@\0$7E_#@\<`@?\`````
+M@?\`````5XM\)`AFBX=R"P``9JD0`'1:,\`STF:+5"0,BD0D$%`SP&:+1Q8#
+MPB7__P``4(N'7`L``/]0!#/`,])FBT0D&,'X"&:+5"04)?\```!0,\!FBT<6
+MC40"`27__P``4(N'7`L``/]0!(/$$%_#,\`STF:+1"004#/`9HM'%F:+5"00
+M`\(E__\``%"+AUP+``#_4`B#Q`A?PY`[_X'_`````%>+?"0(:/\````SP&:+
+M1Q:#P`<E__\``%"+AUP+``#_4`2+1"04@\0(A<!T7C/`9HM'!H/X`G18@_@#
+M=4YH_@```#/`9HN'<`L``(/`'27__P``4(N'7`L``/]0!&B`````,\!FBX=P
+M"P``@\`?)?__``!0BX=<"P``_U`$:C*+AUP+``#_4#2#Q!1?PX/'`&H',\!F
+MBX=P"P``@\`")?__``!0BX=<"P``_U`$:(`````SP&:+AW`+``"#P`,E__\`
+M`%"+AUP+``#_4`1J,HN'7`L``/]0-(/$%%_#@\<`BU0D!#/`9HM"%E"+DEP+
+M``!2Z,F-__^#Q`C#D(UT)@!7BWPD"%?HE9#__S/`@\0$BY>4$```BD=8`\*+
+MEZ`0``")AY00```SP(N/G!```(I'6@/!BX^L$```B8><$```,\"*1UL#PHN7
+MJ!```(F'H!```#/`BD=>`\*+E[`0``")AZ@0```SP(I'7P/!BX^\$```B8>L
+M$```,\"*1V`#PHN7N!```(F'L!```#/`BD=B`\*+E\`0``")A[@0```SP(I'
+M9`/!B8>\$```,\"*1V4#PHF'P!```(J'?@L``(3`="'&AWX+````C8>4$```
+M4(N78`L``%*+AUP+``#_4$"#Q`A?PSO_._^!_P````!FBTPD"(M4)`2+P8'A
+M__\``,'A""7__P``P?@(@>$`_P``)?\````+P6:)0A"+1"0,B4(2BT0D$(E"
+M:#/`:)````!FBT(6@\`')?__``!0BX)<"P``_U`$@\0(PXUT)@"+5"0$9HM"
+M$&:%P'0KQT)L`````&B(````,\!FBT(6@\`')?__``!0BX)<"P``_U`$@\0(
+MPX/'`%+HLI/__X/$!,,[_X'_`````('_`````%"+5"0(BT)LA<!T#<=";```
+M``!2_]"#Q`2#Q`3#@\<`BT0D#(M4)`A`4%+_5"0,@\0(A<!U%8M,)`R+1"0(
+M45#_5"0,@\0(A<!T";@!````PX/'`#/`PY`[_X'_`````%>+?"0(,\`SR6:+
+M1Q:)3VAFB8^@"P``@\`(B4]L)?__``!0BX=<"P``_U`<@\@()?\```!0,\!F
+MBT<6@\`()?__``!0BX=<"P``_U`$9HN'<@L``(/$#&:I`@!T/#/`9HM'%H/`
+M"27__P``4(N'7`L``/]0'(/(`27_````4#/`9HM'%H/`"27__P``4(N'7`L`
+M`/]0!(/$#%?HH;'__V;'1P)!`&;'1P0``(/$!%_#BU0D"(M,)`124>A!_/__
+MBT0D#&;'0`(A`(/$",.#QP!0BT0D"%=64XU8'%6+;"0<9C/_,_:+Q27__P``
+M4/\3P?@$@>?__P``P><$@\0$"_A&@_X$?-^^_/___XM,)""+QXO1)?__``"!
+MXO__```[PG0NB\>!Y___``#!_P0E__\``,'@#`O'1HOX?-.^!````#/`75M>
+M7X/$!,.0ZP4[_X/&!%U;7K@!````7X/$!,-3,\!FBT0D#%"+1"0,_U`<,](E
+M_@```(H5``````O",]**5"04"\**V#/`BL-0,\!FBT0D%%"+1"04_U`$N`$`
+M```BPX/$#*(`````6\,[_U,SP&:+1"0,4(M$)`S_4!PSTB7^````BA4`````
+M"\(STHI4)!3WTH'B_P```"/"BM@SP(K#4#/`9HM$)!10BT0D%/]0!+@!````
+M(L.#Q`RB`````%O#._\[_X'_`````#/`9HM$)`A0BT0D"/]0'(/@`8/$!,,[
+M_SO_@?\`````@^P85U9356@VE```BT0D-"7__P``BU0D,(/`'B7__P``4%+H
+M>/[__X/$#(7`=!U=6UZX`P```%^#Q!C#N`(```!=6UY?@\08PX/'`&A&D@``
+MBT0D-"7__P``BTPD,(/``B7__P``4%'H,_[__X/$#(7`=<B+1"0P)?__``"#
+MP`-FB40D("7__P``4(M$)##_4!S&1"0I!XK8B$0D*XM$)#"+="0D@\`$B40D
+M'(UX&#/`BL.#X+^)1"08@\0$,\`STHI4)"6*PS/")?\```!0B\8E__\``%"+
+M1"0@_Q!J8?\7B\8E__\``%#_%S/2@\00BE0D)3/"BU0D%(K8,\"*PX/@OSO0
+M=3'^3"0E=;`SP(I$)"=0BT0D)"7__P``4(M$)#3_4`2#Q`BX`0```%U;7E^#
+MQ!C#@\<`,\"*1"0G4(M$)"0E__\``%"+1"0T_U`$BT0D."7__P``@\`")?__
+M``!0BT0D./]0'(K8,\"(7"0SN3\````BV8A,)#&(7"0RBL-0BT0D0"7__P``
+M@\`")?__``!0BT0D0/]0!(M\)$2+1"1`@>?__P``@\<"C7`<@\`$B40D+(/$
+M%#/`,]**5"0EBL,SPB7_````4(O')?__``!0BT0D(/\0:F'_%HO')?__``!0
+M_Q8STH/$$(I4)"4SPC/2BM@SP(I$)":*TSO"#X6I````_DPD)76M,\"*1"0G
+M4(M$)#0E__\``(/``B7__P``4(M$)#3_4`2+1"0H)?__``!0BT0D./]0'(K0
+MBT0D.+_V____@\0,C7`<B5PD$(O:BVPD((O%)?__``!0_Q8STH/$!(K3.\)U
+M,D=\Z(M<)!"_"@```/;#!G4-75M>N`D```!?@\08P_;#!'1"75M>,\!?@\08
+MPY#K!3O_@\<*75M>N&,```!?@\08PS/`BD0D)U"+1"0T)?__``"#P`(E__\`
+M`%"+1"0T_U`$@\0(BT0D,"7__P``0&:)1"0B)?__``!0BT0D,/]0',9$)"D'
+MBMB+1"0P9HML)":(7"0KC7@<C7`$,\"*PX/@OXE$)!R#Q`0SP#/2BE0D)8K#
+M,\(E_P```%"+Q27__P``4/\6:F'_%XO%)?__``!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T(6
+M@\`4)?__``!0BX)<"P``_U`$@\0(PX/'`#O_@?\`````5XM\)`A6BH=\"P``
+MA,!U'6H`,\!FBT<6@\`4)?__``!0BX=<"P``_U`$@\0(,\`S]F:+1Q:#P`8E
+M__\``%"+AUP+``#_4""#Q`2I@````'035^A)DO__@\@!@\0$B_#K)8/&`(I'
+M&X3`=0U7Z-_X__^#Q`2%P'0.5^BB^O__O@$```"#Q`2*AWP+``"$P'4@:,``
+M```SP&:+1Q:#P!0E__\``%"+AUP+``#_4`2#Q`B+QEY?PX/'`#O_@?\`````
+M:,`````SP(M4)`AFBT(6@\`4)?__``!0BX)<"P``_U`$@\0(PX/'`#O_@?\`
+M````5XM\)`AJ`#/`9HN'<`L``(/`+B7__P``4(N'7`L``/]0!&@```"`,\!F
+MBX=P"P``@\`4)?__``!0BX=<"P``_U`,,\!FBX=P"P``@\`8)?__``!0BX=<
+M"P``_U`D,\!FBX=P"P``@\`4)?__``!0BX=<"P``_U`D@\08/00``("X````
+M``^4P%_#._^-="8`5XM\)!!6,_93BUPD$%6+;"08B\='4%7_TX/$"(7`=`RX
+M`0```%U;7E_#._]&@_X$?.!=6UXSP%_#@\<`C70F`(/L)%=64U6+1"0XBI!.
+M"P``@.+(B)!."P``9HN0<@L``&;WPH``=$"+@!0+```STHE$)##WV(/@!XE$
+M)"2+1"0XBTPD)(N`$`L``(E$)"R+1"0XBX`8"P``*\&Y+````/?QB40D(.LM
+MQT0D("````"+1"0XBX!D"P``@\`(B40D,/?8@^`'B40D)(M$)#B#P`B)1"0L
+MBU0D,#/VBWPD)`/7B50D,(M4)"`[U@^.X````(E\)!"+1"0XC7K_BU0D,(ET
+M)!2-L'(+``"+;"0DBTPD+`/I,]N-7!,0BTPD$(M$)"P#R&;W!H``=!EFQT$&
+M``!FQT$$`(!FQP$0`(E9".L3@\<`,])FB5$&9HD1B5$(9HE1!(M4)!"+1"04
+M@\(L.\>)5"00=15FQT$"``"+5"0PB6DH@\H#B5$,ZSV+5"040HT$4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(A^80``"*1"0]B(?G$```BD0D/HB'Z!```(I$)#^(A^D0
+M``!FBT0D*F:)AXX+``!?@\1(PSO_,\F(C^00``"(C^40``"(C^80``"(C^<0
+M``"(C^@0``"(C^D0``#KQ5>+?"0(:APSP&:+AW`+``"#P!@E__\``%"+AUP+
+M``#_4`PSP&:+1P90,\!FBX>:"P``4#/`BH>?"P``4(N';`L``/]0,%`SP&:+
+MAW`+``"#P!@E__\``%"+AUP+``#_4`R+EX(+```SP%)FBX=P"P``@\`8)?__
+M``!0BX=<"P``_U`,,](SP&:+EY@+``!FBX>&"P``@\($P>(0"\)0,\!FBX=P
+M"P``@\`8)?__``!0BX=<"P``_U`,:```#P`SP&:+AW`+``"#P!@E__\``%"+
+MAUP+``#_4`PSP&:+AW`+``"#P"@E__\``%"+AUP+``#_4"`E\/```%`SP&:+
+MAW`+``"#P!@E__\``%"+AUP+``#_4`R#Q$!?PSO_C70F`(/L"#/`5XM\)!!6
+M4VHJ9HN'<`L``(/`&"7__P``4(N'7`L``/]0##/V@\0(9HNWB`L``(J'GPL`
+M`,'F$#P$=`.#SA`SVXJ??0L``/?#`@```'0#@\X$]\,!````=`.#S@(SVV:+
+MGYH+``#WPT````!T!H'.``0``/?#(````'0&@<X`@```5C/`9HN'<`L``(/`
+M&"7__P``4(N'7`L``/]0#(N7B@L``#/`4F:+AW`+``"#P!@E__\``%"+AUP+
+M``#_4`R+CY`+```SP%%FBX=P"P``@\`8)?__``!0BX=<"P``_U`,BX>4"P``
+M4#/`9HN'<`L``(/`&"7__P``4(N'7`L``/]0##/V@\0@BY8`````,\!29HN'
+M<`L``(/`&"7__P``4(N'7`L``/]0#(/$"(/&!(/^$GS39L='`D(`6UY?@\0(
+MPY`[_X'_`````&H(,\"+5"0(9HN"<`L``(/`&"7__P``4(N"7`L``/]0#(/$
+M",.#QP`[_X'_`````&H(,\"+5"0(9HN"<`L``(/`&"7__P``4(N"7`L``/]0
+M#(/$",.#QP`[_X'_`````%>+?"0(:@HSP&:+AW`+``"#P!@E__\``%"+AUP+
+M``#_4`R+EY0+```SP%)FBX=P"P``@\`8)?__``!0BX=<"P``_U`,@\007\.#
+MQP"-="8`5XM\)`AJ"C/`9HN'<`L``(/`&"7__P``4(N'7`L``/]0#(N7D`L`
+M`#/`4F:+AW`+``"#P!@E__\``%"+AUP+``#_4`R#Q!!?PX/'`(UT)@!75HMT
+M)`PSP&:+AG`+``"#P!@E__\``%"+AEP+``#_4"2+^"7_````BY:4$```BXZ8
+M$````\*+EIP0``")AI00``"+Q\'H""7_`````\&)AI@0``"+Q\'H$,'O&"7_
+M`````\*+EJ`0``")AIP0```SP&:+AG`+``"!Y_\````#^H/`&(F^H!```"7_
+M_P``4(N&7`L``/]0)(OX)?\```"+CJ00``"+EJ@0```#P8N.L!```(F&I!``
+M`(O'P>@()?\````#PHN6K!```(F&J!```(O'P>@0P>\8)?\````#PH'G_P``
+M`(F&K!```#/`9HN&<`L```/Y@\`8B;ZP$```)?__``!0BX9<"P``_U`DB_@E
+M_P```,'O"(N6M!````/"BY:X$```@>?_````B8:T$````_J)OK@0``!6Z"_Z
+M__^#Q!"*AGX+``"$P'0AQH9^"P```(V&E!```%"+CF`+``!1BX9<"P``_U!`
+M@\0(7E_#._^!_P````"!_P````!J$C/`BU0D"&:+@G`+``"#P!@E__\``%"+
+M@EP+``#_4`R#Q`C#@\<`._^!_P````!7BWPD"&H*,\!FBX=P"P``@\`8)?__
+M``!0BX=<"P``_U`,@\0(BH>?"P``N@`!```\!'0$9H/*$#/)BH]]"P``]\$"
+M````=`1F@\H$]\$!````=`1F@\H"@>+__P``,\!29HN'<`L``(/`&"7__P``
+M4(N'7`L``/]0"(/$"%_#D&H(,\"+5"0(9HN"<`L``(/`&"7__P``4(N"7`L`
+M`/]0#(/$",.#QP`[_X'_`````&:+1"0(BU0D!&8+@J`+``!FB8*@"P``9HN"
+MH@L``&:%P'4:9HM"`F8],`!R$,:"NPL```!2Z`;%__^#Q`3#._]7BWPD"%?H
+MQ=?__XN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#HA^[__X@'BL.#Q`A'_LN$
+MP'76,\"*1"0?4#/`9HM&!%"+!O]0!(/$"%M>7X/$%,.!_P````"!_P````"#
+M[!!7BWPD&%9358ML)"AFBT<"9CTP`'0?75M>N`$```!?@\00PSO_N`0```!=
+M6UY?@\00PX/&`(N'&`L``(7`=0UFBX=R"P``9JE``'79QH=]"P```(M$)"R)
+MAY`+``"+1"0PB8>4"P``9HN'<@L``&:I`0!T#6;'AY@+``!01NL+._]FQX>8
+M"P``E!$SP(M4)#1FBX>8"P``@>+__P``.\)^"XM$)#1FB8>8"P``N`D```!F
+M(T0D.(/X"70/N`P```!F(T0D.(/X#'4/75M>N`,```!?@\00PSO_BT0D.(7M
+M9HF'F@L``'1%5>C_1@``@\0$A<!U.(I%`$5%B(>("P``145%BD7\B(>)"P``
+MBD7]B(>*"P``BD7^B(>+"P``BD7_B(>,"P``BD4`ZT.0BH>""P``B(>("P``
+MBH>#"P``B(>)"P``BH>$"P``B(>*"P``BH>%"P``B(>+"P``BH>&"P``B(>,
+M"P``BH>'"P``,_8STHB'C0L``(V?B`L``$.*2_\ZRG06B50D&.L>75M>N`(`
+M``!?@\00PX/'`$:#_@9\W,=$)!@!````BT0D&(7`==J*AX@+``"H@'70BX=H
+M"P``BT@\A<ET!U?_4#R#Q`2+AV@+``"*0`N(AW@+``!7BX=L"P``_U`49L>'
+MO`X``"``,\F#Q`0SP(B/M@L``&:)C[0+``"(C[<+``"(C[@+``"(C[H+``"(
+MC[D+``"(C[X.``"(C[\.``"(C\`.``"(C\$.``"(C\(.``"(C\,.``!=6UY?
+M@\00PSO_@^P<5U9358ML)#"+50"!^B"!``!T6EU;7C/`7X/$',-&@_X1<F@S
+M]HM$)#B+WJD$````#X3^````A=L/A/8```!FO@`*B\8E__\``%!5Z!U.``"#
+MQ`B%P'16BT0D*"7__P``]]!F(_CIJP```(/'`,=$)!P`````9L=$)"@PSHM$
+M)#2_#P```(E$)!0S]HL<M0````"%VW2-9HM#"&8]`P`/A7G___^+\^EZ____
+M._]H-I0``(O&)?__``"#P!XE__\``%!5Z%6]__^#Q`R%P'1&BTPD%(O&427_
+M_P``4%7_4Q2+1"0H@\0,0(E$)!R+1"0\BU0D'#O0#XU&`0``BT0D*(M,)!0E
+M__\``/?09B/X@\$TB4PD%(M$)"B#QB`E__\``,'X!&:)1"0H9H'^X`L/A@[_
+M___'1"08`````&;WQP$`#X3@````:$:2``"+1"0<9HL$10````!FB40D*B7_
+M_P``@\`")?__``!05>BLO/__@\0,A<!U-V:+1"0F9JD$`'0*N!P```#K"(/'
+M`+@0````,])FBU0D)@/0@>+__P``4E7H94?__X/$"(7`='@SP&:+1"0F4%7H
+MP+W__X/$"#/VB\B+'+4`````A=MT&#/`B]%FBT,(@>+__P``.\)T"$:#_A%R
+MW3/;A=MT.HM$)#B+$X70=#"+5"04,\!FBT0D)E)05?]3%(M,)"B#Q`Q!BT0D
+M/(E,)!P[R'TFBU0D%(/"-(E4)!2!Y___``"+3"08P?\!08E,)!B#^00/C/K^
+M__^+1"0<75M>7X/$',.#QP"!_P````"!_P````"#[`A75HM$)!2+$('Z(($`
+M`'057KC_____7X/$",,[_S/`7E^#Q`C#N.`/``"+3"049B-$)!PE__\``%!1
+MZ,Y+``"#Q`B%P'77BT0D'"7__P``4(M$)!A0Z,.\__^#Q`B+R&:#^6-TN#/V
+MBSRU`````(7_=!@SP(O19HM'"('B__\``#O"=`A&@_X1<MTS_X7_=(V+5"08
+MBT0D'%(E__\``%"+3"0<4?]7%(/$#%Y?@\0(PY"!_P````"!_P````"+3"0$
+M,\"+D5`+``!29HN!<`L``(/`""7__P``4(N!7`L``/]0#(/$",,[_XUT)@"+
+M5"0$,\!FBT($4(L"_U`<)?\```"#Q`3#@\<`C70F`#/`BU0D!(I$)`A0,\!F
+MBT($4(L"_U`$@\0(PY"-="8`5XM\)`AJ88L'_U`<:F&+!_]0'&IABP?_4!QJ
+M88L'_U`<@\007\,[_SO_@?\`````,\!FBT0D"%"+1"0(BP#_4#2#Q`3#@\<`
+M._^!_P````"#[!PSP%=64XMT)"Q5BUPD-&:+AG`+``"#P#(E__\``%"+AEP+
+M``#_4""+TR7__P``@>+__P``(\*#R`*+^"7__P``4#/`9HN&<`L``(/`,B7_
+M_P``4(N&7`L``/]0"('C__\``#/`@\L"9HE<)#9H4```@&:+AG`+``"#P!0E
+M__\``%"+AEP+``#_4`R[]/___X/$%#/`9HN&<`L``(/`&"7__P``4(N&7`L`
+M`/]0)(E$'""#Q`2#PP1\V<=$)"0`````,]*+QV:+5"0J)?__``"[#````#O"
+M#X0B`0``B^\S_V:+^L'G$('/QP<``&A0``"`,\!FBX9P"P``@\`4)?__``!0
+MBX9<"P``_U`,:+A`8(XSP&:+AG`+``"#P!@E__\``%"+AEP+``#_4`QHV+MR
+M`#/`9HN&<`L``(/`&"7__P``4(N&7`L``/]0#%<SP&:+AG`+``"#P!@E__\`
+M`%"+AEP+``#_4`R!Y?W_```SP%5FBX9P"P``@\`R)?__``!0BX9<"P``_U`(
+MNT3]__^#Q"@SP&:+AG`+``"#P!(E__\``%"+AEP+``#_4""#Q`1#?-\SP+N\
+M`@``9HN&<`L``(/`,B7__P``4(N&7`L``/]0((M4)"B#Q`2+Z"7__P``0HE4
+M)"0STF:+5"0J.\)T#8M$)"2#^&0/C.[^__]H4```@#/`9HN&<`L``(/`%"7_
+M_P``4(N&7`L``/]0#+OT____@\0(BTP<'#/`46:+AG`+``"#P!@E__\``%"+
+MAEP+``#_4`R#Q`B#PP1\V%V[#````%M>7X/$',,[_X/L"#/`5XM\)!!64U5J
+M`&:+AW`+``"#P"XE__\``%"+AUP+``#_4`0SP&:+AW`+``"#P#(E__\``%"+
+MAUP+``#_4""+\&:!YO[_B\8E__\``%`SP&:+AW`+``"#P#(E__\``%"+AUP+
+M``#_4`AF@>;]_S/`@>;__P``5F:+AW`+``"#P#(E__\``%"+AUP+``#_4`B*
+MATX+```D_HB'3@L``#/`9HN'<`L``(/`$B7__P``4(N'7`L``/]0((/$((OP
+M9H'.``*[#P```&:#SA!F(]Z#^P=^!;L'````A=MT#XU+_[L!````T^/K"(/'
+M`+L!````9H'F_^.*AW\+``"$P'0J,]*+PR7__P``BI=_"P``.\)\%V:!S@`8
+M9HN'@`L``&:I$`!T!6:!S@`$@>;__P``,\!69HN'<`L``(/`$B7__P``4(N'
+M7`L``/]0"(/$"(J'?`L``(3`=2-HG"```#/`9HN'<`L``(/`""7__P``4(N'
+M7`L``/]0#(/$",>'4`L``)P@``"!X___```SP$.*AW\+``"+TXOS@>+__P``
+M.\)^!&8/MMB!YO__``"X_0```"O&@>/__P``B^@E__\``(F'5`L``#/`P>,(
+M"]Z!X___``!39HN'<`L``(/`(B7__P``4(N'7`L``/]0"('E__\``#/`@<T`
+M?P``@>7__P``56:+AW`+``"#P"`E__\``%"+AUP+``#_4`AJ`#/`9HN'<`L`
+M`(/`'B7__P``4(N'7`L``/]0"(/$&+Y<````9HN'<@L``&:I@`!U`X/.`E8S
+MP&:+AW`+``"#P"0E__\``%"+AUP+``#_4`QJ`#/`9HN'<`L``(/`!B7__P``
+M4(N'7`L``/]0"(N''`L``(/FXXF')`L``(F'(`L``(J'3@L```P(B(=."P``
+M,\!69HN'<`L``(/`)"7__P``4(N'7`L``/]0#&;'AT@+`````(/$&%U;7E^#
+MQ`C#@\<`@?\`````@?\`````@^P,5U9358U$)!B+;"0H4%6+5"0LBW0D*%+H
+M<<3__X/$#(7`#X7&````:````("+1"0<)?__``"->`,SP&:+AG`+``#!_P*#
+MP!0E__\``%"+AEP+``#_4`R+3"0@,\!19HN&<`L``(/`&"7__P``4(N&7`L`
+M`/]0#(/$$+L!````._M^1HU$)!A0BT0D*%50Z/O#__^#Q`R%P'0'C4?_.]AU
+M38M4)!@SP%)FBX9P"P``@\`8)?__``!0BX9<"P``_U`,@\0(0SO??+I6BX9L
+M"P``_U`L9L=&`B$`9L=&!```,\"#Q`1=6UY?@\0,PSO_75M>N`$```!?@\0,
+MPX/'`%>_PB```%:^!````&:+5"00BDPD#&8C\H7V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&:+AG`+``"#P!(E__\``%"+AEP+``#_
+M4""+^"7__P``@\@@)?__``!0,\!FBX9P"P``@\`2)?__``!0BX9<"P``_U`(
+MBX9<"P``BU0D*(E$)!AFBX9P"P``4FH(:CAFB40D*(U$)"10Z(?K__^+V#/`
+M@>?__P``5V:+AG`+``"#P!(E__\``%"+AEP+``#_4`B#Q"2+PUM>7X/$",.#
+MQP"-="8`@^P05S/_5HMT)!Q358ML)"AFBT4P9JD`@'0DC5TP:F2+AEP+``#_
+M4#2+QT>#Q`2#^&0/CY`"``!F]P,`@'7?:F2+AEP+``#_4#1J`C/`9HN&<`L`
+M`(/`+B7__P``4(N&7`L``/]0!&H6,\!FBX9P"P``@\`6)?__``!0BX9<"P``
+M_U`$:@8SP&:+AG`+``"#P!8E__\``%"+AEP+``#_4`1J`#/`9HN&<`L``(/`
+M+B7__P``4(N&7`L``/]0!+D`@```,\!FB4U<9HF-B````&H!9HN&<`L``(/`
+M*"7__P``4(N&7`L``/]0"(/$+#/_9HN%B````&:I`(!T)XV=B````&IDBX9<
+M"P``_U`TB\='@\0$@_AD#X^;`0``9O<#`(!UWVIDBX9<"P``_U`T:@(SP&:+
+MAG`+``"#P"XE__\``%"+AEP+``#_4`1J%C/`9HN&<`L``(/`%B7__P``4(N&
+M7`L``/]0!&H&,\!FBX9P"P``@\`6)?__``!0BX9<"P``_U`$:@`SP&:+AG`+
+M``"#P"XE__\``%"+AEP+``#_4`1FQX6T`````(`SVX/$)(V]X````&;W!P"`
+M=0F#QRQ#@_L%?/"#^P5U`C/;C11;C13:P>("C805W@```&:+$&:!X@`!9HD0
+MC11;C13:P>("9L>$%>(``````(T46XT4VL'B`HV$%>````")1"0<9L<``(`S
+MP&H%9HN&<`L``(/`*"7__P``4(N&7`L``/]0"(M$)"2#Q`@S_V;W``"`=">)
+M7"00B]AJ9(N&7`L``/]0-(O'1X/$!(/X9']*9O<#`(!UXXM<)!`SP(T,6V:+
+MA;`````STHT,V8/`!,'A`F:+E`W<````.\)T$+@$````75M>7X/$$,.#QP!=
+M6UXSP%^#Q!##._]=6UZX`P```%^#Q!##@\<`75M>N`(```!?@\00PX/'`%U;
+M7K@!````7X/$$,.#QP`[_X'_`````(/L9#/`5XM\)&Q64U5FBX=P"P``4(N'
+M7`L``/]0(&:)1"1T,\!FBX=P"P``@\`D)?__``!0BX=<"P``_U`DB40D8#/`
+M9HN'<`L``(/`!"7__P``4(N'7`L``/]0)(E$)&`SP&:+AW`+``"#P`@E__\`
+M`%"+AUP+``#_4"!FB40D?C/`9HN'<`L``(/`*B7__P``4(N'7`L``/]0(&:)
+MA"2`````,\!FBX=P"P``@\`2)?__``!0BX=<"P``_U`@9HF$)((````SP&:+
+MAW`+``"#P`PE__\``%"+AUP+``#_4"2+GQ0+``"+EQ`+``#WVXE$)&PSP&:+
+MAW`+``"#XP>#P!"+CQ0+``"--!HE__\``%"+AUP+```#V8E<)'S_4"!H__\`
+M`#/`9HN'<`L``(/`$"7__P``4(N'7`L``/]0"&H`,\!FBX=P"P``4(N'7`L`
+M`/]0"&@=X`<`,\!FBX=P"P``@\`D)?__``!0BX=<"P``_U`,:@`SP&:+AW`+
+M``"#P`0E__\``%"+AUP+``#_4`QJ`#/`9HN'<`L``(/`""7__P``4(N'7`L`
+M`/]0"&H`,\!FBX=P"P``@\`J)?__``!0BX=<"P``_U`(,\!FBX=P"P``@\`R
+M)?__``!0BX=<"P``_U`@)?]_``!0,\!FBX=P"P``@\`R)?__``!0BX=<"P``
+M_U`(,\!FBX=P"P``@\`2)?__``!0BX=<"P``_U`@)?#L``"#R`$E__\``%`S
+MP&:+AW`+``"#P!(E__\``%"+AUP+``#_4`AJ`C/`9HN'<`L``(/`+B7__P``
+M4(N'7`L``/]0!#/`9HN'<`L``(/`%B7__P``4(N'7`L``/]0'(K8,\"*PX/(
+M$(B$).8````E_P```%`SP&:+AW`+``"#P!8E__\``%"+AUP+``#_4`1J`#/`
+M9HN'<`L``(/`+B7__P``4(N'7`L``/]0!#/`9HN'<`L``(/`#"7__P``4(N'
+M7`L``/]0)"7__P``#0```P!0,\!FBX=P"P``@\`,)?__``!0BX=<"P``_U`,
+M:@(SP&:+AW`+``"#P"XE__\``%"+AUP+``#_4`0SP(K#@^#OB(0D"P$``"7_
+M````4#/`9HN'<`L``(/`%B7__P``4(N'7`L``/]0!&H`,\!FBX=P"P``@\`N
+M)?__``!0BX=<"P``_U`$@<2H````,]N*@P````!#@_L*B(0>MP$``'+M,]N)
+M?"00BT0D7(VNZ````(E$)&0%W````(E$)&"+1"1<!;@!``")="04B40D3(M$
+M)%P%R`$``+DL````B40D2(V&Y````(E$)!R-AN(```")1"0@C8;@````B40D
+M)(V&W@```(E$)"B-AMP```")1"0LC48,B40D,(U&"(E$)#2-1@:)1"0XC48$
+MB40D/(U&`HOXBT0D/$-FQP80`(M4)$QFQP<```/Q9L<```"+1"0X`_EFQP``
+M!HM$)#2)$(M$)&0#P8E$)&2+1"0PBU0D9(/*`8D0BU0D2(M$)"QFQP`8`(M$
+M)"AFQP```(M$)"1FQP``@(M$)"!FQP```(M$)!R)$(M4)&`#T8M$)#P#P8E5
+M`(E$)#R+1"0XB50D8(M4)#0#P0/1B40D.(M$)#")5"0TBU0D*`/!`]&)1"0P
+MBT0D+(E4)"B+5"0<`\$#T8E$)"R+1"0D`\$#Z8E$)"2+1"0@`\&#^P6)1"0@
+MB50D'`^,'O___XM$)%R+="04BWPD$(/(`8F&O````+D`@```9HN&M@```&8-
+M``%FB8:V````BT0D7&:)3@0%W````&:)3C")AI@!``!FBX:.`0``9@T``6:)
+MAHX!``"+1"1<!=P```!0,\!FBX=P"P``@\`\)?__``!0BX=<"P``_U`,BTPD
+M9#/`46:+AW`+``"#P#@E__\``%"+AUP+``#_4`Q65^AR]___B_`SP&:+AW`+
+M``"#P"0E__\``%"+AUP+``#_4"0-````!5`SP&:+AW`+``"#P"0E__\``%"+
+MAUP+``#_4`QJ9(N'7`L``/]0-(N$))@````E__\``%`SP&:+AW`+``!0BX=<
+M"P``_U`(BX0DB````%`SP&:+AW`+``"#P"0E__\``%"+AUP+``#_4`R+E"2,
+M````,\!29HN'<`L``(/`!"7__P``4(N'7`L``/]0##/`9HN$)*X```!0,\!F
+MBX=P"P``@\`()?__``!0BX=<"P``_U`(BX0DM````"7__P``4#/`9HN'<`L`
+M`(/`*B7__P``4(N'7`L``/]0"#/`9HN$)+H```!0,\!FBX=P"P``@\`2)?__
+M``!0BX=<"P``_U`(:@(SP&:+AW`+``"#P"XE__\``%"+AUP+``#_4`0SP(J$
+M)-(```!0,\!FBX=P"P``@\`6)?__``!0BX=<"P``_U`$:@`SP&:+AW`+``"#
+MP"XE__\``%"+AUP+``#_4`2+C"3`````,\!19HN'<`L``(/`#"7__P``4(N'
+M7`L``/]0#&H",\!FBX=P"P``@\`N)?__``!0BX=<"P``_U`$,\"*A"3S````
+M4#/`9HN'<`L``(/`%B7__P``4(N'7`L``/]0!&H`,\!FBX=P"P``@\`N)?__
+M``!0BX=<"P``_U`$@<20````A?9T'%U;B\9>7X/$9,,[_[@&````75M>7X/$
+M9,.#QP`SP&:+AW`+``"#P"0E__\``%"+AUP+``#_4"2#Q`2#X!2#^!1UREU;
+M7C/`7X/$9,,[_X'_`````#/`BU0D!&:+1"0(4#/`9HN"<`L``(/`,B7__P``
+M4(N"7`L``/]0"(/$",.0C70F`(/L%#/`5XM\)!Q64U5J`&:+AW`+``"#P"XE
+M__\``%"+AUP+``#_4`0SP&:+AW`+``"#P#(E__\``%"+AUP+``#_4""+\&:!
+MYO[_B\8E__\``%`SP&:+AW`+``"#P#(E__\``%"+AUP+``#_4`AF@>;]_S/`
+M@>;__P``5F:+AW`+``"#P#(E__\``%"+AUP+``#_4`B*ATX+```D_HB'3@L`
+M`#/`9HN'<`L``(/`$B7__P``4(N'7`L``/]0((/$((OP9H/.$+L/````9B/>
+M@_L+?@6["P```(7;=`R-2_^[`0```-/CZP6[`0```&:!YO_CBH=_"P``A,!T
+M*C/2B\,E__\``(J7?PL``#O"?!=F@<X`&&:+AX`+``!FJ1``=`5F@<X`!('F
+M__\``#/`5F:+AW`+``"#P!(E__\``%"+AUP+``#_4`B#Q`B*AWP+``"$P'4C
+M:%P@```SP&:+AW`+``"#P`@E__\``%"+AUP+``#_4`R#Q`C'AU`+``!<(```
+M@>/__P``,\"*AW\+``"-<P&+WCO#=@0SVXK8O0`(```SP"ONB:]4"P``:@)F
+MBX=P"P``@\`N)?__``!0BX=<"P``_U`$,\!FBX=P"P``@\`6)?__``!0BX=<
+M"P``_U`<B$0D+R7_````@\@0)?\```!0,\!FBX=P"P``@\`6)?__``!0BX=<
+M"P``_U`$:`\0#P`SP&:+AW`+``"#P"0E__\``%"+AUP+``#_4`QH'Q```#/`
+M9HN'<`L``(/`*"7__P``4(N'7`L``/]0#&H`,\!FBX=P"P``@\`N)?__``!0
+MBX=<"P``_U`$P>L!,\!#P>,0@<L``@``4V:+AW`+``"#P`PE__\``%"+AUP+
+M``#_4`S![0(SP,'N`;KZ`P``P>40*]8+ZE5FBX=P"P``@\`@)?__``!0BX=<
+M"P``_U`,:@(SP&:+AW`+``"#P"XE__\``%"+AUP+``#_4`0SP(I$)&<E[P``
+M`%`SP&:+AW`+``"#P!8E__\``%"+AUP+``#_4`1J`#/`9HN'<`L``(/`+B7_
+M_P``4(N'7`L``/]0!&H`,\!FBX=P"P``4(N'7`L``/]0"(/$7+Y`````9HN'
+M<@L``&:I@`!U`X/.`E8SP&:+AW`+``"#P"0E__\``%"+AUP+``#_4`QJ`#/`
+M9HN'<`L``(/`!"7__P``4(N'7`L``/]0#(/$$(N''`L``(F')`L``(F'(`L`
+M`(J'3@L```P(B(=."P``BX<8"P``/>@!``!R"5?H`/3__X/$!('.````!S/`
+M5F:+AW`+``"#P"0E__\``%"+AUP+``#_4`QFQX=("P````"#Q`A=6UY?@\04
+MPX/'`(UT)@"#[`Q75E-5C40D&(ML)"A058M4)"R+="0H4NAQL/__@\0,A<`/
+MA28!``!H````@(M$)!PE__\``(UX`S/`9HN&<`L``,'_`H/`%"7__P``4(N&
+M7`L``/]0#(M,)"`SP%%FBX9P"P``@\`8)?__``!0BX9<"P``_U`,@\00NP$`
+M```[^WY*C40D&%"+1"0H55#H^Z___X/$#(7`=`N-1_\[V`^%J0```(M4)!@S
+MP%)FBX9P"P``@\`8)?__``!0BX9<"P``_U`,@\0(0SO??+9H\+\`@#/`9HN&
+M<`L``(/`%"7__P``4(N&7`L``/]0#&B0ZE``,\!FBX9P"P``@\`8)?__``!0
+MBX9<"P``_U`,:@`SP&:+AG`+``"#P!@E__\``%"+AEP+``#_4`Q6BX9L"P``
+M_U`L9L=&`B$`9L=&!```,\"#Q!Q=6UY?@\0,PY!=6UZX`0```%^#Q`S#@\<`
+M@^P(,])7BTPD&%:+="084XM<)!@S_V:#^11U!X#[9'4",MMF]\8(`'4%@/MD
+M=06Z`0```&;WQ@0`=`F%TG4%OP$```!F@_D3=0V$VW4)A?]T!;D4````OL(@
+M``"%_W0&@>9_____A-NX``````^4P(E$)!"%P'04@<X`$```9H/Y$W4C@<X@
+M"```ZQN`^Q!U"X'.``$``.L.@\<`@/MD=0:!S@`"``#!YA"!S@`Q``"%TG0&
+M@>;_[___A?]T!H'F_]___XM$)!"%P'4%@/MD=0QF@_D3=0:!S@!"``"`^V1U
+M!H'F_^[__UN+QEY?@\0(PX/'`('_`````('_`````%>+?"0(,\#'AU`+````
+M````:@!FBX=P"P``@\`N)?__``!0BX=<"P``_U`$,\!FBX=P"P``@\`")?__
+M``!0BX=<"P``_U`<@\@&)?\```!0,\!FBX=P"P``@\`")?__``!0BX=<"P``
+M_U`$@\047\.#[`@SP%=6BW0D%&:+AG`+``"#P!(E__\``%"+AEP+``#_4""+
+M^"7__P``@\@@)?__``!0,\!FBX9P"P``@\`2)?__``!0BX9<"P``_U`(BX9<
+M"P``B40D%#/`9HN&<`L``&H"@\`P9HE$)!PSP&:+AG`+``"#P"XE__\``%"+
+MAEP+``#_4`2+5"0LC40D'%)J"&HX4.AVW/__:@`SP&:+AG`+``"#P"XE__\`
+M`%"+AEP+``#_4`2!Y___```SP%=FBX9P"P``@\`2)?__``!0BX9<"P``_U`(
+M@\0T7E^#Q`C#._^!_P````"!_P````"#[`@SP%=64XMT)!AFBX9P"P``@\`2
+M)?__``!0BX9<"P``_U`@B_@E__\``(/(("7__P``4#/`9HN&<`L``(/`$B7_
+M_P``4(N&7`L``/]0"(N&7`L``(E$)!@SP&:+AG`+``!J`H/`,&:)1"0@,\!F
+MBX9P"P``@\`N)?__``!0BX9<"P``_U`$BU0D,(U$)"!2:@AJ.%#HU=?__XO8
+M,\!J`&:+AG`+``"#P"XE__\``%"+AEP+``#_4`2!Y___```SP%=FBX9P"P``
+M@\`2)?__``!0BX9<"P``_U`(@\0TB\-;7E^#Q`C#._^!_P````!05U:+?"08
+M4[D!````BW0D&(A/,(@/B$\!9HEW$+D$````9HE/$F:%SG0)N!P```#K!SO_
+MN!````!FQT<6$`"+UC/)9HE/'('B__\```/0B\9FB5<4)?__``"#P`*)3Q@E
+M__\``%"+1"08_U`<BMB+QB7__P``@\`#)?__``!0BT0D'/]0'(A$)!>#Q`BX
+M`P```"+#BH``````B$<@BD0D#ZB`=!,SP(K#)?P````-``$``(OPZP209C/V
+M@>;__P``P>8+B7<HBD0D#Z@(=`G&1RP0ZP>#Q@#&1RP$QD<>!#/`9HM'%(/`
+M""7__P``4(M$)!C_4!R#Q`2I`@```'0PQD<A!(I''@P8B$<>C4<BBU0D%%`S
+MP&:+1Q104NAO;/__@\0,N`$```!;7E^#Q`3#,\"*1"0/P?@$@^`#BH``````
+MB$<A/`1U"XI''@P0B$<>Z[F0BD<>#`.(1Q[KKCO_@^P,N0$```!7BWPD'%:+
+M="084U6(3P&(3S"+1"0DN00```!FB4<09H7(9HE/$L8'`G0)N!P```#K!SO_
+MN!````!FQT<6$`"+5"0D,\EFB4\<@>+__P```]"+1"0D9HE7%"7__P``@\`"
+MB4\8B]@E__\``%#_5AR(1"0;:@6+PR7__P``4/]6!(M$)#`E__\``(/``XOH
+M)?__``!0_U8<B$0D*XO#:@8E__\``%#_5@2+Q27__P``4/]6'(I4)#>#Q!SV
+MP@&(1"0:=02H@'0EQD<>`&H"B\,E__\``%#_5@2+Q27__P``4/]6'(A$)"5J
+M`^LCD,9''@1J`(O#)?__``!0_U8$B\4E__\``%#_5AR(1"0E:@&+PR7__P``
+M4/]6!(O%)?__``!0_U8<B$0D,(/$&+@'````(D0D&8J``````(A'((M$)!BH
+M`70'QD<L$.L%D,9'+`2+1"08J(!T&+AX````BU0D&"+"#0`#``!FB40D%.L(
+MD&;'1"04``"+1"04)?__``#!X`J)1RB*1"0:J$!T#L9'(02*1QX,"(A''NL5
+M,\"*1"09P?@#@^`'BH``````B$<ABD<A/`1U3(I''@P0B$<>:@:+PR7__P``
+M4/]6!(U'(H'E__\``%!J/%56Z&AN__\SP('C__\``(I$)"]04_]6!(/$(+@!
+M````75M>7X/$#,.#Q@"*1QX,`^NRD('_`````('_`````%>+?"0(,\!FBX=P
+M"P``@\`")?__``!0BX=<"P``_U`<)?<```!0,\!FBX=P"P``@\`")?__``!0
+MBX=<"P``_U`$@\0,7\,[_SO_@?\`````5XM\)`AJ!3/`9HN'<`L``(/``B7_
+M_P``4(N'7`L``/]0!#/`9HN'<`L``(/``R7__P``4(N'7`L``/]0'"7W````
+M4#/`9HN'<`L``(/``R7__P``4(N'7`L``/]0!(/$%%_#D('_`````('_````
+M`%`SP%>+?"0,:@)FBX=P"P``@\`")?__``!0BX=<"P``_U`$,\!FBX=P"P``
+M@\`#)?__``!0BX=<"P``_U`<BU0D'(/$#(K(N`<````BP8'B_P```(J`````
+M`"7_````.\)T5HM$)!`E_P```(J``````(A$)`<\!W8*N`,```!?@\0$PS/`
+M,]**P8I4)`<E^`````O")?\```!0,\!FBX=P"P``@\`#)?__``!0BX=<"P``
+M_U`$@\0(,\!?@\0$PU>+?"0(:@(SP&:+AW`+``"#P`(E__\``%"+AUP+``#_
+M4`0SP&:+AW`+``"#P`,E__\``%"+AUP+``#_4!R*R#/`@\0,BL'!^`,STH/@
+M!XI4)`R*@``````E_P```#O"=#Z*D@`````SP(K!@>+_````P>(#)<<````+
+MPB7_````4#/`9HN'<`L``(/``R7__P``4(N'7`L``/]0!(/$"%_#@\<`@?\`
+M````@?\`````5XM\)`AJ`#/`9HM'%H/`'B7__P``4(N'7`L``/]0!&H(5^A9
+MD?__@\00)0`+```]``,``'42N`$```"(1QM?P[@!````7\.0:@97Z#"1__^#
+MQ`BI@````'7F,\!?PSO_:@0SP(M4)`AFBT(6@\`>)?__``!0BX)<"P``_U`$
+M@\0(PSO_@?\`````@?\`````@^P0,\!7BWPD&%9356:+AW`+``"#P!XE__\`
+M`%"+AUP+``#_4!R*V+@!````(L,E_P```%`SP&:+AW`+``"#P!XE__\``%"+
+MAUP+``#_4`0SP&:+1Q:#P`@E__\``%"+AUP+``#_4""+\+@``P``9B/&@\00
+M/0`#```/A8`"``"+QB7__P``#0`(```E__\``%`SP&:+1Q:#P`@E__\``%"+
+MAUP+``#_4`@SP&:+1Q:#P`XE__\``%"+AUP+``#_4"!FB40D*H/$#&:%P`^$
+M#@(``#/`9HM'%H/`!B7__P``4(N'7`L``/]0(&:)1"0@,\!FBT<6@\`$)?__
+M``!0BX=<"P``_U`@BVPD)(/$"('E__\``"7__P``P>40"^AFBX=R"P``9JD0
+M`'1<9O?&``1T*3/`9HM$)!Y0,\!59HM'%H/`$"7__P``4(N'7`L``/]0*(/$
+M#.F%`0``,\!FBT0D'E`SP%5FBT<6@\`0)?__``!0BX=<"P``_U`0@\0,Z5P!
+M``"#QP`SP&:+1"0>P?@"9HE$)!BX`P```&8C1"0>9O?&``1FB40D%@^$FP``
+M`(M$)!AFA<!T,"7__P``4#/`56:+1Q:#P!`E__\``%"+AUP+``#_4#`SP&:+
+M1"0J)?S_```#Z(/$#&:+1"069JD"`'0B,\!FBT<6@\`0)?__``!0BX=<"P``
+M_U`@@\4"@\0$9HE%_F:+1"069JD!``^$NP```#/`9HM'%H/`$"7__P``4(N'
+M7`L``/]0'(A%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BX=<"P``_U`$:G0S
+MP&:+AW`+``"#P!TE__\``%"+AUP+``#_4`0SP(I$)"10,\!FBX=P"P``@\`?
+M)?__``!0BX=<"P``_U`$,\"*PU`SP&:+AW`+``"#P!XE__\``%"+AUP+``#_
+M4`2#Q"1;7\.#QP!0BT0D&%>+?"0@5HMT)!13N00```#&1P$#QD<P`8@'BT0D
+M(&:)1P2+1"0<9HE'#&:%SF:)=Q!FB4\2=`BX'````.L&D+@0````9L='%A``
+MB]8SR6:)3QR!XO__```#T(O&9HE7%"7__P``B4\84(M$)!C_4!R*V(O&)?__
+M``!`)?__``!0BT0D'/]0'(A$)!>#Q`BX<````")$)`^#^'!U"\9''C#&1R$$
+MZQJ0QD<>(HM$)"!F/80*=0>P(@P!B$<>QD<A_[@#````(L.*@`````"(1R"*
+M1"0/J(!T$S/`BL,E_`````T``0``B_#K!)!F,_:!YO__``#!Y@N)=RB*1"0/
+MJ`AT)<9'+!"-1R*+3"044#/`9HM'%%!1Z$!=__^#Q`Q;7E^#Q`3#.__&1RP$
+MZ]D[_X'_`````('_`````(/L#%>_`0```%9358ML)"#'1"08`````(UU!(M4
+M)"0[^G1EC4<')?\```!0:)8```#_%F@!`0``_U4<P>`(:``!``"+V/]5'(/$
+M$`O#/80*```/A*0````]A0H``'0'/88*``!U(F@"`0``_U4<P?@$@^`#B\BX
+M`0```-/@"T0D'(E$)!R#Q`1'@_\(?HUJ`(OU:)8```#_5@0SVX/$"(ML)"2+
+M?"0HB\NX`0```-/@BU0D&(70=5PSP&:+!%T`````4%;H9XS__X/$"(/X!75#
+M5VH$:(0*``!5,\!FBP1=`````%!6Z-7]__^X`0```(/$&%U;7E^#Q`S#D&H`
+M:)8```#_%H/$"#/`75M>7X/$#,,[_T.#^P1\C5U;7C/`7X/$#,.!_P````"!
+M_P````!7BWPD"(M$)`R#P`<E_P```%!HE@```/]7!(M4)!B+3"044FH%:(4*
+M``!1:`(!``#_5QS!^`19@^`#9HL$10`````E__\``%!7Z$+]__^#Q""X`0``
+M`%_#._^!_P````!7BWPD"(M$)`R#P`<E_P```%!HE@```/]7!(M4)!B+3"04
+M4FH&:(8*``!1:`(!``#_5QS!^`19@^`#9HL$10`````E__\``%!7Z.+\__]J
+M`&B6````_U<$@\0HN`$```!?PSO_@?\`````@?\`````@^P45[\!````5E-5
+MBVPD*,=$)!@`````C74$C5T<C4<')?\```!0:)8```#_%F@!`0``_Q/!X`B)
+M1"0<:``!``#_$XM4)""#Q!`+PF:)1"0B,\!FBT0D(CV$"@``#X2-````/84*
+M```/A)8````]A@H```^$MP```.D:`0``._^+3"0PBT0D'%%J!&B$"@``4(M$
+M)#PE__\``%!3Z!_\__^#Q!BX`0```%U;7E^#Q!3#@\<`:@!HE@```/\6BTPD
+M.#/`46H%9HM$)#)0BT0D0%<E__\``%!5Z./[__^X`0```(/$(%U;7E^#Q!3#
+M@\<`BU0D&(E\)!Q"B50D&.F6````._]H`@$``/]5'(M4)#"#Q`3!^`2!XO__
+M``"#X`-FBP1%`````"7__P``.\)TA&@"`0``_U4<BU0D,(/$!,'X!('B__\`
+M`(/@`V:+!$4`````)?__```[PG4\:@!HE@```/\6BT0D.%`SP&H&9HM$)#)0
+MBT0D0%<E__\``%!5Z#O[__^#Q""X`0```%U;7E^#Q!3#@\<`1X/_"`^.?/[_
+M_VH`B]UHE@```/]3!(M$)""#Q`B%P'0W@_@!#X2^_O__BU0D,(M$)"Q2:@1H
+MA`H``&H`)?__``!04^C@^O__@\08N`$```!=6UY?@\04PUU;7C/`7X/$%,,[
+M_XUT)@!7BWPD"&:+AW(+``!FJ0(`=%<SP(J'>PL``(/`!R7_````4&B6````
+MBX=<"P``_U`$:`(!``"+AUP+``#_4!R#R`XE_P```%!H`@$``(N'7`L``/]0
+M!&H`:)8```"+AUP+``#_4`2#Q!Q?PY"-="8`4%=6BW0D%%.+7"0@BWPD)('[
+M/8,)`74(Q@<'ZP:#Q@#&!PC&1P$"QD<P`6:)=Q"Y!````&:)3Q)FA<Z+1"0<
+MB5\$9HE'#'0(N!P```#K!I"X$````&;'1Q80`(O6,\EFB4\<@>+__P```]"+
+MQF:)5Q0E__\``(E/&%"+1"08_U`<B$0D$XO&)?__``!`)?__``!0BT0D'/]0
+M'(K8,\"#Q`B*P\'X!(O6@^`#@>+__P``9HL$10`````E__\``#O"=`HSP%M>
+M7X/$!,.0N`,```"*5"0/(L+VPT"*@`````"(1R!T"\9''C#&1R$$ZPF0QD<>
+M(L9'(?_VPX!T%S/`BD0D#R7\````#0`!``"+\.L&@\<`9C/V@>;__P``P>8+
+M]L,(B7<H=`C&1RP0ZP8[_\9'+`2-1R*+3"044#/`9HM'%%!1Z&=7__^#Q`RX
+M`0```%M>7X/$!,,[_X'_`````%=6BT0D$,'@#(OX)?__```%@`P``"7__P``
+M4(M$)!#_4"2#Q`2+\('^/8,)`70(@?X]@PD"=2.+QR7__P``!80,```E__\`
+M`%"+1"00_U`<@\0$J0$```!U"K@!````7E_#._^!Y___``"+1"0,@<>'#```
+M@>?__P``5_]0','X!(M4)!A25H/@`XM,)!Q19HL$10`````E__\``%"+1"0@
+M4.CY_?__@\087E_#@\<`5XM$)`A64U4S_XU8)(O'P>`,B_`E__\```6`#```
+M)?__``!0_Q.#Q`2+Z(']/8,)`70,@?T]@PD"#X6!````B\8E__\```6$#```
+M)?__``!0BT0D&/]0'(/$!*D!````=%Z!YO__``"+1"04@<:'#```@>;__P``
+M5O]0','X!(/$!(/@`S/29HM4)!AFBP1%`````"7__P``.\)U(XM4)!PSP%)5
+M5XM,)"!FBT0D)%!1Z#K]__^#Q!1=6UY?PSO_1X/_$`^,0____UU;7C/`7\.#
+MQP"!_P````"!_P````!7BWPD"&:+AW(+``!FJ0(`=#XSP&:+AW`+``!`)?__
+M``!0BX=<"P``_U`<@\A`)?\```!0,\!FBX=P"P``0"7__P``4(N'7`L``/]0
+M!(/$#%_#._^!_P````"!_P````!7BWPD"&H`,\!FBT<6@\`4)?__``!0BX=<
+M"P``_U`$,\!FBT<6@\`()?__``!0BX=<"P``_U`@@\0,)0`+```]``,``'42
+MN`$```"(1QM?P[@!````7\.0,\!FBT<6@\`&)?__``!0BX=<"P``_U`@@\0$
+MJ8````!UUC/`7\,[_U>+?"0(BD<;A,!U(C/`9HM'%H/`!B7__P``4(N'7`L`
+M`/]0((/$!*F`````=!ZX`0```%_#@\8`QD<;`5?HCHS__[@!````@\0$7\-7
+MZ*Z*__^#Q`2%P'7?,\!?PX/'`&H`,\"+5"0(9HM"%H/`%"7__P``4(N"7`L`
+M`/]0!#/`@\0(PX'_`````('_`````&C`````,\"+5"0(9HM"%H/`%"7__P``
+M4(N"7`L``/]0!(/$",.#QP`[_X'_`````%>+?"0(,\!FBX=P"P``@\`2)?__
+M``!0BX=<"P``_U`<@^`_4#/`9HN'<`L``(/`$B7__P``4(N'7`L``/]0!(/$
+M#%_#@?\`````@?\`````4(M$)`B*0!N$P'4JBT0D"&:+0!8E__\``(/`%27_
+M_P``4(M$)`R+@%P+``#_4!R#Q`2HP'0*N`$```"#Q`3#D#/`@\0$PSO_._^!
+M_P````!7BWPD"&H`,\!FBT<6@\`4)?__``!0BX=<"P``_U`$,\!FBT<6@\`5
+M)?__``!0BX=<"P``_U`<@\0,J,"X`````%\/E<##._\[_X'_`````%<S_U-F
+MBUPD#(L,O0````"%R708,\"+TV:+00B!XO__```[PG0.1X/_$7+=,\!;7\.#
+MQP!;B\%?PX/'`(UT)@!7,_]3BUPD#(L,O0````"%R70-BU$$.]-T#D>#_Q%R
+MZ#/`6U_#@\<`6XO!7\.#QP!7,_]64S/2BDPD&&:+?"04P><09HM4)!`+^C/V
+MBQRU`````(7;=#>+$_?"P)\``'0GBT,$B]<E`/___X'B`/___SO"=1,SP#/2
+MBD,*BM$[PG4&B\-;7E_#1H/^$7*^6UXSP%_#@?\`````@?\`````N.P0``##
+M._\[_X'_`````(/L"%>+1"005HMT)"2+$(M\)!B!^B"!``!T&5ZX!````%^#
+MQ`C#._^X`@```%Y?@\0(PY!H[!```%?HH7K__V;'1P(``&;'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?`L``(3`=!;^R(B"?`L``(3`=0I2_Y*H"P``@\0$
+MPY"-="8`,\"+5"0$9HL"/5*4``!U&&:+0@)F/2``=@Y2_Y*L"P``@\0$PX/'
+M`#/`PY"-="8`5S/_5HMT)`PSP&:+!CU2E```=21FBT8"9CT@`'8:5O^6L`L`
+M`(/$!(OX@_\!?@E6Z`MU__^#Q`2+QUY?PX/'`#/`BU0D!&:+`CU2E```=2!F
+MBT("9CT@`'864O^2L`L``(/$!(7`N``````/E<##D#/`PY"!_P````"!_P``
+M```SP(M4)`1FBP(]4I0``'439HM"`F8](`!V"5+HH'3__X/$!,.!_P````"!
+M_P````"#[!`SR8M4)!2*@0````!!@_E+B(0*0Q```'+MBH*""P``B(),$```
+MBH*""P``B()U$```BH+<$```B()?$```BH*#"P``B()-$```BH*#"P``B()V
+M$```BH+=$```B()@$```BH*$"P``B().$```BH*$"P``B()W$```BH+>$```
+MB()A$```BH*%"P``B()/$```BH*%"P``B()X$```BH+?$```B()B$```BH*&
+M"P``B()0$```BH*&"P``B()Y$```BH+@$```B()C$```BH*'"P``B()1$```
+MBH*'"P``B()Z$```BH+A$```B()D$```BH),$```#("(@DP0``!FQP0D`0"+
+M@F0+``!FQT0D#$L`!400``")1"0$C8)$$```B40D"&:+@KP.``!FA<!T$FH!
+M:@"-1"0(4%+HS6[__X/$$(/$$,,[_XUT)@!0,\!7BWPD#%9FBT<"A<`/A)L`
+M``"#^!`/A)H```"#^#`/A)$```"#^%!T"8/X8`^%SP```(J'?0L``*@##X2;
+M````5XN';`L``/]0*#/2@\0$B_`E__\``&:+EY`0```KPF:)1"0(9CV@#W97
+MBH=]"P``)/R(AWT+``!H``$``%>+AVP+``#_4!QJ`#/`9HN'D!```('F__\`
+M`%!6:@)J`&H%5^A';/__@\0DZS`[_S/`7E^#Q`3#7KCH`P``7X/$!,.0BT0D
+M"&8]N`MV$&:)MY`0``!7Z-7]__^#Q`2*EX\0``"*PO["J`>(EX\0``!U$FB`
+M````5XN';`L``/]0'(/$"%>+AVP+``#_4!"#Q`1>7X/$!,.0._^!_P````!3
+MBT0D"&:+4`1F_T@$9H72=0JX_____UO#@\<`BU0D"(M$)`R+"KL!`````]F)
+M&HH1B!!;,\##D#O_@?\`````@^P,5HMT)!1FBT8"9CT0`'4*BX9L"P``A<!U
+M&%ZX`@```(/$#,,[_[@!````7H/$#,,[_XM$)!AFBP`E__\``#U2E```=>&+
+M1"08BY9L"P``9HM``F:+$B7__P``@>+__P``.\)UP8M$)!B#P`2)1"0$BT0D
+M&&:+0`1FB40D"(J&>@L``#P$=5^+CF@+``"+EF@+``!FBTD,@>'__P``@<D`
+M@```9@N.<@L``&:)CG(+``"+4B")EJP+``"+EF@+``"+4AB)EK`+``"+EF@+
+M``"+4BB)EJ0+``"+EF@+``"+4C#K48/'`(N.:`L``(N6:`L``&:+20YF"XYR
+M"P``9HF.<@L``(M2)(F6K`L``(N6:`L``(M2'(F6L`L``(N6:`L``(M2+(F6
+MI`L``(N6:`L``(M2-(F6J`L``(U$)`10:`````!6BX9L"P``_U`8@\0,7H/$
+M#,,[_X'_`````%"+1"0(5XH0C7@!A-)U)D>*3_^$R74>1XI7_X32=19'BE?_
+MA-)U#D>*3_^$R74&B@>$P'0',\!?@\0$PU^X`0```(/$!,,[_SO_@?\`````
+M5XM\)`AFBT<"9CU!`'8_BU0D#%)7BX=L"P``_U`(BT0D%(/$"(7`="57Z'%J
+M__^+CV`+``!1BX=<"P``_U`\9L='!```9L='`B(`@\0(7\.+5"0$BT0D"(F"
+MD`L``&:+0@)F/4$`<@]J0%*+@FP+``#_4!R#Q`C#._^!_P````"+5"0$BT0D
+M"(F"E`L``&:+0@)F/4$`=@]J(%*+@FP+``#_4!R#Q`C#._^!_P````!7BWPD
+M"%.*1"00BI]]"P``B(=]"P``9HM'`F8]00!V10^^PS/2BE0D$#/"J0,```!T
+M$F@``0``5XN';`L``/]0'(/$"(I$)!"H`W09]L,#=117BX=L"P``_U`H9HF'
+MD!```(/$!%M?PSO_@?\`````5XM\)`A69HM'`F8]00!V+(M$)!2%P'4DQH=^
+M"P```6B`````5XN';`L``/]0'+@!````@\0(7E_#@\<`5XVWE!```(M$)!2Y
+M%@```(OX,\#SI5]>7\,[_SO_@?\`````BT0D!`^_@+P.``##C70F`(M,)`1F
+MBT$"9CU0`',.N`$```##N`(```##._\/OY&\#@``BT0D"$IFBP`E__\``#O"
+M?>!J`(M4)!!2BT0D$%!1Z-II__\SP(/$$,.-="8`BU0D!+@@````#[^2M`L`
+M`"O"PY"!_P````"!_P````!75HMT)`QFBX:T"P``9CT@`'P17K@"````7\.0
+MN`0```!>7\-FBX9R"P``9JD``701BT0D&(M4)!0#PCT````!=]IFBT8"9CU!
+M`',(7K@!````7\-FBX::"P``9JD"`'0;,\"+3"089HN&F`L``#O(?0I>N`,`
+M``!?PSO_BH:X"P``N1\````BR(M4)!"-#$G!X0.-O`Z\"P``B1>+5"04B5<$
+M9HM4)!AFB5<(BU0D'(E7%&:+1@)F/5``<@Y75HN&;`L``/]0)(/$"&;_AK0+
+M``"*EK@+``#^PC/`B):X"P``7E_#@\<`._^!_P````!J`8M4)`A2BX)L"P``
+M_U`$@\0(PX'_`````('_`````%!64XMT)!"*?"049HM&`F8]$`!T"UNX`0``
+M`%Z#Q`3#9HN&<@L``&:I`"!U3S/`BL>%P'0G@_@$="R#^!!T)X/X9'4*9HM&
+M!F8]$P!T&+@"````6UZ#Q`3#@\<`BH9Y"P``J(!T%C/`9HM&!DB#^!-W"O\D
+MA20'``"#QP!;N`,```!>@\0$PY!J`S/`9HN&<`L``(/``B7__P``4(N&7`L`
+M`/]0!#/`9HN&<`L``(/``R7__P``4(N&7`L``/]0'(A$)!>#Q`RH`70)N!``
+M``#K!SO_N`0````STHK7.\(/A)\!```SP(I$)`N#\`$E_P```%`SP&:+AG`+
+M``"#P`,E__\``%"+AEP+``#_4`2#Q`CI;0$``)!H]P```#/`9HN&<`L``(/`
+M'27__P``4(N&7`L``/]0!#/`9HN&<`L``(/`'R7__P``4(N&7`L``/]0'(/$
+M#(K8]L,!=`>X$````.L%N`0````STHK7.\(/A`\!```SP(K#@_`!)?\```!0
+M,\!FBX9P"P``@\`?)?__``!0BX9<"P``_U`$@\0(Z=\```"#QP`SP&:+AG`+
+M``!`)?__``!0BX9<"P``_U`<@\0$BMCVPPAT";@0````ZP<[_[@$````,]**
+MUSO"#X2?````,\"*PX/P""7_````4#/`9HN&<`L``$`E__\``%"+AEP+``#_
+M4`2#Q`CK=#/`9HN&<`L``(/`$"7__P``4(N&7`L``/]0'(/$!(K8]L.`=`>X
+M$````.L%N`0````STHK7.\)T.S/`BL,U@````"7_````4#/`9HN&<`L``(/`
+M$"7__P``4(N&7`L``/]0!(/$".L,B+Z="P``B+Z>"P``@/\0=0]FBY9R"P``
+M9H/*`>L.._]FBY9R"P``9H'B_O]FB99R"P``6S/`7H/$!,.0@?\`````@?\`
+M````BU0D!(I,)`AFBT("9CT0`'0.N`$```##N`(```##._]FBX)R"P``9JD(
+M('42@/D/=^:+@F@+``"+0$2%P'4)N`,```##@\<`,\"*P5!2BX)H"P``_U!$
+M,\"#Q`C#@\<`5HMT)`A3BEPD$&:+1@)F/1``=!!;N`$```!>P[@#````6U[#
+M9HN&<@L``&:I`"!UZS/`BL.#^`=^"SW_````#X7K`0``,\!FBT8&2(/X"W?+
+M_R2%=`<``#/`BL.#^`(/A,L!``"#^`0/A+X````]_P````^$MP$``&:+AG(+
+M``!FJ00`=9:+AF0+```]%.__`'>)BI9Y"P``@,H#B)9Y"P``@.+OB)9Y"P``
+MZ3<!```SP(K#@_@$=$,]_P````^$;`$``&:+AG(+``!FJ0P`#X5'____BX9D
+M"P``/13O_P`/AS;___^*EGD+``"`R@.(EGD+``#I[0```#O_BI9Y"P``@.+\
+MB)9Y"P``Z=<````SP(K#@_@$=!,]_P````^$8O___^D'`0``@\<`BI9Y"P``
+M@.+\B)9Y"P``@,H0B)9Y"P``Z9X```"#QP`SP(K#@_@$="<]_P````^%T```
+M`(J6>0L``(#*`HB6>0L``(#B[XB6>0L``.MM._^*EGD+``"`XOV(EGD+``"`
+MRA"(EGD+``#K43O_@/L$=$KIC@```#O_,\"*PX/X!'0K/?\```!U?&:+AG(+
+M``!FJ0`0#X57_O__BI9Y"P``@,H"B)9Y"P``ZQ$[_XJ6>0L``(#B_8B6>0L`
+M`(N&:`L``(M`2(7`=!(SP(K#4%:+AF@+``#_4$B#Q`B+1"04B)YZ"P``BI9Y
+M"P``B!"*AGD+``"H`7069HN6<@L``&:!R@`!ZQ1;N`(```!>PV:+EG(+``!F
+M@>+__F:)EG(+``!;,\!>PU"X_P,``%=64XM<)!2+="089B/&)?__```]0`(`
+M``^$\P```#V``@``#X3H````/<`"```/A-T````]``,```^$T@```#T@`P``
+M#X3'````/4`#```/A+P````]8`,```^$L0```(O&)?__``!0_U,<@\0$)>(`
+M``"#^"(/A94```"+QB7__P``@\`#)?__``!0_U,<@\0$)<````"#^$!U=8O&
+M)?__``"#P`0E__\``%#_4QR#Q`2I(````'58B\8E__\``(/`"27__P``4/]3
+M','@"(OXB\8E__\``(/`""7__P``4/]3'(/$"`O'9H7`="-FJ0$`=1V!YO__
+M``"#Q@R!YO__``!6_U,<@\0$J0@```!T"3/`6UY?@\0$PUM>7[@!````@\0$
+MPXUT)@"#[!!75E-5C40D'XML)"2)1"04:/@,``#_51PS_X/$!(K8C74<:F'_
+M%FCX#```_Q8STH/$"(K3.]!T";\!````ZQ`[_T>#_S)\VXM$)!0S_X@8A?\/
+MA<D```"*1"0?J`$/A;T```"-1"0?B40D%&CZ#```_U4<,_^#Q`2*V(UU'&IA
+M_Q9H^@P``/\6,]*#Q`B*TSO0=`J_`0```.L1@\<`1X/_,GS:BT0D%#/_B!B%
+M_W5Q:/@,``#_51R(1"0C@\0$)?\```"I\````'03@^`.@_@(N``````/E,#K
+M!8/'`#/`A<!U/6H.:/@,``#_501J8?]5'&CX#```_U4<@\00@_@.=1YJ`&CX
+M#```_U4$:F'_51QH^`P``/]5'(/$$(7`=`TSP%U;7E^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;7HM$)%1?@\18PY"!_P````"!_P````!75E-59HML)!B+
+M="04B\4E__\``%#_5APS_X/&'(K8@\0$:F'_%HO%)?__``!0_Q8STH/$"(K3
+M.]!T#;@!````75M>7\.#QP!'@_\R?-2+1"0<B!A=6UXSP%_#D(UT)@!7BWPD
+M"&CX#```_U<D@\0$J0```']U2&@```"`:/@,``#_5PQJ8?]7'&CX#```_U<D
+M@\00/0```(!U)&BG`P"`:/@,``#_5PQJ8?]7'&CX#```_U<D@\00/:0#`(!T
+M!3/`7\.0:@!H^`P``/]7#(/$"+@!````7\,[_X'_`````%>+?"0(:/@,``#_
+M5R2#Q`2I````?W5(:````(!H^`P``/]7#&IA_U<<:/@,``#_5R2#Q!`]````
+M@'4D:*0#`(!H^`P``/]7#&IA_U<<:/@,``#_5R2#Q!`]I`,`@'0%,\!?PY!J
+M`&CX#```_U<,@\0(N`$```!?PSO_@?\`````BU0D!%+H]O[__X/$!(7`=1>+
+M3"0$4>@%]___@\0$A<!T#K@"````P[@!````PSO_BT0D!%#H1O___X/$!(7`
+M=><SP,.!_P````"!_P````"+3"0$9HM!`F8]$`!T#K@!````P[@#````PSO_
+M9HM!!F8]#0!R[HM4)`@SP(F1$`L``(M4)`R)D10+``"+5"00B9$8"P``PY!5
+MB^Q65XMU"(M]#(M-$/.D7UY=PT`H(RET<FQL9"YC("12979I<VEO;CH@("`Q
+M+C$@("0`3VQI8V]M(%123$Q$(#$N,BXP(`HD"E`*5`HP"D`*8`IP"@D#"@M`
+M`H`"P`(``R`#0`-@`P(`````````````````````````````````````````
+M`````````````````````````````````````/P7``!I&```:1@``&D8``!@
+M&```:1@``$@8``!I&```/!@``&D8``!I&```:1@```@8``#X7@``$&```/AB
+M``"P8P``7E\``!AD``!>7P```P``````````````````````````````````
+M````````````````````````````````````````0/_______P`````$````
+M````````````````````````````````````````````````````````````
+M```````````$$`!D````"0,*"P4&!P0!``````````$````20!``#``,````
+M````````````````````````````````````````````````````````````
+M``````````````````D*"PP/`P4'!08'``$#!`0("``%"`8(!P@``0(#"`@$
+M`P0'!08``0("````1I(```(````20!``#``,````````````````````````
+M``````````````````````````````````````````````````````````0`
+M```VE````P````(`````````````````````````````````````````````
+M````````````````````````````````````````````"````(0*```$````
+M`D``````````````````````````````````````````````````````````
+M```````````````````````````````(````A0H```4````"0```````````
+M````````````````````````````````````````````````````````````
+M``````````````````@```"&"@``!@````)`````````````````````````
+M````````````````````````````````````````````````````````````
+M````$````#V#"0$'````$D`0``P`#```````````````````````````````
+M```````````````````````````````````````````````````0````/8,)
+M`@@````20!``#``,````````````````````````````````````````````
+M`````````````````````````````````````$````"-$`$`"@`!``@,````
+M````````````````````````````````````````````````````````````
+M````````````````````````0````(T0`0`+``(#"`PHA/[__O\`````````
+M````````````````````````````````````````````````````````````
+M``````````"`````C1`!``P``P`(#`@$_O\`````````````````````````
+M```````````````````````````````````````````````````````````!
+M``"-$`0`#0`"````"```````````````````````````````````````````
+M``````````````````````````````````````````````(``(T0!``.``,`
+M```(````````````````````````````````````````````````````````
+M````````````````````````````````!```C1`'``\``0$```@`````````
+M````````````````````````````````````````````````````````````
+M``````````````````"```"-$`4`$@`"````"```````````````````````
+M````````````````````````````````````````````````````````````
+M``````@``(T0"``3``$"```(````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````!!`P````"``@```````PG#T]`,`.(0!``I``P``
+M```````&P`$``0`&P`*````,P`L0`%IX:U$````20`P`,C`R,#(P.398-3<V
+M``!L``$`>``!``@!`0"8`0$`F`$!`)@!`0"8`0$`F`$!`&P``0```@$```(!
+M```"`0!H`@$`:`(!`&@"`0!L``$`;``!`&@"`0!H`@$`:`(!`"P#`0!H`P$`
+MP`,!`"`$`0!<!`$`7`0!`%P$`0!<!`$`+`,!`*@$`0"T!`$`M`0!``0````,
+M`````0```%-#3P`!``$``0````@``0(``````````````````````0``````
+M````````!`#Q_P````````````````,``0`````````````````#``(`````
+M`````````````P`#``````````````````,`!``````````````````#``4`
+M`````````````````P`&``````````````````,`!P`````````````````#
+M``@``````````````````P`)``````````````````,`"@`,````````````
+M```$`/'_%````'`/`0!$`````@`!`",````0#@$`7`````(``0`O````8`H!
+M`(@````"``$`-@```/`*`0!H`0```@`!`$````!@#`$`I`$```(``0!*````
+M\`X!`'@````"``$`60```'`.`0!X`````@`!`&4```"0!@$`0`$```(``0!Q
+M````\/H``#@````"``$`>0```(#X``!,`0```@`!`(8```"@\P``9`````(`
+M`0"0````</,``#`````"``$`F0```##S```\`````@`!`*0```"P[0``6`$`
+M``(``0"U`````.@``#0!```"``$`Q@```.#7``#H`````@`!`-T```#PU@``
+MY`````(``0#S````X,<```@(```"``$`_P````#%``#8`@```@`!``H!``!0
+MQ```K`````(``0`@`0``H,,``*0````"``$`-0$``+"Z```8`````@`!`#\!
+M``!@N@``'`````(``0!)`0``0+H``!P````"``$`4@$``&`%`0`L`0```@`!
+M`&`!``"0_```2`````(``0!G`0```+0``)0````"``$`<P$``%"P``#<````
+M`@`!`'\!```0L```0`````(``0"*`0``T*\``$`````"``$`E@$``)"O``!`
+M`````@`!`*`!```0KP``@`````(``0"M`0``0*T``-0````"``$`N0$``#"K
+M```(`@```@`!`,<!``!@J@``R`````(``0#3`0``@*D``-0````"``$`X`$`
+M`("G``#X`0```@`!`.T!```@K@``\`````(``0#Y`0``\*(``(0$```"``$`
+M!`(``("Z```H`````@`!``P"````H@``\`````(``0`6`@``V`8``$L````!
+M``(`)P(``)0&``!$`````0`"`#,"``"`U@``<`````(``0!(`@``,+$``,@"
+M```"``$`6@(``$0&``!0`````0`"`&8"``#T!0``4`````$``@!R`@``I`4`
+M`%`````!``(`?@(``%0%``!0`````0`"`(H"``"0PP``$`````(``0">`@``
+M$+H``"P````"``$`J0(``)#!``#\`0```@`!`+H"```$!0``4`````$``@#&
+M`@``X/(``$@````"``$`T@(``)#R``!(`````@`!`-X"``"T!```4`````$`
+M`@#H`@``$/(``"@````"``$`\P(``.#Q```D`````@`!`/\"``"`\0``8```
+M``(``0`+`P``9`0``%`````!``(`%0,``$#R``!$`````@`!`"8#````\0``
+M@`````(``0`R`P``%`0``%`````!``(`/`,``,0#``!0`````0`"`$<#```0
+M[P``L`````(``0!4`P``H/```%0````"``$`80,``,#O``#4`````@`!`&H#
+M``!T`P``4`````$``@!U`P``T.H``&0````"``$`A`,``"0#``!0`````0`"
+M`(X#``!PZ@``6`````(``0"=`P``U`(``%`````!``(`IP,``$#I```D`0``
+M`@`!`+8#``!`[0``;`````(``0#"`P``0.L``/P!```"``$`RP,``(0"``!0
+M`````0`"`-4#``!0YP``L`````(``0#@`P```.<``$P````"``$`\0,``%#B
+M``#D`````@`!```$``!0Y@``L`````(``0`1!```X-X``"0````"``$`'P0`
+M`(#>``!@`````@`!`"X$```0WP``.`,```(``0`_!```0.,```P#```"``$`
+M2`0``#0"``!0`````0`"`%($``#0W0``I`````(``0!=!```$-T``,`````"
+M``$`;@0``*#<``!D`````@`!`'T$``!0W```2`````(``0".!```,-H``!0"
+M```"``$`EP0``.0!``!0`````0`"`*$$``#<`0``"`````$``@"M!```S`$`
+M`!`````!``(`N00``,0!```(`````0`"`,$$``"\`0``"`````$``@#.!```
+MT-@``&`!```"``$`UP0``&P!``!0`````0`"`.$$``!H`0``!`````$``@#H
+M!```9`$```0````!``(`]`0``%P!```(`````0`"`/T$``#PSP``+`````(`
+M`0`0!0``@-4``/0````"``$`)P4``"#0``#\`P```@`!`#<%```@U```8`$`
+M``(``0!,!0``)`$``#@````!``(`7@4``!@!```*`````0`"`'$%``#0N@``
+M8`(```(``0"#!0``(,$``'`````"``$`F04``#"]``#D`@```@`!`*@%```@
+MP`````$```(``0"\!0``X````#@````!``(`S04``-"A```H`````@`!`-D%
+M``"`H0``2`````(``0#E!0``T)\``+`!```"``$`]@4``$"=``"0`@```@`!
+M``@&``"@FP``E`$```(``0`>!@``()@``'@#```"``$`-`8``'"7``!0````
+M`@`!`$@&``"0D```H`4```(``0!=!@``T(\``,`````"``$`;P8``+"/```@
+M`````@`!`(4&``!PCP``0`````(``0"9!@``0(\``"@````"``$`K`8``)".
+M```H`````@`!`,4&``!`C```*`````(``0#5!@``$(P``"@````"``$`X@8`
+M`/"$``"(`P```@`!`/0&``"PA```/`````(``0#\!@``((0``(P````"``$`
+M!@<``/"#```H`````@`!`!0'```P@P``N`````(``0`D!P```(,``"@````"
+M``$`+@<``%!^``"P!````@`!`#<'``"`?```R`$```(``0!%!P``\'H``(P!
+M```"``$`50<``'!V``!T!````@`!`%T'``!0=@``&`````(``0!E!P``\'4`
+M`%@````"``$`;0<``*!U``!0`````@`!`','```0=0``D`````(``0![!P``
+M`'0``#@````"``$`AP<``.!S```@`````@`!`)`'``"0<P``1`````(``0"=
+M!P``,',``%P````"``$`J`<``*!P``"8`````@`!`+$'``"0;P``0`````(`
+M`0"W!P``(&\``"P````"``$`P`<```!O```<`````@`!`,P'```0;0``Z`$`
+M``(``0#C!P``4&P``+P````"``$`]`<``)!K``"T`````@`!``0(````:P``
+MC`````(``0`-"```$&H``.0````"``$`&`@`````````!````0`#`"$(``#P
+M:```'`$```(``0`I"```D&@``%@````"``$`-P@``!"-``!T`0```@`!`$8(
+M```P9```3`$```(``0!4"```@(@``"`!```"``$`:@@``#"6```X`0```@`!
+M`'X(``#`EP``5`````(``0"-"```$%X``!0&```"``$`G0@``*!=``!H````
+M`@`!`*H(``"06```!`4```(``0"V"```P%<``-`````"``$`QP@``,".``"`
+M`````@`!`-4(``#`C```3`````(``0#E"```<(P``$P````"``$`^@@``,"*
+M``!(`0```@`!``8)``"@B0``'`$```(``0`2"0``L%0``!`#```"``$`)@D`
+M`)!0```4!````@`!`#8)``!`3P``1`$```(``0!$"0``,$X``!`!```"``$`
+M40D``*!,``"0`0```@`!`%\)````3```E`````(``0!M"0```'```)0````"
+M``$`=0D``"!+``#@`````@`!`'T)``"`2@``E`````(``0"'"0``L$@``-`!
+M```"``$`E`D``&!&``!,`@```@`!`)P)``!010``$`$```(``0"E"0```$4`
+M`$P````"``$`K0D``*!"``!@`@```@`!`+0)``#`/@``V`,```(``0#!"0``
+M@&<``!`!```"``$`SPD``+`T```<`@```@`!`-P)```P,P``@`$```(``0#I
+M"0``8#```$0"```"``$`]@D``(`F``"(!@```@`!``@*``#0%0````,```(`
+M`0`5"@``@&4``#P!```"``$`(@H````5``#$`````@`!`"T*``!0#```K`@`
+M``(``0`W"@``L`H``*`!```"``$`1`H``,!F``"X`````@`!`$\*``#P"0``
+MN`````(``0!@"@``0'(``.@````"``$`<`H``-!O```L`````@`!`'@*``"`
+M!P``<`(```(``0"""@``X`(``)0$```"``$`D0H``%!O```\`````@`!`)8*
+M````````V`(```(``0"?"@``C`````$````!``(`J`H``!`M``!$`P```@`!
+M`+@*``"`(P``^`(```(``0#("@``\!X``)`$```"``$`V0H``+`R``!T````
+M`@`!`.D*``#0&```(`8```(``0#Y"@``0'0``+`````"``$`!`L``-`V``#L
+M!P```@`!``P+```@<@``'`````(``0`6"P``\'0``"`````"``$`(PL``$!Q
+M``#@`````@`!`"P+``!4````.`````$``@!#"P``1@````X````!``(`40L`
+M`$(````$`````0`"`%H+```Z````"`````$``@!F"P``,@````@````!``(`
+M;PL``"`````2`````0`"`'<+````````(`````$``@!["P``\+8``%0"```2
+M``$`A0L``%#X```D````$@`!`)\+``!@_@``#````!(``0"Q"P``P/X``!0`
+M```2``$`P@L``&#W```\````$@`!`,X+``#@_```4````!(``0#9"P```/X`
+M`%@````2``$`[`L``-`'`0"H````$@`!`/D+``!@_0``*````!(``0`3#```
+MH+0``%`"```2``$`'0P``.#^``#H````$@`!`#(,``#0_P``%````!(``0!!
+M#```,/T``"@````2``$`5@P``,`)`0"4````$@`!`&D,``#0^0``&`$``!(`
+M`0!S#```P`\!`$@````2``$`@@P```@0`0``````$``!`(P,```0^```-```
+M`!(``0"E#```\/\``+0"```2``$`LPP``"`)`0"4````$@`!`,<,```@]```
+M\`(``!(``0#8#```@`@!`)P````2``$`YPP``!#T```(````$@`!`/@,```P
+M^P``6`$``!(``0`&#0``D/T``&@````2``$`'@T``'#^``!,````$@`!`#$-
+M``"P`@$`8````!(``0!##0``H/<``"P````2``$`60T``%"Y``"T````$@`!
+M`&X-```0]P``4````!(``0![#0``$`,!`%`"```2``$`APT``-#W``!`````
+M$@`!``!T<FQL9&5L9BYO`'1R;&QD+F,`4$-)0DE/4U!R97-E;G0`4$-)0VAE
+M8VM296<`06-C97!T`%!#23%3=V5E<`!00TDR4W=E97``3VQD4$-),5!R97-E
+M;G0`4$-),5!R97-E;G0`4$-),E!R97-E;G0`1V5T0V]D90!396YD5%101G)A
+M;64`4$-)3&]O:W5P`$QO;VMU<$E$`$QO;VMU<%1Y<&4`0V]N9C,Q,S-3;&]T
+M0F%S90!#;VYF,S$R.5-L;W1"87-E`$)U;&QS97EE5W)I=&524$Q%15!R;VT`
+M0G5L;'-E>65296%D4E!,1450<F]M`$1R86EN4EA&:69O`&1R86EN7W1X<G@`
+M2&%W:V5Y95=R:71E4E!,1450<F]M`$AA=VME>65296%D4E!,1450<F]M`$5%
+M35-$96QA>0!%15!O<G1/=70`1450;W)T26X`3D4R,#`P4')E<V5N=`!Z97)O
+M97,`07-I8T5%4F5A9$(`07-I8T5%5W)I=&4`1457<FET94)I=`!%14-L;V-K
+M1&]W;@!%14-L;V-K57``145#;&]C:U!U;'-E`$5%5W)I=&53=&]P`$5%5W)I
+M=&5286YD;VT`07-I8T5%4F5A9%<`1457<FET95-T87)T`$5%1'5M;7E7<FET
+M90!%15=R:71E0GET90!%15)E861">71E`$5%1&5L87D`145296%D0FET`%12
+M;&QD5%105&5M<&QA=&4`061A<'1E<DQI<W0`0G5L;'-E>65(5T-O;F9I9TEN
+M:70`0G5L;'-E>6500TE#;VYF:6<`3T,S-30P5&%B;&4`3T,S,C4P5&%B;&4`
+M3T,S,30Q5&%B;&4`3T,S,30P5&%B;&4`2&%W:V5Y94A70V]N9FEG26YI=`!%
+M;F%B;&500TDT`$AA=VME>6500TE#;VYF:6<`3T,S,3,Y5&%B;&4`1&ES86)L
+M95!#23,`4')E<V5N=%!#23,`4$-),U1A8FQE`$5N86)L95!#23(`1&ES86)L
+M95!#23(`4')E<V5N=%!#23(`4$-),E1A8FQE`%!#23%(5T-O;F9I9TEN:70`
+M1&ES86)L95!#23$`4$-),51A8FQE`$5)4T$R5&%B;&4`0V]N9C,Q,S-3;&]T
+M`$5)4T%/<&5N26YI=`!#;VYF,S$S,P!%25-!,51A8FQE`$U#03-3;&]T0V]N
+M9FEG`$U#03-486)L90!-0T$R4VQO=$-O;F9I9P!-0T$R5&%B;&4`34-!,5-L
+M;W1#;VYF:6<`34-!3W!E;DEN:70`0V]N9C,Q,CD`34-!,51A8FQE`$E303-3
+M971$34$`25-!,U-E=$EN=&5R<G5P=`!)4T$S2%=/<&5N26YI=`!)4T$S2%=#
+M;VYF:6=);FET`$5N86)L93,Q,3A024\`1&ES86)L93,Q,3A024\`25-!,U!)
+M3TEN=&5R<G5P=`!#;VYF,S$Q.`!)4T$S5&%B;&4`25-!,E-E=$1-00!)4T$R
+M4V5T26YT97)R=7!T`$E303)(5T]P96Y);FET`$E303)(5T-O;F9I9TEN:70`
+M0V]N9C,Q,3<`25-!,E1A8FQE`$E303)$34%":71S`$E303));G1":71S`$E3
+M03)$34$`25-!,DEN=$QE=F5L`$-O;F8S,3$U`$E303%486)L90!)4T%$34$`
+M25-!26YT3&5V96P`145?4U!%140`0G5L;'-E>65"87-I8U)E<V5T`$)U;&QS
+M97EE0V]N;F5C=$]P=&EO;G,`0G5L;'-E>65297-T87)T`$)U;&QS97EE0V]D
+M941O=VYL;V%D`$)U;&QS97EE26YT97)F86-E`%181')A:6Y&<F%M94AE861E
+M<@!(87=K97EE0F%S:6-297-E=`!(87=K97EE0V]N;F5C=$]P=&EO;G,`2&%W
+M:V5Y95)E<W1A<G0`2&%W:V5Y94-O9&5$;W=N;&]A9`!(87=K97EE26YT97)F
+M86-E`$1I<V%B;&500TDT`%!R97-E;G100TDT`$AA=VME>65);G1E<G)U<'0`
+M5')A;G-M:71);G1E<G)U<'0`4W!I;C-296-E:79E26YT97)R=7!T`%-P:6XR
+M4F5C96EV94EN=&5R<G5P=`!(87=K97EE4F5A9$U!0U1I;65R`$AA=VME>653
+M971U<%1R86YS;6ET`%-E;F10;VQL26UM961I871E`$AA=VME>65#;&]S94-O
+M;7!L971E9`!(87=K97EE4V5T=7!#;VUM86YD`$AA=VME>65.;T]P97)A=&EO
+M;@!(87=K97EE4F5A9$5R<F]R0V]U;G1E<G,`2&%W:V5Y94U!0U)E<V5T`$AA
+M=VME>65#;&]S90!(87=K97EE2%=/<&5N26YI=`!'971,;VYG`$%S:6-#:&5C
+M:P!00TE(5T]P96Y);FET`%!#25!)3TEN=&5R<G5P=`!%;F%B;&500TD`1&]0
+M0TE024\`4$-)4$E/4')E<V5N=`!00TE(5T-O;F9I9TEN:70`061P5'EP90!%
+M14=E=$1/`$5%0VQE87(`1453970`0VAE8VM)9`!'971435-3:&]R=`!30T)#
+M;&5A<@!3=&%R=$-O;6UA;F0`5$U30V]M;6%N9`!T;7-?;W5T,@!D;W5T,@!T
+M;7-S:&]R=`!3=&]R95IE<F]E<P!2971U<FY#;VUP;&5T961"=69F97)S`%!R
+M;VUI<V-U;W5S0VAE8VL`5')A8V54;V]L4F5M;W9E`$-20T-H96-K`$-O;7!U
+M=&5#4D,`0U)#5&%B;&4`0U)#26YI=`!3971U<%1R86YS;6ET`%5P9&%T94-O
+M=6YT97)S`$5X96-);G1E<G)U<'0`2&%W:V5Y95)E861087)A;65T97)S`$AA
+M=VME>653971U<%)E8V5I=F4`2&%W:V5Y94U!0TEN:70`4W1A='5S26YT97)R
+M=7!T`$AA=VME>65297-E=`!(87=K97EE4&]L;`!(87=K97EE57-E<D-L;W-E
+M`$AA=VME>65296]P96X`2&%W:V5Y95-E=$=R;W5P`$AA=VME>653971&=6YC
+M=&EO;F%L`$AA=VME>65/<&5N`$EN:71#;VUM86YD`$AA=VME>653=&%R=$-O
+M;6UA;F0`3VQD4$E/26YT97)R=7!T`%!R97-E;G1/;&1024\`16YA8FQE36%S
+M=&5R`$1I<V%B;&5-87-T97(`4')E<V5N=$UA<W1E<@!T;7-?:6XR`%=A:710
+M24\`4F5A9$5%0DE!`%1-4U!#24-O;F9I9P!296%D0DE!`$-H96-K0DE!`$5%
+M4&%U<V4`145296%D`$5%3W5T3F]R;4-M9`!2971U<FY"=69F97)S`%)E;W!E
+M;E!H87-E,@!296]P96Y0:&%S934`4F5O<&5N4&AA<V4V`%1R86YS9F5R26YI
+M=$)L;V-K`%1-4TEN=&5R<G5P=`!297-E=$)U9F9E<G,`4FEN9U-T871U<P!4
+M>%)X4W=E97``061A<'1E<D-H96-K`%-E;F13=&%T=7,`0V]M;6%N9$-O;7!L
+M971E9`!297-P;VYD17)R;W)L;V<`=&US;&]N9P!$;T-O;6UA;F0`4F5A9%!A
+M<F%M971E<G,`9&EN,@!435-#:&5C:P!%141)0V]P>0!435-296%D34%#5&EM
+M97(`5$U34V5T=7!296-E:79E`%1-4U-E='5P5')A;G-M:70`5$U34V5T=7!#
+M;VUM86YD`%1-4T-O9&5$;W=N;&]A9`!435--04-);FET`%1-4U!O;&P`5$U3
+M7T-H96-K`%1-4U5S97)#;&]S90!435-297-E=`!0;W=E<DU!0TA?5$U326YT
+M97)F86-E`$Y%,C`P,%!O<G1486(`26YT3&5V96P`:7AT;W1M<V)A<V4`:7AT
+M;V)A<V4`5%)L;&1)1`!?5E\`5%)L;&1&:6YD`%12;&QD26YT97)R=7!T4&]S
+M=%-E<G9I8V4`5%)L;&14<F%N<VUI=$9R964`5%)L;&1296-E:79E1G)E90!4
+M4FQL9$5N86)L90!44FQL9$-L;W-E`%12;&QD1V5T4W1A=&ES=&EC<P!44FQL
+M9$9I;F100TD`5%)L;&13971&=6YC=&EO;F%L061D<F5S<P!44FQL9$]P96X`
+M5%)L;&1296-E:79E1G)A9VUE;G0`5%)L;&1%;65R9V5N8WD`5%)L;&13971'
+M<F]U<$%D9')E<W,`5%)L;&1-0T%3;&]T0V]N9FEG`%12;&QD4&]L;`!44FQL
+M9$%D9$UE;6]R>0!44FQL9$-O<'D`5%)L;&1);G1E<G)U<'10<F5397)V:6-E
+M`%12;&QD4V5T4W!E960`5%)L;&1%25-!4VQO=$-O;F9I9P!44FQL9$%D87!T
+M97));FET`%12;&QD4$-)0V]N9FEG`%12;&QD061A<'1E<E-I>F4`5%)L;&1$
+M;W=N;&]A9`!44FQL9%-E=%!R;VUI<V-U;W5S36]D90!44FQL9%1R86YS;6ET
+M1G)A;64`5%)L;&13971);G1E<G)U<'0`5%)L;&1);G1E<G)U<'10<F5S96YT
+M`%12;&QD24]!9&1R97-S0V]N9FEG`%12;&QD1&ES86)L90!44FQL9%-E=$1-
+M00!44FQL9$EN=&5R<G5P=%-E<G9I8V4``"YT97AT`"YD871A`"YB<W,`+FYO
+M=&4`+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L+G1E>'0`+G)E;"YD
+M871A`"YC;VUM96YT`'L(```!T@``.PH```'4``#V%P```0,``#@F```!U```
+M@S````'4``!B,0```=0``&0R```!U```[#(```'4``![-````<D``*`U```!
+MZ```J#4```'H``"Q-0```>@``+LU```!Z```Q34```'H``#/-0```>@``#<V
+M```!R```UCH```''``#C/@```=@```L_```!V```(S\```'8``!+/P```=@`
+M`&,_```!V```BS\```'8``"C/P```=@``,L_```!V```&T````'8``!!0```
+M`=@``)%````!V```MT````'8```U00```=@``%9!```!V```?D$```'8``"6
+M00```=@``+Y!```!V```#D(```'8```T0@```=@``-E"```!V```,D,```'8
+M``!:0P```=@``*I#```!V```T$,```'8``!X1````=@``*!$```!V```N$0`
+M``'8``#F1````=@``/)>```!`P``\F@```&F``!2:0```:8``&!I```!I@``
+M<6D```&F``!^:0```:8``)5I```!I@``G6D```&F``"F:0```:8``*QI```!
+MI@``M6D```&F``##:0```:8``-9I```!I@``Y&D```&F``!):@```:8``'=J
+M```!I@``B6H```&F``";:@```:8``*UJ```!I@``V6H```&F``"@<P```=0`
+M`+EU```!V```Z'4```'8```)=@```=@``$!V```!V```SXL```'H```6F0``
+M`OH``'29```"^@``N)D```+Z``#>F0```OH``)2S```!<```@;<```$W``!'
+MN````><``+JX```!-P``O;D```$W``!GRP```78``&;9```!;P``#MH```%N
+M``!NVP```6L``.+;```!:@``9MT```%K``!^W0```6D``"3>```!:@``,]X`
+M``%H``#.Z````>4``/[I```!YP``(.H```'G``"NZ@```><```[K```!YP``
+M8^P```'G``"/[````><``&7N```!YP``C.X```'E``"C[P```><``%#P```!
+MYP``//,```$W``![\P```3<``+_S```!-P``B_@```$V``!R_````14``&4`
+M`0`!`P``9`,!``$#``!8`````>(``%P````!X0``8`````'@``!D`````=\`
+M`&@````!W@``;`````'=``!P`````=P``'0````!VP``>`````':``!\````
+M`=D``)`````!`@``E`````$"``"8`````0(``)P````!`@``H`````$"``"D
+M`````0(``*@````!`@``K`````$"``"P`````0(``+0````!`@``N`````$"
+M``"\`````0(``,`````!`@``Q`````$"``#(`````0(``,P````!`@``T```
+M``$"``#4`````0(``-@````!`@``W`````$"``#D`````:\``.@````!L0``
+M[`````&-``#P`````;```/0````!K0``^`````%Z``#\`````88````!```!
+M@P``!`$```&L```(`0```8(```P!```!>0``$`$```%X```4`0```7<``"@!
+M```!KP``+`$```&Q```P`0```8T``#0!```!L```.`$```&M```\`0```70`
+M`$`!```!A@``1`$```&#``!(`0```:P``$P!```!@@``4`$```%S``!4`0``
+M`7(``%@!```!<0``@`$```%L``"$`0```;@``(@!```!RP``C`$```&Y``"0
+M`0```;P``)@!```!NP``H`$```&Z``"L`0```>,``/@!```!9@``_`$```&X
+M`````@```<L```0"```!N0``"`(```&\```0`@```;L``!@"```!N@``'`(`
+M``%E```@`@```60``"0"```!XP``*`(```%C```L`@```6(``$@"```!8```
+M3`(```%?``!0`@```<L``%0"```!N0``6`(```&\``!<`@```5X``&`"```!
+MNP``9`(```%=``!H`@```;H``&P"```!7```<`(```%;``!T`@```>,``'@"
+M```!6@``?`(```%9``"8`@```5<``)P"```!N```H`(```'+``"D`@```;D`
+M`*@"```!O```L`(```&[``"X`@```;H``,`"```!5@``Q`(```'C``#0`@``
+M`54``.@"```!5P``[`(```&X``#P`@```<L``/0"```!N0``^`(```&\````
+M`P```;L```@#```!N@``$`,```%6```4`P```>,``"`#```!4P``.`,```%7
+M```\`P```;@``$`#```!RP``1`,```&Y``!(`P```;P``%`#```!NP``6`,`
+M``&Z``!@`P```58``&0#```!XP``<`,```%1``"(`P```4\``(P#```!N```
+MD`,```'+``"4`P```;D``)@#```!O```H`,```&[``"H`P```;H``+`#```!
+M3@``M`,```'C``#``P```4T``-@#```!3P``W`,```&X``#@`P```<L``.0#
+M```!N0``Z`,```&\``#P`P```;L``/@#```!N@````0```%.```$!````>,`
+M`!`$```!30``*`0```'````L!````8\``#0$```!N0``/`0```%*``!$!```
+M`9```$P$```!20``4`0```&.``!4!````>,``'@$```!P```?`0```&/``"`
+M!````8\``(0$```!1P``B`0```%'``",!````48``)`$```!1@``E`0```%%
+M``"8!````44``)P$```!DP``H`0```&.``"D!````>,``,@$```!P```S`0`
+M``&/``#0!````<L``-0$```!0P``V`0```%#``#<!````4(``.`$```!0@``
+MY`0```&0``#H!````9```.P$```!DP``\`0```&.``#T!````>,``!@%```!
+M0```(`4```%^```H!0```7T``#`%```!?```.`4```$_```\!0```3X``$`%
+M```!BP``1`4```%[``!H!0```4```'`%```!?@``>`4```%]``"`!0```7P`
+M`(@%```!/P``C`4```$^``"0!0```8L``)0%```!>P``N`4```%```#`!0``
+M`7X``,@%```!?0``T`4```%\``#8!0```3\``-P%```!/@``X`4```&+``#D
+M!0```7L```@&```!0```$`8```%^```8!@```7T``"`&```!?```*`8```$_
+M```L!@```3X``#`&```!BP``-`8```%[``!8!@```3D``&`&```!?@``:`8`
+M``%]``!P!@```7P``'@&```!/P``?`8```$X``"`!@```8L``(0&```!=0``
+ME`8```%M``"8!@```6<``)P&```!80``H`8```%8``"D!@```50``*@&```!
+M4@``K`8```%0``"P!@```4P``+0&```!2P``N`8```%(``"\!@```40``,`&
+M```!00``Q`8```$]``#(!@```3P``,P&```!.P``T`8```$Z```D!P```0(`
+M`"@'```!`@``+`<```$"```P!P```0(``#0'```!`@``.`<```$"```\!P``
+M`0(``$`'```!`@``1`<```$"``!(!P```0(``$P'```!`@``4`<```$"``!4
+M!P```0(``%@'```!`@``7`<```$"``!@!P```0(``&0'```!`@``:`<```$"
+M``!L!P```0(``'`'```!`@``=`<```$"``!X!P```0(``'P'```!`@``@`<`
+M``$"``"$!P```0(``(@'```!`@``C`<```$"``"0!P```0(``)0'```!`@``
+MF`<```$"``"<!P```0(``*`'```!`@``>'!G-'!L=7,@0"@C*2!S=&1D968N
+M:"`R,"XQ(#DT+S$R+S`T(`!A8V]M<#H@4F5L96%S92`U+C`N,&$@,39-87(Y
+M-0!O<'1I;3H@4F5L96%S92`U+C`N,&$@,39-87(Y-0!I,S@V87,Z(%)E;&5A
+M<V4@-2XP+C!A(#$V36%R.34`0"@C*2!T8V]P>2YS(#$N,"`Y."\P."\Q,0!I
+M,S@V87,Z(%)E;&5A<V4@-2XP+C!A(#$V36%R.34`````````````````````
+M`````````````````````````````````````0````$````&`````````$``
+M```<$`$````````````0``````````<````!`````P````````!<$`$`I`<`
+M````````````!``````````-````"`````,``````````!@!```$````````
+M``````0`````````$@````<````````````````8`0`<```````````````!
+M`````````!@````"```````````````<&`$`H!````8```#J````!````!``
+M```@`````P``````````````O"@!`)T-``````````````$`````````*```
+M``,``````````````%DV`0!/```````````````!`````````#(````)````
+M``````````"H-@$`6`,```4````!````!`````@````\````"0``````````
+M`````#H!`"`(```%`````@````0````(````1@````$``````````````"!"
+6`0"Z```````````````!```````````(
+`
+end
diff --git a/sys/contrib/dev/oltr/if_oltr.c b/sys/contrib/dev/oltr/if_oltr.c
new file mode 100644
index 0000000..499580f
--- /dev/null
+++ b/sys/contrib/dev/oltr/if_oltr.c
@@ -0,0 +1,1571 @@
+/*
+ * Copyright (c) 1998, Larry Lile
+ * All rights reserved.
+ *
+ * For latest sources and information on this driver, please
+ * go to http://anarchy.stdio.com.
+ *
+ * Questions, comments or suggestions should be directed to
+ * Larry Lile <lile@stdio.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/iso88025.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/iso88025.h>
+
+#if (__FreeBSD_version < 400000)
+#include <bpfilter.h>
+#endif
+
+#if (NBPFILTER > 0) || (__FreeBSD_version > 400000)
+#include <net/bpf.h>
+
+#ifndef BPF_MTAP
+#define BPF_MTAP(_ifp, _m) do { \
+ if ((_ifp)->if_bpf) \
+ bpf_mtap((_ifp), (_m)); \
+} while (0)
+#endif
+#endif
+
+#include <vm/vm.h> /* for vtophys */
+#include <vm/pmap.h> /* for vtophys */
+#include <machine/bus_memio.h>
+#include <machine/bus_pio.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+
+#if (__FreeBSD_version < 500000)
+#include <pci/pcireg.h>
+#include <pci/pcivar.h>
+#else
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#endif
+
+#include "contrib/dev/oltr/trlld.h"
+
+/*#define DEBUG_MASK DEBUG_POLL*/
+
+#ifndef DEBUG_MASK
+#define DEBUG_MASK 0x0000
+#endif
+
+#define DEBUG_POLL 0x0001
+#define DEBUG_INT 0x0002
+#define DEBUG_INIT 0x0004
+#define DEBUG_FN_ENT 0x8000
+
+#define PCI_VENDOR_OLICOM 0x108D
+
+#define MIN3(A,B,C) (MIN(A, (MIN(B, C))))
+
+char *AdapterName[] = {
+ /* 0 */ "Olicom XT Adapter [unsupported]",
+ /* 1 */ "Olicom OC-3115",
+ /* 2 */ "Olicom ISA 16/4 Adapter (OC-3117)",
+ /* 3 */ "Olicom ISA 16/4 Adapter (OC-3118)",
+ /* 4 */ "Olicom MCA 16/4 Adapter (OC-3129) [unsupported]",
+ /* 5 */ "Olicom MCA 16/4 Adapter (OC-3129) [unsupported]",
+ /* 6 */ "Olicom MCA 16/4 Adapter (OC-3129) [unsupported]",
+ /* 7 */ "Olicom EISA 16/4 Adapter (OC-3133)",
+ /* 8 */ "Olicom EISA 16/4 Adapter (OC-3133)",
+ /* 9 */ "Olicom EISA 16/4 Server Adapter (OC-3135)",
+ /* 10 */ "Olicom PCI 16/4 Adapter (OC-3136)",
+ /* 11 */ "Olicom PCI 16/4 Adapter (OC-3136)",
+ /* 12 */ "Olicom PCI/II 16/4 Adapter (OC-3137)",
+ /* 13 */ "Olicom PCI 16/4 Adapter (OC-3139)",
+ /* 14 */ "Olicom RapidFire 3140 16/4 PCI Adapter (OC-3140)",
+ /* 15 */ "Olicom RapidFire 3141 Fiber Adapter (OC-3141)",
+ /* 16 */ "Olicom PCMCIA 16/4 Adapter (OC-3220) [unsupported]",
+ /* 17 */ "Olicom PCMCIA 16/4 Adapter (OC-3121, OC-3230, OC-3232) [unsupported]",
+ /* 18 */ "Olicom PCMCIA 16/4 Adapter (OC-3250)",
+ /* 19 */ "Olicom RapidFire 3540 100/16/4 Adapter (OC-3540)"
+};
+
+/*
+ * Glue function prototypes for PMW kit IO
+ */
+
+#ifndef TRlldInlineIO
+static void DriverOutByte __P((unsigned short, unsigned char));
+static void DriverOutWord __P((unsigned short, unsigned short));
+static void DriverOutDword __P((unsigned short, unsigned long));
+static void DriverRepOutByte __P((unsigned short, unsigned char *, int));
+static void DriverRepOutWord __P((unsigned short, unsigned short *, int));
+static void DriverRepOutDword __P((unsigned short, unsigned long *, int));
+static unsigned char DriverInByte __P((unsigned short));
+static unsigned short DriverInWord __P((unsigned short));
+static unsigned long DriverInDword __P((unsigned short));
+static void DriverRepInByte __P((unsigned short, unsigned char *, int));
+static void DriverRepInWord __P((unsigned short, unsigned short *, int));
+static void DriverRepInDword __P((unsigned short, unsigned long *, int));
+#endif /*TRlldInlineIO*/
+static void DriverSuspend __P((unsigned short));
+static void DriverStatus __P((void *, TRlldStatus_t *));
+static void DriverCloseCompleted __P((void *));
+static void DriverStatistics __P((void *, TRlldStatistics_t *));
+static void DriverTransmitFrameCompleted __P((void *, void *, int));
+static void DriverReceiveFrameCompleted __P((void *, int, int, void *, int));
+
+static TRlldDriver_t LldDriver = {
+ TRLLD_VERSION,
+#ifndef TRlldInlineIO
+ DriverOutByte,
+ DriverOutWord,
+ DriverOutDword,
+ DriverRepOutByte,
+ DriverRepOutWord,
+ DriverRepOutDword,
+ DriverInByte,
+ DriverInWord,
+ DriverInDword,
+ DriverRepInByte,
+ DriverRepInWord,
+ DriverRepInDword,
+#endif /*TRlldInlineIO*/
+ DriverSuspend,
+ DriverStatus,
+ DriverCloseCompleted,
+ DriverStatistics,
+ DriverTransmitFrameCompleted,
+ DriverReceiveFrameCompleted,
+};
+
+struct oltr_rx_buf {
+ int index;
+ char *data;
+ u_long address;
+};
+
+struct oltr_tx_buf {
+ int index;
+ char *data;
+ u_long address;
+};
+
+#define RING_BUFFER_LEN 16
+#define RING_BUFFER(x) ((RING_BUFFER_LEN - 1) & x)
+#define RX_BUFFER_LEN 2048
+#define TX_BUFFER_LEN 2048
+
+struct oltr_softc {
+ struct arpcom arpcom;
+ struct ifmedia ifmedia;
+ bus_space_handle_t oltr_bhandle;
+ bus_space_tag_t oltr_btag;
+ void *oltr_intrhand;
+ struct resource *oltr_irq;
+ struct resource *oltr_res;
+ int unit;
+ int state;
+#define OL_UNKNOWN 0
+#define OL_INIT 1
+#define OL_READY 2
+#define OL_CLOSING 3
+#define OL_CLOSED 4
+#define OL_OPENING 5
+#define OL_OPEN 6
+#define OL_PROMISC 7
+#define OL_DEAD 8
+ struct oltr_rx_buf rx_ring[RING_BUFFER_LEN];
+ int tx_head, tx_avail, tx_frame;
+ struct oltr_tx_buf tx_ring[RING_BUFFER_LEN];
+ TRlldTransmit_t frame_ring[RING_BUFFER_LEN];
+ struct mbuf *restart;
+ TRlldAdapter_t TRlldAdapter;
+ TRlldStatistics_t statistics;
+ TRlldStatistics_t current;
+ TRlldAdapterConfig_t config;
+ u_short AdapterMode;
+ u_long GroupAddress;
+ u_long FunctionalAddress;
+ struct callout_handle oltr_poll_ch;
+ /*struct callout_handle oltr_stat_ch;*/
+ void *work_memory;
+};
+
+#define SELF_TEST_POLLS 32
+
+void oltr_poll __P((void *));
+/*void oltr_stat __P((void *));*/
+
+static void oltr_start __P((struct ifnet *));
+static void oltr_stop __P((struct oltr_softc *));
+static void oltr_close __P((struct oltr_softc *));
+static void oltr_init __P((void *));
+static int oltr_ioctl __P((struct ifnet *, u_long, caddr_t));
+static void oltr_intr __P((void *));
+static int oltr_ifmedia_upd __P((struct ifnet *));
+static void oltr_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
+
+#if __FreeBSD_version > 400000
+
+static int oltr_pci_probe __P((device_t));
+static int oltr_pci_attach __P((device_t));
+static int oltr_pci_detach __P((device_t));
+static void oltr_pci_shutdown __P((device_t));
+
+static device_method_t oltr_methods[] = {
+ DEVMETHOD(device_probe, oltr_pci_probe),
+ DEVMETHOD(device_attach, oltr_pci_attach),
+ DEVMETHOD(device_detach, oltr_pci_detach),
+ DEVMETHOD(device_shutdown, oltr_pci_shutdown),
+ { 0, 0 }
+};
+
+static driver_t oltr_driver = {
+ "oltr",
+ oltr_methods,
+ sizeof(struct oltr_softc)
+};
+
+static devclass_t oltr_devclass;
+
+DRIVER_MODULE(oltr, pci, oltr_driver, oltr_devclass, 0, 0);
+MODULE_DEPEND(oltr, pci, 1, 1, 1);
+MODULE_DEPEND(oltr, iso88025, 1, 1, 1);
+
+static int
+oltr_pci_probe(device_t dev)
+{
+ int i, rc;
+ char PCIConfigHeader[64];
+ TRlldAdapterConfig_t config;
+
+ if ((pci_get_vendor(dev) == PCI_VENDOR_OLICOM) &&
+ ((pci_get_device(dev) == 0x0001) ||
+ (pci_get_device(dev) == 0x0004) ||
+ (pci_get_device(dev) == 0x0005) ||
+ (pci_get_device(dev) == 0x0007) ||
+ (pci_get_device(dev) == 0x0008))) {
+
+ for (i = 0; i < sizeof(PCIConfigHeader); i++)
+ PCIConfigHeader[i] = pci_read_config(dev, i, 1);
+
+ rc = TRlldPCIConfig(&LldDriver, &config, PCIConfigHeader);
+ if (rc == TRLLD_PCICONFIG_FAIL) {
+ device_printf(dev, "TRlldPciConfig failed!\n");
+ return(ENXIO);
+ }
+ if (rc == TRLLD_PCICONFIG_VERSION) {
+ device_printf(dev, "wrong LLD version\n");
+ return(ENXIO);
+ }
+ device_set_desc(dev, AdapterName[config.type]);
+ return(0);
+ }
+ return(ENXIO);
+}
+
+static int
+oltr_pci_attach(device_t dev)
+{
+ int i, s, rc = 0, rid,
+ scratch_size;
+ int media = IFM_TOKEN|IFM_TOK_UTP16;
+ u_long command;
+ char PCIConfigHeader[64];
+ struct oltr_softc *sc = device_get_softc(dev);
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+
+ s = splimp();
+
+ bzero(sc, sizeof(struct oltr_softc));
+ sc->unit = device_get_unit(dev);
+ sc->state = OL_UNKNOWN;
+
+ for (i = 0; i < sizeof(PCIConfigHeader); i++)
+ PCIConfigHeader[i] = pci_read_config(dev, i, 1);
+
+ switch(TRlldPCIConfig(&LldDriver, &sc->config, PCIConfigHeader)) {
+ case TRLLD_PCICONFIG_OK:
+ break;
+ case TRLLD_PCICONFIG_SET_COMMAND:
+ device_printf(dev, "enabling bus master mode\n");
+ command = pci_read_config(dev, PCIR_COMMAND, 4);
+ pci_write_config(dev, PCIR_COMMAND,
+ (command | PCIM_CMD_BUSMASTEREN), 4);
+ command = pci_read_config(dev, PCIR_COMMAND, 4);
+ if (!(command & PCIM_CMD_BUSMASTEREN)) {
+ device_printf(dev, "failed to enable bus master mode\n");
+ goto config_failed;
+ }
+ break;
+ case TRLLD_PCICONFIG_FAIL:
+ device_printf(dev, "TRlldPciConfig failed!\n");
+ goto config_failed;
+ break;
+ case TRLLD_PCICONFIG_VERSION:
+ device_printf(dev, "wrong LLD version\n");
+ goto config_failed;
+ break;
+ }
+ device_printf(dev, "MAC address %6D\n", sc->config.macaddress, ":");
+
+ scratch_size = TRlldAdapterSize();
+ if (bootverbose)
+ device_printf(dev, "adapter memory block size %d bytes\n", scratch_size);
+ sc->TRlldAdapter = (TRlldAdapter_t)malloc(scratch_size, M_DEVBUF, M_NOWAIT);
+ if (sc->TRlldAdapter == NULL) {
+ device_printf(dev, "couldn't allocate scratch buffer (%d bytes)\n", scratch_size);
+ goto config_failed;
+ }
+
+ /*
+ * Allocate RX/TX Pools
+ */
+ for (i = 0; i < RING_BUFFER_LEN; i++) {
+ sc->rx_ring[i].index = i;
+ sc->rx_ring[i].data = (char *)malloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
+ sc->rx_ring[i].address = vtophys(sc->rx_ring[i].data);
+ sc->tx_ring[i].index = i;
+ sc->tx_ring[i].data = (char *)malloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
+ sc->tx_ring[i].address = vtophys(sc->tx_ring[i].data);
+ if ((!sc->rx_ring[i].data) || (!sc->tx_ring[i].data)) {
+ device_printf(dev, "unable to allocate ring buffers\n");
+ while (i > 0) {
+ if (sc->rx_ring[i].data)
+ free(sc->rx_ring[i].data, M_DEVBUF);
+ if (sc->tx_ring[i].data)
+ free(sc->tx_ring[i].data, M_DEVBUF);
+ i--;
+ }
+ goto config_failed;
+ }
+ }
+
+ /*
+ * Allocate interrupt and DMA channel
+ */
+ rid = 0;
+ sc->oltr_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ (sc->config.mode & TRLLD_MODE_SHARE_INTERRUPT ? RF_ACTIVE | RF_SHAREABLE : RF_ACTIVE));
+ if (sc->oltr_irq == NULL) {
+ device_printf(dev, "couldn't map interrupt\n");
+ goto config_failed;
+ }
+ if (bus_setup_intr(dev, sc->oltr_irq, INTR_TYPE_NET, oltr_intr, sc, &sc->oltr_intrhand)) {
+ device_printf(dev, "couldn't setup interrupt\n");
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->oltr_irq);
+ goto config_failed;
+ }
+
+ /*
+ * Do the ifnet initialization
+ */
+ ifp->if_softc = sc;
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
+ ifp->if_init = oltr_init;
+ ifp->if_start = oltr_start;
+ ifp->if_ioctl = oltr_ioctl;
+ ifp->if_flags = IFF_BROADCAST;
+ ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
+ bcopy(sc->config.macaddress, sc->arpcom.ac_enaddr, sizeof(sc->config.macaddress));
+
+ /*
+ * Do ifmedia setup.
+ */
+ ifmedia_init(&sc->ifmedia, 0, oltr_ifmedia_upd, oltr_ifmedia_sts);
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
+ switch(sc->config.type) {
+ case TRLLD_ADAPTER_PCI7: /* OC-3540 */
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP100, 0, NULL);
+ /* FALL THROUGH */
+ case TRLLD_ADAPTER_PCI4: /* OC-3139 */
+ case TRLLD_ADAPTER_PCI5: /* OC-3140 */
+ case TRLLD_ADAPTER_PCI6: /* OC-3141 */
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_AUTO, 0, NULL);
+ media = IFM_TOKEN|IFM_AUTO;
+ rc = TRlldSetSpeed(sc->TRlldAdapter, 0);
+ /* FALL THROUGH */
+ default:
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP4, 0, NULL);
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP16, 0, NULL);
+ break;
+ }
+ sc->ifmedia.ifm_media = media;
+ ifmedia_set(&sc->ifmedia, media);
+
+ /*
+ * Attach the interface
+ */
+ iso88025_ifattach(ifp, ISO88025_BPF_SUPPORTED);
+
+ splx(s);
+ return(0);
+
+config_failed:
+
+ splx(s);
+ return(ENXIO);
+}
+
+static int
+oltr_pci_detach(device_t dev)
+{
+ struct oltr_softc *sc = device_get_softc(dev);
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+ int s, i;
+
+ device_printf(dev, "driver unloading\n");
+
+ s = splimp();
+
+ iso88025_ifdetach(ifp, ISO88025_BPF_SUPPORTED);
+ if (sc->state > OL_CLOSED)
+ oltr_stop(sc);
+
+ untimeout(oltr_poll, (void *)sc, sc->oltr_poll_ch);
+ /*untimeout(oltr_stat, (void *)sc, sc->oltr_stat_ch);*/
+
+ bus_teardown_intr(dev, sc->oltr_irq, sc->oltr_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->oltr_irq);
+
+ /* Deallocate all dynamic memory regions */
+ for (i = 0; i < RING_BUFFER_LEN; i++) {
+ free(sc->rx_ring[i].data, M_DEVBUF);
+ free(sc->tx_ring[i].data, M_DEVBUF);
+ }
+ if (sc->work_memory)
+ free(sc->work_memory, M_DEVBUF);
+ free(sc->TRlldAdapter, M_DEVBUF);
+
+ (void)splx(s);
+
+ return(0);
+}
+
+static void
+oltr_pci_shutdown(device_t dev)
+{
+ struct oltr_softc *sc = device_get_softc(dev);
+
+ device_printf(dev, "oltr_pci_shutdown called\n");
+
+ if (sc->state > OL_CLOSED)
+ oltr_stop(sc);
+
+ return;
+}
+
+#else
+
+static const char *oltr_pci_probe __P((pcici_t, pcidi_t));
+static void oltr_pci_attach __P((pcici_t, int));
+
+static unsigned long oltr_count = 0;
+
+static struct pci_device oltr_device = {
+ "oltr",
+ oltr_pci_probe,
+ oltr_pci_attach,
+ &oltr_count,
+ NULL
+};
+
+DATA_SET(pcidevice_set, oltr_device);
+
+static const char *
+oltr_pci_probe(pcici_t config_id, pcidi_t device_id)
+{
+ int i, rc;
+ char PCIConfigHeader[64];
+ TRlldAdapterConfig_t config;
+
+ if (((device_id & 0xffff) == PCI_VENDOR_OLICOM) && (
+ (((device_id >> 16) & 0xffff) == 0x0001) ||
+ (((device_id >> 16) & 0xffff) == 0x0004) ||
+ (((device_id >> 16) & 0xffff) == 0x0005) ||
+ (((device_id >> 16) & 0xffff) == 0x0007) ||
+ (((device_id >> 16) & 0xffff) == 0x0008))) {
+
+ for (i = 0; i < 64; i++)
+ PCIConfigHeader[i] = pci_cfgread(config_id, i, /* bytes */ 1);
+
+ rc = TRlldPCIConfig(&LldDriver, &config, PCIConfigHeader);
+
+ if (rc == TRLLD_PCICONFIG_FAIL) {
+ printf("oltr: TRlldPciConfig failed!\n");
+ return(NULL);
+ }
+ if (rc == TRLLD_PCICONFIG_VERSION) {
+ printf("oltr: wrong LLD version.\n");
+ return(NULL);
+ }
+ return(AdapterName[config.type]);
+ }
+
+ return(NULL);
+}
+
+static void
+oltr_pci_attach(pcici_t config_id, int unit)
+{
+ int i, s, rc = 0, scratch_size;
+ int media = IFM_TOKEN|IFM_TOK_UTP16;
+ u_long command;
+ char PCIConfigHeader[64];
+ struct oltr_softc *sc;
+ struct ifnet *ifp; /* = &sc->arpcom.ac_if; */
+
+ s = splimp();
+
+ sc = malloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (sc == NULL) {
+ printf("oltr%d: no memory for softc struct!\n", unit);
+ goto config_failed;
+ }
+ sc->unit = unit;
+ sc->state = OL_UNKNOWN;
+ ifp = &sc->arpcom.ac_if;
+
+ for (i = 0; i < sizeof(PCIConfigHeader); i++)
+ PCIConfigHeader[i] = pci_cfgread(config_id, i, 1);
+
+ switch(TRlldPCIConfig(&LldDriver, &sc->config, PCIConfigHeader)) {
+ case TRLLD_PCICONFIG_OK:
+ break;
+ case TRLLD_PCICONFIG_SET_COMMAND:
+ printf("oltr%d: enabling bus master mode\n", unit);
+ command = pci_conf_read(config_id, PCIR_COMMAND);
+ pci_conf_write(config_id, PCIR_COMMAND, (command | PCIM_CMD_BUSMASTEREN));
+ command = pci_conf_read(config_id, PCIR_COMMAND);
+ if (!(command & PCIM_CMD_BUSMASTEREN)) {
+ printf("oltr%d: failed to enable bus master mode\n", unit);
+ goto config_failed;
+ }
+ break;
+ case TRLLD_PCICONFIG_FAIL:
+ printf("oltr%d: TRlldPciConfig failed!\n", unit);
+ goto config_failed;
+ break;
+ case TRLLD_PCICONFIG_VERSION:
+ printf("oltr%d: wrong LLD version\n", unit);
+ goto config_failed;
+ break;
+ }
+ printf("oltr%d: MAC address %6D\n", unit, sc->config.macaddress, ":");
+
+ scratch_size = TRlldAdapterSize();
+ if (bootverbose)
+ printf("oltr%d: adapter memory block size %d bytes\n", unit, scratch_size);
+ sc->TRlldAdapter = (TRlldAdapter_t)malloc(scratch_size, M_DEVBUF, M_NOWAIT);
+ if (sc->TRlldAdapter == NULL) {
+ printf("oltr%d: couldn't allocate scratch buffer (%d bytes)\n",unit, scratch_size);
+ goto config_failed;
+ }
+
+ /*
+ * Allocate RX/TX Pools
+ */
+ for (i = 0; i < RING_BUFFER_LEN; i++) {
+ sc->rx_ring[i].index = i;
+ sc->rx_ring[i].data = (char *)malloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
+ sc->rx_ring[i].address = vtophys(sc->rx_ring[i].data);
+ sc->tx_ring[i].index = i;
+ sc->tx_ring[i].data = (char *)malloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
+ sc->tx_ring[i].address = vtophys(sc->tx_ring[i].data);
+ if ((!sc->rx_ring[i].data) || (!sc->tx_ring[i].data)) {
+ printf("oltr%d: unable to allocate ring buffers\n", unit);
+ while (i > 0) {
+ if (sc->rx_ring[i].data)
+ free(sc->rx_ring[i].data, M_DEVBUF);
+ if (sc->tx_ring[i].data)
+ free(sc->tx_ring[i].data, M_DEVBUF);
+ i--;
+ }
+ goto config_failed;
+ }
+ }
+
+ /*
+ * Allocate interrupt and DMA channel
+ */
+ if (!pci_map_int(config_id, oltr_intr, sc, &net_imask)) {
+ printf("oltr%d: couldn't setup interrupt\n", unit);
+ goto config_failed;
+ }
+
+ /*
+ * Do the ifnet initialization
+ */
+ ifp->if_softc = sc;
+ ifp->if_unit = unit;
+ ifp->if_name = "oltr";
+ ifp->if_output = iso88025_output;
+ ifp->if_init = oltr_init;
+ ifp->if_start = oltr_start;
+ ifp->if_ioctl = oltr_ioctl;
+ ifp->if_flags = IFF_BROADCAST;
+ bcopy(sc->config.macaddress, sc->arpcom.ac_enaddr, sizeof(sc->config.macaddress));
+
+ /*
+ * Do ifmedia setup.
+ */
+ ifmedia_init(&sc->ifmedia, 0, oltr_ifmedia_upd, oltr_ifmedia_sts);
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
+ switch(sc->config.type) {
+ case TRLLD_ADAPTER_PCI7: /* OC-3540 */
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP100, 0, NULL);
+ /* FALL THROUGH */
+ case TRLLD_ADAPTER_PCI4: /* OC-3139 */
+ case TRLLD_ADAPTER_PCI5: /* OC-3140 */
+ case TRLLD_ADAPTER_PCI6: /* OC-3141 */
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_AUTO, 0, NULL);
+ media = IFM_TOKEN|IFM_AUTO;
+ rc = TRlldSetSpeed(sc->TRlldAdapter, 0);
+ /* FALL THROUGH */
+ default:
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP4, 0, NULL);
+ ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP16, 0, NULL);
+ break;
+ }
+ sc->ifmedia.ifm_media = media;
+ ifmedia_set(&sc->ifmedia, media);
+
+ /*
+ * Attach the interface
+ */
+ if_attach(ifp);
+ ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
+ iso88025_ifattach(ifp);
+
+ splx(s);
+ return;
+
+config_failed:
+ (void)splx(s);
+
+ return;
+}
+
+#endif
+
+static void
+oltr_intr(void *xsc)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)xsc;
+
+ if (DEBUG_MASK & DEBUG_INT)
+ printf("I");
+
+ TRlldInterruptService(sc->TRlldAdapter);
+
+ return;
+}
+
+static void
+oltr_start(struct ifnet *ifp)
+{
+ struct oltr_softc *sc = ifp->if_softc;
+ struct mbuf *m0, *m;
+ int copy_len, buffer, frame, fragment, rc, s;
+
+ /*
+ * Check to see if output is already active
+ */
+ if (ifp->if_flags & IFF_OACTIVE)
+ return;
+
+outloop:
+
+ /*
+ * Make sure we have buffers to transmit with
+ */
+ if (sc->tx_avail <= 0) {
+ printf("oltr%d: tx queue full\n", sc->unit);
+ ifp->if_flags |= IFF_OACTIVE;
+ return;
+ }
+
+ if (sc->restart == NULL) {
+ IF_DEQUEUE(&ifp->if_snd, m);
+ if (m == NULL)
+ return;
+ } else {
+ m = sc->restart;
+ sc->restart = NULL;
+ }
+
+ m0 = m;
+ frame = RING_BUFFER(sc->tx_frame);
+ buffer = RING_BUFFER(sc->tx_head);
+ fragment = 0;
+ copy_len = 0;
+ sc->frame_ring[frame].FragmentCount = 0;
+
+ while (copy_len < m0->m_pkthdr.len) {
+ sc->frame_ring[frame].FragmentCount++;
+ if (sc->frame_ring[frame].FragmentCount > sc->tx_avail)
+ goto nobuffers;
+ sc->frame_ring[frame].TransmitFragment[fragment].VirtualAddress = sc->tx_ring[buffer].data;
+ sc->frame_ring[frame].TransmitFragment[fragment].PhysicalAddress = sc->tx_ring[buffer].address;
+ sc->frame_ring[frame].TransmitFragment[fragment].count = MIN(m0->m_pkthdr.len - copy_len, TX_BUFFER_LEN);
+ m_copydata(m0, copy_len, MIN(m0->m_pkthdr.len - copy_len, TX_BUFFER_LEN), sc->tx_ring[buffer].data);
+ copy_len += MIN(m0->m_pkthdr.len - copy_len, TX_BUFFER_LEN);
+ fragment++;
+ buffer = RING_BUFFER((buffer + 1));
+ }
+
+ s = splimp();
+ rc = TRlldTransmitFrame(sc->TRlldAdapter, &sc->frame_ring[frame], (void *)&sc->frame_ring[frame]);
+ (void)splx(s);
+
+ if (rc != TRLLD_TRANSMIT_OK) {
+ printf("oltr%d: TRlldTransmitFrame returned %d\n", sc->unit, rc);
+ ifp->if_oerrors++;
+ goto bad;
+ }
+
+ sc->tx_avail -= sc->frame_ring[frame].FragmentCount;
+ sc->tx_head = RING_BUFFER((sc->tx_head + sc->frame_ring[frame].FragmentCount));
+ sc->tx_frame++;
+
+#if (NBPFILTER > 0) || (__FreeBSD_version > 400000)
+ BPF_MTAP(ifp, m0);
+#endif
+ /*ifp->if_opackets++;*/
+
+bad:
+ m_freem(m0);
+
+ goto outloop;
+
+nobuffers:
+
+ printf("oltr%d: queue full\n", sc->unit);
+ ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_oerrors++;
+ /*m_freem(m0);*/
+ sc->restart = m0;
+
+ return;
+}
+
+static void
+oltr_close(struct oltr_softc *sc)
+{
+ /*printf("oltr%d: oltr_close\n", sc->unit);*/
+
+ oltr_stop(sc);
+
+ tsleep(sc, PWAIT, "oltrclose", 30*hz);
+}
+
+static void
+oltr_stop(struct oltr_softc *sc)
+{
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+
+ /*printf("oltr%d: oltr_stop\n", sc->unit);*/
+
+ ifp->if_flags &= ~(IFF_UP | IFF_RUNNING | IFF_OACTIVE);
+ TRlldClose(sc->TRlldAdapter, 0);
+ sc->state = OL_CLOSING;
+}
+
+static void
+oltr_init(void * xsc)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)xsc;
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifmedia *ifm = &sc->ifmedia;
+ int poll = 0, i, rc = 0, s;
+ int work_size;
+
+ /*
+ * Check adapter state, don't allow multiple inits
+ */
+ if (sc->state > OL_CLOSED) {
+ printf("oltr%d: adapter not ready\n", sc->unit);
+ return;
+ }
+
+ s = splimp();
+
+ /*
+ * Initialize Adapter
+ */
+ if ((rc = TRlldAdapterInit(&LldDriver, sc->TRlldAdapter, vtophys(sc->TRlldAdapter),
+ (void *)sc, &sc->config)) != TRLLD_INIT_OK) {
+ switch(rc) {
+ case TRLLD_INIT_NOT_FOUND:
+ printf("oltr%d: adapter not found\n", sc->unit);
+ break;
+ case TRLLD_INIT_UNSUPPORTED:
+ printf("oltr%d: adapter not supported by low level driver\n", sc->unit);
+ break;
+ case TRLLD_INIT_PHYS16:
+ printf("oltr%d: adapter memory block above 16M cannot DMA\n", sc->unit);
+ break;
+ case TRLLD_INIT_VERSION:
+ printf("oltr%d: low level driver version mismatch\n", sc->unit);
+ break;
+ default:
+ printf("oltr%d: unknown init error %d\n", sc->unit, rc);
+ break;
+ }
+ goto init_failed;
+ }
+ sc->state = OL_INIT;
+
+ switch(sc->config.type) {
+ case TRLLD_ADAPTER_PCI4: /* OC-3139 */
+ work_size = 32 * 1024;
+ break;
+ case TRLLD_ADAPTER_PCI7: /* OC-3540 */
+ work_size = 256;
+ break;
+ default:
+ work_size = 0;
+ }
+
+ if (work_size) {
+ if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
+ printf("oltr%d: failed to allocate work memory (%d octets).\n", sc->unit, work_size);
+ } else {
+ TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
+ vtophys(sc->work_memory), work_size);
+ }
+ }
+
+ switch(IFM_SUBTYPE(ifm->ifm_media)) {
+ case IFM_AUTO:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, 0); /* TRLLD_SPEED_AUTO */
+ break;
+ case IFM_TOK_UTP4:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_4MBPS);
+ break;
+ case IFM_TOK_UTP16:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
+ break;
+ case IFM_TOK_UTP100:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_100MBPS);
+ break;
+ }
+
+ /*
+ * Download adapter micro-code
+ */
+ if (bootverbose)
+ printf("oltr%d: Downloading adapter microcode: ", sc->unit);
+
+ switch(sc->config.mactype) {
+ case TRLLD_MAC_TMS:
+ rc = TRlldDownload(sc->TRlldAdapter, TRlldMacCode);
+ if (bootverbose)
+ printf("TMS-380");
+ break;
+ case TRLLD_MAC_HAWKEYE:
+ rc = TRlldDownload(sc->TRlldAdapter, TRlldHawkeyeMac);
+ if (bootverbose)
+ printf("Hawkeye");
+ break;
+ case TRLLD_MAC_BULLSEYE:
+ rc = TRlldDownload(sc->TRlldAdapter, TRlldBullseyeMac);
+ if (bootverbose)
+ printf("Bullseye");
+ break;
+ default:
+ if (bootverbose)
+ printf("unknown - failed!\n");
+ goto init_failed;
+ break;
+ }
+
+ /*
+ * Check download status
+ */
+ switch(rc) {
+ case TRLLD_DOWNLOAD_OK:
+ if (bootverbose)
+ printf(" - ok\n");
+ break;
+ case TRLLD_DOWNLOAD_ERROR:
+ if (bootverbose)
+ printf(" - failed\n");
+ else
+ printf("oltr%d: adapter microcode download failed\n", sc->unit);
+ goto init_failed;
+ break;
+ case TRLLD_STATE:
+ if (bootverbose)
+ printf(" - not ready\n");
+ goto init_failed;
+ break;
+ }
+
+ /*
+ * Wait for self-test to complete
+ */
+ i = 0;
+ while ((poll++ < SELF_TEST_POLLS) && (sc->state < OL_READY)) {
+ if (DEBUG_MASK & DEBUG_INIT)
+ printf("p");
+ DELAY(TRlldPoll(sc->TRlldAdapter) * 1000);
+ if (TRlldInterruptService(sc->TRlldAdapter) != 0)
+ if (DEBUG_MASK & DEBUG_INIT) printf("i");
+ }
+
+ if (sc->state != OL_CLOSED) {
+ printf("oltr%d: self-test failed\n", sc->unit);
+ goto init_failed;
+ }
+
+ /*
+ * Set up adapter poll
+ */
+ callout_handle_init(&sc->oltr_poll_ch);
+ sc->oltr_poll_ch = timeout(oltr_poll, (void *)sc, 1);
+
+ sc->state = OL_OPENING;
+
+ /*
+ * Open the adapter
+ */
+ rc = TRlldOpen(sc->TRlldAdapter, sc->arpcom.ac_enaddr, sc->GroupAddress,
+ sc->FunctionalAddress, 1552, sc->AdapterMode);
+ switch(rc) {
+ case TRLLD_OPEN_OK:
+ break;
+ case TRLLD_OPEN_STATE:
+ printf("oltr%d: adapter not ready for open\n", sc->unit);
+ (void)splx(s);
+ return;
+ case TRLLD_OPEN_ADDRESS_ERROR:
+ printf("oltr%d: illegal MAC address\n", sc->unit);
+ (void)splx(s);
+ return;
+ case TRLLD_OPEN_MODE_ERROR:
+ printf("oltr%d: illegal open mode\n", sc->unit);
+ (void)splx(s);
+ return;
+ default:
+ printf("oltr%d: unknown open error (%d)\n", sc->unit, rc);
+ (void)splx(s);
+ return;
+ }
+
+ /*
+ * Set promiscious mode for now...
+ */
+ TRlldSetPromiscuousMode(sc->TRlldAdapter, TRLLD_PROM_LLC);
+ ifp->if_flags |= IFF_PROMISC;
+
+ /*
+ * Block on the ring insert and set a timeout
+ */
+ tsleep(sc, PWAIT, "oltropen", 30*hz);
+
+ /*
+ * Set up receive buffer ring
+ */
+ for (i = 0; i < RING_BUFFER_LEN; i++) {
+ rc = TRlldReceiveFragment(sc->TRlldAdapter, (void *)sc->rx_ring[i].data,
+ sc->rx_ring[i].address, RX_BUFFER_LEN, (void *)sc->rx_ring[i].index);
+ if (rc != TRLLD_RECEIVE_OK) {
+ printf("oltr%d: adapter refused receive fragment %d (rc = %d)\n", sc->unit, i, rc);
+ break;
+ }
+ }
+
+ sc->tx_avail = RING_BUFFER_LEN;
+ sc->tx_head = 0;
+ sc->tx_frame = 0;
+
+ sc->restart = NULL;
+
+ ifp->if_flags |= IFF_RUNNING;
+ ifp->if_flags &= ~IFF_OACTIVE;
+
+ /*
+ * Set up adapter statistics poll
+ */
+ /*callout_handle_init(&sc->oltr_stat_ch);*/
+ /*sc->oltr_stat_ch = timeout(oltr_stat, (void *)sc, 1*hz);*/
+
+ (void)splx(s);
+ return;
+
+init_failed:
+ sc->state = OL_DEAD;
+ (void)splx(s);
+ return;
+}
+
+static int
+oltr_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
+{
+ struct oltr_softc *sc = ifp->if_softc;
+ struct ifreq *ifr = (struct ifreq *)data;
+ int error = 0, s;
+
+ s = splimp();
+
+ switch(command) {
+ case SIOCSIFADDR:
+ case SIOCGIFADDR:
+ case SIOCSIFMTU:
+ error = iso88025_ioctl(ifp, command, data);
+ break;
+
+ case SIOCSIFFLAGS:
+ if (ifp->if_flags & IFF_UP) {
+ oltr_init(sc);
+ } else {
+ if (ifp->if_flags & IFF_RUNNING) {
+ oltr_close(sc);
+ }
+ }
+ break;
+ case SIOCGIFMEDIA:
+ case SIOCSIFMEDIA:
+ error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command);
+ break;
+ default:
+ error = EINVAL;
+ break;
+ }
+
+ (void)splx(s);
+
+ return(error);
+}
+
+
+void
+oltr_poll(void *arg)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)arg;
+ int s;
+
+ s = splimp();
+
+ if (DEBUG_MASK & DEBUG_POLL) printf("P");
+
+ /* Set up next adapter poll */
+ sc->oltr_poll_ch = timeout(oltr_poll, (void *)sc, (TRlldPoll(sc->TRlldAdapter) * hz / 1000));
+
+ (void)splx(s);
+}
+
+#ifdef NOTYET
+void
+oltr_stat(void *arg)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)arg;
+ int s;
+
+ s = splimp();
+
+ /* Set up next adapter poll */
+ sc->oltr_stat_ch = timeout(oltr_stat, (void *)sc, 1*hz);
+ if (TRlldGetStatistics(sc->TRlldAdapter, &sc->current, 0) != 0) {
+ /*printf("oltr%d: statistics available immediately...\n", sc->unit);*/
+ DriverStatistics((void *)sc, &sc->current);
+ }
+
+ (void)splx(s);
+}
+#endif
+static int
+oltr_ifmedia_upd(struct ifnet *ifp)
+{
+ struct oltr_softc *sc = ifp->if_softc;
+ struct ifmedia *ifm = &sc->ifmedia;
+ int rc;
+
+ if (IFM_TYPE(ifm->ifm_media) != IFM_TOKEN)
+ return(EINVAL);
+
+ switch(IFM_SUBTYPE(ifm->ifm_media)) {
+ case IFM_AUTO:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, 0); /* TRLLD_SPEED_AUTO */
+ break;
+ case IFM_TOK_UTP4:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_4MBPS);
+ break;
+ case IFM_TOK_UTP16:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
+ break;
+ case IFM_TOK_UTP100:
+ rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_100MBPS);
+ break;
+ default:
+ return(EINVAL);
+ break;
+ }
+
+ return(0);
+
+}
+
+static void
+oltr_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+{
+ struct oltr_softc *sc = ifp->if_softc;
+ struct ifmedia *ifm = &sc->ifmedia;
+
+ /*printf("oltr%d: oltr_ifmedia_sts\n", sc->unit);*/
+
+ ifmr->ifm_active = IFM_TYPE(ifm->ifm_media)|IFM_SUBTYPE(ifm->ifm_media);
+
+}
+
+/*
+ * ---------------------- PMW Callback Functions -----------------------
+ */
+
+void
+DriverStatistics(void *DriverHandle, TRlldStatistics_t *statistics)
+{
+#ifdef NOTYET
+ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle;
+
+ if (sc->statistics.LineErrors != statistics->LineErrors)
+ printf("oltr%d: Line Errors %lu\n", sc->unit,
+ statistics->LineErrors);
+ if (sc->statistics.InternalErrors != statistics->InternalErrors)
+ printf("oltr%d: Internal Errors %lu\n", sc->unit,
+ statistics->InternalErrors);
+ if (sc->statistics.BurstErrors != statistics->BurstErrors)
+ printf("oltr%d: Burst Errors %lu\n", sc->unit,
+ statistics->BurstErrors);
+ if (sc->statistics.AbortDelimiters != statistics->AbortDelimiters)
+ printf("oltr%d: Abort Delimiters %lu\n", sc->unit,
+ statistics->AbortDelimiters);
+ if (sc->statistics.ARIFCIErrors != statistics->ARIFCIErrors)
+ printf("oltr%d: ARIFCI Errors %lu\n", sc->unit,
+ statistics->ARIFCIErrors);
+ if (sc->statistics.LostFrames != statistics->LostFrames)
+ printf("oltr%d: Lost Frames %lu\n", sc->unit,
+ statistics->LostFrames);
+ if (sc->statistics.CongestionErrors != statistics->CongestionErrors)
+ printf("oltr%d: Congestion Errors %lu\n", sc->unit,
+ statistics->CongestionErrors);
+ if (sc->statistics.FrequencyErrors != statistics->FrequencyErrors)
+ printf("oltr%d: Frequency Errors %lu\n", sc->unit,
+ statistics->FrequencyErrors);
+ if (sc->statistics.TokenErrors != statistics->TokenErrors)
+ printf("oltr%d: Token Errors %lu\n", sc->unit,
+ statistics->TokenErrors);
+ if (sc->statistics.DMABusErrors != statistics->DMABusErrors)
+ printf("oltr%d: DMA Bus Errors %lu\n", sc->unit,
+ statistics->DMABusErrors);
+ if (sc->statistics.DMAParityErrors != statistics->DMAParityErrors)
+ printf("oltr%d: DMA Parity Errors %lu\n", sc->unit,
+ statistics->DMAParityErrors);
+ if (sc->statistics.ReceiveLongFrame != statistics->ReceiveLongFrame)
+ printf("oltr%d: Long frames received %lu\n", sc->unit,
+ statistics->ReceiveLongFrame);
+ if (sc->statistics.ReceiveCRCErrors != statistics->ReceiveCRCErrors)
+ printf("oltr%d: Receive CRC Errors %lu\n", sc->unit,
+ statistics->ReceiveCRCErrors);
+ if (sc->statistics.ReceiveOverflow != statistics->ReceiveOverflow)
+ printf("oltr%d: Recieve overflows %lu\n", sc->unit,
+ statistics->ReceiveOverflow);
+ if (sc->statistics.TransmitUnderrun != statistics->TransmitUnderrun)
+ printf("oltr%d: Frequency Errors %lu\n", sc->unit,
+ statistics->TransmitUnderrun);
+ bcopy(statistics, &sc->statistics, sizeof(TRlldStatistics_t));
+#endif
+}
+
+static void
+DriverSuspend(unsigned short MicroSeconds)
+{
+ DELAY(MicroSeconds);
+}
+
+
+static void
+DriverStatus(void *DriverHandle, TRlldStatus_t *Status)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle;
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+
+ char *Protocol[] = { /* 0 */ "Unknown",
+ /* 1 */ "TKP",
+ /* 2 */ "TXI" };
+ char *Timeout[] = { /* 0 */ "command",
+ /* 1 */ "transmit",
+ /* 2 */ "interrupt" };
+
+ switch (Status->Type) {
+
+ case TRLLD_STS_ON_WIRE:
+ printf("oltr%d: ring insert (%d Mbps - %s)\n", sc->unit,
+ Status->Specification.OnWireInformation.Speed,
+ Protocol[Status->Specification.OnWireInformation.AccessProtocol]);
+ sc->state = OL_OPEN;
+ wakeup(sc);
+ break;
+ case TRLLD_STS_SELFTEST_STATUS:
+ if (Status->Specification.SelftestStatus == TRLLD_ST_OK) {
+ sc->state = OL_CLOSED;
+ if (bootverbose)
+ printf("oltr%d: self test complete\n", sc->unit);
+ }
+ if (Status->Specification.SelftestStatus & TRLLD_ST_ERROR) {
+ printf("oltr%d: Adapter self test error %d", sc->unit,
+ Status->Specification.SelftestStatus & ~TRLLD_ST_ERROR);
+ sc->state = OL_DEAD;
+ }
+ if (Status->Specification.SelftestStatus & TRLLD_ST_TIMEOUT) {
+ printf("oltr%d: Adapter self test timed out.\n", sc->unit);
+ sc->state = OL_DEAD;
+ }
+ break;
+ case TRLLD_STS_INIT_STATUS:
+ if (Status->Specification.InitStatus == 0x800) {
+ oltr_stop(sc);
+ ifmedia_set(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP16);
+ TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
+ oltr_init(sc);
+ break;
+ }
+ printf("oltr%d: adapter init failure 0x%03x\n", sc->unit,
+ Status->Specification.InitStatus);
+ oltr_stop(sc);
+ break;
+ case TRLLD_STS_RING_STATUS:
+ if (Status->Specification.RingStatus) {
+ printf("oltr%d: Ring status change: ", sc->unit);
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_SIGNAL_LOSS)
+ printf(" [Signal Loss]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_HARD_ERROR)
+ printf(" [Hard Error]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_SOFT_ERROR)
+ printf(" [Soft Error]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_TRANSMIT_BEACON)
+ printf(" [Beacon]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_LOBE_WIRE_FAULT)
+ printf(" [Wire Fault]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_AUTO_REMOVAL_ERROR)
+ printf(" [Auto Removal]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_REMOVE_RECEIVED)
+ printf(" [Remove Received]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_COUNTER_OVERFLOW)
+ printf(" [Counter Overflow]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_SINGLE_STATION)
+ printf(" [Single Station]");
+ if (Status->Specification.RingStatus &
+ TRLLD_RS_RING_RECOVERY)
+ printf(" [Ring Recovery]");
+ printf("\n");
+ }
+ break;
+ case TRLLD_STS_ADAPTER_CHECK:
+ printf("oltr%d: adapter check (%04x %04x %04x %04x)\n", sc->unit,
+ Status->Specification.AdapterCheck[0],
+ Status->Specification.AdapterCheck[1],
+ Status->Specification.AdapterCheck[2],
+ Status->Specification.AdapterCheck[3]);
+ sc->state = OL_DEAD;
+ oltr_stop(sc);
+ break;
+ case TRLLD_STS_PROMISCUOUS_STOPPED:
+ printf("oltr%d: promiscuous mode ", sc->unit);
+ if (Status->Specification.PromRemovedCause == 1)
+ printf("remove received.");
+ if (Status->Specification.PromRemovedCause == 2)
+ printf("poll failure.");
+ if (Status->Specification.PromRemovedCause == 2)
+ printf("buffer size failure.");
+ printf("\n");
+ ifp->if_flags &= ~IFF_PROMISC;
+ break;
+ case TRLLD_STS_LLD_ERROR:
+ printf("oltr%d: low level driver internal error ", sc->unit);
+ printf("(%04x %04x %04x %04x).\n",
+ Status->Specification.InternalError[0],
+ Status->Specification.InternalError[1],
+ Status->Specification.InternalError[2],
+ Status->Specification.InternalError[3]);
+ sc->state = OL_DEAD;
+ oltr_stop(sc);
+ break;
+ case TRLLD_STS_ADAPTER_TIMEOUT:
+ printf("oltr%d: adapter %s timeout.\n", sc->unit,
+ Timeout[Status->Specification.AdapterTimeout]);
+ break;
+ default:
+ printf("oltr%d: driver status Type = %d\n", sc->unit, Status->Type);
+ break;
+
+ }
+ if (Status->Closed) {
+ sc->state = OL_CLOSING;
+ oltr_stop(sc);
+ }
+
+}
+
+static void
+DriverCloseCompleted(void *DriverHandle)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle;
+
+ printf("oltr%d: adapter closed\n", sc->unit);
+ wakeup(sc);
+ sc->state = OL_CLOSED;
+}
+
+static void
+DriverTransmitFrameCompleted(void *DriverHandle, void *FrameHandle, int TransmitStatus)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle;
+ struct ifnet *ifp = &sc->arpcom.ac_if;
+ TRlldTransmit_t *frame = (TRlldTransmit_t *)FrameHandle;
+
+ /*printf("oltr%d: DriverTransmitFrameCompleted\n", sc->unit);*/
+
+ if (TransmitStatus != TRLLD_TRANSMIT_OK) {
+ ifp->if_oerrors++;
+ printf("oltr%d: transmit error %d\n", sc->unit, TransmitStatus);
+ } else {
+ ifp->if_opackets++;
+ }
+
+ sc->tx_avail += frame->FragmentCount;
+
+ if (ifp->if_flags & IFF_OACTIVE) {
+ printf("oltr%d: queue restart\n", sc->unit);
+ ifp->if_flags &= ~IFF_OACTIVE;
+ oltr_start(ifp);
+ }
+
+
+}
+
+static void
+DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount, void *FragmentHandle, int ReceiveStatus)
+{
+ struct oltr_softc *sc = (struct oltr_softc *)DriverHandle;
+ struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if;
+ struct mbuf *m0, *m1, *m;
+ int frame_len = ByteCount, i = (int)FragmentHandle, rc, s;
+ int mbuf_offset, mbuf_size, frag_offset, copy_length;
+ char *fragment = sc->rx_ring[RING_BUFFER(i)].data;
+
+ if (sc->state > OL_CLOSED) {
+ if (ReceiveStatus == TRLLD_RCV_OK) {
+ MGETHDR(m0, M_DONTWAIT, MT_DATA);
+ mbuf_size = MHLEN - 2;
+ if (!m0) {
+ ifp->if_ierrors++;
+ goto dropped;
+ }
+ if (ByteCount + 2 > MHLEN) {
+ MCLGET(m0, M_DONTWAIT);
+ mbuf_size = MCLBYTES - 2;
+ if (!(m0->m_flags & M_EXT)) {
+ m_freem(m0);
+ ifp->if_ierrors++;
+ goto dropped;
+ }
+ }
+ m0->m_pkthdr.rcvif = ifp;
+ m0->m_pkthdr.len = ByteCount;
+ m0->m_len = 0;
+ m0->m_data += 2;
+
+ m = m0;
+ mbuf_offset = 0;
+ frag_offset = 0;
+ while (frame_len) {
+ copy_length = MIN3(frame_len,
+ (RX_BUFFER_LEN - frag_offset),
+ (mbuf_size - mbuf_offset));
+ bcopy(fragment + frag_offset, mtod(m, char *) +
+ mbuf_offset, copy_length);
+ m->m_len += copy_length;
+ mbuf_offset += copy_length;
+ frag_offset += copy_length;
+ frame_len -= copy_length;
+
+ if (frag_offset == RX_BUFFER_LEN) {
+ fragment =
+ sc->rx_ring[RING_BUFFER(++i)].data;
+ frag_offset = 0;
+ }
+ if ((mbuf_offset == mbuf_size) && (frame_len > 0)) {
+ MGET(m1, M_DONTWAIT, MT_DATA);
+ mbuf_size = MHLEN;
+ if (!m1) {
+ ifp->if_ierrors++;
+ m_freem(m0);
+ goto dropped;
+ }
+ if (frame_len > MHLEN) {
+ MCLGET(m1, M_DONTWAIT);
+ mbuf_size = MCLBYTES;
+ if (!(m1->m_flags & M_EXT)) {
+ m_freem(m0);
+ m_freem(m1);
+ ifp->if_ierrors++;
+ goto dropped;
+ }
+ }
+ m->m_next = m1;
+ m = m1;
+ mbuf_offset = 0;
+ m->m_len = 0;
+ }
+ }
+ ifp->if_ipackets++;
+
+ iso88025_input(ifp, m0);
+ } else { /* Receiver error */
+ if (ReceiveStatus != TRLLD_RCV_NO_DATA) {
+ printf("oltr%d: receive error %d\n", sc->unit,
+ ReceiveStatus);
+ ifp->if_ierrors++;
+ }
+ }
+
+dropped:
+ s = splimp();
+ i = (int)FragmentHandle;
+ while (FragmentCount--) {
+ rc = TRlldReceiveFragment(sc->TRlldAdapter,
+ (void *)sc->rx_ring[RING_BUFFER(i)].data,
+ sc->rx_ring[RING_BUFFER(i)].address,
+ RX_BUFFER_LEN, (void *)sc->rx_ring[RING_BUFFER(i)].index);
+ if (rc != TRLLD_RECEIVE_OK) {
+ printf("oltr%d: adapter refused receive fragment %d (rc = %d)\n", sc->unit, i, rc);
+ break;
+ }
+ i++;
+ }
+ (void)splx(s);
+ }
+}
+
+
+/*
+ * ---------------------------- PMW Glue -------------------------------
+ */
+
+#ifndef TRlldInlineIO
+
+static void
+DriverOutByte(unsigned short IOAddress, unsigned char value)
+{
+ outbv(IOAddress, value);
+}
+
+static void
+DriverOutWord(unsigned short IOAddress, unsigned short value)
+{
+ outw(IOAddress, value);
+}
+
+static void
+DriverOutDword(unsigned short IOAddress, unsigned long value)
+{
+ outl(IOAddress, value);
+}
+
+static void
+DriverRepOutByte(unsigned short IOAddress, unsigned char *DataPointer, int ByteCount)
+{
+ outsb(IOAddress, (void *)DataPointer, ByteCount);
+}
+
+static void
+DriverRepOutWord(unsigned short IOAddress, unsigned short *DataPointer, int WordCount)
+{
+ outsw(IOAddress, (void *)DataPointer, WordCount);
+}
+
+static void
+DriverRepOutDword(unsigned short IOAddress, unsigned long *DataPointer, int DWordCount)
+{
+ outsl(IOAddress, (void *)DataPointer, DWordCount);
+}
+
+static unsigned char
+DriverInByte(unsigned short IOAddress)
+{
+ return(inbv(IOAddress));
+}
+
+static unsigned short
+DriverInWord(unsigned short IOAddress)
+{
+ return(inw(IOAddress));
+}
+
+static unsigned long
+DriverInDword(unsigned short IOAddress)
+{
+ return(inl(IOAddress));
+}
+
+static void
+DriverRepInByte(unsigned short IOAddress, unsigned char *DataPointer, int ByteCount)
+{
+ insb(IOAddress, (void *)DataPointer, ByteCount);
+}
+
+static void
+DriverRepInWord(unsigned short IOAddress, unsigned short *DataPointer, int WordCount)
+{
+ insw(IOAddress, (void *)DataPointer, WordCount);
+}
+static void
+DriverRepInDword( unsigned short IOAddress, unsigned long *DataPointer, int DWordCount)
+{
+ insl(IOAddress, (void *)DataPointer, DWordCount);
+}
+#endif /* TRlldInlineIO */
diff --git a/sys/contrib/dev/oltr/trlld.h b/sys/contrib/dev/oltr/trlld.h
new file mode 100644
index 0000000..988cf35
--- /dev/null
+++ b/sys/contrib/dev/oltr/trlld.h
@@ -0,0 +1,902 @@
+/*
+ ****************************** trlld.h ***********************************
+ *
+ * Copyright (c) 1997
+ * OLICOM A/S
+ * Denmark
+ *
+ * All Rights Reserved
+ *
+ * This source file is subject to the terms and conditions of the
+ * OLICOM Software License Agreement which restricts the manner
+ * in which it may be used.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Description: PowerMACH Works header file
+ * $FreeBSD$
+ *
+ *---------------------------------------------------------------------------
+ * $Log: J:/usr/project/trlld/libsrc/include/trlld.h_v $
+ *
+ * Rev 1.9 25 Jan 1999 09:56:28 EGS
+ * Added 3150
+ *
+ * Rev 1.8 10 Dec 1998 12:24:52 JHM
+ * version 1.2.0,prominfo structure with shorts.
+ *
+ * Rev 1.7 25 Nov 1998 16:18:48 JHM
+ * Bullseye mac, 100MBPS, mactype in config structure,
+ * 3540 adapter, TRlldTransmitFree, TRlldReceiveFree,
+ * TRlldAdapterName
+ *
+ * Rev 1.6 23 Oct 1998 16:00:36 JHM
+ * hawkeye adapter types
+ *
+ * Rev 1.5 11 Aug 1998 12:22:06 JHM
+ * split hawkeye types into PCI4,5,6
+ *
+ * Rev 1.4 10 Jul 1998 14:39:22 JHM
+ * OC_3140,OC_3250
+ *
+ * Rev 1.3 18 Jun 1998 11:32:20 JHM
+ * AddMemory,OC_3250
+ *
+ * Rev 1.2 18 Apr 1998 15:11:20 JHM
+ *
+ * Rev 1.1 09 Dec 1997 18:17:52 JHM
+ * rel111: TRlldDataPtr_t
+ *
+ * Rev 1.0 24 Nov 1997 11:08:58 JHM
+ * Initial revision.
+
+ Rev 1.5 18 Jun 1997 11:31:36 JHM
+ Checks for version
+
+ Rev 1.4 13 Jun 1997 13:47:34 JHM
+
+ Rev 1.3 13 Jun 1997 13:27:56 JHM
+ DTR support, version change
+
+ Rev 1.2 12 Jun 1997 11:43:20 JHM
+ TRLLD_INTERRUPT_TIMEOUT defined
+
+ Rev 1.1 11 Apr 1997 15:24:18 JHM
+ replaced tabs with spaces
+
+ Rev 1.0 11 Apr 1997 14:43:04 JHM
+ Initial revision.
+ *
+ ****************************************************************************
+*/
+
+#ifndef TRLLD_H
+#define TRLLD_H
+
+/* Data buffer pointers are always 32 bits.
+ For 16:16 it is segment:offset while it for 32:32 is a linear address. */
+
+#ifdef TRlldSmall
+#define TRlldDataPtr_t unsigned char far *
+#define TRlldWordDataPtr_t unsigned short far *
+#define TRlldDWordDataPtr_t unsigned long far *
+#else
+#define TRlldDataPtr_t unsigned char *
+#define TRlldWordDataPtr_t unsigned short *
+#define TRlldDWordDataPtr_t unsigned long *
+#endif
+
+#ifdef __WATCOMC__
+#define CDECL _cdecl
+#else
+#define CDECL
+#endif
+
+/*****************************************************************************/
+/* */
+/* Firmware */
+/* */
+/*****************************************************************************/
+
+extern unsigned char TRlldMacCode[]; /* 3115,17,18,29,33,36,37 */
+extern unsigned char TRlldHawkeyeMac[]; /* 3139,3140,3141,3250 */
+extern unsigned char TRlldBullseyeMac[]; /* 3150,3540 */
+
+/*****************************************************************************/
+/* */
+/* Maximal numbers of concurrent receive and transmit slots */
+/* */
+/*****************************************************************************/
+
+#define TRLLD_MAX_RECEIVE 32
+#define TRLLD_MAX_TRANSMIT 32
+
+/*****************************************************************************/
+/* */
+/* Maximal frame sizes */
+/* */
+/*****************************************************************************/
+
+#define TRLLD_MAXFRAME_100MBPS 18000
+#define TRLLD_MAXFRAME_16MBPS 18000
+#define TRLLD_MAXFRAME_4MBPS 4500
+
+/*****************************************************************************/
+/* */
+/* TRlldStatus contains the adapter status used in a DriverStatus call-back. */
+/* */
+/*****************************************************************************/
+
+struct OnWireInformation {
+ unsigned short RingStatus;
+ unsigned short Speed;
+ unsigned short AccessProtocol;
+ unsigned short Reserved;
+};
+
+typedef struct TRlldStatus {
+ unsigned short Type;
+ unsigned char Closed;
+ unsigned char AccessProtocol;
+ unsigned short MaxFrameSize;
+ unsigned short Reserved;
+ union {
+ unsigned short OnWireRingStatus; /* for compability */
+ unsigned short SelftestStatus;
+ unsigned short InitStatus;
+ unsigned short RingStatus;
+ unsigned short AdapterCheck[4];
+ unsigned short InternalError[4];
+ unsigned short PromRemovedCause;
+ unsigned short AdapterTimeout;
+ struct OnWireInformation OnWireInformation;
+ } Specification;
+} TRlldStatus_t;
+
+/* values of TRlldStatus.Type */
+
+#define TRLLD_STS_ON_WIRE 0
+#define TRLLD_STS_SELFTEST_STATUS 1
+#define TRLLD_STS_INIT_STATUS 2
+#define TRLLD_STS_RING_STATUS 3
+#define TRLLD_STS_ADAPTER_CHECK 4
+#define TRLLD_STS_PROMISCUOUS_STOPPED 5
+#define TRLLD_STS_LLD_ERROR 6
+#define TRLLD_STS_ADAPTER_TIMEOUT 7
+
+/* values of TRlldStatus.Closed */
+
+#define TRLLD_STS_STATUS_OK 0
+#define TRLLD_STS_STATUS_CLOSED 1
+
+/* values of TRlldStatus.AccessProtocol */
+
+#define TRLLD_ACCESS_UNKNOWN 0
+#define TRLLD_ACCESS_TKP 1
+#define TRLLD_ACCESS_TXI 2
+
+/* values of TRlldStatus.SelftestStatus */
+
+#define TRLLD_ST_OK 0
+#define TRLLD_ST_ERROR 0x0100 /* actual errors are 010x, where x is */
+ /* 0: Initial Test Error */
+ /* 1: Adapter Software Checksum Error */
+ /* 2: Adapter RAM Error */
+ /* 4: Instruction Test Error */
+ /* 5: Protocol Handler/RI Hw Error */
+ /* 6: System Interface Register Error */
+
+#define TRLLD_ST_TIMEOUT 0x0200 /* The adapter did not complete */
+ /* selftest after download */
+
+/* values of TRlldStatus.Specification.InitStatus */
+
+/* the most likely cause of an init error (whatever the code) is a wrong */
+/* physical or virtual address of the adapter block in TRlldAdapterInit */
+
+#define TRLLD_INIT_ERROR 0x100 /* actual errors are 010x, where x is */
+ /* 1: Invalid init block (LLD error) */
+ /* 2: Invalid options (LLD error) */
+ /* 3: Invalid rcv burst (LLD error) */
+ /* 4: Invalid xmt burst (LLD error) */
+ /* 5: Invalid DMA threshold (LLDerror)*/
+ /* 6: Invalid scb addr */
+ /* 7: Invalid ssb addr */
+ /* 8: DIO parity error (HW error) */
+ /* 9: DMA timeout (May be interrupt
+ failing if PIO mode or PCI2) */
+ /* A: DMA parity error (HW error) */
+ /* B: DMA bus error (HW error) */
+ /* C: DMA data error */
+ /* D: Adapter check */
+
+#define TRLLD_INIT_TIMEOUT 0x200 /* adapter init did not complete */
+#define TRLLD_INIT_DMA_ERROR 0x300 /* adapter cannot access sys memory */
+#define TRLLD_INIT_INTR_ERROR 0x400 /* adapter cannot interrupt */
+#define TRLLD_OPEN_TIMEOUT 0x500 /* adapter open did not complete */
+ /* within 30 seconds */
+
+#define TRLLD_OPEN_ERROR 0x600 /* actual errors are 06xx, where the */
+ /* bits in x mean: */
+ /* 01: Invalid open options (LLDerror)*/
+ /* 04: TxBuffer count error (LLDerror)*/
+ /* 10: Buffer size error (LLD error) */
+ /* 20: List size error (LLD error) */
+ /* 40: Node address error */
+
+#define TRLLD_OPEN_REPEAT 0x700 /* actual errors are 07xy, where */
+ /* x is the open phase: */
+ /* 1: Lobe media test */
+ /* 2: Physical Insertion */
+ /* 3: Address verification */
+ /* 4: Participation in ring poll */
+ /* 5: Request Initialization */
+ /* 9: Request registration (TXI) */
+ /* A: Lobe Media Test (TXI) */
+ /* B: Address verification (TXI) */
+ /* y is the type of error: */
+ /* 1: Function failure (No Cable ?) */
+ /* 2: Signal loss */
+ /* 5: Timeout */
+ /* 6: Ring failure (TKP) */
+ /* 6: Protocol error (TXI) */
+ /* 7: Ring beaconing */
+ /* 8: Duplicate Node Address (TKP) */
+ /* 8: Insert Denied (TXI) */
+ /* 9: Request Initialization (TKP) */
+ /* 9: Heart beat failure (TXI) */
+ /* A: Remove received */
+ /* B: C-port address changed (TXI) */
+ /* C: Wire Fault (TKP) */
+ /* D: Auto Speed, 1. on ring (TKP) */
+ /* E: Speed sense failed */
+
+/* When opening with FORCE_TXI and only classic token ring attachment is */
+/* possible, the error is Request Registration/Timeout or 0x795 */
+
+#define TRLLD_OPEN_1ST_ON_RING 0x800 /* Speed sense is active, but no other*/
+ /* station is present to set the speed*/
+
+
+/* values of TRlldStatus.Specification.RingStatus */
+
+#define TRLLD_RS_SIGNAL_LOSS 0x8000
+#define TRLLD_RS_HARD_ERROR 0x4000
+#define TRLLD_RS_SOFT_ERROR 0x2000
+#define TRLLD_RS_TRANSMIT_BEACON 0x1000
+#define TRLLD_RS_LOBE_WIRE_FAULT 0x0800
+#define TRLLD_RS_AUTO_REMOVAL_ERROR 0x0400
+#define TRLLD_RS_REMOVE_RECEIVED 0x0100
+#define TRLLD_RS_COUNTER_OVERFLOW 0x0080
+#define TRLLD_RS_SINGLE_STATION 0x0040
+#define TRLLD_RS_RING_RECOVERY 0x0020
+
+/* values of TRlldStatus.Specification.AdapterCheck */
+/* MISSING */
+
+/* values of TRlldStatus.Specification.PromRemovedCause */
+
+#define TRLLD_PROM_REMOVE_RECEIVED 1
+#define TRLLD_PROM_POLL_FAILURE 2
+#define TRLLD_PROM_BUFFER_SIZE 3
+
+/* values of TRlldStatus.Specification.InternalError */
+
+#define TRLLD_INTERNAL_PIO 1 /* A PIO transfer to or from adapter */
+ /* did not complete */
+#define TRLLD_INTERNAL_TX 2 /* Trouble with clean up of tx frames */
+#define TRLLD_INTERNAL_RX 3 /* Trouble with clean up of receive */
+ /* fragments */
+#define TRLLD_INTERNAL_CMD 4 /* error response from adapter */
+#define TRLLD_INTERNAL_STATE 5 /* event happened in unexpected state */
+
+/* values of TRlldStatus.Specification.AdapterTimeout */
+
+#define TRLLD_COMMAND_TIMEOUT 1
+#define TRLLD_TRANSMIT_TIMEOUT 2
+#define TRLLD_INTERRUPT_TIMEOUT 3
+
+
+/*****************************************************************************/
+/* */
+/* TRlldStatistics contains the adapter statistics returned to Driver */
+/* in TRlldStatistics calls and DriverStatistics call-backs */
+/* */
+/*****************************************************************************/
+
+typedef struct TRlldStatistics {
+ unsigned long LineErrors;
+ unsigned long InternalErrors; /* Not maintained by TMS based boards */
+ unsigned long BurstErrors;
+ unsigned long ARIFCIErrors;
+ unsigned long AbortDelimiters; /* Not maintained by TMS based boards */
+ unsigned long LostFrames;
+ unsigned long CongestionErrors;
+ unsigned long FrameCopiedErrors;
+ unsigned long FrequencyErrors; /* Not maintained by TMS based boards */
+ unsigned long TokenErrors;
+ unsigned long DMABusErrors; /* Not maintained by 3139 */
+ unsigned long DMAParityErrors; /* Not maintained by 3139 */
+ unsigned long ReceiveLongFrame; /* Not maintained by TMS based boards */
+ unsigned long ReceiveCRCErrors; /* Not maintained by TMS based boards */
+ unsigned long ReceiveOverflow; /* Not maintained by TMS based boards */
+ unsigned long TransmitUnderrun; /* Not maintained by TMS based boards */
+ unsigned long UnderrunLock; /* Not maintained by TMS based boards */
+ unsigned long OverflowReset;
+ unsigned char UpstreamNeighbour[6];
+ unsigned short RingNumber;
+ unsigned char BeaconingUpstreamNeighbour[6];
+ unsigned short padding;
+} TRlldStatistics_t;
+
+
+/*****************************************************************************/
+/* */
+/* TRlldDriver contains the Driver call-backs */
+/* */
+/*****************************************************************************/
+
+typedef struct TRlldDriver {
+ unsigned long TRlldVersion;
+#ifndef TRlldInlineIO
+ void (CDECL * DriverOutByte)(unsigned short IOAddress,
+ unsigned char Value);
+ void (CDECL * DriverOutWord)(unsigned short IOAddress,
+ unsigned short Value);
+ void (CDECL * DriverOutDWord)(unsigned short IOAddress,
+ unsigned long Value);
+ void (CDECL * DriverRepOutByte)(unsigned short IOAddress,
+ TRlldDataPtr_t DataPointer,
+ int ByteCount);
+ void (CDECL * DriverRepOutWord)(unsigned short IOAddress,
+ TRlldWordDataPtr_t DataPointer,
+ int WordCount);
+ void (CDECL * DriverRepOutDWord)(unsigned short IOAddress,
+ TRlldDWordDataPtr_t DataPointer,
+ int DWordCount);
+ unsigned char (CDECL * DriverInByte)(unsigned short IOAddress);
+ unsigned short (CDECL * DriverInWord)(unsigned short IOAddress);
+ unsigned long (CDECL * DriverInDWord)(unsigned short IOAddress);
+ void (CDECL * DriverRepInByte)(unsigned short IOAddress,
+ TRlldDataPtr_t DataPointer,
+ int ByteCount);
+ void (CDECL * DriverRepInWord)(unsigned short IOAddress,
+ TRlldWordDataPtr_t DataPointer,
+ int WordCount);
+ void (CDECL * DriverRepInDWord)(unsigned short IOAddress,
+ TRlldDWordDataPtr_t DataPointer,
+ int DWordCount);
+#endif
+ void (CDECL * DriverSuspend)(unsigned short MicroSeconds);
+ void (CDECL * DriverStatus)(void * DriverHandle,
+ TRlldStatus_t * Status);
+ void (CDECL * DriverCloseCmpltd)(void * DriverHandle);
+ void (CDECL * DriverStatistics)(void * DriverHandle,
+ TRlldStatistics_t * Statistics);
+ void (CDECL * DriverTxFrameCmpltd)(void * DriverHandle,
+ void * FrameHandle,
+ int TxStatus);
+ void (CDECL * DriverRcvFrameCmpltd)(void * DriverHandle,
+ int ByteCount,
+ int FragmentCount,
+ void * FragmentHandle,
+ int RcvStatus);
+} TRlldDriver_t;
+
+/* Version and model control */
+
+#define TRLLD_VERSION_INLINEIO 0x8000
+#define TRLLD_VERSION_SMALL 0x4000
+#ifdef TRlldInlineIO
+#ifdef TRlldSmall
+#define TRLLD_VERSION 0x4120
+#else
+#define TRLLD_VERSION 0x0120
+#endif
+#else
+#ifdef TRlldSmall
+#define TRLLD_VERSION 0xC120
+#else
+#define TRLLD_VERSION 0x8120
+#endif
+#endif
+
+
+/*****************************************************************************/
+/* */
+/* TRlldAdapterConfig contains the properties found for an adapter */
+/* used when finding and defining adapters to use */
+/* */
+/*****************************************************************************/
+
+
+struct pnp_id {
+ unsigned short vendor;
+ unsigned short device;
+};
+
+struct pci_id {
+ unsigned short vendor;
+ unsigned short device;
+ unsigned char revision;
+ unsigned char reserved_byte;
+ unsigned short reserved_word;
+};
+
+struct pcmcia_id {
+ /* unknown as yet */
+ unsigned char x;
+};
+
+struct pci_slot {
+ unsigned short bus_no;
+ unsigned short device_no;
+};
+
+struct pcmcia_socket {
+ /* unknown as yet */
+ unsigned char x;
+};
+
+typedef struct TRlldAdapterConfig {
+ unsigned char type;
+ unsigned char bus;
+ unsigned short magic;
+ union {
+ struct pnp_id pnp;
+ unsigned long eisa;
+ unsigned short mca;
+ struct pci_id pci;
+ struct pcmcia_id pcmcia;
+ } id;
+ union {
+ unsigned short csn;
+ unsigned short eisa;
+ unsigned short mca;
+ struct pci_slot pci;
+ struct pcmcia_socket pcmcia;
+ } slot;
+ unsigned short iobase0;
+ unsigned short iolength0;
+ unsigned short iobase1;
+ unsigned short iolength1;
+ unsigned long memorybase;
+ unsigned short memorylength;
+ unsigned char mode;
+ unsigned char xmode;
+ unsigned char interruptlevel;
+ unsigned char dmalevel;
+ unsigned char macaddress[6];
+ unsigned long prombase;
+ unsigned char speed;
+ unsigned char cachelinesize;
+ unsigned short pcicommand;
+ unsigned char mactype;
+ unsigned char reserved[3];
+} TRlldAdapterConfig_t;
+
+/* values of TRlldAdapterConfig.Type */
+
+#define TRLLD_ADAPTER_XT 0 /* not supported */
+#define TRLLD_ADAPTER_ISA1 1 /* OC-3115 */
+#define TRLLD_ADAPTER_ISA2 2 /* OC-3117 */
+#define TRLLD_ADAPTER_ISA3 3 /* OC-3118 */
+#define TRLLD_ADAPTER_MCA1 4 /* OC-3129 id A84 */
+#define TRLLD_ADAPTER_MCA2 5 /* OC-3129 id A85 */
+#define TRLLD_ADAPTER_MCA3 6 /* OC-3129 id A86 */
+#define TRLLD_ADAPTER_EISA1 7 /* OC-3133 id 0109833D */
+#define TRLLD_ADAPTER_EISA2 8 /* OC-3133 id 0209833D */
+#define TRLLD_ADAPTER_EISA3 9 /* OC-3135 not supported */
+#define TRLLD_ADAPTER_PCI1 10 /* OC-3136 id 108d0001 rev 1 */
+#define TRLLD_ADAPTER_PCI2 11 /* OC-3136 id 108d0001 rev 2 */
+#define TRLLD_ADAPTER_PCI3 12 /* OC-3137 id 108d0001 rev 3 */
+#define TRLLD_ADAPTER_PCI4 13 /* OC-3139 id 108d0004 rev 2 */
+#define TRLLD_ADAPTER_PCI5 14 /* OC-3140 id 108d0004 rev 3 */
+#define TRLLD_ADAPTER_PCI6 15 /* OC-3141 id 108d0007 rev 1 */
+#define TRLLD_ADAPTER_PCI7 19 /* OC-3540 id 108d0008 rev 1 */
+#define TRLLD_ADAPTER_PCI8 20 /* OC-3150 id 108d000a rev 1 */
+#ifdef PCMCIA
+#define TRLLD_ADAPTER_PCCARD1 16 /* OC-3220 */
+#define TRLLD_ADAPTER_PCCARD2 17 /* OC-3221,OC-3230,OC-3232 */
+#endif
+#define TRLLD_ADAPTER_PCCARD3 18 /* OC-3250 id 108d0005 rev 1 */
+
+/* values of TRlldAdapterConfig.Bus */
+
+#define TRLLD_BUS_ISA 1
+#define TRLLD_BUS_EISA 2
+#define TRLLD_BUS_MCA 3
+#define TRLLD_BUS_PCI 4
+#define TRLLD_BUS_PCMCIA 5
+
+/* values of TRlldAdapterConfig.mode */
+
+#define TRLLD_MODE_16M 0x01 /* needs data buffers below 16 M */
+#define TRLLD_MODE_PHYSICAL 0x02 /* needs valid physical addresses */
+#define TRLLD_MODE_FIXED_CFG 0x04 /* cannot be reconfigured */
+#define TRLLD_MODE_SHORT_SLOT 0x08 /* in short ISA slot, cannot use DMA */
+#define TRLLD_MODE_CANNOT_DISABLE 0x10 /* can not disable interrupt */
+#define TRLLD_MODE_SHARE_INTERRUPT 0x20 /* may share interrupt */
+#define TRLLD_MODE_MEMORY 0x40 /* is configured with a memory window*/
+
+/* values of TRlldAdapterConfig.dma */
+
+#define TRLLD_DMA_PIO 4 /* other values signifies the DMA channel */
+#define TRLLD_DMA_MASTER 0xff /* to use */
+
+/* values of TRlldAdapterConfig.mactype */
+
+ /* download with: */
+#define TRLLD_MAC_TMS 1 /* TRlldMACCode */
+#define TRLLD_MAC_HAWKEYE 2 /* TRlldHawkeyeMAC */
+#define TRLLD_MAC_BULLSEYE 3 /* TRlldBullseyeMAC */
+
+
+typedef void * TRlldAdapter_t;
+typedef void * TRlldAdapterType_t;
+
+#ifndef MAX_FRAGMENTS
+#define MAX_FRAGMENTS 32
+#endif
+
+typedef struct TRlldTransmit {
+ unsigned short FragmentCount;
+ unsigned short TRlldTransmitReserved;
+ struct TRlldTransmitFragment {
+ unsigned long PhysicalAddress;
+ TRlldDataPtr_t VirtualAddress;
+ unsigned short count;
+ unsigned short TRlldTransmitFragmentReserved;
+ } TransmitFragment[MAX_FRAGMENTS];
+} TRlldTransmit_t;
+
+int CDECL TRlldAdapterSize(void);
+
+int CDECL TRlldInit(int TypeCount,
+ TRlldAdapterType_t * AdapterTypeTable);
+
+extern TRlldAdapterType_t CDECL TRlld3115; /* ISA adapters */
+extern TRlldAdapterType_t CDECL TRlld3117;
+extern TRlldAdapterType_t CDECL TRlld3118;
+extern TRlldAdapterType_t CDECL TRlld3129; /* MCA adapters */
+extern TRlldAdapterType_t CDECL TRlld3133; /* EISA adapters */
+extern TRlldAdapterType_t CDECL TRlld3136; /* PCI adapters */
+extern TRlldAdapterType_t CDECL TRlld3137;
+extern TRlldAdapterType_t CDECL TRlld3139; /* Hawkeye adapters */
+extern TRlldAdapterType_t CDECL TRlld3540; /* Bullseye adapters */
+
+#define T3115 &TRlld3115
+#define T3117 &TRlld3117
+#define T3118 &TRlld3118
+#define T3129 &TRlld3129
+#define T3133 &TRlld3133
+#define T3136 &TRlld3136
+#define T3137 &TRlld3137
+#define T3139 &TRlld3139
+#define T3540 &TRlld3540
+
+/* Only for Boot Prom Page Zero code */
+
+extern TRlldAdapterType_t CDECL TRlld3115Boot; /* ISA adapters */
+extern TRlldAdapterType_t CDECL TRlld3117Boot;
+extern TRlldAdapterType_t CDECL TRlld3118Boot;
+extern TRlldAdapterType_t CDECL TRlld3129Boot; /* MCA adapters */
+extern TRlldAdapterType_t CDECL TRlld3133Boot; /* EISA adapters */
+extern TRlldAdapterType_t CDECL TRlld3136Boot; /* PCI adapters */
+extern TRlldAdapterType_t CDECL TRlld3137Boot;
+extern TRlldAdapterType_t CDECL TRlld3139Boot; /* Hawkeye adapters */
+extern TRlldAdapterType_t CDECL TRlld3150Boot;
+extern TRlldAdapterType_t CDECL TRlld3250Boot;
+extern TRlldAdapterType_t CDECL TRlld3540Boot; /* Bullseye adapter */
+
+#define B3115 &TRlld3115Boot
+#define B3117 &TRlld3117Boot
+#define B3118 &TRlld3118Boot
+#define B3129 &TRlld3129Boot
+#define B3133 &TRlld3133Boot
+#define B3136 &TRlld3136Boot
+#define B3137 &TRlld3137Boot
+#define B3139 &TRlld3139Boot
+#define B3150 &TRlld3150Boot
+#define B3250 &TRlld3250Boot
+#define B3540 &TRlld3540Boot
+
+#define TRLLD_INIT_OK 0
+#define TRLLD_INIT_UNKNOWN 5
+
+int CDECL TRlldAdapterInit(TRlldDriver_t * DriverDefinition,
+ TRlldAdapter_t * TRlldAdapter,
+ unsigned long TRlldAdapterPhysical,
+ void * DriverHandle,
+ TRlldAdapterConfig_t * config);
+
+#define TRLLD_INIT_OK 0
+#define TRLLD_INIT_NOT_FOUND 1
+#define TRLLD_INIT_UNSUPPORTED 2
+#define TRLLD_INIT_PHYS16 3
+#define TRLLD_INIT_VERSION 4
+
+int CDECL TRlldSetSpeed(TRlldAdapter_t * adapter,
+ unsigned char speed);
+
+#define TRLLD_SPEED_4MBPS 4
+#define TRLLD_SPEED_16MBPS 16
+#define TRLLD_SPEED_100MBPS 100
+
+int CDECL TRlldSetInterrupt(TRlldAdapter_t * adapter,
+ unsigned char interruptlevel);
+
+int CDECL TRlldSetDMA(TRlldAdapter_t * adapter,
+ unsigned char dma, unsigned char * mode);
+
+#define TRLLD_CONFIG_OK 0
+#define TRLLD_CONFIG_STATE 1
+#define TRLLD_CONFIG_ILLEGAL 2
+#define TRLLD_CONFIG_FAILED 3
+
+int CDECL TRlldSetSpecial(TRlldAdapter_t * adapter,
+ unsigned short param1, unsigned short param2,
+ unsigned short param3, unsigned short param4);
+
+int CDECL TRlldAddMemory(TRlldAdapter_t * adapter,
+ TRlldDataPtr_t virtual,
+ unsigned long physical,
+ long size);
+
+int CDECL TRlldDisable(TRlldAdapter_t * adapter);
+
+#define TRLLD_OK 0
+#define TRLLD_NOT_SUPPORTED 1
+
+void CDECL TRlldEnable(TRlldAdapter_t * adapter);
+
+int CDECL TRlldInterruptPresent(TRlldAdapter_t * adapter);
+
+#define TRLLD_NO_INTERRUPT 0
+#define TRLLD_INTERRUPT 1
+
+int CDECL TRlldInterruptService(TRlldAdapter_t * adapter);
+
+int CDECL TRlldInterruptPreService(TRlldAdapter_t * adapter);
+
+void CDECL TRlldInterruptPostService(TRlldAdapter_t * adapter);
+
+
+int CDECL TRlldPoll(TRlldAdapter_t * adapter);
+
+int CDECL TRlldDownload(TRlldAdapter_t * adapter,
+ char * DownLoadCode);
+
+#define TRLLD_DOWNLOAD_OK 0
+#define TRLLD_DOWNLOAD_ERROR 1
+#define TRLLD_STATE 2
+
+typedef int (CDECL * GetCode_t)(void * handle, unsigned char * maccodebyte);
+
+int CDECL TRlldStreamDownload(TRlldAdapter_t * adapter,
+ GetCode_t procedure, void * handle);
+
+int CDECL TRlldOpen(TRlldAdapter_t * adapter,
+ unsigned char * MACAddress,
+ unsigned long GroupAddress,
+ unsigned long FunctionalAddress,
+ unsigned short MaxFrameSize,
+ unsigned short OpenModes);
+
+#define TRLLD_OPEN_OK 0
+#define TRLLD_OPEN_STATE 1
+#define TRLLD_OPEN_ADDRESS_ERROR 2
+#define TRLLD_OPEN_MODE_ERROR 3
+#define TRLLD_OPEN_MEMORY 4
+
+#define TRLLD_MODE_TX_STATUS 0x01
+#define TRLLD_MODE_RX_SINGLE 0x02
+#define TRLLD_MODE_FORCE_TKP 0x04
+#define TRLLD_MODE_FORCE_TXI 0x08
+#define TRLLD_MODE_TX_CRC 0x10
+
+void CDECL TRlldClose(TRlldAdapter_t * adapter, int immediate);
+
+void CDECL TRlldSetGroupAddress(TRlldAdapter_t * adapter,
+ unsigned long GroupAddress);
+
+void CDECL TRlldSetFunctionalAddress(TRlldAdapter_t * adapter,
+ unsigned long FunctionalAddress);
+
+void CDECL TRlldSetPromiscuousMode(TRlldAdapter_t * adapter,
+ unsigned char mode);
+
+/* mode bits */
+
+#define TRLLD_PROM_LLC 1
+#define TRLLD_PROM_MAC 2
+#define TRLLD_PROM_ERRORFRAMES 4
+
+int CDECL TRlldGetStatistics(TRlldAdapter_t * adapter,
+ TRlldStatistics_t * statistics,
+ int immediate);
+
+#define TRLLD_IMMEDIATE_STATISTICS 1
+
+#define TRLLD_STATISTICS_RETRIEVED 0
+#define TRLLD_STATISTICS_PENDING 1
+
+int CDECL TRlldTransmitFrame(TRlldAdapter_t * adapter,
+ TRlldTransmit_t * TransmitFrame,
+ void * FrameHandle);
+
+#define TRLLD_TRANSMIT_OK 0
+#define TRLLD_TRANSMIT_NOT_OPEN 1
+#define TRLLD_TRANSMIT_TOO_MANY 2
+#define TRLLD_TRANSMIT_MAX16 3
+#define TRLLD_TRANSMIT_SIZE 4
+#define TRLLD_TRANSMIT_EMPTY 5
+
+/* completion flags */
+
+#define TRLLD_TX_OK 0
+#define TRLLD_TX_NOT_PROCESSED 1
+#define TRLLD_TX_NOT_RECOGNIZED 2
+#define TRLLD_TX_NOT_COPIED 3
+
+/* number of free transmit fragments */
+
+int CDECL TRlldTransmitFree(TRlldAdapter_t * adapter);
+
+int CDECL TRlldReceiveFragment(TRlldAdapter_t * adapter,
+ TRlldDataPtr_t FragmentStart,
+ unsigned long FragmentPhysical,
+ int count,
+ void * FragmentHandle);
+
+#define TRLLD_RECEIVE_OK 0
+#define TRLLD_RECEIVE_NOT_OPEN 1
+#define TRLLD_RECEIVE_TOO_MANY 2
+#define TRLLD_RECEIVE_SIZE 3
+#define TRLLD_RECEIVE_MAX16 4
+
+/* completion flags */
+
+#define TRLLD_RCV_OK 0
+#define TRLLD_RCV_NO_DATA 1
+#define TRLLD_RCV_ERROR 2 /* Only when TRLLD_PROM_ERRORFRAMES */
+#define TRLLD_RCV_LONG 3
+
+/* number of free receive fragments */
+
+int CDECL TRlldReceiveFree(TRlldAdapter_t * adapter);
+
+int CDECL TRlldFind(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config_table,
+ unsigned long type_mask,
+ int max);
+
+/* type mask bits */
+
+#define OC_3115 0x0001
+#define OC_3117 0x0002
+#define OC_3118 0x0004
+#define OC_3129 0x0008
+#define OC_3133 0x0010
+#define OC_3136 0x0040
+#define OC_3137 0x0080
+#define OC_3139 0x0100
+#define OC_3140 0x0200
+#define OC_3141 0x0400
+#define OC_3540 0x0800
+#define OC_3150 0x1000
+
+#ifdef PCMCIA
+#define OC_3220 0x0800
+#define OC_3221 0x1000
+#define OC_3230 0x2000
+#define OC_3232 0x4000
+#endif
+
+#define OC_3250 0x8000
+
+int CDECL TRlldIOAddressConfig(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config,
+ unsigned short address);
+
+
+#define TRLLD_FIND_OK 1
+#define TRLLD_FIND_ERROR 0
+#define TRLLD_FIND_VERSION -1
+
+int CDECL TRlldEISASlotConfig(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config,
+ int slot);
+
+int CDECL TRlldMCASlotConfig(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config,
+ int slot);
+
+int CDECL TRlldPCIConfig(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config,
+ char * PCIConfigurationSpace);
+
+#define TRLLD_PCICONFIG_OK 0
+#define TRLLD_PCICONFIG_FAIL 1
+#define TRLLD_PCICONFIG_SET_COMMAND 2
+#define TRLLD_PCICONFIG_VERSION 3
+
+
+int CDECL TRlldFindPCI(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config_table,
+ unsigned long type_mask,
+ int max);
+
+#ifdef PCMCIA
+typedef void * PCCardHandle_t;
+
+typedef int (CDECL * GetTupleData_t)(PCCardHandle_t handle,
+ unsigned short TupleIdent,
+ char * TupleData,
+ int length);
+
+int CDECL TRlldPCCardConfig(TRlldDriver_t * driver,
+ TRlldAdapterConfig_t * config,
+ unsigned short address,
+ int irq,
+ GetTupleData_t GetTuple,
+ PCCardHandle_t handle);
+
+#define TRLLD_PCCARD_CONFIG_OK 0
+#define TRLLD_PCCARD_CONFIG_FAIL 1
+#endif
+
+/* Boot Prom Support */
+
+typedef struct TRlldPromInfo {
+ unsigned short PromIdent;
+ short PromPages;
+ short PromPageSize;
+} TRlldPromInfo_t;
+
+int CDECL TRlldMapBootProm(TRlldAdapter_t * adapter,
+ TRlldDataPtr_t prompointer);
+
+#define TRLLD_PROM_OK 0
+#define TRLLD_PROM_FAILED 3
+
+int CDECL TRlldGetPromInfo(TRlldAdapter_t * adapter, TRlldPromInfo_t * info);
+
+#define TRLLD_PROM_OK 0
+#define TRLLD_PROM_NOT_MOUNTED 1
+#define TRLLD_PROM_NOT_MAPPED 2
+
+void CDECL TRlldSetPromPage(TRlldAdapter_t * adapter, int page);
+
+int CDECL TRlldSetMemoryUse(TRlldAdapter_t * adapter, int use);
+
+#define TRLLD_PROM_TO_MEMORY 0
+#define TRLLD_REGISTERS_TO_MEMORY 1
+
+#define TRLLD_MEMORY_USE_OK 0
+#define TRLLD_MEMORY_USE_NO_MEMORY 1
+#define TRLLD_MEMORY_USE_STATE 2
+#define TRLLD_MEMORY_USE_ILLEGAL 3
+
+int CDECL TRlldPromErase(TRlldAdapter_t * adapter,
+ void (CDECL * delay)(int milliseconds));
+
+#define TRLLD_PROM_OK 0
+#define TRLLD_PROM_NOT_MOUNTED 1
+#define TRLLD_PROM_NOT_MAPPED 2
+#define TRLLD_PROM_FAILED 3
+
+int CDECL TRlldPromWrite(TRlldAdapter_t * adapter, char * data,
+ int offset, int count);
+
+#define TRLLD_PROM_OK 0
+#define TRLLD_PROM_NOT_MOUNTED 1
+#define TRLLD_PROM_NOT_MAPPED 2
+#define TRLLD_PROM_FAILED 3
+#define TRLLD_PROM_ILLEGAL 4
+
+void CDECL TRlldEmergency(TRlldAdapter_t * adapter);
+
+/* Convert from TRlldAdapterConfig.type to name string */
+char * CDECL TRlldAdapterName(int type);
+#endif
diff --git a/sys/contrib/dev/oltr/trlldbm.c b/sys/contrib/dev/oltr/trlldbm.c
new file mode 100644
index 0000000..944606d
--- /dev/null
+++ b/sys/contrib/dev/oltr/trlldbm.c
@@ -0,0 +1,2690 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 1997
+ * OLICOM A/S
+ * Denmark
+ *
+ * All Rights Reserved
+ *
+ * This source file is subject to the terms and conditions of the
+ * OLICOM Software License Agreement which restricts the manner
+ * in which it may be used.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Description: Olicom adapter micro-code
+ *
+ *---------------------------------------------------------------------------
+ */
+
+unsigned char TRlldBullseyeMac[] __attribute ((aligned(2))) = {
+ 0x52, 0x94, 0x04, 0x00, 0x02, 0x7d, 0x0b, 0xe7, 0x4f, 0x43, 0x53, 0x4d,
+ 0x41, 0x43, 0x2e, 0x42, 0x55, 0x4c, 0x4c, 0x53, 0x45, 0x59, 0x45, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xea, 0x55, 0x00, 0x00, 0x00, 0xfc, 0xfa, 0xb8, 0x00, 0x00, 0xbb, 0x00,
+ 0x00, 0xb9, 0x00, 0x00, 0xba, 0x00, 0x00, 0xbe, 0x00, 0x00, 0xbf, 0x00,
+ 0x00, 0xbd, 0x00, 0x00, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0,
+ 0xb8, 0x20, 0x5f, 0x8b, 0xe0, 0x83, 0x3e, 0x4e, 0x00, 0x00, 0x75, 0x1c,
+ 0x2b, 0xdb, 0x8b, 0xf3, 0xad, 0x8b, 0xd8, 0x8b, 0xc8, 0xd1, 0xe9, 0x49,
+ 0x49, 0xad, 0x03, 0xd8, 0xe2, 0xfb, 0x0b, 0xdb, 0x74, 0x06, 0xc7, 0x06,
+ 0xf2, 0x5d, 0x01, 0x00, 0xb8, 0x00, 0x00, 0x8e, 0xd8, 0xc7, 0x06, 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0xe6, 0x12,
+ 0x90, 0x90, 0x90, 0x26, 0x83, 0x26, 0x32, 0x00, 0xf7, 0x90, 0x90, 0x90,
+ 0x33, 0xc0, 0x26, 0xc7, 0x06, 0x44, 0x00, 0xff, 0xff, 0x26, 0xc7, 0x06,
+ 0x46, 0x00, 0xff, 0xff, 0x26, 0x09, 0x06, 0x48, 0x00, 0x26, 0x09, 0x06,
+ 0x4a, 0x00, 0xb8, 0x00, 0x00, 0xe7, 0x06, 0xb8, 0x0f, 0x27, 0xe7, 0x00,
+ 0xb8, 0x09, 0x00, 0xe7, 0x06, 0xb0, 0x11, 0xe8, 0x89, 0x0a, 0xe8, 0xc7,
+ 0x0a, 0xfb, 0xe9, 0x71, 0x0b, 0x90, 0x50, 0xb0, 0xa0, 0xe6, 0x10, 0x58,
+ 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xe7, 0xe7, 0xe7, 0x30, 0x32,
+ 0x30, 0x33, 0x39, 0x39, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67,
+ 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x38, 0x2c,
+ 0x20, 0x31, 0x39, 0x39, 0x39, 0x20, 0x4f, 0x6c, 0x69, 0x63, 0x6f, 0x6d,
+ 0x2e, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73,
+ 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x5a, 0x21,
+ 0x5a, 0x21, 0xdd, 0x37, 0x8e, 0x3b, 0x8a, 0x3d, 0xd9, 0x3e, 0x1b, 0x40,
+ 0x63, 0x43, 0x5a, 0x21, 0x5a, 0x21, 0x5a, 0x21, 0xcc, 0x41, 0x22, 0x42,
+ 0xb3, 0x42, 0x30, 0x43, 0x35, 0x43, 0x3a, 0x43, 0x5a, 0x21, 0x5a, 0x21,
+ 0x5a, 0x21, 0x5a, 0x21, 0xf2, 0x3a, 0x5a, 0x21, 0x5a, 0x21, 0x72, 0x39,
+ 0xd2, 0x39, 0xd2, 0x39, 0xaf, 0x3a, 0xd2, 0x39, 0xd7, 0x3a, 0x13, 0x3b,
+ 0x5a, 0x21, 0x5a, 0x21, 0xcc, 0x41, 0x22, 0x42, 0xb3, 0x42, 0x30, 0x43,
+ 0x35, 0x43, 0x3a, 0x43, 0x5a, 0x21, 0xec, 0x39, 0x5a, 0x21, 0x77, 0x3a,
+ 0x5a, 0x21, 0x48, 0x3b, 0x6e, 0x3b, 0x17, 0x35, 0x17, 0x35, 0x17, 0x35,
+ 0x17, 0x35, 0xe1, 0x35, 0x0e, 0x37, 0x17, 0x35, 0xf3, 0x35, 0xa1, 0x36,
+ 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37,
+ 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37,
+ 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37,
+ 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x60, 0x37, 0x4d, 0x36,
+ 0x17, 0x35, 0x17, 0x35, 0x17, 0x35, 0x17, 0x35, 0x17, 0x35, 0x80, 0x36,
+ 0x17, 0x35, 0x17, 0x35, 0x92, 0x36, 0x17, 0x35, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x04, 0x05, 0xff, 0xff,
+ 0xff, 0x00, 0x03, 0x00, 0x03, 0x03, 0x00, 0x03, 0x0d, 0x06, 0xff, 0xff,
+ 0x18, 0x06, 0x28, 0x06, 0x28, 0x06, 0x28, 0x06, 0x28, 0x06, 0x00, 0x00,
+ 0x33, 0x06, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x39, 0x06, 0x58, 0x06,
+ 0x9e, 0x06, 0x9e, 0x06, 0x9e, 0x06, 0x6d, 0x06, 0x7d, 0x06, 0x00, 0x00,
+ 0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x5a, 0x21, 0xeb, 0x43, 0x5e, 0x17, 0xc7, 0x34, 0xf3, 0x27,
+ 0x85, 0x4a, 0x5a, 0x21, 0x25, 0x44, 0xfe, 0x47, 0x47, 0x46, 0x47, 0x44,
+ 0xba, 0x45, 0xbf, 0x47, 0x83, 0x45, 0x77, 0x47, 0x85, 0x48, 0xcf, 0x48,
+ 0xbc, 0x48, 0x9e, 0x47, 0xdc, 0x48, 0x01, 0x49, 0x2c, 0x49, 0xbf, 0x48,
+ 0x4a, 0x49, 0x16, 0x03, 0x3c, 0x03, 0x5c, 0x03, 0x88, 0x03, 0xae, 0x03,
+ 0x26, 0x04, 0x8c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0x2b, 0xc0, 0x2b, 0xc0, 0x2b,
+ 0xc0, 0x2b, 0xc0, 0x26, 0x83, 0x26, 0x32, 0x00, 0xf7, 0xc3, 0x50, 0x53,
+ 0x52, 0xc6, 0x46, 0x01, 0x00, 0x32, 0xe4, 0x8a, 0x46, 0x00, 0xbb, 0x00,
+ 0xbd, 0x81, 0xeb, 0x00, 0x7d, 0x81, 0xe3, 0x00, 0xff, 0x89, 0x9e, 0xac,
+ 0x15, 0x81, 0xc3, 0x00, 0x01, 0xf7, 0xe3, 0x05, 0x00, 0x7d, 0x89, 0x86,
+ 0xa8, 0x15, 0x03, 0x86, 0xac, 0x15, 0x48, 0x89, 0x86, 0xaa, 0x15, 0x5a,
+ 0x5b, 0x58, 0xc3, 0x51, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x4c, 0x00,
+ 0xfc, 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06, 0x54, 0x00, 0x80, 0x00, 0x75,
+ 0x1e, 0xb9, 0xf4, 0x01, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x4c, 0x00,
+ 0x00, 0x08, 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06, 0x54, 0x00, 0x80, 0x00,
+ 0x75, 0x05, 0xe8, 0xe2, 0x02, 0xe2, 0xe5, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x26, 0x4c, 0x00, 0xff, 0xf7, 0x59, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e,
+ 0x4c, 0x00, 0x02, 0xc3, 0x50, 0x53, 0xc1, 0xe0, 0x05, 0x05, 0x00, 0x03,
+ 0x8b, 0xd8, 0x8d, 0x86, 0x00, 0x01, 0x89, 0x07, 0x8d, 0x86, 0xd4, 0x01,
+ 0x89, 0x47, 0x02, 0x8d, 0x86, 0xe4, 0x01, 0x89, 0x47, 0x04, 0x8d, 0x86,
+ 0xb0, 0x15, 0x89, 0x47, 0x08, 0x8d, 0x86, 0xc4, 0x15, 0x89,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c6, 0x86, 0xb1, 0x02, 0x00, 0xa8, 0x02,
+ 0x74, 0x26, 0x26, 0x83, 0x26, 0x42, 0x00, 0xcf, 0xf7, 0x86, 0xf4, 0x00,
+ 0x04, 0x00, 0x75, 0x14, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x84, 0x75, 0x0c,
+ 0x80, 0xbe, 0xfe, 0x00, 0x01, 0x77, 0x05, 0xc6, 0x86, 0xb0, 0x02, 0x01,
+ 0xb0, 0x02, 0xeb, 0x2a, 0xa8, 0x04, 0x74, 0x0e, 0x26, 0x83, 0x0e, 0x42,
+ 0x00, 0x20, 0x26, 0x83, 0x26, 0x42, 0x00, 0xef, 0xeb, 0x18, 0xa8, 0x08,
+ 0x74, 0x08, 0x26, 0x83, 0x0e, 0x42, 0x00, 0x30, 0xeb, 0x0c, 0xa8, 0x10,
+ 0x74, 0x08, 0x26, 0x83, 0x0e, 0x42, 0x00, 0x30, 0xeb, 0x00, 0xf6, 0x06,
+ 0x23, 0x5f, 0x01, 0x74, 0x06, 0x26, 0x83, 0x26, 0x42, 0x00, 0xcf, 0xc3,
+ 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x4c, 0x00, 0x00, 0x01, 0x90,
+ 0x90, 0x90, 0x90, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x4c, 0x00, 0xff,
+ 0xfe, 0xc3, 0x8e, 0x46, 0x02, 0x80, 0xbe, 0xfe, 0x00, 0x02, 0x74, 0x1e,
+ 0xf6, 0x06, 0x23, 0x5f, 0x01, 0x75, 0x0f, 0x80, 0xbe, 0xb0, 0x02, 0x01,
+ 0x75, 0x10, 0x26, 0x83, 0x0e, 0x42, 0x00, 0x02, 0xeb, 0x08, 0xc6, 0x86,
+ 0x6c, 0x01, 0x01, 0xe8, 0x98, 0x47, 0xc3, 0x8e, 0x46, 0x02, 0xf7, 0x86,
+ 0xf4, 0x00, 0x02, 0x00, 0x74, 0x09, 0x26, 0x81, 0x26, 0x42, 0x00, 0xff,
+ 0xef, 0xeb, 0x07, 0x26, 0x81, 0x0e, 0x42, 0x00, 0x00, 0x10, 0xc3, 0x8e,
+ 0x46, 0x02, 0xf7, 0x86, 0xf4, 0x00, 0x02, 0x00, 0x74, 0x09, 0x26, 0x81,
+ 0x0e, 0x42, 0x00, 0x00, 0x10, 0xeb, 0x07, 0x26, 0x81, 0x26, 0x42, 0x00,
+ 0xff, 0xef, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x42, 0x00, 0x00,
+ 0x80, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x42, 0x00, 0xff, 0x7f,
+ 0xc3, 0xf7, 0x86, 0xf4, 0x00, 0x08, 0x00, 0x74, 0x13, 0xe8, 0xdf, 0xff,
+ 0xeb, 0x39, 0x80, 0x7e, 0x06, 0x0e, 0x74, 0x1d, 0x80, 0x7e, 0x06, 0x48,
+ 0x74, 0x23, 0xeb, 0x2b, 0xe8, 0xd7, 0xff, 0x8e, 0x46, 0x02, 0xf7, 0x86,
+ 0xf4, 0x00, 0x10, 0x00, 0x75, 0xe4, 0x80, 0xbe, 0xfe, 0x00, 0x00, 0x75,
+ 0x0c, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x42, 0x00, 0x00, 0x40, 0xeb,
+ 0x0a, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x42, 0x00, 0xff, 0xbf, 0xc3,
+ 0x83, 0xe0, 0xf7, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x04, 0x74, 0x03, 0x83,
+ 0xc8, 0x08, 0xc3, 0x80, 0xbe, 0xfe, 0x00, 0x01, 0x77, 0x0a, 0x8e, 0x46,
+ 0x02, 0x26, 0x83, 0x0e, 0x50, 0x00, 0x04, 0xc3, 0x8e, 0x46, 0x02, 0x26,
+ 0x83, 0x0e, 0x90, 0x00, 0x04, 0xc3, 0x80, 0xbe, 0xfe, 0x00, 0x01, 0x77,
+ 0x0a, 0x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, 0x26, 0x83, 0x26, 0x4c, 0x00, 0xfe, 0x26, 0x81, 0x0e, 0x32,
+ 0x00, 0x00, 0x80, 0x8e, 0x46, 0x02, 0xf6, 0x06, 0x23, 0x5f, 0x01, 0x75,
+ 0x08, 0x26, 0x83, 0x26, 0x42, 0x00, 0xfd, 0xeb, 0x08, 0xc6, 0x86, 0x6d,
+ 0x01, 0x01, 0xe8, 0x15, 0x42, 0xc6, 0x86, 0x08, 0x01, 0x00, 0xc7, 0x86,
+ 0x22, 0x01, 0x00, 0x00, 0xe8, 0x34, 0xfa, 0xe8, 0x58, 0xfa, 0xf7, 0x86,
+ 0xf4, 0x00, 0x10, 0x00, 0x74, 0x14, 0xf7, 0x86, 0xf4, 0x00, 0x02, 0x00,
+ 0x74, 0x0c, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x42, 0x00, 0x00, 0x40,
+ 0xeb, 0x0a, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x42, 0x00, 0xff, 0xbf,
+ 0x80, 0xbe, 0xfe, 0x00, 0x02, 0x75, 0x05, 0xc6, 0x86, 0xfe, 0x00, 0x01,
+ 0xf6, 0x86, 0xbd, 0x01, 0x01, 0x75, 0x02, 0xeb, 0x71, 0x26, 0xff, 0x36,
+ 0x5e, 0x00, 0x26, 0xff, 0x36, 0x60, 0x00, 0x26, 0xff, 0x36, 0x62, 0x00,
+ 0x26, 0xff, 0x36, 0x64, 0x00, 0x26, 0xff, 0x36, 0x66, 0x00, 0x26, 0xff,
+ 0x36, 0x7a, 0x00, 0x26, 0xff, 0x36, 0x7c, 0x00, 0x26, 0xff, 0x36, 0x7e,
+ 0x00, 0x26, 0xff, 0x36, 0x52, 0x00, 0x26, 0xff, 0x36, 0x6a, 0x00, 0x26,
+ 0xff, 0x36, 0x68, 0x00, 0xe8, 0xf7, 0xee, 0x26, 0x8f, 0x06, 0x68, 0x00,
+ 0x26, 0x8f, 0x06, 0x6a, 0x00, 0x26, 0x8f, 0x06, 0x52, 0x00, 0x26, 0x8f,
+ 0x06, 0x7e, 0x00, 0x26, 0x8f, 0x06, 0x7c, 0x00, 0x26, 0x8f, 0x06, 0x7a,
+ 0x00, 0x26, 0x8f, 0x06, 0x66, 0x00, 0x26, 0x8f, 0x06, 0x64, 0x00, 0x26,
+ 0x8f, 0x06, 0x62, 0x00, 0x26, 0x8f, 0x06, 0x60, 0x00, 0x26, 0x8f, 0x06,
+ 0x5e, 0x00, 0xe8, 0x6e, 0xec, 0xe8, 0xff, 0x2e, 0xc6, 0x86, 0xb2, 0x02,
+ 0x00, 0x8d, 0xbe, 0x16, 0x03, 0x8c, 0xd8, 0x8e, 0xc0, 0xab, 0xab, 0xab,
+ 0xf6, 0x86, 0xab, 0x02, 0x01, 0x74, 0x12, 0x8e, 0x46, 0x02, 0x26, 0x83,
+ 0x0e, 0x42, 0x00, 0x04, 0xc6, 0x86, 0xb4, 0x02, 0x00, 0xc6, 0x46, 0x09,
+ 0x1e, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x44, 0x00, 0xff, 0xfb, 0xf7,
+ 0x86, 0x12, 0x01, 0x00, 0x02, 0x74, 0x10, 0xf7, 0x86, 0x20, 0x01, 0x80,
+ 0x00, 0x75, 0x08, 0xbe, 0x51, 0x4d, 0xe8, 0xe7, 0xf3, 0xeb, 0x0d, 0x8e,
+ 0x46, 0x02, 0x33, 0xc0, 0x26, 0xa3, 0x64, 0x00, 0x26, 0xa3, 0x66, 0x00,
+ 0xc3, 0x90, 0x33, 0xc0, 0x88, 0x86, 0x5f, 0x02, 0x88, 0x86, 0x62, 0x02,
+ 0x88, 0x86, 0x64, 0x02, 0x88, 0x86, 0x67, 0x02, 0x88, 0x86, 0x6c, 0x02,
+ 0xbe, 0xd9, 0x4c, 0xe8, 0xba, 0xf3, 0xc6, 0x86, 0xb2, 0x02, 0x01, 0x8e,
+ 0x46, 0x02, 0xf6, 0x06, 0x23, 0x5f, 0x01, 0x75, 0x08, 0x26, 0x83, 0x26,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, 0x09, 0x1e, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x4c, 0x00, 0xfe,
+ 0x26, 0x81, 0x0e, 0x32, 0x00, 0x00, 0x80, 0xc7, 0x86, 0xda, 0x02, 0x05,
+ 0x00, 0xbe, 0x39, 0x4d, 0xe8, 0x6d, 0xf1, 0xb0, 0x00, 0xe8, 0xc6, 0x15,
+ 0xe8, 0x81, 0x13, 0xc3, 0xb8, 0x00, 0x80, 0xe8, 0x90, 0x2b, 0xc6, 0x86,
+ 0x08, 0x01, 0x00, 0xe8, 0xd7, 0xf6, 0xe8, 0x86, 0xf6, 0x8e, 0x46, 0x02,
+ 0x26, 0xc7, 0x06, 0x68, 0x00, 0x18, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x83,
+ 0x0e, 0x4c, 0x00, 0x01, 0x26, 0x81, 0x26, 0x32, 0x00, 0xff, 0x7f, 0xc3,
+ 0xc7, 0x86, 0x36, 0x02, 0x01, 0x00, 0xc7, 0x86, 0xc6, 0x01, 0xff, 0xff,
+ 0xc7, 0x86, 0xcc, 0x02, 0x00, 0x00, 0xc7, 0x86, 0xc8, 0x01, 0x14, 0x00,
+ 0x80, 0x7e, 0x07, 0x10, 0x74, 0x4b, 0xb0, 0x00, 0xe8, 0x73, 0x15, 0x80,
+ 0x7e, 0x06, 0x0e, 0x74, 0x02, 0xeb, 0x3e, 0x8e, 0x46, 0x02, 0x26, 0x83,
+ 0x0e, 0x4c, 0x00, 0x01, 0x26, 0x81, 0x26, 0x32, 0x00, 0xff, 0x7f, 0x83,
+ 0xa6, 0x0a, 0x02, 0xdf, 0xc6, 0x86, 0x89, 0x02, 0x01, 0xf6, 0x86, 0x5f,
+ 0x02, 0x01, 0x74, 0x1d, 0xf6, 0x86, 0x6a, 0x02, 0x01, 0x74, 0x16, 0xf6,
+ 0x86, 0x67, 0x02, 0x01, 0x75, 0x0f, 0xc6, 0x86, 0x67, 0x02, 0x01, 0xf6,
+ 0x86, 0x58, 0x02, 0x01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 0x81, 0x0e, 0x32, 0x00, 0x00, 0x80,
+ 0xe8, 0x38, 0xf5, 0xc7, 0x86, 0xb8, 0x02, 0x02, 0x00, 0xc7, 0x86, 0xba,
+ 0x02, 0x08, 0x00, 0xc6, 0x86, 0x58, 0x02, 0x00, 0x8e, 0x46, 0x02, 0x26,
+ 0x81, 0x26, 0x64, 0x00, 0xff, 0x7f, 0xc6, 0x86, 0x6d, 0x02, 0x00, 0xc6,
+ 0x86, 0x6f, 0x02, 0x00, 0xe8, 0x79, 0xf1, 0xf6, 0x86, 0x85, 0x02, 0x01,
+ 0x75, 0x06, 0xbe, 0x6d, 0x4c, 0xe8, 0x2c, 0xef, 0x81, 0xa6, 0x0a, 0x02,
+ 0xff, 0x6f, 0x81, 0x8e, 0x0a, 0x02, 0x00, 0x40, 0xc6, 0x86, 0x89, 0x02,
+ 0x01, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x4c, 0x00, 0xfe, 0x26,
+ 0x81, 0x0e, 0x32, 0x00, 0x00, 0x80, 0x83, 0xbe, 0xca, 0x01, 0x00, 0x74,
+ 0x0d, 0x8b, 0x86, 0xca, 0x01, 0xc7, 0x86, 0xca, 0x01, 0x00, 0x00, 0xe8,
+ 0x2a, 0x10, 0xbe, 0x79, 0x4c, 0xe8, 0xf0, 0xee, 0xc3, 0x90, 0xc7, 0x86,
+ 0x36, 0x02, 0x01, 0x00, 0xc7, 0x86, 0x34, 0x02, 0x02, 0x00, 0xb0, 0x00,
+ 0xe8, 0x3b, 0x13, 0x80, 0x7e, 0x06, 0x48, 0x75, 0x10, 0x8e, 0x46, 0x02,
+ 0x26, 0x83, 0x0e, 0x4c, 0x00, 0x01, 0x26, 0x81, 0x26, 0x32, 0x00, 0xff,
+ 0x7f, 0xc3, 0xc7, 0x86, 0x34, 0x02, 0x03, 0x00, 0xff, 0x86, 0x48, 0x02,
+ 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x4c, 0x00, 0xfe, 0x26, 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 0x01,
+ 0xc3, 0x90, 0xc7, 0x86, 0x34, 0x02, 0x01, 0x00, 0xc3, 0x90, 0xc3, 0x53,
+ 0x50, 0x89, 0x86, 0x22, 0x01, 0x80, 0xbe, 0x62, 0x01, 0x01, 0x75, 0x0f,
+ 0x50, 0xe8, 0x1b, 0xe6, 0xe8, 0xb1, 0x26, 0xc6, 0x46, 0x07, 0x00, 0x58,
+ 0xe9, 0xea, 0x00, 0xf6, 0x86, 0x08, 0x01, 0x01, 0x74, 0x05, 0xe8, 0xfd,
+ 0x27, 0xeb, 0x6c, 0x83, 0xf8, 0x10, 0x75, 0x08, 0x81, 0x8e, 0x1e, 0x01,
+ 0x00, 0x80, 0xeb, 0x5f, 0x83, 0x8e, 0x1e, 0x01, 0x02, 0x8b, 0x9e, 0x0a,
+ 0x02, 0x83, 0xf8, 0x01, 0x75, 0x04, 0x81, 0xcb, 0x00, 0x04, 0x83, 0xf8,
+ 0x0c, 0x75, 0x04, 0x81, 0xcb, 0x00, 0x08, 0x83, 0xf8, 0x0b, 0x75, 0x03,
+ 0x83, 0xcb, 0x02, 0x83, 0xf8, 0x09, 0x75, 0x03, 0x83, 0xcb, 0x04, 0x83,
+ 0xf8, 0x0a, 0x75, 0x09, 0x81, 0xcb, 0x00, 0x01, 0x83, 0x8e, 0x1e, 0x01,
+ 0x04, 0x83, 0xf8, 0x06, 0x75, 0x03, 0x83, 0xcb, 0x01, 0x83, 0xf8, 0x0f,
+ 0x74, 0x19, 0x83, 0xf8, 0x02, 0x75, 0x03, 0x83, 0xcb, 0x08, 0x83, 0xf8,
+ 0x03, 0x75, 0x03, 0x83, 0xcb, 0x08, 0x89, 0x9e, 0x0a, 0x02, 0xc6, 0x86,
+ 0x89, 0x02, 0x01, 0x8a, 0x4e, 0x06, 0x80, 0xbe, 0xfe, 0x00, 0x02, 0x72,
+ 0x2e, 0xf7, 0x86, 0x0a, 0x02, 0x08, 0x00, 0x75, 0x1c, 0x80, 0xf9, 0x48,
+ 0x74, 0x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 0x02,
+ 0x00, 0x8a, 0x86, 0x58, 0x02, 0x8a, 0xa6, 0x84, 0x02, 0x88, 0xa6, 0x58,
+ 0x02, 0xe8, 0xd8, 0xd4, 0x88, 0x86, 0x58, 0x02, 0xc6, 0x46, 0x09, 0x0c,
+ 0xb8, 0x00, 0x03, 0xe8, 0xbe, 0xf3, 0xe9, 0xbc, 0x00, 0x80, 0x7e, 0x08,
+ 0x00, 0x75, 0x3d, 0xf6, 0x86, 0x58, 0x02, 0x01, 0x75, 0x16, 0xf6, 0x86,
+ 0x6c, 0x02, 0x01, 0x74, 0x16, 0xf6, 0x86, 0x62, 0x02, 0x01, 0x74, 0x08,
+ 0xf7, 0x86, 0x12, 0x01, 0x00, 0x01, 0x75, 0x16, 0xc6, 0x46, 0x09, 0x0c,
+ 0xe9, 0x92, 0x00, 0xf6, 0x86, 0x62, 0x02, 0x01, 0x74, 0x9c, 0xf7, 0x86,
+ 0x12, 0x01, 0x00, 0x01, 0x74, 0x94, 0xc6, 0x46, 0x09, 0x04, 0xff, 0x86,
+ 0x4e, 0x02, 0xeb, 0x79, 0x80, 0x7e, 0x08, 0x0a, 0x75, 0x73, 0xf6, 0x86,
+ 0x63, 0x02, 0x01, 0x75, 0x0e, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x01, 0x75,
+ 0x06, 0xc6, 0x46, 0x09, 0x0c, 0xeb, 0x5e, 0xf7, 0x86, 0x12, 0x01, 0x00,
+ 0x01, 0x74, 0x56, 0xc6, 0x46, 0x09, 0x04, 0xeb, 0x50, 0x80, 0x7e, 0x08,
+ 0x04, 0x75, 0x2c, 0xc6, 0x46, 0x09, 0x0c, 0x80, 0x7e, 0x0a, 0x00, 0x75,
+ 0x1d, 0xc6, 0x86, 0x6d, 0x02, 0x00, 0xc6, 0x86, 0x6f, 0x02, 0x00, 0x8a,
+ 0x86, 0x58, 0x02, 0x8a, 0xa6, 0x84, 0x02, 0x88, 0xa6, 0x58, 0x02, 0xe8,
+ 0x32, 0xd4, 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xf3, 0xab, 0xc7, 0x86, 0x2a, 0x02, 0xff, 0xff, 0x8e, 0x46, 0x02, 0xb8,
+ 0x02, 0x00, 0xf7, 0x86, 0xf4, 0x00, 0x80, 0x00, 0x74, 0x03, 0x83, 0xc8,
+ 0x01, 0xf7, 0x86, 0xf4, 0x00, 0x40, 0x00, 0x74, 0x03, 0x83, 0xc8, 0x04,
+ 0xf7, 0x86, 0xf4, 0x00, 0x20, 0x00, 0x74, 0x03, 0x83, 0xc8, 0x08, 0x26,
+ 0xa3, 0x4e, 0x00, 0xb0, 0x02, 0xe8, 0x0e, 0xc8, 0xf7, 0x86, 0xf4, 0x00,
+ 0x00, 0x20, 0x74, 0x28, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x84, 0x74, 0x0c,
+ 0xb8, 0x05, 0x00, 0xe8, 0x27, 0x00, 0xc6, 0x46, 0x07, 0x42, 0xeb, 0x20,
+ 0xf7, 0x86, 0xf6, 0x00, 0x80, 0x00, 0x74, 0x0c, 0xb8, 0x05, 0x00, 0xe8,
+ 0x13, 0x00, 0xc6, 0x46, 0x07, 0x42, 0xeb, 0x0c, 0xb8, 0x02, 0x00, 0xe8,
+ 0x07, 0x00, 0xc6, 0x46, 0x07, 0x02, 0xeb, 0x00, 0xc3, 0x50, 0xb0, 0x00,
+ 0x88, 0x86, 0xaa, 0x02, 0x88, 0x86, 0xab, 0x02, 0x88, 0x86, 0xac, 0x02,
+ 0x88, 0x86, 0xad, 0x02, 0x88, 0x86, 0xaf, 0x02, 0x88, 0x86, 0xae, 0x02,
+ 0x58, 0x9c, 0xfa, 0x83, 0xf8, 0x02, 0x74, 0x13, 0x83, 0xf8, 0x05, 0x74,
+ 0x0c, 0xc7, 0x46, 0x12, 0x5a, 0x21, 0xc7, 0x46, 0x14, 0x5a, 0x21, 0xeb,
+ 0x42, 0xeb, 0x21, 0xc6, 0x86, 0xaa, 0x02, 0x01, 0xc6, 0x86, 0xae, 0x02,
+ 0x01, 0xc6, 0x86, 0xaf, 0x02, 0x00, 0xc7, 0x46, 0x12, 0x62, 0x37, 0xc7,
+ 0x46, 0x14, 0x89, 0x34, 0xc7, 0x86, 0xba, 0x01, 0x2c, 0x00, 0xeb, 0x1f,
+ 0xc6, 0x86, 0xac, 0x02, 0x01, 0xc6, 0x86, 0xae, 0x02, 0x00, 0xc6, 0x86,
+ 0xaf, 0x02, 0x01, 0xc7, 0x46, 0x12, 0x66, 0x37, 0xc7, 0x46, 0x14, 0x8d,
+ 0x34, 0xc7, 0x86, 0xba, 0x01, 0x30, 0x00, 0x0e, 0xe8, 0x02, 0x00, 0xeb,
+ 0x01, 0xcf, 0xc3, 0x8c, 0x00, 0x76, 0x4d, 0xbc, 0x02, 0x96, 0x00, 0xac,
+ 0x4d, 0x14, 0x00, 0x96, 0x00, 0xc0, 0x4d, 0x08, 0x07, 0x96, 0x00, 0xfe,
+ 0x4d, 0x6e, 0x00, 0x78, 0x00, 0x64, 0x50, 0x00, 0x00, 0x6e, 0x00, 0xc0,
+ 0x4e, 0xf4, 0x01, 0x6e, 0x00, 0xf0, 0x4e, 0x08, 0x07, 0x6e, 0x00, 0x1c,
+ 0x52, 0x02, 0x00, 0xaa, 0x00, 0x38, 0x4f, 0xfa, 0x00, 0x8c, 0x00, 0x88,
+ 0x4f, 0x02, 0x00, 0x8c, 0x00, 0x8a, 0x4e, 0x3c, 0x00, 0x78, 0x00, 0xf4,
+ 0x4f, 0x04, 0x01, 0x96, 0x00, 0x20, 0x50, 0x64, 0x00, 0x96, 0x00, 0x44,
+ 0x50, 0xdc, 0x05, 0xbe, 0x00, 0x72, 0x51, 0xf4, 0x01, 0xbe, 0x00, 0x72,
+ 0x51, 0x32, 0x00, 0xa0, 0x00, 0xee, 0x52, 0xf4, 0x01, 0xbe, 0x00, 0x9c,
+ 0x51, 0xf4, 0x01, 0x82, 0x00, 0xc0, 0x55, 0x19, 0x00, 0x6e, 0x00, 0xd4,
+ 0x52, 0x14, 0x00, 0x78, 0x00, 0xb0, 0x51, 0xc4, 0x09, 0x6e, 0x00, 0xc4,
+ 0x51, 0x02, 0x00, 0xd2, 0x00, 0x4a, 0x56, 0x2c, 0x01, 0x78, 0x00, 0xc6,
+ 0x54, 0xf0, 0x00, 0x6e, 0x00, 0x46, 0x53, 0x32, 0x00, 0xa0, 0x00, 0xa8,
+ 0x53, 0xbc, 0x02, 0x6e, 0x00, 0xba, 0x53, 0x08, 0x07, 0x6e, 0x00, 0xc8,
+ 0x53, 0xe8, 0x03, 0x6e, 0x00, 0xda, 0x53, 0x14, 0x00, 0x96, 0x00, 0xe6,
+ 0x53, 0x64, 0x00, 0xa0, 0x00, 0xd4, 0x54, 0xf4, 0x01, 0xc8, 0x00, 0x72,
+ 0x4f, 0x02, 0x00, 0x6e, 0x00, 0x16, 0x54, 0x04, 0x00, 0x8c, 0x00, 0x9e,
+ 0x54, 0x14, 0x00, 0x6e, 0x00, 0x84, 0x56, 0x84, 0x03, 0x96, 0x00, 0x92,
+ 0x56, 0x02, 0x00, 0x82, 0x00, 0xc6, 0x52, 0x14, 0x00, 0xb4, 0x00, 0xbe,
+ 0x56, 0x02, 0x00, 0xdc, 0x00, 0x7a, 0x56, 0x64, 0x00, 0xa0, 0x00, 0xe5,
+ 0x55, 0x64, 0x00, 0xc8, 0x00, 0xfc, 0x55, 0x03, 0x00, 0xd2, 0x00, 0x4e,
+ 0x56, 0xf4, 0x01, 0xd2, 0x00, 0x60, 0x56, 0x4c, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x80, 0xbe,
+ 0x58, 0x02, 0x01, 0x75, 0x28, 0x80, 0x7e, 0x08, 0x00, 0x75, 0x22, 0xf6,
+ 0x86, 0x69, 0x02, 0x01, 0x74, 0x1c, 0xe8, 0xee, 0xdf, 0xbe, 0x67, 0x4c,
+ 0xe8, 0xb9, 0xc1, 0x8c, 0xd8, 0x8e, 0xc0, 0x33, 0xc0, 0x8d, 0xbe, 0xf2,
+ 0x01, 0xab, 0xab, 0xab, 0xc6, 0x86, 0x69, 0x02, 0x00, 0xc3, 0xe8, 0xa6,
+ 0xe2, 0xeb, 0xdf, 0x90, 0x8a, 0x46, 0x08, 0x3c, 0x0a, 0x75, 0x0b, 0xf6,
+ 0x86, 0x62, 0x02, 0x01, 0x74, 0x04, 0xc6, 0x46, 0x09, 0x04, 0xc3, 0x90,
+ 0x80, 0xbe, 0xab, 0x02, 0x01, 0x74, 0x32, 0x80, 0x7e, 0x08, 0x06, 0x75,
+ 0x2c, 0x80, 0x7e, 0x06, 0x0c, 0x75, 0x0f, 0xf6, 0x86, 0x62, 0x02, 0x01,
+ 0x74, 0x08, 0xb8, 0x07, 0x00, 0xe8, 0x7b, 0xd3, 0xeb, 0x17, 0xf6, 0x86,
+ 0x62, 0x02, 0x01, 0x74, 0x10, 0xf6, 0x86, 0x5d, 0x02, 0x01, 0x75, 0x09,
+ 0xc6, 0x86, 0x5d, 0x02, 0x01, 0xc6, 0x46, 0x09, 0x08, 0xc3, 0xe9, 0x84,
+ 0x00, 0x90, 0x8a, 0x4e, 0x06, 0x8a, 0x56, 0x08, 0x80, 0xf9, 0x06, 0x74,
+ 0xf1, 0x80, 0xf9, 0x08, 0x74, 0x05, 0x80, 0xf9, 0x0a, 0x75, 0x0a, 0x80,
+ 0xfa, 0x0c, 0x74, 0xe2, 0x80, 0xfa, 0x04, 0x74, 0xdd, 0x80, 0xfa, 0x0c,
+ 0x74, 0x05, 0x80, 0xfa, 0x04, 0x75, 0x59, 0xf6, 0x86, 0x67, 0x02, 0x01,
+ 0x74, 0x52, 0xe8, 0xed, 0x02, 0xf6, 0x86, 0x65, 0x02, 0x01, 0x74, 0x0b,
+ 0x81, 0x8e, 0x0a, 0x02, 0x00, 0x80, 0xc6, 0x86, 0x89, 0x02, 0x01, 0xc6,
+ 0x46, 0x09, 0x06, 0x81, 0x8e, 0x0a, 0x02, 0x00, 0x50, 0xc6, 0x86, 0x89,
+ 0x02, 0x01, 0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x80, 0xbe, 0xfe, 0x00, 0x02, 0x74, 0x18, 0xb8,
+ 0x00, 0x02, 0x80, 0xbe, 0x65, 0x02, 0x01, 0x74, 0x37, 0xf6, 0x86, 0xac,
+ 0x02, 0x01, 0x75, 0x07, 0xf6, 0x86, 0xad, 0x02, 0x01, 0x74, 0x05, 0xb8,
+ 0x00, 0x05, 0xeb, 0x24, 0xb8, 0x00, 0x04, 0xc7, 0x86, 0x36, 0x02, 0x04,
+ 0x00, 0x8a, 0x4e, 0x08, 0x80, 0xf9, 0x0c, 0x74, 0x13, 0xb8, 0x00, 0x04,
+ 0x80, 0xbe, 0x5e, 0x02, 0x01, 0x74, 0x09, 0xb8, 0x00, 0x03, 0xc7, 0x86,
+ 0x36, 0x02, 0x07, 0x00, 0x89, 0x86, 0x0c, 0x03, 0xc3, 0x90, 0x80, 0x7e,
+ 0x08, 0x08, 0x74, 0x23, 0x8a, 0x46, 0x06, 0x3c, 0x04, 0x72, 0x1c, 0x3c,
+ 0x48, 0x74, 0x04, 0x3c, 0x0e, 0x77, 0x14, 0xf6, 0x86, 0x61, 0x02, 0x01,
+ 0x74, 0x0d, 0xf6, 0x86, 0x60, 0x02, 0x01, 0x74, 0x06, 0xb8, 0x0c, 0x00,
+ 0xe8, 0xc0, 0xcf, 0xc3, 0xc6, 0x86, 0x61, 0x02, 0x01, 0x8e, 0x46, 0x02,
+ 0x26, 0x81, 0x26, 0x44, 0x00, 0xff, 0xf7, 0xe8, 0xcc, 0x03, 0xc3, 0x90,
+ 0x80, 0x7e, 0x06, 0x02, 0x74, 0x06, 0x80, 0x7e, 0x08, 0x08, 0x75, 0x06,
+ 0xb8, 0x01, 0x00, 0xe8, 0x99, 0xcf, 0xc3, 0x90, 0x51, 0x52, 0x56, 0x80,
+ 0xbe, 0xfe, 0x00, 0x02, 0x75, 0x02, 0xeb, 0x48, 0x33, 0xd2, 0xc6, 0x86,
+ 0x6d, 0x02, 0x00, 0xe8, 0xb2, 0xbf, 0x8d, 0xb6, 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fd, 0x90, 0x80, 0x7e,
+ 0x06, 0x42, 0x75, 0x14, 0x80, 0xbe, 0xfe, 0x00, 0x02, 0x72, 0x27, 0xf6,
+ 0x86, 0x74, 0x02, 0x01, 0x75, 0x08, 0xb8, 0x02, 0x00, 0xe8, 0x0e, 0x04,
+ 0xeb, 0x45, 0xc7, 0x86, 0x34, 0x05, 0x00, 0x02, 0xc7, 0x86, 0x30, 0x05,
+ 0x00, 0x02, 0xc6, 0x86, 0x79, 0x02, 0x01, 0xc6, 0x86, 0xb0, 0x02, 0x00,
+ 0xeb, 0x1e, 0xc6, 0x86, 0xb0, 0x02, 0x01, 0xc7, 0x86, 0x34, 0x05, 0x00,
+ 0x02, 0xc7, 0x86, 0x30, 0x05, 0x00, 0x01, 0xf6, 0x86, 0x78, 0x02, 0x01,
+ 0x74, 0x06, 0xc7, 0x86, 0x34, 0x05, 0x00, 0x06, 0xc7, 0x86, 0xd8, 0x02,
+ 0x05, 0x00, 0xbe, 0x27, 0x4d, 0xe8, 0xa8, 0xbb, 0xe8, 0x29, 0xdd, 0xc3,
+ 0x80, 0x7e, 0x08, 0x18, 0x74, 0x06, 0x80, 0x7e, 0x08, 0x1a, 0x75, 0x04,
+ 0xc6, 0x46, 0x09, 0x1c, 0xc3, 0x90, 0x80, 0x7e, 0x06, 0x46, 0x75, 0x06,
+ 0xb8, 0x05, 0x00, 0xe8, 0x95, 0xcd, 0xc3, 0x90, 0x80, 0x7e, 0x08, 0x1c,
+ 0x75, 0x0a, 0x80, 0x7e, 0x06, 0x48, 0x75, 0x04, 0xc6, 0x46, 0x07, 0x44,
+ 0xc3, 0x90, 0x80, 0x7e, 0x06, 0x42, 0x75, 0x04, 0xc6, 0x46, 0x07, 0x44,
+ 0xc3, 0x90, 0xf6, 0x86, 0x73, 0x02, 0x01, 0x74, 0x27, 0xf6, 0x46, 0x06,
+ 0x46, 0x75, 0x18, 0x80, 0xbe, 0xfe, 0x00, 0x02, 0x74, 0x11, 0xc6, 0x86,
+ 0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x7a, 0x02, 0x01, 0xe8, 0xd4, 0xbc, 0xff, 0x86, 0xd6, 0x02,
+ 0xbe, 0x2d, 0x4d, 0xe8, 0x8a, 0xba, 0xe8, 0x4d, 0xdc, 0xc3, 0x80, 0x7e,
+ 0x06, 0x44, 0x75, 0x06, 0xb8, 0x05, 0x00, 0xe8, 0x89, 0xcc, 0xc3, 0x90,
+ 0x80, 0x7e, 0x06, 0x46, 0x75, 0x08, 0xb8, 0x06, 0x00, 0xe8, 0x7b, 0xcc,
+ 0xeb, 0x17, 0x80, 0x7e, 0x08, 0x16, 0x75, 0x11, 0xc7, 0x86, 0x2e, 0x02,
+ 0x04, 0x00, 0xf6, 0x86, 0x72, 0x02, 0x01, 0x74, 0x04, 0xc6, 0x46, 0x09,
+ 0x18, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x8b, 0x16, 0x42, 0x00, 0xf7, 0xc2,
+ 0x02, 0x00, 0x74, 0x14, 0x8b, 0xc2, 0x83, 0xe0, 0xfd, 0x8e, 0x46, 0x02,
+ 0x26, 0xa3, 0x42, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x89, 0x16, 0x42, 0x00,
+ 0xc3, 0x90, 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06, 0x54, 0x00, 0x03, 0x00,
+ 0x74, 0x10, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x54, 0x00, 0x03, 0xc6,
+ 0x86, 0x59, 0x02, 0x01, 0xeb, 0x00, 0xf6, 0x86, 0x59, 0x02, 0x01, 0x75,
+ 0x14, 0x80, 0x7e, 0x08, 0x00, 0x75, 0x0e, 0xc6, 0x46, 0x09, 0x02, 0xff,
+ 0x86, 0x44, 0x02, 0x81, 0x8e, 0xe6, 0x02, 0x00, 0x02, 0xc6, 0x86, 0x59,
+ 0x02, 0x00, 0xc3, 0x90, 0xf7, 0x86, 0xf4, 0x00, 0x00, 0x10, 0x75, 0x15,
+ 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06, 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, 0x02,
+ 0xff, 0x86, 0x44, 0x02, 0xf6, 0x86, 0x62, 0x02, 0x01, 0x74, 0x06, 0x81,
+ 0x8e, 0xe6, 0x02, 0x00, 0x02, 0xc6, 0x86, 0x6d, 0x02, 0x01, 0x8e, 0x46,
+ 0x02, 0x26, 0x83, 0x0e, 0x4c, 0x00, 0x10, 0x8e, 0x46, 0x02, 0x26, 0xc7,
+ 0x06, 0x48, 0x00, 0x00, 0x00, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x48,
+ 0x00, 0x00, 0x01, 0x58, 0xc3, 0x83, 0x8e, 0xe6, 0x02, 0x20, 0x83, 0x7e,
+ 0x06, 0x08, 0x75, 0x13, 0x8b, 0x8e, 0xce, 0x02, 0x41, 0x89, 0x8e, 0xce,
+ 0x02, 0x80, 0xf9, 0x02, 0x75, 0x05, 0x50, 0xe8, 0x3f, 0xd5, 0x58, 0xc3,
+ 0x50, 0x53, 0x51, 0x8a, 0x4e, 0x06, 0x80, 0xf9, 0x0e, 0x74, 0x1e, 0x80,
+ 0xf9, 0x48, 0x74, 0x19, 0x80, 0xbe, 0x58, 0x02, 0x01, 0x74, 0x46, 0x80,
+ 0xf9, 0x08, 0x72, 0x41, 0x80, 0xf9, 0x0e, 0x77, 0x3c, 0xb8, 0x02, 0x00,
+ 0xe8, 0xa0, 0xc8, 0xeb, 0x34, 0xc7, 0x86, 0x2e, 0x02, 0x05, 0x00, 0xc6,
+ 0x86, 0x65, 0x02, 0x01, 0x8a, 0x46, 0x08, 0x3c, 0x06, 0x74, 0x26, 0x3c,
+ 0x02, 0x74, 0x51, 0x3c, 0x08, 0x74, 0x1a, 0x3c, 0x04, 0x74, 0x16, 0xf6,
+ 0x86, 0xac, 0x02, 0x01, 0x75, 0x13, 0xf6, 0x86, 0xad, 0x02, 0x01, 0x75,
+ 0x0c, 0xc6, 0x46, 0x09, 0x04, 0xff, 0x86, 0x4e, 0x02, 0x59, 0x5b, 0x58,
+ 0xc3, 0x8b, 0x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x04, 0x88, 0x86, 0x7a, 0x01, 0x81, 0xbe, 0x76,
+ 0x01, 0xbc, 0x02, 0x72, 0x06, 0xc7, 0x86, 0x76, 0x01, 0xf4, 0x01, 0x2a,
+ 0xe4, 0x83, 0xf8, 0x7f, 0x75, 0x12, 0x8b, 0x86, 0x76, 0x01, 0xbe, 0xeb,
+ 0x09, 0xf7, 0xe6, 0xbe, 0x20, 0x00, 0xf7, 0xf6, 0x03, 0x86, 0x7a, 0x01,
+ 0x89, 0x86, 0x7e, 0x01, 0xff, 0x86, 0x76, 0x01, 0x83, 0xbe, 0x80, 0x01,
+ 0x01, 0x74, 0x53, 0x83, 0xf8, 0x1f, 0x72, 0x4e, 0x8d, 0xb6, 0x96, 0x01,
+ 0x83, 0x3c, 0x12, 0x72, 0x45, 0x83, 0x3c, 0x23, 0x77, 0x40, 0x83, 0x7c,
+ 0x02, 0x1f, 0x72, 0x3a, 0x83, 0x7c, 0x02, 0x45, 0x77, 0x34, 0x83, 0x7c,
+ 0x04, 0x12, 0x72, 0x2e, 0x90, 0x83, 0x7c, 0x04, 0x23, 0x77, 0x27, 0x81,
+ 0x7c, 0x06, 0x9c, 0x00, 0x72, 0x20, 0xc7, 0x86, 0x80, 0x01, 0x01, 0x00,
+ 0xc7, 0x86, 0x82, 0x01, 0x01, 0x00, 0xc7, 0x86, 0x88, 0x01, 0x00, 0x00,
+ 0xa1, 0xd4, 0x5d, 0x89, 0x86, 0x84, 0x01, 0xa1, 0xd6, 0x5d, 0x89, 0x86,
+ 0x86, 0x01, 0x83, 0xc3, 0x02, 0x49, 0x74, 0x03, 0xe9, 0xdb, 0xfe, 0xc3,
+ 0x50, 0x51, 0x52, 0x56, 0x57, 0x8e, 0x46, 0x02, 0x83, 0x86, 0x90, 0x01,
+ 0x01, 0x83, 0x96, 0x92, 0x01, 0x00, 0xc7, 0x86, 0x80, 0x01, 0x00, 0x00,
+ 0x26, 0xa1, 0x72, 0x00, 0xd1, 0xe8, 0xd0, 0xe8, 0x86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0x5f, 0x10, 0x00, 0xc3, 0x53, 0xc7, 0x06, 0x26,
+ 0x5f, 0x12, 0x00, 0x33, 0xdb, 0x8a, 0x1e, 0x24, 0x5f, 0xd0, 0xe3, 0x8b,
+ 0x9f, 0xea, 0x5d, 0x06, 0x8e, 0x47, 0x02, 0x26, 0x83, 0x26, 0x42, 0x00,
+ 0xfe, 0x07, 0xb8, 0x9d, 0x06, 0xe7, 0x02, 0x5b, 0xc3, 0x90, 0xe5, 0x06,
+ 0x83, 0xe0, 0x09, 0xe7, 0x06, 0xc7, 0x06, 0x26, 0x5f, 0x14, 0x00, 0xc6,
+ 0x06, 0x24, 0x5f, 0x80, 0xc3, 0x90, 0xe5, 0x06, 0x83, 0xe0, 0x09, 0xe7,
+ 0x06, 0xc3, 0x4e, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x78, 0x74,
+ 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x34, 0x12,
+ 0x45, 0x23, 0x56, 0x34, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xab, 0xde, 0xbc,
+ 0xef, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x6f, 0x74, 0x49, 0x6d, 0x70,
+ 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x00, 0x54, 0x69, 0x6d,
+ 0x65, 0x72, 0x30, 0x00, 0x00, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x31, 0x00,
+ 0x00, 0x54, 0x65, 0x73, 0x74, 0x31, 0x00, 0x00, 0x54, 0x65, 0x73, 0x74,
+ 0x32, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x5e, 0x35, 0x56, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
+ 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0xc0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0xe0, 0x02, 0xc0, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
+ 0x00, 0x02, 0x04, 0x01, 0x00, 0x00, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0xe0, 0x03, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x03, 0x06, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x20, 0x00, 0xe0, 0x04, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x04, 0x08, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x05, 0xc0, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x05,
+ 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x06, 0xc0, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+ 0x00, 0x06, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xe0, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0xe0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x06, 0x00, 0x08, 0x02, 0x26, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00,
+ 0xe0, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x1c, 0x26, 0x00, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x50, 0x20, 0x0c, 0x23, 0x30, 0x30,
+ 0x30, 0x30, 0xf3, 0xf0, 0xf0, 0xf8, 0xf9, 0xf6, 0x08, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x21, 0x00, 0x00, 0x04, 0x21, 0x00, 0x00, 0x06, 0x2b, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x28, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x29, 0x20, 0x00, 0x08, 0x00, 0x01, 0x00,
+ 0x04, 0x06, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x40, 0x25, 0x06, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x22,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
+ 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x12, 0x40, 0x26, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x1a, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x60, 0x27, 0x08, 0x0a, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0xe0, 0x00,
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x16, 0x60, 0x28, 0x04, 0x30, 0x00, 0x00, 0x06, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1e, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x11, 0x04, 0x0c,
+ 0x00, 0x01, 0x04, 0x0e, 0x00, 0x02, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x16, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x12, 0x04, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xe0, 0x00, 0xc0, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x30, 0x13, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0xe0, 0x00, 0xc0, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x03, 0x14, 0x04, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00,
+ 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x03, 0x15, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00,
+ 0xe0, 0x08, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00,
+ 0xe0, 0x07, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x30, 0x17, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00,
+ 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x22, 0x60, 0x29, 0x08, 0x2d, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x2a, 0x00, 0x00, 0x02, 0x20, 0x80, 0x00, 0x00, 0x06, 0x09, 0x00,
+ 0x00, 0x00, 0x04, 0x03, 0x01, 0x80, 0x00, 0x00, 0x04, 0x02, 0x80, 0x00,
+ 0x00, 0x08, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, 0x80, 0x00, 0x00,
+ 0x08, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x01, 0x26, 0x80, 0x00, 0x00, 0xff,
+ 0x06, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x05,
+ 0x00, 0x00, 0x00, 0x04, 0x06, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00,
+ 0x00, 0x04, 0x09, 0x00, 0x00, 0x00, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x00, 0x04, 0x09,
+ 0x00, 0x00, 0x00, 0x04, 0x03, 0x0c, 0x80, 0x00, 0x00, 0x04, 0x0e, 0x80,
+ 0x00, 0x00, 0x04, 0x21, 0x00, 0x00, 0x00, 0x04, 0x01, 0x0f, 0x80, 0x00,
+ 0x00, 0x04, 0x01, 0x0d, 0x80, 0x00, 0x00, 0x04, 0x04, 0x02, 0x80, 0x00,
+ 0x00, 0x08, 0x22, 0x00, 0x00, 0x00, 0xff, 0x23, 0x00, 0x00, 0x00, 0xff,
+ 0x21, 0x00, 0x00, 0x00, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00,
+ 0xa5, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00
+};
diff --git a/sys/contrib/dev/oltr/trlldhm.c b/sys/contrib/dev/oltr/trlldhm.c
new file mode 100644
index 0000000..cdcb250
--- /dev/null
+++ b/sys/contrib/dev/oltr/trlldhm.c
@@ -0,0 +1,2519 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 1997
+ * OLICOM A/S
+ * Denmark
+ *
+ * All Rights Reserved
+ *
+ * This source file is subject to the terms and conditions of the
+ * OLICOM Software License Agreement which restricts the manner
+ * in which it may be used.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Description: Olicom adapter micro-code
+ *
+ *---------------------------------------------------------------------------
+ */
+
+unsigned char TRlldHawkeyeMac[] __attribute ((aligned(2))) = {
+ 0x52, 0x94, 0x03, 0x00, 0x02, 0x75, 0xea, 0x12, 0x4f, 0x43, 0x53, 0x4d,
+ 0x41, 0x43, 0x2e, 0x48, 0x41, 0x57, 0x4b, 0x45, 0x59, 0x45, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xea, 0x55, 0x00, 0x00, 0x00, 0xfc, 0xfa, 0xb8, 0x00, 0x00, 0xbb, 0x00,
+ 0x00, 0xb9, 0x00, 0x00, 0xba, 0x00, 0x00, 0xbe, 0x00, 0x00, 0xbf, 0x00,
+ 0x00, 0xbd, 0x00, 0x00, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0,
+ 0xb8, 0x88, 0x56, 0x8b, 0xe0, 0x83, 0x3e, 0x4e, 0x00, 0x00, 0x75, 0x1c,
+ 0x2b, 0xdb, 0x8b, 0xf3, 0xad, 0x8b, 0xd8, 0x8b, 0xc8, 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 0xc0, 0x26, 0x83, 0x0e,
+ 0x72, 0x00, 0x08, 0x2a, 0xe4, 0xb0, 0x13, 0xe6, 0x10, 0x90, 0x90, 0x90,
+ 0xb0, 0x08, 0xe6, 0x12, 0x90, 0x90, 0x90, 0xb0, 0x09, 0xe6, 0x12, 0x90,
+ 0x90, 0x90, 0xb0, 0xff, 0xe6, 0x12, 0x90, 0x90, 0x90, 0x26, 0x83, 0x26,
+ 0x72, 0x00, 0xf7, 0x8b, 0x86, 0x0f, 0x01, 0x26, 0xa3, 0x02, 0x00, 0x90,
+ 0x90, 0x90, 0x33, 0xc0, 0x26, 0xc7, 0x06, 0x04, 0x00, 0xff, 0xff, 0x26,
+ 0xc7, 0x06, 0x06, 0x00, 0xff, 0xff, 0x26, 0x09, 0x06, 0x08, 0x00, 0x26,
+ 0x09, 0x06, 0x0a, 0x00, 0xb8, 0x00, 0x00, 0xe7, 0x06, 0xb8, 0x0f, 0x27,
+ 0xe7, 0x00, 0xb8, 0x09, 0x00, 0xe7, 0x06, 0xb0, 0x11, 0xe8, 0xb0, 0x0a,
+ 0xe8, 0xed, 0x0a, 0xfb, 0xe9, 0x96, 0x0b, 0x90, 0x50, 0xb0, 0xa0, 0xe6,
+ 0x10, 0x58, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x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x08, 0x32,
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32,
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32,
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32,
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0xf4, 0x30, 0xbe, 0x2f,
+ 0xbe, 0x2f, 0xbe, 0x2f, 0xbe, 0x2f, 0xbe, 0x2f, 0x27, 0x31, 0xbe, 0x2f,
+ 0xbe, 0x2f, 0x39, 0x31, 0xbe, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x04, 0x05, 0xff, 0xff, 0xff, 0x00,
+ 0x03, 0x00, 0x03, 0x03, 0xb7, 0x05, 0xff, 0xff, 0xc2, 0x05, 0xd2, 0x05,
+ 0xd2, 0x05, 0xd2, 0x05, 0xd2, 0x05, 0x00, 0x00, 0xdd, 0x05, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0xe3, 0x05, 0x02, 0x06, 0x48, 0x06, 0x48, 0x06,
+ 0x48, 0x06, 0x17, 0x06, 0x27, 0x06, 0x00, 0x00, 0x2d, 0x06, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x1d,
+ 0xb2, 0x3d, 0xfe, 0x14, 0x6e, 0x2f, 0x17, 0x23, 0xf6, 0x43, 0x26, 0x1d,
+ 0xec, 0x3d, 0x78, 0x41, 0xf5, 0x3f, 0x0e, 0x3e, 0x93, 0x3f, 0x39, 0x41,
+ 0x5c, 0x3f, 0xf1, 0x40, 0xff,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, 0x00, 0xc3, 0x8e,
+ 0x46, 0x02, 0x33, 0xc0, 0x89, 0x86, 0xb6, 0x01, 0x8e, 0x46, 0x02, 0x26,
+ 0xa3, 0x10, 0x00, 0x8b, 0x86, 0x52, 0x15, 0x26, 0xa3, 0x30, 0x00, 0x89,
+ 0x86, 0xb2, 0x01, 0xc1, 0xe8, 0x08, 0x26, 0xa3, 0x34, 0x00, 0x8b, 0x86,
+ 0x54, 0x15, 0x26, 0xa3, 0x38, 0x00, 0xc1, 0xe8, 0x08, 0x26, 0xa3, 0x36,
+ 0x00, 0x33, 0xc0, 0xc6, 0x86, 0x83, 0x02, 0x01, 0x8d, 0xb6, 0x52, 0x09,
+ 0xc7, 0x86, 0xa6, 0x01, 0x5a, 0x09, 0x01, 0xae, 0xa6, 0x01, 0x89, 0xb6,
+ 0xa8, 0x01, 0x89, 0xb6, 0xaa, 0x01, 0xc7, 0x04, 0x30, 0x80, 0xc7, 0x44,
+ 0x04, 0x00, 0x00, 0xc6, 0x86, 0x86, 0x02, 0x01, 0xe8, 0x01, 0x09, 0xb8,
+ 0x00, 0x40, 0xf7, 0x86, 0xf6, 0x00, 0x00, 0x01, 0x74, 0x13, 0x25, 0xff,
+ 0x1f, 0x0d, 0x00, 0xa0, 0x83, 0xe0, 0xfd, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x0e, 0x0c, 0x00, 0x80, 0x00, 0x8e, 0x46, 0x02, 0x26, 0xa3, 0x00, 0x00,
+ 0xa1, 0x34, 0x55, 0x83, 0xc0, 0x02, 0xe8, 0x85, 0x04, 0x39, 0x06, 0x34,
+ 0x55, 0x75, 0xf7, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x00, 0x00,
+ 0x08, 0xbe, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x02, 0x00, 0xc8, 0x8e,
+ 0x46, 0x02, 0x26, 0xc7, 0x06, 0x0c, 0x00, 0xa0, 0x00, 0x8e, 0x46, 0x02,
+ 0x26, 0xc7, 0x06, 0x10, 0x00, 0x04, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x26, 0x00, 0x00, 0x7f, 0xff, 0x90, 0x90, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x0e, 0x00, 0x00, 0x80, 0x00, 0x90, 0x90, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x26, 0x00, 0x00, 0x7f, 0xff, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x28,
+ 0x00, 0x18, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e, 0x0c, 0x00, 0x01,
+ 0xc3, 0xc6, 0x86, 0x0c, 0x01, 0x01, 0xc6, 0x86, 0x0d, 0x01, 0x00, 0xe8,
+ 0x06, 0x23, 0xa1, 0x34, 0x55, 0x83, 0xc0, 0x02, 0x0b, 0xc0, 0x0b, 0xc0,
+ 0x0b, 0xc0, 0x0b, 0xc0, 0x39, 0x06, 0x34, 0x55, 0x72, 0xf2, 0x80, 0xbe,
+ 0x0d, 0x01, 0x01, 0x74, 0x03, 0xf9, 0xeb, 0x01, 0xf8, 0xc6, 0x86, 0x0c,
+ 0x01, 0x00, 0xc3, 0xb8, 0x00, 0x00, 0x88, 0x86, 0x06, 0x01, 0x88, 0x86,
+ 0x07, 0x01, 0x88, 0x86, 0x08, 0x01, 0x88, 0x86, 0x09, 0x01, 0x89, 0x86,
+ 0x0a, 0x01, 0x88, 0x86, 0xb8, 0x01, 0x88, 0x86, 0xb9, 0x01, 0x88, 0x86,
+ 0xcd, 0x01, 0xa2, 0x8a, 0x56, 0xc3, 0x50, 0x53, 0x52, 0xc6, 0x46, 0x01,
+ 0x00, 0x32, 0xe4, 0x8a, 0x46, 0x00, 0xbb, 0x00, 0xfd, 0xbb, 0x00, 0xee,
+ 0x83, 0x3e, 0x58, 0x55, 0x20, 0x75, 0x03, 0xbb, 0x00, 0x7d, 0x81, 0xeb,
+ 0x00, 0x75, 0x81, 0xe3, 0x00, 0xff, 0x89, 0x9e, 0x56, 0x15, 0x81, 0xc3,
+ 0x00, 0x01, 0xf7, 0xe3, 0x05, 0x00, 0x75, 0x89, 0x86, 0x52, 0x15, 0x03,
+ 0x86, 0x56, 0x15, 0x48, 0x89, 0x86, 0x54, 0x15, 0x5a, 0x5b, 0x58, 0xc3,
+ 0x51, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x0c, 0x00, 0xfc, 0x8e, 0x46,
+ 0x02, 0x26, 0xf7, 0x06, 0x14, 0x00, 0x80, 0x00, 0x75, 0x1e, 0xb9, 0xf4,
+ 0x01, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x0c, 0x00, 0x00, 0x08, 0x8e,
+ 0x46, 0x02, 0x26, 0xf7, 0x06, 0x14, 0x00, 0x80, 0x00, 0x75, 0x05, 0xe8,
+ 0x54, 0x03, 0xe2, 0xe5, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x0c, 0x00,
+ 0xff, 0xf7, 0x59, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e, 0x0c, 0x00, 0x02,
+ 0xc3, 0x50, 0x53, 0xc1, 0xe0, 0x05, 0x05, 0x00, 0x03, 0x8b, 0xd8, 0x8d,
+ 0x86, 0x00, 0x01, 0x89, 0x07, 0x8d, 0x86, 0xd0, 0x01, 0x89, 0x47, 0x02,
+ 0x8d, 0x86, 0xe0, 0x01, 0x89, 0x47, 0x04, 0x8d, 0x86, 0x58, 0x15, 0x89,
+ 0x47, 0x08, 0x8d, 0x86, 0x6c, 0x15, 0x89, 0x47, 0x06, 0x8d, 0x86, 0xbc,
+ 0x01, 0x89, 0x47, 0x0a, 0xc7, 0x47, 0x0c, 0x9c, 0x56, 0x8d, 0x86, 0x3c,
+ 0x02, 0x89, 0x47, 0x0e, 0x8d, 0x06, 0x34, 0x55, 0x89, 0x47, 0x10, 0xc7,
+ 0x47, 0x14, 0x00, 0x00, 0xc7, 0x47, 0x16, 0x00, 0x00, 0x8d, 0x86, 0xec,
+ 0x15, 0x89, 0x47, 0x18, 0x5b, 0x58, 0xc3, 0x8e, 0x46, 0x02, 0x80, 0xbe,
+ 0x2d, 0x01, 0x01, 0x75, 0x40, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x10,
+ 0x00, 0xfb, 0x26, 0xa1, 0x38, 0x00, 0x2d, 0x00, 0x02, 0x3b, 0x86, 0x52,
+ 0x15, 0x73, 0x0c, 0x8b, 0xd8, 0x2b, 0x9e, 0x52, 0x15, 0x8b, 0x86, 0x54,
+ 0x15, 0x2b, 0xc3, 0x26, 0xa3, 0x6c, 0x00, 0x26, 0xa1, 0x12, 0x00, 0x89,
+ 0x86, 0x32, 0x01, 0x26, 0xc7, 0x06, 0x12, 0x00, 0x00, 0x01, 0x8e, 0x46,
+ 0x02, 0x26, 0x83, 0x0e, 0x10, 0x00, 0x05, 0xeb, 0x18, 0x8e, 0x46, 0x02,
+ 0x26, 0x83, 0x26, 0x10, 0x00, 0xfe, 0x8b, 0x86, 0x32, 0x01, 0x26, 0xa3,
+ 0x12, 0x00, 0xb8, 0xff, 0xff, 0x26, 0xa3, 0x6c, 0x00, 0xc3, 0x50, 0xf7,
+ 0x86, 0xf6, 0x00, 0x02, 0x00, 0x75, 0x02, 0xeb, 0x4b, 0xf6, 0x86, 0x60,
+ 0x02, 0x01, 0x75, 0x07, 0xf6, 0x86, 0x6e, 0x02, 0x01, 0x74, 0x3d, 0xf6,
+ 0x86, 0x85, 0x02, 0x01, 0x74, 0x36, 0xc6, 0x86, 0x85, 0x02, 0x00, 0x8b,
+ 0x86, 0x06, 0x02, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x40, 0x74, 0x03, 0x25,
+ 0xff, 0xaf, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x20, 0x74, 0x03, 0x25, 0xff,
+ 0xdf, 0x89, 0x86, 0x06, 0x02, 0x3b, 0x86, 0x36, 0x02, 0x74, 0x0d, 0x89,
+ 0x86, 0x36, 0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b, 0x8e, 0xdb, 0x83, 0x06, 0x34, 0x55, 0x01, 0x73,
+ 0x04, 0x11, 0x1e, 0x36, 0x55, 0xb9, 0x01, 0x00, 0x8b, 0xaf, 0x52, 0x55,
+ 0xf6, 0x06, 0x8a, 0x56, 0x01, 0x75, 0x03, 0xe8, 0xda, 0x3e, 0xf7, 0x06,
+ 0x34, 0x55, 0x07, 0x00, 0x74, 0x10, 0x80, 0xbe, 0x2d, 0x01, 0x01, 0x75,
+ 0x09, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e, 0x10, 0x00, 0x01, 0xf7, 0x86,
+ 0xa3, 0x02, 0x01, 0x00, 0x74, 0x30, 0xfe, 0x86, 0x6b, 0x01, 0x80, 0xbe,
+ 0x6b, 0x01, 0x02, 0x73, 0x02, 0xeb, 0x23, 0xc6, 0x86, 0x6b, 0x01, 0x00,
+ 0xf7, 0x86, 0x1c, 0x01, 0x01, 0x00, 0x75, 0x0a, 0x8e, 0x46, 0x02, 0x26,
+ 0x81, 0x26, 0x04, 0x00, 0x32, 0xfe, 0x81, 0xa6, 0x18, 0x01, 0x32, 0xfe,
+ 0xc7, 0x86, 0xa3, 0x02, 0x00, 0x00, 0xc6, 0x86, 0x6a, 0x01, 0x00, 0x8e,
+ 0x46, 0x02, 0x26, 0xa1, 0x08, 0x00, 0x25, 0x00, 0x02, 0x74, 0x03, 0xe8,
+ 0x1d, 0x12, 0xf6, 0x86, 0x54, 0x02, 0x01, 0x74, 0x03, 0xe8, 0x90, 0x3e,
+ 0x8b, 0x86, 0xf6, 0x00, 0x25, 0xd0, 0xe5, 0x89, 0x86, 0x2c, 0x02, 0x8a,
+ 0x46, 0x08, 0x3c, 0x06, 0x74, 0x08, 0x3c, 0x0a, 0x74, 0x04, 0x3c, 0x18,
+ 0x75, 0x04, 0xff, 0x86, 0x46, 0x02, 0x83, 0xc3, 0x02, 0x49, 0x74, 0x03,
+ 0xe9, 0x5d, 0xff, 0xf7, 0x06, 0x48, 0x55, 0xff, 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0x83, 0xc8, 0x20, 0xc6, 0x86, 0x7a, 0x02, 0x00, 0xeb, 0x08, 0x83,
+ 0xe0, 0xdf, 0xc6, 0x86, 0x7a, 0x02, 0x01, 0xf6, 0x86, 0x54, 0x02, 0x01,
+ 0x74, 0x0a, 0xc6, 0x86, 0x7a, 0x02, 0x00, 0x83, 0xc8, 0x40, 0xeb, 0x03,
+ 0x83, 0xe0, 0xbf, 0xf6, 0x86, 0x79, 0x02, 0x01, 0x74, 0x05, 0x0d, 0x80,
+ 0x00, 0xeb, 0x03, 0x25, 0x7f, 0xff, 0xf6, 0x86, 0x78, 0x02, 0x01, 0x74,
+ 0x05, 0x0d, 0x00, 0x01, 0xeb, 0x03, 0x25, 0xff, 0xfe, 0xf6, 0x86, 0x7a,
+ 0x02, 0x01, 0x74, 0x05, 0x0d, 0x00, 0x20, 0xeb, 0x03, 0x25, 0xff, 0xdf,
+ 0x33, 0xd8, 0x74, 0x12, 0xf7, 0xc3, 0x20, 0x00, 0x74, 0x05, 0xc6, 0x06,
+ 0x0a, 0x13, 0x01, 0x25, 0xff, 0xf7, 0x26, 0xa3, 0x0c, 0x00, 0x26, 0xa1,
+ 0x10, 0x00, 0x8b, 0xd8, 0x33, 0xd8, 0x74, 0x04, 0x26, 0xa3, 0x10, 0x00,
+ 0xf6, 0x06, 0x0a, 0x13, 0x01, 0x74, 0x1e, 0xc6, 0x06, 0x0a, 0x13, 0x00,
+ 0x26, 0x81, 0x26, 0x00, 0x00, 0x7f, 0xff, 0x90, 0x90, 0x26, 0x81, 0x0e,
+ 0x00, 0x00, 0x80, 0x00, 0x90, 0x90, 0x26, 0x81, 0x26, 0x00, 0x00, 0x7f,
+ 0xff, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x00, 0x8e, 0x46, 0x02, 0xf7, 0x86,
+ 0xf4, 0x00, 0x04, 0x00, 0x74, 0x0b, 0xc6, 0x06, 0x8a, 0x56, 0x01, 0x26,
+ 0x83, 0x0e, 0x02, 0x00, 0x02, 0xc6, 0x86, 0xab, 0x02, 0x00, 0xc6, 0x86,
+ 0xac, 0x02, 0x00, 0x81, 0xa6, 0xf6, 0x00, 0xff, 0xfb, 0xa8, 0x01, 0x74,
+ 0x19, 0x81, 0x8e, 0xf6, 0x00, 0x00, 0x04, 0x26, 0x83, 0x0e, 0x02, 0x00,
+ 0x20, 0x26, 0x83, 0x26, 0x02, 0x00, 0xef, 0xc6, 0x86, 0xac, 0x02, 0x01,
+ 0xeb, 0x4d, 0xa8, 0x02, 0x74, 0x1f, 0x26, 0x83, 0x26, 0x02, 0x00, 0xcf,
+ 0xf7, 0x86, 0xf4, 0x00, 0x04, 0x00, 0x75, 0x0d, 0xf7, 0x86, 0x12, 0x01,
+ 0x00, 0x84, 0x75, 0x05, 0xc6, 0x86, 0xab, 0x02, 0x01, 0xb0, 0x02, 0xeb,
+ 0x2a, 0xa8, 0x04, 0x74, 0x0e, 0x26, 0x83, 0x0e, 0x02, 0x00, 0x20, 0x26,
+ 0x83, 0x26, 0x02, 0x00, 0xef, 0xeb, 0x18, 0xa8, 0x08, 0x74, 0x08, 0x26,
+ 0x83, 0x0e, 0x02, 0x00, 0x30, 0xeb, 0x0c, 0xa8, 0x10, 0x74, 0x08, 0x26,
+ 0x83, 0x0e, 0x02, 0x00, 0x30, 0xeb, 0x00, 0xf6, 0x06, 0x8a, 0x56, 0x01,
+ 0x74, 0x06, 0x26, 0x83, 0x26, 0x02, 0x00, 0xcf, 0xc3, 0xc3, 0x8e, 0x46,
+ 0x02, 0x26, 0x81, 0x0e, 0x0c, 0x00, 0x00, 0x01, 0x90, 0x90, 0x8e, 0x46,
+ 0x02, 0x26, 0x81, 0x26, 0x0c, 0x00, 0xff, 0xfe, 0xc3, 0x8e, 0x46, 0x02,
+ 0xf6, 0x06, 0x8a, 0x56, 0x01, 0x75, 0x0f, 0x80, 0xbe, 0xab, 0x02, 0x01,
+ 0x75, 0x10, 0x26, 0x83, 0x0e, 0x02, 0x00, 0x02, 0xeb, 0x08, 0xc6, 0x86,
+ 0x6c, 0x01, 0x01, 0xe8, 0x9c, 0x3f, 0xc3, 0x8e, 0x46, 0x02, 0xf7, 0x86,
+ 0xf4, 0x00, 0x02, 0x00, 0x74, 0x09, 0x26, 0x81, 0x26, 0x02, 0x00, 0xff,
+ 0xef, 0xeb, 0x07, 0x26, 0x81, 0x0e, 0x02, 0x00, 0x00, 0x10, 0xc3, 0x8e,
+ 0x46, 0x02, 0xf7, 0x86, 0xf4, 0x00, 0x02, 0x00, 0x74, 0x09, 0x26, 0x81,
+ 0x0e, 0x02, 0x00, 0x00, 0x10, 0xeb, 0x07, 0x26, 0x81, 0x26, 0x02, 0x00,
+ 0xff, 0xef, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x02, 0x00, 0x00,
+ 0x80, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x02, 0x00, 0xff, 0x7f,
+ 0xc3, 0xf7, 0x86, 0xf4, 0x00, 0x08, 0x00, 0x74, 0x13, 0xe8, 0xdf, 0xff,
+ 0xeb, 0x3a, 0x80, 0x7e, 0x06, 0x0e, 0x74, 0x1e, 0x80, 0x7e, 0x06, 0x48,
+ 0x74, 0x24, 0xeb, 0x2c, 0xe8, 0xd7, 0xff, 0x8e, 0x46, 0x02, 0xf7, 0x86,
+ 0xf4, 0x00, 0x10, 0x00, 0x75, 0xe4, 0xf7, 0x86, 0xf6, 0x00, 0x00, 0x01,
+ 0x75, 0x0c, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x02, 0x00, 0x00, 0x40,
+ 0xeb, 0x0a, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x26, 0x02, 0x00, 0xff, 0xbf,
+ 0xc3, 0x83, 0xe0, 0xf7, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x04, 0x74, 0x03,
+ 0x83, 0xc8, 0x08, 0xc3, 0x53, 0x40, 0x03, 0x06, 0x34, 0x55, 0x8b, 0xd8,
+ 0xe8, 0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 0xe8, 0x6c, 0x2b,
+ 0xc6, 0x86, 0xad, 0x02, 0x00, 0x8d, 0xbe, 0x0a, 0x03, 0x8c, 0xd8, 0x8e,
+ 0xc0, 0xab, 0xab, 0xab, 0xf6, 0x86, 0xa6, 0x02, 0x01, 0x74, 0x04, 0xc6,
+ 0x46, 0x09, 0x1e, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x04, 0x00, 0xff,
+ 0xfb, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x02, 0x74, 0x10, 0xf7, 0x86, 0x20,
+ 0x01, 0x80, 0x00, 0x75, 0x08, 0xbe, 0x59, 0x46, 0xe8, 0x3d, 0xf7, 0xeb,
+ 0x0d, 0x8e, 0x46, 0x02, 0x33, 0xc0, 0x26, 0xa3, 0x24, 0x00, 0x26, 0xa3,
+ 0x26, 0x00, 0xc3, 0x90, 0x33, 0xc0, 0x88, 0x86, 0x5b, 0x02, 0x88, 0x86,
+ 0x5e, 0x02, 0x88, 0x86, 0x60, 0x02, 0x88, 0x86, 0x63, 0x02, 0x88, 0x86,
+ 0x68, 0x02, 0xbe, 0xff, 0x45, 0xe8, 0x10, 0xf7, 0xc6, 0x86, 0xad, 0x02,
+ 0x01, 0x8e, 0x46, 0x02, 0xf6, 0x06, 0x8a, 0x56, 0x01, 0x75, 0x08, 0x26,
+ 0x83, 0x26, 0x02, 0x00, 0xfd, 0xeb, 0x08, 0xc6, 0x86, 0x6d, 0x01, 0x01,
+ 0xe8, 0x2f, 0x3b, 0xc3, 0xc7, 0x86, 0x2e, 0x02, 0x03, 0x00, 0xe8, 0xe9,
+ 0xee, 0xc6, 0x86, 0x69, 0x02, 0x01, 0xc6, 0x86, 0x6b, 0x02, 0x01, 0xe8,
+ 0x1a, 0xf9, 0x8e, 0x46, 0x02, 0x26, 0x81, 0x0e, 0x00, 0x00, 0x00, 0x1e,
+ 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e, 0x10, 0x00, 0x04, 0xbe, 0x17, 0x46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80, 0x7e, 0x06, 0x0e, 0x74, 0x02, 0xeb, 0x37, 0x8e, 0x46, 0x02,
+ 0x26, 0x83, 0x0e, 0x0c, 0x00, 0x01, 0x83, 0xa6, 0x06, 0x02, 0xdf, 0xc6,
+ 0x86, 0x85, 0x02, 0x01, 0xf6, 0x86, 0x5b, 0x02, 0x01, 0x74, 0x1d, 0xf6,
+ 0x86, 0x66, 0x02, 0x01, 0x74, 0x16, 0xf6, 0x86, 0x63, 0x02, 0x01, 0x75,
+ 0x0f, 0xc6, 0x86, 0x63, 0x02, 0x01, 0xf6, 0x86, 0x54, 0x02, 0x01, 0x75,
+ 0x03, 0xe8, 0x88, 0x0e, 0xc3, 0x90, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26,
+ 0x0c, 0x00, 0xfe, 0xc7, 0x86, 0x32, 0x02, 0x02, 0x00, 0xc6, 0x86, 0x69,
+ 0x02, 0x01, 0xe8, 0x43, 0xf7, 0xe8, 0x12, 0xf9, 0xbe, 0xd5, 0x45, 0xe8,
+ 0xfa, 0xf4, 0xe8, 0x1e, 0x0e, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26,
+ 0x0c, 0x00, 0xfe, 0xc7, 0x86, 0x32, 0x02, 0x03, 0x00, 0xc7, 0x86, 0xc2,
+ 0x02, 0x00, 0x00, 0xc7, 0x86, 0xc4, 0x01, 0x0a, 0x00, 0xf6, 0x86, 0x54,
+ 0x02, 0x01, 0x74, 0x0f, 0xc6, 0x86, 0x54, 0x02, 0x00, 0x8e, 0x46, 0x02,
+ 0x26, 0x81, 0x26, 0x24, 0x00, 0xff, 0x7f, 0xc6, 0x86, 0x5a, 0x02, 0x00,
+ 0xc6, 0x86, 0x69, 0x02, 0x01, 0xc6, 0x86, 0x6b, 0x02, 0x01, 0xe8, 0xf3,
+ 0xf6, 0x81, 0xa6, 0x06, 0x02, 0xff, 0x2f, 0x83, 0x8e, 0x06, 0x02, 0x20,
+ 0xc6, 0x86, 0x85, 0x02, 0x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, 0xc7, 0x06, 0x10, 0x00, 0x04, 0x00,
+ 0x33, 0xc0, 0x88, 0x86, 0x88, 0x02, 0x88, 0x86, 0x89, 0x02, 0xc6, 0x86,
+ 0x63, 0x01, 0x01, 0xc7, 0x86, 0x64, 0x01, 0xf8, 0x05, 0xc6, 0x86, 0x69,
+ 0x01, 0x02, 0xc3, 0x90, 0xff, 0x86, 0x44, 0x02, 0x8e, 0x46, 0x02, 0x26,
+ 0x83, 0x26, 0x0c, 0x00, 0xfe, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e, 0x10,
+ 0x00, 0x04, 0xc7, 0x86, 0xae, 0x02, 0x02, 0x00, 0xc7, 0x86, 0xb0, 0x02,
+ 0x08, 0x00, 0xc6, 0x86, 0x54, 0x02, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x26, 0x24, 0x00, 0xff, 0x7f, 0xc6, 0x86, 0x69, 0x02, 0x00, 0xc6, 0x86,
+ 0x6b, 0x02, 0x00, 0xe8, 0xce, 0xf5, 0xf6, 0x86, 0x81, 0x02, 0x01, 0x75,
+ 0x06, 0xbe, 0x93, 0x45, 0xe8, 0x81, 0xf3, 0x81, 0xa6, 0x06, 0x02, 0xff,
+ 0x6f, 0x81, 0x8e, 0x06, 0x02, 0x00, 0x40, 0xc6, 0x86, 0x85, 0x02, 0x01,
+ 0xc3, 0x90, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26, 0x0c, 0x00, 0xfe, 0x83,
+ 0xbe, 0xc6, 0x01, 0x00, 0x74, 0x0d, 0x8b, 0x86, 0xc6, 0x01, 0xc7, 0x86,
+ 0xc6, 0x01, 0x00, 0x00, 0xe8, 0x45, 0x0f, 0xbe, 0x9f, 0x45, 0xe8, 0x4b,
+ 0xf3, 0xc3, 0xc7, 0x86, 0x32, 0x02, 0x01, 0x00, 0xc7, 0x86, 0x30, 0x02,
+ 0x02, 0x00, 0x32, 0xc0, 0xe8, 0xf9, 0x11, 0x80, 0x7e, 0x06, 0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02, 0x01, 0xe8, 0xef, 0x00, 0xc3, 0xc7, 0x86, 0x30, 0x02, 0x01, 0x00,
+ 0xc3, 0x90, 0xc3, 0x53, 0x50, 0x89, 0x86, 0x22, 0x01, 0x80, 0xbe, 0x62,
+ 0x01, 0x01, 0x75, 0x0f, 0x50, 0xe8, 0x62, 0xea, 0xe8, 0x5f, 0x24, 0xc6,
+ 0x46, 0x07, 0x00, 0x58, 0xe9, 0x9d, 0x00, 0xf6, 0x86, 0x08, 0x01, 0x01,
+ 0x74, 0x05, 0xe8, 0xa1, 0x25, 0xeb, 0x57, 0x83, 0xf8, 0x10, 0x75, 0x08,
+ 0x81, 0x8e, 0x1e, 0x01, 0x00, 0x80, 0xeb, 0x4a, 0x83, 0x8e, 0x1e, 0x01,
+ 0x02, 0x8b, 0x9e, 0x06, 0x02, 0x83, 0xf8, 0x01, 0x75, 0x04, 0x81, 0xcb,
+ 0x00, 0x04, 0x83, 0xf8, 0x0c, 0x75, 0x04, 0x81, 0xcb, 0x00, 0x08, 0x83,
+ 0xf8, 0x0b, 0x75, 0x03, 0x83, 0xcb, 0x02, 0x83, 0xf8, 0x09, 0x75, 0x03,
+ 0x83, 0xcb, 0x04, 0x83, 0xf8, 0x0a, 0x75, 0x04, 0x81, 0xcb, 0x00, 0x01,
+ 0x83, 0xf8, 0x06, 0x75, 0x03, 0x83, 0xcb, 0x01, 0x83, 0xf8, 0x0f, 0x74,
+ 0x09, 0x89, 0x9e, 0x06, 0x02, 0xc6, 0x86, 0x85, 0x02, 0x01, 0xc6, 0x46,
+ 0x07, 0x12, 0xc6, 0x46, 0x09, 0x1e, 0xf6, 0x86, 0xa7, 0x02, 0x01, 0x74,
+ 0x1a, 0x8e, 0x46, 0x02, 0xf6, 0x06, 0x8a, 0x56, 0x01, 0x75, 0x08, 0x26,
+ 0x83, 0x26, 0x02, 0x00, 0xfd, 0xeb, 0x08, 0xc6, 0x86, 0x6d, 0x01, 0x01,
+ 0xe8, 0x07, 0x36, 0xf6, 0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, 0xc7, 0x83, 0xf8, 0x04,
+ 0x7c, 0x40, 0x8b, 0x49, 0x16, 0x88, 0xae, 0x04, 0x02, 0x51, 0x80, 0xe1,
+ 0xf0, 0x80, 0xf9, 0x00, 0x74, 0x09, 0x80, 0xf9, 0x30, 0x74, 0x04, 0x59,
+ 0xe9, 0xca, 0x00, 0x59, 0x0b, 0xff, 0x74, 0x0f, 0xf6, 0xc1, 0x0f, 0x74,
+ 0x19, 0x80, 0xf9, 0x33, 0x74, 0x14, 0x80, 0xf9, 0x03, 0x74, 0x0f, 0x86,
+ 0xc4, 0x39, 0x41, 0x14, 0x86, 0xc4, 0x75, 0x02, 0xeb, 0x0c, 0xe9, 0x66,
+ 0x01, 0x90, 0xe9, 0xa4, 0x00, 0x90, 0xe9, 0x63, 0x01, 0x90, 0xf6, 0x86,
+ 0x90, 0x02, 0x01, 0x74, 0x11, 0xe8, 0x7c, 0xfa, 0x80, 0x7e, 0x06, 0x04,
+ 0x75, 0x08, 0xc6, 0x86, 0x6b, 0x02, 0x00, 0xe8, 0x02, 0xee, 0xf6, 0x86,
+ 0x92, 0x02, 0x01, 0x74, 0x20, 0xc6, 0x86, 0x92, 0x02, 0x00, 0x50, 0x8b,
+ 0x86, 0xf8, 0x00, 0x33, 0x86, 0xf6, 0x00, 0xa9, 0x00, 0x01, 0x58, 0x74,
+ 0x0c, 0xb8, 0x0e, 0x00, 0xe8, 0x30, 0xf9, 0xeb, 0x64, 0x90, 0xe9, 0x2f,
+ 0x01, 0x80, 0xfd, 0x15, 0x77, 0x11, 0x80, 0xfd, 0x01, 0x74, 0xf3, 0x80,
+ 0xfd, 0x09, 0x74, 0xee, 0x80, 0xfd, 0x0a, 0x74, 0xe9, 0xeb, 0x11, 0x80,
+ 0xfd, 0x20, 0x72, 0xe2, 0x80, 0xfd, 0x29, 0x77, 0xdd, 0x80, 0xfd, 0x21,
+ 0x74, 0xd8, 0xeb, 0x92, 0x80, 0xfd, 0x10, 0x76, 0x02, 0xeb, 0x0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0x0e, 0x00,
+ 0x00, 0x00, 0x02, 0xf6, 0x86, 0xaa, 0x02, 0x01, 0x74, 0x0c, 0x8e, 0x46,
+ 0x02, 0x26, 0x81, 0x0e, 0x00, 0x00, 0x00, 0x1c, 0xeb, 0x0a, 0x8e, 0x46,
+ 0x02, 0x26, 0x81, 0x26, 0x00, 0x00, 0xff, 0xe3, 0x33, 0xc0, 0x89, 0x86,
+ 0xae, 0x01, 0x40, 0x88, 0x86, 0x83, 0x02, 0x58, 0xf6, 0x86, 0x54, 0x02,
+ 0x01, 0x74, 0x0a, 0xe8, 0xe0, 0xe4, 0x8e, 0x46, 0x02, 0x26, 0xa2, 0x1c,
+ 0x00, 0x8b, 0x9e, 0xa8, 0x01, 0x83, 0x3f, 0x00, 0x74, 0x0f, 0xf7, 0x07,
+ 0x20, 0x00, 0x75, 0x06, 0xc7, 0x07, 0x00, 0x00, 0xeb, 0x03, 0xe8, 0x89,
+ 0x00, 0xf6, 0x86, 0x87, 0x02, 0x01, 0x74, 0x19, 0x8e, 0x46, 0x02, 0x26,
+ 0x89, 0x1e, 0x2c, 0x00, 0xc6, 0x86, 0x87, 0x02, 0x00, 0x8e, 0x46, 0x02,
+ 0x26, 0x83, 0x0e, 0x0c, 0x00, 0x08, 0xfb, 0xeb, 0x06, 0xc6, 0x86, 0x86,
+ 0x02, 0x01, 0xfb, 0xc3, 0x56, 0x8d, 0xb6, 0x52, 0x09, 0xc7, 0x86, 0xa6,
+ 0x01, 0x5a, 0x09, 0x01, 0xae, 0xa6, 0x01, 0x89, 0xb6, 0xa8, 0x01, 0x89,
+ 0xb6, 0xaa, 0x01, 0xc7, 0x04, 0x30, 0x80, 0xc7, 0x44, 0x04, 0x00, 0x00,
+ 0xc6, 0x86, 0x86, 0x02, 0x01, 0x5e, 0xc3, 0xff, 0xa4, 0x20, 0x04, 0x80,
+ 0x7e, 0x06, 0x46, 0x75, 0x1c, 0xf6, 0x86, 0x76, 0x02, 0x01, 0x74, 0x15,
+ 0xff, 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 0x00, 0xe8, 0x37, 0xe8, 0xc3, 0xc7, 0x86, 0x2a,
+ 0x02, 0x0f, 0x00, 0x80, 0x7e, 0x06, 0x44, 0x74, 0x06, 0x80, 0x7e, 0x06,
+ 0x42, 0x75, 0x08, 0xb8, 0x06, 0x00, 0xe8, 0x1e, 0xe8, 0xeb, 0x0d, 0xf6,
+ 0x86, 0x72, 0x02, 0x01, 0x74, 0x06, 0xbe, 0x3b, 0x46, 0xe8, 0x80, 0xda,
+ 0xc3, 0x80, 0x7e, 0x06, 0x44, 0x75, 0x14, 0xe8, 0x76, 0xd8, 0xc7, 0x44,
+ 0x02, 0x02, 0x00, 0x8d, 0x7e, 0x16, 0xe8, 0x89, 0xd8, 0xbe, 0xb7, 0x45,
+ 0xe8, 0x17, 0xdb, 0xc3, 0xf7, 0x86, 0xf6, 0x00, 0x40, 0x00, 0x74, 0x18,
+ 0xf7, 0x86, 0xf4, 0x00, 0x00, 0x20, 0x74, 0x10, 0x80, 0x7e, 0x06, 0x08,
+ 0x72, 0x0a, 0x80, 0x7e, 0x06, 0x0e, 0x77, 0x04, 0xc6, 0x46, 0x07, 0x14,
+ 0xc3, 0xff, 0x86, 0x4c, 0x02, 0xc7, 0x86, 0x2a, 0x02, 0x0b, 0x00, 0x8a,
+ 0x86, 0x54, 0x02, 0x88, 0x86, 0x80, 0x02, 0xc7, 0x86, 0xc2, 0x02, 0x00,
+ 0x00, 0xc6, 0x86, 0x61, 0x02, 0x00, 0x83, 0x8e, 0x06, 0x02, 0x20, 0x81,
+ 0xa6, 0x06, 0x02, 0xff, 0x2f, 0xc6, 0x86, 0x85, 0x02, 0x01, 0xf6, 0x86,
+ 0x54, 0x02, 0x01, 0x74, 0x38, 0xc6, 0x86, 0x80, 0x02, 0x00, 0x8e, 0x46,
+ 0x02, 0x26, 0x81, 0x26, 0x24, 0x00, 0xff, 0x7f, 0x80, 0x7e, 0x0a, 0x00,
+ 0x75, 0x0a, 0xc6, 0x86, 0x69, 0x02, 0x00, 0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0xe9, 0xec, 0x00,
+ 0x80, 0x7e, 0x0a, 0x00, 0x75, 0x1d, 0xc6, 0x86, 0x69, 0x02, 0x00, 0xc6,
+ 0x86, 0x6b, 0x02, 0x00, 0x8a, 0x86, 0x54, 0x02, 0x8a, 0xa6, 0x80, 0x02,
+ 0x88, 0xa6, 0x54, 0x02, 0xe8, 0x5d, 0xdb, 0x88, 0x86, 0x54, 0x02, 0xc6,
+ 0x46, 0x09, 0x0c, 0xb8, 0x00, 0x03, 0xe8, 0x03, 0xf5, 0xe9, 0xbc, 0x00,
+ 0x80, 0x7e, 0x08, 0x00, 0x75, 0x3d, 0xf6, 0x86, 0x54, 0x02, 0x01, 0x75,
+ 0x16, 0xf6, 0x86, 0x68, 0x02, 0x01, 0x74, 0x16, 0xf6, 0x86, 0x5e, 0x02,
+ 0x01, 0x74, 0x08, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x01, 0x75, 0x16, 0xc6,
+ 0x46, 0x09, 0x0c, 0xe9, 0x92, 0x00, 0xf6, 0x86, 0x5e, 0x02, 0x01, 0x74,
+ 0x9c, 0xf7, 0x86, 0x12, 0x01, 0x00, 0x01, 0x74, 0x94, 0xc6, 0x46, 0x09,
+ 0x04, 0xff, 0x86, 0x4a, 0x02, 0xeb, 0x79, 0x80, 0x7e, 0x08, 0x0a, 0x75,
+ 0x73, 0xf6, 0x86, 0x5f, 0x02, 0x01, 0x75, 0x0e, 0xf7, 0x86, 0x12, 0x01,
+ 0x00, 0x01, 0x75, 0x06, 0xc6, 0x46, 0x09, 0x0c, 0xeb, 0x5e, 0xf7, 0x86,
+ 0x12, 0x01, 0x00, 0x01, 0x74, 0x56, 0xc6, 0x46, 0x09, 0x04, 0xeb, 0x50,
+ 0x80, 0x7e, 0x08, 0x04, 0x75, 0x2c, 0xc6, 0x46, 0x09, 0x0c, 0x80, 0x7e,
+ 0x0a, 0x00, 0x75, 0x1d, 0xc6, 0x86, 0x69, 0x02, 0x00, 0xc6, 0x86, 0x6b,
+ 0x02, 0x00, 0x8a, 0x86, 0x54, 0x02, 0x8a, 0xa6, 0x80, 0x02, 0x88, 0xa6,
+ 0x54, 0x02, 0xe8, 0xb7, 0xda, 0x88, 0x86, 0x54, 0x02, 0xe8, 0x5f, 0xf1,
+ 0xeb, 0x1e, 0x80, 0x7e, 0x08, 0x00, 0x75, 0x09, 0xf6, 0x86, 0x68, 0x02,
+ 0x01, 0x74, 0x02, 0xeb, 0xab, 0x80, 0x7e, 0x08, 0x0a, 0x75, 0x09, 0xf6,
+ 0x86, 0x5f, 0x02, 0x01, 0x75, 0x02, 0xeb, 0x9c, 0x8a, 0x86, 0x80, 0x02,
+ 0x88, 0x86, 0x54, 0x02, 0xc3, 0xc7, 0x86, 0xbc, 0x02, 0x02, 0x00, 0xff,
+ 0x86, 0x42, 0x02, 0xc7, 0x86, 0x2a, 0x02, 0x0c, 0x00, 0x80, 0x7e, 0x06,
+ 0x04, 0x74, 0x06, 0x80, 0x7e, 0x06, 0x06, 0x75, 0x04, 0xc6, 0x46, 0x07,
+ 0x08, 0x80, 0x7e, 0x08, 0x00, 0x75, 0x56, 0xf6, 0x86, 0x54, 0x02, 0x01,
+ 0x74, 0x3b, 0xc6, 0x86, 0x54, 0x02, 0x00, 0x8e, 0x46, 0x02, 0x26, 0x81,
+ 0x26, 0x24, 0x00, 0xff, 0x7f, 0xb8, 0x00, 0x02, 0xe8, 0xf9, 0xf3, 0xf6,
+ 0x86, 0x5e, 0x02, 0x01, 0x74, 0x0c, 0xbe, 0xbd, 0x45, 0xe8, 0xf8, 0xd7,
+ 0xbe, 0xdb, 0x45, 0xe8, 0xf2, 0xd7, 0x80, 0x7e, 0x0a, 0x00, 0x75, 0x0d,
+ 0xc6, 0x86, 0x69, 0x02, 0x00, 0xc6, 0x86, 0x6b, 0x02, 0x00, 0xe8, 0x1f,
+ 0xda, 0xf6, 0x86, 0x5e, 0x02, 0x01, 0x74, 0x34, 0xc6, 0x86, 0x58, 0x02,
+ 0x00, 0xc6, 0x86,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 0x01, 0x01, 0x74, 0xea, 0xc6, 0x86,
+ 0x08, 0x01, 0x01, 0xc6, 0x86, 0xcd, 0x01, 0x00, 0xc6, 0x86, 0x09, 0x01,
+ 0x00, 0x8b, 0x86, 0xf8, 0x00, 0x89, 0x86, 0xf6, 0x00, 0x8d, 0xb6, 0x76,
+ 0x15, 0xb8, 0x03, 0x00, 0xf6, 0x04, 0x80, 0x75, 0xc7, 0x33, 0xc0, 0x39,
+ 0x04, 0x75, 0x1e, 0x39, 0x44, 0x02, 0x75, 0x19, 0x39, 0x44, 0x04, 0x75,
+ 0x14, 0x8b, 0x86, 0x00, 0x01, 0x89, 0x04, 0x8b, 0x86, 0x02, 0x01, 0x89,
+ 0x44, 0x02, 0x8b, 0x86, 0x04, 0x01, 0x89, 0x44, 0x04, 0xad, 0x8b, 0x14,
+ 0x8b, 0x74, 0x02, 0x89, 0x86, 0xd0, 0x01, 0x89, 0x96, 0xd2, 0x01, 0x89,
+ 0xb6, 0xd4, 0x01, 0x8e, 0x46, 0x02, 0x50, 0xe8, 0xfc, 0xcd, 0x26, 0xa3,
+ 0x1e, 0x00, 0x8b, 0xc2, 0xe8, 0xf3, 0xcd, 0x26, 0xa3, 0x20, 0x00, 0x8b,
+ 0xc6, 0xe8, 0xea, 0xcd, 0x26, 0xa3, 0x22, 0x00, 0x58, 0xbb, 0x2c, 0x05,
+ 0xb9, 0x13, 0x00, 0x1e, 0x07, 0x8b, 0x3f, 0x03, 0xfd, 0xab, 0x89, 0x15,
+ 0x89, 0x75, 0x02, 0x83, 0xc3, 0x02, 0xe2, 0xf1, 0xbb, 0x28, 0x05, 0x8d,
+ 0x96, 0x84, 0x15, 0xb8, 0x02, 0x00, 0x8b, 0x3f, 0x03, 0xfd, 0x8b, 0xf2,
+ 0xb9, 0x09, 0x00, 0xf3, 0xa5, 0x83, 0xc3, 0x02, 0x48, 0x75, 0xef, 0xf7,
+ 0x86, 0xf6, 0x00, 0x08, 0x00, 0x74, 0x06, 0xbe, 0x65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0x75,
+ 0x0b, 0xf7, 0x86, 0xf6, 0x00, 0x00, 0x02, 0x75, 0x03, 0xb8, 0xc6, 0x11,
+ 0x89, 0x86, 0xfa, 0x00, 0x89, 0x86, 0x32, 0x01, 0x8d, 0xbe, 0x30, 0x04,
+ 0x8b, 0x44, 0x0c, 0x89, 0x05, 0x89, 0x86, 0x00, 0x01, 0x8b, 0x44, 0x0e,
+ 0x89, 0x45, 0x02, 0x89, 0x86, 0x02, 0x01, 0x8b, 0x44, 0x10, 0x89, 0x45,
+ 0x04, 0x89, 0x86, 0x04, 0x01, 0x80, 0xbe, 0x62, 0x01, 0x01, 0x75, 0x21,
+ 0x8b, 0x44, 0x0c, 0x89, 0x86, 0xb0, 0x03, 0x89, 0x86, 0xb6, 0x03, 0x8b,
+ 0x44, 0x0e, 0x89, 0x86, 0xb2, 0x03, 0x89, 0x86, 0xb8, 0x03, 0x8b, 0x44,
+ 0x10, 0x89, 0x86, 0xb4, 0x03, 0x89, 0x86, 0xba, 0x03, 0x8e, 0x46, 0x02,
+ 0x8b, 0x86, 0xfa, 0x00, 0x26, 0xa3, 0x12, 0x00, 0x8b, 0x44, 0x14, 0x26,
+ 0xa3, 0x2a, 0x00, 0x8b, 0x44, 0x16, 0x25, 0xff, 0xf4, 0x83, 0xc8, 0x30,
+ 0x26, 0xa3, 0x28, 0x00, 0x8b, 0x86, 0xf4, 0x00, 0x25, 0xff, 0xfe, 0xc1,
+ 0xe8, 0x08, 0x89, 0x86, 0x24, 0x02, 0xf7, 0x86, 0xf4, 0x00, 0x04, 0x00,
+ 0x74, 0x0f, 0xf6, 0x06, 0x8a, 0x56, 0x01, 0x75, 0x08, 0xc6, 0x06, 0x8a,
+ 0x56, 0x01, 0xe8, 0xbe, 0x0f, 0x80, 0xbe, 0x62, 0x01, 0x01, 0x75, 0x01,
+ 0xc3, 0xc6, 0x86, 0x06, 0x01, 0x01, 0xe9, 0xfb, 0xfc, 0x56, 0x8c, 0xd8,
+ 0x8e, 0xc0, 0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,
+ 0x26, 0x8b, 0x04, 0x50, 0x33, 0xc0, 0x50, 0x23, 0xc3, 0x8b, 0xc8, 0x26,
+ 0x89, 0x04, 0x26, 0x8b, 0x04, 0x23, 0xc3, 0x3b, 0xc1, 0x58, 0x75, 0x3c,
+ 0x05, 0x55, 0x55, 0x73, 0xe9, 0xb8, 0x01, 0x00, 0x50, 0x23, 0xc3, 0x8b,
+ 0xc8, 0x26, 0x89, 0x04, 0x26, 0x8b, 0x04, 0x23, 0xc3, 0x3b, 0xc1, 0x58,
+ 0x75, 0x22, 0xd1, 0xc0, 0x73, 0xea, 0xf7, 0xd0, 0x50, 0x23, 0xc3, 0x8b,
+ 0xc8, 0x26, 0x89, 0x04, 0x26, 0x8b, 0x04, 0x23, 0xc3, 0x3b, 0xc1, 0x58,
+ 0x75, 0x0a, 0xd1, 0xc0, 0x72, 0xea, 0xf8, 0x58, 0x26, 0x89, 0x04, 0xc3,
+ 0xf9, 0xeb, 0xf8, 0x8b, 0x44, 0x08, 0x25, 0xff, 0x7b, 0x89, 0x86, 0x12,
+ 0x01, 0x89, 0x86, 0x14, 0x01, 0x8e, 0x46, 0x02, 0x26, 0x8b, 0x1e, 0x28,
+ 0x00, 0x81, 0xe3, 0xff, 0xf4, 0xa9, 0x04, 0x00, 0x74, 0x04, 0x81, 0xcb,
+ 0x00, 0x08, 0xa9, 0x02, 0x00, 0x74, 0x04, 0x81, 0xcb, 0x00, 0x03, 0x8e,
+ 0x46, 0x02, 0x26, 0x89, 0x1e, 0x28, 0x00, 0xe9, 0xb6, 0xfb, 0x8b, 0x44,
+ 0x08, 0x89, 0x86, 0x28, 0x02, 0x86, 0xc4, 0x89, 0x86, 0x62, 0x05, 0xf6,
+ 0x86, 0x73, 0x02, 0x01, 0x75, 0x05, 0xc6, 0x86, 0x74, 0x02, 0x01, 0xc6,
+ 0x86, 0x73, 0x02, 0x00, 0xe9, 0x95, 0xfb, 0x8b, 0x44, 0x08, 0x89, 0x86,
+ 0x30, 0x01, 0x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, 0x74, 0x0c, 0xc7,
+ 0x46, 0x12, 0x26, 0x1d, 0xc7, 0x46, 0x14, 0x26, 0x1d, 0xeb, 0x42, 0xeb,
+ 0x21, 0xc6, 0x86, 0xa5, 0x02, 0x01, 0xc6, 0x86, 0xa9, 0x02, 0x01, 0xc6,
+ 0x86, 0xaa, 0x02, 0x00, 0xc7, 0x46, 0x12, 0x0a, 0x32, 0xc7, 0x46, 0x14,
+ 0x37, 0x2f, 0xc7, 0x86, 0xba, 0x01, 0x2c, 0x00, 0xeb, 0x1f, 0xc6, 0x86,
+ 0xa7, 0x02, 0x01, 0xc6, 0x86, 0xa9, 0x02, 0x00, 0xc6, 0x86, 0xaa, 0x02,
+ 0x01, 0xc7, 0x46, 0x12, 0x0e, 0x32, 0xc7, 0x46, 0x14, 0x3b, 0x2f, 0xc7,
+ 0x86, 0xba, 0x01, 0x2c, 0x00, 0x0e, 0xe8, 0x02, 0x00, 0xeb, 0x01, 0xcf,
+ 0xc3, 0x8c, 0x00, 0x84, 0x46, 0xbc, 0x02, 0x96, 0x00, 0xba, 0x46, 0x14,
+ 0x00, 0x96, 0x00, 0xce, 0x46, 0x08, 0x07, 0x96, 0x00, 0x08, 0x47, 0x6e,
+ 0x00, 0x78, 0x00, 0x88, 0x49, 0x00, 0x00, 0x6e, 0x00, 0xc2, 0x47, 0xf4,
+ 0x01, 0x6e, 0x00, 0xf2, 0x47, 0x08, 0x07, 0x6e, 0x00, 0x30, 0x4b, 0x05,
+ 0x00, 0xaa, 0x00, 0x36, 0x48, 0xfa, 0x00, 0x8c, 0x00, 0xac, 0x48, 0x02,
+ 0x00, 0x8c, 0x00, 0x8c, 0x47, 0x3c, 0x00, 0x78, 0x00, 0x18, 0x49, 0x04,
+ 0x01, 0x96, 0x00, 0x44, 0x49, 0x64, 0x00, 0x96, 0x00, 0x68, 0x49, 0xdc,
+ 0x05, 0xbe, 0x00, 0x8e, 0x4a, 0xf4, 0x01, 0xbe, 0x00, 0x8e, 0x4a, 0x32,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, 0x06, 0x02, 0x00, 0x20, 0xc6, 0x86,
+ 0x85, 0x02, 0x01, 0xf7, 0x86, 0xf6, 0x00, 0x00, 0x80, 0x75, 0x05, 0xc6,
+ 0x86, 0x56, 0x02, 0x00, 0xc3, 0x90, 0xb8, 0x00, 0x02, 0xc7, 0x86, 0x32,
+ 0x02, 0x06, 0x00, 0x80, 0xbe, 0x61, 0x02, 0x01, 0x74, 0x37, 0xf6, 0x86,
+ 0xa7, 0x02, 0x01, 0x75, 0x07, 0xf6, 0x86, 0xa8, 0x02, 0x01, 0x74, 0x05,
+ 0xb8, 0x00, 0x05, 0xeb, 0x24, 0xb8, 0x00, 0x04, 0xc7, 0x86, 0x32, 0x02,
+ 0x04, 0x00, 0x8a, 0x4e, 0x08, 0x80, 0xf9, 0x0c, 0x74, 0x13, 0xb8, 0x00,
+ 0x04, 0x80, 0xbe, 0x5a, 0x02, 0x01, 0x74, 0x09, 0xb8, 0x00, 0x03, 0xc7,
+ 0x86, 0x32, 0x02, 0x07, 0x00, 0x89, 0x86, 0x00, 0x03, 0xc3, 0x80, 0x7e,
+ 0x08, 0x08, 0x74, 0x23, 0x8a, 0x46, 0x06, 0x3c, 0x04, 0x72, 0x1c, 0x3c,
+ 0x48, 0x74, 0x04, 0x3c, 0x0e, 0x77, 0x14, 0xf6, 0x86, 0x5d, 0x02, 0x01,
+ 0x74, 0x0d, 0xf6, 0x86, 0x5c, 0x02, 0x01, 0x74, 0x06, 0xb8, 0x0c, 0x00,
+ 0xe8, 0x70, 0xd2, 0xc3, 0xc6, 0x86, 0x5d, 0x02, 0x01, 0x8e, 0x46, 0x02,
+ 0x26, 0x81, 0x26, 0x04, 0x00, 0xff, 0xf7, 0xe8, 0xd6, 0x02, 0xc3, 0x90,
+ 0x80, 0x7e, 0x06, 0x02, 0x74, 0x06, 0x80, 0x7e, 0x08, 0x08, 0x75, 0x06,
+ 0xb8, 0x01, 0x00, 0xe8, 0x49, 0xd2, 0xc3, 0x90, 0x51, 0x52, 0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 0xb8, 0x06, 0x00, 0xe8, 0x21, 0xd0, 0xeb, 0x17, 0x80, 0x7e, 0x08, 0x16,
+ 0x75, 0x11, 0xc7, 0x86, 0x2a, 0x02, 0x04, 0x00, 0xf6, 0x86, 0x6e, 0x02,
+ 0x01, 0x74, 0x04, 0xc6, 0x46, 0x09, 0x18, 0xc3, 0x8e, 0x46, 0x02, 0x26,
+ 0x8b, 0x16, 0x02, 0x00, 0xf7, 0xc2, 0x02, 0x00, 0x74, 0x14, 0x8b, 0xc2,
+ 0x83, 0xe0, 0xfd, 0x8e, 0x46, 0x02, 0x26, 0xa3, 0x02, 0x00, 0x8e, 0x46,
+ 0x02, 0x26, 0x89, 0x16, 0x02, 0x00, 0xc3, 0x90, 0x8e, 0x46, 0x02, 0x26,
+ 0xf7, 0x06, 0x14, 0x00, 0x03, 0x00, 0x74, 0x10, 0x8e, 0x46, 0x02, 0x26,
+ 0x83, 0x26, 0x14, 0x00, 0x03, 0xc6, 0x86, 0x55, 0x02, 0x01, 0xeb, 0x00,
+ 0xf6, 0x86, 0x55, 0x02, 0x01, 0x75, 0x14, 0x80, 0x7e, 0x08, 0x00, 0x75,
+ 0x0e, 0xc6, 0x46, 0x09, 0x02, 0xff, 0x86, 0x40, 0x02, 0x81, 0x8e, 0xda,
+ 0x02, 0x00, 0x02, 0xc6, 0x86, 0x55, 0x02, 0x00, 0xc3, 0x90, 0xf7, 0x86,
+ 0xf4, 0x00, 0x00, 0x10, 0x75, 0x15, 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06,
+ 0x14, 0x00, 0x03, 0x00, 0x74, 0x09, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x26,
+ 0x14, 0x00, 0x03, 0xc3, 0x80, 0xbe, 0xab, 0x02, 0x01, 0x75, 0x3d, 0x8e,
+ 0x46, 0x02, 0x26, 0xf7, 0x06, 0x14, 0x00, 0x08, 0x00, 0x74, 0x2c, 0xf6,
+ 0x86, 0x5d, 0x02, 0x01, 0x74, 0x2a,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 0xcf, 0xc3, 0xf7, 0x86,
+ 0xf6, 0x00, 0x08, 0x00, 0x74, 0x09, 0xe8, 0x92, 0xf5, 0xbe, 0x6b, 0x46,
+ 0xe8, 0x15, 0xc1, 0xc3, 0xf7, 0x86, 0xf6, 0x00, 0x08, 0x00, 0x74, 0x11,
+ 0x81, 0x8e, 0x06, 0x02, 0x00, 0x04, 0xc6, 0x86, 0x85, 0x02, 0x01, 0xb8,
+ 0x10, 0x00, 0xe8, 0x8a, 0xce, 0xc3, 0x8e, 0x46, 0x02, 0x26, 0xf7, 0x06,
+ 0x00, 0x00, 0x02, 0x00, 0x74, 0x41, 0xbb, 0x00, 0x03, 0x8b, 0x47, 0x14,
+ 0x83, 0xf8, 0x00, 0x74, 0x36, 0x3b, 0x86, 0x2a, 0x01, 0x74, 0x0c, 0x89,
+ 0x86, 0x2a, 0x01, 0xc7, 0x86, 0x28, 0x01, 0x00, 0x00, 0xeb, 0x24, 0xff,
+ 0x86, 0x28, 0x01, 0x83, 0xbe, 0x28, 0x01, 0x02, 0x72, 0x19, 0x83, 0xbe,
+ 0x28, 0x01, 0x18, 0x73, 0x0c, 0x80, 0x7e, 0x08, 0x00, 0x74, 0x0c, 0x80,
+ 0x7e, 0x08, 0x16, 0x74, 0x06, 0xb8, 0x10, 0x00, 0xe8, 0x3c, 0xce, 0xbe,
+ 0x71, 0x46, 0xe8, 0xa7, 0xc0, 0xc3, 0x8b, 0x86, 0x30, 0x01, 0x88, 0xa6,
+ 0x2c, 0x01, 0x86, 0x86, 0x2d, 0x01, 0x32, 0x86, 0x2d, 0x01, 0x74, 0x0f,
+ 0xf6, 0x46, 0x06, 0x0e, 0x74, 0x06, 0xf6, 0x46, 0x06, 0x48, 0x75, 0x03,
+ 0xe8, 0x94, 0xbb, 0xc3, 0xf6, 0x86, 0x90, 0x02, 0x01, 0x74, 0x0a, 0xa8,
+ 0x24, 0x74, 0x06, 0xc7, 0x86, 0x9d, 0x02, 0x05, 0x00, 0xf6, 0x86, 0xa9,
+ 0x02, 0x01, 0x74, 0x09, 0x80, 0xbe, 0x5e, 0x02, 0x01, 0x75, 0x58, 0xeb,
+ 0x09, 0xf6, 0x86, 0x6e, 0x02, 0x01, 0x75, 0x10, 0xeb, 0x52, 0x80, 0x7e,
+ 0x06, 0x0e, 0x74, 0x02, 0xeb, 0x45, 0x80, 0x7e, 0x08, 0x00, 0x75, 0x3f,
+ 0xa8, 0x01, 0x74, 0x05, 0x83, 0x8e, 0xda, 0x02, 0x10, 0xa8, 0x04, 0x74,
+ 0x05, 0x83, 0x8e, 0xda, 0x02, 0x04, 0xa8, 0x08, 0x74, 0x05, 0x83, 0x8e,
+ 0xda, 0x02, 0x40, 0xa8, 0x20, 0x74, 0x10, 0x81, 0x8e, 0xda, 0x02, 0x00,
+ 0x01, 0xf6, 0x86, 0x54, 0x02, 0x01, 0x75, 0x03, 0xe8, 0x2f, 0xc4, 0xa8,
+ 0x40, 0x74, 0x05, 0x83, 0x8e, 0xda, 0x02, 0x01, 0xa8, 0x80, 0x74, 0x03,
+ 0xe8, 0x52, 0x00, 0xa9, 0x00, 0x01, 0x75, 0x01, 0xc3, 0x50, 0x80, 0x7e,
+ 0x08, 0x0a, 0x75, 0x06, 0xc6, 0x46, 0x09, 0x04, 0xeb, 0x1b, 0x80, 0x7e,
+ 0x08, 0x00, 0x75, 0x23, 0xc6, 0x46, 0x09, 0x02, 0xff, 0x86, 0x40, 0x02,
+ 0xf6, 0x86, 0x5e, 0x02, 0x01, 0x74, 0x06, 0x81, 0x8e, 0xda, 0x02, 0x00,
+ 0x02, 0xc6, 0x86, 0x69, 0x02, 0x01, 0x8e, 0x46, 0x02, 0x26, 0x83, 0x0e,
+ 0x0c, 0x00, 0x10, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x08, 0x00, 0x00,
+ 0x00, 0x8e, 0x46, 0x02, 0x26, 0xc7, 0x06, 0x08, 0x00, 0x00, 0x01, 0x58,
+ 0xc3, 0x83, 0x8e, 0xda, 0x02, 0x20, 0x83, 0x7e, 0x06, 0x08, 0x75, 0x13,
+ 0x8b, 0x8e, 0xc4, 0x02, 0x41, 0x89, 0x8e, 0xc4, 0x02, 0x80, 0xf9, 0x02,
+ 0x75, 0x05, 0x50, 0xe8, 0x35, 0xd9, 0x58, 0xc3, 0x50, 0x53, 0x51, 0x8a,
+ 0x4e, 0x06, 0x80, 0xf9, 0x0e, 0x74, 0x1e, 0x80, 0xf9, 0x48, 0x74, 0x19,
+ 0x80, 0xbe, 0x54, 0x02, 0x01, 0x74, 0x46, 0x80, 0xf9, 0x08, 0x72, 0x41,
+ 0x80, 0xf9, 0x0e, 0x77, 0x3c, 0xb8, 0x02, 0x00, 0xe8, 0x04, 0xcd, 0xeb,
+ 0x34, 0xc7, 0x86, 0x2a, 0x02, 0x05, 0x00, 0xc6, 0x86, 0x61, 0x02, 0x01,
+ 0x8a, 0x46, 0x08, 0x3c, 0x06, 0x74, 0x26, 0x3c, 0x02, 0x74, 0x51, 0x3c,
+ 0x08, 0x74, 0x1a, 0x3c, 0x04, 0x74, 0x16, 0xf6, 0x86, 0xa7, 0x02, 0x01,
+ 0x75, 0x13, 0xf6, 0x86, 0xa8, 0x02, 0x01, 0x75, 0x0c, 0xc6, 0x46, 0x09,
+ 0x04, 0xff, 0x86, 0x4a, 0x02, 0x59, 0x5b, 0x58, 0xc3, 0x8b, 0x86, 0x06,
+ 0x02, 0xf6, 0xc4, 0x80, 0x75, 0x0c, 0x80, 0xcc, 0x80, 0x89, 0x86, 0x06,
+ 0x02, 0xc6, 0x86, 0x85, 0x02, 0x01, 0x81, 0xbe, 0x00, 0x03, 0x00, 0x02,
+ 0x74, 0xdf, 0xc7, 0x86, 0x00, 0x03, 0x00, 0x02, 0xf6, 0x86, 0xa5, 0x02,
+ 0x01, 0x74, 0xd2, 0xe8, 0xac, 0xd7, 0xeb, 0xcd, 0xb8, 0x00, 0x01, 0xe8,
+ 0xfa, 0xda, 0xf6, 0x86, 0x5e, 0x02, 0x01, 0x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0x56, 0x80,
+ 0xc3, 0x90, 0xe5, 0x06, 0x83, 0xe0, 0x09, 0xe7, 0x06, 0xc3, 0x4e, 0x6f,
+ 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x78, 0x74, 0x30, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x34, 0x12, 0x45, 0x23, 0x56, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0xcd, 0xab, 0xde, 0xbc, 0xef, 0xcd, 0x00, 0x00,
+ 0x00, 0x00, 0x4e, 0x6f, 0x74, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65,
+ 0x6e, 0x74, 0x65, 0x64, 0x00, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x30, 0x00,
+ 0x00, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x31, 0x00, 0x00, 0x54, 0x65, 0x73,
+ 0x74, 0x31, 0x00, 0x00, 0x54, 0x65, 0x73, 0x74, 0x32, 0x00, 0x00, 0x90,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x55, 0x59, 0x4e,
+ 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00,
+ 0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0xe0, 0x02, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x16, 0x00, 0x02, 0x04, 0x01, 0x00, 0x00, 0x06, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x03, 0xc0, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x03,
+ 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x04, 0xc0, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+ 0x00, 0x04, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x05,
+ 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x12, 0x00, 0x05, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
+ 0xe0, 0x06, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x12, 0x00, 0x06, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x02, 0x26, 0x00, 0x00,
+ 0x00, 0x00, 0x3e, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x50, 0x20, 0x0c, 0x23,
+ 0x30, 0x30, 0x30, 0x30, 0xf3, 0xf0, 0xf0, 0xf8, 0xf9, 0xf6, 0x08, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x21, 0x00, 0x00, 0x04, 0x21, 0x00, 0x00, 0x06, 0x2b,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x28,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x29, 0x20, 0x00, 0x08, 0x00,
+ 0x01, 0x00, 0x04, 0x06, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x34, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x40, 0x25, 0x06, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x40, 0x26, 0x06, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1a, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x60, 0x27, 0x08, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x16, 0x60, 0x28, 0x04, 0x30, 0x00, 0x00, 0x06, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x11,
+ 0x04, 0x0c, 0x00, 0x01, 0x04, 0x0e, 0x00, 0x02, 0x04, 0x21, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x12,
+ 0x04, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xe0, 0x00,
+ 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x30, 0x13, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0xe0, 0x00,
+ 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x03, 0x14, 0x04, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x15, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x60, 0x29, 0x08, 0x2d, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x2a, 0x00, 0x00, 0x02, 0x20, 0x80, 0x00, 0x00, 0x06,
+ 0x09, 0x00, 0x00, 0x00, 0x04, 0x03, 0x01, 0x80, 0x00, 0x00, 0x04, 0x02,
+ 0x80, 0x00, 0x00, 0x08, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, 0x80,
+ 0x00, 0x00, 0x08, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x01, 0x26, 0x80, 0x00,
+ 0x00, 0xff, 0x06, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00,
+ 0x06, 0x05, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00, 0x00, 0x00, 0x04, 0x07,
+ 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x00, 0x04, 0x04, 0x03, 0x00,
+ 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x09, 0x00, 0x00, 0x00, 0x04, 0x03, 0x0c, 0x80, 0x00, 0x00, 0x04,
+ 0x0e, 0x80, 0x00, 0x00, 0x04, 0x21, 0x00, 0x00, 0x00, 0x04, 0x01, 0x0f,
+ 0x80, 0x00, 0x00, 0x04, 0x01, 0x0d, 0x80, 0x00, 0x00, 0x04, 0x04, 0x02,
+ 0x80, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, 0x00, 0xff, 0x23, 0x00, 0x00,
+ 0x00, 0xff, 0x21, 0x00, 0x00, 0x00, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0xa5, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
diff --git a/sys/contrib/dev/oltr/trlldmac.c b/sys/contrib/dev/oltr/trlldmac.c
new file mode 100644
index 0000000..63cfd3e3
--- /dev/null
+++ b/sys/contrib/dev/oltr/trlldmac.c
@@ -0,0 +1,2641 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 1997
+ * OLICOM A/S
+ * Denmark
+ *
+ * All Rights Reserved
+ *
+ * This source file is subject to the terms and conditions of the
+ * OLICOM Software License Agreement which restricts the manner
+ * in which it may be used.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Description: Olicom adapter micro-code
+ *
+ *---------------------------------------------------------------------------
+ */
+
+unsigned char TRlldMacCode[] __attribute ((aligned(2))) = {
+ 0x52, 0x94, 0x02, 0x00, 0xba, 0x7a, 0x00, 0x00, 0xa0, 0x00, 0x01, 0xc8,
+ 0xe2, 0x28, 0xd4, 0xdb, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00,
+ 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40,
+ 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01,
+ 0xff, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff,
+ 0x7f, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0xd4, 0xe7, 0xe7, 0xe7, 0xf2,
+ 0xf2, 0xf8, 0x28, 0x43, 0x29, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49,
+ 0x47, 0x48, 0x54, 0x20, 0x49, 0x42, 0x4d, 0x20, 0x31, 0x39, 0x38, 0x33,
+ 0x2c, 0x34, 0x2c, 0x35, 0x2c, 0x36, 0x28, 0x43, 0x29, 0x20, 0x43, 0x4f,
+ 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x54, 0x49, 0x20, 0x31,
+ 0x39, 0x38, 0x33, 0x2d, 0x38, 0x39, 0x2c, 0x39, 0x30, 0x2d, 0x39, 0x34,
+ 0x00, 0x00, 0x7b, 0x63, 0xf6, 0xde, 0xf1, 0xcc, 0xed, 0x9c, 0xf7, 0xe2,
+ 0x00, 0x00, 0x00, 0xc4, 0xbd, 0x24, 0x06, 0x4a, 0x06, 0x50, 0x06, 0x4c,
+ 0xda, 0x00, 0x06, 0x4e, 0x00, 0x0f, 0x06, 0x32, 0x00, 0x01, 0x07, 0x50,
+ 0x07, 0x58, 0x07, 0x52, 0xc2, 0xce, 0x07, 0x54, 0x00, 0x0f, 0x07, 0x38,
+ 0x00, 0x01, 0x00, 0xba, 0x00, 0xa0, 0x00, 0xbc, 0xf7, 0xf0, 0x00, 0xbe,
+ 0x00, 0x0f, 0x07, 0x5e, 0x07, 0x3a, 0x07, 0x62, 0x80, 0x40, 0x07, 0x64,
+ 0xc7, 0xb2, 0x07, 0x66, 0xc7, 0x94, 0x07, 0x68, 0xc5, 0x9e, 0x07, 0x98,
+ 0x80, 0x00, 0x07, 0x78, 0x80, 0x00, 0x08, 0xe2, 0x00, 0x04, 0x08, 0xe4,
+ 0x00, 0x01, 0x08, 0xec, 0x00, 0x08, 0x08, 0xf6, 0x00, 0x0a, 0x08, 0xf8,
+ 0x00, 0x06, 0x09, 0x00, 0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xb5, 0x46, 0xb5, 0x62, 0xb6, 0xb6, 0x40, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x20, 0x00, 0x08, 0x00, 0x80, 0x00,
+ 0x08, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c,
+ 0x00, 0x10, 0x00, 0x14, 0x10, 0x0e, 0x0c, 0x0c, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x00, 0x00, 0xa1, 0xc8, 0x00, 0x09, 0x08, 0x08, 0x00, 0x00, 0xa1, 0xd0,
+ 0x00, 0x11, 0x06, 0x06, 0x00, 0x00, 0xa1, 0xe0, 0x00, 0x21, 0x04, 0x04,
+ 0x00, 0x00, 0xa2, 0x00, 0x00, 0x41, 0x02, 0x02, 0x00, 0x00, 0xa2, 0x40,
+ 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xc0, 0x06, 0xd8, 0x07, 0x98,
+ 0xd7, 0xa2, 0x07, 0x58, 0xc6, 0x56, 0x07, 0x58, 0xc5, 0x5c, 0x07, 0x58,
+ 0xc6, 0xc6, 0x07, 0x58, 0xc6, 0x2e, 0x07, 0x98, 0xd4, 0x7e, 0x07, 0x98,
+ 0xd4, 0x76, 0x07, 0x78, 0xce, 0xea, 0x07, 0x58, 0xc6, 0x8e, 0x07, 0x98,
+ 0xd7, 0x5c, 0x07, 0x78, 0xcf, 0xbe, 0x07, 0x58, 0xd4, 0x8e, 0x07, 0x58,
+ 0xc6, 0x3e, 0x07, 0x58, 0xc6, 0x7c, 0x07, 0x58, 0xc7, 0x40, 0x07, 0x98,
+ 0xd8, 0xd2, 0x07, 0x98, 0xd4, 0xb2, 0x07, 0x78, 0xcf, 0x7e, 0x07, 0xb8,
+ 0xd9, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0xce, 0x3e,
+ 0xce, 0xf2, 0xd3, 0xfa, 0xca, 0xba,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f3, 0x20, 0xf3, 0x3a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0xf3, 0xa8,
+ 0xf3, 0x10, 0xf3, 0x26, 0xf3, 0x40, 0x01, 0x40, 0x01, 0x42, 0x01, 0x42,
+ 0x01, 0x42, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xa0, 0x00, 0xff, 0x02, 0x10,
+ 0x02, 0x1f, 0x02, 0x30, 0x02, 0x3f, 0x02, 0x50, 0x02, 0x5f, 0x02, 0x70,
+ 0x02, 0x7f, 0x02, 0x90, 0x02, 0x9f, 0x02, 0xb0, 0x02, 0xbf, 0x02, 0xd0,
+ 0x02, 0xdf, 0x02, 0xe1, 0x02, 0xff, 0x03, 0x01, 0x03, 0x7f, 0x03, 0x81,
+ 0x03, 0x8f, 0x03, 0x91, 0x03, 0x9f, 0x03, 0xa1, 0x03, 0xaf, 0x03, 0xb1,
+ 0x03, 0xbf, 0x03, 0xc1, 0x03, 0xcf, 0x03, 0xe1, 0x03, 0xff, 0x07, 0xc0,
+ 0x07, 0xff, 0x0c, 0x00, 0x0f, 0xff, 0x30, 0x00, 0x37, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xfe, 0xbc, 0x00, 0x07, 0x02, 0x5e, 0x01, 0x00, 0xba, 0xff,
+ 0xba, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x01, 0x0a,
+ 0x01, 0x0e, 0x01, 0x10, 0x01, 0x14, 0x00, 0x00, 0x01, 0x12, 0xf8, 0x00,
+ 0x01, 0x16, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x01, 0x1c,
+ 0x01, 0x82, 0x96, 0x66, 0x96, 0x66, 0x55, 0x55, 0x00, 0x00, 0x01, 0x82,
+ 0x8a, 0x2a, 0x8a, 0x2a, 0xc9, 0x18, 0xc9, 0x18, 0x01, 0x86, 0xa2, 0xaa,
+ 0xa0, 0x1e, 0x55, 0x55, 0x54, 0x1e, 0x01, 0x8a, 0x50, 0x00, 0x00, 0x00,
+ 0xa8, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00,
+ 0x00, 0x00, 0x01, 0x8e, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00,
+ 0x01, 0x90, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x92,
+ 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x94, 0x50, 0x00,
+ 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x96, 0x50, 0x00, 0x00, 0x00,
+ 0xa8, 0x00, 0x00, 0x00, 0x01, 0x98, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00,
+ 0x00, 0x00, 0x01, 0x9a, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00,
+ 0x01, 0x9c, 0x55, 0x55, 0x7f, 0xc0, 0xaa, 0xaa, 0x7f, 0xc0, 0x00, 0x00,
+ 0x01, 0xa2, 0x01, 0xa4, 0x01, 0xa8, 0x01, 0xaa, 0x01, 0xae, 0x01, 0xb0,
+ 0x01, 0xb2, 0x01, 0x80, 0x00, 0x00, 0x01, 0x88, 0xff, 0x00, 0x01, 0x9e,
+ 0x00, 0xff, 0x01, 0xa0, 0x80, 0x00, 0x01, 0xac, 0x80, 0x00, 0x00, 0x00,
+ 0x01, 0xa6, 0x80, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xbc, 0x88, 0x00,
+ 0x06, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x02, 0x00, 0x44, 0xf2, 0x50, 0x00, 0x48, 0xf2, 0x56,
+ 0x00, 0x50, 0xf2, 0x5c, 0x00, 0x60, 0xf2, 0x62, 0x00, 0x78, 0xf2, 0x68,
+ 0xef, 0xc8, 0xee, 0xd6, 0xe9, 0xfc, 0xee, 0xe8, 0x55, 0x14, 0x01, 0xa0,
+ 0xee, 0xaa, 0xe9, 0x90, 0xef, 0x04, 0xef, 0x5e, 0xee, 0xbe, 0xf0, 0x16,
+ 0x00, 0x00, 0x00, 0x1e, 0xef, 0x04, 0xef, 0x50, 0x41, 0x00, 0x41, 0x01,
+ 0xef, 0x74, 0xea, 0x33, 0xee, 0xd6, 0xea, 0x08, 0xee, 0xaa, 0xe9, 0xc4,
+ 0xef, 0x14, 0xef, 0x20, 0xef, 0x74, 0xea, 0x2e, 0xf0, 0x20, 0x00, 0x00,
+ 0xef, 0xf4, 0xee, 0xaa, 0xe9, 0xba, 0xef, 0x14, 0xef, 0x20, 0xef, 0xf4,
+ 0xf0, 0x20, 0x00, 0x00, 0xee, 0xaa, 0xe9, 0xb0, 0xee, 0xca, 0xef, 0x08,
+ 0xef, 0x20, 0xef, 0xf4, 0xee, 0xaa, 0xe9, 0xba, 0xef, 0x14, 0xef, 0x20,
+ 0xef, 0xf4, 0xf0, 0x20, 0x20, 0x00, 0xee, 0xe8, 0x55, 0x14, 0x01, 0xa0,
+ 0xee, 0xd6, 0xea, 0x10, 0xee, 0xaa, 0xe9, 0x90, 0xf0, 0x16, 0x55, 0x50,
+ 0x00, 0x0c, 0xef, 0x04, 0xef, 0x50, 0x01, 0x00, 0x00, 0x00, 0xef, 0x74,
+ 0xea, 0x35, 0xee, 0xbe, 0xf0, 0x16, 0x55, 0x55, 0x00, 0x0c, 0xef, 0x14,
+ 0xef, 0x5e, 0xee, 0xbe, 0xf0, 0x16, 0xff, 0xff, 0x00, 0x08, 0xf0, 0x16,
+ 0x10, 0x02, 0x00, 0x06, 0xef, 0x04, 0xef, 0x50, 0x01, 0x00, 0x01, 0x01,
+ 0xef, 0x74, 0xea, 0x40, 0xee, 0xbe, 0xf0, 0x16, 0xc0, 0x00, 0x00, 0x08,
+ 0xf0, 0x16, 0xff,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, 0xe9, 0xfa, 0x00, 0x05, 0xef, 0x74, 0xea, 0x34,
+ 0xef, 0xf4, 0xee, 0xaa, 0xe9, 0x90, 0xef, 0x14, 0xf0, 0x84, 0xee, 0xca,
+ 0xef, 0x50, 0x01, 0x00, 0x80, 0x00, 0xef, 0x74, 0xea, 0x38, 0xee, 0xbe,
+ 0xf0, 0xbc, 0xf0, 0x10, 0x01, 0x80, 0x8e, 0x41, 0xef, 0x08, 0xef, 0x50,
+ 0x01, 0x00, 0x1b, 0x01, 0xf0, 0xc4, 0xff, 0xe4, 0xef, 0x74, 0xea, 0x3c,
+ 0xf0, 0x7c, 0xee, 0xd6, 0xea, 0x16, 0xee, 0xca, 0xf0, 0x28, 0xee, 0xfa,
+ 0xe0, 0x00, 0xf0, 0x84, 0xef, 0x74, 0xea, 0x46, 0xee, 0xfa, 0xe8, 0x00,
+ 0xef, 0x20, 0xef, 0x74, 0xea, 0x45, 0xee, 0xfa, 0x08, 0x00, 0xf0, 0x84,
+ 0xef, 0x74, 0xea, 0x46, 0xee, 0xfa, 0xf8, 0x00, 0xef, 0x20, 0xef, 0x74,
+ 0xea, 0x45, 0xf0, 0x10, 0x01, 0x80, 0x02, 0x00, 0xee, 0xfa, 0xe0, 0x00,
+ 0xef, 0x20, 0xef, 0x74, 0xea, 0x45, 0xf0, 0x10, 0x01, 0x84, 0x00, 0x00,
+ 0xf0, 0x20, 0x00, 0x34, 0xee, 0xfa, 0x00, 0x00, 0xf0, 0x84, 0xf0, 0x20,
+ 0x60, 0x34, 0xf0, 0xcc, 0xf0, 0x10, 0x01, 0x84, 0x00, 0x00, 0xef, 0x74,
+ 0xea, 0x46, 0xf0, 0x10, 0x01, 0x82, 0xc8, 0x00, 0xee, 0xfa, 0xe0, 0x00,
+ 0xf0, 0x84, 0xee, 0xfa, 0x10, 0x00, 0xf0, 0x84, 0xf0, 0x20, 0x60, 0x34,
+ 0xf0, 0x10, 0x01, 0x80, 0x06, 0x00, 0xee, 0xfa, 0x00, 0x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
+ 0x00, 0x06, 0x60, 0x00, 0xef, 0x5e, 0xf0, 0x9a, 0x60, 0x00, 0xf1, 0x3c,
+ 0xe9, 0x50, 0xee, 0xd6, 0xea, 0x22, 0xee, 0xaa, 0xe9, 0x90, 0xf0, 0x62,
+ 0x55, 0x55, 0x00, 0x16, 0xef, 0x04, 0xef, 0x50, 0x00, 0x00, 0x00, 0x00,
+ 0xef, 0x74, 0xea, 0x4b, 0xef, 0xc8, 0xee, 0xd6, 0xea, 0x22, 0xf0, 0x16,
+ 0x55, 0x55, 0x00, 0x16, 0xee, 0xbe, 0xef, 0x04, 0xef, 0x5e, 0xee, 0xe8,
+ 0x00, 0xff, 0x08, 0x00, 0xee, 0xe8, 0x00, 0xff, 0x0c, 0x00, 0xee, 0xe8,
+ 0x00, 0xff, 0x10, 0x00, 0xee, 0xe8, 0x00, 0xff, 0x14, 0x00, 0xee, 0xe8,
+ 0x00, 0xff, 0x18, 0x00, 0xee, 0xe8, 0x00, 0xff, 0x1c, 0x00, 0xee, 0xe8,
+ 0x00, 0xff, 0x20, 0x00, 0xee, 0xe8, 0x00, 0xff, 0x24, 0x00, 0xee, 0xe8,
+ 0x00, 0xff, 0x28, 0x00, 0xee, 0xe8, 0x00, 0xff, 0x2c, 0x00, 0xef, 0x90,
+ 0xee, 0xbe, 0xee, 0xca, 0xef, 0x2e, 0x30, 0x40, 0x00, 0x06, 0x01, 0x00,
+ 0xef, 0x5e, 0xf0, 0x9a, 0x20, 0x00, 0xee, 0xbe, 0xee, 0xca, 0xef, 0x2e,
+ 0x70, 0x40, 0x00, 0x06, 0x43, 0x00, 0xef, 0x5e, 0xf0, 0x9a, 0x60, 0x00,
+ 0xee, 0xbe, 0xee, 0xca, 0xef, 0x2e, 0xb0, 0x40, 0x00, 0x06, 0x85, 0x00,
+ 0xef, 0x5e, 0xf0, 0x9a, 0xa0, 0x00, 0xf0, 0x96, 0x01, 0x00, 0x01, 0x03,
+ 0x01, 0x01, 0x00, 0x00, 0x81, 0x00, 0x00, 0x1a, 0x10, 0x40, 0x00, 0x00,
+ 0xa9, 0x98, 0x00, 0x0d, 0x55, 0x55, 0x00, 0x00, 0xa9, 0xa4, 0x00, 0xaa,
+ 0x82, 0x72, 0xa9, 0x4a, 0x5a, 0xa5, 0xe7, 0xda, 0x09, 0x03, 0x9d, 0x11,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x04, 0x90, 0xd8, 0x10, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x00, 0x04, 0x90, 0xd8, 0xb4, 0xd8, 0x00, 0x00, 0x81, 0x00,
+ 0x00, 0x08, 0x90, 0xd8, 0x16, 0x46, 0x40, 0x00, 0xb4, 0xd8, 0x00, 0x08,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x13, 0x10, 0x40, 0x00, 0x16, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x10, 0x00, 0x15, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f,
+ 0x00, 0x15, 0x00, 0x00, 0x81, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x12, 0x80, 0x0a, 0x9e, 0x40, 0xc8, 0x00, 0x00, 0x00,
+ 0x80, 0x5e, 0x00, 0x0f, 0x80, 0x06, 0xfe, 0x40, 0xcc, 0x00, 0x00, 0x00,
+ 0x80, 0x04, 0x8e, 0x40, 0xc9, 0x00, 0x80, 0x04, 0x06, 0x00, 0xcc, 0x00,
+ 0x80, 0x04, 0x0a, 0x40, 0xc8, 0x00, 0x80, 0x0a, 0x8a, 0x40, 0xc8, 0x00,
+ 0x00, 0x00, 0x80, 0x5e, 0x00, 0x0f, 0x08, 0x0a, 0x1c, 0x80, 0x00, 0x0a,
+ 0x1a, 0x1c, 0x80, 0x00, 0x0c, 0x1c, 0x80, 0x00, 0x1a, 0x1c, 0x80, 0x00,
+ 0x0e, 0x1a, 0x1c, 0x80, 0x00, 0x04, 0x80, 0x00, 0x02, 0x80, 0x00, 0x02,
+ 0x80, 0x00, 0x00, 0x00, 0xaa, 0x4e, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00,
+ 0xaa, 0x7a, 0x00, 0x4e, 0x07, 0x58, 0xc5, 0x6a, 0xe0, 0x16, 0x08, 0xe2,
+ 0x08, 0xec, 0x08, 0xf6, 0xe0, 0x16, 0x09, 0x00, 0x09, 0x0a, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0xe2, 0x00, 0x00, 0x08, 0xec, 0x08, 0xf6, 0x09, 0x00,
+ 0x00, 0x00, 0x07, 0xb8, 0xd8, 0xee, 0x02, 0x80, 0x07, 0xb8, 0xd9, 0x0c,
+ 0xff, 0x84, 0x07, 0xb8, 0xd9, 0x2e, 0x07, 0xb8, 0xd9, 0xa8, 0xda, 0x88,
+ 0xda, 0x7c, 0xda, 0xa2, 0xda, 0xa6, 0xda, 0x9e, 0xdb, 0x86, 0xdb, 0x86,
+ 0xdb, 0x86, 0xda, 0xa8, 0xda, 0xb2, 0xdb, 0x2e, 0xdb, 0x78, 0x00, 0x00,
+ 0xaa, 0xc8, 0x00, 0x09, 0xdb, 0x86, 0x00, 0x00, 0xaa, 0xd0, 0x02, 0xb0,
+ 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x08,
+ 0x08, 0x05, 0x08, 0x08, 0x08, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x04,
+ 0x00, 0x08, 0x0a, 0x00, 0x00, 0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x41, 0x04, 0x0b, 0x06, 0xc2, 0x08, 0xe6, 0x00, 0xe7, 0x00, 0x06, 0x04,
+ 0x07, 0x04, 0x03, 0x04, 0x04, 0x06, 0x05, 0x04, 0x88, 0x04, 0x00, 0x03,
+ 0x00, 0x1c, 0x0c, 0x00, 0x80, 0x00, 0xe3, 0xfc, 0xe4, 0x04, 0xe4, 0x48,
+ 0xe4, 0x08, 0xe4, 0x14, 0xe4, 0x1a, 0xe4, 0x3e, 0xe4, 0x0e, 0xe4, 0x5c,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x06, 0x0e, 0x14, 0x14, 0x1e, 0x2a, 0x4c,
+ 0x38, 0x7c, 0x3e, 0x78, 0x43, 0x92, 0x58, 0x9c, 0x4d, 0xb2, 0x2f, 0x64,
+ 0x1d, 0x34, 0x6c, 0xd0, 0x23, 0x3e, 0x1d, 0x2a, 0x65, 0xc0, 0x72, 0xe0,
+ 0x78, 0xee, 0x7f, 0xfc, 0x01, 0x32, 0x57, 0x01, 0x11, 0x32, 0x51, 0x81,
+ 0x56, 0x02, 0x55, 0x03, 0x11, 0x54, 0x81, 0x56, 0x02, 0x55, 0x02, 0x54,
+ 0x81, 0x56, 0x76, 0x01, 0x34, 0x02, 0x55, 0x02, 0x54, 0x81, 0x58, 0x02,
+ 0x55, 0x02, 0x54, 0x81, 0x58, 0x02, 0x12, 0x11, 0x52, 0x02, 0x83, 0x58,
+ 0x05, 0x52, 0x04, 0x81, 0x58, 0x05, 0x52, 0x03, 0x15, 0x5c, 0x5b, 0x53,
+ 0x87, 0x52, 0x03, 0x11, 0x51, 0x41, 0x51, 0x78, 0x11, 0x34, 0x11, 0x81,
+ 0x31, 0x20, 0x57, 0x54, 0x53, 0x01, 0x12, 0x5a, 0x51, 0x81, 0x31, 0x20,
+ 0x57, 0x5b, 0x5a, 0x01, 0x11, 0x01, 0x11, 0x51, 0x81, 0x31, 0x20, 0x57,
+ 0x01, 0x15, 0x01, 0x13, 0x01, 0x11, 0x11, 0x11, 0x51, 0x81, 0x58, 0x05,
+ 0x52, 0x02, 0x54, 0x5b, 0x81, 0x5d, 0x05, 0x52, 0x02, 0x54, 0x81, 0x58,
+ 0x02, 0x50, 0x03, 0x13, 0x81, 0x58, 0x02, 0x50, 0x03, 0x11, 0x54, 0x81,
+ 0x5d, 0x72, 0x03, 0x50, 0x03, 0x13, 0x01, 0x13, 0x54, 0x40, 0x00, 0x0e,
+ 0x06, 0x20, 0x06, 0x56, 0xe5, 0x2a, 0x00, 0x24, 0x10, 0x02, 0x00, 0x16,
+ 0x00, 0x02, 0x04, 0x01, 0x07, 0x08, 0xe5, 0x2a, 0x00, 0x20, 0x10, 0x03,
+ 0x00, 0x12, 0x00, 0x03, 0xe4, 0x78, 0x8e, 0x14, 0x00, 0x20, 0x10, 0x04,
+ 0x00, 0x12, 0x00, 0x04, 0xdb, 0xc0, 0x00, 0x20, 0xe0, 0x05, 0x00, 0x12,
+ 0x00, 0x05, 0xdb, 0xc0, 0x00, 0x20, 0xe0, 0x06, 0x00, 0x12, 0x00, 0x06,
+ 0xe7, 0x22, 0x00, 0x12, 0xe0, 0x01, 0x09, 0x6c, 0x06, 0xcc, 0x00, 0x04,
+ 0x00, 0x07, 0x00, 0x00, 0x06, 0x30, 0xe6, 0x42, 0x05, 0xf0, 0xe0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xe2, 0x00, 0x08, 0xff, 0x26,
+ 0x05, 0xdc, 0xe7, 0xae, 0x00, 0x3e, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x30, 0x50, 0x20, 0x0c, 0x23, 0x05, 0xfc, 0x06, 0x52,
+ 0x06, 0x56, 0x00, 0x00, 0x81, 0x00, 0x00, 0x16, 0xe0, 0x00, 0xc0, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x40, 0x2a, 0x04, 0x2a, 0x06, 0x56,
+ 0x00, 0x26, 0xec, 0x71, 0x06, 0x2b, 0x09, 0x72, 0x00, 0x22, 0x00, 0x24,
+ 0xec, 0x87, 0x0c, 0x23, 0x05, 0xfc, 0x08, 0x28, 0x09, 0x34, 0x08, 0x29,
+ 0x07, 0x58, 0x07, 0x78, 0x07, 0x98, 0x00, 0x23, 0x00, 0x2a, 0xec, 0x95,
+ 0x04, 0x06, 0x06, 0xf0, 0x04, 0x07, 0x06, 0xee, 0x00, 0x24, 0xdb, 0xc0,
+ 0x00, 0x34, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x26,
+ 0x40, 0x25, 0xdb, 0xc0, 0x00, 0x20, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x10, 0x00, 0x12, 0x40, 0x26, 0xdb, 0xc0, 0x00, 0x1a, 0xe0, 0x00,
+ 0x00, 0x0c, 0x60, 0x27, 0x08, 0x0a, 0x06, 0xe6, 0xdb, 0xc0, 0x00, 0x24,
+ 0xe0, 0x00, 0x00, 0x16, 0x60, 0x28, 0x04, 0x30, 0x07, 0x06, 0xdc, 0x16,
+ 0x81, 0x00, 0x00, 0x30, 0xe0, 0x00, 0x00, 0x22, 0x60, 0x29, 0x08, 0x2d,
+ 0x07, 0x1c, 0x08, 0x2e, 0x07, 0x22, 0x00, 0x00, 0x02, 0x08, 0x01, 0x06,
+ 0x06, 0x14, 0x08, 0x18, 0x0c, 0x20, 0x0e, 0x26, 0x0f, 0x30, 0x11, 0x34,
+ 0x12, 0x3e, 0x14, 0x42, 0x16, 0x46, 0x0a, 0x1c, 0x18, 0x4a, 0x03, 0x13,
+ 0x83, 0x11, 0x11, 0x01, 0x81, 0x11, 0x81, 0x12, 0x01, 0x13, 0x83, 0x52,
+ 0x85, 0x81, 0x11, 0x85, 0x81, 0x12, 0x81, 0x12, 0x81, 0x19, 0x85, 0x60,
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x6c, 0x00, 0x00, 0x06, 0x30,
+ 0xec, 0xfc, 0x06, 0x54, 0x06, 0x50, 0x02, 0x38, 0x04, 0x21, 0x09, 0x1e,
+ 0x06, 0x0b, 0x06, 0xd8, 0x08, 0x02, 0x06, 0xdc, 0xc0, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x41, 0x00, 0x41, 0xae, 0x14, 0x00, 0x00, 0x81, 0x00,
+ 0x04, 0x09, 0x07, 0x0c, 0x00, 0x41, 0x00, 0x41, 0x02, 0x14, 0x00, 0x00,
+ 0x81, 0x00, 0x06, 0x0b, 0x06, 0xd8, 0x06, 0x2c, 0x09, 0x76, 0x14, 0x22,
+ 0x09, 0x3a, 0x00, 0x41, 0x00, 0x41, 0x02, 0x54, 0x00, 0x00, 0x81, 0x00,
+ 0x06, 0xd8, 0x84, 0x00, 0x48, 0x00, 0xff, 0xfc, 0x00, 0x09, 0xc0, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0xad, 0x80, 0x02, 0x81, 0x00, 0x00,
+ 0x00, 0x00, 0xb0, 0x00, 0x06, 0x44, 0x54, 0x68, 0x69, 0x73, 0x20, 0x63,
+ 0x6f, 0x64, 0x65, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61,
+ 0x73, 0x65, 0x64, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x6c, 0x69,
+ 0x63, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x2c, 0x20,
+ 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72,
+ 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x01, 0x60, 0x01, 0x42,
+ 0x08, 0x00, 0x16, 0x08, 0x03, 0xb0, 0x04, 0xe0, 0x00, 0x00, 0x01, 0x20,
+ 0x00, 0x00, 0xff, 0xff, 0x13, 0xfc, 0x03, 0x80, 0x07, 0xa0, 0x01, 0x42,
+ 0x08, 0x00, 0x07, 0x20, 0x00, 0x00, 0x04, 0xe0, 0x01, 0x00, 0x07, 0x8b,
+ 0x3d, 0x00, 0x01, 0x60, 0x01, 0x42, 0x00, 0x80, 0x13, 0x09, 0x07, 0x8b,
+ 0x2d, 0x00, 0xc0, 0x20, 0x01, 0x4e, 0x02, 0x80, 0x0f, 0x41, 0x11, 0x02,
+ 0x07, 0x8b, 0x3d, 0x00, 0xc8, 0x0b, 0x01, 0x4a, 0x02, 0x00, 0xa0, 0x00,
+ 0x09, 0xa0, 0xc8, 0x00, 0x01, 0x66, 0x02, 0xe0, 0x00, 0xa0, 0x07, 0xa0,
+ 0x01, 0x04, 0x00, 0x20, 0x01, 0xa0, 0x01, 0x40, 0xfe, 0x00, 0x48, 0x20,
+ 0xe0, 0x2a, 0x01, 0x42, 0x04, 0xe0, 0x01, 0x02, 0x04, 0xe0, 0x09, 0x60,
+ 0x04, 0xe0, 0x01, 0x82, 0x01, 0x60, 0x01, 0x1c, 0x00, 0x04, 0x16, 0x03,
+ 0x01, 0xe0, 0x01, 0x40, 0x0c, 0x00, 0x06, 0xa0, 0xb1, 0xbc, 0x07, 0xa0,
+ 0x01, 0x04, 0x00, 0x2d, 0xc2, 0x20, 0xe0, 0x00, 0x02, 0x88, 0xe2, 0x28,
+ 0x16, 0x14, 0x07, 0xa0, 0x01, 0x04, 0x00, 0x2e, 0x01, 0x60, 0x01, 0x42,
+ 0x03, 0x00, 0x16, 0x0d, 0x07, 0xa0, 0x01, 0x04, 0x00, 0x21, 0x07, 0x88,
+ 0xb0, 0x00, 0x07, 0x89, 0xff, 0xfe, 0x09, 0xa8, 0x09, 0xa9, 0x07, 0x8a,
+ 0xe0, 0x02, 0x06, 0xa0, 0xf4, 0x42, 0x10, 0x56, 0x07, 0x88, 0xa0, 0x00,
+ 0x07, 0x89, 0xaf, 0xfe, 0x09, 0xa8, 0x09, 0xa9, 0x07, 0x8a, 0xe0, 0x78,
+ 0x06, 0xa0, 0xf4, 0x42, 0x10, 0x4b, 0x05, 0xa0, 0x01, 0x04, 0x07, 0x88,
+ 0x00, 0x08, 0x07, 0x89, 0x00, 0x7a, 0x03, 0x00, 0x00, 0x01, 0x06, 0xa0,
+ 0xf4, 0x7c, 0x10, 0x40, 0x06, 0xa0, 0xb1, 0xbc, 0x02, 0xe0, 0x03, 0xf4,
+ 0x07, 0x88, 0x00, 0xa0, 0x07, 0x89, 0x00, 0xfe, 0x06, 0xa0, 0xf4, 0x7c,
+ 0x10, 0x35, 0x02, 0xe0, 0x00, 0xa0, 0x04, 0xe0, 0x01, 0x7e, 0x04, 0xc8,
+ 0x02, 0x09, 0x03, 0xf2, 0x62, 0x48, 0xc1, 0xe0, 0x01, 0x40, 0x01, 0xa0,
+ 0x01, 0x40, 0x04, 0x00, 0xce, 0x18, 0x06, 0x09, 0x16, 0xfd, 0x01, 0xa0,
+ 0x01, 0x40, 0x40, 0x00, 0xc8, 0x07, 0x01, 0x40, 0x07, 0x88, 0x03, 0xf4,
+ 0x07, 0x89, 0x3f, 0xfe, 0x06, 0xa0, 0xf4, 0x7c, 0x10, 0x19, 0x02, 0xe0,
+ 0x00, 0xa0, 0x06, 0xa0, 0xf5, 0xa4, 0x10, 0x14, 0xc8, 0x08, 0x04, 0x44,
+ 0xc8, 0x09, 0x04, 0x46, 0x06, 0xa0, 0xf4, 0xd2, 0x10, 0x0d, 0x07, 0x81,
+ 0xe0, 0x7c, 0xc0, 0xb1, 0x13, 0x26, 0xc8, 0x01, 0x00, 0xe0, 0x05, 0xa0,
+ 0x01, 0x04, 0x06, 0x92, 0x10, 0x03, 0xc0, 0x60, 0x00, 0xe0, 0x10, 0xf5,
+ 0x01, 0xe0, 0x01, 0x04, 0x00, 0x10, 0x03, 0xb0, 0x10, 0xff, 0x01, 0xa0,
+ 0x01, 0x04, 0x80, 0x00, 0x03, 0x80, 0x07, 0x80, 0x00, 0xa0, 0x04, 0xc2,
+ 0xcc, 0x80, 0x07, 0x81, 0xb1, 0xaa, 0x02, 0x82, 0x00, 0x1e, 0x16, 0x02,
+ 0x07, 0x81, 0xb1, 0xb4, 0xc4, 0x81, 0x8c, 0x81, 0x16, 0xe9, 0x02, 0x82,
+ 0x00, 0x7c, 0x16, 0xf2, 0x03, 0x00, 0x00, 0x0f, 0x04, 0x5b, 0x07, 0x81,
+ 0xe1, 0x08, 0x07, 0x82, 0x00, 0x04, 0x04, 0xe0, 0x01, 0x80, 0x04, 0xe0,
+ 0x01, 0x82, 0xc4, 0x91, 0x8c, 0xb1, 0x16, 0xd8, 0x02, 0x82, 0x00, 0x7c,
+ 0x16, 0xfa, 0xc8, 0x20, 0xe0, 0x04, 0x01, 0x82, 0xe8, 0x20, 0xe0, 0x0c,
+ 0x01, 0x82, 0xc8, 0x20, 0xe0, 0x10, 0x01, 0x80, 0x07, 0x81, 0xe0, 0x86,
+ 0xc0, 0xb1, 0x13, 0x07, 0xc4, 0xb1, 0x10, 0xfc, 0x07, 0xa0, 0x01, 0x04,
+ 0x00, 0x2e, 0x04, 0x60, 0xb1, 0xaa, 0x07, 0x81, 0xe0, 0x34, 0x07, 0x82,
+ 0x05, 0xfc, 0x07, 0x83, 0x00, 0x0a, 0xcc, 0xb1, 0x06, 0x43, 0x16, 0xfd,
+ 0x02, 0x02, 0x06, 0x00, 0xd0, 0x60, 0x01, 0x4e, 0x13, 0xed, 0x02, 0x21,
+ 0xf7, 0x00, 0x02, 0x21, 0xc0, 0x00, 0xdc, 0x81, 0xd0, 0x60, 0x01, 0x4f,
+ 0xc0, 0xc1, 0x09, 0x41, 0x02, 0x21, 0xf0, 0x00, 0xdc, 0x81, 0x02, 0x43,
+ 0x0f, 0x00, 0x02, 0x23, 0xf0, 0x00, 0xdc, 0x83, 0x02, 0x01, 0x0c, 0x32,
+ 0xc0, 0xa0, 0x04, 0x44, 0xc0, 0xe0, 0x04, 0x46, 0xc1, 0x03, 0x61, 0x02,
+ 0x05, 0x84, 0xc8, 0x04, 0x04, 0x48, 0xc1, 0x03, 0x05, 0x84, 0xa1, 0x04,
+ 0xa1, 0x01, 0xc8, 0x04, 0x0c, 0x30, 0xc1, 0x03, 0x05, 0x84, 0x04, 0xf1,
+ 0x06, 0x04, 0x16, 0xfd, 0x02, 0x08, 0xb0, 0x00, 0x09, 0xa8, 0xc2, 0x60,
+ 0x0c, 0x30, 0x02, 0x29, 0x03, 0xff, 0x09, 0xa9, 0x02, 0x29, 0x00, 0x40,
+ 0x07, 0x80, 0xa0, 0x00, 0x09, 0xa0, 0x07, 0x8a, 0xaf, 0xfe, 0x02, 0x2a,
+ 0x03, 0xff, 0x09, 0xaa, 0x02, 0x01, 0x0c, 0x32, 0x02, 0x05, 0x00, 0x00,
+ 0xc1, 0x03, 0x05, 0x84, 0x07, 0x11, 0x05, 0xc1, 0x05, 0x85, 0x06, 0x04,
+ 0x13, 0x0b, 0x80, 0x85, 0x1a, 0xf9, 0x80, 0x05, 0x1a, 0xf8, 0x82, 0x85,
+ 0x1a, 0xf5, 0x82, 0x05, 0x1a, 0xf4, 0x82, 0x45, 0x1a, 0xf1, 0x10, 0xf1,
+ 0x2d, 0x20, 0x00, 0x02, 0x01, 0x60, 0x01, 0x40, 0x40, 0x00, 0x16, 0x06,
+ 0x07, 0x8a, 0x08, 0x00, 0x01, 0xa0, 0x01, 0x40, 0x40, 0x00, 0x10, 0x48,
+ 0x01, 0x60, 0x01, 0x42, 0x80, 0x00, 0x16, 0x06, 0x07, 0x8a, 0x10, 0x00,
+ 0x01, 0xa0, 0x01, 0x42, 0x80, 0x00, 0x10, 0x3e, 0x01, 0x60, 0x01, 0x02,
+ 0x10, 0x00, 0x16, 0x0a, 0x01, 0x60, 0x01, 0x00, 0x04, 0x00, 0x16, 0x06,
+ 0x07, 0x8a, 0x80, 0x00, 0x01, 0xa0, 0x01, 0x02, 0x10, 0x00, 0x10, 0x30,
+ 0x01, 0x60, 0x01, 0x02, 0x08, 0x00, 0x16, 0x0a, 0x01, 0x60, 0x01, 0x00,
+ 0x04, 0x00, 0x16, 0x06, 0x01, 0xa0, 0x01, 0x02, 0x08, 0x00, 0x02, 0x0d,
+ 0x00, 0x01, 0x10, 0x0d, 0x01, 0x60, 0x01, 0x02, 0x04, 0x00, 0x16, 0x16,
+ 0x01, 0x60, 0x01, 0x00, 0x08, 0x00, 0x16, 0x12, 0x01, 0xa0, 0x01, 0x02,
+ 0x04, 0x00, 0x02, 0x0d, 0x00, 0x02, 0xc3, 0xa0, 0x01, 0x0e, 0xc3, 0xe0,
+ 0x01, 0x10, 0x07, 0x8a, 0x20, 0x00, 0x01, 0x60, 0x01, 0x00, 0x80, 0x00,
+ 0x13, 0x0b, 0x07, 0x8a, 0x40, 0x00, 0x10, 0x08, 0x07, 0x8a, 0x00, 0x04,
+ 0x10, 0x05, 0x07, 0x8a, 0x00, 0x02, 0x10, 0x02, 0x07, 0x8a, 0x00, 0x08,
+ 0x03, 0x00, 0x00, 0x00, 0x04, 0xe0, 0x01, 0x82, 0x07, 0x8b, 0x05, 0xe0,
+ 0xce, 0xca, 0xce, 0xcd, 0xce, 0xce, 0xc6, 0xcf, 0xc3, 0x20, 0x07, 0x58,
+ 0x23, 0x20, 0xe0, 0x04, 0x13, 0x12, 0x07, 0x8b, 0xff, 0x18, 0x02, 0x8a,
+ 0x80, 0x00, 0x13, 0x0a, 0x05, 0x8b, 0xa2, 0xcd, 0x02, 0x8a, 0x40, 0x00,
+ 0x13, 0x05, 0x02, 0x8a, 0x20, 0x00, 0x13, 0x02, 0x07, 0x8b, 0xff, 0x1d,
+ 0xc8, 0x0b, 0x01, 0x04, 0x10, 0x0d, 0xd3, 0x20, 0x01, 0x05, 0x11, 0xfd,
+ 0xd8, 0x20, 0x07, 0xdf, 0x01, 0x17, 0x07, 0x8b, 0xff, 0x80, 0xc8, 0x0b,
+ 0x01, 0x04, 0xe8, 0x20, 0xe0, 0x0a, 0x01, 0x00, 0xc2, 0xe0, 0x01, 0x04,
+ 0x22, 0xe0, 0xe1, 0x86, 0x16, 0xfb, 0x02, 0xe0, 0x00, 0xa0, 0x04, 0xe0,
+ 0x01, 0x82, 0xe8, 0x20, 0xe0, 0x0a, 0x01, 0x00, 0xc2, 0xe0, 0x01, 0x00,
+ 0x22, 0xe0, 0xe0, 0x06, 0x13, 0xf8, 0x01, 0xa0, 0x01, 0x40, 0xf6, 0x00,
+ 0x04, 0x60, 0xb0, 0x90, 0x03, 0x00, 0x00, 0x02, 0x07, 0xa0, 0x01, 0x02,
+ 0xdf, 0xff, 0x03, 0x90, 0xff, 0xff, 0x03, 0x80, 0x03, 0x00, 0x00, 0x02,
+ 0x07, 0x09, 0xc2, 0xa0, 0x01, 0x04, 0x01, 0x8a, 0x00, 0x80, 0x52, 0x4a,
+ 0xd2, 0x89, 0xc8, 0x0a, 0x01, 0x04, 0xd2, 0xa0, 0x01, 0x04, 0x16, 0xf9,
+ 0x05, 0x49, 0x01, 0x89, 0x80, 0x00, 0x01, 0x49, 0x40, 0x00, 0x13, 0x0e,
+ 0xf8, 0x09, 0x07, 0x3a, 0xc2, 0x60, 0x07, 0x36, 0x16, 0x03, 0x03, 0x90,
+ 0xff, 0xff, 0x03, 0x80, 0x04, 0xe0, 0x07, 0x36, 0x04, 0x54, 0x03, 0x90,
+ 0xff, 0xff, 0x03, 0x80, 0x22, 0x60, 0xe1, 0x86, 0x13, 0xc2, 0x04, 0xe0,
+ 0x01, 0x82, 0x04, 0x60, 0xb3, 0xe0, 0x03, 0x00, 0x00, 0x02, 0x07, 0xa0,
+ 0x09, 0x62, 0x03, 0xe8, 0x04, 0xc9, 0xc1, 0xa0, 0x06, 0x34, 0x16, 0x04,
+ 0x06, 0xa0, 0xc2, 0xae, 0x04, 0xe0, 0x09, 0x20, 0x07, 0x86, 0x05, 0xe8,
+ 0x01, 0xa0, 0x01, 0x40, 0x80, 0x00, 0xc2, 0x20, 0x01, 0x84, 0x48, 0x20,
+ 0xe0, 0x08, 0x01, 0x84, 0x22, 0x20, 0xe0, 0x08, 0x13, 0x08, 0x01, 0x60,
+ 0x01, 0xae, 0x00, 0x01, 0x16, 0x04, 0x01, 0xe0, 0x06, 0x34, 0x80, 0x00,
+ 0x10, 0x06, 0xc2, 0x20, 0x09, 0x32, 0x13, 0x06, 0x01, 0xe0, 0x06, 0x34,
+ 0x08, 0x00, 0x04, 0xe0, 0x06, 0x30, 0x07, 0x09, 0x05, 0xa0, 0x05, 0xee,
+ 0x06, 0x20, 0x05, 0xec, 0x16, 0x02, 0xc2, 0x16, 0x16, 0x03, 0xc2, 0x49,
+ 0x16, 0x12, 0x03, 0x80, 0xc5, 0x98, 0xc1, 0xe8, 0x00, 0x02, 0xe9, 0xe0,
+ 0xe0, 0x14, 0x00, 0x04, 0x04, 0xd7, 0x02, 0x27, 0x00, 0x08, 0x06, 0xa0,
+ 0xc2, 0x44, 0xc2, 0x16, 0x13, 0x04, 0xc8, 0x28, 0x00, 0x08, 0x05, 0xec,
+ 0x13, 0xef, 0x04, 0x54, 0x03, 0x00, 0x00, 0x02, 0xc1, 0xe0, 0x01, 0x86,
+ 0x02, 0x47, 0x00, 0x0e, 0xc2, 0xa7, 0xe1, 0x90, 0x04, 0x5a, 0x07, 0x8a,
+ 0xa0, 0x00, 0xc8, 0x0a, 0x01, 0x86, 0xa1, 0xc7, 0x02, 0x27, 0xe1, 0x98,
+ 0xe8, 0x37, 0x06, 0x34, 0xe8, 0x17, 0x06, 0xd2, 0x04, 0xe0, 0x06, 0x30,
+ 0x04, 0x60, 0xb9, 0xc0, 0xe8, 0x0a, 0x06, 0xd2, 0x01, 0xe0, 0x06, 0x34,
+ 0x08, 0x00, 0x04, 0xe0, 0x06, 0x30, 0xe0, 0x20, 0xe0, 0x18, 0x04, 0x5b,
+ 0x05, 0xa0, 0x09, 0x20, 0x88, 0x20, 0x09, 0x20, 0xe0, 0x16, 0x1a, 0xe5,
+ 0x04, 0xe0, 0x09, 0x20, 0x06, 0xa0, 0xe1, 0x18, 0x03, 0x80, 0x05, 0xa0,
+ 0x09, 0x32, 0x03, 0x80, 0xc3, 0x01, 0x13, 0xfb, 0x01, 0x60, 0x09, 0x6a,
+ 0x00, 0x01, 0x13, 0x78, 0x05, 0xa0, 0x09, 0x32, 0x10, 0x75, 0xc0, 0x41,
+ 0x13, 0x06, 0xc8, 0x01, 0x01, 0x6c, 0xc2, 0xe0, 0xfc, 0x02, 0x11, 0x01,
+ 0x10, 0x7b, 0x01, 0x60, 0x01, 0x9c, 0x00, 0x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xd8, 0x20, 0xe2, 0x00,
+ 0x01, 0x83, 0x00, 0x00, 0xb6, 0x44, 0x00, 0x09, 0x09, 0x8b, 0x00, 0x00,
+ 0xb6, 0x4c, 0x0b, 0x36, 0x07, 0xa0, 0x01, 0x8a, 0x00, 0x43, 0x10, 0x13,
+ 0xc8, 0x0c, 0x01, 0x8a, 0xc8, 0x0c, 0x09, 0x18, 0x10, 0x0e, 0x03, 0x00,
+ 0x00, 0x02, 0xc0, 0xe0, 0x01, 0x6c, 0xc3, 0x20, 0x01, 0x8a, 0x98, 0x20,
+ 0x01, 0x83, 0xe2, 0x00, 0x13, 0x81, 0x01, 0x60, 0x01, 0x9c, 0x00, 0x40,
+ 0x13, 0xb9, 0x83, 0x01, 0x16, 0x31, 0xc8, 0x03, 0x01, 0x6c, 0x01, 0x40,
+ 0x00, 0x10, 0x16, 0x14, 0xc2, 0xe0, 0x06, 0x2e, 0x13, 0x11, 0xc2, 0xe0,
+ 0x05, 0xf8, 0x13, 0x0e, 0x01, 0xe0, 0x07, 0x3a, 0x80, 0x00, 0x01, 0x80,
+ 0x00, 0x10, 0xc2, 0xe0, 0x07, 0x36, 0x13, 0x06, 0x04, 0xe0, 0x07, 0x36,
+ 0x01, 0x80, 0x00, 0x20, 0x04, 0x60, 0xb9, 0xc0, 0x01, 0x40, 0x00, 0x20,
+ 0x13, 0xf9, 0x03, 0x90, 0x11, 0xff, 0x03, 0x80, 0x01, 0x08, 0x04, 0x00,
+ 0x16, 0x19, 0x01, 0x60, 0x09, 0x6a, 0x00, 0x01, 0x16, 0x15, 0x01, 0x88,
+ 0x1a, 0x00, 0x01, 0xc8, 0x01, 0x00, 0xc5, 0xc8, 0x10, 0x0f, 0x04, 0xe0,
+ 0x09, 0x18, 0x01, 0xc0, 0x00, 0x04, 0x10, 0x15, 0xc1, 0x81, 0xc8, 0x01,
+ 0x01, 0x6c, 0x02, 0x07, 0xfc, 0x00, 0xc0, 0x77, 0xc2, 0x17, 0x01, 0x48,
+ 0x18, 0x00, 0x13, 0xe4, 0x01, 0x40, 0x00, 0x40, 0x16, 0x15, 0x01, 0x80,
+ 0x00, 0x45, 0xc1, 0x46, 0xd0, 0x20, 0xfc, 0x07, 0x81, 0x60, 0x09, 0x18,
+ 0x13, 0xe6, 0xc2, 0xe0, 0xfc, 0x08, 0x11, 0x08, 0xc2, 0xe0, 0xfc, 0x0e,
+ 0x15, 0x07, 0x13, 0x06, 0xc2, 0xe0, 0xfc, 0x14, 0x15, 0x03, 0x13, 0x02,
+ 0x01, 0xc0, 0x00, 0x01, 0x01, 0x48, 0x01, 0x00, 0x13, 0x11, 0x01, 0x40,
+ 0x40, 0x80, 0x13, 0x5b, 0x04, 0x60, 0xb6, 0x66, 0x01, 0x48, 0x00, 0x01,
+ 0x16, 0x03, 0x01, 0x40, 0x40, 0x00, 0x16, 0x0b, 0x01, 0xc8, 0x40, 0x00,
+ 0x05, 0xa0, 0x09, 0x32, 0xc5, 0xc8, 0x10, 0x05, 0x01, 0xc0, 0x00, 0x40,
+ 0x01, 0x40, 0x00, 0x04, 0x13, 0xef, 0x05, 0xc7, 0xc2, 0xd7, 0x62, 0xc4,
+ 0x05, 0x0b, 0x02, 0x2b, 0xff, 0xfc, 0xc5, 0xcb, 0x15, 0x02, 0x81, 0x46,
+ 0x13, 0x5d, 0x01, 0x08, 0x5e, 0x00, 0x16, 0x5a, 0x01, 0x08, 0x00, 0x88,
+ 0x16, 0x13, 0x02, 0x86, 0x00, 0x43, 0x16, 0x1e, 0x01, 0x40, 0x40, 0x00,
+ 0x13, 0x0b, 0x01, 0x08, 0x00, 0x03, 0x13, 0x08, 0xc2, 0x84, 0x02, 0x2a,
+ 0xff, 0xd8, 0xc8, 0x06, 0x01, 0x6c, 0x68, 0x0a, 0xfc, 0x04, 0x10, 0x66,
+ 0x04, 0x60, 0xb8, 0xa8, 0x01, 0x40, 0x00, 0x01, 0x13, 0xea, 0x01, 0x08,
+ 0x00, 0x02, 0x16, 0xe7, 0x01, 0x48, 0x00,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 0xc2, 0x09, 0xc2, 0x59, 0x13, 0x20,
+ 0xa1, 0xe9, 0x00, 0x08, 0x82, 0x87, 0x12, 0xf9, 0xa2, 0xa9, 0x00, 0x08,
+ 0x62, 0x87, 0xca, 0xca, 0x00, 0x08, 0x6a, 0x4a, 0x00, 0x08, 0xc6, 0xc9,
+ 0xc6, 0x0b, 0x03, 0x80, 0xca, 0xca, 0x00, 0x08, 0xc8, 0x0a, 0x05, 0xec,
+ 0x04, 0xdb, 0xcf, 0x0b, 0xc7, 0x0b, 0x03, 0x80, 0x61, 0x8a, 0xca, 0x46,
+ 0x00, 0x08, 0xca, 0xca, 0x00, 0x08, 0xc8, 0x0a, 0x05, 0xec, 0xc6, 0xc9,
+ 0xc7, 0x0b, 0x03, 0x80, 0x62, 0x87, 0xca, 0xca, 0x00, 0x08, 0x04, 0xdb,
+ 0xc6, 0x0b, 0xcb, 0x0b, 0x00, 0x02, 0x03, 0x80, 0x03, 0x00, 0x00, 0x02,
+ 0xc1, 0xbb, 0xc2, 0xdb, 0x07, 0x8c, 0x05, 0xe8, 0xc2, 0x4c, 0x04, 0xed,
+ 0x00, 0x02, 0xc2, 0x09, 0xc2, 0x59, 0x13, 0x18, 0x81, 0xa9, 0x00, 0x02,
+ 0x16, 0xfa, 0x82, 0xe9, 0x00, 0x04, 0x16, 0xf7, 0xcb, 0x49, 0x00, 0x04,
+ 0xc2, 0x99, 0xc6, 0x0a, 0x13, 0x0a, 0x83, 0x08, 0x13, 0x04, 0xaa, 0xa9,
+ 0x00, 0x08, 0x00, 0x08, 0x03, 0x80, 0xa8, 0x2a, 0x00, 0x08, 0x05, 0xec,
+ 0x03, 0x80, 0xcb, 0x08, 0x00, 0x02, 0x03, 0x80, 0x07, 0x2d, 0x00, 0x02,
+ 0x07, 0x8c, 0x00, 0x08, 0xa3, 0x06, 0xc2, 0x4c, 0xc2, 0x09, 0xc2, 0x59,
+ 0x13, 0x13, 0x82, 0xe9, 0x00, 0x04, 0x16, 0xfa, 0x07, 0xad, 0x00, 0x02,
+ 0x00, 0x01, 0xcb, 0x49, 0x00, 0x04, 0xc6, 0x19, 0x13, 0x01, 0x03, 0x80,
+ 0x83, 0x08, 0x16, 0x04, 0x49, 0xa0, 0xe0, 0x14, 0x00, 0x04, 0x03, 0x80,
+ 0xcb, 0x08, 0x00, 0x02, 0x03, 0x80, 0x03, 0x00, 0x00, 0x02, 0x06, 0x0b,
+ 0x11, 0x1f, 0x13, 0x4d, 0x07, 0x8b, 0x4e, 0x00, 0x01, 0x60, 0x01, 0x42,
+ 0x00, 0x80, 0x13, 0x09, 0x07, 0x8b, 0x3a, 0x00, 0xc1, 0x20, 0x01, 0x4e,
+ 0x02, 0x84, 0x0f, 0x41, 0x11, 0x02, 0x07, 0x8b, 0x4e, 0x00, 0xc8, 0x0b,
+ 0x01, 0x44, 0x07, 0xa0, 0x09, 0x62, 0x03, 0xe8, 0x01, 0xe0, 0x01, 0x40,
+ 0x02, 0x00, 0x01, 0xe0, 0x01, 0x40, 0x20, 0x00, 0x07, 0x84, 0xbc, 0xa0,
+ 0x04, 0x60, 0xbc, 0xae, 0xc8, 0x20, 0xe0, 0x16, 0x00, 0xe0, 0xc2, 0xe0,
+ 0x09, 0x6a, 0x22, 0xe0, 0xe0, 0x10, 0x13, 0x03, 0xe8, 0x20, 0xe0, 0x14,
+ 0x00, 0xe0, 0xc8, 0x20, 0xe0, 0x04, 0x01, 0x82, 0xc8, 0x20, 0x00, 0xe2,
+ 0x01, 0x8a, 0x04, 0xe0, 0x09, 0x18, 0x04, 0xe0, 0x05, 0xf4, 0x04, 0xe0,
+ 0x05, 0xf8, 0x04, 0xe0, 0x05, 0xf0, 0x04, 0xe0, 0x07, 0x42, 0x07, 0xa0,
+ 0x01, 0x88, 0x00, 0x20, 0xc2, 0xe0, 0x09, 0x30, 0x13, 0x09, 0x07, 0xa0,
+ 0x01, 0x88, 0x00, 0x80, 0xe8, 0x20, 0xe0, 0x16, 0x01, 0x80, 0x01, 0xe0,
+ 0x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x02, 0x8b, 0x59, 0x3b, 0x16, 0x21, 0x02, 0x8a,
+ 0x59, 0x3b, 0x13, 0x1e, 0x05, 0x8f, 0x20, 0x20, 0xe0, 0x16, 0x16, 0x01,
+ 0x10, 0x19, 0x20, 0x20, 0xe0, 0x04, 0x16, 0x16, 0x01, 0x00, 0x00, 0xbf,
+ 0x16, 0x13, 0x07, 0x8b, 0x40, 0xc0, 0x01, 0x00, 0x60, 0x00, 0x13, 0x10,
+ 0x01, 0x40, 0x60, 0x00, 0x16, 0x0b, 0x07, 0x8b, 0x44, 0xc4, 0xc3, 0xa0,
+ 0x01, 0x02, 0x48, 0x0e, 0x01, 0x02, 0x01, 0x4e, 0x10, 0x00, 0x16, 0x04,
+ 0x07, 0x8f, 0xff, 0x18, 0x04, 0x60, 0xc4, 0xf2, 0xc3, 0x0b, 0xc3, 0x4b,
+ 0x20, 0x20, 0xe0, 0x0a, 0x16, 0x02, 0x02, 0x6b, 0x20, 0x20, 0x20, 0x20,
+ 0xe0, 0x0c, 0x16, 0x02, 0x02, 0x6c, 0x20, 0x00, 0x20, 0x20, 0xe0, 0x0e,
+ 0x16, 0x02, 0x02, 0x6c, 0x00, 0x20, 0x05, 0x8f, 0x20, 0x20, 0xe0, 0x10,
+ 0x16, 0x07, 0x02, 0x6d, 0x00, 0x20, 0x21, 0x20, 0xe0, 0x22, 0x13, 0xe4,
+ 0xc1, 0x04, 0x16, 0x02, 0x07, 0x84, 0x7f, 0xfe, 0x05, 0x8f, 0x20, 0x20,
+ 0xe0, 0x12, 0x16, 0x02, 0x02, 0x6d, 0x20, 0x00, 0x21, 0x60, 0xe0, 0x22,
+ 0x13, 0xd7, 0xc1, 0x45, 0x16, 0x02, 0x07, 0x85, 0x7f, 0xfe, 0x05, 0x8f,
+ 0xd1, 0x86, 0x13, 0x0b, 0x25, 0xa0, 0xe0, 0x26, 0x13, 0x08, 0x05, 0x8f,
+ 0x26, 0x20, 0xe0, 0x22, 0x16, 0x04, 0x05, 0x8f, 0x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+ 0xc0, 0x60, 0x05, 0xee, 0x02, 0x21, 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02,
+ 0x00, 0x06, 0x16, 0x07, 0x88, 0x01, 0x05, 0xee, 0x16, 0xf9, 0x10, 0x39,
+ 0xd0, 0x60, 0x01, 0x03, 0x13, 0xf1, 0x02, 0x01, 0x01, 0x0a, 0xcc, 0x4c,
+ 0xcc, 0x4c, 0xcc, 0x4e, 0xcc, 0x4f, 0x07, 0xb1, 0x00, 0x40, 0xcc, 0x4d,
+ 0xc8, 0x0a, 0x01, 0x00, 0x04, 0x5b, 0xc0, 0x60, 0x05, 0xee, 0x02, 0x21,
+ 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02, 0x00, 0x06, 0x16, 0x07, 0x88, 0x01,
+ 0x05, 0xee, 0x16, 0xf9, 0x10, 0x1e, 0xd0, 0x60, 0x01, 0x03, 0x13, 0xf1,
+ 0x02, 0x01, 0x01, 0x0a, 0xcc, 0x4c, 0xcc, 0x4c, 0xcc, 0x4e, 0xcc, 0x4f,
+ 0x07, 0xb1, 0x00, 0x40, 0xcc, 0x4d, 0xc8, 0x0a, 0x01, 0x00, 0x03, 0xa0,
+ 0xd0, 0x60, 0x01, 0x03, 0x13, 0x01, 0x04, 0x5b, 0xc0, 0x60, 0x05, 0xee,
+ 0x02, 0x21, 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02, 0x00, 0x06, 0x16, 0xf7,
+ 0x88, 0x01, 0x05, 0xee, 0x16, 0xf9, 0x04, 0xcd, 0x07, 0x8a, 0x40, 0x00,
+ 0xc3, 0x20, 0x01, 0x00, 0x01, 0x0c, 0x80, 0x00, 0x13, 0x02, 0x07, 0x8a,
+ 0x20, 0x00, 0xc3, 0xa0, 0x01, 0x0e, 0xc3, 0xe0, 0x01, 0x10, 0x03, 0xb0,
+ 0xc3, 0x20, 0x07, 0x58, 0x23, 0x20, 0xe0, 0x04, 0x13, 0x02, 0x04, 0x60,
+ 0xc4, 0xec, 0x04, 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 0xe0, 0x26, 0x23, 0xe0, 0xe0, 0x14, 0x13, 0x0a, 0xc1, 0x0a, 0x83, 0xc4,
+ 0x13, 0x07, 0xc3, 0xc4, 0xc1, 0x24, 0xe3, 0xd2, 0x04, 0x54, 0x93, 0xca,
+ 0x13, 0xdc, 0xd3, 0xca, 0x03, 0xb0, 0xd8, 0x0f, 0x06, 0x59, 0x71, 0x04,
+ 0xc1, 0x24, 0xe3, 0xde, 0x04, 0x54, 0x23, 0xa0, 0xe0, 0x0c, 0x13, 0xd1,
+ 0xc3, 0x4d, 0x13, 0xcf, 0x07, 0x86, 0x00, 0x02, 0x07, 0x84, 0x00, 0x26,
+ 0x23, 0x46, 0x13, 0x03, 0x06, 0x44, 0xa1, 0x86, 0x10, 0xfb, 0x43, 0x46,
+ 0x10, 0xb9, 0x07, 0x85, 0x07, 0x1c, 0x07, 0x86, 0x04, 0x1a, 0x6d, 0x76,
+ 0x6d, 0x76, 0x6d, 0x76, 0x05, 0xc6, 0x6d, 0x76, 0x6d, 0x76, 0x6d, 0x76,
+ 0x07, 0x83, 0x90, 0x00, 0x10, 0xbe, 0xc3, 0x0b, 0x07, 0x86, 0x01, 0x00,
+ 0x07, 0x85, 0x80, 0x00, 0xc1, 0x20, 0x06, 0xd2, 0x13, 0x37, 0x04, 0xc4,
+ 0xc0, 0x60, 0x06, 0xd2, 0x20, 0x45, 0x13, 0x04, 0x05, 0x84, 0x09, 0x15,
+ 0x16, 0xf9, 0x10, 0x2e, 0xd3, 0xcf, 0x16, 0x06, 0x23, 0xe0, 0xe0, 0x14,
+ 0x16, 0x03, 0x01, 0x0e, 0x00, 0x03, 0x13, 0x03, 0x04, 0xe0, 0x06, 0xd2,
+ 0x10, 0x23, 0xd0, 0x64, 0x07, 0x1c, 0xb0, 0x46, 0x18, 0x10, 0xd9, 0x01,
+ 0x07, 0x1c, 0x23, 0x60, 0xe0, 0x20, 0x13, 0x0b, 0x07, 0x81, 0x00, 0x18,
+ 0xc0, 0x61, 0xe3, 0xee, 0x88, 0x11, 0xed, 0x26, 0x13, 0x04, 0x02, 0x08,
+ 0x80, 0x18, 0x06, 0xa0, 0xe0, 0x22, 0xd0, 0x64, 0x07, 0x28, 0xb0, 0x46,
+ 0x18, 0x08, 0xd9, 0x01, 0x07, 0x28, 0xb0, 0x46, 0x17, 0x04, 0x07, 0x83,
+ 0x80, 0x40, 0x06, 0xa0, 0xe3, 0x56, 0x48, 0x05, 0x06, 0xd2, 0x16, 0xca,
+ 0xc1, 0x20, 0x09, 0x32, 0x16, 0x01, 0x04, 0x5c, 0x02, 0x04, 0x00, 0x07,
+ 0x06, 0x20, 0x09, 0x32, 0x02, 0x05, 0x01, 0x00, 0x10, 0xc7, 0xc3, 0x0b,
+ 0x04, 0xc5, 0xc0, 0x42, 0x04, 0xc7, 0xc2, 0x20, 0x01, 0x6c, 0xa1, 0xe1,
+ 0x00, 0x04, 0xc8, 0x11, 0x01, 0x6c, 0x16, 0xfb, 0xc8, 0x08, 0x01, 0x6c,
+ 0x04, 0xc8, 0x43, 0xa0, 0xe0, 0x1a, 0xc1, 0x22, 0x00, 0x0e, 0x15, 0x0d,
+ 0x13, 0x0c, 0xe3, 0xa0, 0xe0, 0x1a, 0x06, 0xa0, 0xe3, 0x40, 0xc2, 0x08,
+ 0x13, 0x48, 0x02, 0x88, 0x00, 0x12, 0x1b, 0x45, 0x22, 0x20, 0xe0, 0x22,
+ 0x13, 0x42, 0xc1, 0x02, 0xa1, 0x08, 0x05, 0x08, 0x02, 0x28, 0xff, 0xf2,
+ 0xa2, 0x07, 0x07, 0x83, 0x80, 0x01, 0x02, 0x88, 0x00, 0x04, 0x11, 0x6e,
+ 0xc2, 0x64, 0x00, 0x16, 0xd2, 0x49, 0x16, 0x02, 0x81, 0x02, 0x16, 0x31,
+ 0x01, 0x09, 0xf0, 0x00, 0x16, 0x28, 0xc1, 0x49, 0x71, 0x45, 0x04, 0xc3,
+ 0x02, 0x85, 0x00, 0x09, 0x13, 0x7c, 0x07, 0x83, 0x80, 0x02, 0xc1, 0xa4,
+ 0x00, 0x14, 0x81, 0x88, 0x16, 0x76, 0x05, 0x83, 0x02, 0x85, 0x00, 0x10,
+ 0x1b, 0x13, 0x05, 0x83, 0x99, 0x49, 0xea, 0xd0, 0x13, 0x0a, 0x98, 0x09,
+ 0xe0, 0x0e, 0x16, 0x6b, 0x98, 0x25, 0xea, 0xd0, 0xe0, 0x0c, 0x16, 0x67,
+ 0xc1, 0xe0, 0x06, 0xec, 0x16, 0x64, 0x04, 0xc3, 0xc2, 0x52, 0x13, 0x0f,
+ 0x07, 0x83, 0x80, 0x09, 0xc1, 0xe0, 0x09, 0x6a, 0x01, 0x47, 0x10, 0x00,
+ 0x16, 0x5a, 0xc0, 0xa0, 0x01, 0x6c, 0x06, 0xa0, 0xe1, 0xfa, 0x04, 0x60,
+ 0xdb, 0x9e, 0x04, 0x60, 0xdb, 0xa8, 0x07, 0x89, 0x07, 0x0e, 0x04, 0xc7,
+ 0xd1, 0xe5, 0xea, 0xe1, 0x13, 0x05, 0x06, 0xc7, 0x02, 0x27, 0xea, 0xf2,
+ 0xce, 0x77, 0x15, 0xfe, 0xc0, 0x44, 0x02, 0x21, 0x00, 0x18, 0x02, 0x28,
+ 0xff, 0xfc, 0x13, 0x36, 0xc1, 0x91, 0xd1, 0x86, 0x13, 0x1f, 0x06, 0xc6,
+ 0x07, 0x87, 0x07, 0x0e, 0xc0, 0xf7, 0x02, 0x46, 0xbf, 0xff, 0x02, 0x43,
+ 0x3f, 0xff, 0x91, 0xa0, 0xed, 0x4d, 0x16, 0x09, 0x03, 0xb0, 0x98, 0x20,
+ 0xe0, 0x0e, 0x06, 0x5d, 0x16, 0x0f, 0xc8, 0x21, 0x00, 0x02, 0x07, 0x0c,
+ 0x10, 0x17, 0x82, 0x47, 0x1b, 0x0c, 0x90, 0xc6, 0x16, 0xeb, 0x06, 0x47,
+ 0x04, 0xf7, 0x03, 0xb0, 0x98, 0x20, 0x06, 0x5d, 0x06, 0x57, 0x13, 0x0c,
+ 0x07, 0x83, 0x80, 0x05, 0x10, 0x1c, 0xc0, 0xd1, 0x20, 0xe0, 0xe0, 0x16,
+ 0x16, 0x03, 0x07, 0x83, 0x80, 0x08, 0x10, 0x15, 0x44, 0x60, 0xe0, 0x26,
+ 0x71, 0x86, 0xa0, 0x46, 0x62, 0x06, 0x07, 0x83, 0x80, 0x05, 0xc2, 0x08,
+ 0x15, 0xcb, 0x16, 0x0b, 0x04, 0xc3, 0x07, 0x87, 0x07, 0x0e, 0xc0, 0x77,
+ 0x82, 0x47, 0x1b, 0x05, 0x20, 0x60, 0xe0, 0x06, 0x16, 0xfa, 0x07, 0x83,
+ 0x80, 0x07, 0x04, 0x5c, 0x92, 0xa0, 0xe0, 0x0e, 0x16, 0x11, 0xc8, 0x20,
+ 0xe0, 0x20, 0x07, 0x08, 0x04, 0xe0, 0x01, 0x84, 0x05, 0x60, 0x07, 0x02,
+ 0x13, 0x3f, 0x48, 0x20, 0xe0, 0x06, 0x01, 0x82, 0x06, 0xa0, 0xe0, 0x18,
+ 0x07, 0x83, 0xc0, 0x00, 0x06, 0xa0, 0xe3, 0x56, 0xc8, 0x20, 0xe0, 0x1e,
+ 0x07, 0x02, 0xe3, 0xa0, 0xe0, 0x04, 0x02, 0x08, 0x80, 0x24, 0x06, 0xa0,
+ 0xe0, 0x22, 0x10, 0x36, 0xc1, 0x20, 0x01, 0x84, 0x02, 0x44, 0x88, 0x00,
+ 0x13, 0x1e, 0x48, 0x04, 0x01, 0x84, 0x06, 0x20, 0x07, 0x02, 0x16, 0xf1,
+ 0x23, 0xa0, 0xe0, 0x22, 0x16, 0x05, 0x43, 0xa0, 0xe0, 0x22, 0xd2, 0xa0,
+ 0xe0, 0x0e, 0x10, 0xd3, 0x23, 0xe0, 0xe0, 0x14, 0x13, 0x04, 0x98, 0x20,
+ 0xe3, 0xa9, 0x06, 0x65, 0x16, 0x06, 0x92, 0xa0, 0xe0, 0x0e, 0x13, 0xc9,
+ 0xd2, 0xa0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0e, 0xc6, 0x09, 0x02, 0x49,
+ 0x1f, 0x00, 0x06, 0xc9, 0xa2, 0x09, 0xa8, 0x89, 0x00, 0x04, 0x02, 0x28,
+ 0x00, 0x02, 0xc2, 0x58, 0x0a, 0x49, 0x02, 0x49, 0xf0, 0x00, 0xd6, 0x09,
+ 0x04, 0xe2, 0x00, 0x06, 0x04, 0x5b, 0x07, 0x00, 0xc0, 0x82, 0x13, 0x53,
+ 0xc0, 0xa0, 0x01, 0x6c, 0xc1, 0xa0, 0xfc, 0x06, 0x02, 0x46, 0x00, 0x0f,
+ 0x02, 0x86, 0x00, 0x01, 0x12, 0x3d, 0x88, 0x06, 0x06, 0xf2, 0x16, 0x12,
+ 0x02, 0x01, 0xfc, 0x0e, 0x88, 0x31, 0x06, 0xf4, 0x16, 0x0d, 0x88, 0x31,
+ 0x06, 0xf6, 0x16, 0x0a, 0x88, 0x31, 0x06, 0xf8, 0x16, 0x07, 0x02, 0x86,
+ 0x00, 0x02, 0x16, 0x2c, 0x88, 0x20, 0x07, 0x0a, 0x06, 0xfa, 0x13, 0x28,
+ 0xc1, 0x20, 0x09, 0x6a, 0x01, 0x44, 0x08, 0x00, 0x13, 0x06, 0x02, 0x86,
+ 0x00, 0x02, 0x16, 0x20, 0x01, 0x44, 0x00, 0x80, 0x16, 0x1d, 0x07, 0x00,
+ 0x23, 0xe0, 0xe0, 0x14, 0x16, 0x19, 0x02, 0x82, 0x00, 0x43, 0x13, 0x16,
+ 0x02, 0x00, 0xfc, 0x02, 0xc0, 0x40, 0x01, 0xb0, 0x00, 0x20, 0x01, 0x60,
+ 0x09, 0x6a, 0x00, 0x01, 0x16, 0x07, 0xa0, 0x60, 0x09, 0x2c, 0xcc, 0x60,
+ 0x05, 0xee, 0xc4, 0x50, 0xc4, 0x20, 0x09, 0x2c, 0x07, 0x80, 0x07, 0x36,
+ 0x07, 0x81, 0x00, 0x40, 0x2c, 0x40, 0x04, 0xc0, 0x07, 0x84, 0x06, 0xf2,
+ 0xc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x0a, 0x13, 0x18, 0x04, 0x05, 0x41, 0x48, 0x03,
+ 0x06, 0xfe, 0x10, 0x06, 0x02, 0x83, 0x00, 0x02, 0x16, 0x01, 0x09, 0x13,
+ 0xe8, 0x03, 0x06, 0xfe, 0x40, 0xc8, 0x40, 0xc1, 0x13, 0x05, 0x07, 0x88,
+ 0x07, 0x36, 0x07, 0x89, 0x40, 0x00, 0x2c, 0x48, 0x04, 0x5b, 0x04, 0xc9,
+ 0xc1, 0x24, 0xeb, 0x24, 0xc1, 0x84, 0x71, 0x86, 0x02, 0x26, 0xeb, 0xd6,
+ 0x06, 0xc4, 0x71, 0x04, 0x02, 0x24, 0xeb, 0x4c, 0xd2, 0x14, 0x09, 0xc8,
+ 0xa2, 0x08, 0x03, 0xb0, 0xd8, 0x34, 0x06, 0x5f, 0x02, 0x47, 0x00, 0x0f,
+ 0xa1, 0xc7, 0xc2, 0x28, 0xeb, 0x12, 0x04, 0x58, 0xcd, 0x76, 0x06, 0x47,
+ 0x16, 0xfd, 0x10, 0x32, 0xc2, 0x36, 0x10, 0x26, 0x09, 0x17, 0xa1, 0x47,
+ 0x10, 0x2d, 0x09, 0x17, 0x61, 0x47, 0x10, 0x2a, 0x43, 0xa0, 0xe0, 0x16,
+ 0x04, 0x5b, 0x43, 0xa0, 0xe0, 0x16, 0xc2, 0x49, 0x16, 0x03, 0xc2, 0x44,
+ 0xc8, 0x06, 0x09, 0x22, 0xc1, 0x27, 0xec, 0xe6, 0xc1, 0x84, 0x71, 0x86,
+ 0x02, 0x26, 0xed, 0x1c, 0x06, 0xc4, 0x71, 0x04, 0x02, 0x24, 0xed, 0x02,
+ 0x10, 0xd3, 0xc1, 0x09, 0xc1, 0xa0, 0x09, 0x22, 0x04, 0xc9, 0x10, 0x10,
+ 0xc2, 0x36, 0xd5, 0x78, 0x41, 0x60, 0xe0, 0x22, 0x05, 0xc5, 0x10, 0x0a,
+ 0xcd, 0x78, 0x06, 0x47, 0x15, 0xfd, 0x10, 0x06, 0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0x16, 0xfa,
+ 0x06, 0xa0, 0xe1, 0x2e, 0xc0, 0x82, 0x13, 0x02, 0x02, 0x4f, 0xff, 0x80,
+ 0x04, 0xc4, 0xd1, 0x0f, 0x06, 0xc4, 0x04, 0x60, 0xdb, 0x88, 0x06, 0xa0,
+ 0xe5, 0x50, 0x02, 0x08, 0x80, 0x36, 0x07, 0xa0, 0x06, 0xd6, 0xe5, 0x3e,
+ 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x10, 0x06, 0xa0, 0xe5, 0x50, 0xd1, 0x20,
+ 0x06, 0xce, 0x13, 0xe6, 0x78, 0x20, 0xe0, 0x12, 0x06, 0xce, 0x10, 0xe2,
+ 0xc1, 0x20, 0x04, 0x16, 0x0a, 0x14, 0x06, 0xc4, 0x91, 0x0a, 0x16, 0x01,
+ 0x04, 0x5b, 0x04, 0x60, 0xdb, 0xc0, 0x04, 0xca, 0x04, 0xcd, 0x04, 0xce,
+ 0x04, 0xcf, 0x04, 0xe0, 0x06, 0xa8, 0x04, 0xe0, 0x06, 0xba, 0x07, 0x84,
+ 0x01, 0xa0, 0x07, 0x85, 0x00, 0x10, 0x04, 0xf4, 0x06, 0x45, 0x15, 0xfd,
+ 0x07, 0x84, 0x06, 0xd8, 0x07, 0x85, 0x07, 0x34, 0x61, 0x44, 0x04, 0xf4,
+ 0x06, 0x45, 0x15, 0xfd, 0x07, 0x84, 0x00, 0xc8, 0xc8, 0x04, 0x07, 0x00,
+ 0x07, 0x84, 0x7f, 0xff, 0xc8, 0x04, 0x06, 0xf0, 0x07, 0x84, 0x00, 0x06,
+ 0xc8, 0x04, 0x06, 0xee, 0x03, 0xb0, 0xd8, 0x20, 0xe0, 0x10, 0x06, 0x65,
+ 0x04, 0x60, 0xdb, 0xc0, 0xf8, 0x20, 0xed, 0x71, 0x01, 0x82, 0xc8, 0x20,
+ 0xe0, 0x10, 0x06, 0xc6, 0xc8, 0x20, 0xe0, 0x20, 0x06, 0xc8, 0x2e, 0xe0,
+ 0x00, 0x00, 0x06, 0xa0, 0xe1, 0x2e, 0xc8, 0x20, 0x09, 0x6c, 0x01, 0xa0,
+ 0xc8, 0x20, 0x09, 0x6e, 0x01, 0xa2, 0xc8, 0x20, 0x09, 0x70, 0x01, 0xa4,
+ 0xc8, 0x20, 0x09, 0x6e, 0x01, 0xb0, 0xc8, 0x20, 0x09, 0x70, 0x01, 0xb2,
+ 0xc8, 0x20, 0x09, 0x70, 0x06, 0xcc, 0xf8, 0x20, 0xed, 0x70, 0x01, 0x80,
+ 0x06, 0xa0, 0xe1, 0x18, 0x48, 0x20, 0xe0, 0x04, 0x01, 0x80, 0x04, 0xe0,
+ 0x01, 0x9e, 0x02, 0x08, 0x80, 0x12, 0x06, 0xa0, 0xe0, 0x22, 0x07, 0x84,
+ 0x00, 0x0a, 0x07, 0x85, 0x03, 0xf4, 0x88, 0x20, 0x06, 0xc6, 0xe0, 0x20,
+ 0x1b, 0x04, 0x07, 0x84, 0x00, 0x1c, 0x07, 0x85, 0x03, 0xf8, 0x06, 0xa0,
+ 0xe3, 0xce, 0x07, 0x85, 0xe6, 0x42, 0xc8, 0x05, 0x03, 0xf8, 0x23, 0xa0,
+ 0xe0, 0x0c, 0x13, 0x23, 0xe3, 0xa0, 0xe0, 0x0c, 0x2e, 0xa0, 0x03, 0xf4,
+ 0x10, 0x1e, 0x03, 0xb0, 0x98, 0x20, 0xe0, 0x10, 0x06, 0x65, 0x16, 0x19,
+ 0x02, 0x44, 0x5e, 0x00, 0x16, 0x04, 0x06, 0x20, 0x06, 0xc6, 0x16, 0xd7,
+ 0x10, 0x08, 0x03, 0xb0, 0x98, 0x20, 0xe0, 0x10, 0x06, 0x65, 0x16, 0x0d,
+ 0x06, 0x20, 0x06, 0xc8, 0x16, 0xc4, 0x01, 0x0e, 0x00, 0x03, 0x13, 0x03,
+ 0x07, 0x83, 0x82, 0x00, 0x10, 0x02, 0x07, 0x83, 0x00, 0x01, 0x04, 0x60,
+ 0xdb, 0xb8, 0x04, 0x60, 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2, 0x06, 0x20, 0x06, 0xca, 0x13, 0x03,
+ 0x05, 0xa0, 0x06, 0xcc, 0x10, 0xe6, 0x03, 0xb0, 0xd8, 0x20, 0xe0, 0x0c,
+ 0x06, 0x65, 0x04, 0x60, 0xdb, 0xc0, 0x06, 0x20, 0x06, 0xc8, 0x16, 0xe3,
+ 0x88, 0x20, 0x09, 0x70, 0x06, 0xcc, 0x16, 0x03, 0x07, 0x83, 0x00, 0x08,
+ 0x10, 0x02, 0x07, 0x83, 0x00, 0x0c, 0x04, 0x60, 0xdb, 0xb8, 0x04, 0x60,
+ 0xdb, 0xc0, 0x23, 0xa0, 0xe0, 0x08, 0x13, 0x03, 0x23, 0x60, 0xe0, 0x12,
+ 0x16, 0x06, 0x03, 0xb0, 0xd8, 0x20, 0xe3, 0xa9, 0x06, 0x65, 0x04, 0x60,
+ 0xdb, 0xc0, 0x02, 0x08, 0x80, 0x00, 0x06, 0xa0, 0xe0, 0x22, 0x04, 0x60,
+ 0xdb, 0x9e, 0x02, 0x08, 0x80, 0x00, 0x06, 0xa0, 0xe0, 0x22, 0xc8, 0x20,
+ 0xe0, 0x1e, 0x06, 0xc6, 0xc8, 0x20, 0xe0, 0x1e, 0x06, 0xc8, 0xe3, 0x60,
+ 0xe0, 0x10, 0x04, 0x60, 0xdb, 0xc0, 0x23, 0xe0, 0xe0, 0x14, 0x13, 0x19,
+ 0xc1, 0x44, 0x02, 0x44, 0x1e, 0x00, 0x16, 0xf5, 0x25, 0x60, 0xe4, 0x68,
+ 0x16, 0x06, 0x06, 0x20, 0x06, 0xc8, 0x16, 0xef, 0x04, 0xc2, 0x04, 0x60,
+ 0xec, 0x20, 0x02, 0x08, 0x80, 0x1e, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x07,
+ 0x06, 0x20, 0x06, 0xc6, 0x16, 0xe4, 0x07, 0x83, 0x00, 0x09, 0x06, 0xa0,
+ 0xdb, 0xb8, 0x04, 0x60, 0xdb, 0x9e, 0x04, 0xce, 0x04,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x14, 0x13, 0x04, 0x02, 0x08,
+ 0x80, 0x06, 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x08, 0x00, 0x1e, 0x06, 0xa0,
+ 0xe0, 0x22, 0x23, 0xa0, 0xe0, 0x08, 0x13, 0x02, 0x06, 0xa0, 0xe2, 0x54,
+ 0xc0, 0x82, 0x16, 0x02, 0x04, 0x60, 0xdb, 0xc0, 0xe8, 0x20, 0xed, 0x74,
+ 0x06, 0xf0, 0x99, 0x20, 0xe0, 0x0e, 0x00, 0x16, 0x16, 0x05, 0x04, 0xe0,
+ 0x06, 0xec, 0x48, 0x20, 0xe0, 0x14, 0x06, 0xf0, 0x07, 0x83, 0x00, 0x01,
+ 0x04, 0x60, 0xdb, 0xa2, 0xc2, 0x64, 0x00, 0x14, 0x02, 0x24, 0x00, 0x18,
+ 0xc1, 0xc4, 0x61, 0xc2, 0x02, 0x27, 0xff, 0xfc, 0xc1, 0x74, 0xc1, 0x85,
+ 0x71, 0x45, 0x02, 0x85, 0x00, 0x27, 0x16, 0x46, 0xc1, 0x54, 0x02, 0x45,
+ 0xff, 0xcf, 0x16, 0x42, 0x04, 0xc8, 0xc1, 0x64, 0x00, 0x08, 0x15, 0x06,
+ 0x13, 0x05, 0xc2, 0x24, 0x00, 0x0e, 0x02, 0x48, 0x1f, 0x00, 0x06, 0xc8,
+ 0x02, 0x28, 0x00, 0x11, 0xa2, 0x04, 0x98, 0x18, 0xed, 0x79, 0x16, 0x32,
+ 0xc1, 0x42, 0x02, 0x25, 0x00, 0x04, 0x65, 0x47, 0xc2, 0x35, 0xcd, 0x74,
+ 0x06, 0x48, 0x15, 0xfd, 0xc0, 0xa0, 0x01, 0x6c, 0xc1, 0x02, 0xc8, 0x04,
+ 0x01, 0x6c, 0xc1, 0xa0, 0xfc, 0x00, 0x13, 0x05, 0xc8, 0x20, 0xeb, 0x10,
+ 0xfc, 0x02, 0xc1, 0x06, 0x10, 0xf6, 0xc8, 0x02, 0x01, 0x6c, 0xc8, 0x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0x0b, 0x03, 0x00, 0x00, 0x02, 0x07, 0x82, 0x00, 0xc0, 0xc8, 0x20,
+ 0x00, 0x0c, 0x00, 0xc0, 0xc8, 0x20, 0x00, 0x0e, 0x00, 0xc2, 0xc8, 0x20,
+ 0x00, 0x10, 0x00, 0xc4, 0xc8, 0x20, 0x00, 0x12, 0x00, 0xc6, 0xc8, 0x20,
+ 0x00, 0x14, 0x00, 0xc8, 0xc8, 0x20, 0x00, 0x16, 0x00, 0xca, 0xc8, 0x20,
+ 0x00, 0x04, 0x00, 0xcc, 0xc8, 0x20, 0x00, 0x06, 0x00, 0xce, 0xc8, 0x02,
+ 0x00, 0x0c, 0x07, 0xa0, 0x00, 0x0e, 0xee, 0x3c, 0xc8, 0x02, 0x00, 0x10,
+ 0x07, 0xa0, 0x00, 0x12, 0xee, 0x46, 0xc8, 0x02, 0x00, 0x14, 0x07, 0xa0,
+ 0x00, 0x16, 0xee, 0x76, 0xc8, 0x02, 0x00, 0x04, 0x07, 0xa0, 0x00, 0x06,
+ 0xee, 0x8c, 0x01, 0x60, 0x01, 0x1c, 0x00, 0x04, 0x16, 0x09, 0x01, 0xe0,
+ 0x01, 0x40, 0x08, 0x00, 0x01, 0xa0, 0x01, 0x40, 0x40, 0x00, 0x01, 0xe0,
+ 0x01, 0x40, 0x04, 0x00, 0x06, 0xa0, 0xf1, 0x4c, 0x02, 0x05, 0x80, 0x00,
+ 0xd8, 0x05, 0x04, 0x80, 0x04, 0xc7, 0x03, 0x00, 0x00, 0x0f, 0x07, 0x88,
+ 0x10, 0x00, 0x02, 0x09, 0x20, 0x00, 0x07, 0x8a, 0xee, 0xa4, 0x02, 0x03,
+ 0xe5, 0xfe, 0x04, 0x5a, 0x03, 0x00, 0x00, 0x00, 0xd2, 0x20, 0x01, 0x87,
+ 0x10, 0x06, 0x03, 0x00, 0x00, 0x00, 0xc2, 0x20, 0x01, 0x8a, 0x02, 0x08,
+ 0x1a, 0x00, 0xc2, 0x60, 0x00, 0xae, 0xda, 0x48, 0x04, 0x80, 0x05, 0x89,
+ 0x02, 0x89, 0x00, 0x06, 0x15, 0x07, 0x07, 0x88, 0x80, 0x00, 0xda, 0x48,
+ 0x04, 0x80, 0xc8, 0x09, 0x00, 0xae, 0x03, 0x80, 0x02, 0xe0, 0x00, 0xa0,
+ 0x04, 0x5c, 0x03, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x9c, 0x00, 0x20,
+ 0x13, 0xe2, 0xc2, 0x20, 0x01, 0x8c, 0x02, 0x08, 0x1c, 0x00, 0x10, 0xe3,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x40, 0x40, 0x00, 0x16, 0xec,
+ 0x01, 0xa0, 0x01, 0x40, 0x40, 0x00, 0x02, 0x08, 0x02, 0x00, 0x10, 0xd7,
+ 0xc0, 0xb3, 0x06, 0x92, 0x10, 0xfd, 0xc0, 0xb3, 0xc0, 0x48, 0xcc, 0x72,
+ 0xcc, 0x72, 0xc1, 0x32, 0xcc, 0x44, 0xdc, 0x72, 0x06, 0x04, 0x16, 0xfd,
+ 0x04, 0x5b, 0xc0, 0x48, 0x02, 0x02, 0xe9, 0x90, 0x07, 0x84, 0x00, 0x06,
+ 0x10, 0xf6, 0x02, 0x02, 0xe5, 0xde, 0xc0, 0x49, 0x07, 0x84, 0x00, 0x06,
+ 0x10, 0xf0, 0xc0, 0xb3, 0xc1, 0x32, 0x02, 0x01, 0x00, 0x01, 0xd0, 0x44,
+ 0x06, 0xc1, 0x02, 0x44, 0x00, 0xff, 0x10, 0xe7, 0xc1, 0x33, 0xc0, 0x73,
+ 0xd1, 0x44, 0x02, 0x44, 0x00, 0xff, 0xdc, 0x45, 0x06, 0x04, 0x16, 0xfd,
+ 0x04, 0x5a, 0x06, 0xa0, 0xf0, 0xcc, 0xc8, 0x33, 0x01, 0x9e, 0x04, 0x5a,
+ 0x06, 0xa0, 0xee, 0xca, 0xc1, 0x89, 0x09, 0xa6, 0x02, 0x66, 0x00, 0x40,
+ 0xc8, 0x06, 0x01, 0x8a, 0xc1, 0x88, 0x09, 0xa6, 0x02, 0x66, 0x00, 0x40,
+ 0xc8, 0x06, 0x01, 0x8c, 0x04, 0xc2, 0xc1, 0xc7, 0x16, 0x03, 0x06, 0x02,
+ 0x16, 0xfc, 0x10, 0x4d, 0x04, 0x5a, 0x06, 0xa0, 0xf0, 0x16, 0xc1, 0x89,
+ 0x09, 0xa6, 0x02, 0x66, 0x00, 0x40, 0xc8, 0x06, 0x01, 0x8a, 0xc1, 0x88,
+ 0x09, 0xa6, 0x02, 0x66, 0x00, 0x40, 0xc8, 0x06, 0x01, 0x8c, 0xc8, 0x33,
+ 0x01, 0x9e, 0x10, 0xe8, 0x8a, 0x33, 0x00, 0x02, 0x16, 0x38, 0x8a, 0x73,
+ 0x00, 0x02, 0x16, 0x35, 0x04, 0x5a, 0x8a, 0x20, 0xe9, 0x8a, 0x00, 0x02,
+ 0x16, 0x30, 0x8a, 0x60, 0xe9, 0x8e, 0x00, 0x02, 0x16, 0x2c, 0x07, 0x82,
+ 0xea, 0x34, 0x10, 0x01, 0xc0, 0xb3, 0x02, 0x04, 0x04, 0x80, 0xd1, 0x52,
+ 0x13, 0x03, 0x9d, 0x32, 0x16, 0x22, 0x10, 0xfb, 0x07, 0x85, 0x80, 0x00,
+ 0xd8, 0x05, 0x04, 0x80, 0x04, 0xc7, 0x04, 0x5a, 0xc8, 0x20, 0x00, 0xc0,
+ 0x00, 0x0c, 0xc8, 0x20, 0x00, 0xc2, 0x00, 0x0e, 0xc8, 0x20, 0x00, 0xc4,
+ 0x00, 0x10, 0xc8, 0x20, 0x00, 0xc6, 0x00, 0x12, 0xc8, 0x20, 0x00, 0xc8,
+ 0x00, 0x14, 0xc8, 0x20, 0x00, 0xca, 0x00, 0x16, 0xc8, 0x20, 0x00, 0xcc,
+ 0x00, 0x04, 0xc8, 0x20, 0x00, 0xce, 0x00, 0x06, 0x03, 0x00, 0x00, 0x0f,
+ 0x05, 0xcc, 0x04, 0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4d, 0xc0, 0xb3, 0xc1, 0x32,
+ 0x04, 0x60, 0xee, 0xb6, 0xc1, 0x33, 0x01, 0x60, 0x01, 0x1c, 0x00, 0x04,
+ 0x16, 0x01, 0x04, 0x5b, 0xc0, 0xc4, 0x04, 0x5b, 0x07, 0x89, 0xe5, 0x26,
+ 0xc2, 0x39, 0x13, 0x07, 0xc6, 0x39, 0x86, 0x39, 0x16, 0x25, 0xc6, 0x39,
+ 0x86, 0x39, 0x16, 0x22, 0x10, 0xf7, 0x02, 0x02, 0xf1, 0x6a, 0x04, 0xc4,
+ 0x04, 0xc5, 0xc2, 0x39, 0x13, 0x02, 0x04, 0x60, 0xf1, 0xa6, 0x02, 0x02,
+ 0xf1, 0x78, 0x04, 0xc4, 0xc2, 0x39, 0x13, 0x03, 0xc1, 0x79, 0x04, 0x60,
+ 0xf1, 0xa6, 0x02, 0x02, 0xf1, 0x88, 0x04, 0xc5, 0xc2, 0x39, 0x13, 0x03,
+ 0xc1, 0x39, 0x04, 0x60, 0xf1, 0xa6, 0xc0, 0x79, 0xc0, 0xb9, 0x60, 0x81,
+ 0x05, 0xc2, 0x09, 0x12, 0x04, 0xf1, 0x06, 0x02, 0x16, 0xfd, 0x04, 0x5b,
+ 0x04, 0x5c, 0x02, 0x01, 0xaa, 0xaa, 0xc6, 0x01, 0xe0, 0x44, 0x40, 0x45,
+ 0x80, 0x58, 0x16, 0xf8, 0x02, 0x01, 0x00, 0x14, 0x06, 0x01, 0x16, 0xfe,
+ 0x02, 0x01, 0x55, 0x55, 0xc6, 0x01, 0xe0, 0x44, 0x40, 0x45, 0x80, 0x58,
+ 0x16, 0xed, 0x04, 0x52, 0x02, 0xe0, 0x00, 0xa0, 0x07, 0x88, 0x00, 0xc0,
+ 0x02, 0x09, 0xf2, 0x20, 0x07, 0x84, 0xe5, 0xea, 0x02, 0x05, 0x00, 0x01,
+ 0xc2, 0x8b, 0x04, 0xcc, 0x06, 0xa0, 0xf2, 0x2a, 0x2c, 0x60, 0x00, 0x01,
+ 0x06, 0x99, 0x2c, 0xa0, 0x00, 0x02, 0x06, 0x99, 0x2d, 0x20, 0x00, 0x04,
+ 0x06, 0x99, 0x2e, 0x20, 0x00, 0x08, 0x06, 0x99, 0x2f, 0xa0, 0x00, 0x10,
+ 0x05, 0x8c, 0x16, 0x09, 0xcc, 0x80, 0xc4, 0x81, 0x07, 0x83, 0xf2, 0x6e,
+ 0xc0, 0x88, 0x04, 0x02, 0x05, 0x8c, 0x16, 0x01, 0x10, 0x33, 0x02, 0xe0,
+ 0x00, 0xa0, 0x04, 0x5a, 0x05, 0x8c, 0x16, 0xfb, 0xcc, 0x80, 0xc4, 0x81,
+ 0x0a, 0x15, 0xc0, 0xb4, 0xc0, 0x12, 0xcc, 0x88, 0xc0, 0x52, 0xc4, 0xb4,
+ 0x06, 0x42, 0x04, 0x5b, 0x07, 0x2d, 0x00, 0x18, 0x8b, 0x41, 0x00, 0x0a,
+ 0x16, 0xec, 0x82, 0xc1, 0x16, 0xea, 0x02, 0xc2, 0x02, 0x42, 0x02, 0x00,
+ 0x16, 0xe6, 0x03, 0x80, 0x07, 0x81, 0x00, 0x01, 0x10, 0xf1, 0x02, 0x01,
+ 0x00, 0x02, 0x10, 0xee, 0x02, 0x01, 0x00, 0x04, 0x10, 0xeb, 0x02, 0x01,
+ 0x00, 0x08, 0x10, 0xe8, 0x02, 0x01, 0x00, 0x10, 0x10, 0xe5, 0x02, 0xa1,
+ 0x8b, 0x41, 0x00, 0x10, 0x13, 0x02, 0x04, 0x60, 0xf2, 0x1a, 0x07, 0x2d,
+ 0x00, 0x18, 0x03, 0x80, 0x02, 0x09, 0x08, 0x00, 0x02, 0x03, 0x00, 0x04,
+ 0x04, 0xc7, 0x06, 0xa0, 0xf3, 0x9a, 0x01, 0x60, 0x01, 0x1c, 0x00, 0x04,
+ 0x16, 0x1c, 0x01, 0xa0, 0x01, 0x40, 0x08, 0x00, 0x01, 0xe0, 0x01, 0x40,
+ 0x10, 0x00, 0x02, 0x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 0x44, 0x02, 0x85, 0xff, 0x00, 0x16, 0x17,
+ 0x01, 0xe0, 0x01, 0x40, 0x22, 0x00, 0x02, 0x05, 0x00, 0xc0, 0x06, 0x05,
+ 0x03, 0xd0, 0x16, 0xfd, 0xc1, 0x60, 0x01, 0x46, 0x02, 0x85, 0xff, 0x00,
+ 0x13, 0x0a, 0x02, 0x05, 0x33, 0x93, 0x06, 0x05, 0x00, 0x00, 0xf3, 0x80,
+ 0x00, 0x0b, 0x10, 0x00, 0x00, 0x00, 0xf3, 0x8a, 0x04, 0x9c, 0x03, 0xd0,
+ 0x16, 0xf8, 0x10, 0x51, 0xc8, 0x06, 0x01, 0x4a, 0xcc, 0xc0, 0xc4, 0xc1,
+ 0x10, 0x4b, 0xc0, 0x13, 0xcc, 0xc8, 0xc0, 0x53, 0x02, 0x02, 0xf3, 0xaa,
+ 0xc4, 0xc2, 0x06, 0x43, 0x04, 0x5b, 0xc0, 0x60, 0x00, 0xae, 0x02, 0xc4,
+ 0x02, 0x44, 0x00, 0x0f, 0x88, 0x44, 0xe4, 0x8a, 0x16, 0x3c, 0x02, 0x81,
+ 0x00, 0x08, 0x13, 0x27, 0xc1, 0x21, 0xe4, 0x9c, 0xc1, 0x14, 0x21, 0x21,
+ 0xe4, 0x7a, 0x16, 0x33, 0xc1, 0x21, 0xe4, 0x82, 0x02, 0x81, 0x00, 0x00,
+ 0x13, 0x0b, 0x02, 0x0d, 0x00, 0xa0, 0x83, 0x84, 0x13, 0x09, 0x05, 0xc4,
+ 0x83, 0x84, 0x13, 0x06, 0x05, 0xc4, 0x83, 0x84, 0x13, 0x03, 0x10, 0x23,
+ 0x81, 0x0e, 0x16, 0x21, 0xc1, 0x21, 0xe4, 0x9c, 0x45, 0x21, 0xe4, 0x7a,
+ 0x01, 0xe0, 0x01, 0x42, 0x10, 0x00, 0x01, 0xa0, 0x01, 0x42, 0x10, 0x00,
+ 0xc3, 0xa1, 0xe4, 0x94, 0x02, 0x0f, 0x00, 0x2f, 0x03, 0x80, 0x01, 0xa0,
+ 0x01, 0x40, 0x02, 0x00, 0x01, 0xa0, 0x01, 0x40, 0x80, 0x00, 0xc0, 0x6d,
+ 0x00, 0x0a, 0x13, 0x09, 0x02, 0x81, 0x12, 0x5c, 0x1b, 0x06, 0x02, 0x0e,
+ 0xf3, 0x90, 0x02, 0x0f, 0x00, 0x0f, 0x03, 0x80, 0x05, 0xca, 0x02, 0xe0,
+ 0x00, 0xa0, 0x04, 0x5a, 0xce, 0x59, 0x88, 0x20, 0xe4, 0xa4, 0xe4, 0xa4,
+ 0x10, 0xf8, 0x04, 0xc1, 0x62, 0x48, 0x05, 0x89, 0xc0, 0xa0, 0x01, 0x6c,
+ 0xc8, 0x08, 0x01, 0x6c, 0x02, 0x03, 0xfc, 0x00, 0x02, 0x04, 0x02, 0x00,
+ 0xa0, 0x73, 0x06, 0x04, 0x16, 0xfd, 0x05, 0x88, 0x06, 0x09, 0x16, 0xf4,
+ 0xc8, 0x02, 0x01, 0x6c, 0x86, 0x81, 0x16, 0x02, 0x03, 0xd0, 0x05, 0xcb,
+ 0x04, 0x5b, 0xc0, 0x48, 0xc0, 0x89, 0x60, 0x81, 0x05, 0xc2, 0x04, 0x5b,
+ 0xc3, 0x0b, 0x06, 0xa0, 0xf4, 0x72, 0xcc, 0x41, 0x06, 0x42, 0x16, 0xfd,
+ 0x06, 0xa0, 0xf4, 0x72, 0xc1, 0x01, 0x8c, 0x44, 0x16, 0x12, 0x05, 0xc4,
+ 0x06, 0x42, 0x16, 0xfb, 0x02, 0x04, 0xf4, 0xb8, 0x02, 0x03, 0x01, 0x01,
+ 0x06, 0x94, 0x02, 0x03, 0x5a, 0x5a, 0x06, 0x94, 0x05, 0x43, 0x06, 0x94,
+ 0x07, 0x03, 0x06, 0x94, 0x04, 0xc3, 0x06, 0x94, 0x05, 0xcc, 0x04, 0x5c,
+ 0xc1, 0xcb, 0x06, 0xa0, 0xf4, 0x72, 0xcc, 0x43, 0x06, 0x42, 0x16, 0xfd,
+ 0x06, 0xa0, 0xf4, 0x72, 0x8c, 0x43, 0x16, 0xf5, 0x06, 0x42, 0x16, 0xfc,
+ 0x04, 0x57, 0xc2, 0x8b, 0xc0, 0x08, 0xc1, 0x49, 0x05, 0x85, 0x02, 0x80,
+ 0x00, 0x40, 0x11, 0x03, 0x02, 0x80, 0x00, 0x4f, 0x12, 0x45, 0x02, 0x01,
+ 0xf4, 0x72, 0x09, 0xa1, 0x80, 0x01, 0x13, 0x40, 0x02, 0x01, 0xf5, 0xa2,
+ 0x09, 0xa1, 0x80, 0x01, 0x13, 0x3b, 0xc0, 0x60, 0x00, 0x06, 0x09, 0xa1,
+ 0x80, 0x01, 0x13, 0x36, 0x05, 0x81, 0x80, 0x01, 0x13, 0x33, 0xc0, 0x4a,
+ 0x09, 0xa1, 0x80, 0x01, 0x13, 0x2f, 0xc8, 0x00, 0x01, 0x6a, 0x02, 0x80,
+ 0x00, 0x80, 0x14, 0x17, 0x02, 0x01, 0xf8, 0x00, 0xc1, 0xa0, 0x01, 0x40,
+ 0x01, 0xa0, 0x01, 0x40, 0x04, 0x00, 0x02, 0x02, 0x10, 0x00, 0x02, 0x03,
+ 0x04, 0x00, 0xcc, 0xb1, 0x06, 0x43, 0x16, 0xfd, 0x01, 0xa0, 0x01, 0x40,
+ 0x40, 0x00, 0x02, 0x08, 0xf8, 0x10, 0xc8, 0x06, 0x01, 0x40, 0xc0, 0x00,
+ 0x13, 0x02, 0x02, 0x08, 0xf8, 0x00, 0x02, 0x09, 0xfb, 0xfe, 0x06, 0xa0,
+ 0xf4, 0x7c, 0x10, 0x25, 0x02, 0x80, 0x00, 0x80, 0x14, 0x09, 0x02, 0x01,
+ 0xf8, 0x00, 0x02, 0x02, 0x10, 0x00, 0x02, 0x03, 0x04, 0x00, 0xcc, 0x72,
+ 0x06, 0x43, 0x16, 0xfd, 0x05, 0x80, 0x02, 0x80, 0x00, 0x80, 0x12, 0x04,
+ 0x01, 0x60, 0x01, 0x04, 0x00, 0x20, 0x13, 0x05, 0x81, 0x40, 0x16, 0xab,
+ 0x02, 0x80, 0x00, 0x80, 0x14, 0x0b, 0x07, 0xa0, 0x01, 0x6a, 0x00, 0x7e,
+ 0x02, 0x02, 0x10, 0x00, 0x02, 0x03, 0x04, 0x00, 0x04, 0xc1, 0xcc, 0x81,
+ 0x06, 0x43, 0x16, 0xfd, 0x05, 0xca, 0x04, 0x5a, 0x02, 0x00, 0xf5, 0x94,
+ 0x02, 0x01, 0xf6, 0xc4, 0x02, 0x40, 0xfc, 0x00, 0x02, 0x41, 0xfc, 0x00,
+ 0x80, 0x40, 0x13, 0x04, 0x07, 0xa0, 0x01, 0x04, 0x00, 0x3c, 0x04, 0x5b,
+ 0x04, 0xc0, 0x02, 0x01, 0x00, 0x08, 0x02, 0x02, 0x12, 0x00, 0xc1, 0xe0,
+ 0x01, 0x40, 0x01, 0xa0, 0x01, 0x40, 0x04, 0x00, 0x02, 0x03, 0x01, 0x00,
+ 0xc8, 0x00, 0x01, 0x6a, 0xcc, 0xa0, 0xf8, 0x10, 0x05, 0x80, 0x06, 0x03,
+ 0x16, 0xf9, 0x02, 0x22, 0x02, 0x00, 0x06, 0x01, 0x16, 0xf3, 0x01, 0xa0,
+ 0x01, 0x40, 0x40, 0x00, 0xc8, 0x07, 0x01, 0x40, 0x02, 0x00, 0x08, 0x00,
+ 0xc0, 0x40, 0x06, 0x01, 0xc8, 0x01, 0x01, 0x6a, 0x02, 0x61, 0x80, 0x00,
+ 0xc8, 0x01, 0xf8, 0x10, 0x06, 0x00, 0x16, 0xf6, 0x04, 0xc0, 0x04, 0xc8,
+ 0x04, 0xc9, 0x02, 0x03, 0x08, 0x00, 0xc8, 0x00, 0x01, 0x6a, 0xc1, 0x80,
+ 0x02, 0x66, 0x80, 0x00, 0xc1, 0x20, 0xf8, 0x10, 0x81, 0x06, 0x16, 0x15,
+ 0xc2, 0x08, 0x13, 0x06, 0x05, 0x80, 0x06, 0x03, 0x16, 0xf2, 0xc2, 0x08,
+ 0x13, 0x0d, 0x10, 0x19, 0x07, 0xa0, 0xf8, 0x10, 0x55, 0x55, 0xc1, 0x20,
+ 0xf8, 0x10, 0x02, 0x84, 0x55, 0x55, 0x16, 0x02, 0xc2, 0x06, 0x10, 0xf0,
+ 0x81, 0x06, 0x13, 0xee, 0x04, 0x5b, 0x07, 0xa0, 0xf8, 0x10, 0x55, 0x55,
+ 0xc1, 0x60, 0xf8, 0x10, 0x81, 0x05, 0x13, 0x03, 0x02, 0x85, 0x55, 0x55,
+ 0x16, 0xf5, 0xc2, 0x08, 0x13, 0xe1, 0xc2, 0x40, 0x06, 0x09, 0x02, 0x48,
+ 0x07, 0xff, 0x04, 0xc0, 0x02, 0x01, 0x00, 0x08, 0x02, 0x02, 0x12, 0x00,
+ 0x02, 0x03, 0x01, 0x00, 0xc8, 0x00, 0x01, 0x6a, 0xc8, 0x32, 0xf8, 0x10,
+ 0x05, 0x80, 0x06, 0x03, 0x16, 0xf9, 0x02, 0x22, 0x02, 0x00, 0x06, 0x01,
+ 0x16, 0xf3, 0x02, 0x88, 0x00, 0x40, 0x15, 0x13, 0x02, 0x89, 0x00, 0x4f,
+ 0x11, 0x10, 0x04, 0xc0, 0x02, 0x02, 0x12, 0x00, 0x02, 0x01, 0x00, 0x08,
+ 0x02, 0x03, 0x01, 0x00, 0xcc, 0x80, 0x06, 0x03, 0x16, 0xfd, 0x02, 0x22,
+ 0x02, 0x00, 0x06, 0x01, 0x16, 0xf7, 0x05, 0xcb, 0x04, 0x5b, 0x07, 0xa0,
+ 0x01, 0x04, 0x00, 0x37, 0x04, 0x5b, 0x28, 0x43, 0x29, 0x31, 0x39, 0x38,
+ 0x33, 0x2d, 0x38, 0x38, 0x20, 0x42, 0x59, 0x20, 0x54, 0x49, 0xc2, 0x4b,
+ 0x02, 0xa8, 0x00, 0x98, 0x07, 0x83, 0x00, 0x02, 0x02, 0x28, 0x00, 0x08,
+ 0xc6, 0x23, 0xe4, 0xf6, 0x06, 0x48, 0xc0, 0xc4, 0x0a, 0x73, 0x17, 0x65,
+ 0x06, 0xa0, 0xf7, 0xc4, 0xc1, 0xc8, 0x05, 0xc7, 0x02, 0x03, 0x00, 0xa5,
+ 0x03, 0xb0, 0xcd, 0xf8, 0xcd, 0xf8, 0x02, 0xa6, 0x62, 0x06, 0x02, 0x88,
+ 0x00, 0x0a, 0x16, 0x57, 0x29, 0x03, 0x16, 0x55, 0x29, 0x05, 0x80, 0xc4,
+ 0x16, 0x52, 0x09, 0x15, 0x17, 0x50, 0x09, 0x15, 0x18, 0x4e, 0x02, 0x85,
+ 0x00, 0x29, 0x16, 0x4b, 0x05, 0xc6, 0x00, 0x96, 0x07, 0x03, 0x04, 0xc4,
+ 0x06, 0x45, 0x00, 0x95, 0x05, 0x44, 0x16, 0x43, 0x81, 0x44, 0x16, 0x41,
+ 0x03, 0x00, 0x00, 0x05, 0x02, 0xc4, 0x03, 0x00, 0x00, 0x0a, 0x02, 0x44,
+ 0x00, 0x0f, 0x02, 0x84, 0x00, 0x05, 0x16, 0x37, 0x02, 0xc4, 0x03, 0x00,
+ 0x00, 0x0f, 0x02, 0x44, 0x00, 0x0f, 0x02, 0x84, 0x00, 0x0a, 0x16, 0x2f,
+ 0x02, 0x04, 0xff, 0xfe, 0x13, 0x2c, 0x15, 0x2b, 0x1a, 0x2a, 0x05, 0x84,
+ 0x12, 0x28, 0x15, 0x27, 0x1a, 0x26, 0x18, 0x25, 0x05, 0x84, 0x16, 0x23,
+ 0x1b, 0x22, 0x17, 0x21, 0x05, 0x84, 0x13, 0x1f, 0x1a, 0x1e, 0x11, 0x1d,
+ 0x06, 0x04, 0x16, 0x1b, 0x02, 0xa5, 0xc1, 0xc5, 0x02, 0x25, 0x00, 0x06,
+ 0x02, 0x03, 0xa5, 0xa5, 0xc1, 0x83, 0x00, 0x95, 0x38, 0x03, 0x00, 0x94,
+ 0x02, 0x83, 0x6b, 0x2e, 0x16, 0x0e, 0x02, 0x84, 0x1c, 0x59, 0x16, 0x0b,
+ 0x02, 0x24, 0x00, 0x69, 0x00, 0x95, 0x3c, 0x03, 0x00, 0x94, 0x81, 0x83,
+ 0x16, 0x04, 0x02, 0x84, 0x00, 0x69, 0x16, 0x01, 0x05, 0xc9, 0x04, 0x59,
+ 0xd0, 0xc3, 0x13, 0xfd, 0x1c, 0x01, 0x10, 0xfb, 0x90, 0xe0, 0xe4, 0xfd,
+ 0x16, 0xf8, 0x06, 0xc3, 0xd0, 0xc3, 0x1c, 0xf5, 0x16, 0xf4, 0x90, 0xe0,
+ 0xe4, 0xfa, 0x16, 0xf1, 0x04, 0x5b, 0xc3, 0x0b, 0x02, 0x09, 0xe4, 0xfe,
+ 0x06, 0xa0, 0xf1, 0x50, 0x05, 0xcc, 0x04, 0x5c, 0x07, 0x88, 0xb0, 0x00,
+ 0x07, 0x89, 0xff, 0xfe, 0x09, 0xa8, 0x09, 0xa9, 0x07, 0x8a, 0xe0, 0x02,
+ 0x06, 0xa0, 0xf4, 0x42, 0x00, 0x00, 0x07, 0x88, 0xa0, 0x00, 0x07, 0x89,
+ 0xaf, 0xfe, 0x09, 0xa8, 0x09, 0xa9, 0x07, 0x8a, 0xe0, 0x78, 0x06, 0xa0,
+ 0xf4, 0x42, 0x00, 0x00, 0x06, 0xa0, 0xf6, 0xde, 0x00, 0x00, 0x10, 0xe6,
+ 0x10, 0xe5, 0x00, 0x00, 0xf8, 0x26, 0x07, 0x93, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xb8, 0x00, 0x48, 0x28, 0x43, 0x29, 0x31, 0x39, 0x38, 0x33, 0x2d,
+ 0x38, 0x39, 0x2c, 0x39, 0x30, 0x2d, 0x39, 0x34, 0x20, 0x54, 0x65, 0x78,
+ 0x61, 0x73, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x0a, 0x28, 0x43, 0x29, 0x31, 0x39, 0x38, 0x33, 0x2c, 0x34,
+ 0x2c, 0x35, 0x2c, 0x36, 0x20, 0x49, 0x42, 0x4d, 0x20, 0x43, 0x6f, 0x72,
+ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x34, 0xff, 0xb8,
+ 0x00, 0x80, 0xb0, 0x3e, 0x20, 0x00, 0x90, 0x00, 0x0d, 0xd2, 0x45, 0x4f,
+ 0x20, 0x56, 0x32, 0x32, 0x38, 0x2e, 0x31, 0x30, 0x2e, 0x31, 0x38, 0x20,
+ 0x20, 0x28, 0x43, 0x29, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67,
+ 0x68, 0x74, 0x20, 0x4f, 0x6c, 0x69, 0x63, 0x6f, 0x6d, 0x20, 0x31, 0x39,
+ 0x39, 0x38, 0x2e, 0x00, 0x03, 0x00, 0x00, 0x02, 0xc0, 0xa0, 0x01, 0x6a,
+ 0xc3, 0x0e, 0x09, 0xac, 0xc8, 0x0c, 0x01, 0x6a, 0xc3, 0x0e, 0x02, 0x4c,
+ 0x03, 0xff, 0xd8, 0xec, 0xf8, 0x00, 0x13, 0xc0, 0x05, 0x83, 0x02, 0x43,
+ 0x00, 0x3f, 0xd8, 0xec, 0xf8, 0x01, 0x13, 0xc0, 0xc8, 0x02, 0x01, 0x6a,
+ 0x05, 0xce, 0x03, 0x90, 0xef, 0xff, 0x03, 0x80, 0x11, 0x08, 0xc3, 0xbc,
+ 0xdf, 0xbc, 0x06, 0x0d, 0x16, 0xfd, 0x05, 0x8c, 0x01, 0x8c, 0x00, 0x01,
+ 0x10, 0x12, 0xc3, 0xbc, 0xc3, 0xfc, 0x01, 0x8d, 0x80, 0x00, 0x13, 0x0d,
+ 0x01, 0x0d, 0x40, 0x00, 0x16, 0x04, 0xdf, 0x8f, 0x06, 0x0d, 0x16, 0xfd,
+ 0x10, 0x06, 0x01, 0x8d, 0x40, 0x01, 0x13, 0x03, 0xcf, 0x8f, 0x06, 0x4d,
+ 0x16, 0xfd, 0xc3, 0x7c, 0x16, 0xe3, 0x04,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, 0xc2, 0x4f, 0x05, 0x87,
+ 0xf1, 0xce, 0xc3, 0x8e, 0x11, 0xda, 0x10, 0x06, 0xc2, 0x0d, 0xc2, 0x4f,
+ 0x07, 0x87, 0x00, 0x01, 0xd1, 0xce, 0x11, 0xd3, 0x05, 0xa0, 0x10, 0x84,
+ 0xc8, 0x06, 0x07, 0x92, 0x07, 0x81, 0x01, 0x0a, 0x01, 0x60, 0x13, 0x0c,
+ 0x10, 0x00, 0x16, 0x04, 0xc8, 0x05, 0x01, 0x6c, 0x07, 0x20, 0xfc, 0x06,
+ 0x03, 0x90, 0xa0, 0x07, 0x02, 0xe0, 0x07, 0x78, 0x06, 0x9b, 0x02, 0xe0,
+ 0x08, 0x5c, 0xcc, 0x66, 0x00, 0x04, 0xcc, 0x43, 0xcc, 0x76, 0xcc, 0x76,
+ 0xc8, 0x44, 0x00, 0x02, 0xc4, 0x45, 0x07, 0xa1, 0xff, 0xee, 0x60, 0x81,
+ 0xc3, 0x45, 0xc0, 0xb6, 0x80, 0xc2, 0x1b, 0x63, 0xc3, 0x96, 0x04, 0xf6,
+ 0x02, 0x46, 0xfe, 0xf8, 0x01, 0x4e, 0x40, 0x00, 0x16, 0x02, 0x04, 0x60,
+ 0x90, 0xaa, 0x07, 0x81, 0x01, 0x0a, 0xa1, 0x02, 0xc0, 0x83, 0x02, 0x22,
+ 0x00, 0x06, 0x60, 0x84, 0x15, 0x25, 0x07, 0x84, 0x00, 0x06, 0xc0, 0x83,
+ 0xc8, 0x05, 0x01, 0x6c, 0xc8, 0x02, 0xfc, 0x04, 0x07, 0xa0, 0xfc, 0x02,
+ 0x80, 0x00, 0x04, 0xe0, 0xff, 0xfe, 0xc1, 0x60, 0x01, 0x6c, 0xc8, 0x06,
+ 0x07, 0x92, 0x02, 0xe0, 0x07, 0x78, 0x06, 0x9b, 0x02, 0xe0, 0x08, 0x5c,
+ 0xc8, 0x05, 0x01, 0x6c, 0xc1, 0x60, 0xfc, 0x00, 0x16, 0x16, 0x10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 0x00, 0x16, 0xf5, 0x88, 0x08, 0x01, 0x8c, 0xc0, 0xe0, 0x01, 0x6c,
+ 0xc2, 0x20, 0x05, 0xf4, 0x13, 0x02, 0x04, 0x60, 0xb9, 0x4c, 0x02, 0xe0,
+ 0x08, 0x6a, 0x01, 0x03, 0x00, 0xff, 0x13, 0x11, 0x01, 0x43, 0x04, 0x00,
+ 0x13, 0x0e, 0xc8, 0x09, 0x01, 0x6a, 0xc8, 0x04, 0xf8, 0x00, 0xc2, 0x45,
+ 0xc1, 0x60, 0x08, 0x96, 0x02, 0x85, 0x97, 0xf6, 0x16, 0x02, 0x06, 0xa0,
+ 0x99, 0x16, 0x02, 0x43, 0x03, 0x00, 0x02, 0xe0, 0x00, 0xe0, 0x01, 0x20,
+ 0x08, 0x70, 0x01, 0x00, 0x16, 0x2f, 0xc2, 0x20, 0x05, 0xf4, 0x16, 0x2c,
+ 0xc2, 0x60, 0x05, 0xf0, 0x13, 0x12, 0xc8, 0x19, 0x05, 0xf0, 0xc2, 0xa9,
+ 0x00, 0x0a, 0x11, 0x02, 0xf2, 0xa0, 0x09, 0x2e, 0xd8, 0x0a, 0x01, 0x80,
+ 0xc8, 0x29, 0x00, 0x06, 0x01, 0x8c, 0x07, 0xa0, 0x09, 0x16, 0x00, 0x04,
+ 0xc8, 0x09, 0x05, 0xf4, 0x10, 0x17, 0x02, 0xe0, 0x08, 0x6a, 0x01, 0x83,
+ 0x06, 0x00, 0x16, 0x05, 0xc1, 0x42, 0x13, 0x08, 0xc0, 0xc0, 0xc1, 0x01,
+ 0x04, 0xc2, 0xd8, 0x20, 0x09, 0x2e, 0x01, 0x80, 0xc8, 0x04, 0x01, 0x8c,
+ 0x02, 0xe0, 0x00, 0xe0, 0x07, 0xa0, 0x00, 0x14, 0x08, 0x6a, 0xc8, 0x20,
+ 0x08, 0x96, 0x00, 0x16, 0xc8, 0x03, 0x01, 0x6c, 0x11, 0x03, 0x03, 0x90,
+ 0x11, 0xff, 0x03, 0x80, 0x04, 0x60, 0xb9, 0xc0, 0xc8, 0x04, 0x01, 0x6a,
+ 0x10, 0x03, 0xc8, 0x20, 0xf8, 0x00, 0x01, 0x6a, 0xc3, 0x20, 0xf8, 0x02,
+ 0x01, 0x4c, 0x01, 0x00, 0x16, 0xf8, 0xc1, 0x60, 0x10, 0x86, 0x02, 0x45,
+ 0x00, 0x1f, 0x06, 0xcc, 0xd9, 0x4c, 0x10, 0x88, 0x13, 0x0d, 0x05, 0xa0,
+ 0x10, 0x86, 0x06, 0x03, 0x01, 0x03, 0x00, 0xff, 0x13, 0x52, 0xc1, 0x20,
+ 0xf8, 0x00, 0xc8, 0x04, 0x01, 0x6a, 0x16, 0xe8, 0x06, 0xa0, 0x97, 0xb6,
+ 0x01, 0x0c, 0x00, 0xfe, 0x16, 0xf0, 0xc3, 0x20, 0x01, 0x6a, 0xc8, 0x04,
+ 0x01, 0x6a, 0x01, 0x20, 0xf8, 0x0e, 0x80, 0x00, 0x13, 0x07, 0xc1, 0x20,
+ 0xf8, 0x14, 0x01, 0x84, 0x60, 0xff, 0x02, 0x84, 0x02, 0x00, 0x1b, 0x33,
+ 0xc1, 0x20, 0xf8, 0x08, 0x11, 0x0c, 0x88, 0x20, 0xf8, 0x0c, 0x01, 0xa4,
+ 0x16, 0x2f, 0x88, 0x20, 0xf8, 0x0a, 0x01, 0xa2, 0x16, 0x2b, 0x88, 0x04,
+ 0x01, 0xa0, 0x13, 0x25, 0x10, 0x27, 0xc1, 0x20, 0xf8, 0x0a, 0x11, 0x09,
+ 0x25, 0x20, 0x01, 0xac, 0x16, 0x1e, 0xc1, 0x20, 0xf8, 0x0c, 0x25, 0x20,
+ 0x01, 0xae, 0x16, 0x19, 0x10, 0x1b, 0x02, 0x84, 0xff, 0xff, 0x16, 0x0a,
+ 0x88, 0x04, 0xf8, 0x0c, 0x16, 0x07, 0x41, 0x20, 0xf8, 0x08, 0x13, 0x0f,
+ 0x02, 0x84, 0x3f, 0xff, 0x13, 0x0c, 0x10, 0x0e, 0x88, 0x04, 0x01, 0xa8,
+ 0x16, 0x0b, 0x88, 0x20, 0xf8, 0x0c, 0x01, 0xaa, 0x16, 0x07, 0x88, 0x20,
+ 0xf8, 0x08, 0x01, 0xa6, 0x16, 0x03, 0xd9, 0x60, 0xee, 0xa8, 0x10, 0x88,
+ 0xc8, 0x0c, 0x01, 0x6a, 0x10, 0xa8, 0x01, 0x43, 0x20, 0x00, 0x16, 0x07,
+ 0x07, 0x85, 0x01, 0x04, 0x01, 0x55, 0x21, 0x00, 0x16, 0x03, 0x07, 0x95,
+ 0xde, 0x8c, 0x04, 0x5b, 0x01, 0x55, 0x01, 0x00, 0x16, 0xfc, 0xc1, 0x15,
+ 0x01, 0xc4, 0xff, 0x00, 0x01, 0x84, 0x04, 0x80, 0xc5, 0x44, 0x01, 0x55,
+ 0x20, 0x00, 0x13, 0xf1, 0x01, 0xe0, 0x07, 0x78, 0x80, 0x00, 0x04, 0x5b,
+ 0x03, 0x00, 0x00, 0x02, 0xc2, 0x0b, 0xc3, 0x20, 0x05, 0xf4, 0x16, 0x08,
+ 0xc3, 0x20, 0x08, 0x70, 0x01, 0x0c, 0x00, 0xff, 0x13, 0x1a, 0x01, 0x4c,
+ 0x04, 0x00, 0x13, 0x17, 0xc2, 0xa8, 0x00, 0x0a, 0x01, 0x4a, 0x00, 0x10,
+ 0x16, 0x46, 0x01, 0x4a, 0x80, 0x00, 0x16, 0x19, 0xc3, 0x08, 0x06, 0xa0,
+ 0x9a, 0xf4, 0xc2, 0x0c, 0xc3, 0x20, 0x05, 0xf4, 0x16, 0x12, 0xc3, 0x20,
+ 0x08, 0x70, 0x01, 0x0c, 0x00, 0xff, 0x13, 0x03, 0x01, 0x4c, 0x04, 0x00,
+ 0x16, 0x0a, 0x01, 0x68, 0x00, 0x0a, 0x00, 0x10, 0x13, 0x03, 0x01, 0x0c,
+ 0x01, 0x00, 0x16, 0x2d, 0x06, 0xa0, 0xbc, 0x40, 0x10, 0x04, 0x07, 0x87,
+ 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, 0x45, 0xc1, 0x60, 0x08, 0x96, 0x02, 0x85, 0x97, 0xf6,
+ 0x16, 0x02, 0x06, 0xa0, 0x99, 0x16, 0x02, 0x43, 0x03, 0x00, 0x10, 0x02,
+ 0x01, 0xc3, 0x04, 0x00, 0x00, 0x9d, 0x04, 0x5b, 0x03, 0x00, 0x00, 0x02,
+ 0x07, 0x87, 0x05, 0xf0, 0xc2, 0xcb, 0x16, 0x0f, 0x06, 0xa0, 0x9a, 0xf4,
+ 0x01, 0xe0, 0x08, 0x70, 0x01, 0x00, 0x07, 0xa0, 0x00, 0x14, 0x00, 0xe0,
+ 0x07, 0xa0, 0x00, 0x16, 0x98, 0x4e, 0xcb, 0x60, 0x05, 0xf4, 0x00, 0x02,
+ 0x03, 0x80, 0xc2, 0x20, 0x08, 0x70, 0x01, 0x88, 0x01, 0x00, 0xc8, 0x08,
+ 0x08, 0x70, 0x01, 0x08, 0x04, 0x00, 0x16, 0x03, 0x01, 0x08, 0x00, 0xff,
+ 0x16, 0x08, 0xc2, 0x20, 0x05, 0xf4, 0x16, 0x05, 0xc2, 0x17, 0x13, 0x04,
+ 0xc5, 0xd8, 0x06, 0xa0, 0xbc, 0x40, 0x03, 0x80, 0x02, 0xe0, 0x08, 0x6a,
+ 0x01, 0x83, 0x06, 0x00, 0x16, 0x05, 0xc1, 0x42, 0x13, 0x08, 0xc0, 0xc0,
+ 0xc1, 0x01, 0x04, 0xc2, 0xd8, 0x20, 0x09, 0x2e, 0x01, 0x80, 0xc8, 0x04,
+ 0x01, 0x8c, 0x02, 0xe0, 0x00, 0xc0, 0x07, 0xa0, 0x00, 0x14, 0x08, 0x6a,
+ 0xc8, 0x20, 0x08, 0x96, 0x00, 0x16, 0x03, 0x80, 0xc8, 0x01, 0x01, 0x6a,
+ 0x13, 0x05, 0xc2, 0xe0, 0xf8, 0x02, 0x11, 0x02, 0x06, 0xa0, 0x97, 0xb6,
+ 0x01, 0x60, 0x01, 0x9c, 0x00, 0x40, 0x13, 0x01, 0x03, 0x80, 0xd8, 0x20,
+ 0x09, 0x2f, 0x01, 0x83, 0xc0, 0x41, 0x13, 0x04, 0xc8, 0x01, 0x01, 0x8a,
+ 0xc8, 0x01, 0x09, 0x18, 0x07, 0x85, 0x00, 0x43, 0x01, 0x20, 0x0c, 0x06,
+ 0x00, 0xc0, 0x16, 0x20, 0xc2, 0x20, 0x0c, 0x02, 0x06, 0x08, 0x01, 0x08,
+ 0xfe, 0x03, 0x16, 0x1a, 0x07, 0x8a, 0x00, 0x24, 0x62, 0xa0, 0x0c, 0x04,
+ 0xc8, 0x0a, 0x0c, 0x04, 0x07, 0x87, 0x06, 0x30, 0x01, 0xe7, 0x00, 0x04,
+ 0x00, 0x40, 0x04, 0xd7, 0x02, 0x27, 0x00, 0x0c, 0xc2, 0x57, 0x16, 0x04,
+ 0xcd, 0xc5, 0xc5, 0xc5, 0x04, 0x60, 0xb9, 0xc0, 0x05, 0xc7, 0xc8, 0x17,
+ 0x01, 0x6a, 0xc8, 0x05, 0xf8, 0x00, 0x10, 0xf7, 0x04, 0x60, 0xf8, 0xfe,
+ 0x03, 0x00, 0x00, 0x02, 0xc3, 0x20, 0x01, 0x8a, 0x98, 0x20, 0xe0, 0x10,
+ 0x01, 0x83, 0x13, 0xba, 0x01, 0x20, 0x01, 0x9c, 0x00, 0x40, 0x13, 0x02,
+ 0x06, 0xa0, 0xd7, 0xd8, 0xc1, 0x41, 0x83, 0x05, 0x16, 0x01, 0x03, 0x80,
+ 0xc8, 0x05, 0x01, 0x6a, 0xc2, 0x20, 0xf8, 0x02, 0x01, 0x40, 0x00, 0x40,
+ 0x16, 0x12, 0x88, 0x01, 0x09, 0x18, 0x16, 0x07, 0xc8, 0x20, 0x09, 0x1a,
+ 0x09, 0x18, 0x04, 0xe0, 0x09, 0x1a, 0x01, 0xc0, 0x00, 0x04, 0x01, 0x80,
+ 0x40, 0x40, 0x01, 0x20, 0xf8, 0x06, 0x00, 0xc0, 0x16, 0x02, 0x01, 0xc0,
+ 0x40, 0x00, 0x01, 0x48, 0x01, 0x00, 0x16, 0x55, 0x01, 0xc0, 0x00, 0x40,
+ 0x01, 0x00, 0x40, 0x04, 0x13, 0x50, 0x01, 0x40, 0x40, 0x00, 0x16, 0x48,
+ 0x01, 0xa0, 0x07, 0x78, 0x40, 0x00, 0x01, 0x80, 0x40, 0x00, 0x01, 0x48,
+ 0x00, 0x01, 0x16, 0x3d, 0x01, 0x80, 0x00, 0x04, 0xc1, 0x41, 0xc0, 0x60,
+ 0xf8, 0x00, 0x04, 0xe0, 0xf8, 0x00, 0x07, 0x8b, 0x03, 0xea, 0x62, 0xe0,
+ 0xf8, 0x04, 0xc8, 0x0b, 0xf8, 0x04, 0x85, 0x05, 0x16, 0x02, 0xc5, 0x01,
+ 0x10, 0x10, 0xc8, 0x14, 0x01, 0x6a, 0x88, 0x05, 0xf8, 0x00, 0x13, 0x06,
+ 0xc8, 0x20, 0xf8, 0x00, 0x01, 0x6a, 0x88, 0x05, 0xf8, 0x00, 0x16, 0xfa,
+ 0xc8, 0x01, 0xf8, 0x00, 0x16, 0x02, 0xc0, 0xa0, 0x01, 0x6a, 0x01, 0x08,
+ 0xfe, 0x00, 0x16, 0x4a, 0xc8, 0x05, 0x01, 0x6a, 0x07, 0x87, 0x06, 0x30,
+ 0x01, 0xe7, 0x00, 0x04, 0x00, 0x40, 0x04, 0xd7, 0x02, 0x27, 0x00, 0x0c,
+ 0xa1, 0x45, 0xc9, 0x60, 0xf8, 0x00, 0x0c, 0x32, 0x04, 0xe0, 0xf8, 0x00,
+ 0x09, 0x15, 0xc2, 0x57, 0x16, 0x31, 0xcd, 0xc5, 0xc5, 0xc5, 0x01, 0xc0,
+ 0x00, 0x20, 0xc1, 0x41, 0x10, 0x0e, 0x01, 0x40, 0x00, 0x04, 0x16, 0x05,
+ 0x01, 0x80, 0x00, 0x04, 0x01, 0xe0, 0xf8, 0x02, 0x40, 0x00, 0xc1, 0x60,
+ 0xf8, 0x00, 0x01, 0x00, 0x40, 0x00, 0x16, 0x01, 0xc0, 0x45, 0x83, 0x05,
+ 0x16, 0x87, 0xc2, 0xe0, 0x09, 0x18, 0x16, 0x10, 0x01, 0x00, 0x00, 0x04,
+ 0x16, 0x0d, 0x98, 0x20, 0xe0, 0x10, 0x01, 0x83, 0x13, 0x09, 0x07, 0x8b,
+ 0xd7, 0x5e, 0x01, 0x40, 0x00, 0x40, 0x13, 0x02, 0x07, 0x8b, 0xd7, 0xa4,
+ 0xc8, 0x0b, 0x00, 0x12, 0x01, 0x00, 0x00, 0x20, 0x16, 0x01, 0x03, 0x80,
+ 0x01, 0x80, 0x00, 0x20, 0x04, 0x60, 0xb9, 0xc0, 0x05, 0xc7, 0xc8, 0x17,
+ 0x01, 0x6a, 0xc8, 0x05, 0xf8, 0x00, 0x10, 0xca, 0xc1, 0x81, 0x06, 0xa0,
+ 0xf9, 0x32, 0xc1, 0x46, 0x10, 0xd8, 0x05, 0xa0, 0x09, 0x32, 0xc0, 0x41,
+ 0x16, 0x01, 0x03, 0x80, 0xc3, 0x20, 0x00, 0x12, 0x04, 0x5c, 0x03, 0x00,
+ 0x00, 0x00, 0x03, 0xb0, 0x10, 0xff, 0x03, 0x80, 0x20, 0x00, 0x9d, 0xd2,
+ 0x02, 0x2f, 0x00, 0x00, 0x20, 0x00, 0xc7, 0x46, 0x00, 0x88, 0xc0, 0x60,
+ 0x05, 0xee, 0x02, 0x21, 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02, 0x00, 0x06,
+ 0x13, 0x04, 0x01, 0x20, 0x01, 0x00, 0x08, 0x00, 0x13, 0x04, 0x88, 0x01,
+ 0x05, 0xee, 0x16, 0xf5, 0x10, 0x35, 0x07, 0x81, 0x01, 0x0a, 0xcc, 0x4c,
+ 0xcc, 0x4c, 0xcc, 0x4e, 0xcc, 0x4f, 0x07, 0xb1, 0x00, 0x40, 0xc4, 0x4d,
+ 0xc8, 0x0a, 0x01, 0x00, 0x04, 0x5b, 0xc0, 0x60, 0x05, 0xee, 0x02, 0x21,
+ 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02, 0x00, 0x06, 0x13, 0x04, 0x01, 0x20,
+ 0x01, 0x00, 0x08, 0x00, 0x13, 0x04, 0x88, 0x01, 0x05, 0xee, 0x16, 0xf5,
+ 0x10, 0x19, 0x07, 0x81, 0x01, 0x0a, 0xcc, 0x4c, 0xcc, 0x4c, 0xcc, 0x4e,
+ 0xcc, 0x4f, 0x07, 0xb1, 0x00, 0x40, 0xc4, 0x4d, 0xc8, 0x0a, 0x01, 0x00,
+ 0xc0, 0x60, 0x05, 0xee, 0x02, 0x21, 0x03, 0xe8, 0x01, 0x20, 0x01, 0x02,
+ 0x00, 0x06, 0x13, 0x01, 0x04, 0x5b, 0x88, 0x01, 0x05, 0xee, 0x16, 0xf8,
+ 0x10, 0x01, 0x20, 0x00, 0xce, 0x3e, 0x0a, 0x32, 0x07, 0x8d, 0x10, 0x00,
+ 0x20, 0x0d, 0x16, 0x28, 0x07, 0x8d, 0x08, 0x00, 0x01, 0x40, 0x02, 0x00,
+ 0x13, 0x23, 0x01, 0xc0, 0x02, 0x00, 0x07, 0x8f, 0x97, 0xf6, 0xc3, 0x8e,
+ 0x11, 0x02, 0x07, 0x8f, 0x97, 0x6a, 0xc8, 0x0f, 0x08, 0x96, 0xc3, 0x60,
+ 0x00, 0x16, 0x02, 0x8d, 0x98, 0x4e, 0x13, 0x02, 0xc8, 0x0f, 0x00, 0x16,
+ 0x07, 0x8f, 0x03, 0xf8, 0x02, 0x4e, 0x40, 0x00, 0xc8, 0x0e, 0x08, 0x98,
+ 0xc8, 0x0e, 0x08, 0x9a, 0x13, 0x05, 0x07, 0x8e, 0xee, 0x60, 0xc3, 0xfe,
+ 0xc8, 0x0e, 0x08, 0x90, 0xc8, 0x0f, 0x08, 0x62, 0x04, 0x20, 0xea, 0x7a,
+ 0x04, 0x5b, 0x07, 0x8d, 0x10, 0x00, 0x20, 0x0d, 0x16, 0xfb, 0x07, 0x8d,
+ 0x08, 0x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 0xe2, 0x13, 0xf9, 0xc8, 0x01, 0x01, 0x6c, 0x10, 0xd0,
+ 0x03, 0x00, 0x00, 0x0f, 0x01, 0x60, 0x07, 0x58, 0x14, 0x00, 0x16, 0xbf,
+ 0x07, 0x83, 0xfc, 0x76, 0x02, 0xe0, 0x08, 0x5c, 0x04, 0x60, 0x91, 0x6a,
+ 0x02, 0x2d, 0x00, 0x06, 0xc0, 0xa0, 0x08, 0x4c, 0x04, 0x60, 0xd3, 0x36,
+ 0x01, 0x00, 0x07, 0xff, 0x16, 0x11, 0x01, 0xc0, 0x07, 0xff, 0x01, 0x00,
+ 0x20, 0x00, 0x16, 0x29, 0x01, 0xc0, 0x20, 0x00, 0x07, 0x8f, 0x08, 0x92,
+ 0xc7, 0xc1, 0xc8, 0x0f, 0x00, 0xe8, 0xc0, 0x60, 0x05, 0xf8, 0x04, 0xe0,
+ 0x05, 0xf8, 0x10, 0x1f, 0x01, 0x40, 0x20, 0x00, 0x16, 0x0b, 0xc0, 0x60,
+ 0x05, 0xf8, 0x16, 0xf7, 0x01, 0x80, 0x20, 0x00, 0x07, 0xa0, 0x00, 0xe8,
+ 0x07, 0x7a, 0xc0, 0x60, 0x08, 0x92, 0x10, 0x0f, 0xc3, 0xdd, 0x13, 0x05,
+ 0x03, 0x90, 0x00, 0x17, 0x06, 0x9b, 0x02, 0x2d, 0x00, 0x06, 0x03, 0x00,
+ 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03,
+ 0x13, 0xf8, 0x24, 0x40, 0x13, 0xcd, 0xc8, 0x01, 0x01, 0x6c, 0x88, 0x01,
+ 0x00, 0xe2, 0x16, 0x24, 0xc3, 0xdd, 0x16, 0xea, 0x84, 0xc4, 0x13, 0xed,
+ 0x01, 0x20, 0xfc, 0x06, 0x00, 0xc0, 0x16, 0x53, 0x01, 0xc0, 0x40, 0x00,
+ 0x03, 0x00, 0x00, 0x0f, 0x03, 0xd0, 0x03,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a5, 0xff, 0xee,
+ 0xe0, 0x81, 0x02, 0x25, 0xff, 0xf8, 0x62, 0x86, 0x15, 0x43, 0xa1, 0x8a,
+ 0xa2, 0x46, 0xa0, 0x86, 0x17, 0x21, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00,
+ 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03,
+ 0x13, 0xf8, 0x05, 0xa0, 0x10, 0x80, 0x01, 0x5e, 0x21, 0x00, 0x16, 0x03,
+ 0x07, 0x9e, 0xde, 0x8c, 0x10, 0x11, 0x01, 0x5e, 0x01, 0x00, 0x16, 0x0e,
+ 0xc3, 0xde, 0x01, 0xcf, 0xff, 0x00, 0x01, 0x8f, 0x04, 0x80, 0xc7, 0x8f,
+ 0x01, 0x5e, 0x20, 0x00, 0x13, 0xf1, 0x01, 0xc0, 0x80, 0x00, 0x10, 0x02,
+ 0x05, 0xa0, 0x10, 0x80, 0xc1, 0x8a, 0x88, 0x02, 0x08, 0x8c, 0x15, 0x3f,
+ 0xc2, 0xac, 0x00, 0x04, 0x13, 0x3e, 0x01, 0x8a, 0x80, 0x00, 0xc1, 0xfc,
+ 0xc2, 0x3c, 0x04, 0xfc, 0x02, 0x8c, 0x11, 0xe8, 0x16, 0x02, 0x07, 0x8c,
+ 0x11, 0x28, 0x05, 0x06, 0x13, 0xa3, 0x03, 0x00, 0x00, 0x0f, 0x03, 0xd0,
+ 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03, 0x13, 0xf8, 0x10, 0xaf,
+ 0xa2, 0x46, 0xa2, 0x06, 0x17, 0x01, 0x05, 0x87, 0xa0, 0x86, 0x04, 0xc6,
+ 0x17, 0x93, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x0f, 0x03, 0xd0,
+ 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03, 0x13, 0xf8, 0x01, 0x5e,
+ 0x21, 0x00, 0x16, 0x03, 0x07, 0x9e, 0xde, 0x8c, 0x10, 0x8b, 0x01, 0x5e,
+ 0x01, 0x00, 0x16, 0x88, 0xc3, 0xde, 0x01, 0xcf, 0xff, 0x00, 0x01, 0x8f,
+ 0x04, 0x80, 0xc7, 0x8f, 0x01, 0x5e, 0x20, 0x00, 0x13, 0xf1, 0x01, 0xc0,
+ 0x80, 0x00, 0x04, 0x60, 0xd0, 0x9e, 0x04, 0x60, 0xd5, 0xa0, 0x03, 0x00,
+ 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03,
+ 0x13, 0xf8, 0xc2, 0xac, 0x00, 0x04, 0x16, 0xb7, 0xc3, 0xdd, 0x13, 0xf3,
+ 0x03, 0x90, 0x01, 0xb7, 0x06, 0x9b, 0x02, 0x2d, 0x00, 0x06, 0xc8, 0x01,
+ 0x01, 0x6c, 0x10, 0xeb, 0xa1, 0x8a, 0xa2, 0x46, 0xa0, 0x86, 0x17, 0x21,
+ 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00,
+ 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03, 0x13, 0xf8, 0x05, 0xa0, 0x10, 0x80,
+ 0x01, 0x5e, 0x21, 0x00, 0x16, 0x03, 0x07, 0x9e, 0xde, 0x8c, 0x10, 0x11,
+ 0x01, 0x5e, 0x01, 0x00, 0x16, 0x0e, 0xc3, 0xde, 0x01, 0xcf, 0xff, 0x00,
+ 0x01, 0x8f, 0x04, 0x80, 0xc7, 0x8f, 0x01, 0x5e, 0x20, 0x00, 0x13, 0xf1,
+ 0x01, 0xc0, 0x80, 0x00, 0x10, 0x02, 0x05, 0xa0, 0x10, 0x80, 0xc1, 0x8a,
+ 0x88, 0x02, 0x08, 0x8c, 0x15, 0x15, 0xc2, 0xac, 0x00, 0x04, 0x16, 0x14,
+ 0x03, 0x00, 0x00, 0x0f,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d0, 0x03, 0x00, 0x00, 0x02,
+ 0xd3, 0xe0, 0x01, 0x03, 0x13, 0xf8, 0x05, 0xa0, 0x10, 0x80, 0x01, 0x5e,
+ 0x21, 0x00, 0x16, 0x03, 0x07, 0x9e, 0xde, 0x8c, 0x10, 0x11, 0x01, 0x5e,
+ 0x01, 0x00, 0x16, 0x0e, 0xc3, 0xde, 0x01, 0xcf, 0xff, 0x00, 0x01, 0x8f,
+ 0x04, 0x80, 0xc7, 0x8f, 0x01, 0x5e, 0x20, 0x00, 0x13, 0xf1, 0x01, 0xc0,
+ 0x80, 0x00, 0x10, 0x02, 0x05, 0xa0, 0x10, 0x80, 0xc1, 0x8a, 0x88, 0x02,
+ 0x08, 0x8c, 0x15, 0x15, 0xc2, 0xac, 0x00, 0x04, 0x16, 0x14, 0x03, 0x00,
+ 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01, 0x03,
+ 0x13, 0xf8, 0xc3, 0xdd, 0x13, 0xf3, 0x03, 0x90, 0x01, 0xb7, 0x06, 0x9b,
+ 0x02, 0x2d, 0x00, 0x06, 0xc8, 0x01, 0x01, 0x6c, 0x10, 0xeb, 0x04, 0x60,
+ 0xd5, 0xa0, 0x01, 0x8a, 0x80, 0x00, 0xc1, 0xfc, 0xc2, 0x3c, 0x04, 0xfc,
+ 0x02, 0x8c, 0x11, 0xe8, 0x16, 0x02, 0x07, 0x8c, 0x11, 0x28, 0x05, 0x06,
+ 0x13, 0x09, 0x03, 0x00, 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02,
+ 0xd3, 0xa0, 0x01, 0x03, 0x13, 0xf8, 0x10, 0x9b, 0xa2, 0x06, 0x17, 0x01,
+ 0x05, 0x87, 0xa0, 0x86, 0x17, 0x1e, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00,
+ 0x00, 0x0f, 0x03, 0xd0, 0x03, 0x00, 0x00, 0x02, 0xd3, 0xe0, 0x01,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8, 0x02, 0x01, 0x00, 0x16, 0x05, 0xc0, 0x60, 0xf8, 0x00,
+ 0x83, 0x01, 0x16, 0xf2, 0x10, 0x9a, 0x07, 0xa0, 0x00, 0x12, 0xd7, 0xa4,
+ 0xc0, 0x60, 0xf8, 0x00, 0x83, 0x01, 0x13, 0x93, 0xc8, 0x01, 0x01, 0x6a,
+ 0x01, 0x60, 0xf8, 0x02, 0x01, 0x00, 0x16, 0x89, 0x07, 0xa0, 0x00, 0x12,
+ 0xd7, 0x5e, 0x10, 0xea, 0x03, 0x00, 0x00, 0x02, 0xc3, 0x20, 0x01, 0x8a,
+ 0x13, 0x1d, 0x83, 0x01, 0x13, 0x0e, 0xc8, 0x01, 0x01, 0x6a, 0x01, 0x20,
+ 0xf8, 0x06, 0x00, 0xc0, 0x13, 0x86, 0x01, 0x60, 0xf8, 0x02, 0x01, 0x00,
+ 0x16, 0x07, 0xc0, 0x60, 0xf8, 0x00, 0x83, 0x01, 0x16, 0xf2, 0x03, 0x90,
+ 0xbf, 0xff, 0x03, 0x80, 0x07, 0xa0, 0x00, 0x12, 0xd7, 0xa4, 0xc0, 0x60,
+ 0xf8, 0x00, 0x83, 0x01, 0x16, 0x0b, 0x03, 0x90, 0xbf, 0xff, 0x03, 0x80,
+ 0x10, 0x18, 0x03, 0x00, 0x00, 0x02, 0xc3, 0x20, 0x01, 0x8a, 0x13, 0x13,
+ 0x83, 0x01, 0x13, 0x0e, 0xc8, 0x01, 0x01, 0x6a, 0x01, 0x60, 0xf8, 0x02,
+ 0x01, 0x00, 0x16, 0x04, 0x07, 0xa0, 0x00, 0x12, 0xd7, 0x5e, 0x10, 0xdd,
+ 0xc0, 0x60, 0xf8, 0x00, 0x83, 0x01, 0x16, 0xf2, 0x03, 0x90, 0xbf, 0xff,
+ 0x03, 0x80, 0x07, 0x8b, 0x9c, 0x72, 0xc3, 0x01, 0x13, 0x39, 0xc2, 0x4c,
+ 0xc8, 0x0c, 0x01, 0x6a, 0xc2, 0x20, 0xf8, 0x02, 0x11, 0x2d, 0xc2, 0x4c,
+ 0xc3, 0x20, 0xf8, 0x00, 0x16, 0xf7, 0xc8, 0x09, 0x01, 0x6a, 0xc2, 0x20,
+ 0xf8, 0x02, 0x16, 0x2a, 0x01, 0xe0, 0xf8, 0x02, 0x19, 0x00, 0x05, 0xa0,
+ 0x13, 0x80, 0x10, 0x24, 0x01, 0xe0, 0xf8, 0x02, 0x19, 0x00, 0x05, 0xa0,
+ 0x13, 0x80, 0xc8, 0x0c, 0x01, 0x8a, 0x07, 0x89, 0x09, 0x18, 0xc2, 0x19,
+ 0x13, 0x01, 0x05, 0xc9, 0xc6, 0x4c, 0xc2, 0x20, 0x00, 0x12, 0x02, 0x88,
+ 0xd7, 0x5e, 0x16, 0x03, 0x01, 0xc0, 0x00, 0x40, 0x10, 0x05, 0x02, 0x88,
+ 0xd7, 0xa4, 0x16, 0x05, 0x01, 0x80, 0x40, 0x40, 0x07, 0xa0, 0x00, 0x12,
+ 0x9c, 0x56, 0x04, 0x5b, 0xc8, 0x09, 0x01, 0x6a, 0xc2, 0x20, 0xf8, 0x02,
+ 0x16, 0xe2, 0x10, 0xdc, 0xc2, 0x20, 0x0c, 0x02, 0x11, 0x01, 0x10, 0xe5,
+ 0xd8, 0x20, 0xe0, 0x10, 0x01, 0x83, 0x07, 0x88, 0x00, 0x05, 0x0b, 0x88,
+ 0x0b, 0x88, 0x06, 0x08, 0x16, 0xfc, 0x07, 0xa0, 0x01, 0x8a, 0x00, 0x43,
+ 0x10, 0xd8, 0x20, 0x00, 0xd8, 0x70, 0x00, 0x7f, 0x00, 0x00, 0x20, 0x00,
+ 0xf8, 0x30, 0x05, 0xec, 0x68, 0x04, 0x09, 0x32, 0xd3, 0xcf, 0x16, 0x30,
+ 0x01, 0x4f, 0x00, 0x80, 0x16, 0x2d, 0x01, 0x0e, 0x00, 0x03, 0x16, 0x2a,
+ 0xd1, 0x04, 0x13, 0x01, 0x07, 0x04, 0x06, 0xc4, 0x07, 0x03, 0x07, 0x88,
+ 0x07, 0x23, 0xb6, 0x04, 0x18, 0x0d, 0x01, 0x4d, 0x00, 0x02, 0x13, 0x0f,
+ 0xc0, 0x60, 0x06, 0x7c, 0x02, 0x81, 0x06, 0x30, 0x13, 0x0a, 0x07, 0x88,
+ 0x80, 0x18, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x05, 0x76, 0x04, 0x96, 0x03,
+ 0x13, 0x02, 0xd6, 0x01, 0x10, 0xee, 0x07, 0x88, 0x07, 0x2f, 0xb6, 0x04,
+ 0x18, 0x03, 0x96, 0x03, 0x13, 0x05, 0x04, 0x5c, 0x76, 0x04, 0x96, 0x03,
+ 0x13, 0x05, 0xd6, 0x03, 0x07, 0x83, 0x80, 0x40, 0x06, 0xa0, 0xe3, 0x56,
+ 0x04, 0x5c, 0x03, 0x00, 0x00, 0x02, 0xc1, 0x4b, 0x02, 0x85, 0x00, 0x43,
+ 0x13, 0x2c, 0x01, 0x60, 0x09, 0x6a, 0x00, 0x04, 0x16, 0x06, 0xc8, 0x05,
+ 0x01, 0x6c, 0x01, 0x60, 0xfc, 0x02, 0x00, 0x20, 0x13, 0x07, 0x06, 0xa0,
+ 0xf9, 0x32, 0x03, 0x90, 0x04, 0x77, 0x03, 0x80, 0xc8, 0x0a, 0x01, 0x6c,
+ 0xc2, 0xa0, 0xfc, 0x00, 0x16, 0xfb, 0xc2, 0xa0, 0x01, 0x6c, 0x07, 0x89,
+ 0x03, 0xea, 0x62, 0x60, 0xfc, 0x04, 0xc8, 0x09, 0xfc, 0x04, 0x07, 0x89,
+ 0x05, 0xf8, 0xc2, 0xd9, 0x16, 0x02, 0xce, 0x45, 0x10, 0x05, 0x05, 0xc9,
+ 0xc8, 0x19, 0x01, 0x6c, 0xc8, 0x05, 0xfc, 0x00, 0xc6, 0x4a, 0x01, 0xa0,
+ 0x07, 0x78, 0x07, 0xff, 0x10, 0xe0, 0x07, 0xa0, 0x0c, 0x02, 0x80, 0x00,
+ 0x07, 0xa0, 0x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0xb8, 0x07, 0x8d, 0x00, 0x10, 0x04, 0x5b, 0x03, 0x00,
+ 0x00, 0x02, 0x07, 0x09, 0xc2, 0xa0, 0x01, 0x04, 0x01, 0x8a, 0x00, 0x80,
+ 0x52, 0x4a, 0xd2, 0x89, 0x01, 0xca, 0x25, 0x00, 0xc8, 0x0a, 0x01, 0x04,
+ 0xd2, 0xa0, 0x01, 0x04, 0x01, 0x0a, 0xda, 0x00, 0x16, 0xf5, 0x52, 0x4a,
+ 0x01, 0xa0, 0x08, 0xa0, 0xff, 0x00, 0x07, 0xa0, 0x08, 0xa8, 0x10, 0x00,
+ 0x01, 0xc9, 0x05, 0x00, 0x07, 0x8a, 0x07, 0x78, 0x02, 0x89, 0x5f, 0xff,
+ 0x16, 0x19, 0x01, 0x5a, 0x80, 0x00, 0x16, 0x0f, 0x07, 0x89, 0xde, 0x8c,
+ 0x01, 0x20, 0x07, 0x58, 0x20, 0xfe, 0x13, 0x02, 0x01, 0x89, 0x04, 0x00,
+ 0xc8, 0x09, 0x01, 0x04, 0x01, 0x9a, 0x80, 0x00, 0x03, 0x90, 0xff, 0xff,
+ 0x03, 0x80, 0x01, 0x20, 0x07, 0x58, 0x20, 0xfe, 0x16, 0x22, 0x03, 0x90,
+ 0xff, 0xff, 0x03, 0x80, 0x05, 0x49, 0x01, 0x89, 0x80, 0x00, 0x01, 0x49,
+ 0x40, 0x00, 0x13, 0x23, 0x01, 0x49, 0x20, 0x00, 0x16, 0x2f, 0x01, 0x5a,
+ 0x80, 0x00, 0x16, 0x0e, 0x01, 0x9a, 0x80, 0x00, 0x07, 0x8a, 0xde, 0x8c,
+ 0x01, 0x20, 0x07, 0x58, 0x20, 0xfe, 0x13, 0x02, 0x01, 0x8a, 0x04, 0x00,
+ 0xc8, 0x0a, 0x01, 0x04, 0x01, 0x89, 0x20, 0x00, 0xd2, 0x49, 0x16, 0x05,
+ 0x03, 0x90, 0xff, 0xff, 0x03, 0x80, 0x07, 0x89, 0x20, 0x00, 0xf8, 0x09,
+ 0x07, 0x3a, 0xc2, 0x60, 0x07, 0x36, 0x13, 0xf6, 0x04, 0xe0, 0x07, 0x36,
+ 0x04, 0x54, 0x04, 0xca, 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a,
+ 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a, 0x87, 0x4a,
+ 0x06, 0x0a, 0x16, 0xf4, 0x04, 0x60, 0xb3, 0xf0, 0x01, 0x5a, 0x80, 0x00,
+ 0x13, 0x04, 0x01, 0x20, 0x07, 0x58, 0x20, 0xfe, 0x13, 0xdb, 0xc2, 0xa0,
+ 0x01, 0x04, 0x01, 0xca, 0xff, 0x00, 0x01, 0x8a, 0x04, 0x80, 0xc8, 0x0a,
+ 0x01, 0x04, 0x01, 0x60, 0x01, 0x04, 0x20, 0x00, 0x16, 0xcf, 0x01, 0xc9,
+ 0x20, 0x00, 0x07, 0x8a, 0x07, 0x78, 0x10, 0xb9, 0x01, 0x60, 0x07, 0x58,
+ 0x10, 0x00, 0x16, 0x13, 0x01, 0x20, 0x05, 0xee, 0x00, 0x07, 0x16, 0x0f,
+ 0xc1, 0xa0, 0x08, 0xa0, 0x06, 0xc6, 0xd1, 0xe0, 0x01, 0x03, 0x13, 0x14,
+ 0x71, 0x86, 0x06, 0xc6, 0x01, 0x20, 0x01, 0x04, 0x20, 0x00, 0x13, 0x22,
+ 0x71, 0x86, 0xc8, 0x06, 0x08, 0xa0, 0x01, 0x60, 0x01, 0x82, 0x20, 0x00,
+ 0x16, 0x06, 0x01, 0xa0, 0x01, 0x82, 0x20, 0x00, 0x01, 0xe0, 0x01, 0x82,
+ 0x20, 0x00, 0x04, 0x5b, 0x07, 0x87, 0x01, 0x0c, 0x07, 0x88, 0x08, 0xa2,
+ 0x02, 0x26, 0xff, 0x00, 0x18, 0x04, 0xce, 0x37, 0xce, 0x37, 0xc6, 0x17,
+ 0x10, 0xe2, 0x8e, 0x37, 0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ff, 0x00, 0x01, 0x8f, 0x04, 0x80,
+ 0xc7, 0x8f, 0x01, 0x5e, 0x20, 0x00, 0x16, 0x04, 0x01, 0x60, 0x07, 0x78,
+ 0x80, 0x00, 0x16, 0xf0, 0xc3, 0xdd, 0x02, 0x4f, 0x00, 0x0f, 0xe1, 0x2f,
+ 0xe0, 0x14, 0x03, 0x00, 0x00, 0x0f, 0x04, 0x5b, 0x03, 0x00, 0x00, 0x0f,
+ 0x10, 0x08, 0x06, 0xa0, 0xc7, 0x7e, 0x01, 0xc2, 0xff, 0x80, 0x01, 0x82,
+ 0x24, 0x00, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x02, 0x01, 0x5e,
+ 0x20, 0x00, 0x16, 0xf0, 0xc7, 0x82, 0x03, 0x00, 0x00, 0x0f, 0x03, 0x90,
+ 0x60, 0x3f, 0x04, 0x59, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x02,
+ 0x01, 0x5e, 0x20, 0x00, 0x13, 0x06, 0xc3, 0xde, 0x01, 0xcf, 0xff, 0x00,
+ 0x01, 0x8f, 0x04, 0x80, 0xc7, 0x8f, 0x03, 0x00, 0x00, 0x0f, 0x04, 0x60,
+ 0xc5, 0x60, 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x02, 0x01, 0x5e,
+ 0x20, 0x00, 0x16, 0x10, 0x03, 0x00, 0x00, 0x0f, 0x04, 0x60, 0xc6, 0x22,
+ 0x07, 0x8e, 0x01, 0x04, 0x03, 0x00, 0x00, 0x02, 0x01, 0x5e, 0x20, 0x00,
+ 0x16, 0x09, 0x07, 0xa0, 0x01, 0x04, 0xdb, 0x86, 0x01, 0x85, 0x58, 0x00,
+ 0x03, 0x00, 0x00, 0x0f, 0x04, 0x60, 0xc5, 0x6a, 0xc3, 0xde, 0x01, 0xcf,
+ 0xff, 0x00, 0x01, 0x8f, 0x04, 0x80, 0xc7, 0x8f, 0x01, 0x5e, 0x20, 0x00,
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a, 0x05, 0x01, 0x09, 0x0f, 0x00, 0x13, 0x02, 0x04, 0x60, 0xdd, 0x6a,
+ 0x99, 0x49, 0xea, 0xd0, 0x04, 0x60, 0xdd, 0x54, 0x20, 0x00, 0xb3, 0xcc,
+ 0x00, 0x14, 0x07, 0x8b, 0x01, 0x04, 0x01, 0x5b, 0x20, 0x00, 0x16, 0xfd,
+ 0xd8, 0x20, 0x07, 0xdf, 0x01, 0x17, 0x07, 0x9b, 0xdf, 0x80, 0x20, 0x00,
+ 0xff, 0xc0, 0x00, 0x2a, 0x03, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x01, 0x00,
+ 0x00, 0x80, 0x06, 0x4e, 0x02, 0x01, 0xef, 0xfa, 0xcc, 0x4d, 0xcc, 0x4e,
+ 0xc4, 0x4f, 0x02, 0x00, 0x00, 0x01, 0xc8, 0x00, 0xef, 0xe0, 0x88, 0x00,
+ 0xef, 0xe0, 0x13, 0xfd, 0x02, 0xe0, 0xef, 0xe0, 0x03, 0x80, 0x20, 0x00,
+ 0xae, 0x00, 0x00, 0xaa, 0xc3, 0xce, 0x10, 0x32, 0x00, 0x00, 0xc0, 0x3c,
+ 0x08, 0x4e, 0x00, 0x00, 0xc0, 0x20, 0x07, 0x78, 0x00, 0x00, 0x00, 0x02,
+ 0x08, 0x56, 0x01, 0x0c, 0x00, 0x08, 0x08, 0x62, 0x03, 0xf8, 0x00, 0x06,
+ 0x00, 0x00, 0x12, 0x00, 0x00, 0x02, 0x08, 0x7e, 0x01, 0x8c, 0x00, 0x02,
+ 0x07, 0x78, 0x07, 0xff, 0x00, 0x06, 0x07, 0x7e, 0xfc, 0x76, 0xbe, 0xad,
+ 0x01, 0x0a, 0x00, 0x08, 0x07, 0x8a, 0x00, 0x06, 0x00, 0x00, 0xcf, 0x7a,
+ 0x11, 0x28, 0x00, 0x04, 0x13, 0xa0, 0x13, 0xa0, 0x90, 0x2a, 0x00, 0x02,
+ 0x08, 0x96, 0x97, 0x6a, 0xc0, 0x04, 0x08, 0x9e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x9d, 0xc8, 0x01, 0x80, 0x01, 0x00, 0x01, 0x38, 0x01, 0x7c,
+ 0x01, 0xce, 0x02, 0x32, 0x02, 0xae, 0x03, 0x42, 0x03, 0xf8, 0x03, 0xf8,
+ 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8,
+ 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8,
+ 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8,
+ 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8, 0x03, 0xf8,
+ 0x03, 0xf8, 0x03, 0xf8, 0xcc, 0x00, 0x20, 0x00, 0xb2, 0x98, 0x00, 0x04,
+ 0x02, 0x09, 0x14, 0x00, 0x20, 0x00, 0xb2, 0xa8, 0x00, 0x02, 0x90, 0x00,
+ 0x20, 0x00, 0xb1, 0x00, 0x00, 0x02, 0x90, 0x00, 0x20, 0x00, 0xf8, 0x08,
+ 0x00, 0x02, 0x90, 0x00, 0x20, 0x00, 0xc8, 0xbe, 0x00, 0x04, 0xc2, 0xcb,
+ 0xc2, 0xcb, 0x20, 0x00, 0xbf, 0xb4, 0x00, 0x08, 0x88, 0x0b, 0x07, 0x98,
+ 0x88, 0x0b, 0x07, 0x78, 0x20, 0x00, 0xc0, 0x54, 0x00, 0x04, 0x06, 0xa0,
+ 0xfa, 0x06, 0x20, 0x00, 0xc0, 0x5e, 0x00, 0x04, 0x07, 0x84, 0x07, 0x7a,
+ 0x20, 0x00, 0xc0, 0xc2, 0x00, 0x04, 0x04, 0x60, 0xfa, 0x10, 0x20, 0x00,
+ 0xc9, 0xc0, 0x00, 0x02, 0x16, 0xe2, 0x20, 0x00, 0xc9, 0xc2, 0x00, 0x04,
+ 0x06, 0xa0, 0xfa, 0x42, 0x20, 0x00, 0xc9, 0xe8, 0x00, 0x04, 0x04, 0x60,
+ 0xca, 0x0c, 0x20, 0x00, 0xb9, 0xa0, 0x00, 0x04, 0x04, 0x60, 0x98, 0xa0,
+ 0x20, 0x00, 0xbb, 0x92, 0x00, 0x04, 0x06, 0xa0, 0x9a, 0xf4, 0x20, 0x00,
+ 0xbc, 0x20, 0x00, 0x04, 0xc1, 0xe0, 0xfc, 0x02, 0x20, 0x00, 0xc5, 0x5c,
+ 0x00, 0x04, 0x04, 0x60, 0xfc, 0xec, 0x20, 0x00, 0xc5, 0xa2, 0x00, 0x04,
+ 0x04, 0x60, 0xfc, 0x78, 0x20, 0x00, 0xc5, 0xda, 0x00, 0x04, 0x04, 0x60,
+ 0xfc, 0xc6, 0x20, 0x00, 0xc6, 0x1c, 0x00, 0x04, 0x04, 0x60, 0xfd, 0x0e,
+ 0x20, 0x00, 0xc2, 0xe6, 0x00, 0x06, 0x01, 0x20, 0x01, 0x00, 0x00, 0x80,
+ 0x20, 0x00, 0xc3, 0xd4, 0x00, 0x02, 0x01, 0x17, 0x20, 0x00, 0xa2, 0xca,
+ 0x00, 0x02, 0xc5, 0x60, 0x20, 0x00, 0xa2, 0xd2, 0x00, 0x02, 0xfd, 0x24,
+ 0x20, 0x00, 0xa2, 0xf2, 0x00, 0x02, 0xfd, 0x24, 0x20, 0x00, 0xa3, 0x18,
+ 0x00, 0x02, 0xce, 0x98, 0x20, 0x00, 0xc5, 0x6e, 0x00, 0x02, 0x10, 0x0c,
+ 0x20, 0x00, 0xc4, 0x0c, 0x00, 0x04, 0x06, 0xa0, 0xfd, 0xaa, 0x20, 0x00,
+ 0xcc, 0x38, 0x00, 0x02, 0xc7, 0x7e, 0x20, 0x00, 0xa0, 0xc4, 0x00, 0x02,
+ 0xc7, 0x7e, 0x20, 0x00, 0xc5, 0xec, 0x00, 0x02, 0xc7, 0xb4, 0x20, 0x00,
+ 0xa0, 0xc0, 0x00, 0x02, 0xc7, 0xb4, 0x20, 0x00, 0xc5, 0x14, 0x00, 0x04,
+ 0x04, 0x60, 0xfd, 0xec, 0x20, 0x00, 0xc4, 0xe6, 0x00, 0x04, 0x06, 0xa0,
+ 0xfd, 0x60, 0x20, 0x00, 0xc8, 0x2c, 0x00, 0x02, 0x06, 0x69, 0x20, 0x00,
+ 0xcc, 0x60, 0x00, 0x02, 0x06, 0x69, 0x20, 0x00, 0xdc, 0x68, 0x00, 0x02,
+ 0x04, 0x5c, 0x20, 0x00, 0xdc, 0xb8, 0x00, 0x04, 0x04, 0x60, 0xf8, 0x30,
+ 0x20, 0x00, 0xdd, 0x50, 0x00, 0x04, 0x04, 0x60, 0xfe, 0x04, 0x20, 0x80,
+ 0xb4, 0x88, 0x00, 0x02, 0xfb, 0x88, 0x20, 0x80, 0xdf, 0x06, 0x00, 0x02,
+ 0x08, 0xa8, 0x20, 0x00, 0xa0, 0x34, 0x00, 0x0a, 0x00, 0x02, 0x28, 0xf1,
+ 0xf0, 0xf1, 0xf8, 0xe7, 0xe7, 0xe7, 0x20, 0x00, 0xb2, 0x3c, 0x00, 0x02,
+ 0x06, 0x03, 0x20, 0x00, 0xa1, 0x16, 0x00, 0x02, 0x9c, 0x56, 0x20, 0x00,
+ 0xa1, 0x1a, 0x00, 0x02, 0x98, 0x4e, 0x20, 0x00, 0xa1, 0x1c, 0x00, 0x04,
+ 0x08, 0x4e, 0x95, 0xa8, 0x20, 0x00, 0xa1, 0x22, 0x00, 0x02, 0xfa, 0x76,
+ 0x20, 0x00, 0xa1, 0x66, 0x00, 0x02, 0xf8, 0x9a, 0x20, 0x00, 0xa1, 0x6e,
+ 0x00, 0x02, 0x9a, 0x22, 0x20, 0x00, 0xa1, 0x72, 0x00, 0x02, 0x9b, 0x56,
+ 0x20, 0x00, 0xa1, 0x7a, 0x00, 0x02, 0x9a, 0xb0, 0x20, 0x00, 0xa1, 0x80,
+ 0x00, 0x04, 0xef, 0xc0, 0xff, 0xc0, 0x20, 0x00, 0xa1, 0x9c, 0x00, 0x02,
+ 0x9d, 0xb8, 0x20, 0x00, 0xa0, 0xb0, 0x00, 0x02, 0xce, 0xe8, 0x20, 0x00,
+ 0xa0, 0xac, 0x00, 0x02, 0x07, 0x78, 0x20, 0x00, 0xa2, 0xe6, 0x00, 0x02,
+ 0xfc, 0x1c, 0x20, 0x00, 0xf5, 0xc4, 0x00, 0x02, 0x00, 0x02, 0x20, 0x00,
+ 0xf6, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x20, 0x00, 0xf6, 0xae, 0x00, 0x02,
+ 0x00, 0x02, 0x20, 0x00, 0xf5, 0xfa, 0x00, 0x02, 0x02, 0x00, 0x20, 0x00,
+ 0xf6, 0x18, 0x00, 0x02, 0x02, 0x00, 0x20, 0x00, 0xc5, 0xc8, 0x00, 0x04,
+ 0xc2, 0xa0, 0x07, 0xf8, 0x20, 0x00, 0xc6, 0x9a, 0x00, 0x04, 0xc2, 0xa0,
+ 0x07, 0xf8, 0x20, 0x00, 0xc6, 0xdc, 0x00, 0x04, 0xc2, 0xa0, 0x07, 0xf8,
+ 0x20, 0x00, 0xcc, 0x24, 0x00, 0x04, 0xc2, 0xa0, 0x07, 0xee, 0x20, 0x00,
+ 0xa3, 0x64, 0x00, 0x02, 0x07, 0xf8, 0x20, 0x00, 0xa3, 0x6e, 0x00, 0x02,
+ 0x07, 0xf8, 0x20, 0x00, 0xc3, 0xa6, 0x00, 0x02, 0x3f, 0xfe, 0x20, 0x00,
+ 0xa4, 0x46, 0x00, 0x02, 0x07, 0x08, 0x30, 0x00, 0x90, 0xf0, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0x92, 0x2a, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0x93, 0x5c, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 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0x00, 0xd4, 0xaa, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0xd4, 0xea, 0x00, 0x06,
+ 0xc3, 0xa0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0xd5, 0x0a, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0xd5, 0x54, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0xd5, 0xae, 0x00, 0x06,
+ 0xc3, 0xe0, 0xf0, 0x00, 0x11, 0xf8, 0x30, 0x00, 0xfb, 0x9e, 0x00, 0x06,
+ 0xc1, 0xe0, 0xf0, 0x00, 0x11, 0x14, 0x30, 0x00, 0xc7, 0x4e, 0x00, 0x06,
+ 0x01, 0x60, 0xf0, 0x00, 0x80, 0x00, 0x30, 0x00, 0xc7, 0x86, 0x00, 0x06,
+ 0x01, 0x60, 0xf0, 0x00, 0x80, 0x00, 0x30, 0x00, 0xc7, 0xbc, 0x00, 0x06,
+ 0x01, 0x60, 0xf0, 0x00, 0x80, 0x00, 0x30, 0x00, 0x95, 0x5e, 0x00, 0x04,
+ 0xed, 0x03, 0xed, 0x03, 0x30, 0x00, 0x95, 0x8a, 0x00, 0x04, 0xed, 0x03,
+ 0xed, 0x03, 0x34, 0x00, 0x91, 0xa4, 0x00, 0x02, 0x60, 0x82, 0x34, 0x00,
+ 0x92, 0x44, 0x00, 0x02, 0x60, 0x82, 0x34, 0x00, 0x93, 0x78, 0x00, 0x02,
+ 0x60, 0x82, 0x34, 0x00, 0x94, 0x7a, 0x00, 0x02, 0x68, 0x82, 0x34, 0x00,
+ 0x95, 0x32, 0x00, 0x02, 0x60, 0x82, 0x34, 0x00, 0x95, 0x6c, 0x00, 0x02,
+ 0x68, 0x82, 0x34, 0x00, 0x95, 0x98, 0x00, 0x02, 0x68, 0x82, 0x34, 0x00,
+ 0x95, 0xda, 0x00, 0x02, 0x20, 0x82, 0x38, 0x00, 0xd0, 0x76, 0x00, 0x02,
+ 0xe0, 0x82, 0x38, 0x00, 0xd0, 0xca, 0x00, 0x02, 0xe0, 0x82, 0x38, 0x00,
+ 0xd4, 0x3a, 0x00, 0x02, 0xe0, 0x82, 0x20, 0x00, 0xa0, 0x02, 0x00, 0x02,
+ 0xf9, 0xe0, 0x20, 0x00, 0xa0, 0x7a, 0x00, 0x02, 0xe5, 0x18, 0x20, 0x80,
+ 0xa0, 0x02, 0x00, 0x02, 0x5b, 0x58, 0x20, 0x80, 0xa0, 0x7a, 0x00, 0x02,
+ 0x83, 0xa0, 0x30, 0x00, 0xa0, 0x02, 0x00, 0x02, 0xae, 0x4f, 0x30, 0x00,
+ 0xa0, 0x7a, 0x00, 0x02, 0x2f, 0xfc, 0x30, 0x80, 0xa0, 0x02, 0x00, 0x02,
+ 0x0f, 0xc7, 0x30, 0x80, 0xa0, 0x7a, 0x00, 0x02, 0xce, 0x84, 0x34, 0x00,
+ 0xa0, 0x02, 0x00, 0x02, 0xae, 0x4f, 0x34, 0x00, 0xa0, 0x7a, 0x00, 0x02,
+ 0x2f, 0xf4, 0x34, 0x80, 0xa0, 0x02, 0x00, 0x02, 0x0f, 0xc7, 0x34, 0x80,
+ 0xa0, 0x7a, 0x00, 0x02, 0xce, 0x7c, 0x38, 0x00, 0xa0, 0x02, 0x00, 0x02,
+ 0xae, 0x52, 0x38, 0x00, 0xa0, 0x7a, 0x00, 0x02, 0x2f, 0xf1, 0x38, 0x80,
+ 0xa0, 0x02, 0x00, 0x02, 0x0f, 0xca, 0x38, 0x80, 0xa0, 0x7a, 0x00, 0x02,
+ 0xce, 0x79, 0x00, 0x00, 0x80, 0x00, 0x09, 0xfc, 0x53, 0x4d, 0x41, 0x43,
+ 0x2e, 0x30, 0x30, 0x2e, 0x33, 0x38, 0x20, 0x20, 0x28, 0x43, 0x29, 0x20,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x4f, 0x6c,
+ 0x69, 0x63, 0x6f, 0x6d, 0x20, 0x31, 0x39, 0x39, 0x38, 0x2e, 0x00, 0x00,
+ 0x07, 0xa0, 0x13, 0x04, 0xc4, 0x00, 0x01, 0x60, 0x09, 0x6a, 0x80, 0x00,
+ 0x16, 0x03, 0x01, 0xa0, 0x09, 0x6a, 0x00, 0x60, 0x01, 0x60, 0x09, 0x6a,
+ 0x00, 0x40, 0x16, 0x34, 0x01, 0x20, 0x13, 0x0c, 0x10, 0x00, 0x16, 0x30,
+ 0xd8, 0x20, 0x09, 0x2e, 0x13, 0x06, 0xd8, 0x20, 0x01, 0x80, 0x13, 0x08,
+ 0xd8, 0x20, 0x01, 0x82, 0x13, 0x0a, 0x07, 0xa0, 0x13, 0x00, 0x87, 0xe0,
+ 0x07, 0xa0, 0x13, 0x02, 0xed, 0xb6, 0x07, 0xa0, 0x13, 0x14, 0x00, 0x04,
+ 0x06, 0xa0, 0x84, 0xd0, 0x07, 0xa0, 0x13, 0x0c, 0x04, 0x00, 0xd8, 0x20,
+ 0xef, 0x54, 0x09, 0x2e, 0x01, 0xe0, 0x13, 0x0c, 0x10, 0x00, 0x01, 0xa0,
+ 0x13, 0x0c, 0x28, 0x00, 0x01, 0x60, 0x09, 0x6a, 0x00, 0x20, 0x16, 0x03,
+ 0x01, 0xe0, 0x13, 0x0c, 0x28, 0x00, 0x07, 0xa0, 0x13, 0x4c, 0x00, 0x02,
+ 0x02, 0x0a, 0x00, 0x02, 0x01, 0xe0, 0x13, 0x0e, 0x01, 0x80, 0x10, 0x09,
+ 0x07, 0xa0, 0x13, 0x00, 0xdb, 0xc4, 0x07, 0xa0, 0x13, 0x02, 0xea, 0xb0,
+ 0x01, 0xa0, 0x13, 0x0c, 0x38, 0x00, 0x06, 0xa0, 0xdc, 0x32, 0xc2, 0xe0,
+ 0x13, 0x00, 0x04, 0x5b, 0x01, 0x4e, 0x00, 0x40, 0x16, 0x02, 0x04, 0x60,
+ 0xcc, 0xb4, 0x02, 0x0d, 0x12, 0x00, 0x04, 0x60, 0xcc, 0xa6, 0x01, 0x60,
+ 0x13, 0x0c, 0x10, 0x00, 0x13, 0x02, 0x04, 0x60, 0xe3, 0xce, 0xc8, 0x0b,
+ 0x13, 0x52, 0x06, 0xa0, 0xe3, 0xce, 0xd8, 0x20, 0xe0, 0x0a, 0xfc, 0x06,
+ 0xc2, 0xe0, 0x13, 0x52, 0x04, 0x5b, 0x01, 0x60, 0x13, 0x0c, 0x10, 0x00,
+ 0x16, 0x06, 0x02, 0x84, 0x00, 0x12, 0x13, 0x15, 0x02, 0x84, 0x00, 0x14,
+ 0x13, 0x2d, 0x06, 0xa0, 0xe3, 0xce, 0x01, 0x60, 0x13, 0x0c, 0x10, 0x00,
+ 0x16, 0x0a, 0xd8, 0x20, 0xe0, 0x0a, 0x04, 0x06, 0x88, 0x20, 0x13, 0x54,
+ 0x03, 0xf8, 0x13, 0x03, 0x07, 0xa0, 0x03, 0xf8, 0x81, 0x8c, 0x04, 0x60,
+ 0xdb, 0x96, 0x02, 0x04, 0x00, 0x08, 0x06, 0xa0, 0xe3, 0xce, 0x07, 0xa0,
+ 0x03, 0xf8, 0x81, 0x8c, 0x02, 0x05, 0x04, 0x04, 0x02, 0x06, 0xef, 0x5c,
+ 0xcd, 0x76, 0xcd, 0x76, 0x02, 0x25, 0x00, 0x0c, 0xcd, 0x76, 0xcd, 0x76,
+ 0xcd, 0x76, 0xcd, 0x60, 0x13, 0x12, 0xcd, 0x76, 0xcd, 0x60, 0x13, 0x4c,
+ 0xcd, 0x76, 0xc5, 0x60, 0x09, 0x1e, 0x10, 0xe3, 0x02, 0x04, 0x00, 0x08,
+ 0x06, 0xa0, 0xe3, 0xce, 0x07, 0xa0, 0x03, 0xf8, 0x81, 0x8c, 0x02, 0x05,
+ 0x04, 0x04, 0x02, 0x06, 0xef, 0x6a, 0xcd, 0x76, 0xcd, 0x76, 0x02, 0x25,
+ 0x00, 0x0c, 0xcd, 0x76, 0xcd, 0x76, 0x10, 0xd1, 0x04, 0x60, 0x87, 0xe0,
+ 0x01, 0x4f, 0x00, 0x0a, 0x16, 0x03, 0x01, 0x4f, 0x00, 0x80, 0x04, 0x5b,
+ 0x04, 0x60, 0xda, 0x04, 0xc0, 0xc3, 0x13, 0x06, 0x01, 0x60, 0x13, 0x0c,
+ 0x10, 0x00, 0x16, 0x02, 0x01, 0xd6, 0x00, 0x80, 0x07, 0x86, 0x07, 0x36,
+ 0x04, 0x60, 0xe3, 0x7a, 0xa0, 0x60, 0x13, 0x02, 0xc1, 0x11, 0x04, 0x54,
+ 0x01, 0x48, 0x40, 0x00, 0x16, 0x06, 0x01, 0x88, 0x40, 0x00, 0x02, 0x28,
+ 0xef, 0x00, 0x04, 0x60, 0xe0, 0x36, 0x02, 0x28, 0xe3, 0xee, 0x04, 0x60,
+ 0xe0, 0x36, 0x01, 0x60, 0x13, 0x0c, 0x10, 0x00, 0x16, 0x06, 0x02, 0x85,
+ 0x00, 0x12, 0x13, 0x0a, 0x02, 0x85, 0x00, 0x14, 0x13, 0x07, 0x02, 0x85,
+ 0x00, 0x15, 0x13, 0x24, 0x02, 0x85, 0x00, 0x10, 0x04, 0x60, 0xdd, 0x4c,
+ 0x02, 0x03, 0x80, 0x02, 0x88, 0x24, 0x00, 0x14, 0xe0, 0x1c, 0x16, 0x19,
+ 0x05, 0x83, 0x05, 0x83, 0x92, 0x60, 0xef, 0x9e, 0x16, 0x14, 0x05, 0x83,
+ 0x99, 0x20, 0xe0, 0x0e, 0x00, 0x18, 0x16, 0x0f, 0x05, 0x83, 0x05, 0x83,
+ 0x02, 0x85, 0x00, 0x12, 0x16, 0x05, 0x99, 0x20, 0xef, 0xa0, 0x00, 0x19,
+ 0x16, 0x06, 0x10, 0x04, 0x99, 0x20, 0xef, 0xa1, 0x00, 0x19, 0x16, 0x01,
+ 0x04, 0xc3, 0x04, 0x5c, 0x02, 0x03, 0x80, 0x02, 0x88, 0x24, 0x00, 0x14,
+ 0xe0, 0x1e, 0x16, 0xf9, 0x05, 0x83, 0x05, 0x83, 0x92, 0x60, 0xef, 0x9e,
+ 0x16, 0xf4, 0x04, 0xc3, 0x10, 0xf2, 0x02, 0x85, 0x00, 0x15, 0x13, 0x09,
+ 0x02, 0x85, 0x00, 0x09, 0x13, 0x02, 0x06, 0xa0, 0xe2, 0xe4, 0xa1, 0x45,
+ 0xc1, 0x65, 0xe3, 0xac, 0x04, 0x55, 0x06, 0xa0, 0xe1, 0xa2, 0x01, 0x60,
+ 0x13, 0x0c, 0x04, 0x00, 0x16, 0x19, 0x01, 0x4f, 0x00, 0x80, 0x16, 0x09,
+ 0x01, 0xe0, 0x13, 0x0e, 0x20, 0x00, 0x02, 0x03, 0x80, 0x10, 0x06, 0xa0,
+ 0xe3, 0x56, 0x06, 0xa0, 0xe2, 0x72, 0x01, 0xe0, 0x13, 0x0e, 0x00, 0x10,
+ 0x07, 0xa0, 0x13, 0x00, 0x87, 0xe0, 0x07, 0xa0, 0x13, 0x02, 0xed, 0xb6,
+ 0x01, 0x8f, 0x00, 0x80, 0x02, 0x0a, 0x00, 0x08, 0x04, 0x60, 0x80, 0xbe,
+ 0x02, 0x0d, 0x80, 0x00, 0x01, 0x60, 0x13, 0x0c, 0x10, 0x00, 0x16, 0x02,
+ 0x02, 0x0d, 0x80, 0x80, 0x04, 0x52, 0x01, 0x60, 0x13, 0x0e, 0x20, 0x00,
+ 0x16, 0x02, 0x02, 0x03, 0x82, 0x00, 0x04, 0x60, 0xdb, 0xb8, 0x02, 0x8f,
+ 0x00, 0x06, 0x16, 0x56, 0x01, 0xe0, 0x13, 0x0e, 0x00, 0xa0, 0x05, 0xa0,
+ 0x13, 0x16, 0x06, 0xa0, 0x85, 0x30, 0x02, 0x08, 0xc0, 0x00, 0x06, 0xa0,
+ 0xe0, 0x22, 0x01, 0xcd, 0x04, 0x00, 0x10, 0x48, 0x02, 0x8f, 0x00, 0x02,
+ 0x16, 0x45, 0x02, 0x08, 0xc0, 0x42, 0x06, 0xa0, 0xe0, 0x22, 0x01, 0xcd,
+ 0x08, 0x00, 0x10, 0x3e, 0x93, 0xe0, 0xef, 0xa3, 0x13, 0x03, 0x93, 0xe0,
+ 0xef, 0xa4, 0x16, 0x38, 0xd2, 0xa0, 0xef, 0xa5, 0x10, 0x35, 0x02, 0x8f,
+ 0x00, 0x06, 0x16, 0x32, 0x02, 0x03, 0x00, 0x03, 0x04, 0x60, 0x82, 0xc2,
+ 0x93, 0xe0, 0xef, 0xa5, 0x16, 0x2b, 0x01, 0xe0, 0x13, 0x0e, 0x00, 0x80,
+ 0x06, 0xa0, 0x85, 0x30, 0x04, 0xcf, 0x02, 0x0a, 0x00, 0x04, 0x02, 0x08,
+ 0xc0, 0x1e, 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x03, 0x68, 0x00, 0x06, 0xa0,
+ 0xe3, 0x56, 0x02, 0x03, 0x80, 0x10, 0x06, 0xa0, 0xe3, 0x56, 0x10, 0x16,
+ 0x02, 0x8f, 0x00, 0x04, 0x16, 0x13, 0x02, 0x03, 0x00, 0x03, 0x04, 0x60,
+ 0x82, 0xc2, 0x02, 0x8f, 0x00, 0x02, 0x16, 0x7a, 0x01, 0x60, 0x13, 0x0e,
+ 0x00, 0x08, 0x16, 0x02, 0x04, 0x60, 0x85, 0x56, 0x02, 0x0a, 0x00, 0x04,
+ 0x02, 0x08, 0xc0, 0x1e, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x6d, 0x01, 0x60,
+ 0x13, 0x0e, 0x40, 0x00, 0x16, 0x69, 0x02, 0x8f, 0x00, 0x06, 0x16, 0x07,
+ 0x01, 0xe0, 0x13, 0x0e, 0x00, 0xa0, 0x05, 0xa0, 0x13, 0x16, 0x06, 0xa0,
+ 0x85, 0x30, 0x02, 0x08, 0xc0, 0x30, 0x06, 0xa0, 0xe0, 0x22, 0x01, 0xcd,
+ 0x01, 0x00, 0x10, 0x58, 0x93, 0xe0, 0xef, 0xa3, 0x16, 0x55, 0x02, 0x08,
+ 0xc0, 0x36, 0x06, 0xa0, 0xe0, 0x22, 0x07, 0xa0, 0x07, 0x08, 0x00, 0x05,
+ 0x01, 0x60, 0x13, 0x0e, 0x04, 0x00, 0x16, 0x03, 0x07, 0xa0, 0x07, 0x08,
+ 0x00, 0x02, 0x02, 0x05, 0x03, 0xf8, 0x02, 0x04, 0x00, 0x04, 0x04, 0x60,
+ 0x80, 0xfa, 0xc1, 0x20, 0x01, 0x84, 0x02, 0x44, 0x88, 0x00, 0x13, 0x12,
+ 0x48, 0x04, 0x01, 0x84, 0x06, 0x20, 0x07, 0x02, 0x16, 0x08, 0x01, 0xe0,
+ 0x13, 0x0e, 0x04, 0x00, 0x07, 0x83, 0xc0, 0x00, 0x06, 0xa0, 0xe3, 0x56,
+ 0x10, 0x2f, 0x02, 0x08, 0xc0, 0x3c, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x2a,
+ 0x01, 0xe0, 0x01, 0x82, 0x40, 0x00, 0x06, 0xa0, 0xe0, 0x18, 0x07, 0x20,
+ 0x07, 0x02, 0x01, 0x8e, 0x80, 0x00, 0x01, 0xa0, 0x13, 0x0e, 0x06, 0x00,
+ 0x10, 0x1d, 0x02, 0x8f, 0x00, 0x02, 0x16, 0x1a, 0x01, 0x20, 0x13, 0x0e,
+ 0x00, 0x40, 0x16, 0x16, 0xc2, 0x20, 0x13, 0x14, 0x13, 0x09, 0x06, 0x20,
+ 0x13, 0x14, 0x02, 0x08, 0xc0, 0x42, 0x06, 0xa0, 0xe0, 0x22, 0x01, 0xcd,
+ 0x08, 0x00, 0x10, 0x0a, 0x01, 0x60, 0x13, 0x0c, 0x20, 0x00, 0x13, 0x02,
+ 0x04, 0x60, 0x85, 0x56, 0x02, 0x03, 0x00, 0x05, 0x04, 0x60, 0x82, 0xc2,
+ 0x04, 0x60, 0x87, 0xe0, 0x02, 0x8f, 0x00, 0x06, 0x16, 0x04, 0x02, 0x03,
+ 0x00, 0x05, 0x04, 0x60, 0x82, 0xc2, 0x01, 0x60, 0x13, 0x0e, 0x20, 0x00,
+ 0x16, 0xf3, 0x93, 0xe0, 0xef, 0xa2, 0x16, 0xf0, 0x01, 0xa0, 0x13, 0x0e,
+ 0x50, 0x80, 0x06, 0xa0, 0x85, 0x30, 0x01, 0xce, 0x00, 0x01, 0xd2, 0xa0,
+ 0xef, 0xa3, 0x07, 0xa0, 0x07, 0x08, 0x00, 0x05, 0x01, 0x60, 0x13, 0x0e,
+ 0x04, 0x00, 0x16, 0x03, 0x07, 0xa0, 0x07, 0x08, 0x00, 0x02, 0x02, 0x08,
+ 0xc0, 0x36, 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x08, 0xc0, 0x0c, 0x06, 0xa0,
+ 0xe0, 0x22, 0x02, 0x08, 0xc0, 0x18, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0xd0,
+ 0x02, 0x8f, 0x00, 0x08, 0x16, 0xcd, 0x07, 0xa0, 0x13, 0x14, 0x00, 0x0c,
+ 0x04, 0x60, 0x80, 0x74, 0xc3, 0x0b, 0x06, 0xa0, 0x85, 0x48, 0x06, 0xa0,
+ 0x84, 0xf2, 0xc2, 0xcc, 0x04, 0xe0, 0x13, 0x0e, 0x04, 0xe0, 0x13, 0x16,
+ 0x04, 0xe0, 0x06, 0xdc, 0x04, 0xe0, 0x06, 0xde, 0x04, 0xe0, 0x06, 0xe0,
+ 0x04, 0x5b, 0x02, 0x06, 0x00, 0x05, 0x02, 0x04, 0x13, 0x1a, 0xc1, 0x54,
+ 0x13, 0x01, 0x2c, 0xd4, 0x02, 0x24, 0x00, 0x0a, 0x06, 0x06, 0x16, 0xf9,
+ 0x04, 0x5b, 0x02, 0x06, 0x00, 0x05, 0x02, 0x04, 0x06, 0x72, 0xc1, 0x54,
+ 0x13, 0x01, 0x2c, 0xd4, 0x02, 0x24, 0x00, 0x0a, 0x06, 0x06, 0x16, 0xf9,
+ 0x04, 0x5b, 0x01, 0x60, 0x13, 0x0e, 0x08, 0x00, 0x16, 0x03, 0x01, 0xe0,
+ 0x01, 0x82, 0x20, 0x00, 0x01, 0x60, 0x13, 0x0e, 0x00, 0x80, 0x16, 0x04,
+ 0x01, 0xe0, 0x01, 0x82, 0x0a, 0x00, 0x10, 0x03, 0x01, 0xa0, 0x01, 0x82,
+ 0x0a, 0x00, 0x04, 0x5b, 0x01, 0xa0, 0x01, 0x82, 0x28, 0x00, 0x01, 0xe0,
+ 0x01, 0x82, 0x10, 0x00, 0x04, 0x5b, 0x06, 0xa0, 0x84, 0xf2, 0x04, 0xe0,
+ 0x13, 0x0e, 0xd8, 0x20, 0x13, 0x06, 0x09, 0x2e, 0xd8, 0x20, 0x13, 0x08,
+ 0x01, 0x80, 0xd8, 0x20, 0x13, 0x0a, 0x01, 0x82, 0x06, 0xa0, 0xe0, 0x18,
+ 0x04, 0x60, 0xe5, 0x62, 0xc0, 0x62, 0x00, 0x04, 0xc8, 0x22, 0x00, 0x06,
+ 0x01, 0x6c, 0x02, 0x82, 0x04, 0x00, 0x1b, 0x0d, 0x01, 0x8e, 0x08, 0x00,
+ 0x02, 0x8f, 0x00, 0x06, 0x16, 0x08, 0x06, 0x20, 0x13, 0x16, 0x16, 0x05,
+ 0x01, 0xa0, 0x13, 0x0e, 0x00, 0xa0, 0x06, 0xa0, 0x85, 0x30, 0xc1, 0x22,
+ 0x00, 0x0e, 0x04, 0x51, 0xc8, 0x02, 0x01, 0x6c, 0xa0, 0x82, 0xc8, 0x22,
+ 0x0c, 0x32, 0xfc, 0x00, 0x02, 0x02, 0xfc, 0x00, 0x93, 0xe0, 0xe3, 0xaa,
+ 0x13, 0x71, 0x06, 0xa0, 0xdc, 0xc6, 0x01, 0xa2, 0x00, 0x0e, 0x80, 0x00,
+ 0xc8, 0x05, 0x06, 0xfc, 0xc0, 0xc3, 0x16, 0x43, 0x01, 0x22, 0x00, 0x16,
+ 0x0f, 0x00, 0x16, 0x10, 0x88, 0x22, 0x00, 0x0e, 0x09, 0x6c, 0x16, 0x0c,
+ 0x88, 0x22, 0x00, 0x10, 0x09, 0x6e, 0x16, 0x08, 0x88, 0x22, 0x00, 0x12,
+ 0x09, 0x70, 0x16, 0x04, 0x06, 0xa0, 0xe1, 0xa2, 0x04, 0x60, 0x87, 0xe0,
+ 0x98, 0xa0, 0xef, 0xa6, 0x00, 0x16, 0x13, 0x04, 0x98, 0xa0, 0xef, 0xa7,
+ 0x00, 0x16, 0x16, 0x15, 0xc2, 0xe0, 0x06, 0xdc, 0x16, 0x06, 0xc2, 0xe0,
+ 0x06, 0xde, 0x16, 0x03, 0xc2, 0xe0, 0x06, 0xe0, 0x13, 0x0c, 0x88, 0x22,
+ 0x00, 0x0e, 0x06, 0xdc, 0x16, 0x71, 0x88, 0x22, 0x00, 0x10, 0x06, 0xde,
+ 0x16, 0x6d, 0x88, 0x22, 0x00, 0x12, 0x06, 0xe0, 0x16, 0x69, 0x02, 0x85,
+ 0x00, 0x09, 0x13, 0x0b, 0x02, 0x85, 0x00, 0x15, 0x13, 0x08, 0x02, 0x85,
+ 0x00, 0x12, 0x13, 0x0d, 0x02, 0x85, 0x00, 0x14, 0x13, 0x0e, 0x06, 0xa0,
+ 0xe2, 0xe4, 0xa1, 0x45, 0xc1, 0x65, 0xef, 0x72, 0x04, 0x55, 0x06, 0xa0,
+ 0xe0, 0x6e, 0x04, 0x60, 0x87, 0xe0, 0xc8, 0x24, 0x00, 0x1a, 0x13, 0x4e,
+ 0x10, 0xf4, 0xc8, 0x24, 0x00, 0x1a, 0x13, 0x50, 0x10, 0xf0, 0x01, 0x20,
+ 0x13, 0x0e, 0x02, 0x00, 0x16, 0x07, 0x04, 0xe0, 0x01, 0x84, 0x01, 0xa0,
+ 0x01, 0x82, 0x40, 0x00, 0x06, 0xa0, 0xe0, 0x18, 0x07, 0xa0, 0x07, 0x02,
+ 0x00, 0x04, 0x01, 0xe0, 0x13, 0x0e, 0x02, 0x00, 0x01, 0xce, 0x80, 0x00,
+ 0x02, 0x08, 0xc0, 0x3c, 0x06, 0xa0, 0xe0, 0x22, 0x04, 0x60, 0x87, 0xe0,
+ 0x06, 0xa0, 0xe1, 0xa2, 0x04, 0x60, 0x87, 0xe0, 0x06, 0xa0, 0xe1, 0xa2,
+ 0x02, 0x03, 0x00, 0x05, 0x01, 0x4f, 0x00, 0x80, 0x16, 0x02, 0x02, 0x03,
+ 0x82, 0x00, 0x04, 0x60, 0x82, 0xc2, 0x01, 0x60, 0x13, 0x0e, 0x20, 0x00,
+ 0x16, 0x24, 0x93, 0xe0, 0xef, 0xa2, 0x16, 0x0c, 0x01, 0x60, 0x13, 0x0e,
+ 0x20, 0x00, 0x16, 0x28, 0x02, 0x03, 0xa0, 0x00, 0x06, 0xa0, 0xe3, 0x56,
+ 0x01, 0xa0, 0x13, 0x0e, 0x50, 0x00, 0x10, 0x03, 0x93, 0xe0, 0xef, 0xa3,
+ 0x16, 0x1d, 0x01, 0xce, 0x00, 0x02, 0xd2, 0xa0, 0xef, 0xa4, 0x02, 0x08,
+ 0xc0, 0x0c, 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x08, 0xc0, 0x18, 0x06, 0xa0,
+ 0xe0, 0x22, 0x10, 0x10, 0x06, 0xa0, 0xe1, 0xa2, 0x02, 0x03, 0x00, 0x0b,
+ 0x10, 0x04, 0x06, 0xa0, 0xe1, 0xa2, 0x02, 0x03, 0x00, 0x05, 0x01, 0x4f,
+ 0x00, 0x80, 0x16, 0x02, 0x02, 0x03, 0x82, 0x00, 0x04, 0x60, 0x82, 0xc2,
+ 0x10, 0xbd, 0x02, 0x8f, 0x00, 0x02, 0x13, 0xf1, 0x02, 0x8f, 0x00, 0x04,
+ 0x13, 0xee, 0x01, 0x60, 0x13, 0x0e, 0x40, 0x00, 0x16, 0xf5, 0x02, 0x08,
+ 0xc0, 0x48, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0xf0, 0x02, 0x8f, 0x00, 0x02,
+ 0x16, 0xab, 0xc0, 0xe0, 0x13, 0x4e, 0x16, 0x0e, 0x01, 0x60, 0x13, 0x0c,
+ 0x08, 0x00, 0x13, 0xa8, 0x01, 0xe0, 0x13, 0x0e, 0x00, 0x48, 0x06, 0xa0,
+ 0xe1, 0xa2, 0x02, 0x08, 0xc0, 0x24, 0x06, 0xa0, 0xe0, 0x22, 0x10, 0x22,
+ 0x02, 0x83, 0x00, 0x02, 0x16, 0xd9, 0xc8, 0x24, 0x00, 0x0e, 0x06, 0xdc,
+ 0xc8, 0x24, 0x00, 0x10, 0x06, 0xde, 0xc8, 0x24, 0x00, 0x12, 0x06, 0xe0,
+ 0x06, 0xa0, 0xe1, 0xa2, 0x02, 0x08, 0xc0, 0x24, 0x06, 0xa0, 0xe0, 0x22,
+ 0x01, 0xe0, 0x13, 0x0e, 0x00, 0x40, 0xc0, 0xe0, 0x13, 0x12, 0x16, 0x04,
+ 0x01, 0xa0, 0x13, 0x0e, 0x08, 0x01, 0x10, 0x06, 0x02, 0x83, 0x00, 0x01,
+ 0x16, 0x03, 0x01, 0xe0, 0x13, 0x0e, 0x08, 0x01, 0x10, 0x17, 0x02, 0x8f,
+ 0x00, 0x06, 0x16, 0xb6, 0xc0, 0xe0, 0x13, 0x50, 0x02, 0x83, 0x00, 0x00,
+ 0x16, 0x05, 0x06, 0xa0, 0xe1, 0xa2, 0x02, 0x0a, 0x00, 0x0a, 0x10, 0x0a,
+ 0x02, 0x83, 0x80, 0x20, 0x16, 0x04, 0x02, 0x03, 0x00, 0x08, 0x04, 0x60,
+ 0x82, 0xc2, 0x16, 0xa4, 0x04, 0x60, 0xda, 0x04, 0x92, 0xa0, 0xe0, 0x26,
+ 0x16, 0x0d, 0xd3, 0xe0, 0xe0, 0x26, 0x01, 0x4f, 0x00, 0x80, 0x13, 0x07,
+ 0xc1, 0x0a, 0x83, 0xc4, 0x13, 0x08, 0xc3, 0xc4, 0xc1, 0x24, 0xed, 0xd6,
+ 0x04, 0x54, 0x10, 0x03, 0x93, 0xca, 0x13, 0xec, 0xd3, 0xca, 0x03, 0xb0,
+ 0xd8, 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, 0x06, 0x20, 0x06, 0xc8, 0x16, 0xc5, 0x04, 0x60,
+ 0xe6, 0x6a, 0xd8, 0x20, 0xef, 0x54, 0x09, 0x2e, 0xd8, 0x20, 0xef, 0x54,
+ 0x01, 0x80, 0xd8, 0x20, 0xef, 0x56, 0x01, 0x82, 0x06, 0xa0, 0xe0, 0x18,
+ 0x01, 0xe0, 0x13, 0x0e, 0x40, 0x20, 0x07, 0xa0, 0x13, 0x16, 0x00, 0x01,
+ 0x02, 0x08, 0xc0, 0x30, 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x08, 0xc0, 0x48,
+ 0x06, 0xa0, 0xe0, 0x22, 0x02, 0x08, 0xc0, 0x12, 0x06, 0xa0, 0xe0, 0x22,
+ 0x02, 0x08, 0xc0, 0x00, 0x06, 0xa0, 0xe0, 0x22, 0x01, 0xcd, 0x04, 0x00,
+ 0x04, 0x60, 0x87, 0xe0, 0x06, 0xa0, 0x85, 0x48, 0x01, 0xce, 0x00, 0x20,
+ 0x2e, 0xe0, 0x00, 0x00, 0x04, 0xcd, 0x06, 0xa0, 0x85, 0x0a, 0x02, 0x08,
+ 0xc0, 0x4e, 0x06, 0xa0, 0xe0, 0x22, 0x04, 0x60, 0x87, 0xe0, 0x01, 0xa0,
+ 0x13, 0x0e, 0x00, 0x80, 0x06, 0xa0, 0x85, 0x22, 0x01, 0xcf, 0x00, 0x80,
+ 0x01, 0xe0, 0x13, 0x0e, 0x10, 0x00, 0x01, 0x60, 0x13, 0x0e, 0x00, 0x01,
+ 0x16, 0x04, 0x07, 0x88, 0x80, 0x06, 0x06, 0xa0, 0xe0, 0x22, 0x01, 0x20,
+ 0x13, 0x0e, 0x20, 0x00, 0x16, 0x07, 0x01, 0xe0, 0x13, 0x0e, 0x20, 0x00,
+ 0x04, 0xc3, 0x06, 0xa0, 0xe3, 0x56, 0x10, 0x0e, 0x01, 0x8e, 0x00, 0x03,
+ 0x02, 0x03, 0x00, 0x10, 0x06, 0xa0, 0xe3, 0x56, 0x01, 0x60, 0x13, 0x0e,
+ 0x00, 0x10, 0x16, 0x04, 0x02, 0x03, 0x80, 0x08, 0x06, 0xa0, 0xe3, 0x56,
+ 0xc8, 0x20, 0xe4, 0x6e, 0x01, 0x86, 0x2e, 0xe0, 0x00, 0x01, 0x01, 0x8e,
+ 0x00, 0x20, 0x04, 0x60, 0x87, 0xdc, 0x02, 0x03, 0xa8, 0x00, 0x01, 0x60,
+ 0x07, 0x08, 0x00, 0x02, 0x16, 0x02, 0x02, 0x03, 0xe8, 0x00, 0x06, 0xa0,
+ 0xe3, 0x56, 0x01, 0x4e, 0x00, 0x20, 0x13, 0x06, 0x01, 0xce, 0x00, 0x20,
+ 0x2e, 0xe0, 0x00, 0x00, 0xc0, 0x41, 0x16, 0xfa, 0x06, 0xa0, 0xe1, 0x2e,
+ 0x02, 0x4a, 0xff, 0x00, 0x02, 0x4f, 0xff, 0x80, 0x02, 0x05, 0x03, 0xf8,
+ 0x02, 0x04, 0x00, 0x04, 0x04, 0x60, 0x80, 0xfa, 0x02, 0x4a, 0xff, 0x00,
+ 0x02, 0x4f, 0xff, 0x80, 0x04, 0x60, 0x87, 0xdc, 0x06, 0xa0, 0x85, 0x48,
+ 0x04, 0x60, 0x87, 0xdc, 0x06, 0xa0, 0x84, 0xf2, 0x04, 0xe0, 0x13, 0x0e,
+ 0x01, 0xce, 0x00, 0x08, 0x04, 0x60, 0xe7, 0xf6, 0x00, 0x00, 0x89, 0xfc,
+ 0x06, 0x05, 0x00, 0x00, 0x00, 0x00, 0xad, 0x90, 0x00, 0x62, 0xc0, 0x80,
+ 0x13, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x00, 0xdb, 0xc4, 0x00, 0x02,
+ 0x13, 0x02, 0xea, 0xb0, 0x00, 0x02, 0x13, 0x54, 0xdc, 0x16, 0x00, 0x02,
+ 0x09, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x13, 0x12, 0x00, 0x01, 0x00, 0x00,
+ 0xda, 0x88, 0xda, 0x7c, 0x86, 0x6e, 0xda, 0xa6, 0xda, 0x9e, 0xdb, 0x86,
+ 0xdb, 0x86, 0xdb, 0x86, 0xda, 0xa8, 0x85, 0xa8, 0x85, 0x78, 0xdb, 0x78,
+ 0xdb, 0x86, 0xdb, 0x86, 0xdb, 0x86, 0xdb, 0x86, 0xdb, 0x9e, 0x88, 0x14,
+ 0x88, 0x44, 0x88, 0xca, 0x89, 0x14, 0x89, 0x32, 0xdb, 0xf6, 0x89, 0x9a,
+ 0x89, 0xd8, 0x89, 0xe4, 0xe4, 0x6e, 0xdb, 0x9e, 0x89, 0xec, 0xdb, 0x9e,
+ 0x00, 0x00, 0xaf, 0x00, 0x00, 0xa8, 0x13, 0x24, 0x82, 0xd2, 0x00, 0x14,
+ 0x13, 0x1a, 0x82, 0xf4, 0x00, 0x04, 0x13, 0x38, 0x83, 0x08, 0x02, 0xbc,
+ 0x13, 0x1a, 0x83, 0x1a, 0x07, 0x08, 0x13, 0x1a, 0x83, 0x28, 0x03, 0xe8,
+ 0x13, 0x1a, 0x83, 0x58, 0x00, 0xf0, 0x13, 0x1a, 0x83, 0x66, 0x00, 0x14,
+ 0x13, 0x24, 0x88, 0xb6, 0x00, 0x04, 0x13, 0x2e, 0x83, 0x86, 0x00, 0x64,
+ 0x13, 0x2e, 0x83, 0xb0, 0x00, 0x02, 0x13, 0x42, 0x83, 0xde, 0x00, 0x05,
+ 0x13, 0x1a, 0x84, 0x26, 0x00, 0x04, 0x13, 0x38, 0x84, 0x64, 0x01, 0xf4,
+ 0x13, 0x1a, 0x84, 0xc0, 0x00, 0x14, 0xae, 0x00, 0xd9, 0x00, 0x02, 0x00,
+ 0xd9, 0x00, 0x00, 0x1e, 0x10, 0x00, 0x00, 0x10, 0x30, 0x11, 0x04, 0x0c,
+ 0x04, 0x0e, 0x04, 0x21, 0x00, 0x12, 0x10, 0x00, 0x00, 0x04, 0x30, 0x13,
+ 0xdb, 0xa8, 0xe8, 0x7c, 0x86, 0xbe, 0x86, 0xa8, 0x86, 0xa8, 0x87, 0x26,
+ 0x86, 0xa8, 0xeb, 0xf2, 0xdb, 0xa8, 0x86, 0xa0, 0xec, 0x04, 0xe8, 0x62,
+ 0xec, 0x10, 0xec, 0x10, 0xed, 0x3a, 0xed, 0x44, 0xed, 0x4e, 0x86, 0xa0,
+ 0x87, 0x44, 0x86, 0xa0, 0x87, 0xb2, 0x86, 0xa0, 0x03, 0x00, 0x0f, 0x0d,
+ 0x00, 0x02, 0x04, 0x06, 0x00, 0x03, 0x00, 0x00, 0xb2, 0xa8, 0x00, 0x02,
+ 0x80, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00,
+ 0xf8, 0x08, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0xb9, 0x0c, 0x00, 0x06,
+ 0x48, 0x20, 0x13, 0x04, 0x01, 0x80, 0x00, 0x00, 0xba, 0x38, 0x00, 0x06,
+ 0x48, 0x20, 0x13, 0x04, 0x01, 0x80, 0x00, 0x00, 0xbc, 0x88, 0x00, 0x06,
+ 0x48, 0x20, 0x13, 0x04, 0x01, 0x80, 0x00, 0x00, 0xca, 0xaa, 0x00, 0x04,
+ 0x04, 0x60, 0x82, 0xb0, 0x00, 0x00, 0xc8, 0x2c, 0x00, 0x02, 0x06, 0x09,
+ 0x00, 0x00, 0xcc, 0x60, 0x00, 0x02, 0x06, 0x09, 0x00, 0x00, 0xdb, 0x1c,
+ 0x00, 0x04, 0x04, 0x60, 0x82, 0x56, 0x00, 0x00, 0xe0, 0xc8, 0x00, 0x02,
+ 0x80, 0xda, 0x00, 0x00, 0xed, 0x74, 0x00, 0x02, 0x80, 0xda, 0x00, 0x00,
+ 0xed, 0x94, 0x00, 0x02, 0x80, 0xda, 0x00, 0x00, 0xe7, 0xae, 0x00, 0x04,
+ 0x06, 0xa0, 0x81, 0x90, 0x00, 0x00, 0xe5, 0xb0, 0x00, 0x04, 0x04, 0x60,
+ 0x80, 0x28, 0x00, 0x00, 0xdb, 0xc0, 0x00, 0x04, 0x04, 0x60, 0x80, 0xbe,
+ 0x00, 0x00, 0xda, 0x76, 0x00, 0x04, 0x04, 0x60, 0x81, 0xb8, 0x00, 0x00,
+ 0xe0, 0x32, 0x00, 0x04, 0x04, 0x60, 0x81, 0xc0, 0x00, 0x00, 0xdb, 0x92,
+ 0x00, 0x04, 0x04, 0x60, 0x80, 0xfa, 0x00, 0x00, 0xe3, 0x76, 0x00, 0x04,
+ 0x04, 0x60, 0x81, 0xa0, 0x00, 0x00, 0xdd, 0x48, 0x00, 0x04, 0x04, 0x60,
+ 0x81, 0xda, 0x00, 0x00, 0xcc, 0xa2, 0x00, 0x04, 0x04, 0x60, 0x80, 0xc8,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00
+};
diff --git a/sys/contrib/ia64/libuwx/src/Makefile b/sys/contrib/ia64/libuwx/src/Makefile
new file mode 100644
index 0000000..fa5b8f5
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/Makefile
@@ -0,0 +1,64 @@
+# Makefile for IPF unwind express library, libuwx.
+#
+# To build a cross-unwind library (i.e., one hosted on a
+# non-IPF, non-HP-UX system), omit the "self" callbacks
+# and the dependency on libuca by setting SELFOBJS and
+# SELFLIBS to empty strings.
+
+AR = ar
+RANLIB = :
+
+OTHERCFLAGS =
+# OTHERCFLAGS = -DUWX_TRACE_ENABLE # Enables trace output
+# OTHERCFLAGS = +DD64 # Builds 64-bit library
+
+CFLAGS = -O $(OTHERCFLAGS)
+
+OBJS = uwx_bstream.o uwx_context.o uwx_env.o uwx_scoreboard.o \
+ uwx_step.o uwx_str.o uwx_swap.o uwx_trace.o uwx_uinfo.o \
+ uwx_utable.o
+
+# SELFOBJS = # For cross-unwind library
+SELFOBJS = uwx_self.o uwx_self_context.o uwx_ttrace.o
+
+# SELFLIBS = # For cross-unwind library
+SELFLIBS = -luca
+
+libuwx.a: $(OBJS) $(SELFOBJS)
+ $(AR) rv libuwx.a $?
+ $(RANLIB) libuwx.a
+
+libuwx.so: $(OBJS) $(SELFOBJS)
+ ld -b -o libuwx.so $(OBJS) $(SELFOBJS) $(SELFLIBS)
+
+libuwx.sl: $(OBJS) $(SELFOBJS)
+ ld -b -o libuwx.sl $(OBJS) $(SELFOBJS) $(SELFLIBS)
+
+uwx_bstream.o: uwx.h uwx_env.h uwx_bstream.h
+
+uwx_context.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_step.h uwx_trace.h
+
+uwx_env.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_str.h uwx_trace.h
+
+uwx_scoreboard.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_trace.h
+
+uwx_step.o: uwx.h uwx_env.h uwx_context.h uwx_utable.h \
+ uwx_uinfo.h uwx_scoreboard.h uwx_str.h uwx_trace.h
+
+uwx_str.o: uwx.h uwx_env.h uwx_str.h
+
+uwx_swap.o: uwx.h uwx_env.h uwx_swap.h
+
+uwx_trace.o: uwx.h uwx_env.h uwx_uinfo.h uwx_scoreboard.h uwx_trace.h
+
+uwx_uinfo.o: uwx.h uwx_env.h uwx_uinfo.h uwx_utable.h \
+ uwx_scoreboard.h uwx_bstream.h uwx_trace.h
+
+uwx_utable.o: uwx.h uwx_env.h uwx_utable.h uwx_swap.h uwx_trace.h
+
+uwx_self.o: uwx.h uwx_env.h uwx_context.h uwx_trace.h uwx_self.h
+
+uwx_self_context.o: uwx_self_context.s
+ $(CC) -c $(CFLAGS) -o uwx_self_context.o uwx_self_context.s
+
+uwx_ttrace.o: uwx.h uwx_env.h uwx_context.h uwx_trace.h uwx_ttrace.h
diff --git a/sys/contrib/ia64/libuwx/src/uwx.h b/sys/contrib/ia64/libuwx/src/uwx.h
new file mode 100644
index 0000000..a2d318d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx.h
@@ -0,0 +1,257 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <stdlib.h>
+#include <inttypes.h>
+#else
+#include <sys/param.h>
+#include <sys/systm.h>
+#endif
+
+/* Unwind environment structure (opaque) */
+struct uwx_env;
+
+/* Allocate and free callbacks */
+typedef void *(*alloc_cb)(size_t size);
+typedef void (*free_cb)(void *ptr);
+extern int uwx_register_alloc_cb(alloc_cb alloc, free_cb free);
+
+/* Allocate and initialize an unwind environment */
+extern struct uwx_env *uwx_init(void);
+
+/* Free an unwind environment */
+extern int uwx_free(struct uwx_env *env);
+
+/* Put unwind express into cross-process mode */
+extern int uwx_set_remote(struct uwx_env *env, int is_big_endian_target);
+
+/* Copy-in callback */
+typedef int (*copyin_cb)(
+ int request, /* request code (see below) */
+ char *loc, /* local (destination) address */
+ uint64_t rem, /* remote (source) address */
+ int len, /* number of bytes to copy */
+ intptr_t tok); /* callback token */
+
+/* Lookup IP callback */
+typedef int (*lookupip_cb)(
+ int request, /* request code (see below) */
+ uint64_t ip, /* IP of current frame */
+ intptr_t tok, /* callback token */
+ uint64_t **vecp); /* parameter vector (in/out) */
+
+/* Register copy-in and lookup IP callbacks */
+extern int uwx_register_callbacks(
+ struct uwx_env *env, /* unwind environment */
+ intptr_t tok, /* callback token */
+ copyin_cb copyin, /* copy-in callback */
+ lookupip_cb lookupip); /* lookup IP callback */
+
+/* Initialize a context with the basic info needed to start an unwind */
+extern int uwx_init_context(
+ struct uwx_env *env, /* unwind environment */
+ uint64_t ip, /* IP (instruction pointer) */
+ uint64_t sp, /* SP (stack pointer) */
+ uint64_t bsp, /* BSP (backing store pointer) */
+ uint64_t cfm); /* CFM (current frame marker) */
+
+/* Set the value of a specific register in the current context (non fp) */
+extern int uwx_set_reg(
+ struct uwx_env *env, /* unwind environment */
+ int regid, /* register id (see below) */
+ uint64_t val); /* register value */
+
+/* Set the value of a floating-point register in the current context */
+extern int uwx_set_fr(
+ struct uwx_env *env, /* unwind environment */
+ int regid, /* register id (see below) */
+ uint64_t *val); /* register value (ptr to 16 bytes) */
+ /* (memory spill format) */
+
+/* Initialize the unwind history */
+extern int uwx_init_history(struct uwx_env *env);
+
+/* Step one frame */
+extern int uwx_step(struct uwx_env *env);
+
+/* Get symbol information, if available, for current frame */
+extern int uwx_get_sym_info(
+ struct uwx_env *env, /* unwind environment */
+ char **modp, /* load module name (out) */
+ char **symp, /* function name (out) */
+ uint64_t *offsetp); /* offset from start of function (out) */
+
+/* Get the value of a register from the current context */
+extern int uwx_get_reg(
+ struct uwx_env *env, /* unwind environment */
+ int regid, /* register id (see below) */
+ uint64_t *valp); /* register value (out) */
+
+/* Get the NaT bit of a GR from the current context */
+extern int uwx_get_nat(
+ struct uwx_env *env, /* unwind environment */
+ int regid, /* register id (see below) */
+ int *natp); /* NaT value (out: 0 or 1) */
+
+/* Get the spill location for a register in the current context */
+extern int uwx_get_spill_loc(
+ struct uwx_env *env, /* unwind environment */
+ int regid, /* register id (see below) */
+ uint64_t *dispp); /* disposition code (see below) (out) */
+
+/* Get the ABI context code (if uwx_step returned UWX_ABI_FRAME) */
+extern int uwx_get_abi_context_code(struct uwx_env *env);
+
+/* Return status codes for uwx_ APIs */
+#define UWX_OK 0
+#define UWX_BOTTOM 1 /* Hit bottom of stack */
+#define UWX_ABI_FRAME 2 /* Hit ABI-dependent frame */
+#define UWX_ERR_NOENV (-1) /* No uwx_env allocated */
+#define UWX_ERR_IPNOTFOUND (-2) /* Lookup IP c/b returned NOTFOUND */
+#define UWX_ERR_LOOKUPERR (-3) /* Lookup IP c/b returned ERR */
+#define UWX_ERR_BADKEY (-4) /* Bad result vector key */
+#define UWX_ERR_COPYIN_UTBL (-5) /* Error reading unwind table */
+#define UWX_ERR_COPYIN_UINFO (-6) /* Error reading unwind info */
+#define UWX_ERR_COPYIN_MSTK (-7) /* Error reading memory stack */
+#define UWX_ERR_COPYIN_RSTK (-8) /* Error reading register stack */
+#define UWX_ERR_COPYIN_REG (-9) /* Error reading context register */
+#define UWX_ERR_NOUENTRY (-10) /* No unwind table entry for ip */
+#define UWX_ERR_NOUDESC (-11) /* No unwind descriptor covers ip */
+#define UWX_ERR_BADUDESC (-12) /* Bad unwind descriptor */
+#define UWX_ERR_NOMEM (-13) /* Out of memory */
+#define UWX_ERR_PROLOG_UF (-14) /* Prologue underflow */
+#define UWX_ERR_UNDEFLABEL (-15) /* Undefined label in copy_state */
+#define UWX_ERR_BADREGID (-16) /* Bad register identifier */
+#define UWX_ERR_CANTUNWIND (-17) /* Can't unwind */
+#define UWX_ERR_NOCALLBACKS (-18) /* No callbacks registered */
+#define UWX_ERR_NOCONTEXT (-19) /* Context not initialized */
+
+/* Request codes for copyin callback */
+#define UWX_COPYIN_UINFO 1 /* Reading unwind info */
+#define UWX_COPYIN_MSTACK 2 /* Reading memory stack */
+#define UWX_COPYIN_RSTACK 3 /* Reading RSE backing store */
+#define UWX_COPYIN_REG 4 /* Reading initial register state */
+
+/* Request codes for lookup IP callback */
+#define UWX_LKUP_LOOKUP 1 /* Lookup IP */
+#define UWX_LKUP_FREE 2 /* Free result vector */
+#define UWX_LKUP_SYMBOLS 3 /* Lookup symbolic information */
+
+/* Return status codes for lookup IP callback */
+#define UWX_LKUP_NOTFOUND 0 /* IP not found */
+#define UWX_LKUP_ERR 1 /* Other error */
+#define UWX_LKUP_UTABLE 2 /* Returned ref to unwind table */
+#define UWX_LKUP_FDESC 3 /* Returned frame description */
+#define UWX_LKUP_SYMINFO 4 /* Returned symbolic information */
+
+/* The lookup IP callback receives a parameter vector, and returns */
+/* one on success. This vector is a series of key/value pairs; each */
+/* even-numbered slot is a key, and each odd-numbered slot is a */
+/* corresponding value. The vector is terminated by a pair whose */
+/* key is 0. */
+#define UWX_KEY_END 0 /* End of vector */
+
+/* Keys passed to lookup IP callback */
+#define UWX_KEY_PREDS 1 /* Predicate registers */
+
+/* Keys returned with UWX_LKUP_UTABLE */
+/* These key/value pairs describe the unwind table corresponding */
+/* to the load module in which the current IP resides. */
+#define UWX_KEY_TBASE 1 /* Base address of text seg */
+#define UWX_KEY_UFLAGS 2 /* Unwind flags */
+#define UWX_KEY_USTART 3 /* Base of unwind tbl */
+#define UWX_KEY_UEND 4 /* End of unwind tbl */
+
+/* Keys returned with UWX_LKUP_FDESC */
+/* These key/value pairs describe the state of the frame at the */
+/* given IP. They are typically used for dynamically-generated code. */
+#define UWX_KEY_FSIZE 1 /* Frame size */
+#define UWX_KEY_SPILL(reg_id) (2 | ((reg_id) << 4)) /* Reg spilled */
+#define UWX_KEY_CONTEXT 3 /* ABI-dep. context */
+
+/* Keys returned with UWX_LKUP_FDESC or UWX_LKUP_SYMINFO */
+#define UWX_KEY_MODULE 5 /* Name of load module */
+#define UWX_KEY_FUNC 6 /* Name of function */
+#define UWX_KEY_FUNCSTART 7 /* Address of start of function */
+
+/* Register identifiers */
+/* For use in UWX_LKUP_FDESC result vectors and context access APIs. */
+/* "no spill info": These regs aren't spilled directly, so */
+/* result vectors must not describe these registers. */
+/* The result vector must describe the related register or */
+/* pseudo register instead (ip:rp, sp:psp, bsp/cfm:pfs). */
+/* "pseudo register": Not a machine register, but treated as */
+/* one for unwind purposes. */
+#define UWX_REG_IP 0 /* ip (no spill info) */
+#define UWX_REG_SP 1 /* sp (no spill info) */
+#define UWX_REG_BSP 2 /* ar.bsp (no spill info) */
+#define UWX_REG_CFM 3 /* cfm (no spill info) */
+#define UWX_REG_RP 4 /* rp (pseudo-register) */
+#define UWX_REG_PSP 5 /* psp (pseudo-register) */
+#define UWX_REG_PFS 6 /* pfs (pseudo-register) */
+#define UWX_REG_PREDS 7 /* p0 - p63 */
+#define UWX_REG_PRIUNAT 8 /* primary unat (pseudo-register) */
+#define UWX_REG_AR_BSPSTORE 9 /* ar.bspstore */
+#define UWX_REG_AR_RNAT 10 /* ar.rnat */
+#define UWX_REG_AR_UNAT 11 /* ar.unat */
+#define UWX_REG_AR_FPSR 12 /* ar.fpsr */
+#define UWX_REG_AR_LC 13 /* ar.lc */
+#define UWX_REG_AR_PFS 14 /* ar.pfs */
+#define UWX_REG_GR(gr) (0x100 | (gr))
+#define UWX_REG_FR(fr) (0x200 | (fr))
+#define UWX_REG_BR(br) (0x300 | (br))
+
+/* for backwards compatibility with previous releases... */
+#define UWX_REG_BSPSTORE UWX_REG_AR_BSPSTORE
+#define UWX_REG_RNAT UWX_REG_AR_RNAT
+#define UWX_REG_UNAT UWX_REG_AR_UNAT
+#define UWX_REG_FPSR UWX_REG_AR_FPSR
+#define UWX_REG_LC UWX_REG_AR_LC
+
+/* Values corresponding to UWX_KEY_SPILL keys indicate the disposition */
+/* of the spilled register -- either in the memory stack or in another */
+/* register. The PSP register may also have a disposition of "SPPLUS", */
+/* indicating that its value is SP plus a fixed constant. */
+#define UWX_DISP_NONE 0 /* Not spilled */
+#define UWX_DISP_SPPLUS(k) (1 | (k)) /* PSP = SP+constant */
+#define UWX_DISP_SPREL(disp) (2 | (disp)) /* Spilled at [SP+disp] */
+#define UWX_DISP_PSPREL(disp) (3 | (disp)) /* Spilled at [PSP+16-disp] */
+#define UWX_DISP_REG(reg) (4 | ((reg) << 4)) /* Saved to another reg. */
+
+/* The uwx_get_spill_loc() routine returns a spill location for a */
+/* given register in the current context. It will return a disposition */
+/* code of UWX_DISP_NONE, UWX_DISP_REG(reg), or one of the following */
+/* to indicate that the spilled value can be found in the memory */
+/* stack or the register stack backing store. */
+#define UWX_DISP_MSTK(addr) (5 | (addr)) /* Spilled in mem. stack */
+#define UWX_DISP_RSTK(addr) (6 | (addr)) /* Spilled in reg. stack */
+
+/* Extract the disposition code, offset, address, or register id */
+/* from a disposition returned from uwx_get_spill_loc(). */
+/* Compare the extracted disp code against UWX_DISP_REG(0), etc. */
+#define UWX_GET_DISP_CODE(disp) ((int)(disp) & 0x07)
+#define UWX_GET_DISP_OFFSET(disp) ((disp) & ~(uint64_t)0x07)
+#define UWX_GET_DISP_ADDR(disp) ((disp) & ~(uint64_t)0x07)
+#define UWX_GET_DISP_REGID(disp) ((int)(disp) >> 4)
diff --git a/sys/contrib/ia64/libuwx/src/uwx_bstream.c b/sys/contrib/ia64/libuwx/src/uwx_bstream.c
new file mode 100644
index 0000000..4bc8e42
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_bstream.c
@@ -0,0 +1,181 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_bstream.h"
+
+
+/* uwx_init_bstream: initialize a byte stream for reading */
+
+void uwx_init_bstream(
+ struct uwx_bstream *bstream,
+ struct uwx_env *env,
+ uint64_t source,
+ unsigned int len,
+ int request)
+{
+ bstream->buf = 0;
+ if (env->remote) {
+ bstream->source = source;
+ bstream->bufp = (unsigned char *) &bstream->buf;
+ bstream->nbuf = 0;
+ bstream->copyin = env->copyin;
+ bstream->cb_token = env->cb_token;
+ bstream->request = request;
+ }
+ else {
+ bstream->source = 0;
+ bstream->bufp = (unsigned char *) source;
+ bstream->nbuf = len;
+ bstream->copyin = 0;
+ bstream->cb_token = 0;
+ bstream->request = 0;
+ }
+ bstream->ntotal = len;
+ bstream->peekc = -1;
+}
+
+
+/* uwx_get_byte: read the next byte from the byte stream */
+
+int uwx_get_byte(struct uwx_bstream *bstream)
+{
+ int len;
+ int n;
+ int b;
+
+ if (bstream->peekc >= 0) {
+ b = bstream->peekc;
+ bstream->peekc = -1;
+ return b;
+ }
+ if (bstream->ntotal <= 0)
+ return -1;
+ if (bstream->nbuf <= 0) {
+ if (bstream->source & 0x7 || bstream->ntotal < sizeof(uint64_t))
+ len = sizeof(uint32_t);
+ else
+ len = sizeof(uint64_t);
+ n = (*bstream->copyin)(bstream->request, (char *)&bstream->buf,
+ bstream->source, len, bstream->cb_token);
+ if (n != len)
+ return -1;
+ bstream->bufp = (unsigned char *) &bstream->buf;
+ bstream->nbuf = n;
+ bstream->source += n;
+ }
+
+ b = *bstream->bufp++;
+ bstream->nbuf--;
+ bstream->ntotal--;
+ return b;
+}
+
+
+/* uwx_unget_byte: push a byte back onto the byte stream */
+
+int uwx_unget_byte(struct uwx_bstream *bstream, int b)
+{
+ bstream->peekc = b;
+ return 0;
+}
+
+
+/* uwx_get_uleb128: read a ULEB128 value from the byte stream */
+
+int uwx_get_uleb128(struct uwx_bstream *bstream, uint64_t *valp)
+{
+ uint64_t val;
+ int i;
+ int b;
+
+ b = uwx_get_byte(bstream);
+ val = (uint64_t)(b & 0x7f) << 56;
+ for (i = 0; i < 8; i++) {
+ val = val >> 7;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 56;
+ }
+ }
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 63;
+ }
+ if (b & 0x80)
+ return -1;
+ *valp = val;
+ return 0;
+}
+
+#if 0
+int uwx_get_uleb128_alt(struct uwx_bstream *bstream, uint64_t *valp)
+{
+ uint64_t val;
+ int b;
+
+ b = uwx_get_byte(bstream);
+ val = b & 0x7f;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 7;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 14;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 21;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 28;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 35;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 42;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 49;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 56;
+ if (b & 0x80) {
+ b = uwx_get_byte(bstream);
+ val |= (uint64_t)(b & 0x7f) << 63;
+ if (b & 0x80)
+ return -1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ *valp = val;
+ return 0;
+}
+#endif
diff --git a/sys/contrib/ia64/libuwx/src/uwx_bstream.h b/sys/contrib/ia64/libuwx/src/uwx_bstream.h
new file mode 100644
index 0000000..066d946
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_bstream.h
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+struct uwx_bstream {
+ copyin_cb copyin;
+ intptr_t cb_token;
+ uint64_t source;
+ uint64_t buf;
+ unsigned char *bufp;
+ int nbuf;
+ unsigned int ntotal;
+ int request;
+ int peekc;
+};
+
+/* uwx_init_bstream: initialize a byte stream for reading */
+
+extern void uwx_init_bstream(
+ struct uwx_bstream *bstream,
+ struct uwx_env *env,
+ uint64_t source,
+ unsigned int len,
+ int request);
+
+
+/* uwx_get_byte: read the next byte from the byte stream */
+
+extern int uwx_get_byte(struct uwx_bstream *bstream);
+
+
+/* uwx_unget_byte: push a byte back onto the byte stream */
+
+extern int uwx_unget_byte(struct uwx_bstream *bstream, int b);
+
+
+/* uwx_get_uleb128: read a ULEB128 value from the byte stream */
+
+extern int uwx_get_uleb128(struct uwx_bstream *bstream, uint64_t *val);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_context.c b/sys/contrib/ia64/libuwx/src/uwx_context.c
new file mode 100644
index 0000000..01b594d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_context.c
@@ -0,0 +1,346 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_context.h"
+#include "uwx_scoreboard.h"
+#include "uwx_step.h"
+#include "uwx_trace.h"
+
+int uwx_init_context(
+ struct uwx_env *env,
+ uint64_t ip,
+ uint64_t sp,
+ uint64_t bsp,
+ uint64_t cfm)
+{
+ int i;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ env->context.special[UWX_REG_IP] = ip;
+ env->context.special[UWX_REG_SP] = sp;
+ env->context.special[UWX_REG_BSP] = bsp;
+ env->context.special[UWX_REG_CFM] = cfm;
+ for (i = UWX_REG_RP; i < NSPECIALREG; i++)
+ env->context.special[i] = 0;
+ for (i = 0; i < NPRESERVEDGR; i++)
+ env->context.gr[i] = 0;
+ env->context.valid_regs = VALID_BASIC4;
+ env->context.valid_frs = 0;
+ env->rstate = 0;
+ (void)uwx_init_history(env);
+ return UWX_OK;
+}
+
+int uwx_get_reg(struct uwx_env *env, int regid, uint64_t *valp)
+{
+ int status;
+ int sor;
+ int rrb_gr;
+ uint64_t bsp;
+ int n;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ status = UWX_OK;
+
+ if (regid == UWX_REG_GR(12))
+ regid = UWX_REG_SP;
+ if (regid < NSPECIALREG && (env->context.valid_regs & (1 << regid)))
+ *valp = env->context.special[regid];
+ else if (regid == UWX_REG_PSP || regid == UWX_REG_RP ||
+ regid == UWX_REG_PFS) {
+ status = uwx_restore_markers(env);
+ if (status != UWX_OK)
+ return status;
+ *valp = env->context.special[regid];
+ }
+ else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7) &&
+ (env->context.valid_regs &
+ (1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT))) )
+ *valp = env->context.gr[regid - UWX_REG_GR(4)];
+ else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) {
+ if (env->copyin == 0)
+ return UWX_ERR_NOCALLBACKS;
+ bsp = env->context.special[UWX_REG_BSP];
+ TRACE_C_GET_REG(regid, bsp)
+ regid -= UWX_REG_GR(32);
+ sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8;
+ rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f;
+ if (sor != 0 && rrb_gr != 0 && regid < sor) {
+ TRACE_C_ROTATE_GR(regid, sor, rrb_gr, (regid+rrb_gr)%sor)
+ regid = (regid + rrb_gr) % sor;
+ }
+ bsp = uwx_add_to_bsp(bsp, regid);
+ n = (*env->copyin)(UWX_COPYIN_RSTACK, (char *)valp,
+ bsp, DWORDSZ, env->cb_token);
+ if (n != DWORDSZ)
+ status = UWX_ERR_COPYIN_RSTK;
+ }
+ else if (regid == UWX_REG_GR(0))
+ *valp = 0;
+ else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_BR(5) &&
+ (env->context.valid_regs &
+ (1 << (regid - UWX_REG_BR(1) + VALID_BR_SHIFT))) )
+ *valp = env->context.br[regid - UWX_REG_BR(1)];
+ else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5) &&
+ (env->context.valid_frs & (1 << (regid - UWX_REG_FR(2)))) ) {
+ valp[0] = env->context.fr[regid - UWX_REG_FR(2)].part0;
+ valp[1] = env->context.fr[regid - UWX_REG_FR(2)].part1;
+ }
+ else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31) &&
+ (env->context.valid_frs & (1 << (regid - UWX_REG_FR(16) + 4))) ) {
+ valp[0] = env->context.fr[regid - UWX_REG_FR(16) + 4].part0;
+ valp[1] = env->context.fr[regid - UWX_REG_FR(16) + 4].part1;
+ }
+ else if ( (regid < NSPECIALREG) ||
+ (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) ||
+ (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) ) {
+ if (env->copyin == 0)
+ return UWX_ERR_NOCALLBACKS;
+ n = (*env->copyin)(UWX_COPYIN_REG, (char *)valp,
+ regid, DWORDSZ, env->cb_token);
+ if (n != DWORDSZ)
+ status = UWX_ERR_COPYIN_REG;
+ }
+ else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) {
+ if (env->copyin == 0)
+ return UWX_ERR_NOCALLBACKS;
+ n = (*env->copyin)(UWX_COPYIN_REG, (char *)valp,
+ regid, 2*DWORDSZ, env->cb_token);
+ if (n != 2*DWORDSZ)
+ status = UWX_ERR_COPYIN_REG;
+ }
+ else if (regid == UWX_REG_FR(0)) {
+ valp[0] = 0;
+ valp[1] = 0;
+ }
+ else if (regid == UWX_REG_FR(1)) {
+ valp[0] = 0x000000000000ffffULL;
+ valp[1] = 0x8000000000000000ULL;
+ }
+ else
+ status = UWX_ERR_BADREGID;
+ return status;
+}
+
+int uwx_get_nat(struct uwx_env *env, int regid, int *natp)
+{
+ int status;
+ int sor;
+ int rrb_gr;
+ uint64_t bsp;
+ uint64_t natcollp;
+ uint64_t natcoll;
+ int n;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ status = UWX_OK;
+
+ if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7) &&
+ (env->context.valid_regs &
+ (1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT))) ) {
+ *natp = (env->context.special[UWX_REG_PRIUNAT] >>
+ (regid - UWX_REG_GR(4)) ) & 0x01;
+ }
+ else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) {
+ if (env->copyin == 0)
+ return UWX_ERR_NOCALLBACKS;
+ bsp = env->context.special[UWX_REG_BSP];
+ regid -= UWX_REG_GR(32);
+ sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8;
+ rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f;
+ if (sor != 0 && rrb_gr != 0 && regid < sor) {
+ regid = (regid + rrb_gr) % sor;
+ }
+ bsp = uwx_add_to_bsp(bsp, regid);
+ natcollp = bsp | 0x01f8;
+ if (natcollp >= bsp)
+ n = (*env->copyin)(UWX_COPYIN_REG, (char *)&natcoll,
+ (uint64_t)UWX_REG_AR_RNAT, DWORDSZ, env->cb_token);
+ else
+ n = (*env->copyin)(UWX_COPYIN_RSTACK, (char *)&natcoll,
+ bsp, DWORDSZ, env->cb_token);
+ if (n != DWORDSZ)
+ return UWX_ERR_COPYIN_RSTK;
+ *natp = (int)(natcoll >> (((int)bsp >> 3) & 0x3f)) & 0x01;
+ }
+ else if (regid == UWX_REG_GR(0))
+ *natp = 0;
+ else
+ status = UWX_ERR_BADREGID;
+ return status;
+}
+
+int uwx_get_spill_loc(struct uwx_env *env, int regid, uint64_t *dispp)
+{
+ int status;
+ int sor;
+ int rrb_gr;
+ uint64_t bsp;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ status = UWX_OK;
+
+ if (regid == UWX_REG_GR(12))
+ regid = UWX_REG_SP;
+ if (regid < NSPECIALREG)
+ *dispp = env->history.special[regid];
+ else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7))
+ *dispp = env->history.gr[regid - UWX_REG_GR(4)];
+ else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) {
+ bsp = env->context.special[UWX_REG_BSP];
+ regid -= UWX_REG_GR(32);
+ sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8;
+ rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f;
+ if (sor != 0 && rrb_gr != 0 && regid < sor)
+ regid = (regid + rrb_gr) % sor;
+ bsp = uwx_add_to_bsp(bsp, regid);
+ *dispp = UWX_DISP_RSTK(bsp);
+ }
+ else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_GR(5))
+ *dispp = env->history.br[regid - UWX_REG_BR(1)];
+ else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5))
+ *dispp = env->history.fr[regid - UWX_REG_FR(2)];
+ else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31))
+ *dispp = env->history.fr[regid - UWX_REG_FR(16) + 4];
+ else if ( (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) ||
+ (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) ||
+ (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) )
+ *dispp = UWX_DISP_REG(regid);
+ else
+ status = UWX_ERR_BADREGID;
+ return status;
+}
+
+int uwx_set_reg(struct uwx_env *env, int regid, uint64_t val)
+{
+ int status;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ if (regid == UWX_REG_GR(12))
+ regid = UWX_REG_SP;
+ if (regid < NSPECIALREG) {
+ env->context.special[regid] = val;
+ env->context.valid_regs |= 1 << regid;
+ status = UWX_OK;
+ }
+ else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7)) {
+ env->context.gr[regid - UWX_REG_GR(4)] = val;
+ env->context.valid_regs |=
+ 1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT);
+ status = UWX_OK;
+ }
+ else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) {
+ status = UWX_ERR_BADREGID;
+ }
+ else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_BR(5)) {
+ env->context.br[regid - UWX_REG_BR(1)] = val;
+ env->context.valid_regs |=
+ 1 << (regid - UWX_REG_BR(1) + VALID_BR_SHIFT);
+ status = UWX_OK;
+ }
+ else
+ status = UWX_ERR_BADREGID;
+ return status;
+}
+
+int uwx_set_fr(struct uwx_env *env, int regid, uint64_t *val)
+{
+
+ if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5))
+ regid -= UWX_REG_FR(2);
+ else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31))
+ regid -= UWX_REG_FR(16) - 4;
+ else
+ return UWX_ERR_BADREGID;
+
+ env->context.fr[regid].part0 = val[0];
+ env->context.fr[regid].part1 = val[1];
+ env->context.valid_frs |= 1 << regid;
+ env->nsbreg = NSBREG;
+ return UWX_OK;
+}
+
+uint64_t uwx_add_to_bsp(uint64_t bsp, int nslots)
+{
+ int bias;
+
+ /*
+ * Here's a picture of the backing store as modeled in
+ * the computations below. "X" marks NaT collections at
+ * every 0x1f8 mod 0x200 address.
+ *
+ * To make the NaT adjustments easier, we bias the current bsp
+ * by enough slots to place it at the previous NaT collection.
+ * Then we need to add the bias to the number of slots,
+ * then add 1 for every 63 slots to account for NaT collections.
+ * Then we can remove the bias again and add the adjusted
+ * number of slots to the bsp.
+ *
+ * 0 1f8 3f8
+ * +---------------------------------------------------------------+
+ * | X X|
+ * +---------------------------------------------------------------+
+ * <-------- bias -------->
+ * <--- nslots --->
+ * ^
+ * |
+ * bsp
+ * <------- adjusted (nslots + bias) ------->
+
+ * When subtracting from bsp, we bias the bsp in the opposite
+ * direction so that it is at the next NaT collection.
+ *
+ * 0 1f8 3f8
+ * +---------------------------------------------------------------+
+ * | X X|
+ * +---------------------------------------------------------------+
+ * <------- bias ------->
+ * <--- nslots --->
+ * ^
+ * |
+ * bsp
+ * <------ adjusted (nslots + bias) ------>
+ */
+
+ if (nslots > 0) {
+ bias = ((unsigned int)bsp & 0x1f8) / DWORDSZ;
+ nslots += (nslots + bias) / 63;
+ }
+ else if (nslots < 0) {
+ bias = (0x1f8 - ((unsigned int)bsp & 0x1f8)) / DWORDSZ;
+ nslots -= (-nslots + bias) / 63;
+ }
+ return bsp + nslots * DWORDSZ;
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_context.h b/sys/contrib/ia64/libuwx/src/uwx_context.h
new file mode 100644
index 0000000..2bdedc9
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_context.h
@@ -0,0 +1,25 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+extern uint64_t uwx_add_to_bsp(uint64_t bsp, int nslots);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_env.c b/sys/contrib/ia64/libuwx/src/uwx_env.c
new file mode 100644
index 0000000..aa2c4a0
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_env.c
@@ -0,0 +1,170 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <stdlib.h>
+#else
+#define free(p) /* nullified */
+#define malloc(sz) NULL
+#endif
+
+#include "uwx_env.h"
+#include "uwx_scoreboard.h"
+#include "uwx_str.h"
+#include "uwx_trace.h"
+
+alloc_cb uwx_allocate_cb = 0;
+free_cb uwx_free_cb = 0;
+
+int uwx_register_alloc_cb(alloc_cb alloc, free_cb free)
+{
+ uwx_allocate_cb = alloc;
+ uwx_free_cb = free;
+ return UWX_OK;
+}
+
+int uwx_init_history(struct uwx_env *env)
+{
+ int i;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ for (i = 0; i < NSPECIALREG; i++)
+ env->history.special[i] = UWX_DISP_REG(i);;
+ for (i = 0; i < NPRESERVEDGR; i++)
+ env->history.gr[i] = UWX_DISP_REG(UWX_REG_GR(4+i));
+ for (i = 0; i < NPRESERVEDBR; i++)
+ env->history.br[i] = UWX_DISP_REG(UWX_REG_BR(1+i));
+ for (i = 0; i < 4; i++)
+ env->history.fr[i] = UWX_DISP_REG(UWX_REG_FR(2+i));
+ for ( ; i < NPRESERVEDFR; i++)
+ env->history.fr[i] = UWX_DISP_REG(UWX_REG_FR(12+i));
+
+ return UWX_OK;
+}
+
+struct uwx_env *uwx_init()
+{
+ int i;
+ struct uwx_env *env;
+
+ if (uwx_allocate_cb == 0)
+ env = (struct uwx_env *) malloc(sizeof(struct uwx_env));
+ else
+ env = (struct uwx_env *) (*uwx_allocate_cb)(sizeof(struct uwx_env));
+ if (env != 0) {
+ env->context.valid_regs = 0;
+ env->context.valid_frs = 0;
+ for (i = 0; i < NSPECIALREG; i++)
+ env->context.special[i] = 0;
+ for (i = 0; i < NPRESERVEDGR; i++)
+ env->context.gr[i] = 0;
+ for (i = 0; i < NPRESERVEDBR; i++)
+ env->context.br[i] = 0;
+ for (i = 0; i < NPRESERVEDFR; i++) {
+ env->context.fr[i].part0 = 0;
+ env->context.fr[i].part1 = 0;
+ }
+ env->rstate = 0;
+ env->function_offset = 0;
+ (void)uwx_init_history(env);
+ env->allocate_cb = uwx_allocate_cb;
+ env->free_cb = uwx_free_cb;
+ env->free_scoreboards = 0;
+ env->used_scoreboards = 0;
+ env->labeled_scoreboards = 0;
+ (void)uwx_init_str_pool(env);
+ env->module_name = 0;
+ env->function_name = 0;
+ env->cb_token = 0;
+ env->copyin = 0;
+ env->lookupip = 0;
+ env->remote = 0;
+ env->byte_swap = 0;
+ env->abi_context = 0;
+ env->nsbreg = NSBREG_NOFR;
+ env->nscoreboards = 0;
+ env->trace = 0;
+ TRACE_INIT
+ for (i = 0; i < NSCOREBOARDS; i++)
+ (void) uwx_alloc_scoreboard(env);
+ }
+ return env;
+}
+
+int uwx_set_remote(struct uwx_env *env, int is_big_endian_target)
+{
+ int is_big_endian_host;
+ char *p;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ env->remote = 1;
+
+ is_big_endian_host = 1;
+ p = (char *)&is_big_endian_host;
+ *p = 0;
+ if (is_big_endian_target == is_big_endian_host)
+ env->byte_swap = 0;
+ else
+ env->byte_swap = 1;
+
+ return UWX_OK;
+}
+
+int uwx_register_callbacks(
+ struct uwx_env *env,
+ intptr_t tok,
+ copyin_cb copyin,
+ lookupip_cb lookupip)
+{
+ if (env == 0)
+ return UWX_ERR_NOENV;
+ env->cb_token = tok;
+ env->copyin = copyin;
+ env->lookupip = lookupip;
+ return UWX_OK;
+}
+
+int uwx_get_abi_context_code(struct uwx_env *env)
+{
+ if (env == 0)
+ return UWX_ERR_NOENV;
+ return env->abi_context;
+}
+
+int uwx_free(struct uwx_env *env)
+{
+ if (env != 0) {
+ uwx_free_scoreboards(env);
+ uwx_free_str_pool(env);
+ if (env->free_cb == 0)
+ free((void *)env);
+ else
+ (*env->free_cb)((void *)env);
+ }
+ return UWX_OK;
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_env.h b/sys/contrib/ia64/libuwx/src/uwx_env.h
new file mode 100644
index 0000000..f730bdd
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_env.h
@@ -0,0 +1,103 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx.h"
+
+#define WORDSZ 4
+#define DWORDSZ 8
+#define BUNDLESZ 16
+#define SLOTSPERBUNDLE 3
+
+#define UNWIND_TBL_32BIT 0x8000000000000000LL
+
+#define UNW_VER(x) ((x) >> 48)
+#define UNW_FLAG_MASK 0x0000ffff00000000LL
+#define UNW_FLAG_EHANDLER 0x0000000100000000LL
+#define UNW_FLAG_UHANDLER 0x0000000200000000LL
+#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffLL)
+
+struct uwx_scoreboard;
+
+#define NSCOREBOARDS 8 /* Initial allocation of scoreboards */
+
+#define NSPECIALREG 16 /* Must be even, so FRs are aligned */
+#define NPRESERVEDGR 4
+#define NPRESERVEDBR 5
+#define NPRESERVEDFR 20
+
+struct uwx_fpreg {
+ uint64_t part0;
+ uint64_t part1;
+};
+
+struct uwx_context {
+ unsigned int valid_regs;
+ unsigned int valid_frs;
+ uint64_t special[NSPECIALREG];
+ uint64_t gr[NPRESERVEDGR];
+ uint64_t br[NPRESERVEDBR];
+ struct uwx_fpreg fr[NPRESERVEDFR];
+};
+
+#define VALID_GR_SHIFT NSPECIALREG
+#define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR)
+
+#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */
+#define VALID_MARKERS 0x70 /* RP, PSP, PFS */
+
+struct uwx_history {
+ uint64_t special[NSPECIALREG];
+ uint64_t gr[NPRESERVEDGR];
+ uint64_t br[NPRESERVEDBR];
+ uint64_t fr[NPRESERVEDFR];
+};
+
+struct uwx_str_pool;
+
+struct uwx_env {
+ struct uwx_context context;
+ uint64_t *rstate;
+ int64_t function_offset;
+ struct uwx_history history;
+ alloc_cb allocate_cb;
+ free_cb free_cb;
+ struct uwx_scoreboard *free_scoreboards;
+ struct uwx_scoreboard *used_scoreboards;
+ struct uwx_scoreboard *labeled_scoreboards;
+ struct uwx_str_pool *string_pool;
+ char *module_name;
+ char *function_name;
+ intptr_t cb_token;
+ copyin_cb copyin;
+ lookupip_cb lookupip;
+ int remote;
+ int byte_swap;
+ int abi_context;
+ int nsbreg;
+ int nscoreboards;
+ int trace;
+};
+
+extern alloc_cb uwx_allocate_cb;
+extern free_cb uwx_free_cb;
diff --git a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c
new file mode 100644
index 0000000..bee0706
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c
@@ -0,0 +1,279 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <stdlib.h>
+#else
+#define free(p) /* nullified */
+#define malloc(sz) NULL
+#endif
+
+#include "uwx_env.h"
+#include "uwx_scoreboard.h"
+#include "uwx_trace.h"
+
+
+struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env)
+{
+ struct uwx_scoreboard *sb;
+ int i;
+
+ if (env->free_scoreboards != 0) {
+ sb = env->free_scoreboards;
+ env->free_scoreboards = sb->nextfree;
+ TRACE_B_REUSE(sb->id)
+ }
+ else {
+ if (env->allocate_cb == 0)
+ sb = (struct uwx_scoreboard *)
+ malloc(sizeof(struct uwx_scoreboard));
+ else
+ sb = (struct uwx_scoreboard *)
+ (*env->allocate_cb)(sizeof(struct uwx_scoreboard));
+ if (sb == 0)
+ return 0;
+ sb->id = env->nscoreboards++;
+ sb->nextused = env->used_scoreboards;
+ env->used_scoreboards = sb;
+ TRACE_B_ALLOC(sb->id)
+ }
+
+ sb->nextstack = 0;
+ sb->nextlabel = 0;
+ for (i = 0; i < env->nsbreg; i++)
+ sb->rstate[i] = UWX_DISP_NONE;
+ sb->rstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_BR(0));
+ sb->rstate[SBREG_PSP] = UWX_DISP_SPPLUS(0);
+ sb->rstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_AR_PFS);
+ sb->rstate[SBREG_PRIUNAT] = UWX_DISP_REG(UWX_REG_AR_UNAT);
+ sb->label = 0;
+ return sb;
+}
+
+static
+void uwx_reclaim_scoreboards(struct uwx_env *env)
+{
+ struct uwx_scoreboard *sb;
+
+ env->free_scoreboards = 0;
+ for (sb = env->used_scoreboards; sb != 0; sb = sb->nextused) {
+ sb->nextfree = env->free_scoreboards;
+ env->free_scoreboards = sb;
+ }
+ env->labeled_scoreboards = 0;
+}
+
+struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env)
+{
+ struct uwx_scoreboard *sb;
+
+ uwx_reclaim_scoreboards(env);
+ sb = uwx_alloc_scoreboard(env);
+ return sb;
+}
+
+struct uwx_scoreboard *uwx_new_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *prevsb)
+{
+ int i;
+ struct uwx_scoreboard *sb;
+
+ sb = uwx_alloc_scoreboard(env);
+ if (sb == 0)
+ return 0;
+ sb->nextstack = prevsb;
+ for (i = 0; i < env->nsbreg; i++)
+ sb->rstate[i] = prevsb->rstate[i];
+ return sb;
+}
+
+struct uwx_scoreboard *uwx_pop_scoreboards(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int ecount)
+{
+ struct uwx_scoreboard *next;
+
+ while (ecount > 0) {
+ next = sb->nextstack;
+ TRACE_B_POP(sb->id)
+ sb->nextstack = 0;
+ sb->nextfree = env->free_scoreboards;
+ env->free_scoreboards = sb;
+ sb = next;
+ if (sb == 0)
+ return 0;
+ ecount--;
+ }
+ return sb;
+}
+
+int uwx_label_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int label)
+{
+ struct uwx_scoreboard *new;
+ struct uwx_scoreboard *back;
+ struct uwx_scoreboard *next;
+ int i;
+
+ TRACE_B_LABEL(label)
+
+ /* Copy the current stack, storing reverse links */
+ /* in the "nextstack" field. */
+
+ back = 0;
+ new = 0;
+ while (sb != 0) {
+ TRACE_B_LABEL_COPY(sb->id)
+ new = uwx_alloc_scoreboard(env);
+ if (new == 0)
+ return UWX_ERR_NOMEM;
+ new->nextstack = back;
+ for (i = 0; i < env->nsbreg; i++)
+ new->rstate[i] = sb->rstate[i];
+ sb = sb->nextstack;
+ back = new;
+ }
+
+ /* The "new" pointer now points to the bottom of the new stack, */
+ /* and the "nextstack" links lead towards the top. */
+ /* Now go back down the stack, reversing the stack links to their */
+ /* proper direction. */
+
+ back = 0;
+ while (new != 0) {
+ next = new->nextstack;
+ new->nextstack = back;
+ TRACE_B_LABEL_REVERSE(back, new)
+ back = new;
+ new = next;
+ }
+
+ /* The "back" pointer now points to the top of the stack. */
+
+ back->label = label;
+ back->nextlabel = env->labeled_scoreboards;
+ env->labeled_scoreboards = back;
+ return UWX_OK;
+}
+
+int uwx_copy_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int label)
+{
+ struct uwx_scoreboard *next;
+ struct uwx_scoreboard *next2;
+ struct uwx_scoreboard *lsb;
+ struct uwx_scoreboard *new;
+ struct uwx_scoreboard *back;
+ int i;
+
+ TRACE_B_COPY(label, sb->id)
+
+ /* Free the existing stack. */
+
+ next = sb->nextstack;
+ while (next != 0) {
+ TRACE_B_COPY_FREE(next->id)
+ next2 = next->nextstack;
+ next->nextstack = 0;
+ next->nextfree = env->free_scoreboards;
+ env->free_scoreboards = next;
+ next = next2;
+ }
+
+ /* Find the scoreboard with the requested label. */
+
+ for (lsb = env->labeled_scoreboards; lsb != 0; lsb = lsb->nextlabel) {
+ if (lsb->label == label)
+ break;
+ }
+
+ if (lsb == 0)
+ return UWX_ERR_UNDEFLABEL;
+
+ TRACE_B_COPY_FOUND(lsb->id)
+
+ /* Copy the labeled scoreboard. */
+
+ sb->nextstack = 0;
+ sb->nextlabel = 0;
+ for (i = 0; i < env->nsbreg; i++)
+ sb->rstate[i] = lsb->rstate[i];
+ sb->label = 0;
+
+ /* Now copy its stack, storing reverse links in the nextstack field. */
+
+ back = sb;
+ new = 0;
+ for (next = lsb->nextstack; next != 0; next = next->nextstack) {
+ TRACE_B_COPY_COPY(next->id)
+ new = uwx_alloc_scoreboard(env);
+ if (new == 0)
+ return UWX_ERR_NOMEM;
+ new->nextstack = back;
+ for (i = 0; i < env->nsbreg; i++)
+ new->rstate[i] = next->rstate[i];
+ back = new;
+ }
+
+ /* The "new" pointer now points to the bottom of the new stack, */
+ /* and the "nextstack" links lead towards the top. */
+ /* Now go back down the stack, reversing the nextstack links to their */
+ /* proper direction. */
+
+ back = 0;
+ while (new != 0) {
+ next = new->nextstack;
+ new->nextstack = back;
+ TRACE_B_COPY_REVERSE(back, new)
+ back = new;
+ new = next;
+ }
+
+ return UWX_OK;
+}
+
+void uwx_free_scoreboards(struct uwx_env *env)
+{
+ struct uwx_scoreboard *sb;
+ struct uwx_scoreboard *next;
+
+ for (sb = env->used_scoreboards; sb != 0; sb = next) {
+ TRACE_B_FREE(sb->id)
+ next = sb->nextused;
+ if (env->free_cb == 0)
+ free((void *)sb);
+ else
+ (*env->free_cb)((void *)sb);
+ }
+ env->free_scoreboards = 0;
+ env->used_scoreboards = 0;
+ env->labeled_scoreboards = 0;
+}
+
diff --git a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h
new file mode 100644
index 0000000..0122d38
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h
@@ -0,0 +1,79 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#define NSB_SPECIAL 9
+#define NSB_GR 4
+#define NSB_BR 5
+#define NSB_FR 20
+
+#define SBREG_RP 0
+#define SBREG_PSP 1
+#define SBREG_PFS 2
+#define SBREG_PREDS 3
+#define SBREG_UNAT 4
+#define SBREG_PRIUNAT 5
+#define SBREG_RNAT 6
+#define SBREG_LC 7
+#define SBREG_FPSR 8
+#define SBREG_GR (0 + NSB_SPECIAL)
+#define SBREG_BR (SBREG_GR + NSB_GR)
+#define SBREG_FR (SBREG_BR + NSB_BR)
+
+#define NSBREG_NOFR (NSB_SPECIAL + NSB_GR + NSB_BR)
+#define NSBREG (NSB_SPECIAL + NSB_GR + NSB_BR + NSB_FR)
+
+struct uwx_scoreboard {
+ struct uwx_scoreboard *nextused;
+ struct uwx_scoreboard *nextfree;
+ struct uwx_scoreboard *nextstack;
+ struct uwx_scoreboard *nextlabel;
+ uint64_t rstate[NSBREG];
+ int label;
+ int id;
+};
+
+extern struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env);
+
+extern struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env);
+
+extern struct uwx_scoreboard *uwx_new_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *prevsb);
+
+extern struct uwx_scoreboard *uwx_pop_scoreboards(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int ecount);
+
+extern int uwx_label_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int label);
+
+extern int uwx_copy_scoreboard(
+ struct uwx_env *env,
+ struct uwx_scoreboard *sb,
+ int label);
+
+extern void uwx_free_scoreboards(struct uwx_env *env);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_self.c b/sys/contrib/ia64/libuwx/src/uwx_self.c
new file mode 100644
index 0000000..f5b1276
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_self.c
@@ -0,0 +1,278 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <stdlib.h>
+#include <crt0.h>
+#include <dlfcn.h>
+#include <sys/uc_access.h>
+#endif
+
+#include "uwx_env.h"
+#include "uwx_context.h"
+#include "uwx_trace.h"
+#include "uwx_self.h"
+
+#define UWX_ABI_HPUX_SIGCONTEXT 0x0101 /* abi = HP-UX, context = 1 */
+
+struct uwx_self_info {
+ ucontext_t *ucontext;
+ uint64_t bspstore;
+ uint64_t rvec[10];
+ uint64_t sendsig_start;
+ uint64_t sendsig_end;
+ alloc_cb allocate_cb;
+ free_cb free_cb;
+ int trace;
+};
+
+struct uwx_self_info *uwx_self_init_info(struct uwx_env *env)
+{
+ struct uwx_self_info *info;
+
+ if (env->allocate_cb == 0)
+ info = (struct uwx_self_info *)
+ malloc(sizeof(struct uwx_self_info));
+ else
+ info = (struct uwx_self_info *)
+ (*env->allocate_cb)(sizeof(struct uwx_self_info));
+ if (info == 0)
+ return 0;
+
+ info->ucontext = 0;
+ info->bspstore = 0;
+ info->sendsig_start = __load_info->li_sendsig_txt;
+ info->sendsig_end = __load_info->li_sendsig_txt +
+ __load_info->li_sendsig_tsz;
+ info->allocate_cb = env->allocate_cb;
+ info->free_cb = env->free_cb;
+ info->trace = env->trace;
+ return info;
+}
+
+int uwx_self_free_info(struct uwx_self_info *info)
+{
+ if (info->free_cb == 0)
+ free((void *)info);
+ else
+ (*info->free_cb)((void *)info);
+ return UWX_OK;
+}
+
+int uwx_self_init_from_sigcontext(
+ struct uwx_env *env,
+ struct uwx_self_info *info,
+ ucontext_t *ucontext)
+{
+ int status;
+ uint16_t reason;
+ uint64_t ip;
+ uint64_t sp;
+ uint64_t bsp;
+ uint64_t cfm;
+ unsigned int nat;
+ uint64_t ec;
+ int adj;
+
+ info->ucontext = ucontext;
+ status = __uc_get_reason(ucontext, &reason);
+ status = __uc_get_ip(ucontext, &ip);
+ status = __uc_get_grs(ucontext, 12, 1, &sp, &nat);
+ status = __uc_get_cfm(ucontext, &cfm);
+#ifdef NEW_UC_GET_AR
+ status = __uc_get_ar_bsp(ucontext, &bsp);
+ status = __uc_get_ar_bspstore(ucontext, &info->bspstore);
+ status = __uc_get_ar_ec(ucontext, &ec);
+#else
+ status = __uc_get_ar(ucontext, 17, &bsp);
+ status = __uc_get_ar(ucontext, 18, &info->bspstore);
+ status = __uc_get_ar(ucontext, 66, &ec);
+#endif
+ /* The returned bsp needs to be adjusted. */
+ /* For interrupt frames, where bsp was advanced by a cover */
+ /* instruction, subtract sof (size of frame). For non-interrupt */
+ /* frames, where bsp was advanced by br.call, subtract sol */
+ /* (size of locals). */
+ if (reason != 0)
+ adj = (unsigned int)cfm & 0x7f; /* interrupt frame */
+ else
+ adj = ((unsigned int)cfm >> 7) & 0x7f; /* non-interrupt frame */
+ bsp = uwx_add_to_bsp(bsp, -adj);
+ cfm |= ec << 52;
+ uwx_init_context(env, ip, sp, bsp, cfm);
+ return UWX_OK;
+}
+
+int uwx_self_do_context_frame(
+ struct uwx_env *env,
+ struct uwx_self_info *info)
+{
+ int abi_context;
+ int status;
+ uint64_t ucontext;
+
+ abi_context = uwx_get_abi_context_code(env);
+ if (abi_context != UWX_ABI_HPUX_SIGCONTEXT)
+ return UWX_SELF_ERR_BADABICONTEXT;
+ status = uwx_get_reg(env, UWX_REG_GR(32), (uint64_t *)&ucontext);
+ if (status != 0)
+ return status;
+ return uwx_self_init_from_sigcontext(env, info, (ucontext_t *)ucontext);
+}
+
+int uwx_self_copyin(
+ int request,
+ char *loc,
+ uint64_t rem,
+ int len,
+ intptr_t tok)
+{
+ int status;
+ int regid;
+ unsigned int nat;
+ struct uwx_self_info *info = (struct uwx_self_info *) tok;
+ unsigned long *wp;
+ uint64_t *dp;
+
+ dp = (uint64_t *) loc;
+
+ if (request == UWX_COPYIN_UINFO ||
+ request == UWX_COPYIN_MSTACK) {
+ if (len == 4) {
+ wp = (unsigned long *) loc;
+ *wp = *(unsigned long *)rem;
+ TRACE_SELF_COPYIN4(rem, len, wp)
+ }
+ else if (len == 8) {
+ *dp = *(uint64_t *)rem;
+ TRACE_SELF_COPYIN4(rem, len, dp)
+ }
+ else
+ return 0;
+ }
+ else if (request == UWX_COPYIN_RSTACK && len == 8) {
+ if (info->ucontext == 0 || rem < info->bspstore) {
+ *dp = *(uint64_t *)rem;
+ TRACE_SELF_COPYIN4(rem, len, dp)
+ }
+ else {
+ status = __uc_get_rsebs(info->ucontext, (uint64_t *)rem, 1, dp);
+ if (status != 0)
+ return 0;
+ }
+ }
+ else if (request == UWX_COPYIN_REG && len == 8) {
+ if (info->ucontext == 0)
+ return 0;
+ regid = (int)rem;
+ if (rem < UWX_REG_GR(0)) {
+ switch (regid) {
+ case UWX_REG_PREDS:
+ status = __uc_get_prs(info->ucontext, dp);
+ break;
+ case UWX_REG_AR_PFS:
+ status = __uc_get_ar(info->ucontext, 64, dp);
+ break;
+ case UWX_REG_AR_RNAT:
+ status = __uc_get_ar(info->ucontext, 19, dp);
+ break;
+ case UWX_REG_AR_UNAT:
+ status = __uc_get_ar(info->ucontext, 36, dp);
+ break;
+ case UWX_REG_AR_FPSR:
+ status = __uc_get_ar(info->ucontext, 40, dp);
+ break;
+ case UWX_REG_AR_LC:
+ status = __uc_get_ar(info->ucontext, 65, dp);
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
+ status = __uc_get_grs(info->ucontext,
+ regid - UWX_REG_GR(0), 1, dp, &nat);
+ }
+ else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
+ status = __uc_get_brs(info->ucontext,
+ regid - UWX_REG_BR(0), 1, dp);
+ }
+ if (status != 0)
+ return 0;
+ }
+ return len;
+}
+
+
+int uwx_self_lookupip(
+ int request,
+ uint64_t ip,
+ intptr_t tok,
+ uint64_t **resultp)
+{
+ struct uwx_self_info *info = (struct uwx_self_info *) tok;
+ UINT64 handle;
+ struct load_module_desc desc;
+ uint64_t *unwind_base;
+ uint64_t *rvec;
+ int i;
+
+ if (request == UWX_LKUP_LOOKUP) {
+ TRACE_SELF_LOOKUP(ip)
+ if (ip >= info->sendsig_start && ip < info->sendsig_end) {
+ i = 0;
+ rvec = info->rvec;
+ rvec[i++] = UWX_KEY_CONTEXT;
+ rvec[i++] = UWX_ABI_HPUX_SIGCONTEXT;
+ rvec[i++] = 0;
+ rvec[i++] = 0;
+ *resultp = rvec;
+ return UWX_LKUP_FDESC;
+ }
+ else {
+ handle = dlmodinfo(ip, &desc, sizeof(desc), 0, 0, 0);
+ if (handle == 0)
+ return UWX_LKUP_ERR;
+ unwind_base = (uint64_t *) desc.unwind_base;
+ TRACE_SELF_LOOKUP_DESC(desc.text_base, unwind_base)
+ i = 0;
+ rvec = info->rvec;
+ rvec[i++] = UWX_KEY_TBASE;
+ rvec[i++] = desc.text_base;
+ rvec[i++] = UWX_KEY_UFLAGS;
+ rvec[i++] = unwind_base[0];
+ rvec[i++] = UWX_KEY_USTART;
+ rvec[i++] = desc.text_base + unwind_base[1];
+ rvec[i++] = UWX_KEY_UEND;
+ rvec[i++] = desc.text_base + unwind_base[2];
+ rvec[i++] = 0;
+ rvec[i++] = 0;
+ *resultp = rvec;
+ return UWX_LKUP_UTABLE;
+ }
+ }
+ else if (request == UWX_LKUP_FREE) {
+ return 0;
+ }
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_self.h b/sys/contrib/ia64/libuwx/src/uwx_self.h
new file mode 100644
index 0000000..e324d0d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_self.h
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <signal.h>
+#endif
+
+struct uwx_self_info;
+
+extern struct uwx_self_info *uwx_self_init_info(struct uwx_env *env);
+
+extern int uwx_self_free_info(struct uwx_self_info *info);
+
+extern int uwx_self_init_context(struct uwx_env *env);
+
+extern int uwx_self_init_from_sigcontext(
+ struct uwx_env *env,
+ struct uwx_self_info *info,
+ ucontext_t *ucontext);
+
+extern int uwx_self_do_context_frame(
+ struct uwx_env *env,
+ struct uwx_self_info *info);
+
+extern int uwx_self_copyin(
+ int request,
+ char *loc,
+ uint64_t rem,
+ int len,
+ intptr_t tok);
+
+extern int uwx_self_lookupip(
+ int request,
+ uint64_t ip,
+ intptr_t tok,
+ uint64_t **resultp);
+
+#define UWX_SELF_ERR_BADABICONTEXT (-101)
diff --git a/sys/contrib/ia64/libuwx/src/uwx_self_context.s b/sys/contrib/ia64/libuwx/src/uwx_self_context.s
new file mode 100644
index 0000000..fb89e76
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_self_context.s
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2002,2003 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef _LP64
+#define SWIZZLE add
+#define STPTR st8
+#else
+#define SWIZZLE addp4
+#define STPTR st4
+#endif
+
+rRP = r14
+rPFS = r15
+rUNAT = r16
+rRNAT = r17
+rENV0 = r18
+rENV1 = r19
+rENV2 = r20
+rNSLOT = r21
+rBSP = r22
+rPBSP = r23
+rRSC = r24
+rNATP = r25
+rBIAS = r26
+rRSC0 = r27
+rTMP1 = r28
+rTMP2 = r29
+rTMP3 = r30
+rTMP4 = r31
+rTMP5 = r8
+
+ .text
+ .proc uwx_self_init_context
+ .global uwx_self_init_context
+uwx_self_init_context:
+ .prologue
+ alloc rPFS = ar.pfs, 1, 0, 0, 0
+ mov rUNAT = ar.unat
+ .body
+ SWIZZLE rENV0 = r0, r32 // rENV0 = &env
+ ;;
+ flushrs
+ extr.u rNSLOT = rPFS, 7, 7 // nslots = pfs.sol
+ mov rRP = b0
+ ;;
+ mov rRSC = ar.rsc
+ add rENV1 = 120, rENV0 // rENV1 = &env->context.gr[0]
+ add rENV2 = 128, rENV0 // rENV2 = &env->context.gr[1]
+ ;;
+ and rRSC0 = -4, rRSC // clear ar.rsc.mode
+ adds rNATP = 0x1f8, r0
+ mov rTMP1 = b1
+ ;;
+ st8.spill [rENV1] = r4, 16 // env+120: r4
+ st8.spill [rENV2] = r5, 16 // env+128: r5
+ mov rTMP2 = b2
+ ;;
+ st8.spill [rENV1] = r6, 16 // env+136: r6
+ st8.spill [rENV2] = r7, 16 // env+144: r7
+ mov rTMP3 = b3
+ ;;
+ st8 [rENV1] = rTMP1, 16 // env+152: b1
+ st8 [rENV2] = rTMP2, 16 // env+160: b2
+ mov rTMP1 = b4
+ ;;
+ st8 [rENV1] = rTMP3, 16 // env+168: b3
+ st8 [rENV2] = rTMP1, 16 // env+176: b4
+ mov rTMP2 = b5
+ ;;
+ st8 [rENV1] = rTMP2 // env+184: b5
+ mov ar.rsc = rRSC0 // enforced lazy mode
+ add rENV1 = 8, rENV0
+ ;;
+ mov rRNAT = ar.rnat // get copy of ar.rnat
+ movl rTMP1 = 0x7fec8f00000000 // valid_regs: ip, sp, bsp, cfm,
+ // preds, rnat, unat, lc, grs, brs
+ ;;
+ mov ar.rsc = rRSC // restore ar.rsc
+ mov rBSP = ar.bsp
+ add rTMP3 = 120, rENV0 // spill_loc = &env->context.gr[0]
+ ;;
+ mov rTMP2 = ar.unat
+ nop
+ extr.u rTMP3 = rTMP3, 3, 6 // bitpos = spill_loc{8:3}
+ ;;
+ or rNATP = rBSP, rNATP // natp = bsp | 0x1f8
+ sub rTMP4 = 64, rTMP3 // (64 - bitpos)
+ shr rTMP5 = rTMP2, rTMP3 // (unat >> bitpos)
+ ;;
+ sub rBIAS = rNATP, rBSP // bias = (natp - bsp) ...
+ nop
+ shl rTMP2 = rTMP2, rTMP4 // (unat << (64 - bitpos))
+ ;;
+ or rTMP2 = rTMP2, rTMP5 // rotate_right(unat, bitpos)
+ extr.u rBIAS = rBIAS, 3, 6 // ... div 8
+ mov rTMP4 = pr
+ ;;
+ st8 [rENV0] = rTMP1, 16 // env+0: valid_regs mask
+ st8 [rENV1] = rRP, 24 // env+8: ip (my rp)
+ add rBIAS = rNSLOT, rBIAS // bias += nslots
+ ;;
+ cmp.lt p6, p0 = 63, rBIAS // if (63 < bias) ...
+ cmp.lt p7, p0 = 126, rBIAS // if (126 < bias) ...
+ nop
+ ;;
+ st8 [rENV0] = r12, 48 // env+16: sp
+ st8 [rENV1] = rPFS, 40 // env+32: cfm (my pfs)
+(p6) add rNSLOT = 1, rNSLOT // ... nslots++
+ ;;
+ st8 [rENV0] = rTMP4, 24 // env+64: preds
+ st8 [rENV1] = rTMP2, 24 // env+72: priunat
+(p7) add rNSLOT = 1, rNSLOT // ... nslots++
+ ;;
+ st8 [rENV0] = rRNAT, -64 // env+88: rnat
+ st8 [rENV1] = rUNAT, 8 // env+96: unat
+ dep.z rTMP3 = rNSLOT, 3, 7 // (nslots << 3)
+ ;;
+ sub rPBSP = rBSP, rTMP3 // prev_bsp = bsp - (nslots << 3)
+ mov rTMP3 = ar.fpsr
+ mov rTMP1 = ar.lc
+ ;;
+ st8 [rENV0] = rPBSP // env+24: bsp (my prev bsp)
+ st8 [rENV1] = rTMP3, 8 // env+104: fpsr
+ add rENV2 = 320, rENV2 // rENV2 = &env->context.rstate
+ ;;
+ st8 [rENV1] = rTMP1 // env+112: lc
+ STPTR [rENV2] = r0 // env+512: env->rstate = 0
+ nop
+ ;;
+ mov ar.unat = rUNAT
+ mov ret0 = r0 // return UWX_OK
+ br.ret.sptk b0
+ .endp
+
diff --git a/sys/contrib/ia64/libuwx/src/uwx_step.c b/sys/contrib/ia64/libuwx/src/uwx_step.c
new file mode 100644
index 0000000..6cacfc2
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_step.c
@@ -0,0 +1,590 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_context.h"
+#include "uwx_utable.h"
+#include "uwx_uinfo.h"
+#include "uwx_scoreboard.h"
+#include "uwx_str.h"
+#include "uwx_step.h"
+#include "uwx_trace.h"
+
+/*
+ * uwx_step.c
+ *
+ * This file contains the routines for stepping from one frame
+ * into its callers frame. The context for the current frame
+ * is maintained inside the current unwind environment
+ * (struct uwx_env), and is updated with each call to
+ * uwx_step() to refer to the previous frame.
+ */
+
+
+/* Forward Declarations */
+
+int uwx_decode_uvec(struct uwx_env *env, uint64_t *uvec, uint64_t **rstate);
+int uwx_restore_reg(struct uwx_env *env, uint64_t rstate,
+ uint64_t *valp, uint64_t *histp);
+int uwx_restore_freg(struct uwx_env *env, uint64_t rstate,
+ uint64_t *valp, uint64_t *histp);
+int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat);
+
+
+/* uwx_get_frame_info: Gets unwind info for current frame */
+static
+int uwx_get_frame_info(struct uwx_env *env)
+{
+ int i;
+ int status;
+ int cbstatus;
+ uint64_t *uvec;
+ uint64_t *rstate;
+ struct uwx_utable_entry uentry;
+ uint64_t uvecout[4];
+
+ if (env->copyin == 0 || env->lookupip == 0)
+ return UWX_ERR_NOCALLBACKS;
+
+ env->function_offset = -1LL;
+ env->function_name = 0;
+ env->module_name = 0;
+ uwx_reset_str_pool(env);
+
+ /* Use the lookup IP callback routine to find out about the */
+ /* current IP. If the predicate registers are valid, pass them */
+ /* in the uvec. */
+
+ i = 0;
+ if (env->context.valid_regs & (1 << UWX_REG_PREDS)) {
+ uvecout[i++] = UWX_KEY_PREDS;
+ uvecout[i++] = env->context.special[UWX_REG_PREDS];
+ }
+ uvecout[i++] = UWX_KEY_END;
+ uvecout[i++] = 0;
+ uvec = uvecout;
+ cbstatus = (*env->lookupip)(UWX_LKUP_LOOKUP,
+ env->context.special[UWX_REG_IP], env->cb_token, &uvec);
+
+ /* If NOTFOUND, there's nothing we can do but return an error. */
+
+ if (cbstatus == UWX_LKUP_NOTFOUND) {
+ status = UWX_ERR_IPNOTFOUND;
+ }
+
+ /* If the callback returns an unwind table, we need to */
+ /* search the table for an unwind entry that describes the */
+ /* code region of interest, then decode the unwind information */
+ /* associated with that unwind table entry, and store the */
+ /* resulting register state array in the unwind environment */
+ /* block. */
+
+ else if (cbstatus == UWX_LKUP_UTABLE) {
+ status = uwx_search_utable(env, uvec, &uentry);
+ (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec);
+ if (status == UWX_OK)
+ status = uwx_decode_uinfo(env, &uentry, &rstate);
+ else if (status == UWX_ERR_NOUENTRY)
+ status = uwx_default_rstate(env, &rstate);
+ if (status == UWX_OK)
+ env->rstate = rstate;
+ }
+
+ /* If the callback returns a frame description (in the form */
+ /* of an update vector), convert the update vector into a */
+ /* register state array, then invoke the callback again to */
+ /* let it free any memory it allocated. */
+
+ else if (cbstatus == UWX_LKUP_FDESC) {
+ status = uwx_decode_uvec(env, uvec, &rstate);
+ (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec);
+ if (status == UWX_OK)
+ env->rstate = rstate;
+ }
+
+ /* Any other return from the callback is an error. */
+
+ else {
+ status = UWX_ERR_LOOKUPERR;
+ }
+ return status;
+}
+
+
+/* uwx_restore_markers: Restores the stack markers -- PSP, RP, PFS */
+
+int uwx_restore_markers(struct uwx_env *env)
+{
+ int status;
+ uint64_t val;
+ uint64_t hist;
+
+ if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4)
+ return UWX_ERR_NOCONTEXT;
+
+ /* If we haven't already obtained the frame info for the */
+ /* current frame, get it now. */
+
+ if (env->rstate == 0) {
+ status = uwx_get_frame_info(env);
+ if (status != UWX_OK)
+ return status;
+ }
+
+ TRACE_S_STEP(env->rstate)
+
+ if (env->rstate[SBREG_PSP] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_PSP], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_PSP] = val;
+ env->history.special[UWX_REG_PSP] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_PSP;
+ TRACE_S_RESTORE_REG("PSP", env->rstate[SBREG_PSP], val)
+ }
+
+ if (env->rstate[SBREG_RP] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_RP], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_RP] = val;
+ env->history.special[UWX_REG_RP] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_RP;
+ TRACE_S_RESTORE_REG("RP", env->rstate[SBREG_RP], val)
+ }
+
+ if (env->rstate[SBREG_PFS] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_PFS], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_PFS] = val;
+ env->history.special[UWX_REG_PFS] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_PFS;
+ TRACE_S_RESTORE_REG("PFS", env->rstate[SBREG_PFS], val)
+ }
+
+ return UWX_OK;
+}
+
+/* uwx_get_sym_info: Gets symbolic info from current frame */
+
+int uwx_get_sym_info(
+ struct uwx_env *env,
+ char **modp,
+ char **symp,
+ uint64_t *offsetp)
+{
+ int status;
+ int cbstatus;
+ uint64_t ip;
+ uint64_t *uvec;
+ uint64_t uvecout[2];
+ int i;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ /* If we haven't already obtained the frame info for the */
+ /* current frame, get it now. */
+
+ if (env->rstate == 0) {
+ status = uwx_get_frame_info(env);
+ if (status != UWX_OK)
+ return status;
+ }
+
+ /* Get the symbolic information from the lookup IP callback. */
+ if (env->function_name == 0) {
+ ip = env->context.special[UWX_REG_IP];
+ i = 0;
+ if (env->function_offset >= 0) {
+ uvecout[i++] = UWX_KEY_FUNCSTART;
+ uvecout[i++] = ip - env->function_offset;
+ }
+ uvecout[i++] = UWX_KEY_END;
+ uvecout[i++] = 0;
+ uvec = uvecout;
+ cbstatus = (*env->lookupip)(UWX_LKUP_SYMBOLS,
+ env->context.special[UWX_REG_IP], env->cb_token, &uvec);
+
+ if (cbstatus == UWX_LKUP_SYMINFO) {
+ for (i = 0; uvec[i] != UWX_KEY_END; i += 2) {
+ switch ((int)uvec[i]) {
+ case UWX_KEY_MODULE:
+ env->module_name =
+ uwx_alloc_str(env, (char *)(uvec[i+1]));
+ break;
+ case UWX_KEY_FUNC:
+ env->function_name =
+ uwx_alloc_str(env, (char *)(uvec[i+1]));
+ break;
+ case UWX_KEY_FUNCSTART:
+ env->function_offset = ip - uvec[i+1];
+ break;
+ }
+ }
+ (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec);
+ }
+ }
+
+ *modp = env->module_name;
+ *symp = env->function_name;
+ *offsetp = env->function_offset;
+
+ return UWX_OK;
+}
+
+
+/* uwx_step: Steps from the current frame to the previous frame */
+
+int uwx_step(struct uwx_env *env)
+{
+ int i;
+ int status;
+ int pfs_sol;
+ int dispcode;
+ uint64_t val;
+ uint64_t fval[2];
+ uint64_t hist;
+ uint64_t tempgr[NPRESERVEDGR];
+ int needpriunat;
+ int unat;
+ int tempnat;
+
+ if (env == 0)
+ return UWX_ERR_NOENV;
+
+ /* Complete the current context by restoring the current values */
+ /* of psp, rp, and pfs. */
+
+ if (env->rstate == 0 ||
+ (env->context.valid_regs & VALID_MARKERS) != VALID_MARKERS) {
+ status = uwx_restore_markers(env);
+ if (status != UWX_OK)
+ return status;
+ }
+
+ /* Check for bottom of stack (rp == 0). */
+
+ if (env->context.special[UWX_REG_RP] == 0)
+ return UWX_BOTTOM;
+
+ /* Find where the primary unat is saved, get a copy. */
+ /* Then, as we restore the GRs, we'll merge the NaT bits into the */
+ /* priunat register in the context. */
+ /* (Make sure we need it, though, before we try to get it, */
+ /* because the attempt to get it might invoke the copy-in callback. */
+ /* We don't need the priunat unless one of GR 4-7 was */
+ /* saved to the memory stack.) */
+
+ needpriunat = 0;
+ for (i = 0; i < NSB_GR; i++) {
+ dispcode = UWX_GET_DISP_CODE(env->rstate[SBREG_GR + i]);
+ if (dispcode == UWX_DISP_SPREL(0) || dispcode == UWX_DISP_PSPREL(0))
+ needpriunat = 1;
+ }
+ unat = 0;
+ if (needpriunat && env->rstate[SBREG_PRIUNAT] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_PRIUNAT], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ unat = (int) val;
+ env->history.special[UWX_REG_PRIUNAT] = hist;
+ TRACE_S_RESTORE_REG("PRIUNAT", env->rstate[SBREG_PRIUNAT], val)
+ }
+
+ /* Retrieve saved values of the preserved GRs into temporaries. */
+
+ tempnat = (int) env->context.special[UWX_REG_PRIUNAT];
+ for (i = 0; i < NSB_GR; i++) {
+ if (env->rstate[SBREG_GR + i] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env,
+ env->rstate[SBREG_GR + i], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ tempgr[i] = val;
+ if (uwx_restore_nat(env, env->rstate[SBREG_GR + i], unat))
+ tempnat |= 1 << i;
+ else
+ tempnat &= ~(1 << i);
+ env->history.gr[i] = hist;
+ env->context.valid_regs |= 1 << (i + VALID_GR_SHIFT);
+ TRACE_S_RESTORE_GR(i, env->rstate[SBREG_GR + i], val)
+ }
+ }
+
+ /* Now we have everything we need to step back to the previous frame. */
+
+ /* Restore preserved BRs. */
+
+ for (i = 0; i < NSB_BR; i++) {
+ if (env->rstate[SBREG_BR + i] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env,
+ env->rstate[SBREG_BR + i], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.br[i] = val;
+ env->history.br[i] = hist;
+ env->context.valid_regs |= 1 << (i + VALID_BR_SHIFT);
+ TRACE_S_RESTORE_BR(i, env->rstate[SBREG_BR + i], val)
+ }
+ }
+
+ /* Restore preserved FRs. */
+
+ if (env->nsbreg == NSBREG) {
+ for (i = 0; i < NSB_FR; i++) {
+ if (env->rstate[SBREG_FR + i] != UWX_DISP_NONE) {
+ status = uwx_restore_freg(env,
+ env->rstate[SBREG_FR + i], fval, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.fr[i].part0 = fval[0];
+ env->context.fr[i].part1 = fval[1];
+ env->history.fr[i] = hist;
+ env->context.valid_frs |= 1 << i;
+ TRACE_S_RESTORE_FR(i, env->rstate[SBREG_FR + i], fval)
+ }
+ }
+ }
+
+ /* Restore other preserved regs. */
+
+ if (env->rstate[SBREG_PREDS] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_PREDS], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_PREDS] = val;
+ env->history.special[UWX_REG_PREDS] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_PREDS;
+ TRACE_S_RESTORE_REG("PREDS", env->rstate[SBREG_PREDS], val)
+ }
+ if (env->rstate[SBREG_RNAT] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_RNAT], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_AR_RNAT] = val;
+ env->history.special[UWX_REG_AR_RNAT] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_AR_RNAT;
+ TRACE_S_RESTORE_REG("RNAT", env->rstate[SBREG_RNAT], val)
+ }
+ if (env->rstate[SBREG_UNAT] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_UNAT], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_AR_UNAT] = val;
+ env->history.special[UWX_REG_AR_UNAT] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_AR_UNAT;
+ TRACE_S_RESTORE_REG("UNAT", env->rstate[SBREG_UNAT], val)
+ }
+ if (env->rstate[SBREG_FPSR] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_FPSR], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_AR_FPSR] = val;
+ env->history.special[UWX_REG_AR_FPSR] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_AR_FPSR;
+ TRACE_S_RESTORE_REG("FPSR", env->rstate[SBREG_FPSR], val)
+ }
+ if (env->rstate[SBREG_LC] != UWX_DISP_NONE) {
+ status = uwx_restore_reg(env, env->rstate[SBREG_LC], &val, &hist);
+ if (status != UWX_OK)
+ return status;
+ env->context.special[UWX_REG_AR_LC] = val;
+ env->history.special[UWX_REG_AR_LC] = hist;
+ env->context.valid_regs |= 1 << UWX_REG_AR_LC;
+ TRACE_S_RESTORE_REG("LC", env->rstate[SBREG_LC], val)
+ }
+
+ /* Restore preserved GRs from temporaries. */
+
+ for (i = 0; i < NSB_GR; i++) {
+ if (env->rstate[SBREG_GR + i] != UWX_DISP_NONE)
+ env->context.gr[i] = tempgr[i];
+ }
+ env->context.special[UWX_REG_PRIUNAT] = tempnat;
+
+ /* Restore the frame markers. */
+
+ env->context.special[UWX_REG_IP] = env->context.special[UWX_REG_RP];
+ env->history.special[UWX_REG_IP] = env->history.special[UWX_REG_RP];
+
+ env->context.special[UWX_REG_SP] = env->context.special[UWX_REG_PSP];
+ env->history.special[UWX_REG_SP] = env->history.special[UWX_REG_PSP];
+
+ pfs_sol = ((unsigned int)env->context.special[UWX_REG_PFS] >> 7) & 0x7f;
+ env->context.special[UWX_REG_BSP] = uwx_add_to_bsp(
+ env->context.special[UWX_REG_BSP],
+ -pfs_sol);
+
+ env->context.special[UWX_REG_CFM] = env->context.special[UWX_REG_PFS];
+ env->history.special[UWX_REG_CFM] = env->history.special[UWX_REG_PFS];
+
+ env->context.special[UWX_REG_RP] = 0;
+
+ /* The frame info for the new frame isn't yet available. */
+
+ env->rstate = 0;
+ env->context.valid_regs &= ~VALID_MARKERS;
+
+ return UWX_OK;
+}
+
+
+/* uwx_decode_uvec: Converts the update vector into a register state array */
+
+int uwx_decode_uvec(struct uwx_env *env, uint64_t *uvec, uint64_t **rstate)
+{
+ while (*uvec != 0) {
+ switch ((int)*uvec++) {
+ case UWX_KEY_CONTEXT:
+ env->abi_context = (int)(*uvec++);
+ return UWX_ABI_FRAME;
+ default:
+ return UWX_ERR_CANTUNWIND;
+ }
+ }
+ return UWX_OK;
+}
+
+
+/* uwx_restore_reg: Restores a register according to the scoreboard */
+
+#define COPYIN_MSTACK_8(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_MSTACK, (dest), (src), \
+ DWORDSZ, env->cb_token) : \
+ (*(uint64_t *)(dest) = *(uint64_t *)(src), DWORDSZ) )
+
+int uwx_restore_reg(struct uwx_env *env, uint64_t rstate,
+ uint64_t *valp, uint64_t *histp)
+{
+ int status;
+ uint64_t p;
+ int n;
+ int regid;
+
+ status = UWX_OK;
+
+ switch (UWX_GET_DISP_CODE(rstate)) {
+ case UWX_DISP_SPPLUS(0):
+ *valp = env->context.special[UWX_REG_SP] +
+ UWX_GET_DISP_OFFSET(rstate);
+ *histp = UWX_DISP_NONE;
+ break;
+ case UWX_DISP_SPREL(0):
+ p = env->context.special[UWX_REG_SP] +
+ UWX_GET_DISP_OFFSET(rstate);
+ n = COPYIN_MSTACK_8((char *)valp, p);
+ if (n != DWORDSZ)
+ status = UWX_ERR_COPYIN_MSTK;
+ *histp = UWX_DISP_MSTK(p);
+ break;
+ case UWX_DISP_PSPREL(0):
+ p = env->context.special[UWX_REG_PSP] + 16 -
+ UWX_GET_DISP_OFFSET(rstate);
+ n = COPYIN_MSTACK_8((char *)valp, p);
+ if (n != DWORDSZ)
+ status = UWX_ERR_COPYIN_MSTK;
+ *histp = UWX_DISP_MSTK(p);
+ break;
+ case UWX_DISP_REG(0):
+ regid = UWX_GET_DISP_REGID(rstate);
+ status = uwx_get_reg(env, regid, valp);
+ (void) uwx_get_spill_loc(env, regid, histp);
+ break;
+ }
+ return status;
+}
+
+#define COPYIN_MSTACK_16(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_MSTACK, (dest), (src), \
+ 2*DWORDSZ, env->cb_token) : \
+ (*(uint64_t *)(dest) = *(uint64_t *)(src), \
+ *(uint64_t *)((dest)+8) = *(uint64_t *)((src)+8), \
+ 2*DWORDSZ) )
+
+int uwx_restore_freg(struct uwx_env *env, uint64_t rstate,
+ uint64_t *valp, uint64_t *histp)
+{
+ int status;
+ uint64_t p;
+ int n;
+ int regid;
+
+ status = UWX_OK;
+
+ switch (UWX_GET_DISP_CODE(rstate)) {
+ case UWX_DISP_SPREL(0):
+ p = env->context.special[UWX_REG_SP] +
+ UWX_GET_DISP_OFFSET(rstate);
+ n = COPYIN_MSTACK_16((char *)valp, p);
+ if (n != 2*DWORDSZ)
+ status = UWX_ERR_COPYIN_MSTK;
+ *histp = UWX_DISP_MSTK(p);
+ break;
+ case UWX_DISP_PSPREL(0):
+ p = env->context.special[UWX_REG_PSP] + 16 -
+ UWX_GET_DISP_OFFSET(rstate);
+ n = COPYIN_MSTACK_16((char *)valp, p);
+ if (n != 2*DWORDSZ)
+ status = UWX_ERR_COPYIN_MSTK;
+ *histp = UWX_DISP_MSTK(p);
+ break;
+ case UWX_DISP_REG(0):
+ regid = UWX_GET_DISP_REGID(rstate);
+ status = uwx_get_reg(env, regid, valp);
+ (void) uwx_get_spill_loc(env, regid, histp);
+ break;
+ }
+ return status;
+}
+
+/* uwx_restore_nat: Returns the saved NaT bit for a preserved GR */
+
+int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat)
+{
+ int nat;
+ uint64_t p;
+
+ nat = 0;
+ switch (UWX_GET_DISP_CODE(rstate)) {
+ case UWX_DISP_SPREL(0):
+ p = env->context.special[UWX_REG_SP] +
+ UWX_GET_DISP_OFFSET(rstate);
+ nat = (unat >> (((int)p >> 3) & 0x3f)) & 0x01;
+ break;
+ case UWX_DISP_PSPREL(0):
+ p = env->context.special[UWX_REG_PSP] + 16 -
+ UWX_GET_DISP_OFFSET(rstate);
+ nat = (unat >> (((int)p >> 3) & 0x3f)) & 0x01;
+ break;
+ case UWX_DISP_REG(0):
+ (void) uwx_get_nat(env, UWX_GET_DISP_REGID(rstate), &nat);
+ break;
+ }
+ return nat;
+}
+
diff --git a/sys/contrib/ia64/libuwx/src/uwx_step.h b/sys/contrib/ia64/libuwx/src/uwx_step.h
new file mode 100644
index 0000000..6a54132
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_step.h
@@ -0,0 +1,25 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+extern int uwx_restore_markers(struct uwx_env *env);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_str.c b/sys/contrib/ia64/libuwx/src/uwx_str.c
new file mode 100644
index 0000000..4704a75
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_str.c
@@ -0,0 +1,124 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_str.h"
+
+#ifdef _KERNEL
+#define free(p) /* nullified */
+#define malloc(sz) NULL
+#endif
+
+/*
+ * uwx_str.c
+ *
+ * This file contains the routines for maintaining a string
+ * pool for the unwind environment. We preallocate enough
+ * space for most purposes so that no memory allocation is
+ * necessary during a normal unwind. If we do need more,
+ * we use the allocate callback, if one is provided.
+ *
+ * The string pool is reused with each call to step(),
+ * and is completely freed when the unwind environment is
+ * freed.
+ */
+
+
+int uwx_init_str_pool(struct uwx_env *env)
+{
+ if (env->allocate_cb == 0)
+ env->string_pool = (struct uwx_str_pool *)
+ malloc(sizeof(struct uwx_str_pool));
+ else
+ env->string_pool = (struct uwx_str_pool *)
+ (*env->allocate_cb)(sizeof(struct uwx_str_pool));
+
+ if (env->string_pool == 0)
+ return UWX_ERR_NOMEM;
+
+ env->string_pool->next = 0;
+ env->string_pool->size = STRPOOLSIZE;
+ env->string_pool->used = 0;
+
+ return UWX_OK;
+}
+
+void uwx_free_str_pool(struct uwx_env *env)
+{
+ struct uwx_str_pool *pool;
+ struct uwx_str_pool *next;
+
+ for (pool = env->string_pool; pool != 0; pool = next) {
+ next = pool->next;
+ if (env->free_cb == 0)
+ free(pool);
+ else
+ (*env->free_cb)(pool);
+ }
+}
+
+char *uwx_alloc_str(struct uwx_env *env, char *str)
+{
+ int len;
+ int size;
+ struct uwx_str_pool *pool;
+ struct uwx_str_pool *prev;
+ char *p;
+
+ len = strlen(str) + 1;
+ prev = 0;
+ for (pool = env->string_pool; pool != 0; pool = pool->next) {
+ prev = pool;
+ if (pool->size - pool->used >= len)
+ break;
+ }
+ if (pool == 0) {
+ size = STRPOOLSIZE;
+ if (len > size)
+ size = len;
+ size += sizeof(struct uwx_str_pool) - STRPOOLSIZE;
+ if (env->allocate_cb == 0)
+ pool = (struct uwx_str_pool *) malloc(size);
+ else
+ pool = (struct uwx_str_pool *) (*env->allocate_cb)(size);
+ if (env->string_pool == 0)
+ return 0;
+ pool->next = 0;
+ pool->size = size;
+ pool->used = 0;
+ prev->next = pool;
+ }
+ p = pool->pool + pool->used;
+ strcpy(p, str);
+ pool->used += len;
+ return p;
+}
+
+void uwx_reset_str_pool(struct uwx_env *env)
+{
+ struct uwx_str_pool *pool;
+
+ for (pool = env->string_pool; pool != 0; pool = pool->next)
+ pool->used = 0;
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_str.h b/sys/contrib/ia64/libuwx/src/uwx_str.h
new file mode 100644
index 0000000..f55340e
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_str.h
@@ -0,0 +1,37 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#define STRPOOLSIZE 400
+
+struct uwx_str_pool {
+ struct uwx_str_pool *next;
+ int size;
+ int used;
+ char pool[STRPOOLSIZE];
+};
+
+extern int uwx_init_str_pool(struct uwx_env *env);
+extern void uwx_free_str_pool(struct uwx_env *env);
+extern char *uwx_alloc_str(struct uwx_env *env, char *str);
+extern void uwx_reset_str_pool(struct uwx_env *env);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_swap.c b/sys/contrib/ia64/libuwx/src/uwx_swap.c
new file mode 100644
index 0000000..19d57bd
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_swap.c
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_swap.h"
+
+void uwx_swap4(uint32_t *w)
+{
+ unsigned char *p;
+ unsigned char t[4];
+
+ p = (unsigned char *) w;
+
+ t[0] = p[0];
+ t[1] = p[1];
+ t[2] = p[2];
+ t[3] = p[3];
+
+ p[0] = t[3];
+ p[1] = t[2];
+ p[2] = t[1];
+ p[3] = t[0];
+}
+
+void uwx_swap8(uint64_t *dw)
+{
+ unsigned char *p;
+ unsigned char t[8];
+
+ p = (unsigned char *) dw;
+
+ t[0] = p[0];
+ t[1] = p[1];
+ t[2] = p[2];
+ t[3] = p[3];
+ t[4] = p[4];
+ t[5] = p[5];
+ t[6] = p[6];
+ t[7] = p[7];
+
+ p[0] = t[7];
+ p[1] = t[6];
+ p[2] = t[5];
+ p[3] = t[4];
+ p[4] = t[3];
+ p[5] = t[2];
+ p[6] = t[1];
+ p[7] = t[0];
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_swap.h b/sys/contrib/ia64/libuwx/src/uwx_swap.h
new file mode 100644
index 0000000..1eb24d4
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_swap.h
@@ -0,0 +1,26 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+extern void uwx_swap4(uint32_t *w);
+extern void uwx_swap8(uint64_t *dw);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_trace.c b/sys/contrib/ia64/libuwx/src/uwx_trace.c
new file mode 100644
index 0000000..11c3db6
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_trace.c
@@ -0,0 +1,143 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_uinfo.h"
+#include "uwx_scoreboard.h"
+#include "uwx_trace.h"
+
+#ifdef UWX_TRACE_ENABLE
+
+void uwx_trace_init(struct uwx_env *env)
+{
+ char *tstr;
+
+ tstr = getenv("UWX_TRACE");
+ if (tstr != NULL) {
+ while (*tstr != '\0') {
+ switch (*tstr) {
+ case 'i': env->trace |= UWX_TRACE_UINFO; break;
+ case 't': env->trace |= UWX_TRACE_UTABLE; break;
+ case 'b': env->trace |= UWX_TRACE_SB; break;
+ case 'r': env->trace |= UWX_TRACE_RSTATE; break;
+ case 's': env->trace |= UWX_TRACE_STEP; break;
+ case 'c': env->trace |= UWX_TRACE_CONTEXT; break;
+ case 'C': env->trace |= UWX_TRACE_COPYIN; break;
+ case 'L': env->trace |= UWX_TRACE_LOOKUPIP; break;
+ case '?':
+#ifdef _KERNEL
+ printf("UWX_TRACE flag `%c' unknown.\n", *tstr);
+#else
+ fprintf(stderr, "UWX_TRACE flags:\n");
+ fprintf(stderr, " i: unwind info\n");
+ fprintf(stderr, " t: unwind table searching\n");
+ fprintf(stderr, " b: scoreboard management\n");
+ fprintf(stderr, " r: register state vector\n");
+ fprintf(stderr, " s: step\n");
+ fprintf(stderr, " c: context\n");
+ fprintf(stderr, " C: copyin callback\n");
+ fprintf(stderr, " L: lookup ip callback\n");
+ exit(1);
+#endif
+ }
+ tstr++;
+ }
+ }
+}
+
+char *uwx_sb_rnames[] = {
+ "RP", "PSP", "PFS",
+ "PREDS", "UNAT", "PRIUNAT", "RNAT", "LC", "FPSR",
+ "GR4", "GR5", "GR6", "GR7",
+ "BR1", "BR2", "BR3", "BR4", "BR5",
+ "FR2", "FR3", "FR4", "FR5",
+ "FR16", "FR17", "FR18", "FR19",
+ "FR20", "FR21", "FR22", "FR23",
+ "FR24", "FR25", "FR26", "FR27",
+ "FR28", "FR29", "FR30", "FR31",
+};
+
+void uwx_dump_rstate(int regid, uint64_t rstate)
+{
+ int reg;
+
+ if (rstate == UWX_DISP_NONE)
+ return;
+ printf(" %-7s", uwx_sb_rnames[regid]);
+ switch (UWX_GET_DISP_CODE(rstate)) {
+ case UWX_DISP_NONE:
+ printf(" unchanged\n");
+ break;
+ case UWX_DISP_SPPLUS(0):
+ printf(" SP + %d\n", (int)rstate & ~0x07);
+ break;
+ case UWX_DISP_SPREL(0):
+ printf(" [SP + %d]\n", (int)rstate & ~0x07);
+ break;
+ case UWX_DISP_PSPREL(0):
+ printf(" [PSP + 16 - %d]\n", (int)rstate & ~0x07);
+ break;
+ case UWX_DISP_REG(0):
+ reg = UWX_GET_DISP_REGID(rstate);
+ if (reg == UWX_REG_AR_PFS)
+ printf(" [AR.PFS]\n");
+ else if (reg == UWX_REG_AR_UNAT)
+ printf(" [AR.UNAT]\n");
+ else if (reg >= UWX_REG_GR(0) && reg < UWX_REG_GR(128))
+ printf(" [GR%d]\n", reg - UWX_REG_GR(0));
+ else if (reg >= UWX_REG_FR(0) && reg < UWX_REG_FR(128))
+ printf(" [FR%d]\n", reg - UWX_REG_FR(0));
+ else if (reg >= UWX_REG_BR(0) && reg < UWX_REG_BR(8))
+ printf(" [BR%d]\n", reg - UWX_REG_BR(0));
+ else
+ printf(" [reg %d]\n", reg);
+ break;
+ default:
+ printf(" <%08llx>\n", (unsigned long long)rstate);
+ break;
+ }
+}
+
+void uwx_dump_scoreboard(
+ struct uwx_scoreboard *scoreboard,
+ int nsbreg,
+ struct uwx_rhdr *rhdr,
+ int cur_slot,
+ int ip_slot)
+{
+ int i;
+
+ if (rhdr->is_prologue)
+ printf(" Prologue region (start = %d, length = %d)\n",
+ (int)cur_slot, (int)rhdr->rlen);
+ else
+ printf(" Body region (start = %d, length = %d, ecount = %d)\n",
+ cur_slot, (int)rhdr->rlen, rhdr->ecount);
+ if (ip_slot < rhdr->rlen)
+ printf(" IP is in this region (offset = %d)\n", ip_slot);
+ for (i = 0; i < nsbreg; i++)
+ uwx_dump_rstate(i, scoreboard->rstate[i]);
+}
+
+#endif /* UWX_TRACE_ENABLE */
diff --git a/sys/contrib/ia64/libuwx/src/uwx_trace.h b/sys/contrib/ia64/libuwx/src/uwx_trace.h
new file mode 100644
index 0000000..38a2e9d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_trace.h
@@ -0,0 +1,350 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#define UWX_TRACE_SB 1 /* UWX_TRACE=b: scoreboard mgmt */
+#define UWX_TRACE_UINFO 2 /* UWX_TRACE=i: unwind info */
+#define UWX_TRACE_RSTATE 4 /* UWX_TRACE=r: reg state vector */
+#define UWX_TRACE_STEP 8 /* UWX_TRACE=s: step */
+#define UWX_TRACE_UTABLE 16 /* UWX_TRACE=t: unwind tbl search */
+#define UWX_TRACE_CONTEXT 32 /* UWX_TRACE=c: context */
+#define UWX_TRACE_COPYIN 64 /* UWX_TRACE=C: copyin callback */
+#define UWX_TRACE_LOOKUPIP 128 /* UWX_TRACE=L: lookupip callback */
+
+#ifdef UWX_TRACE_ENABLE
+
+extern void uwx_trace_init(struct uwx_env *env);
+
+extern void uwx_dump_rstate(int regid, uint64_t rstate);
+
+struct uwx_rhdr;
+
+extern void uwx_dump_scoreboard(
+ struct uwx_scoreboard *scoreboard,
+ int nsbreg,
+ struct uwx_rhdr *rhdr,
+ int cur_slot,
+ int ip_slot);
+
+#define TRACE_INIT uwx_trace_init(env);
+
+#define TRACE_B_REUSE(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_alloc_scoreboard: reuse id %d\n", (id));
+
+#define TRACE_B_ALLOC(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_alloc_scoreboard: alloc id %d\n", (id));
+
+#define TRACE_B_POP(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_pop_scoreboards: free id %d\n", (id));
+
+#define TRACE_B_LABEL(label) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_label_scoreboard: label %d\n", (label));
+
+#define TRACE_B_LABEL_COPY(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_label_scoreboard: copy id %d\n", (id));
+
+#define TRACE_B_LABEL_REVERSE(back, new) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_label_scoreboard: reverse link %d -> %d\n", \
+ (new)->id, ((back) == 0) ? -1 : (back)->id);
+
+#define TRACE_B_COPY(label, id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_copy_scoreboard: label %d, cur sb id %d\n", (label), (id));
+
+#define TRACE_B_COPY_FREE(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_copy_scoreboard: free id %d\n", (id));
+
+#define TRACE_B_COPY_FOUND(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_copy_scoreboard: found id %d\n", (id));
+
+#define TRACE_B_COPY_COPY(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_copy_scoreboard: copy id %d\n", (id));
+
+#define TRACE_B_COPY_REVERSE(back, new) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_copy_scoreboard: reverse link %d -> %d\n", \
+ (new)->id, ((back) == 0) ? -1 : (back)->id);
+
+#define TRACE_B_FREE(id) \
+ if (env->trace & UWX_TRACE_SB) \
+ printf("uwx_free_scoreboards: free id %d\n", (id));
+
+#define TRACE_I_DECODE_RHDR_1(name, b0) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_rhdr: %02x %s\n", \
+ (b0), (name));
+
+#define TRACE_I_DECODE_RHDR_1L(name, b0, val) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_rhdr: %02x %08x %s\n", \
+ (b0), (int)(val), (name));
+
+#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_rhdr: %02x %02x %08x %s\n", \
+ (b0), (b1), (int)(val), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_1(name, b0) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %s\n", \
+ (b0), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %08x %s\n", \
+ (b0), (int)(val), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %08x %08x %s\n", \
+ (b0), (int)(val1), (int)(val2), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %02x %s\n", \
+ (b0), (b1), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, val) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %02x %08x %s\n", \
+ (b0), (b1), (int)(val), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %02x %02x %s\n", \
+ (b0), (b1), (b2), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: %02x %02x %02x %02x %s\n", \
+ (b0), (b1), (b2), (b3), (name));
+
+#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: spill base = %08x\n", (int)(spill_base));
+
+#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: gr_mem_mask = %02x; gr_gr_mask = %02x\n", \
+ (gr_mem_mask), (gr_gr_mask));
+
+#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_prologue: ngr = %d\n", (ngr));
+
+#define TRACE_I_DECODE_BODY_1(name, b0) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_body: %02x %s\n", \
+ (b0), (name));
+
+#define TRACE_I_DECODE_BODY_1L(name, b0, val) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_body: %02x %08x %s\n", \
+ (b0), (int)(val), (name));
+
+#define TRACE_I_DECODE_BODY_1LL(name, b0, val1, val2) \
+ if (env->trace & UWX_TRACE_UINFO) \
+ printf("uwx_decode_body: %02x %08x %08x %s\n", \
+ (b0), (int)(val1), (int)(val2), (name));
+
+#define TRACE_R_UIB(uentry, ulen) \
+ if (env->trace & UWX_TRACE_RSTATE) \
+ printf("Unwind info block (flags = %08x %08x, ulen = %d)\n", \
+ (unsigned int)((uentry)->unwind_flags >> 32), \
+ (unsigned int)(uentry)->unwind_flags, \
+ (ulen));
+
+#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) \
+ if (env->trace & UWX_TRACE_RSTATE) \
+ uwx_dump_scoreboard(scoreboard, env->nsbreg, \
+ &(rhdr), cur_slot, ip_slot);
+
+#define TRACE_S_STEP(rstate) \
+ if (env->trace & UWX_TRACE_STEP) { \
+ printf("uwx_restore_markers:\n"); \
+ uwx_dump_rstate(SBREG_RP, (rstate)[SBREG_RP]); \
+ uwx_dump_rstate(SBREG_PSP, (rstate)[SBREG_PSP]); \
+ uwx_dump_rstate(SBREG_PFS, (rstate)[SBREG_PFS]); \
+ }
+
+#define TRACE_S_RESTORE_REG(regname, rstate, val) \
+ if (env->trace & UWX_TRACE_STEP) \
+ printf(" restore %-7s (rstate = %08x %08x) = %08x %08x\n", \
+ regname, \
+ (unsigned int) ((rstate) >> 32), \
+ (unsigned int) (rstate), \
+ (unsigned int) ((val) >> 32), \
+ (unsigned int) (val));
+
+#define TRACE_S_RESTORE_GR(regid, rstate, val) \
+ if (env->trace & UWX_TRACE_STEP) \
+ printf(" restore GR%d (rstate = %08x %08x) = %08x %08x\n", \
+ (regid) + 4, \
+ (unsigned int) ((rstate) >> 32), \
+ (unsigned int) (rstate), \
+ (unsigned int) ((val) >> 32), \
+ (unsigned int) (val));
+
+#define TRACE_S_RESTORE_BR(regid, rstate, val) \
+ if (env->trace & UWX_TRACE_STEP) \
+ printf(" restore BR%d (rstate = %08x %08x) = %08x %08x\n", \
+ (regid) + 1, \
+ (unsigned int) ((rstate) >> 32), \
+ (unsigned int) (rstate), \
+ (unsigned int) ((val) >> 32), \
+ (unsigned int) (val));
+
+#define TRACE_S_RESTORE_FR(regid, rstate, fval) \
+ if (env->trace & UWX_TRACE_STEP) \
+ printf(" restore FR%d (rstate = %08x %08x) = %08x %08x %08x %08x\n", \
+ (regid) + 1, \
+ (unsigned int) ((rstate) >> 32), \
+ (unsigned int) (rstate), \
+ (unsigned int) ((fval[0]) >> 32), \
+ (unsigned int) (fval[0]), \
+ (unsigned int) ((fval[1]) >> 32), \
+ (unsigned int) (fval[1]));
+
+#define TRACE_T_SEARCH32(ip) \
+ if (env->trace & UWX_TRACE_UTABLE) \
+ printf("uwx_search_utable32 (relative ip = %08x)\n", (ip));
+
+#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) \
+ if (env->trace & UWX_TRACE_UTABLE) \
+ printf(" lb/ub = %d/%d, mid = %d, start/end = %08x %08x\n", \
+ lb, ub, mid, code_start, code_end);
+
+#define TRACE_C_GET_REG(regid, bsp) \
+ if (env->trace & UWX_TRACE_CONTEXT) \
+ printf("uwx_get_reg (gr%d, bsp = %08x %08x)\n", \
+ (regid) - UWX_REG_GR(0), \
+ (unsigned int) ((bsp) >> 32), \
+ (unsigned int) (bsp));
+
+#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid) \
+ if (env->trace & UWX_TRACE_CONTEXT) \
+ printf("uwx_get_reg (gr%d, sor = %d, rrb = %d) --> gr%d\n", \
+ (regid) + 32, \
+ (sor), \
+ (rrb_gr), \
+ (newregid) + 32);
+
+#define TRACE_SELF_COPYIN4(rem, len, wp) \
+ if (info->trace & UWX_TRACE_COPYIN) \
+ printf("copyin (rem = %08x %08x, len = %d, val = %08x)\n", \
+ (unsigned int) ((rem) >> 32), \
+ (unsigned int) (rem), \
+ (len), *(wp));
+
+#define TRACE_SELF_COPYIN8(rem, len, dp) \
+ if (info->trace & UWX_TRACE_COPYIN) \
+ printf("copyin (rem = %08x %08x, len = %d, val = %08x %08x)\n", \
+ (unsigned int) ((rem) >> 32), \
+ (unsigned int) (rem), \
+ (len), \
+ ((unsigned int *)(dp))[0], \
+ ((unsigned int *)(dp))[1]);
+
+#define TRACE_SELF_LOOKUP(ip) \
+ if (info->trace & UWX_TRACE_LOOKUPIP) \
+ printf("Lookup IP callback: ip = %08x %08x\n", \
+ (unsigned int) ((ip) >> 32), \
+ (unsigned int) (ip));
+
+#define TRACE_SELF_LOOKUP_DESC(text_base, unwind_base) \
+ if (info->trace & UWX_TRACE_LOOKUPIP) { \
+ printf(" text base: %08x %08x\n", \
+ (unsigned int) ((text_base) >> 32), \
+ (unsigned int) (text_base)); \
+ printf(" unwind base: %08x %08x\n", \
+ (unsigned int) ((uint64_t)(unwind_base) >> 32), \
+ (unsigned int) (unwind_base)); \
+ printf(" unwind flags: %08x %08x\n", \
+ (unsigned int) ((unwind_base)[0] >> 32), \
+ (unsigned int) (unwind_base)[0]); \
+ printf(" unwind start: %08x %08x\n", \
+ (unsigned int) (((text_base)+(unwind_base)[1]) >> 32), \
+ (unsigned int) ((text_base)+(unwind_base)[1])); \
+ printf(" unwind end: %08x %08x\n", \
+ (unsigned int) (((text_base)+(unwind_base)[2]) >> 32), \
+ (unsigned int) ((text_base)+(unwind_base)[2])); \
+ }
+
+#else /* !UWX_TRACE_ENABLE */
+
+#define TRACE_INIT
+#define TRACE_B_REUSE(id)
+#define TRACE_B_ALLOC(id)
+#define TRACE_B_POP(id)
+#define TRACE_B_LABEL(label)
+#define TRACE_B_LABEL_COPY(id)
+#define TRACE_B_LABEL_REVERSE(back, new)
+#define TRACE_B_COPY(label, id)
+#define TRACE_B_COPY_FREE(id)
+#define TRACE_B_COPY_FOUND(id)
+#define TRACE_B_COPY_COPY(id)
+#define TRACE_B_COPY_REVERSE(back, new)
+#define TRACE_B_FREE(id)
+#define TRACE_I_DECODE_RHDR_1(name, b0)
+#define TRACE_I_DECODE_RHDR_1L(name, b0, val)
+#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val)
+#define TRACE_I_DECODE_PROLOGUE_1(name, b0)
+#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val)
+#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2)
+#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1)
+#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, parm1)
+#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2)
+#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3)
+#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base)
+#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask)
+#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr)
+#define TRACE_I_DECODE_BODY_1(name, b0)
+#define TRACE_I_DECODE_BODY_1L(name, b0, parm1)
+#define TRACE_I_DECODE_BODY_1LL(name, b0, parm1, parm2)
+#define TRACE_R_UIB(uentry, ulen)
+#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot)
+#define TRACE_S_STEP(rstate)
+#define TRACE_S_RESTORE_REG(regname, rstate, val)
+#define TRACE_S_RESTORE_GR(regid, rstate, val)
+#define TRACE_S_RESTORE_BR(regid, rstate, val)
+#define TRACE_S_RESTORE_FR(regid, rstate, val)
+#define TRACE_T_SEARCH32(ip)
+#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end)
+#define TRACE_C_GET_REG(regid, bsp)
+#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid)
+#define TRACE_SELF_COPYIN4(rem, len, wp)
+#define TRACE_SELF_COPYIN8(rem, len, dp)
+#define TRACE_SELF_LOOKUP(ip)
+#define TRACE_SELF_LOOKUP_DESC(text_base, unwind_base)
+
+#endif /* UWX_TRACE_ENABLE */
+
diff --git a/sys/contrib/ia64/libuwx/src/uwx_ttrace.c b/sys/contrib/ia64/libuwx/src/uwx_ttrace.c
new file mode 100644
index 0000000..37f2e8a
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_ttrace.c
@@ -0,0 +1,367 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <sys/ttrace.h>
+#include <sys/uc_access.h>
+#include <machine/sys/uregs.h>
+#endif
+
+#include "uwx_env.h"
+#include "uwx_context.h"
+#include "uwx_trace.h"
+#include "uwx_ttrace.h"
+
+struct uwx_ttrace_info {
+ uint64_t bspstore;
+ uint64_t load_map;
+ uint64_t rvec[10];
+ alloc_cb allocate_cb;
+ free_cb free_cb;
+ int have_ucontext;
+ pid_t pid;
+ lwpid_t lwpid;
+ int trace;
+ ucontext_t ucontext;
+};
+
+void *uwx_ttrace_memcpy(void *buffer, uint64_t ptr, size_t bufsiz, int ident)
+{
+ uint64_t *dest;
+ uint64_t val;
+ int status;
+
+ status = ttrace(TT_PROC_RDDATA, (pid_t)ident,
+ 0, ptr, bufsiz, (uint64_t)buffer);
+ if (status != 0)
+ return NULL;
+ return buffer;
+}
+
+struct uwx_ttrace_info *uwx_ttrace_init_info(
+ struct uwx_env *env,
+ pid_t pid,
+ lwpid_t lwpid,
+ uint64_t load_map)
+{
+ struct uwx_ttrace_info *info;
+
+ if (env->allocate_cb == 0)
+ info = (struct uwx_ttrace_info *)
+ malloc(sizeof(struct uwx_ttrace_info));
+ else
+ info = (struct uwx_ttrace_info *)
+ (*env->allocate_cb)(sizeof(struct uwx_ttrace_info));
+ if (info == 0)
+ return 0;
+
+ info->bspstore = 0;
+ info->load_map = load_map;
+ info->allocate_cb = env->allocate_cb;
+ info->free_cb = env->free_cb;
+ info->have_ucontext = 0;
+ info->pid = pid;
+ info->lwpid = lwpid;
+ info->trace = env->trace;
+ return info;
+}
+
+int uwx_ttrace_free_info(struct uwx_ttrace_info *info)
+{
+ if (info->free_cb == 0)
+ free((void *)info);
+ else
+ (*info->free_cb)((void *)info);
+ return UWX_OK;
+}
+
+int uwx_ttrace_init_context(struct uwx_env *env, struct uwx_ttrace_info *info)
+{
+ uint64_t reason;
+ uint64_t ip;
+ uint64_t sp;
+ uint64_t bsp;
+ uint64_t cfm;
+ uint64_t ec;
+ int status;
+
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__reason, (uint64_t)8, (uint64_t)&reason);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__ip, (uint64_t)8, (uint64_t)&ip);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__r12, (uint64_t)8, (uint64_t)&sp);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__ar_bsp, (uint64_t)8, (uint64_t)&bsp);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__ar_bspstore, (uint64_t)8, (uint64_t)&info->bspstore);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__cfm, (uint64_t)8, (uint64_t)&cfm);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+ status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ (uint64_t)__ar_ec, (uint64_t)8, (uint64_t)&ec);
+ if (status != 0)
+ return UWX_TT_ERR_TTRACE;
+
+ cfm |= ec << 52;
+
+ if (reason != 0)
+ bsp = uwx_add_to_bsp(bsp, -((unsigned int)cfm & 0x7f));
+
+ return uwx_init_context(env, ip, sp, bsp, cfm);
+}
+
+int uwx_ttrace_init_from_sigcontext(
+ struct uwx_env *env,
+ struct uwx_ttrace_info *info,
+ uint64_t ucontext)
+{
+ int status;
+ uint16_t reason;
+ uint64_t ip;
+ uint64_t sp;
+ uint64_t bsp;
+ uint64_t cfm;
+ unsigned int nat;
+ uint64_t ec;
+
+ info->have_ucontext = 1;
+ uwx_ttrace_memcpy(&info->ucontext,
+ ucontext,
+ sizeof(__uc_misc_t),
+ info->pid);
+ uwx_ttrace_memcpy(&info->ucontext.__uc_mcontext,
+ (uint64_t) &((ucontext_t *)ucontext)->__uc_mcontext,
+ sizeof(mcontext_t),
+ info->pid);
+ status = __uc_get_reason(&info->ucontext, &reason);
+ status = __uc_get_ip(&info->ucontext, &ip);
+ status = __uc_get_grs(&info->ucontext, 12, 1, &sp, &nat);
+ status = __uc_get_ar(&info->ucontext, 17, &bsp);
+ status = __uc_get_ar(&info->ucontext, 18, &info->bspstore);
+ status = __uc_get_ar(&info->ucontext, 66, &ec);
+ status = __uc_get_cfm(&info->ucontext, &cfm);
+ cfm |= ec << 52;
+ if (reason != 0)
+ bsp = uwx_add_to_bsp(bsp, -((unsigned int)cfm & 0x7f));
+ uwx_init_context(env, ip, sp, bsp, cfm);
+ return UWX_OK;
+}
+
+int uwx_ttrace_do_context_frame(
+ struct uwx_env *env,
+ struct uwx_ttrace_info *info)
+{
+ int abi_context;
+ int status;
+ uint64_t ucontext;
+
+ abi_context = uwx_get_abi_context_code(env);
+ if (abi_context != 0x0101) /* abi = HP-UX, context = 1 */
+ return UWX_TT_ERR_BADABICONTEXT;
+ status = uwx_get_reg(env, UWX_REG_GR(32), &ucontext);
+ if (status != 0)
+ return status;
+ return uwx_ttrace_init_from_sigcontext(env, info, ucontext);
+}
+
+int uwx_ttrace_copyin(
+ int request,
+ char *loc,
+ uint64_t rem,
+ int len,
+ intptr_t tok)
+{
+ int status;
+ int regid;
+ unsigned int nat;
+ struct uwx_ttrace_info *info = (struct uwx_ttrace_info *) tok;
+ unsigned long *wp;
+ uint64_t *dp;
+ int ttreg;
+
+ dp = (uint64_t *) loc;
+
+ if (request == UWX_COPYIN_UINFO) {
+ if (len == 4) {
+ status = ttrace(TT_PROC_RDTEXT, info->pid,
+ 0, rem, 4, (uint64_t)loc);
+ wp = (unsigned long *) loc;
+ TRACE_SELF_COPYIN4(rem, len, wp)
+ }
+ else if (len == 8) {
+ status = ttrace(TT_PROC_RDTEXT, info->pid,
+ 0, rem, 8, (uint64_t)loc);
+ TRACE_SELF_COPYIN4(rem, len, dp)
+ }
+ else
+ return 0;
+ }
+ else if (request == UWX_COPYIN_MSTACK && len == 8) {
+ status = ttrace(TT_PROC_RDDATA, info->pid, 0, rem, 8, (uint64_t)loc);
+ TRACE_SELF_COPYIN4(rem, len, dp)
+ }
+ else if (request == UWX_COPYIN_RSTACK && len == 8) {
+ if (info->have_ucontext == 0 || rem < info->bspstore) {
+ status = ttrace(TT_PROC_RDDATA, info->pid, 0, rem, 8, (uint64_t)loc);
+ TRACE_SELF_COPYIN4(rem, len, dp)
+ }
+ else {
+ status = __uc_get_rsebs(&info->ucontext, (uint64_t *)rem, 1, dp);
+ if (status != 0)
+ return 0;
+ }
+ }
+ else if (request == UWX_COPYIN_REG && len == 8) {
+ regid = (int)rem;
+ if (info->have_ucontext) {
+ if (regid < UWX_REG_GR(0)) {
+ switch (regid) {
+ case UWX_REG_PREDS:
+ status = __uc_get_prs(&info->ucontext, dp);
+ break;
+ case UWX_REG_AR_PFS:
+ status = __uc_get_ar(&info->ucontext, 64, dp);
+ break;
+ case UWX_REG_AR_RNAT:
+ status = __uc_get_ar(&info->ucontext, 19, dp);
+ break;
+ case UWX_REG_AR_UNAT:
+ status = __uc_get_ar(&info->ucontext, 36, dp);
+ break;
+ case UWX_REG_AR_FPSR:
+ status = __uc_get_ar(&info->ucontext, 40, dp);
+ break;
+ case UWX_REG_AR_LC:
+ status = __uc_get_ar(&info->ucontext, 65, dp);
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
+ status = __uc_get_grs(&info->ucontext,
+ regid - UWX_REG_GR(0), 1, dp, &nat);
+ }
+ else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
+ status = __uc_get_brs(&info->ucontext,
+ regid - UWX_REG_BR(0), 1, dp);
+ }
+ }
+ else {
+ if (regid < UWX_REG_GR(0)) {
+ switch (regid) {
+ case UWX_REG_PREDS:
+ ttreg = __pr;
+ break;
+ case UWX_REG_AR_PFS:
+ ttreg = __ar_pfs;
+ break;
+ case UWX_REG_AR_RNAT:
+ ttreg = __ar_rnat;
+ break;
+ case UWX_REG_AR_UNAT:
+ ttreg = __ar_unat;
+ break;
+ case UWX_REG_AR_FPSR:
+ ttreg = __ar_fpsr;
+ break;
+ case UWX_REG_AR_LC:
+ ttreg = __ar_lc;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
+ ttreg = regid - UWX_REG_GR(1) + __r1;
+ }
+ else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
+ ttreg = regid - UWX_REG_BR(0) + __b0;
+ }
+ else
+ return 0;
+ status == ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
+ ttreg, 8, (uint64_t)loc);
+ }
+ if (status != 0)
+ return 0;
+ }
+ return len;
+}
+
+
+int uwx_ttrace_lookupip(
+ int request,
+ uint64_t ip,
+ intptr_t tok,
+ uint64_t **resultp)
+{
+ struct uwx_ttrace_info *info = (struct uwx_ttrace_info *) tok;
+ UINT64 handle;
+ struct load_module_desc desc;
+ uint64_t *unwind_base;
+ uint64_t *rvec;
+ int i;
+
+ if (request == UWX_LKUP_LOOKUP) {
+ TRACE_SELF_LOOKUP(ip)
+ handle = dlmodinfo((unsigned long) ip, &desc, sizeof(desc),
+ uwx_ttrace_memcpy, info->pid, info->load_map);
+ if (handle == 0)
+ return UWX_LKUP_ERR;
+ unwind_base = (uint64_t *) desc.unwind_base;
+ TRACE_SELF_LOOKUP_DESC(desc.text_base, unwind_base)
+ i = 0;
+ rvec = info->rvec;
+ rvec[i++] = UWX_KEY_TBASE;
+ rvec[i++] = desc.text_base;
+ rvec[i++] = UWX_KEY_UFLAGS;
+ rvec[i++] = unwind_base[0];
+ rvec[i++] = UWX_KEY_USTART;
+ rvec[i++] = desc.text_base + unwind_base[1];
+ rvec[i++] = UWX_KEY_UEND;
+ rvec[i++] = desc.text_base + unwind_base[2];
+ rvec[i++] = 0;
+ rvec[i++] = 0;
+ *resultp = rvec;
+ return UWX_LKUP_UTABLE;
+ }
+ else if (request == UWX_LKUP_FREE) {
+ return 0;
+ }
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_ttrace.h b/sys/contrib/ia64/libuwx/src/uwx_ttrace.h
new file mode 100644
index 0000000..d85f505
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_ttrace.h
@@ -0,0 +1,66 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _KERNEL
+#include <signal.h>
+#endif
+
+struct uwx_ttrace_info;
+
+extern struct uwx_ttrace_info *uwx_ttrace_init_info(
+ struct uwx_env *env,
+ pid_t pid,
+ lwpid_t lwpid,
+ uint64_t load_map);
+
+extern int uwx_ttrace_free_info(struct uwx_ttrace_info *info);
+
+extern int uwx_ttrace_init_context(
+ struct uwx_env *env,
+ struct uwx_ttrace_info *info);
+
+extern int uwx_ttrace_init_from_sigcontext(
+ struct uwx_env *env,
+ struct uwx_ttrace_info *info,
+ uint64_t ucontext);
+
+extern int uwx_ttrace_do_context_frame(
+ struct uwx_env *env,
+ struct uwx_ttrace_info *info);
+
+extern int uwx_ttrace_copyin(
+ int request,
+ char *loc,
+ uint64_t rem,
+ int len,
+ intptr_t tok);
+
+extern int uwx_ttrace_lookupip(
+ int request,
+ uint64_t ip,
+ intptr_t tok,
+ uint64_t **resultp);
+
+#define UWX_TT_ERR_BADABICONTEXT (-101)
+#define UWX_TT_ERR_TTRACE (-102)
diff --git a/sys/contrib/ia64/libuwx/src/uwx_uinfo.c b/sys/contrib/ia64/libuwx/src/uwx_uinfo.c
new file mode 100644
index 0000000..bf9530d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_uinfo.c
@@ -0,0 +1,1107 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_uinfo.h"
+#include "uwx_utable.h"
+#include "uwx_scoreboard.h"
+#include "uwx_bstream.h"
+#include "uwx_trace.h"
+#include "uwx_swap.h"
+
+int uwx_count_ones(unsigned int mask);
+
+/*
+ * uwx_uinfo.c
+ *
+ * This file contains the routines for reading and decoding
+ * the unwind information block.
+ *
+ * The main entry point, uwx_decode_uinfo(), is given a pointer
+ * to an unwind table entry and a pointer (passed by reference)
+ * to be filled in with a pointer to an update vector. It will
+ * read and decode the unwind descriptors contained in the
+ * unwind information block, then build the register state array,
+ * which describes the actions necessary to step from the current
+ * frame to the previous one.
+ */
+
+#define COPYIN_UINFO_4(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \
+ WORDSZ, env->cb_token) : \
+ (*(uint32_t *)(dest) = *(uint32_t *)(src), WORDSZ) )
+
+#define COPYIN_UINFO_8(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \
+ DWORDSZ, env->cb_token) : \
+ (*(uint64_t *)(dest) = *(uint64_t *)(src), DWORDSZ) )
+
+
+/* uwx_default_rstate: Returns the default register state for a leaf routine */
+
+int uwx_default_rstate(struct uwx_env *env, uint64_t **rstatep)
+{
+ struct uwx_scoreboard *sb;
+
+ sb = uwx_init_scoreboards(env);
+ *rstatep = sb->rstate;
+ return UWX_OK;
+}
+
+
+/* uwx_decode_uinfo: Decodes unwind info region */
+
+int uwx_decode_uinfo(
+ struct uwx_env *env,
+ struct uwx_utable_entry *uentry,
+ uint64_t **rstatep)
+{
+ uint64_t uinfohdr;
+ unsigned int ulen;
+ int len;
+ struct uwx_bstream bstream;
+ struct uwx_scoreboard *scoreboard;
+ int ip_slot;
+ int cur_slot;
+ int status;
+ struct uwx_rhdr rhdr;
+
+ /* Remember the offset from the start of the function */
+ /* to the current IP. This helps the client find */
+ /* the symbolic information. */
+
+ env->function_offset = env->context.special[UWX_REG_IP] -
+ uentry->code_start;
+
+ /* Read the unwind info header using the copyin callback. */
+ /* (If we're reading a 32-bit unwind table, we need to */
+ /* read the header as two 32-bit pieces to preserve the */
+ /* guarantee that we always call copyin for aligned */
+ /* 4-byte or 8-byte chunks.) */
+ /* Then compute the length of the unwind descriptor */
+ /* region and initialize a byte stream to read it. */
+
+ if (uentry->unwind_flags & UNWIND_TBL_32BIT) {
+ len = COPYIN_UINFO_4((char *)&uinfohdr, uentry->unwind_info);
+ len += COPYIN_UINFO_4((char *)&uinfohdr + WORDSZ,
+ uentry->unwind_info + WORDSZ);
+ }
+ else
+ len = COPYIN_UINFO_8((char *)&uinfohdr, uentry->unwind_info);
+ if (len != DWORDSZ)
+ return UWX_ERR_COPYIN_UINFO;
+ if (env->byte_swap)
+ uwx_swap8(&uinfohdr);
+ if (uentry->unwind_flags & UNWIND_TBL_32BIT)
+ ulen = UNW_LENGTH(uinfohdr) * WORDSZ;
+ else
+ ulen = UNW_LENGTH(uinfohdr) * DWORDSZ;
+ uwx_init_bstream(&bstream, env,
+ uentry->unwind_info + DWORDSZ, ulen, UWX_COPYIN_UINFO);
+
+ TRACE_R_UIB(uentry, ulen)
+
+ /* Create an initial scoreboard for tracking the unwind state. */
+
+ scoreboard = uwx_init_scoreboards(env);
+
+ /* Prepare to read and decode the unwind regions described */
+ /* by the unwind info block. Find the target "ip" slot */
+ /* relative to the beginning of the region. The lower 4 bits */
+ /* of the actual IP encode the slot number within a bundle. */
+
+ cur_slot = 0;
+ ip_slot = (int) ((env->context.special[UWX_REG_IP] & ~0x0fLL)
+ - uentry->code_start)
+ / BUNDLESZ * SLOTSPERBUNDLE
+ + (unsigned int) (env->context.special[UWX_REG_IP] & 0x0f);
+
+ /* Loop over the regions in the unwind info block. */
+
+ for (;;) {
+
+ /* Decode the next region header. */
+ /* We have an error if we reach the end of the info block, */
+ /* since we should have found our target ip slot by then. */
+ /* We also have an error if the next byte isn't a region */
+ /* header record. */
+
+ status = uwx_decode_rhdr(env, &bstream, &rhdr);
+ if (status != UWX_OK)
+ return status;
+
+ /* If a prologue region, get a new scoreboard, pushing */
+ /* the previous one onto the prologue stack. Then read */
+ /* and decode the prologue region records. */
+
+ if (rhdr.is_prologue) {
+ scoreboard = uwx_new_scoreboard(env, scoreboard);
+ if (scoreboard == 0)
+ return UWX_ERR_NOMEM;
+ status = uwx_decode_prologue(env, &bstream,
+ scoreboard, &rhdr, ip_slot);
+ }
+
+ /* If a body region, read and decode the body region */
+ /* records. If the body has an epilogue count, */
+ /* uwx_decode_body will note that in the region header */
+ /* record for use at the bottom of the loop. */
+
+ else {
+ status = uwx_decode_body(env, &bstream, scoreboard, &rhdr, ip_slot);
+ }
+
+ if (status != UWX_OK)
+ return status;
+
+ TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot)
+
+ /* If the target ip slot is within this region, we're done. */
+ /* Return the scoreboard's register state array. */
+
+ if (ip_slot < rhdr.rlen) {
+ *rstatep = scoreboard->rstate;
+ return UWX_OK;
+ }
+
+ /* Otherwise, update the current ip slot, pop the */
+ /* scoreboard stack based on the epilogue count, */
+ /* and loop back around for the next region. */
+
+ cur_slot += rhdr.rlen;
+ ip_slot -= rhdr.rlen;
+ if (rhdr.ecount > 0) {
+ scoreboard = uwx_pop_scoreboards(env, scoreboard, rhdr.ecount);
+ if (scoreboard == 0)
+ return UWX_ERR_PROLOG_UF;
+ }
+ }
+ /*NOTREACHED*/
+}
+
+
+/* uwx_decode_rhdr: Decodes a region header record */
+
+int uwx_decode_rhdr(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_rhdr *rhdr)
+{
+ int b0;
+ int b1;
+ uint64_t val;
+ int status;
+
+ /* Get the first byte of the next descriptor record. */
+ b0 = uwx_get_byte(bstream);
+ if (b0 < 0)
+ return UWX_ERR_NOUDESC;
+
+ /* Initialize region header record. */
+
+ rhdr->is_prologue = 0;
+ rhdr->rlen = 0;
+ rhdr->mask = 0;
+ rhdr->grsave = 0;
+ rhdr->ecount = 0;
+
+ /* Format R1 */
+
+ if (b0 < 0x40) {
+ if ((b0 & 0x20) == 0) {
+ TRACE_I_DECODE_RHDR_1("(R1) prologue", b0)
+ rhdr->is_prologue = 1;
+ }
+ else {
+ TRACE_I_DECODE_RHDR_1("(R1) body", b0)
+ }
+ rhdr->rlen = b0 & 0x1f;
+ }
+
+ /* Format R2 */
+
+ else if (b0 < 0x60) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ status = uwx_get_uleb128(bstream, &val);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_RHDR_2L("(R2) prologue_gr", b0, b1, val)
+ rhdr->is_prologue = 1;
+ rhdr->rlen = (unsigned int) val;
+ rhdr->mask = ((b0 & 0x07) << 1) | (b1 >> 7);
+ rhdr->grsave = b1 & 0x7f;
+ }
+
+ /* Format R3 */
+
+ else if (b0 < 0x80) {
+ status = uwx_get_uleb128(bstream, &val);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ if ((b0 & 0x03) == 0) {
+ TRACE_I_DECODE_RHDR_1L("(R3) prologue", b0, val)
+ rhdr->is_prologue = 1;
+ }
+ else {
+ TRACE_I_DECODE_RHDR_1L("(R3) body", b0, val)
+ }
+ rhdr->rlen = (unsigned int) val;
+ }
+
+ /* Otherwise, not a region header record. */
+
+ else {
+ TRACE_I_DECODE_RHDR_1("(?)", b0)
+ return UWX_ERR_BADUDESC;
+ }
+
+ return UWX_OK;
+}
+
+
+/* uwx_decode_prologue: Decodes a prologue region */
+
+int uwx_decode_prologue(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_scoreboard *scoreboard,
+ struct uwx_rhdr *rhdr,
+ int ip_slot)
+{
+ int status;
+ int reg;
+ int mask;
+ int b0;
+ int b1;
+ int b2;
+ int b3;
+ int r;
+ int t;
+ int i;
+ uint64_t parm1;
+ uint64_t parm2;
+ uint64_t newrstate[NSBREG];
+ int tspill[NSBREG];
+ int priunat_mem_rstate;
+ int t_priunat_mem;
+ unsigned int gr_mem_mask;
+ unsigned int br_mem_mask;
+ unsigned int fr_mem_mask;
+ unsigned int gr_gr_mask;
+ unsigned int br_gr_mask;
+ int ngr;
+ int nbr;
+ int nfr;
+ unsigned int spill_base;
+ unsigned int gr_base;
+ unsigned int br_base;
+ unsigned int fr_base;
+
+ /* Initialize an array of register states from the current */
+ /* scoreboard, along with a parallel array of spill times. */
+ /* We use this as a temporary scoreboard, then update the */
+ /* real scoreboard at the end of the procedure. */
+ /* We initialize the spill time to (rhdr.rlen - 1) so that */
+ /* spills without a "when" descriptor will take effect */
+ /* at the end of the prologue region. */
+ /* (Boundary condition: all actions in a zero-length prologue */
+ /* will appear to have happened in the instruction slot */
+ /* immediately preceding the prologue.) */
+
+ for (i = 0; i < env->nsbreg; i++) {
+ newrstate[i] = scoreboard->rstate[i];
+ tspill[i] = rhdr->rlen - 1;
+ }
+ priunat_mem_rstate = UWX_DISP_NONE;
+ t_priunat_mem = rhdr->rlen - 1;
+
+ fr_mem_mask = 0;
+ gr_mem_mask = 0;
+ br_mem_mask = 0;
+ gr_gr_mask = 0;
+ br_gr_mask = 0;
+ nfr = 0;
+ ngr = 0;
+ nbr = 0;
+ spill_base = 0;
+
+ /* If prologue_gr header record supplied mask and grsave, */
+ /* record these in the scoreboard. */
+
+ reg = rhdr->grsave;
+ mask = rhdr->mask;
+ if (mask & 0x8) {
+ newrstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+ if (mask & 0x4) {
+ newrstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+ if (mask & 0x2) {
+ newrstate[SBREG_PSP] = UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+ if (mask & 0x1) {
+ newrstate[SBREG_PREDS] = UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+
+ /* Read prologue descriptor records until */
+ /* we hit another region header. */
+
+ for (;;) {
+
+ b0 = uwx_get_byte(bstream);
+
+ if (b0 < 0x80) {
+ /* Return the last byte read to the byte stream, since it's */
+ /* really the first byte of the next region header record. */
+ if (b0 >= 0)
+ (void) uwx_unget_byte(bstream, b0);
+ break;
+ }
+
+ switch ((b0 & 0x70) >> 4) {
+
+ case 0: /* 1000 xxxx */
+ case 1: /* 1001 xxxx */
+ /* Format P1 (br_mem) */
+ TRACE_I_DECODE_PROLOGUE_1("(P1) br_mem", b0)
+ br_mem_mask = b0 & 0x1f;
+ break;
+
+ case 2: /* 1010 xxxx */
+ /* Format P2 (br_gr) */
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_PROLOGUE_2("(P2) br_gr", b0, b1)
+ mask = ((b0 & 0x0f) << 1) | (b1 >> 7);
+ reg = b1 & 0x7f;
+ br_gr_mask = mask;
+ for (i = 0; i < NSB_BR && mask != 0; i++) {
+ if (mask & 0x01) {
+ newrstate[SBREG_BR + i] = UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+ mask = mask >> 1;
+ }
+ break;
+
+ case 3: /* 1011 xxxx */
+ /* Format P3 */
+ if (b0 < 0xb8) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ r = ((b0 & 0x3) << 1) | (b1 >> 7);
+ reg = b1 & 0x7f;
+ switch (r) {
+ case 0: /* psp_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) psp_gr", b0, b1)
+ newrstate[SBREG_PSP] = UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 1: /* rp_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) rp_gr", b0, b1)
+ newrstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 2: /* pfs_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) pfs_gr", b0, b1)
+ newrstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 3: /* preds_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) preds_gr", b0, b1)
+ newrstate[SBREG_PREDS] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 4: /* unat_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) unat_gr", b0, b1)
+ newrstate[SBREG_UNAT] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 5: /* lc_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) lc_gr", b0, b1)
+ newrstate[SBREG_LC] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 6: /* rp_br */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) rp_br", b0, b1)
+ scoreboard->rstate[SBREG_RP] =
+ UWX_DISP_REG(UWX_REG_BR(reg));
+ break;
+ case 7: /* rnat_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) rnat_gr", b0, b1)
+ newrstate[SBREG_RNAT] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 8: /* bsp_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) bsp_gr", b0, b1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 9: /* bspstore_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) bspstore_gr", b0, b1)
+ /* Don't track BSPSTORE yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 10: /* fpsr_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) fpsr_gr", b0, b1)
+ newrstate[SBREG_FPSR] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ case 11: /* priunat_gr */
+ TRACE_I_DECODE_PROLOGUE_2("(P3) priunat_gr", b0, b1)
+ newrstate[SBREG_PRIUNAT] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ break;
+ default:
+ TRACE_I_DECODE_PROLOGUE_2("(P3) ??", b0, b1)
+ return UWX_ERR_BADUDESC;
+ }
+ }
+
+ /* Format P4 (spill_mask) */
+ else if (b0 == 0xb8) {
+ TRACE_I_DECODE_PROLOGUE_1("(P4) spill_mask", b0)
+ /* The spill_mask descriptor is followed by */
+ /* an imask field whose length is determined */
+ /* by the region length: there are two mask */
+ /* bits per instruction slot in the region. */
+ /* We decode these bits two at a time, counting */
+ /* the number of FRs, GRs, and BRs that are */
+ /* saved up to the slot of interest. Other */
+ /* descriptors describe which sets of these */
+ /* registers are spilled, and we put those */
+ /* two pieces of information together at the */
+ /* end of the main loop. */
+ t = 0;
+ while (t < rhdr->rlen) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ for (i = 0; i < 4 && (t + i) < ip_slot; i++) {
+ switch (b1 & 0xc0) {
+ case 0x00: break;
+ case 0x40: nfr++; break;
+ case 0x80: ngr++; break;
+ case 0xc0: nbr++; break;
+ }
+ b1 = b1 << 2;
+ }
+ t += 4;
+ }
+ }
+
+ /* Format P5 (frgr_mem) */
+ else if (b0 == 0xb9) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ b3 = uwx_get_byte(bstream);
+ if (b3 < 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_PROLOGUE_4("(P5) frgr_mem", b0, b1, b2, b3)
+ gr_mem_mask = b1 >> 4;
+ fr_mem_mask = ((b1 & 0x0f) << 16) | (b2 << 8) | b3;
+ }
+
+ /* Invalid descriptor record */
+ else {
+ TRACE_I_DECODE_PROLOGUE_1("(?)", b0)
+ return UWX_ERR_BADUDESC;
+ }
+
+ break;
+
+ case 4: /* 1100 xxxx */
+ /* Format P6 (fr_mem) */
+ TRACE_I_DECODE_PROLOGUE_1("(P6) fr_mem", b0)
+ fr_mem_mask = b0 & 0x0f;
+ break;
+
+ case 5: /* 1101 xxxx */
+ /* Format P6 (gr_mem) */
+ TRACE_I_DECODE_PROLOGUE_1("(P6) gr_mem", b0)
+ gr_mem_mask = b0 & 0x0f;
+ break;
+
+ case 6: /* 1110 xxxx */
+ /* Format P7 */
+ r = b0 & 0xf;
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ switch (r) {
+ case 0: /* mem_stack_f */
+ status = uwx_get_uleb128(bstream, &parm2);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_PROLOGUE_1LL("(P7) mem_stack_f", b0, parm1, parm2)
+ newrstate[SBREG_PSP] = UWX_DISP_SPPLUS(parm2 * 16);
+ tspill[SBREG_PSP] = (int) parm1;
+ break;
+ case 1: /* mem_stack_v */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) mem_stack_v", b0, parm1)
+ tspill[SBREG_PSP] = (int) parm1;
+ break;
+ case 2: /* spill_base */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) spill_base", b0, parm1)
+ spill_base = 4 * (unsigned int) parm1;
+ break;
+ case 3: /* psp_sprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) psp_sprel", b0, parm1)
+ newrstate[SBREG_PSP] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 4: /* rp_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) rp_when", b0, parm1)
+ tspill[SBREG_RP] = (int) parm1;
+ break;
+ case 5: /* rp_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) rp_psprel", b0, parm1)
+ newrstate[SBREG_RP] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 6: /* pfs_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) pfs_when", b0, parm1)
+ tspill[SBREG_PFS] = (int) parm1;
+ break;
+ case 7: /* pfs_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) pfs_psprel", b0, parm1)
+ newrstate[SBREG_PFS] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 8: /* preds_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) preds_when", b0, parm1)
+ tspill[SBREG_PREDS] = (int) parm1;
+ break;
+ case 9: /* preds_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) preds_psprel", b0, parm1)
+ newrstate[SBREG_PREDS] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 10: /* lc_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) lc_when", b0, parm1)
+ tspill[SBREG_LC] = (int) parm1;
+ break;
+ case 11: /* lc_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) lc_psprel", b0, parm1)
+ newrstate[SBREG_LC] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 12: /* unat_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) unat_when", b0, parm1)
+ tspill[SBREG_UNAT] = (int) parm1;
+ break;
+ case 13: /* unat_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) unat_psprel", b0, parm1)
+ newrstate[SBREG_UNAT] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 14: /* fpsr_when */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) fpsr_when", b0, parm1)
+ tspill[SBREG_FPSR] = (int) parm1;
+ break;
+ case 15: /* fpsr_psprel */
+ TRACE_I_DECODE_PROLOGUE_1L("(P7) fpsr_psprel", b0, parm1)
+ newrstate[SBREG_FPSR] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ }
+ break;
+
+ case 7: /* 1111 xxxx */
+ /* Format P8 */
+ if (b0 == 0xf0) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ switch (b1) {
+ case 1: /* rp_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) rp_sprel", b0, b1, parm1)
+ newrstate[SBREG_RP] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 2: /* pfs_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) pfs_sprel", b0, b1, parm1)
+ newrstate[SBREG_PFS] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 3: /* preds_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) preds_sprel", b0, b1, parm1)
+ newrstate[SBREG_PREDS] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 4: /* lc_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) lc_sprel", b0, b1, parm1)
+ newrstate[SBREG_LC] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 5: /* unat_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) unat_sprel", b0, b1, parm1)
+ newrstate[SBREG_UNAT] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 6: /* fpsr_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) fpsr_sprel", b0, b1, parm1)
+ newrstate[SBREG_FPSR] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 7: /* bsp_when */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_when", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 8: /* bsp_psprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_psprel", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 9: /* bsp_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_sprel", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 10: /* bspstore_when */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_when", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 11: /* bspstore_psprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_psprel", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 12: /* bspstore_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_sprel", b0, b1, parm1)
+ /* Don't track BSP yet */
+ return UWX_ERR_CANTUNWIND;
+ break;
+ case 13: /* rnat_when */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_when", b0, b1, parm1)
+ tspill[SBREG_RNAT] = (int) parm1;
+ break;
+ case 14: /* rnat_psprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_psprel", b0, b1, parm1)
+ newrstate[SBREG_RNAT] = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 15: /* rnat_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_sprel", b0, b1, parm1)
+ newrstate[SBREG_RNAT] = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 16: /* priunat_when_gr */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_when_gr", b0, b1, parm1)
+ tspill[SBREG_PRIUNAT] = (int) parm1;
+ break;
+ case 17: /* priunat_psprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_psprel", b0, b1, parm1)
+ priunat_mem_rstate = UWX_DISP_PSPREL(parm1 * 4);
+ break;
+ case 18: /* priunat_sprel */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_sprel", b0, b1, parm1)
+ priunat_mem_rstate = UWX_DISP_SPREL(parm1 * 4);
+ break;
+ case 19: /* priunat_when_mem */
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_when_mem", b0, b1, parm1)
+ t_priunat_mem = (int) parm1;
+ break;
+ default:
+ TRACE_I_DECODE_PROLOGUE_2L("(P8) ??", b0, b1, parm1)
+ return UWX_ERR_BADUDESC;
+ }
+ }
+
+ /* Format P9 (gr_gr) */
+ else if (b0 == 0xf1) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_PROLOGUE_3("(P9) gr_gr", b0, b1, b2)
+ mask = b1 & 0x0f;
+ reg = b2 & 0x7f;
+ gr_gr_mask = mask;
+ for (i = 0; i < NSB_GR && mask != 0; i++) {
+ if (mask & 0x01) {
+ newrstate[SBREG_GR + i] =
+ UWX_DISP_REG(UWX_REG_GR(reg));
+ reg++;
+ }
+ mask = mask >> 1;
+ }
+ }
+
+ /* Format X1 */
+ else if (b0 == 0xf9) {
+ TRACE_I_DECODE_PROLOGUE_1("(X1)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X2 */
+ else if (b0 == 0xfa) {
+ TRACE_I_DECODE_PROLOGUE_1("(X2)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X3 */
+ else if (b0 == 0xfb) {
+ TRACE_I_DECODE_PROLOGUE_1("(X3)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X4 */
+ else if (b0 == 0xfc) {
+ TRACE_I_DECODE_PROLOGUE_1("(X4)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ b3 = uwx_get_byte(bstream);
+ if (b3 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format P10 */
+ else if (b0 == 0xff) {
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_PROLOGUE_3("(P10) abi", b0, b1, b2)
+ env->abi_context = (b1 << 8) | b2;
+ return UWX_ABI_FRAME;
+ }
+
+ /* Invalid descriptor record */
+ else {
+ TRACE_I_DECODE_PROLOGUE_1("(?)", b0)
+ return UWX_ERR_BADUDESC;
+ }
+ break;
+ }
+ }
+
+ /* Process the masks of spilled GRs, FRs, and BRs to */
+ /* determine when and where each register was saved. */
+
+ fr_base = spill_base + 16 * uwx_count_ones(fr_mem_mask);
+ br_base = fr_base + 8 * uwx_count_ones(br_mem_mask);
+ gr_base = br_base + 8 * uwx_count_ones(gr_mem_mask);
+ TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base)
+ TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask)
+ TRACE_I_DECODE_PROLOGUE_NSPILL(ngr)
+ for (i = 0; ngr > 0 && i <= NSB_GR; i++) {
+ if (gr_mem_mask & 1) {
+ newrstate[SBREG_GR + i] = UWX_DISP_PSPREL(gr_base);
+ tspill[SBREG_GR + i] = 0;
+ gr_base -= 8;
+ ngr--;
+ }
+ else if (gr_gr_mask & 1) {
+ tspill[SBREG_GR + i] = 0;
+ ngr--;
+ }
+ gr_gr_mask = gr_gr_mask >> 1;
+ gr_mem_mask = gr_mem_mask >> 1;
+ }
+ for (i = 0; nbr > 0 && i <= NSB_BR; i++) {
+ if (br_mem_mask & 1) {
+ newrstate[SBREG_BR + i] = UWX_DISP_PSPREL(br_base);
+ tspill[SBREG_BR + i] = 0;
+ br_base -= 8;
+ nbr--;
+ }
+ else if (br_gr_mask & 1) {
+ tspill[SBREG_BR + i] = 0;
+ nbr--;
+ }
+ br_gr_mask = br_gr_mask >> 1;
+ br_mem_mask = br_mem_mask >> 1;
+ }
+ for (i = 0; nfr > 0 && i <= NSB_FR; i++) {
+ if (fr_mem_mask & 1) {
+ newrstate[SBREG_FR + i] = UWX_DISP_PSPREL(fr_base);
+ tspill[SBREG_FR + i] = 0;
+ fr_base -= 16;
+ nfr--;
+ }
+ fr_mem_mask = fr_mem_mask >> 1;
+ }
+
+ /* Update the scoreboard. */
+
+ for (i = 0; i < env->nsbreg; i++) {
+ if (ip_slot >= rhdr->rlen || ip_slot > tspill[i])
+ scoreboard->rstate[i] = newrstate[i];
+ }
+ if (priunat_mem_rstate != UWX_DISP_NONE && ip_slot > t_priunat_mem)
+ scoreboard->rstate[SBREG_PRIUNAT] = priunat_mem_rstate;
+
+ return UWX_OK;
+}
+
+int uwx_count_ones(unsigned int mask)
+{
+ mask = (mask & 0x55555555) + ((mask & 0xaaaaaaaa) >> 1);
+ mask = (mask & 0x33333333) + ((mask & 0xcccccccc) >> 2);
+ mask = (mask & 0x0f0f0f0f) + ((mask & 0xf0f0f0f0) >> 4);
+ mask = (mask & 0x00ff00ff) + ((mask & 0xff00ff00) >> 8);
+ return (mask & 0x0000ffff) + ((mask & 0xffff0000) >> 16);
+}
+
+/* uwx_decode_body: Decodes a body region */
+
+int uwx_decode_body(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_scoreboard *scoreboard,
+ struct uwx_rhdr *rhdr,
+ int ip_slot)
+{
+ int status;
+ int b0;
+ int b1;
+ int b2;
+ int b3;
+ int label;
+ int ecount;
+ int i;
+ uint64_t parm1;
+ uint64_t parm2;
+ uint64_t newrstate[NSBREG];
+ int tspill[NSBREG];
+ int t_sp_restore;
+
+ /* Initialize an array of register states from the current */
+ /* scoreboard, along with a parallel array of spill times. */
+ /* We use this as a temporary scoreboard, then update the */
+ /* real scoreboard at the end of the procedure. */
+ /* We initialize the spill time to (rhdr.rlen - 1) so that */
+ /* spills without a "when" descriptor will take effect */
+ /* at the end of the prologue region. */
+ /* (Boundary condition: all actions in a zero-length prologue */
+ /* will appear to have happened in the instruction slot */
+ /* immediately preceding the prologue.) */
+
+ for (i = 0; i < env->nsbreg; i++) {
+ newrstate[i] = scoreboard->rstate[i];
+ tspill[i] = rhdr->rlen - 1;
+ }
+ t_sp_restore = rhdr->rlen - 1;
+
+ /* Read body descriptor records until */
+ /* we hit another region header. */
+
+ for (;;) {
+
+ b0 = uwx_get_byte(bstream);
+
+ if (b0 < 0x80) {
+ /* Return the last byte read to the byte stream, since it's */
+ /* really the first byte of the next region header record. */
+ if (b0 >= 0)
+ (void) uwx_unget_byte(bstream, b0);
+ break;
+ }
+
+ /* Format B1 (label_state) */
+ if (b0 < 0xa0) {
+ TRACE_I_DECODE_BODY_1("(B1) label_state", b0)
+ label = b0 & 0x1f;
+ status = uwx_label_scoreboard(env, scoreboard, label);
+ if (status != UWX_OK)
+ return (status);
+ }
+
+ /* Format B1 (copy_state) */
+ else if (b0 < 0xc0) {
+ TRACE_I_DECODE_BODY_1("(B1) copy_state", b0)
+ label = b0 & 0x1f;
+ status = uwx_copy_scoreboard(env, scoreboard, label);
+ if (status != UWX_OK)
+ return (status);
+ for (i = 0; i < env->nsbreg; i++) {
+ newrstate[i] = scoreboard->rstate[i];
+ tspill[i] = rhdr->rlen;
+ }
+ }
+
+ /* Format B2 (epilogue) */
+ else if (b0 < 0xe0) {
+ ecount = b0 & 0x1f;
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_BODY_1L("(B2) epilogue", b0, parm1)
+ rhdr->ecount = ecount + 1;
+ t_sp_restore = rhdr->rlen - (unsigned int) parm1;
+ }
+
+ /* Format B3 (epilogue) */
+ else if (b0 == 0xe0) {
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ status = uwx_get_uleb128(bstream, &parm2);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_BODY_1LL("(B3) epilogue", b0, parm1, parm2)
+ t_sp_restore = rhdr->rlen - (unsigned int) parm1;
+ rhdr->ecount = (unsigned int) parm2 + 1;
+ }
+
+ /* Format B4 (label_state) */
+ else if (b0 == 0xf0) {
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_BODY_1L("(B4) label_state", b0, parm1)
+ label = (int) parm1;
+ status = uwx_label_scoreboard(env, scoreboard, label);
+ if (status != UWX_OK)
+ return (status);
+ }
+
+ /* Format B4 (copy_state) */
+ else if (b0 == 0xf8) {
+ status = uwx_get_uleb128(bstream, &parm1);
+ if (status != 0)
+ return UWX_ERR_BADUDESC;
+ TRACE_I_DECODE_BODY_1L("(B4) copy_state", b0, parm1)
+ label = (int) parm1;
+ status = uwx_copy_scoreboard(env, scoreboard, label);
+ if (status != UWX_OK)
+ return (status);
+ for (i = 0; i < env->nsbreg; i++) {
+ newrstate[i] = scoreboard->rstate[i];
+ tspill[i] = rhdr->rlen;
+ }
+ }
+
+ /* Format X1 */
+ else if (b0 == 0xf9) {
+ TRACE_I_DECODE_BODY_1("(X1)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X2 */
+ else if (b0 == 0xfa) {
+ TRACE_I_DECODE_BODY_1("(X2)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X3 */
+ else if (b0 == 0xfb) {
+ TRACE_I_DECODE_BODY_1("(X3)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Format X4 */
+ else if (b0 == 0xfc) {
+ TRACE_I_DECODE_BODY_1("(X4)", b0)
+ b1 = uwx_get_byte(bstream);
+ if (b1 < 0)
+ return UWX_ERR_BADUDESC;
+ b2 = uwx_get_byte(bstream);
+ if (b2 < 0)
+ return UWX_ERR_BADUDESC;
+ b3 = uwx_get_byte(bstream);
+ if (b3 < 0)
+ return UWX_ERR_BADUDESC;
+ /* Don't support X-format descriptors yet */
+ return UWX_ERR_CANTUNWIND;
+ }
+
+ /* Invalid descriptor record */
+ else {
+ TRACE_I_DECODE_BODY_1("(?)", b0)
+ return UWX_ERR_BADUDESC;
+ }
+ }
+
+ /* Update the scoreboard. */
+
+ for (i = 0; i < env->nsbreg; i++) {
+ if (ip_slot > tspill[i])
+ scoreboard->rstate[i] = newrstate[i];
+ }
+
+ /* If we've passed the point in the epilogue where sp */
+ /* is restored, update the scoreboard entry for PSP */
+ /* and reset any entries for registers saved in memory. */
+
+ if (ip_slot > t_sp_restore) {
+ scoreboard->rstate[SBREG_PSP] = UWX_DISP_SPPLUS(0);
+ for (i = 0; i < env->nsbreg; i++) {
+ if (UWX_GET_DISP_CODE(scoreboard->rstate[i]) == UWX_DISP_SPREL(0) ||
+ UWX_GET_DISP_CODE(scoreboard->rstate[i]) == UWX_DISP_PSPREL(0))
+ scoreboard->rstate[i] = UWX_DISP_NONE;
+ }
+ }
+
+ return UWX_OK;
+}
+
diff --git a/sys/contrib/ia64/libuwx/src/uwx_uinfo.h b/sys/contrib/ia64/libuwx/src/uwx_uinfo.h
new file mode 100644
index 0000000..bdd05cb
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_uinfo.h
@@ -0,0 +1,66 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+struct uwx_utable_entry;
+
+extern int uwx_decode_uinfo(
+ struct uwx_env *env,
+ struct uwx_utable_entry *uentry,
+ uint64_t **rstatep);
+
+extern int uwx_default_rstate(
+ struct uwx_env *env,
+ uint64_t **rstatep);
+
+/* Region header record */
+
+struct uwx_rhdr {
+ int is_prologue; /* true if prologue region */
+ unsigned int rlen; /* length of region (# instruction slots) */
+ int mask; /* register save mask */
+ int grsave; /* first gr used for saving */
+ unsigned int ecount; /* epilogue count (0 = no epilogue) */
+ unsigned int epilogue_t; /* epilogue "t" value */
+};
+
+struct uwx_bstream;
+
+extern int uwx_decode_rhdr(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_rhdr *rhdr);
+
+extern int uwx_decode_prologue(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_scoreboard *scoreboard,
+ struct uwx_rhdr *rhdr,
+ int ip_slot);
+
+extern int uwx_decode_body(
+ struct uwx_env *env,
+ struct uwx_bstream *bstream,
+ struct uwx_scoreboard *scoreboard,
+ struct uwx_rhdr *rhdr,
+ int ip_slot);
diff --git a/sys/contrib/ia64/libuwx/src/uwx_utable.c b/sys/contrib/ia64/libuwx/src/uwx_utable.c
new file mode 100644
index 0000000..9533aec
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_utable.c
@@ -0,0 +1,257 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "uwx_env.h"
+#include "uwx_utable.h"
+#include "uwx_swap.h"
+#include "uwx_trace.h"
+
+/*
+ * uwx_utable.c
+ *
+ * This file contains the routines for searching an unwind table.
+ * The main entry point, uwx_search_utable(), gets the
+ * necessary information from the lookup ip callback's result
+ * vector, determines whether the table is 32-bit or 64-bit,
+ * then invokes the binary search routine for that format.
+ */
+
+
+/* Forward declarations */
+
+int uwx_search_utable32(
+ struct uwx_env *env,
+ uint32_t text_base,
+ uint32_t unwind_start,
+ uint32_t unwind_end,
+ struct uwx_utable_entry *uentry);
+
+int uwx_search_utable64(
+ struct uwx_env *env,
+ uint64_t text_base,
+ uint64_t unwind_start,
+ uint64_t unwind_end,
+ struct uwx_utable_entry *uentry);
+
+
+/* uwx_search_utable: Searches an unwind table for IP in current context */
+
+int uwx_search_utable(
+ struct uwx_env *env,
+ uint64_t *uvec,
+ struct uwx_utable_entry *uentry)
+{
+ uint64_t text_base = 0;
+ uint64_t unwind_flags;
+ uint64_t unwind_start = 0;
+ uint64_t unwind_end = 0;
+ int keys;
+ int status;
+
+ /* Get unwind table information from the result vector. */
+ /* Make sure all three required values are given. */
+
+ keys = 0;
+ unwind_flags = 0;
+ while (*uvec != 0) {
+ switch ((int)*uvec++) {
+ case UWX_KEY_TBASE:
+ keys |= 1;
+ text_base = *uvec++;
+ break;
+ case UWX_KEY_UFLAGS:
+ unwind_flags = *uvec++;
+ break;
+ case UWX_KEY_USTART:
+ keys |= 2;
+ unwind_start = *uvec++;
+ break;
+ case UWX_KEY_UEND:
+ keys |= 4;
+ unwind_end = *uvec++;
+ break;
+ default:
+ return UWX_ERR_BADKEY;
+ }
+ }
+ if (keys != 7)
+ return UWX_ERR_BADKEY;
+
+ /* Copy the unwind flags into the unwind entry. */
+ /* (uwx_decode_uinfo needs to know whether it's 32-bit or 64-bit.) */
+
+ uentry->unwind_flags = unwind_flags;
+
+ /* Call the appropriate binary search routine. */
+
+ if (unwind_flags & UNWIND_TBL_32BIT)
+ status = uwx_search_utable32(env,
+ (uint32_t) text_base,
+ (uint32_t) unwind_start,
+ (uint32_t) unwind_end,
+ uentry);
+ else
+ status = uwx_search_utable64(env,
+ text_base, unwind_start, unwind_end, uentry);
+
+ return status;
+}
+
+
+/* uwx_search_utable32: Binary search of 32-bit unwind table */
+
+#define COPYIN_UINFO_4(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \
+ WORDSZ, env->cb_token) : \
+ (*(uint32_t *)(dest) = *(uint32_t *)(src), WORDSZ) )
+
+int uwx_search_utable32(
+ struct uwx_env *env,
+ uint32_t text_base,
+ uint32_t unwind_start,
+ uint32_t unwind_end,
+ struct uwx_utable_entry *uentry)
+{
+ int lb;
+ int ub;
+ int mid = 0;
+ int len;
+ uint32_t ip;
+ uint32_t code_start;
+ uint32_t code_end;
+ uint32_t unwind_info;
+
+ /* Since the unwind table uses segment-relative offsets, convert */
+ /* the IP in the current context to a segment-relative offset. */
+
+ ip = env->context.special[UWX_REG_IP] - text_base;
+
+ TRACE_T_SEARCH32(ip)
+
+ /* Standard binary search. */
+ /* Might modify this to do interpolation in the future. */
+
+ lb = 0;
+ ub = (unwind_end - unwind_start) / (3 * WORDSZ);
+ while (ub > lb) {
+ mid = (lb + ub) / 2;
+ len = COPYIN_UINFO_4((char *)&code_start,
+ (intptr_t)(unwind_start+mid*3*WORDSZ));
+ len += COPYIN_UINFO_4((char *)&code_end,
+ (intptr_t)(unwind_start+mid*3*WORDSZ+WORDSZ));
+ if (len != 2 * WORDSZ)
+ return UWX_ERR_COPYIN_UTBL;
+ if (env->byte_swap) {
+ uwx_swap4(&code_start);
+ uwx_swap4(&code_end);
+ }
+ TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end)
+ if (ip >= code_end)
+ lb = mid + 1;
+ else if (ip < code_start)
+ ub = mid;
+ else
+ break;
+ }
+ if (ub <= lb)
+ return UWX_ERR_NOUENTRY;
+ len = COPYIN_UINFO_4((char *)&unwind_info,
+ (intptr_t)(unwind_start+mid*3*WORDSZ+2*WORDSZ));
+ if (len != WORDSZ)
+ return UWX_ERR_COPYIN_UTBL;
+ if (env->byte_swap)
+ uwx_swap4(&unwind_info);
+ uentry->code_start = text_base + code_start;
+ uentry->code_end = text_base + code_end;
+ uentry->unwind_info = text_base + unwind_info;
+ return UWX_OK;
+}
+
+
+/* uwx_search_utable64: Binary search of 64-bit unwind table */
+
+#define COPYIN_UINFO_8(dest, src) \
+ (env->remote? \
+ (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \
+ DWORDSZ, env->cb_token) : \
+ (*(uint64_t *)(dest) = *(uint64_t *)(src), DWORDSZ) )
+
+int uwx_search_utable64(
+ struct uwx_env *env,
+ uint64_t text_base,
+ uint64_t unwind_start,
+ uint64_t unwind_end,
+ struct uwx_utable_entry *uentry)
+{
+ int lb;
+ int ub;
+ int mid = 0;
+ int len;
+ uint64_t ip;
+ uint64_t code_start;
+ uint64_t code_end;
+ uint64_t unwind_info;
+
+ /* Since the unwind table uses segment-relative offsets, convert */
+ /* the IP in the current context to a segment-relative offset. */
+
+ ip = env->context.special[UWX_REG_IP] - text_base;
+
+ /* Standard binary search. */
+ /* Might modify this to do interpolation in the future. */
+
+ lb = 0;
+ ub = (unwind_end - unwind_start) / (3 * DWORDSZ);
+ while (ub > lb) {
+ mid = (lb + ub) / 2;
+ len = COPYIN_UINFO_8((char *)&code_start, unwind_start+mid*3*DWORDSZ);
+ len += COPYIN_UINFO_8((char *)&code_end,
+ unwind_start+mid*3*DWORDSZ+DWORDSZ);
+ if (len != 2 * DWORDSZ)
+ return UWX_ERR_COPYIN_UTBL;
+ if (env->byte_swap) {
+ uwx_swap8(&code_start);
+ uwx_swap8(&code_end);
+ }
+ if (ip >= code_end)
+ lb = mid + 1;
+ else if (ip < code_start)
+ ub = mid;
+ else
+ break;
+ }
+ if (ub <= lb)
+ return UWX_ERR_NOUENTRY;
+ len = COPYIN_UINFO_8((char *)&unwind_info,
+ unwind_start+mid*3*DWORDSZ+2*DWORDSZ);
+ if (len != DWORDSZ)
+ return UWX_ERR_COPYIN_UTBL;
+ if (env->byte_swap)
+ uwx_swap8(&unwind_info);
+ uentry->code_start = text_base + code_start;
+ uentry->code_end = text_base + code_end;
+ uentry->unwind_info = text_base + unwind_info;
+ return UWX_OK;
+}
diff --git a/sys/contrib/ia64/libuwx/src/uwx_utable.h b/sys/contrib/ia64/libuwx/src/uwx_utable.h
new file mode 100644
index 0000000..67d2087
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/src/uwx_utable.h
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+struct uwx_utable_entry {
+ uint64_t code_start;
+ uint64_t code_end;
+ uint64_t unwind_info;
+ uint64_t unwind_flags;
+};
+
+extern int uwx_search_utable(
+ struct uwx_env *env,
+ uint64_t *uvec,
+ struct uwx_utable_entry *uentry);
diff --git a/sys/contrib/ia64/libuwx/test/Makefile b/sys/contrib/ia64/libuwx/test/Makefile
new file mode 100644
index 0000000..11251d4
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/test/Makefile
@@ -0,0 +1,14 @@
+UWXINCDIR = ../include
+UWXLIBDIR = ../lib/ipf32
+
+CFLAGS = -O -I $(UWXINCDIR)
+LDFLAGS = -L $(UWXLIBDIR)
+
+dumpmyself: dumpmyself.o dump_context.o primeregs.o
+ $(CC) -o dumpmyself $(LDFLAGS) dumpmyself.o dump_context.o primeregs.o -luwx
+
+
+dumpmyself.o: $(UWXINCDIR)/uwx.h $(UWXINCDIR)/uwx_self.h
+
+dump_context.o:
+primeregs.o:
diff --git a/sys/contrib/ia64/libuwx/test/dump_context.c b/sys/contrib/ia64/libuwx/test/dump_context.c
new file mode 100644
index 0000000..db46e3d
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/test/dump_context.c
@@ -0,0 +1,100 @@
+#include <stdio.h>
+#include <inttypes.h>
+
+#define IP 0
+#define SP 1
+#define BSP 2
+#define CFM 3
+#define RP 4
+#define PSP 5
+#define PFS 6
+#define PREDS 7
+#define PRIUNAT 8
+#define AR_BSPSTORE 9
+#define AR_RNAT 10
+#define AR_UNAT 11
+#define AR_FPSR 12
+#define AR_LC 13
+#define AR_PFS 14
+#define GR4 16
+#define GR5 17
+#define GR6 18
+#define GR7 19
+#define BR1 20
+#define BR2 21
+#define BR3 22
+#define BR4 23
+#define BR5 24
+
+void dump_context(uint64_t *context)
+{
+ int i, j;
+ unsigned int valid;
+ uint64_t val;
+ static char *names[] = {
+ /* 0 */ "ip", "sp", "bsp", "cfm",
+ /* 4 */ "rp", "psp", "pfs", "preds",
+ /* 8 */ "priunat", "ar.bspstore", "ar.rnat", "ar.unat",
+ /* 12 */ "ar.fpsr", "ar.lc", "ar.pfs", "(pad)",
+ /* 16 */ "gr4", "gr5", "gr6", "gr7",
+ /* 20 */ "br1", "br2", "br3", "br4", "br5"
+ };
+ static int col1[] = {
+ IP,
+ SP,
+ BSP,
+ CFM,
+ RP,
+ PSP,
+ PFS,
+ AR_RNAT,
+ AR_UNAT,
+ AR_FPSR,
+ AR_LC,
+ AR_PFS,
+ };
+ static int col2[] = {
+ PREDS,
+ PRIUNAT,
+ GR4,
+ GR5,
+ GR6,
+ GR7,
+ BR1,
+ BR2,
+ BR3,
+ BR4,
+ BR5,
+ };
+
+#define NCOL1 (sizeof(col1)/sizeof(int))
+#define NCOL2 (sizeof(col2)/sizeof(int))
+#define NPRINT (NCOL1 > NCOL2 ? NCOL1 : NCOL2)
+
+ valid = (unsigned int)(context[0] >> 32);
+ printf(" valid_regs (%08lx):", valid);
+ for (i = 0; i <= BR5; i++) {
+ if (valid & 1) printf(" %s", names[i]);
+ valid >>= 1;
+ }
+ printf("\n");
+ for (i = 0; i < NPRINT; i++) {
+ if (i < NCOL1) {
+ j = col1[i];
+ val = context[j+1];
+ printf(" %-8s %08x %08x", names[j],
+ (unsigned int)(val >> 32),
+ (unsigned int)val);
+ }
+ else
+ printf(" ");
+ if (i < NCOL2) {
+ j = col2[i];
+ val = context[j+1];
+ printf(" %-8s %08x %08x", names[j],
+ (unsigned int)(val >> 32),
+ (unsigned int)val);
+ }
+ putchar('\n');
+ }
+}
diff --git a/sys/contrib/ia64/libuwx/test/dumpmyself.c b/sys/contrib/ia64/libuwx/test/dumpmyself.c
new file mode 100644
index 0000000..c2b63d0
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/test/dumpmyself.c
@@ -0,0 +1,106 @@
+#include "uwx.h"
+#include "uwx_self.h"
+
+struct uwx_env *uenv;
+struct uwx_self_info *cbinfo;
+
+extern int uwx_get_frame_info(struct uwx_env *uenv);
+
+extern void dump_context(uint64_t *context);
+
+extern void prime_registers();
+
+int main(int argc, char **argv)
+{
+ int status;
+ unsigned int *wp;
+ uenv = uwx_init();
+ printf("uwx_init returned %08x\n", uenv);
+ cbinfo = uwx_self_init_info(uenv);
+ status = uwx_register_callbacks(
+ uenv,
+ (intptr_t)cbinfo,
+ uwx_self_copyin,
+ uwx_self_lookupip);
+ printf("uwx_register_callbacks returned %d\n", status);
+ uwx_self_init_context(uenv);
+ printf("In main():\n");
+ dump_context((uint64_t *)uenv);
+ prime_registers();
+ uwx_free(uenv);
+ return 0;
+}
+
+int func1(void)
+{
+ uwx_self_init_context(uenv);
+ printf("In func1():\n");
+ dump_context((uint64_t *)uenv);
+ return func2();
+}
+
+int func2(void)
+{
+ uwx_self_init_context(uenv);
+ printf("In func2():\n");
+ dump_context((uint64_t *)uenv);
+ return func3();
+}
+
+int func3(void)
+{
+ uwx_self_init_context(uenv);
+ printf("In func3():\n");
+ dump_context((uint64_t *)uenv);
+ return func4();
+}
+
+int func4(void)
+{
+ int status;
+ int foo[10];
+ uint64_t *p;
+ uint64_t disp;
+ uint64_t val;
+
+ func5(foo);
+ uwx_self_init_context(uenv);
+ uwx_init_history(uenv);
+ printf("In func4():\n");
+ dump_context((uint64_t *)uenv);
+ for (;;) {
+ status = uwx_step(uenv);
+ if (status != UWX_OK) {
+ printf("uwx_step returned %d\n", status);
+ break;
+ }
+ status = uwx_get_reg(uenv, UWX_REG_PFS, &val);
+ if (status != UWX_OK) {
+ printf("uwx_get_reg returned %d\n", status);
+ break;
+ }
+ printf("After step:\n");
+ dump_context((uint64_t *)uenv);
+ status = uwx_get_spill_loc(uenv, UWX_REG_IP, &disp);
+ if (status == UWX_OK) {
+ p = (uint64_t *)(disp & ~0x7LL);
+ if ((disp & 0x7) == UWX_DISP_RSTK(0))
+ printf("IP spilled to backing store %08x = %08x\n",
+ (int)p, (int)(*p));
+ else if ((disp & 0x7) == UWX_DISP_MSTK(0))
+ printf("IP spilled to mem stack %08x = %08x\n",
+ (int)p, (int)(*p));
+ else if ((disp & 0x7) == UWX_DISP_REG(0))
+ printf("IP found in register %08x\n", (int)disp >> 4);
+ else
+ printf("IP history not available\n");
+ }
+ }
+ return 0;
+}
+
+int func5(int *foo)
+{
+ foo[0] = 0;
+ return 0;
+}
diff --git a/sys/contrib/ia64/libuwx/test/primeregs.s b/sys/contrib/ia64/libuwx/test/primeregs.s
new file mode 100644
index 0000000..12444a2
--- /dev/null
+++ b/sys/contrib/ia64/libuwx/test/primeregs.s
@@ -0,0 +1,93 @@
+ .text
+ .proc prime_registers
+ .global prime_registers
+
+prime_registers:
+
+ .prologue
+
+ .save ar.pfs, r32
+ alloc r32 = ar.pfs, 0, 3, 0, 0
+ .save rp, r33
+ mov r33 = b0
+ .save ar.unat, r34
+ mov r34 = ar.unat
+ add r14 = -56, sp
+ add r15 = -48, sp
+ .fframe 80
+ add sp = -80, sp
+ mov r16 = b1
+ ;;
+
+ .save.g 0x1
+ st8.spill [r14] = r4, 16
+ .save.g 0x2
+ st8.spill [r15] = r5, 16
+ mov r17 = b2
+ ;;
+ .save.g 0x4
+ st8.spill [r14] = r6, 16
+ .save.g 0x8
+ st8.spill [r15] = r7, 16
+ mov r18 = b3
+ ;;
+ .save.b 0x1
+ st8 [r14] = r16, 16
+ .save.b 0x2
+ st8 [r15] = r17, 16
+ mov r19 = b4
+ ;;
+ .save.b 0x4
+ st8 [r14] = r18, 16
+ .save.b 0x8
+ st8 [r15] = r19
+ mov r20 = b5
+ ;;
+ .save.b 0x10
+ st8 [r14] = r20
+
+ .body
+
+ dep.z r4 = -0x34, 16, 32
+ ;;
+ add r5 = 1, r4
+ add r6 = 2, r4
+ ;;
+ add r7 = 3, r4
+ ;;
+
+ .global func1
+ .type func1, @function
+ br.call.sptk b0 = func1
+ ;;
+
+ add r14 = 80, sp
+ add r15 = 88, sp
+ ;;
+ ld8 r20 = [r15], -16
+ ;;
+ ld8 r19 = [r14], -16
+ ld8 r18 = [r15], -16
+ mov b5 = r20
+ ;;
+ ld8 r17 = [r14], -16
+ ld8 r16 = [r15], -16
+ mov b4 = r19
+ ;;
+ ld8.fill r7 = [r14], -16
+ ld8.fill r6 = [r15], -16
+ mov b3 = r18
+ ;;
+ ld8.fill r5 = [r14]
+ ld8.fill r4 = [r15]
+ mov b2 = r17
+ mov b1 = r16
+
+ .restore sp
+ mov ar.pfs = r32
+ ;;
+ add sp = 80, sp
+ mov ar.unat = r34
+ mov b0 = r33
+ br.ret.sptk b0
+ .endp
diff --git a/sys/contrib/ipfilter/netinet/IPFILTER.LICENCE b/sys/contrib/ipfilter/netinet/IPFILTER.LICENCE
new file mode 100644
index 0000000..1ee473d
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/IPFILTER.LICENCE
@@ -0,0 +1,30 @@
+$FreeBSD$
+
+Copyright (C) 1993-2002 by Darren Reed.
+
+The author accepts no responsibility for the use of this software and
+provides it on an ``as is'' basis without express or implied warranty.
+
+Redistribution and use, with or without modification, in source and binary
+forms, are permitted provided that this notice is preserved in its entirety
+and due credit is given to the original author and the contributors.
+
+The licence and distribution terms for any publically available version or
+derivative of this code cannot be changed. i.e. this code cannot simply be
+copied, in part or in whole, and put under another distribution licence
+[including the GNU Public Licence.]
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+I hate legalese, don't you ?
+
diff --git a/sys/contrib/ipfilter/netinet/QNX_OCL.txt b/sys/contrib/ipfilter/netinet/QNX_OCL.txt
new file mode 100644
index 0000000..b623776
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/QNX_OCL.txt
@@ -0,0 +1,277 @@
+$FreeBSD$
+
+ End User License Certificate (EULA) End User License Certificate
+ (EULA)
+ Support Support
+ QNX Source Licenses QNX Source Licenses
+ License of the month
+ Confidential Source License
+ Version 1.0
+
+QNX Open Community License Version 1.0
+
+ THIS QNX OPEN COMMUNITY LICENSE ( "THE OCL", OR "THIS AGREEMENT")
+ APPLIES TO PROGRAMS THAT QNX SOFTWARE SYSTEMS LTD. ("QSS") EXPRESSLY
+ ELECTS TO LICENSE UNDER THE OCL TERMS. IT ALSO APPLIES TO DERIVATIVE
+ WORKS CREATED UNDER THIS AGREEMENT THAT CREATORS ELECT TO LICENSE TO
+ OTHERS IN SOURCE CODE FORM. ANY USE, REPRODUCTION, MODIFICATION OR
+ DISTRIBUTION OF SUCH PROGRAMS CONSTITUTES RECIPIENT'S ACCEPTANCE OF
+ THE OCL. THE LICENSE RIGHTS GRANTED BELOW ARE CONDITIONAL UPON
+ RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT AND THE FORMATION OF A
+ BINDING CONTRACT. NOTHING ELSE GRANTS PERMISSION TO USE, REPRODUCE,
+ MODIFY OR DISTRIBUTE SUCH PROGRAMS OR THEIR DERIVATIVE WORKS. THESE
+ ACTIONS ARE OTHERWISE PROHIBITED. CONTACT QSS IF OTHER STEPS ARE
+ REQUIRED LOCALLY TO CREATE A BINDING CONTRACT.
+
+ The OCL is intended to promote the development, use and distribution
+ of derivative works created from QSS source code. This includes
+ commercial distribution of object code versions under the terms of
+ Recipient's own license agreement and, at Recipient's option, sharing
+ of source code modifications within the QNX developer's community. The
+ license granted under the OCL is royalty free. Recipient is entitled
+ to charge royalties for object code versions of derivative works that
+ originate with Recipient. If Recipient elects to license source code
+ for its derivative works to others, then it must be licensed under the
+ OCL. The terms of the OCL are as follows:
+
+1. DEFINITIONS
+
+ "Contribution" means:
+
+ a. in the case of QSS: (i) the Original Program, where the Original
+ Program originates from QSS, (ii) changes and/or additions to
+ Unrestricted Open Source, where the Original Program originates
+ from Unrestricted Open Source and where such changes and/or
+ additions originate from QSS, and (iii) changes and/or additions
+ to the Program where such changes and/or additions originate from
+ QSS.
+ b. in the case of each Contributor, changes and/or additions to the
+ Program, where such changes and/or additions originate from and
+ are distributed by that particular Contributor.
+
+ A Contribution 'originates' from a Contributor if it was added to the
+ Program by such Contributor itself or anyone acting on such
+ Contributor's behalf. Contributions do not include additions to the
+ Program which: (i) are separate modules of software distributed in
+ conjunction with the Program under their own license agreement, and
+ (ii) are not derivative works of the Program.
+
+ "Contributor" means QSS and any other entity that distributes the
+ Program.
+
+ "Licensed Patents " mean patent claims licensable by Contributor to
+ others, which are necessarily infringed by the use or sale of its
+ Contribution alone or when combined with the Program.
+
+ "Unrestricted Open Source" means published source code that is
+ licensed for free use and distribution under an unrestricted licensing
+ and distribution model, such as the Berkley Software Design ("BSD")
+ and "BSD-like" licenses. It specifically excludes any source code
+ licensed under any version of the GNU General Public License (GPL) or
+ the GNU Lesser/Library GPL. All "Unrestricted Open Source" license
+ terms appear or are clearly identified in the header of any affected
+ source code for the Original Program.
+
+ "Original Program" means the original version of the software
+ accompanying this Agreement as released by QSS, including source code,
+ object code and documentation, if any.
+
+ "Program" means the Original Program and Contributions.
+
+ "Recipient" means anyone who receives the Program under this
+ Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+ a. Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free
+ copyright license to reproduce, prepare derivative works of,
+ publicly display, publicly perform, and directly and indirectly
+ sublicense and distribute the Contribution of such Contributor, if
+ any, and such derivative works, in source code and object code
+ form.
+ b. Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such
+ Contributor, if any, in source code and object code form. This
+ patent license shall apply to the combination of the Contribution
+ and the Program if, at the time the Contribution is added by the
+ Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent
+ license shall not apply to any other combinations which include
+ the Contribution.
+ c. Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+ d. Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ 3. REQUIREMENTS
+
+ A Contributor may choose to distribute the Program in object code form
+ under its own license agreement, provided that:
+
+ a. it complies with the terms and conditions of this Agreement; and
+ b. its license agreement:
+ i. effectively disclaims on behalf of all Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and
+ fitness for a particular purpose;
+ ii. effectively excludes on behalf of all Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+ and
+ iii. states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party.
+
+ If the Program is made available in source code form:
+
+ a. it must be made available under this Agreement; and
+ b. a copy of this Agreement must be included with each copy of the
+ Program. Each Contributor must include the following in a
+ conspicuous location in the Program along with any other copyright
+ or attribution statements required by the terms of any applicable
+ Unrestricted Open Source license:
+ Copyright {date here}, QNX Software Systems Ltd. and others. All
+ Rights Reserved.
+
+ In addition, each Contributor must identify itself as the originator
+ of its Contribution, if any, in a manner that reasonably allows
+ subsequent Recipients to identify the originator of the Contribution.
+
+ 4. COMMERCIAL DISTRIBUTION
+
+ Commercial distributors of software may accept certain
+ responsibilities with respect to end users, business partners and the
+ like. While this license is intended to facilitate the commercial use
+ of the Program, the Contributor who includes the Program in a
+ commercial product offering should do so in a manner which does not
+ create potential liability for other Contributors. Therefore, if a
+ Contributor includes the Program in a commercial product offering,
+ such Contributor ("Commercial Contributor") hereby agrees to defend
+ and indemnify every other Contributor ("Indemnified Contributor")
+ against any losses, damages and costs (collectively "Losses") arising
+ from claims, lawsuits and other legal actions brought by a third party
+ against the Indemnified Contributor to the extent caused by the acts
+ or omissions of such Commercial Contributor in connection with its
+ distribution of the Program in a commercial product offering. The
+ obligations in this section do not apply to any claims or Losses
+ relating to any actual or alleged intellectual property infringement.
+ In order to qualify, an Indemnified Contributor must: a) promptly
+ notify the Commercial Contributor in writing of such claim, and b)
+ allow the Commercial Contributor to control, and cooperate with the
+ Commercial Contributor in, the defense and any related settlement
+ negotiations. The Indemnified Contributor may participate in any such
+ claim at its own expense.
+
+ For example, a Contributor might include the Program in a commercial
+ product offering, Product X. That Contributor is then a Commercial
+ Contributor. If that Commercial Contributor then makes performance
+ claims, or offers warranties related to Product X, those performance
+ claims and warranties are such Commercial Contributor's responsibility
+ alone. Under this section, the Commercial Contributor would have to
+ defend claims against the other Contributors related to those
+ performance claims and warranties, and if a court requires any other
+ Contributor to pay any damages as a result, the Commercial Contributor
+ must pay those damages.
+
+ 5. NO WARRANTY
+
+ Recipient acknowledges that there may be errors or bugs in the Program
+ and that it is imperative that Recipient conduct thorough testing to
+ identify and correct any problems prior to the productive use or
+ commercial release of any products that use the Program, and prior to
+ the release of any modifications, updates or enhancements thereto.
+
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+ PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+ WARRANTIES OR CONDITIONS OF TITLE, NON- INFRINGEMENT, MERCHANTABILITY
+ OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+ responsible for determining the appropriateness of using and
+ distributing the Program and assumes all risks associated with its
+ exercise of rights under this Agreement, including but not limited to
+ the risks and costs of program errors, compliance with applicable
+ laws, damage to or loss of data, programs or equipment, and
+ unavailability or interruption of operations.
+
+ 6. DISCLAIMER OF LIABILITY
+
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+ WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+ DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ 7. GENERAL
+
+ If any provision of this Agreement is invalid or unenforceable under
+ applicable law, it shall not affect the validity or enforceability of
+ the remainder of the terms of this Agreement, and without further
+ action by the parties hereto, such provision shall be reformed to the
+ minimum extent necessary to make such provision valid and enforceable.
+
+ If Recipient institutes patent litigation against a Contributor with
+ respect to a patent applicable to software (including a cross-claim or
+ counterclaim in a lawsuit), then any patent licenses granted by that
+ Contributor to such recipient under this Agreement shall terminate as
+ of the date such litigation is filed. In addition, If Recipient
+ institutes patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Program
+ itself (excluding combinations of the Program with other software or
+ hardware) infringes such Recipient's patent(s), then such Recipient's
+ rights granted under Section 2(b) shall terminate as of the date such
+ litigation is filed.
+
+ All Recipient's rights under this Agreement shall terminate if it
+ fails to comply with any of the material terms or conditions of this
+ Agreement and does not cure such failure in a reasonable period of
+ time after becoming aware of such noncompliance. If all Recipient's
+ rights under this Agreement terminate, Recipient agrees to cease use
+ and distribution of the Program as soon as reasonably practicable.
+ However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and
+ survive.
+
+ QSS may publish new versions (including revisions) of this Agreement
+ from time to time. Each new version of the Agreement will be given a
+ distinguishing version number. The Program (including Contributions)
+ may always be distributed subject to the version of the Agreement
+ under which it was received. In addition, after a new version of the
+ Agreement is published, Contributor may elect to distribute the
+ Program (including its Contributions) under the new version. No one
+ other than QSS has the right to modify this Agreement. Except as
+ expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+ no rights or licenses to the intellectual property of any Contributor
+ under this Agreement, whether expressly, by implication, estoppel or
+ otherwise. All rights in the Program not expressly granted under this
+ Agreement are reserved.
+
+ This Agreement is governed by the laws in force in the Province of
+ Ontario, Canada without regard to the conflict of law provisions
+ therein. The parties expressly disclaim the provisions of the United
+ Nations Convention on Contracts for the International Sale of Goods.
+ No party to this Agreement will bring a legal action under this
+ Agreement more than one year after the cause of action arose. Each
+ party waives its rights to a jury trial in any resulting litigation.
+
+ * QNX is a registered trademark of QNX Software Systems Ltd.
+
+ Document Version: ocl1_00
diff --git a/sys/contrib/ipfilter/netinet/fil.c b/sys/contrib/ipfilter/netinet/fil.c
new file mode 100644
index 0000000..67d9f03
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/fil.c
@@ -0,0 +1,2247 @@
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
+ defined(_KERNEL)
+# include "opt_ipfilter_log.h"
+#endif
+#if (defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD_version) && \
+ (__FreeBSD_version >= 220000)
+# if (__FreeBSD_version >= 400000)
+# ifndef KLD_MODULE
+# include "opt_inet6.h"
+# endif
+# if (__FreeBSD_version == 400019)
+# define CSUM_DELAY_DATA
+# endif
+# endif
+# include <sys/filio.h>
+# include <sys/fcntl.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#if (defined(_KERNEL) || defined(KERNEL)) && !defined(linux)
+# include <sys/systm.h>
+#else
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/byteorder.h>
+# if SOLARIS2 < 5
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+#endif
+#ifndef linux
+# include <sys/protosw.h>
+# include <sys/socket.h>
+#endif
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifndef linux
+# include <netinet/ip_var.h>
+#endif
+#if defined(__sgi) && defined(IFF_DRVRLOCK) /* IRIX 6 */
+# include <sys/hashing.h>
+# include <netinet/in_var.h>
+#endif
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#ifdef USE_INET6
+# include <netinet/icmp6.h>
+# if !SOLARIS && defined(_KERNEL)
+# include <netinet6/in6_var.h>
+# endif
+#endif
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_proxy.h"
+#include "netinet/ip_auth.h"
+# if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+# if defined(_KERNEL) && !defined(IPFILTER_LKM)
+# include "opt_ipfilter.h"
+# endif
+# endif
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#include "netinet/ipl.h"
+
+#include <machine/in_cksum.h>
+
+#if !defined(lint)
+static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed";
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+#ifndef _KERNEL
+# include "ipf.h"
+# include "ipt.h"
+extern int opts;
+
+# define FR_VERBOSE(verb_pr) verbose verb_pr
+# define FR_DEBUG(verb_pr) debug verb_pr
+# define IPLLOG(a, c, d, e) ipflog(a, c, d, e)
+#else /* #ifndef _KERNEL */
+# define FR_VERBOSE(verb_pr)
+# define FR_DEBUG(verb_pr)
+# define IPLLOG(a, c, d, e) ipflog(a, c, d, e)
+# if SOLARIS || defined(__sgi)
+extern KRWLOCK_T ipf_mutex, ipf_auth, ipf_nat;
+extern kmutex_t ipf_rw;
+# endif /* SOLARIS || __sgi */
+#endif /* _KERNEL */
+
+
+struct filterstats frstats[2] = {{0,0,0,0,0},{0,0,0,0,0}};
+struct frentry *ipfilter[2][2] = { { NULL, NULL }, { NULL, NULL } },
+#ifdef USE_INET6
+ *ipfilter6[2][2] = { { NULL, NULL }, { NULL, NULL } },
+ *ipacct6[2][2] = { { NULL, NULL }, { NULL, NULL } },
+#endif
+ *ipacct[2][2] = { { NULL, NULL }, { NULL, NULL } };
+struct frgroup *ipfgroups[3][2];
+int fr_flags = IPF_LOGGING;
+int fr_active = 0;
+int fr_chksrc = 0;
+int fr_minttl = 3;
+int fr_minttllog = 1;
+#if defined(IPFILTER_DEFAULT_BLOCK)
+int fr_pass = FR_NOMATCH|FR_BLOCK;
+#else
+int fr_pass = (IPF_DEFAULT_PASS|FR_NOMATCH);
+#endif
+char ipfilter_version[] = IPL_VERSION;
+
+fr_info_t frcache[2];
+
+static int frflushlist __P((int, minor_t, int *, frentry_t **));
+#ifdef _KERNEL
+static void frsynclist __P((frentry_t *));
+#endif
+
+
+/*
+ * bit values for identifying presence of individual IP options
+ */
+struct optlist ipopts[20] = {
+ { IPOPT_NOP, 0x000001 },
+ { IPOPT_RR, 0x000002 },
+ { IPOPT_ZSU, 0x000004 },
+ { IPOPT_MTUP, 0x000008 },
+ { IPOPT_MTUR, 0x000010 },
+ { IPOPT_ENCODE, 0x000020 },
+ { IPOPT_TS, 0x000040 },
+ { IPOPT_TR, 0x000080 },
+ { IPOPT_SECURITY, 0x000100 },
+ { IPOPT_LSRR, 0x000200 },
+ { IPOPT_E_SEC, 0x000400 },
+ { IPOPT_CIPSO, 0x000800 },
+ { IPOPT_SATID, 0x001000 },
+ { IPOPT_SSRR, 0x002000 },
+ { IPOPT_ADDEXT, 0x004000 },
+ { IPOPT_VISA, 0x008000 },
+ { IPOPT_IMITD, 0x010000 },
+ { IPOPT_EIP, 0x020000 },
+ { IPOPT_FINN, 0x040000 },
+ { 0, 0x000000 }
+};
+
+/*
+ * bit values for identifying presence of individual IP security options
+ */
+struct optlist secopt[8] = {
+ { IPSO_CLASS_RES4, 0x01 },
+ { IPSO_CLASS_TOPS, 0x02 },
+ { IPSO_CLASS_SECR, 0x04 },
+ { IPSO_CLASS_RES3, 0x08 },
+ { IPSO_CLASS_CONF, 0x10 },
+ { IPSO_CLASS_UNCL, 0x20 },
+ { IPSO_CLASS_RES2, 0x40 },
+ { IPSO_CLASS_RES1, 0x80 }
+};
+
+
+/*
+ * compact the IP header into a structure which contains just the info.
+ * which is useful for comparing IP headers with.
+ */
+void fr_makefrip(hlen, ip, fin)
+int hlen;
+ip_t *ip;
+fr_info_t *fin;
+{
+ u_short optmsk = 0, secmsk = 0, auth = 0;
+ int i, mv, ol, off, p, plen, v;
+ fr_ip_t *fi = &fin->fin_fi;
+ struct optlist *op;
+ u_char *s, opt;
+ tcphdr_t *tcp;
+
+ fin->fin_rev = 0;
+ fin->fin_fr = NULL;
+ fin->fin_tcpf = 0;
+ fin->fin_data[0] = 0;
+ fin->fin_data[1] = 0;
+ fin->fin_rule = -1;
+ fin->fin_group = -1;
+ fin->fin_icode = ipl_unreach;
+ v = fin->fin_v;
+ fi->fi_v = v;
+ fin->fin_hlen = hlen;
+ if (v == 4) {
+ fin->fin_id = ip->ip_id;
+ fi->fi_tos = ip->ip_tos;
+ off = (ip->ip_off & IP_OFFMASK);
+ tcp = (tcphdr_t *)((char *)ip + hlen);
+ (*(((u_short *)fi) + 1)) = (*(((u_short *)ip) + 4));
+ fi->fi_src.i6[1] = 0;
+ fi->fi_src.i6[2] = 0;
+ fi->fi_src.i6[3] = 0;
+ fi->fi_dst.i6[1] = 0;
+ fi->fi_dst.i6[2] = 0;
+ fi->fi_dst.i6[3] = 0;
+ fi->fi_saddr = ip->ip_src.s_addr;
+ fi->fi_daddr = ip->ip_dst.s_addr;
+ p = ip->ip_p;
+ fi->fi_fl = (hlen > sizeof(ip_t)) ? FI_OPTIONS : 0;
+ if (ip->ip_off & (IP_MF|IP_OFFMASK))
+ fi->fi_fl |= FI_FRAG;
+ plen = ip->ip_len;
+ fin->fin_dlen = plen - hlen;
+ }
+#ifdef USE_INET6
+ else if (v == 6) {
+ ip6_t *ip6 = (ip6_t *)ip;
+
+ off = 0;
+ p = ip6->ip6_nxt;
+ fi->fi_p = p;
+ fi->fi_ttl = ip6->ip6_hlim;
+ tcp = (tcphdr_t *)(ip6 + 1);
+ fi->fi_src.in6 = ip6->ip6_src;
+ fi->fi_dst.in6 = ip6->ip6_dst;
+ fin->fin_id = (u_short)(ip6->ip6_flow & 0xffff);
+ fi->fi_tos = 0;
+ fi->fi_fl = 0;
+ plen = ntohs(ip6->ip6_plen);
+ fin->fin_dlen = plen;
+ plen += sizeof(*ip6);
+ }
+#endif
+ else
+ return;
+
+ fin->fin_off = off;
+ fin->fin_plen = plen;
+ fin->fin_dp = (char *)tcp;
+ fin->fin_misc = 0;
+ off <<= 3;
+
+ switch (p)
+ {
+#ifdef USE_INET6
+ case IPPROTO_ICMPV6 :
+ {
+ int minicmpsz = sizeof(struct icmp6_hdr);
+ struct icmp6_hdr *icmp6;
+
+ if (fin->fin_dlen > 1) {
+ fin->fin_data[0] = *(u_short *)tcp;
+
+ icmp6 = (struct icmp6_hdr *)tcp;
+
+ switch (icmp6->icmp6_type)
+ {
+ case ICMP6_ECHO_REPLY :
+ case ICMP6_ECHO_REQUEST :
+ minicmpsz = ICMP6_MINLEN;
+ break;
+ case ICMP6_DST_UNREACH :
+ case ICMP6_PACKET_TOO_BIG :
+ case ICMP6_TIME_EXCEEDED :
+ case ICMP6_PARAM_PROB :
+ minicmpsz = ICMP6ERR_IPICMPHLEN;
+ break;
+ default :
+ break;
+ }
+ }
+
+ if (!(plen >= minicmpsz))
+ fi->fi_fl |= FI_SHORT;
+
+ break;
+ }
+#endif
+ case IPPROTO_ICMP :
+ {
+ int minicmpsz = sizeof(struct icmp);
+ icmphdr_t *icmp;
+
+ if (!off && (fin->fin_dlen > 1)) {
+ fin->fin_data[0] = *(u_short *)tcp;
+
+ icmp = (icmphdr_t *)tcp;
+
+ switch (icmp->icmp_type)
+ {
+ case ICMP_ECHOREPLY :
+ case ICMP_ECHO :
+ /* Router discovery messages - RFC 1256 */
+ case ICMP_ROUTERADVERT :
+ case ICMP_ROUTERSOLICIT :
+ minicmpsz = ICMP_MINLEN;
+ break;
+ /*
+ * type(1) + code(1) + cksum(2) + id(2) seq(2) +
+ * 3*timestamp(3*4)
+ */
+ case ICMP_TSTAMP :
+ case ICMP_TSTAMPREPLY :
+ minicmpsz = 20;
+ break;
+ /*
+ * type(1) + code(1) + cksum(2) + id(2) seq(2) +
+ * mask(4)
+ */
+ case ICMP_MASKREQ :
+ case ICMP_MASKREPLY :
+ minicmpsz = 12;
+ break;
+ default :
+ break;
+ }
+ }
+
+ if ((!(plen >= hlen + minicmpsz) && !off) ||
+ (off && off < sizeof(struct icmp)))
+ fi->fi_fl |= FI_SHORT;
+
+ break;
+ }
+ case IPPROTO_TCP :
+ fi->fi_fl |= FI_TCPUDP;
+#ifdef USE_INET6
+ if (v == 6) {
+ if (plen < sizeof(struct tcphdr))
+ fi->fi_fl |= FI_SHORT;
+ } else
+#endif
+ if (v == 4) {
+ if ((!IPMINLEN(ip, tcphdr) && !off) ||
+ (off && off < sizeof(struct tcphdr)))
+ fi->fi_fl |= FI_SHORT;
+ }
+ if (!(fi->fi_fl & FI_SHORT) && !off)
+ fin->fin_tcpf = tcp->th_flags;
+ goto getports;
+ case IPPROTO_UDP :
+ fi->fi_fl |= FI_TCPUDP;
+#ifdef USE_INET6
+ if (v == 6) {
+ if (plen < sizeof(struct udphdr))
+ fi->fi_fl |= FI_SHORT;
+ } else
+#endif
+ if (v == 4) {
+ if ((!IPMINLEN(ip, udphdr) && !off) ||
+ (off && off < sizeof(struct udphdr)))
+ fi->fi_fl |= FI_SHORT;
+ }
+getports:
+ if (!off && (fin->fin_dlen > 3)) {
+ fin->fin_data[0] = ntohs(tcp->th_sport);
+ fin->fin_data[1] = ntohs(tcp->th_dport);
+ }
+ break;
+ case IPPROTO_ESP :
+#ifdef USE_INET6
+ if (v == 6) {
+ if (plen < 8)
+ fi->fi_fl |= FI_SHORT;
+ } else
+#endif
+ if (v == 4) {
+ if (((ip->ip_len < hlen + 8) && !off) ||
+ (off && off < 8))
+ fi->fi_fl |= FI_SHORT;
+ }
+ break;
+ default :
+ break;
+ }
+
+#ifdef USE_INET6
+ if (v == 6) {
+ fi->fi_optmsk = 0;
+ fi->fi_secmsk = 0;
+ fi->fi_auth = 0;
+ return;
+ }
+#endif
+
+ for (s = (u_char *)(ip + 1), hlen -= (int)sizeof(*ip); hlen > 0; ) {
+ opt = *s;
+ if (opt == '\0')
+ break;
+ else if (opt == IPOPT_NOP)
+ ol = 1;
+ else {
+ if (hlen < 2)
+ break;
+ ol = (int)*(s + 1);
+ if (ol < 2 || ol > hlen)
+ break;
+ }
+ for (i = 9, mv = 4; mv >= 0; ) {
+ op = ipopts + i;
+ if (opt == (u_char)op->ol_val) {
+ optmsk |= op->ol_bit;
+ if (opt == IPOPT_SECURITY) {
+ struct optlist *sp;
+ u_char sec;
+ int j, m;
+
+ sec = *(s + 2); /* classification */
+ for (j = 3, m = 2; m >= 0; ) {
+ sp = secopt + j;
+ if (sec == sp->ol_val) {
+ secmsk |= sp->ol_bit;
+ auth = *(s + 3);
+ auth *= 256;
+ auth += *(s + 4);
+ break;
+ }
+ if (sec < sp->ol_val)
+ j -= m--;
+ else
+ j += m--;
+ }
+ }
+ break;
+ }
+ if (opt < op->ol_val)
+ i -= mv--;
+ else
+ i += mv--;
+ }
+ hlen -= ol;
+ s += ol;
+ }
+ if (auth && !(auth & 0x0100))
+ auth &= 0xff00;
+ fi->fi_optmsk = optmsk;
+ fi->fi_secmsk = secmsk;
+ fi->fi_auth = auth;
+}
+
+
+/*
+ * check an IP packet for TCP/UDP characteristics such as ports and flags.
+ */
+int fr_tcpudpchk(ft, fin)
+frtuc_t *ft;
+fr_info_t *fin;
+{
+ register u_short po, tup;
+ register char i;
+ register int err = 1;
+
+ /*
+ * Both ports should *always* be in the first fragment.
+ * So far, I cannot find any cases where they can not be.
+ *
+ * compare destination ports
+ */
+ if ((i = (int)ft->ftu_dcmp)) {
+ po = ft->ftu_dport;
+ tup = fin->fin_data[1];
+ /*
+ * Do opposite test to that required and
+ * continue if that succeeds.
+ */
+ if (!--i && tup != po) /* EQUAL */
+ err = 0;
+ else if (!--i && tup == po) /* NOTEQUAL */
+ err = 0;
+ else if (!--i && tup >= po) /* LESSTHAN */
+ err = 0;
+ else if (!--i && tup <= po) /* GREATERTHAN */
+ err = 0;
+ else if (!--i && tup > po) /* LT or EQ */
+ err = 0;
+ else if (!--i && tup < po) /* GT or EQ */
+ err = 0;
+ else if (!--i && /* Out of range */
+ (tup >= po && tup <= ft->ftu_dtop))
+ err = 0;
+ else if (!--i && /* In range */
+ (tup <= po || tup >= ft->ftu_dtop))
+ err = 0;
+ }
+ /*
+ * compare source ports
+ */
+ if (err && (i = (int)ft->ftu_scmp)) {
+ po = ft->ftu_sport;
+ tup = fin->fin_data[0];
+ if (!--i && tup != po)
+ err = 0;
+ else if (!--i && tup == po)
+ err = 0;
+ else if (!--i && tup >= po)
+ err = 0;
+ else if (!--i && tup <= po)
+ err = 0;
+ else if (!--i && tup > po)
+ err = 0;
+ else if (!--i && tup < po)
+ err = 0;
+ else if (!--i && /* Out of range */
+ (tup >= po && tup <= ft->ftu_stop))
+ err = 0;
+ else if (!--i && /* In range */
+ (tup <= po || tup >= ft->ftu_stop))
+ err = 0;
+ }
+
+ /*
+ * If we don't have all the TCP/UDP header, then how can we
+ * expect to do any sort of match on it ? If we were looking for
+ * TCP flags, then NO match. If not, then match (which should
+ * satisfy the "short" class too).
+ */
+ if (err && (fin->fin_fi.fi_p == IPPROTO_TCP)) {
+ if (fin->fin_fl & FI_SHORT)
+ return !(ft->ftu_tcpf | ft->ftu_tcpfm);
+ /*
+ * Match the flags ? If not, abort this match.
+ */
+ if (ft->ftu_tcpfm &&
+ ft->ftu_tcpf != (fin->fin_tcpf & ft->ftu_tcpfm)) {
+ FR_DEBUG(("f. %#x & %#x != %#x\n", fin->fin_tcpf,
+ ft->ftu_tcpfm, ft->ftu_tcpf));
+ err = 0;
+ }
+ }
+ return err;
+}
+
+/*
+ * Check the input/output list of rules for a match and result.
+ * Could be per interface, but this gets real nasty when you don't have
+ * kernel sauce.
+ */
+int fr_scanlist(passin, ip, fin, m)
+u_32_t passin;
+ip_t *ip;
+register fr_info_t *fin;
+void *m;
+{
+ register struct frentry *fr;
+ register fr_ip_t *fi = &fin->fin_fi;
+ int rulen, portcmp = 0, off, skip = 0, logged = 0;
+ u_32_t pass, passt, passl;
+ frentry_t *frl;
+
+ frl = NULL;
+ pass = passin;
+ fr = fin->fin_fr;
+ fin->fin_fr = NULL;
+ off = fin->fin_off;
+
+ if ((fi->fi_fl & FI_TCPUDP) && (fin->fin_dlen > 3) && !off)
+ portcmp = 1;
+
+ for (rulen = 0; fr; fr = fr->fr_next, rulen++) {
+ if (skip) {
+ FR_VERBOSE(("%d (%#x)\n", skip, fr->fr_flags));
+ skip--;
+ continue;
+ }
+ /*
+ * In all checks below, a null (zero) value in the
+ * filter struture is taken to mean a wildcard.
+ *
+ * check that we are working for the right interface
+ */
+#ifdef _KERNEL
+# if (BSD >= 199306)
+ if (fin->fin_out != 0) {
+ if ((fr->fr_oifa &&
+ (fr->fr_oifa != ((mb_t *)m)->m_pkthdr.rcvif)))
+ continue;
+ }
+# endif
+#else
+ if (opts & (OPT_VERBOSE|OPT_DEBUG))
+ printf("\n");
+#endif
+
+ FR_VERBOSE(("%c", fr->fr_skip ? 's' :
+ (pass & FR_PASS) ? 'p' :
+ (pass & FR_AUTH) ? 'a' :
+ (pass & FR_ACCOUNT) ? 'A' :
+ (pass & FR_NOMATCH) ? 'n' : 'b'));
+
+ if (fr->fr_ifa && fr->fr_ifa != fin->fin_ifp)
+ continue;
+
+ FR_VERBOSE((":i"));
+ {
+ register u_32_t *ld, *lm, *lip;
+ register int i;
+
+ lip = (u_32_t *)fi;
+ lm = (u_32_t *)&fr->fr_mip;
+ ld = (u_32_t *)&fr->fr_ip;
+ i = ((*lip & *lm) != *ld);
+ FR_DEBUG(("0. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ if (i)
+ continue;
+ /*
+ * We now know whether the packet version and the
+ * rule version match, along with protocol, ttl and
+ * tos.
+ */
+ lip++, lm++, ld++;
+ /*
+ * Unrolled loops (4 each, for 32 bits).
+ */
+ FR_DEBUG(("1a. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 5;
+ if (fi->fi_v == 6) {
+ FR_DEBUG(("1b. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 5;
+ FR_DEBUG(("1c. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 5;
+ FR_DEBUG(("1d. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 5;
+ } else {
+ lip += 3;
+ lm += 3;
+ ld += 3;
+ }
+ i ^= (fr->fr_flags & FR_NOTSRCIP);
+ if (i)
+ continue;
+ FR_DEBUG(("2a. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 6;
+ if (fi->fi_v == 6) {
+ FR_DEBUG(("2b. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 6;
+ FR_DEBUG(("2c. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 6;
+ FR_DEBUG(("2d. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++) << 6;
+ } else {
+ lip += 3;
+ lm += 3;
+ ld += 3;
+ }
+ i ^= (fr->fr_flags & FR_NOTDSTIP);
+ if (i)
+ continue;
+ FR_DEBUG(("3. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip++ & *lm++) != *ld++);
+ FR_DEBUG(("4. %#08x & %#08x != %#08x\n",
+ *lip, *lm, *ld));
+ i |= ((*lip & *lm) != *ld);
+ if (i)
+ continue;
+ }
+
+ /*
+ * If a fragment, then only the first has what we're looking
+ * for here...
+ */
+ if (!portcmp && (fr->fr_dcmp || fr->fr_scmp || fr->fr_tcpf ||
+ fr->fr_tcpfm))
+ continue;
+ if (fi->fi_fl & FI_TCPUDP) {
+ if (!fr_tcpudpchk(&fr->fr_tuc, fin))
+ continue;
+ } else if (fr->fr_icmpm || fr->fr_icmp) {
+ if (((fi->fi_p != IPPROTO_ICMP) &&
+ (fi->fi_p != IPPROTO_ICMPV6)) || off ||
+ (fin->fin_dlen < 2))
+ continue;
+ if ((fin->fin_data[0] & fr->fr_icmpm) != fr->fr_icmp) {
+ FR_DEBUG(("i. %#x & %#x != %#x\n",
+ fin->fin_data[0], fr->fr_icmpm,
+ fr->fr_icmp));
+ continue;
+ }
+ }
+ FR_VERBOSE(("*"));
+
+ if (fr->fr_flags & FR_NOMATCH) {
+ passt = passl;
+ passl = passin;
+ fin->fin_fr = frl;
+ frl = NULL;
+ if (fr->fr_flags & FR_QUICK)
+ break;
+ continue;
+ }
+
+ passl = passt;
+ passt = fr->fr_flags;
+ frl = fin->fin_fr;
+ fin->fin_fr = fr;
+#if (BSD >= 199306) && (defined(_KERNEL) || defined(KERNEL))
+ if (securelevel <= 0)
+#endif
+ if ((passt & FR_CALLNOW) && fr->fr_func)
+ passt = (*fr->fr_func)(passt, ip, fin);
+#ifdef IPFILTER_LOG
+ /*
+ * Just log this packet...
+ */
+ if ((passt & FR_LOGMASK) == FR_LOG) {
+ if (!IPLLOG(passt, ip, fin, m)) {
+ if (passt & FR_LOGORBLOCK)
+ passt |= FR_BLOCK|FR_QUICK;
+ ATOMIC_INCL(frstats[fin->fin_out].fr_skip);
+ }
+ ATOMIC_INCL(frstats[fin->fin_out].fr_pkl);
+ logged = 1;
+ }
+#endif /* IPFILTER_LOG */
+ ATOMIC_INCL(fr->fr_hits);
+ if (passt & FR_ACCOUNT)
+ fr->fr_bytes += (U_QUAD_T)ip->ip_len;
+ else
+ fin->fin_icode = fr->fr_icode;
+ fin->fin_rule = rulen;
+ fin->fin_group = fr->fr_group;
+ if (fr->fr_grp != NULL) {
+ fin->fin_fr = fr->fr_grp;
+ passt = fr_scanlist(passt, ip, fin, m);
+ if (fin->fin_fr == NULL) {
+ fin->fin_rule = rulen;
+ fin->fin_group = fr->fr_group;
+ fin->fin_fr = fr;
+ }
+ if (passt & FR_DONTCACHE)
+ logged = 1;
+ }
+ if (!(skip = fr->fr_skip) && (passt & FR_LOGMASK) != FR_LOG)
+ pass = passt;
+ FR_DEBUG(("pass %#x\n", pass));
+ if (passt & FR_QUICK)
+ break;
+ }
+ if (logged)
+ pass |= FR_DONTCACHE;
+ pass |= (fi->fi_fl << 24);
+ return pass;
+}
+
+
+/*
+ * frcheck - filter check
+ * check using source and destination addresses/ports in a packet whether
+ * or not to pass it on or not.
+ */
+int fr_check(ip, hlen, ifp, out
+#if defined(_KERNEL) && SOLARIS
+, qif, mp)
+qif_t *qif;
+#else
+, mp)
+#endif
+mb_t **mp;
+ip_t *ip;
+int hlen;
+void *ifp;
+int out;
+{
+ /*
+ * The above really sucks, but short of writing a diff
+ */
+ fr_info_t frinfo, *fc;
+ register fr_info_t *fin = &frinfo;
+ int changed, error = EHOSTUNREACH, v = ip->ip_v;
+ frentry_t *fr = NULL, *list;
+ u_32_t pass, apass;
+#if !SOLARIS || !defined(_KERNEL)
+ register mb_t *m = *mp;
+#endif
+
+#ifdef _KERNEL
+ int p, len, drop = 0, logit = 0;
+ mb_t *mc = NULL;
+# if !defined(__SVR4) && !defined(__svr4__)
+# ifdef __sgi
+ char hbuf[128];
+# endif
+ int up;
+
+# if !SOLARIS && !defined(NETBSD_PF) && \
+ ((defined(__FreeBSD__) && (__FreeBSD_version < 500011)) || \
+ defined(__OpenBSD__) || defined(_BSDI_VERSION))
+ if (fr_checkp != fr_check && fr_running > 0) {
+ static int counter = 0;
+
+ if (counter == 0) {
+ printf("WARNING: fr_checkp corrupt: value %lx\n",
+ (u_long)fr_checkp);
+ printf("WARNING: fr_checkp should be %lx\n",
+ (u_long)fr_check);
+ printf("WARNING: fixing fr_checkp\n");
+ }
+ fr_checkp = fr_check;
+ counter++;
+ if (counter == 10000)
+ counter = 0;
+ }
+# endif
+
+# ifdef M_CANFASTFWD
+ /*
+ * XXX For now, IP Filter and fast-forwarding of cached flows
+ * XXX are mutually exclusive. Eventually, IP Filter should
+ * XXX get a "can-fast-forward" filter rule.
+ */
+ m->m_flags &= ~M_CANFASTFWD;
+# endif /* M_CANFASTFWD */
+# ifdef CSUM_DELAY_DATA
+ /*
+ * disable delayed checksums.
+ */
+ if ((out != 0) && (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)) {
+ in_delayed_cksum(m);
+ m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
+ }
+# endif /* CSUM_DELAY_DATA */
+
+# ifdef USE_INET6
+ if (v == 6) {
+ len = ntohs(((ip6_t*)ip)->ip6_plen);
+ if (!len)
+ return -1; /* potential jumbo gram */
+ len += sizeof(ip6_t);
+ p = ((ip6_t *)ip)->ip6_nxt;
+ } else
+# endif
+ {
+ p = ip->ip_p;
+ len = ip->ip_len;
+ }
+
+ if ((p == IPPROTO_TCP || p == IPPROTO_UDP ||
+ (v == 4 && p == IPPROTO_ICMP)
+# ifdef USE_INET6
+ || (v == 6 && p == IPPROTO_ICMPV6)
+# endif
+ )) {
+ int plen = 0;
+
+ if ((v == 6) || (ip->ip_off & IP_OFFMASK) == 0)
+ switch(p)
+ {
+ case IPPROTO_TCP:
+ plen = sizeof(tcphdr_t);
+ break;
+ case IPPROTO_UDP:
+ plen = sizeof(udphdr_t);
+ break;
+ /* 96 - enough for complete ICMP error IP header */
+ case IPPROTO_ICMP:
+ plen = ICMPERR_MAXPKTLEN - sizeof(ip_t);
+ break;
+ case IPPROTO_ESP:
+ plen = 8;
+ break;
+# ifdef USE_INET6
+ case IPPROTO_ICMPV6 :
+ /*
+ * XXX does not take intermediate header
+ * into account
+ */
+ plen = ICMP6ERR_MINPKTLEN + 8 - sizeof(ip6_t);
+ break;
+# endif
+ }
+ up = MIN(hlen + plen, len);
+
+ if (up > m->m_len) {
+# ifdef __sgi
+ /* Under IRIX, avoid m_pullup as it makes ping <hostname> panic */
+ if ((up > sizeof(hbuf)) || (m_length(m) < up)) {
+ ATOMIC_INCL(frstats[out].fr_pull[1]);
+ return -1;
+ }
+ m_copydata(m, 0, up, hbuf);
+ ATOMIC_INCL(frstats[out].fr_pull[0]);
+ ip = (ip_t *)hbuf;
+# else /* __ sgi */
+# ifndef linux
+ if ((*mp = m_pullup(m, up)) == 0) {
+ ATOMIC_INCL(frstats[out].fr_pull[1]);
+ return -1;
+ } else {
+ ATOMIC_INCL(frstats[out].fr_pull[0]);
+ m = *mp;
+ ip = mtod(m, ip_t *);
+ }
+# endif /* !linux */
+# endif /* __sgi */
+ } else
+ up = 0;
+ } else
+ up = 0;
+# endif /* !defined(__SVR4) && !defined(__svr4__) */
+# if SOLARIS
+ mb_t *m = qif->qf_m;
+
+ if ((u_int)ip & 0x3)
+ return 2;
+ fin->fin_qfm = m;
+ fin->fin_qif = qif;
+# endif
+#endif /* _KERNEL */
+
+#ifndef __FreeBSD__
+ /*
+ * Be careful here: ip_id is in network byte order when called
+ * from ip_output()
+ */
+ if ((out) && (v == 4))
+ ip->ip_id = ntohs(ip->ip_id);
+#endif
+
+ changed = 0;
+ fin->fin_ifp = ifp;
+ fin->fin_v = v;
+ fin->fin_out = out;
+ fin->fin_mp = mp;
+ fr_makefrip(hlen, ip, fin);
+
+#ifdef _KERNEL
+# ifdef USE_INET6
+ if (v == 6) {
+ ATOMIC_INCL(frstats[0].fr_ipv6[out]);
+ if (((ip6_t *)ip)->ip6_hlim < fr_minttl) {
+ ATOMIC_INCL(frstats[0].fr_badttl);
+ if (fr_minttllog & 1)
+ logit = -3;
+ if (fr_minttllog & 2)
+ drop = 1;
+ }
+ } else
+# endif
+ if (!out) {
+ if (fr_chksrc && !fr_verifysrc(ip->ip_src, ifp)) {
+ ATOMIC_INCL(frstats[0].fr_badsrc);
+ if (fr_chksrc & 1)
+ drop = 1;
+ if (fr_chksrc & 2)
+ logit = -2;
+ } else if (ip->ip_ttl < fr_minttl) {
+ ATOMIC_INCL(frstats[0].fr_badttl);
+ if (fr_minttllog & 1)
+ logit = -3;
+ if (fr_minttllog & 2)
+ drop = 1;
+ }
+ }
+ if (drop) {
+# ifdef IPFILTER_LOG
+ if (logit) {
+ fin->fin_group = logit;
+ pass = FR_INQUE|FR_NOMATCH|FR_LOGB;
+ (void) IPLLOG(pass, ip, fin, m);
+ }
+# endif
+# if !SOLARIS
+ m_freem(m);
+# endif
+ return error;
+ }
+#endif
+ pass = fr_pass;
+ if (fin->fin_fl & FI_SHORT) {
+ ATOMIC_INCL(frstats[out].fr_short);
+ }
+
+ READ_ENTER(&ipf_mutex);
+
+ /*
+ * Check auth now. This, combined with the check below to see if apass
+ * is 0 is to ensure that we don't count the packet twice, which can
+ * otherwise occur when we reprocess it. As it is, we only count it
+ * after it has no auth. table matchup. This also stops NAT from
+ * occuring until after the packet has been auth'd.
+ */
+ apass = fr_checkauth(ip, fin);
+
+ if (!out) {
+#ifdef USE_INET6
+ if (v == 6)
+ list = ipacct6[0][fr_active];
+ else
+#endif
+ list = ipacct[0][fr_active];
+ changed = ip_natin(ip, fin);
+ if (!apass && (fin->fin_fr = list) &&
+ (fr_scanlist(FR_NOMATCH, ip, fin, m) & FR_ACCOUNT)) {
+ ATOMIC_INCL(frstats[0].fr_acct);
+ }
+ }
+
+ if (!apass) {
+ if ((fin->fin_fl & FI_FRAG) == FI_FRAG)
+ fr = ipfr_knownfrag(ip, fin);
+ if (!fr && !(fin->fin_fl & FI_SHORT))
+ fr = fr_checkstate(ip, fin);
+ if (fr != NULL)
+ pass = fr->fr_flags;
+ if (fr && (pass & FR_LOGFIRST))
+ pass &= ~(FR_LOGFIRST|FR_LOG);
+ }
+
+ if (apass || !fr) {
+ /*
+ * If a packet is found in the auth table, then skip checking
+ * the access lists for permission but we do need to consider
+ * the result as if it were from the ACL's.
+ */
+ if (!apass) {
+ fc = frcache + out;
+ if (!bcmp((char *)fin, (char *)fc, FI_CSIZE)) {
+ /*
+ * copy cached data so we can unlock the mutex
+ * earlier.
+ */
+ bcopy((char *)fc, (char *)fin, FI_COPYSIZE);
+ ATOMIC_INCL(frstats[out].fr_chit);
+ if ((fr = fin->fin_fr)) {
+ ATOMIC_INCL(fr->fr_hits);
+ pass = fr->fr_flags;
+ }
+ } else {
+#ifdef USE_INET6
+ if (v == 6)
+ list = ipfilter6[out][fr_active];
+ else
+#endif
+ list = ipfilter[out][fr_active];
+ if ((fin->fin_fr = list))
+ pass = fr_scanlist(fr_pass, ip, fin, m);
+ if (!(pass & (FR_KEEPSTATE|FR_DONTCACHE)))
+ bcopy((char *)fin, (char *)fc,
+ FI_COPYSIZE);
+ if (pass & FR_NOMATCH) {
+ ATOMIC_INCL(frstats[out].fr_nom);
+ fin->fin_fr = NULL;
+ }
+ }
+ } else
+ pass = apass;
+ fr = fin->fin_fr;
+
+ /*
+ * If we fail to add a packet to the authorization queue,
+ * then we drop the packet later. However, if it was added
+ * then pretend we've dropped it already.
+ */
+ if ((pass & FR_AUTH)) {
+ if (fr_newauth((mb_t *)m, fin, ip) != 0) {
+ m = *mp = NULL;
+ error = 0;
+ } else
+ error = ENOSPC;
+ }
+
+ if (pass & FR_PREAUTH) {
+ READ_ENTER(&ipf_auth);
+ if ((fin->fin_fr = ipauth) &&
+ (pass = fr_scanlist(0, ip, fin, m))) {
+ ATOMIC_INCL(fr_authstats.fas_hits);
+ } else {
+ ATOMIC_INCL(fr_authstats.fas_miss);
+ }
+ RWLOCK_EXIT(&ipf_auth);
+ }
+
+ fin->fin_fr = fr;
+ if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) {
+ if (fin->fin_fl & FI_FRAG) {
+ if (ipfr_newfrag(ip, fin) == -1) {
+ ATOMIC_INCL(frstats[out].fr_bnfr);
+ } else {
+ ATOMIC_INCL(frstats[out].fr_nfr);
+ }
+ } else {
+ ATOMIC_INCL(frstats[out].fr_cfr);
+ }
+ }
+ if (pass & FR_KEEPSTATE) {
+ if (fr_addstate(ip, fin, NULL, 0) == NULL) {
+ ATOMIC_INCL(frstats[out].fr_bads);
+ } else {
+ ATOMIC_INCL(frstats[out].fr_ads);
+ }
+ }
+ } else if (fr != NULL) {
+ pass = fr->fr_flags;
+ if (pass & FR_LOGFIRST)
+ pass &= ~(FR_LOGFIRST|FR_LOG);
+ }
+
+#if (BSD >= 199306) && (defined(_KERNEL) || defined(KERNEL))
+ if (securelevel <= 0)
+#endif
+ if (fr && fr->fr_func && !(pass & FR_CALLNOW))
+ pass = (*fr->fr_func)(pass, ip, fin);
+
+ /*
+ * Only count/translate packets which will be passed on, out the
+ * interface.
+ */
+ if (out && (pass & FR_PASS)) {
+#ifdef USE_INET6
+ if (v == 6)
+ list = ipacct6[1][fr_active];
+ else
+#endif
+ list = ipacct[1][fr_active];
+ if (list != NULL) {
+ u_32_t sg, sr;
+
+ fin->fin_fr = list;
+ sg = fin->fin_group;
+ sr = fin->fin_rule;
+ if (fr_scanlist(FR_NOMATCH, ip, fin, m) & FR_ACCOUNT) {
+ ATOMIC_INCL(frstats[1].fr_acct);
+ }
+ fin->fin_group = sg;
+ fin->fin_rule = sr;
+ fin->fin_fr = fr;
+ }
+ changed = ip_natout(ip, fin);
+ } else
+ fin->fin_fr = fr;
+ RWLOCK_EXIT(&ipf_mutex);
+
+#ifdef IPFILTER_LOG
+ if ((fr_flags & FF_LOGGING) || (pass & FR_LOGMASK)) {
+ if ((fr_flags & FF_LOGNOMATCH) && (pass & FR_NOMATCH)) {
+ pass |= FF_LOGNOMATCH;
+ ATOMIC_INCL(frstats[out].fr_npkl);
+ goto logit;
+ } else if (((pass & FR_LOGMASK) == FR_LOGP) ||
+ ((pass & FR_PASS) && (fr_flags & FF_LOGPASS))) {
+ if ((pass & FR_LOGMASK) != FR_LOGP)
+ pass |= FF_LOGPASS;
+ ATOMIC_INCL(frstats[out].fr_ppkl);
+ goto logit;
+ } else if (((pass & FR_LOGMASK) == FR_LOGB) ||
+ ((pass & FR_BLOCK) && (fr_flags & FF_LOGBLOCK))) {
+ if ((pass & FR_LOGMASK) != FR_LOGB)
+ pass |= FF_LOGBLOCK;
+ ATOMIC_INCL(frstats[out].fr_bpkl);
+logit:
+ if (!IPLLOG(pass, ip, fin, m)) {
+ ATOMIC_INCL(frstats[out].fr_skip);
+ if ((pass & (FR_PASS|FR_LOGORBLOCK)) ==
+ (FR_PASS|FR_LOGORBLOCK))
+ pass ^= FR_PASS|FR_BLOCK;
+ }
+ }
+ }
+#endif /* IPFILTER_LOG */
+
+#ifndef __FreeBSD__
+ if ((out) && (v == 4))
+ ip->ip_id = htons(ip->ip_id);
+#endif
+
+#ifdef _KERNEL
+ /*
+ * Only allow FR_DUP to work if a rule matched - it makes no sense to
+ * set FR_DUP as a "default" as there are no instructions about where
+ * to send the packet.
+ */
+ if (fr && (pass & FR_DUP))
+# if SOLARIS
+ mc = dupmsg(m);
+# else
+# if defined(__OpenBSD__) && (OpenBSD >= 199905)
+ mc = m_copym2(m, 0, M_COPYALL, M_DONTWAIT);
+# else
+ mc = m_copy(m, 0, M_COPYALL);
+# endif
+# endif
+#endif
+ if (pass & FR_PASS) {
+ ATOMIC_INCL(frstats[out].fr_pass);
+ } else if (pass & FR_BLOCK) {
+ ATOMIC_INCL(frstats[out].fr_block);
+ /*
+ * Should we return an ICMP packet to indicate error
+ * status passing through the packet filter ?
+ * WARNING: ICMP error packets AND TCP RST packets should
+ * ONLY be sent in repsonse to incoming packets. Sending them
+ * in response to outbound packets can result in a panic on
+ * some operating systems.
+ */
+ if (!out) {
+ if (changed == -1)
+ /*
+ * If a packet results in a NAT error, do not
+ * send a reset or ICMP error as it may disrupt
+ * an existing flow. This is the proxy saying
+ * the content is bad so just drop the packet
+ * silently.
+ */
+ ;
+ else if (pass & FR_RETICMP) {
+ int dst;
+
+ if ((pass & FR_RETMASK) == FR_FAKEICMP)
+ dst = 1;
+ else
+ dst = 0;
+ send_icmp_err(ip, ICMP_UNREACH, fin, dst);
+ ATOMIC_INCL(frstats[0].fr_ret);
+ } else if (((pass & FR_RETMASK) == FR_RETRST) &&
+ !(fin->fin_fl & FI_SHORT)) {
+ if (send_reset(ip, fin) == 0) {
+ ATOMIC_INCL(frstats[1].fr_ret);
+ }
+ }
+ } else {
+ if (pass & FR_RETRST)
+ error = ECONNRESET;
+ }
+ }
+
+ /*
+ * If we didn't drop off the bottom of the list of rules (and thus
+ * the 'current' rule fr is not NULL), then we may have some extra
+ * instructions about what to do with a packet.
+ * Once we're finished return to our caller, freeing the packet if
+ * we are dropping it (* BSD ONLY *).
+ */
+ if ((changed == -1) && (pass & FR_PASS)) {
+ pass &= ~FR_PASS;
+ pass |= FR_BLOCK;
+ }
+#if defined(_KERNEL)
+# if !SOLARIS
+# if !defined(linux)
+ if (fr) {
+ frdest_t *fdp = &fr->fr_tif;
+
+ if (((pass & FR_FASTROUTE) && !out) ||
+ (fdp->fd_ifp && fdp->fd_ifp != (struct ifnet *)-1)) {
+ (void) ipfr_fastroute(m, mp, fin, fdp);
+ m = *mp;
+ }
+
+ if (mc != NULL)
+ (void) ipfr_fastroute(mc, &mc, fin, &fr->fr_dif);
+ }
+
+ if (!(pass & FR_PASS) && m) {
+ m_freem(m);
+ m = *mp = NULL;
+ }
+# ifdef __sgi
+ else if (changed && up && m)
+ m_copyback(m, 0, up, hbuf);
+# endif
+# endif /* !linux */
+# else /* !SOLARIS */
+ if (fr) {
+ frdest_t *fdp = &fr->fr_tif;
+
+ if (((pass & FR_FASTROUTE) && !out) ||
+ (fdp->fd_ifp && fdp->fd_ifp != (struct ifnet *)-1))
+ (void) ipfr_fastroute(ip, m, mp, fin, fdp);
+
+ if (mc != NULL)
+ (void) ipfr_fastroute(ip, mc, &mc, fin, &fr->fr_dif);
+ }
+# endif /* !SOLARIS */
+ return (pass & FR_PASS) ? 0 : error;
+#else /* _KERNEL */
+ if (pass & FR_NOMATCH)
+ return 1;
+ if (pass & FR_PASS)
+ return 0;
+ if (pass & FR_AUTH)
+ return -2;
+ if ((pass & FR_RETMASK) == FR_RETRST)
+ return -3;
+ if ((pass & FR_RETMASK) == FR_RETICMP)
+ return -4;
+ if ((pass & FR_RETMASK) == FR_FAKEICMP)
+ return -5;
+ return -1;
+#endif /* _KERNEL */
+}
+
+
+/*
+ * ipf_cksum
+ * addr should be 16bit aligned and len is in bytes.
+ * length is in bytes
+ */
+u_short ipf_cksum(addr, len)
+register u_short *addr;
+register int len;
+{
+ register u_32_t sum = 0;
+
+ for (sum = 0; len > 1; len -= 2)
+ sum += *addr++;
+
+ /* mop up an odd byte, if necessary */
+ if (len == 1)
+ sum += *(u_char *)addr;
+
+ /*
+ * add back carry outs from top 16 bits to low 16 bits
+ */
+ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
+ sum += (sum >> 16); /* add carry */
+ return (u_short)(~sum);
+}
+
+
+/*
+ * NB: This function assumes we've pullup'd enough for all of the IP header
+ * and the TCP header. We also assume that data blocks aren't allocated in
+ * odd sizes.
+ */
+u_short fr_tcpsum(m, ip, tcp)
+mb_t *m;
+ip_t *ip;
+tcphdr_t *tcp;
+{
+ u_short *sp, slen, ts;
+ u_int sum, sum2;
+ int hlen;
+
+ /*
+ * Add up IP Header portion
+ */
+ hlen = ip->ip_hl << 2;
+ slen = ip->ip_len - hlen;
+ sum = htons((u_short)ip->ip_p);
+ sum += htons(slen);
+ sp = (u_short *)&ip->ip_src;
+ sum += *sp++; /* ip_src */
+ sum += *sp++;
+ sum += *sp++; /* ip_dst */
+ sum += *sp++;
+ ts = tcp->th_sum;
+ tcp->th_sum = 0;
+#ifdef KERNEL
+# if SOLARIS
+ sum2 = ip_cksum(m, hlen, sum); /* hlen == offset */
+ sum2 = (sum2 & 0xffff) + (sum2 >> 16);
+ sum2 = ~sum2 & 0xffff;
+# else /* SOLARIS */
+# if defined(BSD) || defined(sun)
+# if BSD >= 199306
+ m->m_data += hlen;
+# else
+ m->m_off += hlen;
+# endif
+ m->m_len -= hlen;
+ sum2 = in_cksum(m, slen);
+ m->m_len += hlen;
+# if BSD >= 199306
+ m->m_data -= hlen;
+# else
+ m->m_off -= hlen;
+# endif
+ /*
+ * Both sum and sum2 are partial sums, so combine them together.
+ */
+ sum = (sum & 0xffff) + (sum >> 16);
+ sum = ~sum & 0xffff;
+ sum2 += sum;
+ sum2 = (sum2 & 0xffff) + (sum2 >> 16);
+# else /* defined(BSD) || defined(sun) */
+{
+ union {
+ u_char c[2];
+ u_short s;
+ } bytes;
+ u_short len = ip->ip_len;
+# if defined(__sgi)
+ int add;
+# endif
+
+ /*
+ * Add up IP Header portion
+ */
+ sp = (u_short *)&ip->ip_src;
+ len -= (ip->ip_hl << 2);
+ sum = ntohs(IPPROTO_TCP);
+ sum += htons(len);
+ sum += *sp++; /* ip_src */
+ sum += *sp++;
+ sum += *sp++; /* ip_dst */
+ sum += *sp++;
+ if (sp != (u_short *)tcp)
+ sp = (u_short *)tcp;
+ sum += *sp++; /* sport */
+ sum += *sp++; /* dport */
+ sum += *sp++; /* seq */
+ sum += *sp++;
+ sum += *sp++; /* ack */
+ sum += *sp++;
+ sum += *sp++; /* off */
+ sum += *sp++; /* win */
+ sum += *sp++; /* Skip over checksum */
+ sum += *sp++; /* urp */
+
+# ifdef __sgi
+ /*
+ * In case we had to copy the IP & TCP header out of mbufs,
+ * skip over the mbuf bits which are the header
+ */
+ if ((caddr_t)ip != mtod(m, caddr_t)) {
+ hlen = (caddr_t)sp - (caddr_t)ip;
+ while (hlen) {
+ add = MIN(hlen, m->m_len);
+ sp = (u_short *)(mtod(m, caddr_t) + add);
+ hlen -= add;
+ if (add == m->m_len) {
+ m = m->m_next;
+ if (!hlen) {
+ if (!m)
+ break;
+ sp = mtod(m, u_short *);
+ }
+ PANIC((!m),("fr_tcpsum(1): not enough data"));
+ }
+ }
+ }
+# endif
+
+ if (!(len -= sizeof(*tcp)))
+ goto nodata;
+ while (len > 1) {
+ if (((caddr_t)sp - mtod(m, caddr_t)) >= m->m_len) {
+ m = m->m_next;
+ PANIC((!m),("fr_tcpsum(2): not enough data"));
+ sp = mtod(m, u_short *);
+ }
+ if (((caddr_t)(sp + 1) - mtod(m, caddr_t)) > m->m_len) {
+ bytes.c[0] = *(u_char *)sp;
+ m = m->m_next;
+ PANIC((!m),("fr_tcpsum(3): not enough data"));
+ sp = mtod(m, u_short *);
+ bytes.c[1] = *(u_char *)sp;
+ sum += bytes.s;
+ sp = (u_short *)((u_char *)sp + 1);
+ }
+ if ((u_long)sp & 1) {
+ bcopy((char *)sp++, (char *)&bytes.s, sizeof(bytes.s));
+ sum += bytes.s;
+ } else
+ sum += *sp++;
+ len -= 2;
+ }
+ if (len)
+ sum += ntohs(*(u_char *)sp << 8);
+nodata:
+ while (sum > 0xffff)
+ sum = (sum & 0xffff) + (sum >> 16);
+ sum2 = (u_short)(~sum & 0xffff);
+}
+# endif /* defined(BSD) || defined(sun) */
+# endif /* SOLARIS */
+#else /* KERNEL */
+ for (; slen > 1; slen -= 2)
+ sum += *sp++;
+ if (slen)
+ sum += ntohs(*(u_char *)sp << 8);
+ while (sum > 0xffff)
+ sum = (sum & 0xffff) + (sum >> 16);
+ sum2 = (u_short)(~sum & 0xffff);
+#endif /* KERNEL */
+ tcp->th_sum = ts;
+ return sum2;
+}
+
+
+#if defined(_KERNEL) && ( ((BSD < 199306) && !SOLARIS) || defined(__sgi) )
+/*
+ * Copyright (c) 1982, 1986, 1988, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
+ * $Id: fil.c,v 2.35.2.67 2002/12/06 13:28:05 darrenr Exp $
+ */
+/*
+ * Copy data from an mbuf chain starting "off" bytes from the beginning,
+ * continuing for "len" bytes, into the indicated buffer.
+ */
+void
+m_copydata(m, off, len, cp)
+ register mb_t *m;
+ register int off;
+ register int len;
+ caddr_t cp;
+{
+ register unsigned count;
+
+ if (off < 0 || len < 0)
+ panic("m_copydata");
+ while (off > 0) {
+ if (m == 0)
+ panic("m_copydata");
+ if (off < m->m_len)
+ break;
+ off -= m->m_len;
+ m = m->m_next;
+ }
+ while (len > 0) {
+ if (m == 0)
+ panic("m_copydata");
+ count = MIN(m->m_len - off, len);
+ bcopy(mtod(m, caddr_t) + off, cp, count);
+ len -= count;
+ cp += count;
+ off = 0;
+ m = m->m_next;
+ }
+}
+
+
+# ifndef linux
+/*
+ * Copy data from a buffer back into the indicated mbuf chain,
+ * starting "off" bytes from the beginning, extending the mbuf
+ * chain if necessary.
+ */
+void
+m_copyback(m0, off, len, cp)
+ struct mbuf *m0;
+ register int off;
+ register int len;
+ caddr_t cp;
+{
+ register int mlen;
+ register struct mbuf *m = m0, *n;
+ int totlen = 0;
+
+ if (m0 == 0)
+ return;
+ while (off > (mlen = m->m_len)) {
+ off -= mlen;
+ totlen += mlen;
+ if (m->m_next == 0) {
+ n = m_getclr(M_DONTWAIT, m->m_type);
+ if (n == 0)
+ goto out;
+ n->m_len = min(MLEN, len + off);
+ m->m_next = n;
+ }
+ m = m->m_next;
+ }
+ while (len > 0) {
+ mlen = min (m->m_len - off, len);
+ bcopy(cp, off + mtod(m, caddr_t), (unsigned)mlen);
+ cp += mlen;
+ len -= mlen;
+ mlen += off;
+ off = 0;
+ totlen += mlen;
+ if (len == 0)
+ break;
+ if (m->m_next == 0) {
+ n = m_get(M_DONTWAIT, m->m_type);
+ if (n == 0)
+ break;
+ n->m_len = min(MLEN, len);
+ m->m_next = n;
+ }
+ m = m->m_next;
+ }
+out:
+#if 0
+ if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen))
+ m->m_pkthdr.len = totlen;
+#endif
+ return;
+}
+# endif /* linux */
+#endif /* (_KERNEL) && ( ((BSD < 199306) && !SOLARIS) || __sgi) */
+
+
+frgroup_t *fr_findgroup(num, flags, which, set, fgpp)
+u_32_t num, flags;
+minor_t which;
+int set;
+frgroup_t ***fgpp;
+{
+ frgroup_t *fg, **fgp;
+
+ if (which == IPL_LOGAUTH)
+ fgp = &ipfgroups[2][set];
+ else if (flags & FR_ACCOUNT)
+ fgp = &ipfgroups[1][set];
+ else if (flags & (FR_OUTQUE|FR_INQUE))
+ fgp = &ipfgroups[0][set];
+ else
+ return NULL;
+
+ while ((fg = *fgp))
+ if (fg->fg_num == num)
+ break;
+ else
+ fgp = &fg->fg_next;
+ if (fgpp)
+ *fgpp = fgp;
+ return fg;
+}
+
+
+frgroup_t *fr_addgroup(num, fp, which, set)
+u_32_t num;
+frentry_t *fp;
+minor_t which;
+int set;
+{
+ frgroup_t *fg, **fgp;
+
+ if ((fg = fr_findgroup(num, fp->fr_flags, which, set, &fgp)))
+ return fg;
+
+ KMALLOC(fg, frgroup_t *);
+ if (fg) {
+ fg->fg_num = num;
+ fg->fg_next = *fgp;
+ fg->fg_head = fp;
+ fg->fg_start = &fp->fr_grp;
+ *fgp = fg;
+ }
+ return fg;
+}
+
+
+void fr_delgroup(num, flags, which, set)
+u_32_t num, flags;
+minor_t which;
+int set;
+{
+ frgroup_t *fg, **fgp;
+
+ if (!(fg = fr_findgroup(num, flags, which, set, &fgp)))
+ return;
+
+ *fgp = fg->fg_next;
+ KFREE(fg);
+}
+
+
+
+/*
+ * recursively flush rules from the list, descending groups as they are
+ * encountered. if a rule is the head of a group and it has lost all its
+ * group members, then also delete the group reference.
+ */
+static int frflushlist(set, unit, nfreedp, listp)
+int set;
+minor_t unit;
+int *nfreedp;
+frentry_t **listp;
+{
+ register int freed = 0, i;
+ register frentry_t *fp;
+
+ while ((fp = *listp)) {
+ *listp = fp->fr_next;
+ if (fp->fr_grp) {
+ i = frflushlist(set, unit, nfreedp, &fp->fr_grp);
+ MUTEX_ENTER(&ipf_rw);
+ fp->fr_ref -= i;
+ MUTEX_EXIT(&ipf_rw);
+ }
+
+ ATOMIC_DEC32(fp->fr_ref);
+ if (fp->fr_grhead) {
+ fr_delgroup(fp->fr_grhead, fp->fr_flags,
+ unit, set);
+ fp->fr_grhead = 0;
+ }
+ if (fp->fr_ref == 0) {
+ KFREE(fp);
+ freed++;
+ } else
+ fp->fr_next = NULL;
+ }
+ *nfreedp += freed;
+ return freed;
+}
+
+
+int frflush(unit, proto, flags)
+minor_t unit;
+int proto, flags;
+{
+ int flushed = 0, set;
+
+ if (unit != IPL_LOGIPF)
+ return 0;
+ WRITE_ENTER(&ipf_mutex);
+ bzero((char *)frcache, sizeof(frcache[0]) * 2);
+
+ set = fr_active;
+ if (flags & FR_INACTIVE)
+ set = 1 - set;
+
+ if (flags & FR_OUTQUE) {
+#ifdef USE_INET6
+ if (proto == 0 || proto == 6) {
+ (void) frflushlist(set, unit,
+ &flushed, &ipfilter6[1][set]);
+ (void) frflushlist(set, unit,
+ &flushed, &ipacct6[1][set]);
+ }
+#endif
+ if (proto == 0 || proto == 4) {
+ (void) frflushlist(set, unit,
+ &flushed, &ipfilter[1][set]);
+ (void) frflushlist(set, unit,
+ &flushed, &ipacct[1][set]);
+ }
+ }
+ if (flags & FR_INQUE) {
+#ifdef USE_INET6
+ if (proto == 0 || proto == 6) {
+ (void) frflushlist(set, unit,
+ &flushed, &ipfilter6[0][set]);
+ (void) frflushlist(set, unit,
+ &flushed, &ipacct6[0][set]);
+ }
+#endif
+ if (proto == 0 || proto == 4) {
+ (void) frflushlist(set, unit,
+ &flushed, &ipfilter[0][set]);
+ (void) frflushlist(set, unit,
+ &flushed, &ipacct[0][set]);
+ }
+ }
+ RWLOCK_EXIT(&ipf_mutex);
+ return flushed;
+}
+
+
+char *memstr(src, dst, slen, dlen)
+char *src, *dst;
+int slen, dlen;
+{
+ char *s = NULL;
+
+ while (dlen >= slen) {
+ if (bcmp(src, dst, slen) == 0) {
+ s = dst;
+ break;
+ }
+ dst++;
+ dlen--;
+ }
+ return s;
+}
+
+
+void fixskip(listp, rp, addremove)
+frentry_t **listp, *rp;
+int addremove;
+{
+ frentry_t *fp;
+ int rules = 0, rn = 0;
+
+ for (fp = *listp; fp && (fp != rp); fp = fp->fr_next, rules++)
+ ;
+
+ if (!fp)
+ return;
+
+ for (fp = *listp; fp && (fp != rp); fp = fp->fr_next, rn++)
+ if (fp->fr_skip && (rn + fp->fr_skip >= rules))
+ fp->fr_skip += addremove;
+}
+
+
+#ifdef _KERNEL
+/*
+ * count consecutive 1's in bit mask. If the mask generated by counting
+ * consecutive 1's is different to that passed, return -1, else return #
+ * of bits.
+ */
+int countbits(ip)
+u_32_t ip;
+{
+ u_32_t ipn;
+ int cnt = 0, i, j;
+
+ ip = ipn = ntohl(ip);
+ for (i = 32; i; i--, ipn *= 2)
+ if (ipn & 0x80000000)
+ cnt++;
+ else
+ break;
+ ipn = 0;
+ for (i = 32, j = cnt; i; i--, j--) {
+ ipn *= 2;
+ if (j > 0)
+ ipn++;
+ }
+ if (ipn == ip)
+ return cnt;
+ return -1;
+}
+
+
+/*
+ * return the first IP Address associated with an interface
+ */
+int fr_ifpaddr(v, ifptr, inp)
+int v;
+void *ifptr;
+struct in_addr *inp;
+{
+# ifdef USE_INET6
+ struct in6_addr *inp6 = NULL;
+# endif
+# if SOLARIS
+ ill_t *ill = ifptr;
+# else
+ struct ifnet *ifp = ifptr;
+# endif
+ struct in_addr in;
+
+# if SOLARIS
+# ifdef USE_INET6
+ if (v == 6) {
+ struct in6_addr in6;
+
+ /*
+ * First is always link local.
+ */
+ if (ill->ill_ipif->ipif_next)
+ in6 = ill->ill_ipif->ipif_next->ipif_v6lcl_addr;
+ else
+ bzero((char *)&in6, sizeof(in6));
+ bcopy((char *)&in6, (char *)inp, sizeof(in6));
+ } else
+# endif
+ {
+ in.s_addr = ill->ill_ipif->ipif_local_addr;
+ *inp = in;
+ }
+# else /* SOLARIS */
+# if linux
+ ;
+# else /* linux */
+ struct sockaddr_in *sin;
+ struct ifaddr *ifa;
+
+# if (__FreeBSD_version >= 300000)
+ ifa = TAILQ_FIRST(&ifp->if_addrhead);
+# else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ ifa = ifp->if_addrlist.tqh_first;
+# else
+# if defined(__sgi) && defined(IFF_DRVRLOCK) /* IRIX 6 */
+ ifa = &((struct in_ifaddr *)ifp->in_ifaddr)->ia_ifa;
+# else
+ ifa = ifp->if_addrlist;
+# endif
+# endif /* __NetBSD__ || __OpenBSD__ */
+# endif /* __FreeBSD_version >= 300000 */
+# if (BSD < 199306) && !(/*IRIX6*/defined(__sgi) && defined(IFF_DRVRLOCK))
+ sin = (struct sockaddr_in *)&ifa->ifa_addr;
+# else
+ sin = (struct sockaddr_in *)ifa->ifa_addr;
+ while (sin && ifa) {
+ if ((v == 4) && (sin->sin_family == AF_INET))
+ break;
+# ifdef USE_INET6
+ if ((v == 6) && (sin->sin_family == AF_INET6)) {
+ inp6 = &((struct sockaddr_in6 *)sin)->sin6_addr;
+ if (!IN6_IS_ADDR_LINKLOCAL(inp6) &&
+ !IN6_IS_ADDR_LOOPBACK(inp6))
+ break;
+ }
+# endif
+# if (__FreeBSD_version >= 300000)
+ ifa = TAILQ_NEXT(ifa, ifa_link);
+# else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ ifa = ifa->ifa_list.tqe_next;
+# else
+ ifa = ifa->ifa_next;
+# endif
+# endif /* __FreeBSD_version >= 300000 */
+ if (ifa)
+ sin = (struct sockaddr_in *)ifa->ifa_addr;
+ }
+ if (ifa == NULL)
+ sin = NULL;
+ if (sin == NULL)
+ return -1;
+# endif /* (BSD < 199306) && (!__sgi && IFF_DRVLOCK) */
+# ifdef USE_INET6
+ if (v == 6)
+ bcopy((char *)inp6, (char *)inp, sizeof(*inp6));
+ else
+# endif
+ {
+ in = sin->sin_addr;
+ *inp = in;
+ }
+# endif /* linux */
+# endif /* SOLARIS */
+ return 0;
+}
+
+
+static void frsynclist(fr)
+register frentry_t *fr;
+{
+ for (; fr; fr = fr->fr_next) {
+ if (fr->fr_ifa != NULL) {
+ fr->fr_ifa = GETUNIT(fr->fr_ifname, fr->fr_ip.fi_v);
+ if (fr->fr_ifa == NULL)
+ fr->fr_ifa = (void *)-1;
+ }
+ if (fr->fr_grp)
+ frsynclist(fr->fr_grp);
+ }
+}
+
+
+void frsync()
+{
+# if !SOLARIS
+ register struct ifnet *ifp;
+
+# if defined(__OpenBSD__) || ((NetBSD >= 199511) && (NetBSD < 1991011)) || \
+ (defined(__FreeBSD_version) && (__FreeBSD_version >= 300000))
+# if (NetBSD >= 199905) || defined(__OpenBSD__)
+ for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next)
+# elif defined(__FreeBSD_version) && (__FreeBSD_version >= 500043)
+ IFNET_RLOCK();
+ TAILQ_FOREACH(ifp, &ifnet, if_link)
+# else
+ for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next)
+# endif
+# else
+ for (ifp = ifnet; ifp; ifp = ifp->if_next)
+# endif
+ {
+ ip_natsync(ifp);
+ ip_statesync(ifp);
+ }
+# if defined(__FreeBSD_version) && (__FreeBSD_version >= 500043)
+ IFNET_RUNLOCK();
+# endif
+ ip_natsync((struct ifnet *)-1);
+# endif /* !SOLARIS */
+
+ WRITE_ENTER(&ipf_mutex);
+ frsynclist(ipacct[0][fr_active]);
+ frsynclist(ipacct[1][fr_active]);
+ frsynclist(ipfilter[0][fr_active]);
+ frsynclist(ipfilter[1][fr_active]);
+#ifdef USE_INET6
+ frsynclist(ipacct6[0][fr_active]);
+ frsynclist(ipacct6[1][fr_active]);
+ frsynclist(ipfilter6[0][fr_active]);
+ frsynclist(ipfilter6[1][fr_active]);
+#endif
+ RWLOCK_EXIT(&ipf_mutex);
+}
+
+
+/*
+ * In the functions below, bcopy() is called because the pointer being
+ * copied _from_ in this instance is a pointer to a char buf (which could
+ * end up being unaligned) and on the kernel's local stack.
+ */
+int ircopyptr(a, b, c)
+void *a, *b;
+size_t c;
+{
+ caddr_t ca;
+ int err;
+
+#if SOLARIS
+ if (copyin(a, (char *)&ca, sizeof(ca)))
+ return EFAULT;
+#else
+ bcopy(a, &ca, sizeof(ca));
+#endif
+ err = copyin(ca, b, c);
+ if (err)
+ err = EFAULT;
+ return err;
+}
+
+
+int iwcopyptr(a, b, c)
+void *a, *b;
+size_t c;
+{
+ caddr_t ca;
+ int err;
+
+#if SOLARIS
+ if (copyin(b, (char *)&ca, sizeof(ca)))
+ return EFAULT;
+#else
+ bcopy(b, &ca, sizeof(ca));
+#endif
+ err = copyout(a, ca, c);
+ if (err)
+ err = EFAULT;
+ return err;
+}
+
+#else /* _KERNEL */
+
+
+/*
+ * return the first IP Address associated with an interface
+ */
+int fr_ifpaddr(v, ifptr, inp)
+int v;
+void *ifptr;
+struct in_addr *inp;
+{
+ return 0;
+}
+
+
+int ircopyptr(a, b, c)
+void *a, *b;
+size_t c;
+{
+ caddr_t ca;
+
+ bcopy(a, &ca, sizeof(ca));
+ bcopy(ca, b, c);
+ return 0;
+}
+
+
+int iwcopyptr(a, b, c)
+void *a, *b;
+size_t c;
+{
+ caddr_t ca;
+
+ bcopy(b, &ca, sizeof(ca));
+ bcopy(a, ca, c);
+ return 0;
+}
+
+
+#endif
+
+
+int fr_lock(data, lockp)
+caddr_t data;
+int *lockp;
+{
+ int arg, error;
+
+ error = IRCOPY(data, (caddr_t)&arg, sizeof(arg));
+ if (!error) {
+ error = IWCOPY((caddr_t)lockp, data, sizeof(*lockp));
+ if (!error)
+ *lockp = arg;
+ }
+ return error;
+}
+
+
+void fr_getstat(fiop)
+friostat_t *fiop;
+{
+ bcopy((char *)frstats, (char *)fiop->f_st, sizeof(filterstats_t) * 2);
+ fiop->f_locks[0] = fr_state_lock;
+ fiop->f_locks[1] = fr_nat_lock;
+ fiop->f_locks[2] = fr_frag_lock;
+ fiop->f_locks[3] = fr_auth_lock;
+ fiop->f_fin[0] = ipfilter[0][0];
+ fiop->f_fin[1] = ipfilter[0][1];
+ fiop->f_fout[0] = ipfilter[1][0];
+ fiop->f_fout[1] = ipfilter[1][1];
+ fiop->f_acctin[0] = ipacct[0][0];
+ fiop->f_acctin[1] = ipacct[0][1];
+ fiop->f_acctout[0] = ipacct[1][0];
+ fiop->f_acctout[1] = ipacct[1][1];
+#ifdef USE_INET6
+ fiop->f_fin6[0] = ipfilter6[0][0];
+ fiop->f_fin6[1] = ipfilter6[0][1];
+ fiop->f_fout6[0] = ipfilter6[1][0];
+ fiop->f_fout6[1] = ipfilter6[1][1];
+ fiop->f_acctin6[0] = ipacct6[0][0];
+ fiop->f_acctin6[1] = ipacct6[0][1];
+ fiop->f_acctout6[0] = ipacct6[1][0];
+ fiop->f_acctout6[1] = ipacct6[1][1];
+#else
+ fiop->f_fin6[0] = NULL;
+ fiop->f_fin6[1] = NULL;
+ fiop->f_fout6[0] = NULL;
+ fiop->f_fout6[1] = NULL;
+ fiop->f_acctin6[0] = NULL;
+ fiop->f_acctin6[1] = NULL;
+ fiop->f_acctout6[0] = NULL;
+ fiop->f_acctout6[1] = NULL;
+#endif
+ fiop->f_active = fr_active;
+ fiop->f_froute[0] = ipl_frouteok[0];
+ fiop->f_froute[1] = ipl_frouteok[1];
+
+ fiop->f_running = fr_running;
+ fiop->f_groups[0][0] = ipfgroups[0][0];
+ fiop->f_groups[0][1] = ipfgroups[0][1];
+ fiop->f_groups[1][0] = ipfgroups[1][0];
+ fiop->f_groups[1][1] = ipfgroups[1][1];
+ fiop->f_groups[2][0] = ipfgroups[2][0];
+ fiop->f_groups[2][1] = ipfgroups[2][1];
+#ifdef IPFILTER_LOG
+ fiop->f_logging = 1;
+#else
+ fiop->f_logging = 0;
+#endif
+ fiop->f_defpass = fr_pass;
+ strncpy(fiop->f_version, ipfilter_version, sizeof(fiop->f_version));
+}
+
+
+#ifdef USE_INET6
+int icmptoicmp6types[ICMP_MAXTYPE+1] = {
+ ICMP6_ECHO_REPLY, /* 0: ICMP_ECHOREPLY */
+ -1, /* 1: UNUSED */
+ -1, /* 2: UNUSED */
+ ICMP6_DST_UNREACH, /* 3: ICMP_UNREACH */
+ -1, /* 4: ICMP_SOURCEQUENCH */
+ ND_REDIRECT, /* 5: ICMP_REDIRECT */
+ -1, /* 6: UNUSED */
+ -1, /* 7: UNUSED */
+ ICMP6_ECHO_REQUEST, /* 8: ICMP_ECHO */
+ -1, /* 9: UNUSED */
+ -1, /* 10: UNUSED */
+ ICMP6_TIME_EXCEEDED, /* 11: ICMP_TIMXCEED */
+ ICMP6_PARAM_PROB, /* 12: ICMP_PARAMPROB */
+ -1, /* 13: ICMP_TSTAMP */
+ -1, /* 14: ICMP_TSTAMPREPLY */
+ -1, /* 15: ICMP_IREQ */
+ -1, /* 16: ICMP_IREQREPLY */
+ -1, /* 17: ICMP_MASKREQ */
+ -1, /* 18: ICMP_MASKREPLY */
+};
+
+
+int icmptoicmp6unreach[ICMP_MAX_UNREACH] = {
+ ICMP6_DST_UNREACH_ADDR, /* 0: ICMP_UNREACH_NET */
+ ICMP6_DST_UNREACH_ADDR, /* 1: ICMP_UNREACH_HOST */
+ -1, /* 2: ICMP_UNREACH_PROTOCOL */
+ ICMP6_DST_UNREACH_NOPORT, /* 3: ICMP_UNREACH_PORT */
+ -1, /* 4: ICMP_UNREACH_NEEDFRAG */
+ ICMP6_DST_UNREACH_NOTNEIGHBOR, /* 5: ICMP_UNREACH_SRCFAIL */
+ ICMP6_DST_UNREACH_ADDR, /* 6: ICMP_UNREACH_NET_UNKNOWN */
+ ICMP6_DST_UNREACH_ADDR, /* 7: ICMP_UNREACH_HOST_UNKNOWN */
+ -1, /* 8: ICMP_UNREACH_ISOLATED */
+ ICMP6_DST_UNREACH_ADMIN, /* 9: ICMP_UNREACH_NET_PROHIB */
+ ICMP6_DST_UNREACH_ADMIN, /* 10: ICMP_UNREACH_HOST_PROHIB */
+ -1, /* 11: ICMP_UNREACH_TOSNET */
+ -1, /* 12: ICMP_UNREACH_TOSHOST */
+ ICMP6_DST_UNREACH_ADMIN, /* 13: ICMP_UNREACH_ADMIN_PROHIBIT */
+};
+#endif
+
+
+#ifndef _KERNEL
+int mbuflen(buf)
+mb_t *buf;
+{
+ ip_t *ip;
+
+ ip = (ip_t *)buf;
+ return ip->ip_len;
+}
+#endif
diff --git a/sys/contrib/ipfilter/netinet/ip_auth.c b/sys/contrib/ipfilter/netinet/ip_auth.c
new file mode 100644
index 0000000..800f392
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_auth.c
@@ -0,0 +1,657 @@
+/*
+ * Copyright (C) 1998-2001 by Darren Reed & Guido van Rooij.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#if !defined(_KERNEL) && !defined(KERNEL)
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000)
+# include <sys/filio.h>
+# include <sys/fcntl.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+#if (defined(_KERNEL) || defined(KERNEL)) && !defined(linux)
+# include <sys/systm.h>
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/filio.h>
+# include <sys/byteorder.h>
+# ifdef _KERNEL
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+# include <sys/kmem.h>
+#endif
+#if (_BSDI_VERSION >= 199802) || (__FreeBSD_version >= 400000)
+# include <sys/queue.h>
+#endif
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(bsdi)
+# include <machine/cpu.h>
+#endif
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifndef KERNEL
+# define KERNEL
+# define NOT_KERNEL
+#endif
+#ifndef linux
+# include <netinet/ip_var.h>
+#endif
+#ifdef NOT_KERNEL
+# undef KERNEL
+#endif
+#ifdef __sgi
+# ifdef IFF_DRVRLOCK /* IRIX6 */
+# include <sys/hashing.h>
+# endif
+#endif
+#include <netinet/tcp.h>
+#if defined(__sgi) && !defined(IFF_DRVRLOCK) /* IRIX < 6 */
+extern struct ifqueue ipintrq; /* ip packet input queue */
+#else
+# ifndef linux
+# if __FreeBSD_version >= 300000
+# include <net/if_var.h>
+# endif
+# include <netinet/in_var.h>
+# include <netinet/tcp_fsm.h>
+# endif
+#endif
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_auth.h"
+#if !SOLARIS && !defined(linux)
+# include <net/netisr.h>
+# ifdef __FreeBSD__
+# include <machine/cpufunc.h>
+# endif
+#endif
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+# if (defined(_KERNEL) || defined(KERNEL)) && !defined(IPFILTER_LKM)
+# include <sys/libkern.h>
+# include <sys/systm.h>
+# endif
+#endif
+
+#if !defined(lint)
+/* static const char rcsid[] = "@(#)$Id: ip_auth.c,v 2.11.2.12 2001/07/18 14:57:08 darrenr Exp $"; */
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+extern KRWLOCK_T ipf_auth, ipf_mutex;
+extern kmutex_t ipf_authmx;
+# if SOLARIS
+extern kcondvar_t ipfauthwait;
+# endif
+#endif
+#ifdef linux
+static struct wait_queue *ipfauthwait = NULL;
+#endif
+
+int fr_authsize = FR_NUMAUTH;
+int fr_authused = 0;
+int fr_defaultauthage = 600;
+int fr_auth_lock = 0;
+fr_authstat_t fr_authstats;
+static frauth_t fr_auth[FR_NUMAUTH];
+mb_t *fr_authpkts[FR_NUMAUTH];
+static int fr_authstart = 0, fr_authend = 0, fr_authnext = 0;
+static frauthent_t *fae_list = NULL;
+frentry_t *ipauth = NULL,
+ *fr_authlist = NULL;
+
+
+/*
+ * Check if a packet has authorization. If the packet is found to match an
+ * authorization result and that would result in a feedback loop (i.e. it
+ * will end up returning FR_AUTH) then return FR_BLOCK instead.
+ */
+u_32_t fr_checkauth(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ u_short id = ip->ip_id;
+ frentry_t *fr;
+ frauth_t *fra;
+ u_32_t pass;
+ int i;
+
+ if (fr_auth_lock || !fr_authused)
+ return 0;
+
+ READ_ENTER(&ipf_auth);
+ for (i = fr_authstart; i != fr_authend; ) {
+ /*
+ * index becomes -2 only after an SIOCAUTHW. Check this in
+ * case the same packet gets sent again and it hasn't yet been
+ * auth'd.
+ */
+ fra = fr_auth + i;
+ if ((fra->fra_index == -2) && (id == fra->fra_info.fin_id) &&
+ !bcmp((char *)fin, (char *)&fra->fra_info, FI_CSIZE)) {
+ /*
+ * Avoid feedback loop.
+ */
+ if (!(pass = fra->fra_pass) || (pass & FR_AUTH))
+ pass = FR_BLOCK;
+ /*
+ * Create a dummy rule for the stateful checking to
+ * use and return. Zero out any values we don't
+ * trust from userland!
+ */
+ if ((pass & FR_KEEPSTATE) || ((pass & FR_KEEPFRAG) &&
+ (fin->fin_fi.fi_fl & FI_FRAG))) {
+ KMALLOC(fr, frentry_t *);
+ if (fr) {
+ bcopy((char *)fra->fra_info.fin_fr,
+ fr, sizeof(*fr));
+ fr->fr_grp = NULL;
+ fr->fr_ifa = fin->fin_ifp;
+ fr->fr_func = NULL;
+ fr->fr_ref = 1;
+ fr->fr_flags = pass;
+#if BSD >= 199306
+ fr->fr_oifa = NULL;
+#endif
+ }
+ } else
+ fr = fra->fra_info.fin_fr;
+ fin->fin_fr = fr;
+ RWLOCK_EXIT(&ipf_auth);
+ WRITE_ENTER(&ipf_auth);
+ if (fr && fr != fra->fra_info.fin_fr) {
+ fr->fr_next = fr_authlist;
+ fr_authlist = fr;
+ }
+ fr_authstats.fas_hits++;
+ fra->fra_index = -1;
+ fr_authused--;
+ if (i == fr_authstart) {
+ while (fra->fra_index == -1) {
+ i++;
+ fra++;
+ if (i == FR_NUMAUTH) {
+ i = 0;
+ fra = fr_auth;
+ }
+ fr_authstart = i;
+ if (i == fr_authend)
+ break;
+ }
+ if (fr_authstart == fr_authend) {
+ fr_authnext = 0;
+ fr_authstart = fr_authend = 0;
+ }
+ }
+ RWLOCK_EXIT(&ipf_auth);
+ return pass;
+ }
+ i++;
+ if (i == FR_NUMAUTH)
+ i = 0;
+ }
+ fr_authstats.fas_miss++;
+ RWLOCK_EXIT(&ipf_auth);
+ return 0;
+}
+
+
+/*
+ * Check if we have room in the auth array to hold details for another packet.
+ * If we do, store it and wake up any user programs which are waiting to
+ * hear about these events.
+ */
+int fr_newauth(m, fin, ip)
+mb_t *m;
+fr_info_t *fin;
+ip_t *ip;
+{
+#if defined(_KERNEL) && SOLARIS
+ qif_t *qif = fin->fin_qif;
+#endif
+ frauth_t *fra;
+ int i;
+
+ if (fr_auth_lock)
+ return 0;
+
+ WRITE_ENTER(&ipf_auth);
+ if (fr_authstart > fr_authend) {
+ fr_authstats.fas_nospace++;
+ RWLOCK_EXIT(&ipf_auth);
+ return 0;
+ } else {
+ if (fr_authused == FR_NUMAUTH) {
+ fr_authstats.fas_nospace++;
+ RWLOCK_EXIT(&ipf_auth);
+ return 0;
+ }
+ }
+
+ fr_authstats.fas_added++;
+ fr_authused++;
+ i = fr_authend++;
+ if (fr_authend == FR_NUMAUTH)
+ fr_authend = 0;
+ RWLOCK_EXIT(&ipf_auth);
+ fra = fr_auth + i;
+ fra->fra_index = i;
+ fra->fra_pass = 0;
+ fra->fra_age = fr_defaultauthage;
+ bcopy((char *)fin, (char *)&fra->fra_info, sizeof(*fin));
+#if SOLARIS && defined(_KERNEL)
+# if !defined(sparc)
+ /*
+ * No need to copyback here as we want to undo the changes, not keep
+ * them.
+ */
+ if ((ip == (ip_t *)m->b_rptr) && (ip->ip_v == 4))
+ {
+ register u_short bo;
+
+ bo = ip->ip_len;
+ ip->ip_len = htons(bo);
+# if !SOLARIS && !defined(__NetBSD__) && !defined(__FreeBSD__)
+ /* 4.4BSD converts this ip_input.c, but I don't in solaris.c */
+ bo = ip->ip_id;
+ ip->ip_id = htons(bo);
+# endif
+ bo = ip->ip_off;
+ ip->ip_off = htons(bo);
+ }
+# endif
+ m->b_rptr -= qif->qf_off;
+ fr_authpkts[i] = *(mblk_t **)fin->fin_mp;
+ fra->fra_q = qif->qf_q;
+ cv_signal(&ipfauthwait);
+#else
+# if defined(BSD) && !defined(sparc) && (BSD >= 199306)
+ if (fin->fin_out == 0) {
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
+ }
+# endif
+ fr_authpkts[i] = m;
+ WAKEUP(&fr_authnext);
+#endif
+ return 1;
+}
+
+
+int fr_auth_ioctl(data, mode, cmd)
+caddr_t data;
+int mode;
+#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003)
+u_long cmd;
+#else
+int cmd;
+#endif
+{
+ mb_t *m;
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+ frauth_t auth, *au = &auth, *fra;
+ int i, error = 0;
+
+ switch (cmd)
+ {
+ case SIOCSTLCK :
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ break;
+ }
+ error = fr_lock(data, &fr_auth_lock);
+ break;
+ case SIOCINIFR :
+ case SIOCRMIFR :
+ case SIOCADIFR :
+ error = EINVAL;
+ break;
+ case SIOCINAFR :
+ error = EINVAL;
+ break;
+ case SIOCRMAFR :
+ case SIOCADAFR :
+ /* These commands go via request to fr_preauthcmd */
+ error = EINVAL;
+ break;
+ case SIOCATHST:
+ fr_authstats.fas_faelist = fae_list;
+ error = IWCOPYPTR((char *)&fr_authstats, data,
+ sizeof(fr_authstats));
+ break;
+ case SIOCAUTHW:
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ break;
+ }
+fr_authioctlloop:
+ READ_ENTER(&ipf_auth);
+ if ((fr_authnext != fr_authend) && fr_authpkts[fr_authnext]) {
+ error = IWCOPYPTR((char *)&fr_auth[fr_authnext], data,
+ sizeof(frauth_t));
+ RWLOCK_EXIT(&ipf_auth);
+ if (error)
+ break;
+ WRITE_ENTER(&ipf_auth);
+ SPL_NET(s);
+ fr_authnext++;
+ if (fr_authnext == FR_NUMAUTH)
+ fr_authnext = 0;
+ SPL_X(s);
+ RWLOCK_EXIT(&ipf_auth);
+ return 0;
+ }
+ RWLOCK_EXIT(&ipf_auth);
+#ifdef _KERNEL
+# if SOLARIS
+ mutex_enter(&ipf_authmx);
+ if (!cv_wait_sig(&ipfauthwait, &ipf_authmx)) {
+ mutex_exit(&ipf_authmx);
+ return EINTR;
+ }
+ mutex_exit(&ipf_authmx);
+# else
+ error = SLEEP(&fr_authnext, "fr_authnext");
+# endif
+#endif
+ if (!error)
+ goto fr_authioctlloop;
+ break;
+ case SIOCAUTHR:
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ break;
+ }
+ error = IRCOPYPTR(data, (caddr_t)&auth, sizeof(auth));
+ if (error)
+ return error;
+ WRITE_ENTER(&ipf_auth);
+ SPL_NET(s);
+ i = au->fra_index;
+ fra = fr_auth + i;
+ if ((i < 0) || (i > FR_NUMAUTH) ||
+ (fra->fra_info.fin_id != au->fra_info.fin_id)) {
+ SPL_X(s);
+ RWLOCK_EXIT(&ipf_auth);
+ return EINVAL;
+ }
+ m = fr_authpkts[i];
+ fra->fra_index = -2;
+ fra->fra_pass = au->fra_pass;
+ fr_authpkts[i] = NULL;
+ RWLOCK_EXIT(&ipf_auth);
+#ifdef _KERNEL
+ if (m && au->fra_info.fin_out) {
+# if SOLARIS
+ error = (fr_qout(fra->fra_q, m) == 0) ? EINVAL : 0;
+# else /* SOLARIS */
+ struct route ro;
+
+ bzero((char *)&ro, sizeof(ro));
+# if ((_BSDI_VERSION >= 199802) && (_BSDI_VERSION < 200005)) || \
+ defined(__OpenBSD__) || (defined(IRIX) && (IRIX >= 605)) || \
+ (__FreeBSD_version >= 500042)
+ error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL,
+ NULL);
+# else
+ error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL);
+# endif
+ if (ro.ro_rt) {
+ RTFREE(ro.ro_rt);
+ }
+# endif /* SOLARIS */
+ if (error)
+ fr_authstats.fas_sendfail++;
+ else
+ fr_authstats.fas_sendok++;
+ } else if (m) {
+# if SOLARIS
+ error = (fr_qin(fra->fra_q, m) == 0) ? EINVAL : 0;
+# else /* SOLARIS */
+ if (! netisr_queue(NETISR_IP, m))
+ error = ENOBUFS;
+# endif /* SOLARIS */
+ if (error)
+ fr_authstats.fas_quefail++;
+ else
+ fr_authstats.fas_queok++;
+ } else
+ error = EINVAL;
+# if SOLARIS
+ if (error)
+ error = EINVAL;
+# else
+ /*
+ * If we experience an error which will result in the packet
+ * not being processed, make sure we advance to the next one.
+ */
+ if (error == ENOBUFS) {
+ fr_authused--;
+ fra->fra_index = -1;
+ fra->fra_pass = 0;
+ if (i == fr_authstart) {
+ while (fra->fra_index == -1) {
+ i++;
+ if (i == FR_NUMAUTH)
+ i = 0;
+ fr_authstart = i;
+ if (i == fr_authend)
+ break;
+ }
+ if (fr_authstart == fr_authend) {
+ fr_authnext = 0;
+ fr_authstart = fr_authend = 0;
+ }
+ }
+ }
+# endif
+#endif /* _KERNEL */
+ SPL_X(s);
+ break;
+ default :
+ error = EINVAL;
+ break;
+ }
+ return error;
+}
+
+
+/*
+ * Free all network buffer memory used to keep saved packets.
+ */
+void fr_authunload()
+{
+ register int i;
+ register frauthent_t *fae, **faep;
+ frentry_t *fr, **frp;
+ mb_t *m;
+
+ WRITE_ENTER(&ipf_auth);
+ for (i = 0; i < FR_NUMAUTH; i++) {
+ if ((m = fr_authpkts[i])) {
+ FREE_MB_T(m);
+ fr_authpkts[i] = NULL;
+ fr_auth[i].fra_index = -1;
+ }
+ }
+
+
+ for (faep = &fae_list; (fae = *faep); ) {
+ *faep = fae->fae_next;
+ KFREE(fae);
+ }
+ ipauth = NULL;
+ RWLOCK_EXIT(&ipf_auth);
+
+ if (fr_authlist) {
+ /*
+ * We *MuST* reget ipf_auth because otherwise we won't get the
+ * locks in the right order and risk deadlock.
+ * We need ipf_mutex here to prevent a rule from using it
+ * inside fr_check().
+ */
+ WRITE_ENTER(&ipf_mutex);
+ WRITE_ENTER(&ipf_auth);
+ for (frp = &fr_authlist; (fr = *frp); ) {
+ if (fr->fr_ref == 1) {
+ *frp = fr->fr_next;
+ KFREE(fr);
+ } else
+ frp = &fr->fr_next;
+ }
+ RWLOCK_EXIT(&ipf_auth);
+ RWLOCK_EXIT(&ipf_mutex);
+ }
+}
+
+
+/*
+ * Slowly expire held auth records. Timeouts are set
+ * in expectation of this being called twice per second.
+ */
+void fr_authexpire()
+{
+ register int i;
+ register frauth_t *fra;
+ register frauthent_t *fae, **faep;
+ register frentry_t *fr, **frp;
+ mb_t *m;
+#if !SOLARIS && defined(_KERNEL)
+ int s;
+#endif
+
+ if (fr_auth_lock)
+ return;
+
+ SPL_NET(s);
+ WRITE_ENTER(&ipf_auth);
+ for (i = 0, fra = fr_auth; i < FR_NUMAUTH; i++, fra++) {
+ if ((!--fra->fra_age) && (m = fr_authpkts[i])) {
+ FREE_MB_T(m);
+ fr_authpkts[i] = NULL;
+ fr_auth[i].fra_index = -1;
+ fr_authstats.fas_expire++;
+ fr_authused--;
+ }
+ }
+
+ for (faep = &fae_list; (fae = *faep); ) {
+ if (!--fae->fae_age) {
+ *faep = fae->fae_next;
+ KFREE(fae);
+ fr_authstats.fas_expire++;
+ } else
+ faep = &fae->fae_next;
+ }
+ if (fae_list != NULL)
+ ipauth = &fae_list->fae_fr;
+ else
+ ipauth = NULL;
+
+ for (frp = &fr_authlist; (fr = *frp); ) {
+ if (fr->fr_ref == 1) {
+ *frp = fr->fr_next;
+ KFREE(fr);
+ } else
+ frp = &fr->fr_next;
+ }
+ RWLOCK_EXIT(&ipf_auth);
+ SPL_X(s);
+}
+
+int fr_preauthcmd(cmd, fr, frptr)
+#if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)
+u_long cmd;
+#else
+int cmd;
+#endif
+frentry_t *fr, **frptr;
+{
+ frauthent_t *fae, **faep;
+ int error = 0;
+#if defined(KERNEL) && !SOLARIS
+ int s;
+#endif
+
+ if ((cmd != SIOCADAFR) && (cmd != SIOCRMAFR)) {
+ /* Should not happen */
+ printf("fr_preauthcmd called with bad cmd 0x%lx", (u_long)cmd);
+ return EIO;
+ }
+
+ for (faep = &fae_list; (fae = *faep); )
+ if (&fae->fae_fr == fr)
+ break;
+ else
+ faep = &fae->fae_next;
+ if (cmd == SIOCRMAFR) {
+ if (!fr || !frptr)
+ error = EINVAL;
+ else if (!fae)
+ error = ESRCH;
+ else {
+ WRITE_ENTER(&ipf_auth);
+ SPL_NET(s);
+ *faep = fae->fae_next;
+ *frptr = fr->fr_next;
+ SPL_X(s);
+ RWLOCK_EXIT(&ipf_auth);
+ KFREE(fae);
+ }
+ } else if (fr && frptr) {
+ KMALLOC(fae, frauthent_t *);
+ if (fae != NULL) {
+ bcopy((char *)fr, (char *)&fae->fae_fr,
+ sizeof(*fr));
+ WRITE_ENTER(&ipf_auth);
+ SPL_NET(s);
+ fae->fae_age = fr_defaultauthage;
+ fae->fae_fr.fr_hits = 0;
+ fae->fae_fr.fr_next = *frptr;
+ *frptr = &fae->fae_fr;
+ fae->fae_next = *faep;
+ *faep = fae;
+ ipauth = &fae_list->fae_fr;
+ SPL_X(s);
+ RWLOCK_EXIT(&ipf_auth);
+ } else
+ error = ENOMEM;
+ } else
+ error = EINVAL;
+ return error;
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_auth.h b/sys/contrib/ipfilter/netinet/ip_auth.h
new file mode 100644
index 0000000..64fc2d7
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_auth.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 1997-2001 by Darren Reed & Guido Van Rooij.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $FreeBSD$
+ *
+ */
+#ifndef __IP_AUTH_H__
+#define __IP_AUTH_H__
+
+#define FR_NUMAUTH 32
+
+typedef struct frauth {
+ int fra_age;
+ int fra_index;
+ u_32_t fra_pass;
+ fr_info_t fra_info;
+#if SOLARIS
+ queue_t *fra_q;
+#endif
+} frauth_t;
+
+typedef struct frauthent {
+ struct frentry fae_fr;
+ struct frauthent *fae_next;
+ u_long fae_age;
+} frauthent_t;
+
+typedef struct fr_authstat {
+ U_QUAD_T fas_hits;
+ U_QUAD_T fas_miss;
+ u_long fas_nospace;
+ u_long fas_added;
+ u_long fas_sendfail;
+ u_long fas_sendok;
+ u_long fas_queok;
+ u_long fas_quefail;
+ u_long fas_expire;
+ frauthent_t *fas_faelist;
+} fr_authstat_t;
+
+
+extern frentry_t *ipauth;
+extern struct fr_authstat fr_authstats;
+extern int fr_defaultauthage;
+extern int fr_authsize;
+extern int fr_authused;
+extern int fr_auth_lock;
+extern u_32_t fr_checkauth __P((ip_t *, fr_info_t *));
+extern void fr_authexpire __P((void));
+extern void fr_authunload __P((void));
+extern mb_t *fr_authpkts[];
+extern int fr_newauth __P((mb_t *, fr_info_t *, ip_t *));
+#if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (__FreeBSD_version >= 300003)
+extern int fr_preauthcmd __P((u_long, frentry_t *, frentry_t **));
+extern int fr_auth_ioctl __P((caddr_t, int, u_long));
+#else
+extern int fr_preauthcmd __P((int, frentry_t *, frentry_t **));
+extern int fr_auth_ioctl __P((caddr_t, int, int));
+#endif
+#endif /* __IP_AUTH_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h
new file mode 100644
index 0000000..d14ad2b
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_compat.h
@@ -0,0 +1,1387 @@
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ip_compat.h 1.8 1/14/96
+ * $Id: ip_compat.h,v 2.26.2.9 2001/01/14 14:58:01 darrenr Exp $
+ * $FreeBSD$
+ */
+
+#ifndef __IP_COMPAT_H__
+#define __IP_COMPAT_H__
+
+#ifndef __P
+# ifdef __STDC__
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+#ifndef __STDC__
+# undef const
+# define const
+#endif
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+#if SOLARIS
+# if !defined(SOLARIS2)
+# define SOLARIS2 3 /* Pick an old version */
+# endif
+# if SOLARIS2 >= 8
+# ifndef USE_INET6
+# define USE_INET6
+# endif
+# else
+# undef USE_INET6
+# endif
+#endif
+#if defined(sun) && !(defined(__svr4__) || defined(__SVR4))
+# undef USE_INET6
+#endif
+
+#if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
+# undef KERNEL
+# undef _KERNEL
+# undef __KERNEL__
+# define KERNEL
+# define _KERNEL
+# define __KERNEL__
+#endif
+
+#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
+#define index strchr
+# if !defined(KERNEL)
+# define bzero(a,b) memset(a,0,b)
+# define bcmp memcmp
+# define bcopy(a,b,c) memmove(b,a,c)
+# endif
+#endif
+
+#ifndef offsetof
+#define offsetof(t,m) (int)((&((t *)0L)->m))
+#endif
+
+#if defined(__sgi) || defined(bsdi)
+struct ether_addr {
+ u_char ether_addr_octet[6];
+};
+#endif
+
+#ifndef LIFNAMSIZ
+# ifdef IF_NAMESIZE
+# define LIFNAMSIZ IF_NAMESIZE
+# else
+# ifdef IFNAMSIZ
+# define LIFNAMSIZ IFNAMSIZ
+# else
+# define LIFNAMSIZ 16
+# endif
+# endif
+#endif
+
+#if defined(__sgi) && !defined(IPFILTER_LKM)
+# ifdef __STDC__
+# define IPL_EXTERN(ep) ipfilter##ep
+# else
+# define IPL_EXTERN(ep) ipfilter/**/ep
+# endif
+#else
+# ifdef __STDC__
+# define IPL_EXTERN(ep) ipl##ep
+# else
+# define IPL_EXTERN(ep) ipl/**/ep
+# endif
+#endif
+
+#ifdef __sgi
+# include <sys/debug.h>
+#endif
+
+#ifdef linux
+# include <sys/sysmacros.h>
+#endif
+
+/*
+ * This is a workaround for <sys/uio.h> troubles on FreeBSD and OpenBSD.
+ */
+#ifndef _KERNEL
+# define ADD_KERNEL
+# define _KERNEL
+# define KERNEL
+#endif
+#ifdef __OpenBSD__
+struct file;
+#endif
+#include <sys/uio.h>
+#ifdef ADD_KERNEL
+# undef _KERNEL
+# undef KERNEL
+#endif
+
+#if SOLARIS
+# define MTYPE(m) ((m)->b_datap->db_type)
+# if SOLARIS2 >= 4
+# include <sys/isa_defs.h>
+# endif
+# include <sys/ioccom.h>
+# include <sys/sysmacros.h>
+# include <sys/kmem.h>
+/*
+ * because Solaris 2 defines these in two places :-/
+ */
+# undef IPOPT_EOL
+# undef IPOPT_NOP
+# undef IPOPT_LSRR
+# undef IPOPT_RR
+# undef IPOPT_SSRR
+# ifndef KERNEL
+# define _KERNEL
+# undef RES_INIT
+# if SOLARIS2 >= 8
+# include <netinet/ip6.h>
+# endif
+# include <inet/common.h>
+# include <inet/ip.h>
+# include <inet/ip_ire.h>
+# undef _KERNEL
+# else /* _KERNEL */
+# if SOLARIS2 >= 8
+# include <netinet/ip6.h>
+# endif
+# include <inet/common.h>
+# include <inet/ip.h>
+# include <inet/ip_ire.h>
+# endif /* _KERNEL */
+# if SOLARIS2 >= 8
+# include <inet/ip_if.h>
+# include <netinet/ip6.h>
+# define ipif_local_addr ipif_lcl_addr
+/* Only defined in private include file */
+# ifndef V4_PART_OF_V6
+# define V4_PART_OF_V6(v6) v6.s6_addr32[3]
+# endif
+# endif
+
+typedef struct qif {
+ struct qif *qf_next;
+ ill_t *qf_ill;
+ kmutex_t qf_lock;
+ void *qf_iptr;
+ void *qf_optr;
+ queue_t *qf_in;
+ queue_t *qf_out;
+ struct qinit *qf_wqinfo;
+ struct qinit *qf_rqinfo;
+ struct qinit qf_wqinit;
+ struct qinit qf_rqinit;
+ mblk_t *qf_m; /* These three fields are for passing data up from */
+ queue_t *qf_q; /* fr_qin and fr_qout to the packet processing. */
+ size_t qf_off;
+ size_t qf_len; /* this field is used for in ipfr_fastroute */
+ char qf_name[LIFNAMSIZ];
+ /*
+ * in case the ILL has disappeared...
+ */
+ size_t qf_hl; /* header length */
+ int qf_sap;
+# if SOLARIS2 >= 8
+ int qf_tunoff; /* tunnel offset */
+#endif
+ size_t qf_incnt;
+ size_t qf_outcnt;
+} qif_t;
+#else /* SOLARIS */
+# if !defined(__sgi)
+typedef int minor_t;
+# endif
+#endif /* SOLARIS */
+#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
+
+#ifndef IP_OFFMASK
+#define IP_OFFMASK 0x1fff
+#endif
+
+#if BSD > 199306
+# define USE_QUAD_T
+# define U_QUAD_T u_quad_t
+# define QUAD_T quad_t
+#else /* BSD > 199306 */
+# define U_QUAD_T u_long
+# define QUAD_T long
+#endif /* BSD > 199306 */
+
+
+#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
+# include <sys/param.h>
+# ifndef __FreeBSD_version
+# ifdef IPFILTER_LKM
+# include <osreldate.h>
+# else
+# include <sys/osreldate.h>
+# endif
+# endif
+# ifdef IPFILTER_LKM
+# define ACTUALLY_LKM_NOT_KERNEL
+# endif
+# if defined(__FreeBSD_version) && (__FreeBSD_version < 300000)
+# include <machine/spl.h>
+# else
+# if (__FreeBSD_version >= 300000) && (__FreeBSD_version < 400000)
+# if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
+# define ACTUALLY_LKM_NOT_KERNEL
+# endif
+# endif
+# endif
+#endif /* __FreeBSD__ && KERNEL */
+
+#if defined(__FreeBSD_version) && (__FreeBSD_version >= 500000) && \
+ defined(_KERNEL)
+# include <machine/in_cksum.h>
+#endif
+
+/*
+ * These operating systems already take care of the problem for us.
+ */
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
+ defined(__sgi)
+typedef u_int32_t u_32_t;
+# if defined(_KERNEL) && !defined(IPFILTER_LKM)
+# if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 104110000)
+# include "opt_inet.h"
+# endif
+# if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000) && \
+ !defined(KLD_MODULE)
+# include "opt_inet6.h"
+# endif
+# ifdef INET6
+# define USE_INET6
+# endif
+# endif
+# if !defined(_KERNEL) && !defined(IPFILTER_LKM) && !defined(USE_INET6)
+# if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000)) || \
+ (defined(OpenBSD) && (OpenBSD >= 200111)) || \
+ (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105000000))
+# define USE_INET6
+# endif
+# endif
+#else
+/*
+ * Really, any arch where sizeof(long) != sizeof(int).
+ */
+# if defined(__alpha__) || defined(__alpha) || defined(_LP64)
+typedef unsigned int u_32_t;
+# else
+# if SOLARIS2 >= 6
+typedef uint32_t u_32_t;
+# else
+typedef unsigned int u_32_t;
+# endif
+# endif
+#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __sgi */
+
+#ifdef USE_INET6
+# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+# include <netinet/ip6.h>
+# ifdef _KERNEL
+# include <netinet6/ip6_var.h>
+# endif
+typedef struct ip6_hdr ip6_t;
+# endif
+# include <netinet/icmp6.h>
+union i6addr {
+ u_32_t i6[4];
+ struct in_addr in4;
+ struct in6_addr in6;
+};
+#else
+union i6addr {
+ u_32_t i6[4];
+ struct in_addr in4;
+};
+#endif
+
+#define IP6CMP(a,b) bcmp((char *)&(a), (char *)&(b), sizeof(a))
+#define IP6EQ(a,b) (bcmp((char *)&(a), (char *)&(b), sizeof(a)) == 0)
+#define IP6NEQ(a,b) (bcmp((char *)&(a), (char *)&(b), sizeof(a)) != 0)
+#define IP6_ISZERO(a) ((((union i6addr *)(a))->i6[0] | \
+ ((union i6addr *)(a))->i6[1] | \
+ ((union i6addr *)(a))->i6[2] | \
+ ((union i6addr *)(a))->i6[3]) == 0)
+#define IP6_NOTZERO(a) ((((union i6addr *)(a))->i6[0] | \
+ ((union i6addr *)(a))->i6[1] | \
+ ((union i6addr *)(a))->i6[2] | \
+ ((union i6addr *)(a))->i6[3]) != 0)
+
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+/*
+ * Security Options for Intenet Protocol (IPSO) as defined in RFC 1108.
+ *
+ * Basic Option
+ *
+ * 00000001 - (Reserved 4)
+ * 00111101 - Top Secret
+ * 01011010 - Secret
+ * 10010110 - Confidential
+ * 01100110 - (Reserved 3)
+ * 11001100 - (Reserved 2)
+ * 10101011 - Unclassified
+ * 11110001 - (Reserved 1)
+ */
+#define IPSO_CLASS_RES4 0x01
+#define IPSO_CLASS_TOPS 0x3d
+#define IPSO_CLASS_SECR 0x5a
+#define IPSO_CLASS_CONF 0x96
+#define IPSO_CLASS_RES3 0x66
+#define IPSO_CLASS_RES2 0xcc
+#define IPSO_CLASS_UNCL 0xab
+#define IPSO_CLASS_RES1 0xf1
+
+#define IPSO_AUTH_GENSER 0x80
+#define IPSO_AUTH_ESI 0x40
+#define IPSO_AUTH_SCI 0x20
+#define IPSO_AUTH_NSA 0x10
+#define IPSO_AUTH_DOE 0x08
+#define IPSO_AUTH_UN 0x06
+#define IPSO_AUTH_FTE 0x01
+
+/*
+ * IP option #defines
+ */
+/*#define IPOPT_RR 7 */
+#define IPOPT_ZSU 10 /* ZSU */
+#define IPOPT_MTUP 11 /* MTUP */
+#define IPOPT_MTUR 12 /* MTUR */
+#define IPOPT_ENCODE 15 /* ENCODE */
+/*#define IPOPT_TS 68 */
+#define IPOPT_TR 82 /* TR */
+/*#define IPOPT_SECURITY 130 */
+/*#define IPOPT_LSRR 131 */
+#define IPOPT_E_SEC 133 /* E-SEC */
+#define IPOPT_CIPSO 134 /* CIPSO */
+/*#define IPOPT_SATID 136 */
+#ifndef IPOPT_SID
+# define IPOPT_SID IPOPT_SATID
+#endif
+/*#define IPOPT_SSRR 137 */
+#define IPOPT_ADDEXT 147 /* ADDEXT */
+#define IPOPT_VISA 142 /* VISA */
+#define IPOPT_IMITD 144 /* IMITD */
+#define IPOPT_EIP 145 /* EIP */
+#define IPOPT_FINN 205 /* FINN */
+
+#ifndef TCPOPT_WSCALE
+# define TCPOPT_WSCALE 3
+#endif
+
+/*
+ * Build some macros and #defines to enable the same code to compile anywhere
+ * Well, that's the idea, anyway :-)
+ */
+#if SOLARIS
+typedef mblk_t mb_t;
+# if SOLARIS2 >= 7
+# ifdef lint
+# define ALIGN32(ptr) (ptr ? 0L : 0L)
+# define ALIGN16(ptr) (ptr ? 0L : 0L)
+# else
+# define ALIGN32(ptr) (ptr)
+# define ALIGN16(ptr) (ptr)
+# endif
+# endif
+#else
+typedef struct mbuf mb_t;
+#endif /* SOLARIS */
+
+#if !SOLARIS || (SOLARIS2 < 6) || !defined(KERNEL)
+# define ATOMIC_INCL ATOMIC_INC
+# define ATOMIC_INC64 ATOMIC_INC
+# define ATOMIC_INC32 ATOMIC_INC
+# define ATOMIC_INC16 ATOMIC_INC
+# define ATOMIC_DECL ATOMIC_DEC
+# define ATOMIC_DEC64 ATOMIC_DEC
+# define ATOMIC_DEC32 ATOMIC_DEC
+# define ATOMIC_DEC16 ATOMIC_DEC
+#endif
+#ifdef __sgi
+# define hz HZ
+# include <sys/ksynch.h>
+# define IPF_LOCK_PL plhi
+# include <sys/sema.h>
+#undef kmutex_t
+typedef struct {
+ lock_t *l;
+ int pl;
+} kmutex_t;
+# undef MUTEX_INIT
+# undef MUTEX_DESTROY
+#endif
+#ifdef KERNEL
+# if SOLARIS
+# if SOLARIS2 >= 6
+# include <sys/atomic.h>
+# if SOLARIS2 == 6
+# define ATOMIC_INCL(x) atomic_add_long((uint32_t*)&(x), 1)
+# define ATOMIC_DECL(x) atomic_add_long((uint32_t*)&(x), -1)
+# else
+# define ATOMIC_INCL(x) atomic_add_long(&(x), 1)
+# define ATOMIC_DECL(x) atomic_add_long(&(x), -1)
+# endif
+# define ATOMIC_INC64(x) atomic_add_64((uint64_t*)&(x), 1)
+# define ATOMIC_INC32(x) atomic_add_32((uint32_t*)&(x), 1)
+# define ATOMIC_INC16(x) atomic_add_16((uint16_t*)&(x), 1)
+# define ATOMIC_DEC64(x) atomic_add_64((uint64_t*)&(x), -1)
+# define ATOMIC_DEC32(x) atomic_add_32((uint32_t*)&(x), -1)
+# define ATOMIC_DEC16(x) atomic_add_16((uint16_t*)&(x), -1)
+# else
+# define IRE_CACHE IRE_ROUTE
+# define ATOMIC_INC(x) { mutex_enter(&ipf_rw); (x)++; \
+ mutex_exit(&ipf_rw); }
+# define ATOMIC_DEC(x) { mutex_enter(&ipf_rw); (x)--; \
+ mutex_exit(&ipf_rw); }
+# endif
+# define MUTEX_ENTER(x) mutex_enter(x)
+# if 1
+# define KRWLOCK_T krwlock_t
+# define READ_ENTER(x) rw_enter(x, RW_READER)
+# define WRITE_ENTER(x) rw_enter(x, RW_WRITER)
+# define RW_UPGRADE(x) { if (rw_tryupgrade(x) == 0) { \
+ rw_exit(x); \
+ rw_enter(x, RW_WRITER); } \
+ }
+# define MUTEX_DOWNGRADE(x) rw_downgrade(x)
+# define RWLOCK_INIT(x, y, z) rw_init((x), (y), RW_DRIVER, (z))
+# define RWLOCK_EXIT(x) rw_exit(x)
+# define RW_DESTROY(x) rw_destroy(x)
+# else
+# define KRWLOCK_T kmutex_t
+# define READ_ENTER(x) mutex_enter(x)
+# define WRITE_ENTER(x) mutex_enter(x)
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_INIT(x, y, z) mutex_init((x), (y), MUTEX_DRIVER, (z))
+# define RWLOCK_EXIT(x) mutex_exit(x)
+# define RW_DESTROY(x) mutex_destroy(x)
+# endif
+# define MUTEX_INIT(x, y, z) mutex_init((x), (y), MUTEX_DRIVER, (z))
+# define MUTEX_DESTROY(x) mutex_destroy(x)
+# define MUTEX_EXIT(x) mutex_exit(x)
+# define MTOD(m,t) (t)((m)->b_rptr)
+# define IRCOPY(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
+# define IWCOPY(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
+# define IRCOPYPTR ircopyptr
+# define IWCOPYPTR iwcopyptr
+# define FREE_MB_T(m) freemsg(m)
+# define SPL_NET(x) ;
+# define SPL_IMP(x) ;
+# undef SPL_X
+# define SPL_X(x) ;
+# ifdef sparc
+# define ntohs(x) (x)
+# define ntohl(x) (x)
+# define htons(x) (x)
+# define htonl(x) (x)
+# endif /* sparc */
+# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+# define GET_MINOR(x) getminor(x)
+extern ill_t *get_unit __P((char *, int));
+# define GETUNIT(n, v) get_unit(n, v)
+# define IFNAME(x) ((ill_t *)x)->ill_name
+# else /* SOLARIS */
+# if defined(__sgi)
+# define ATOMIC_INC(x) { MUTEX_ENTER(&ipf_rw); \
+ (x)++; MUTEX_EXIT(&ipf_rw); }
+# define ATOMIC_DEC(x) { MUTEX_ENTER(&ipf_rw); \
+ (x)--; MUTEX_EXIT(&ipf_rw); }
+# define MUTEX_ENTER(x) (x)->pl = LOCK((x)->l, IPF_LOCK_PL);
+# define KRWLOCK_T kmutex_t
+# define READ_ENTER(x) MUTEX_ENTER(x)
+# define WRITE_ENTER(x) MUTEX_ENTER(x)
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) MUTEX_EXIT(x)
+# define MUTEX_EXIT(x) UNLOCK((x)->l, (x)->pl);
+# define MUTEX_INIT(x,y,z) (x)->l = LOCK_ALLOC((uchar_t)-1, IPF_LOCK_PL, (lkinfo_t *)-1, KM_NOSLEEP)
+# define MUTEX_DESTROY(x) LOCK_DEALLOC((x)->l)
+# else /* __sgi */
+# define ATOMIC_INC(x) (x)++
+# define ATOMIC_DEC(x) (x)--
+# define MUTEX_ENTER(x) ;
+# define READ_ENTER(x) ;
+# define WRITE_ENTER(x) ;
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) ;
+# define MUTEX_EXIT(x) ;
+# define MUTEX_INIT(x,y,z) ;
+# define MUTEX_DESTROY(x) ;
+# endif /* __sgi */
+# ifndef linux
+# define FREE_MB_T(m) m_freem(m)
+# define MTOD(m,t) mtod(m,t)
+# define IRCOPY(a,b,c) (bcopy((a), (b), (c)), 0)
+# define IWCOPY(a,b,c) (bcopy((a), (b), (c)), 0)
+# define IRCOPYPTR ircopyptr
+# define IWCOPYPTR iwcopyptr
+# endif /* !linux */
+# endif /* SOLARIS */
+
+# ifdef sun
+# if !SOLARIS
+# include <sys/time.h>
+# include <sys/kmem_alloc.h>
+# define GETUNIT(n, v) ifunit(n, IFNAMSIZ)
+# define IFNAME(x) ((struct ifnet *)x)->if_name
+# endif
+# else
+# ifndef linux
+# define GETUNIT(n, v) ifunit(n)
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+# define IFNAME(x) ((struct ifnet *)x)->if_xname
+# else
+# define USE_GETIFNAME 1
+# define IFNAME(x) get_ifname((struct ifnet *)x)
+extern char *get_ifname __P((struct ifnet *));
+# endif
+# endif
+# endif /* sun */
+
+# if defined(sun) && !defined(linux) || defined(__sgi)
+# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
+# define SLEEP(id, n) sleep((id), PZERO+1)
+# define WAKEUP(id) wakeup(id)
+# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
+# define KFREES(x,s) kmem_free((char *)(x), (s))
+# if !SOLARIS
+extern void m_copydata __P((struct mbuf *, int, int, caddr_t));
+extern void m_copyback __P((struct mbuf *, int, int, caddr_t));
+# endif
+# ifdef __sgi
+# include <sys/kmem.h>
+# include <sys/ddi.h>
+# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+# define GET_MINOR(x) getminor(x)
+# else
+# if !SOLARIS
+# define KMALLOC(a,b) (a) = (b)new_kmem_alloc(sizeof(*(a)), \
+ KMEM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
+# endif /* SOLARIS */
+# endif /* __sgi */
+# endif /* sun && !linux */
+# ifndef GET_MINOR
+# define GET_MINOR(x) minor(x)
+# endif
+# if (BSD >= 199306) || defined(__FreeBSD__)
+# if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \
+ defined(__FreeBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \
+ defined(_BSDI_VERSION)
+# include <vm/vm.h>
+# endif
+# if !defined(__FreeBSD__) || (defined (__FreeBSD_version) && \
+ (__FreeBSD_version >= 300000))
+# if (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105180000)) || \
+ (defined(OpenBSD) && (OpenBSD >= 200111))
+# include <uvm/uvm_extern.h>
+# else
+# include <vm/vm_extern.h>
+extern vm_map_t kmem_map;
+# endif
+# include <sys/proc.h>
+# else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
+# include <vm/vm_kern.h>
+# endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
+# ifdef M_PFIL
+# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_PFIL, M_NOWAIT)
+# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_PFIL, M_NOWAIT)
+# define KFREE(x) FREE((x), M_PFIL)
+# define KFREES(x,s) FREE((x), M_PFIL)
+# else
+# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_TEMP, M_NOWAIT)
+# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
+# define KFREE(x) FREE((x), M_TEMP)
+# define KFREES(x,s) FREE((x), M_TEMP)
+# endif /* M_PFIL */
+# define UIOMOVE(a,b,c,d) uiomove(a,b,d)
+# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
+# define WAKEUP(id) wakeup(id)
+# endif /* BSD */
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199407)) || \
+ (defined(OpenBSD) && (OpenBSD >= 200006))
+# define SPL_NET(x) x = splsoftnet()
+# define SPL_X(x) (void) splx(x)
+# else
+# if !SOLARIS && !defined(linux)
+# define SPL_IMP(x) x = splimp()
+# define SPL_NET(x) x = splnet()
+# define SPL_X(x) (void) splx(x)
+# endif
+# endif /* NetBSD && (NetBSD <= 1991011) && (NetBSD >= 199407) */
+# define PANIC(x,y) if (x) panic y
+#else /* KERNEL */
+# define SLEEP(x,y) 1
+# define WAKEUP(x) ;
+# define PANIC(x,y) ;
+# define ATOMIC_INC(x) (x)++
+# define ATOMIC_DEC(x) (x)--
+# define MUTEX_ENTER(x) ;
+# define READ_ENTER(x) ;
+# define MUTEX_INIT(x,y,z) ;
+# define MUTEX_DESTROY(x) ;
+# define WRITE_ENTER(x) ;
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) ;
+# define MUTEX_EXIT(x) ;
+# define SPL_NET(x) ;
+# define SPL_IMP(x) ;
+# undef SPL_X
+# define SPL_X(x) ;
+# define KMALLOC(a,b) (a) = (b)malloc(sizeof(*a))
+# define KMALLOCS(a,b,c) (a) = (b)malloc(c)
+# define KFREE(x) free(x)
+# define KFREES(x,s) free(x)
+# define FREE_MB_T(x) ;
+# define GETUNIT(x, v) get_unit(x,v)
+# define IRCOPY(a,b,c) (bcopy((a), (b), (c)), 0)
+# define IWCOPY(a,b,c) (bcopy((a), (b), (c)), 0)
+# define IRCOPYPTR ircopyptr
+# define IWCOPYPTR iwcopyptr
+# define IFNAME(x) get_ifname((struct ifnet *)x)
+# define UIOMOVE(a,b,c,d) ipfuiomove(a,b,c,d)
+# include <sys/time.h>
+extern void m_copydata __P((mb_t *, int, int, caddr_t));
+extern int ipfuiomove __P((caddr_t, int, int, struct uio *));
+#endif /* KERNEL */
+
+/*
+ * These #ifdef's are here mainly for linux, but who knows, they may
+ * not be in other places or maybe one day linux will grow up and some
+ * of these will turn up there too.
+ */
+#ifndef ICMP_MINLEN
+# define ICMP_MINLEN 8
+#endif
+#ifndef ICMP_ECHOREPLY
+# define ICMP_ECHOREPLY 0
+#endif
+#ifndef ICMP_UNREACH
+# define ICMP_UNREACH 3
+#endif
+#ifndef ICMP_UNREACH_NET
+# define ICMP_UNREACH_NET 0
+#endif
+#ifndef ICMP_UNREACH_HOST
+# define ICMP_UNREACH_HOST 1
+#endif
+#ifndef ICMP_UNREACH_PROTOCOL
+# define ICMP_UNREACH_PROTOCOL 2
+#endif
+#ifndef ICMP_UNREACH_PORT
+# define ICMP_UNREACH_PORT 3
+#endif
+#ifndef ICMP_UNREACH_NEEDFRAG
+# define ICMP_UNREACH_NEEDFRAG 4
+#endif
+#ifndef ICMP_UNREACH_SRCFAIL
+# define ICMP_UNREACH_SRCFAIL 5
+#endif
+#ifndef ICMP_UNREACH_NET_UNKNOWN
+# define ICMP_UNREACH_NET_UNKNOWN 6
+#endif
+#ifndef ICMP_UNREACH_HOST_UNKNOWN
+# define ICMP_UNREACH_HOST_UNKNOWN 7
+#endif
+#ifndef ICMP_UNREACH_ISOLATED
+# define ICMP_UNREACH_ISOLATED 8
+#endif
+#ifndef ICMP_UNREACH_NET_PROHIB
+# define ICMP_UNREACH_NET_PROHIB 9
+#endif
+#ifndef ICMP_UNREACH_HOST_PROHIB
+# define ICMP_UNREACH_HOST_PROHIB 10
+#endif
+#ifndef ICMP_UNREACH_TOSNET
+# define ICMP_UNREACH_TOSNET 11
+#endif
+#ifndef ICMP_UNREACH_TOSHOST
+# define ICMP_UNREACH_TOSHOST 12
+#endif
+#ifndef ICMP_UNREACH_ADMIN_PROHIBIT
+# define ICMP_UNREACH_ADMIN_PROHIBIT 13
+#endif
+#ifndef ICMP_UNREACH_HOST_PRECEDENCE
+# define ICMP_UNREACH_HOST_PRECEDENCE 14
+#endif
+#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
+# define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
+#endif
+#ifndef ICMP_SOURCEQUENCH
+# define ICMP_SOURCEQUENCH 4
+#endif
+#ifndef ICMP_REDIRECT_NET
+# define ICMP_REDIRECT_NET 0
+#endif
+#ifndef ICMP_REDIRECT_HOST
+# define ICMP_REDIRECT_HOST 1
+#endif
+#ifndef ICMP_REDIRECT_TOSNET
+# define ICMP_REDIRECT_TOSNET 2
+#endif
+#ifndef ICMP_REDIRECT_TOSHOST
+# define ICMP_REDIRECT_TOSHOST 3
+#endif
+#ifndef ICMP_ALTHOSTADDR
+# define ICMP_ALTHOSTADDR 6
+#endif
+#ifndef ICMP_TIMXCEED
+# define ICMP_TIMXCEED 11
+#endif
+#ifndef ICMP_TIMXCEED_INTRANS
+# define ICMP_TIMXCEED_INTRANS 0
+#endif
+#ifndef ICMP_TIMXCEED_REASS
+# define ICMP_TIMXCEED_REASS 1
+#endif
+#ifndef ICMP_PARAMPROB
+# define ICMP_PARAMPROB 12
+#endif
+#ifndef ICMP_PARAMPROB_ERRATPTR
+# define ICMP_PARAMPROB_ERRATPTR 0
+#endif
+#ifndef ICMP_PARAMPROB_OPTABSENT
+# define ICMP_PARAMPROB_OPTABSENT 1
+#endif
+#ifndef ICMP_PARAMPROB_LENGTH
+# define ICMP_PARAMPROB_LENGTH 2
+#endif
+#ifndef ICMP_TSTAMP
+# define ICMP_TSTAMP 13
+#endif
+#ifndef ICMP_TSTAMPREPLY
+# define ICMP_TSTAMPREPLY 14
+#endif
+#ifndef ICMP_IREQ
+# define ICMP_IREQ 15
+#endif
+#ifndef ICMP_IREQREPLY
+# define ICMP_IREQREPLY 16
+#endif
+#ifndef ICMP_MASKREQ
+# define ICMP_MASKREQ 17
+#endif
+#ifndef ICMP_MASKREPLY
+# define ICMP_MASKREPLY 18
+#endif
+#ifndef ICMP_TRACEROUTE
+# define ICMP_TRACEROUTE 30
+#endif
+#ifndef ICMP_DATACONVERR
+# define ICMP_DATACONVERR 31
+#endif
+#ifndef ICMP_MOBILE_REDIRECT
+# define ICMP_MOBILE_REDIRECT 32
+#endif
+#ifndef ICMP_IPV6_WHEREAREYOU
+# define ICMP_IPV6_WHEREAREYOU 33
+#endif
+#ifndef ICMP_IPV6_IAMHERE
+# define ICMP_IPV6_IAMHERE 34
+#endif
+#ifndef ICMP_MOBILE_REGREQUEST
+# define ICMP_MOBILE_REGREQUEST 35
+#endif
+#ifndef ICMP_MOBILE_REGREPLY
+# define ICMP_MOBILE_REGREPLY 36
+#endif
+#ifndef ICMP_SKIP
+# define ICMP_SKIP 39
+#endif
+#ifndef ICMP_PHOTURIS
+# define ICMP_PHOTURIS 40
+#endif
+#ifndef ICMP_PHOTURIS_UNKNOWN_INDEX
+# define ICMP_PHOTURIS_UNKNOWN_INDEX 1
+#endif
+#ifndef ICMP_PHOTURIS_AUTH_FAILED
+# define ICMP_PHOTURIS_AUTH_FAILED 2
+#endif
+#ifndef ICMP_PHOTURIS_DECRYPT_FAILED
+# define ICMP_PHOTURIS_DECRYPT_FAILED 3
+#endif
+#ifndef IPVERSION
+# define IPVERSION 4
+#endif
+#ifndef IPOPT_MINOFF
+# define IPOPT_MINOFF 4
+#endif
+#ifndef IPOPT_COPIED
+# define IPOPT_COPIED(x) ((x)&0x80)
+#endif
+#ifndef IPOPT_EOL
+# define IPOPT_EOL 0
+#endif
+#ifndef IPOPT_NOP
+# define IPOPT_NOP 1
+#endif
+#ifndef IP_MF
+# define IP_MF ((u_short)0x2000)
+#endif
+#ifndef ETHERTYPE_IP
+# define ETHERTYPE_IP ((u_short)0x0800)
+#endif
+#ifndef TH_FIN
+# define TH_FIN 0x01
+#endif
+#ifndef TH_SYN
+# define TH_SYN 0x02
+#endif
+#ifndef TH_RST
+# define TH_RST 0x04
+#endif
+#ifndef TH_PUSH
+# define TH_PUSH 0x08
+#endif
+#ifndef TH_ACK
+# define TH_ACK 0x10
+#endif
+#ifndef TH_URG
+# define TH_URG 0x20
+#endif
+#ifndef IPOPT_EOL
+# define IPOPT_EOL 0
+#endif
+#ifndef IPOPT_NOP
+# define IPOPT_NOP 1
+#endif
+#ifndef IPOPT_RR
+# define IPOPT_RR 7
+#endif
+#ifndef IPOPT_TS
+# define IPOPT_TS 68
+#endif
+#ifndef IPOPT_SECURITY
+# define IPOPT_SECURITY 130
+#endif
+#ifndef IPOPT_LSRR
+# define IPOPT_LSRR 131
+#endif
+#ifndef IPOPT_SATID
+# define IPOPT_SATID 136
+#endif
+#ifndef IPOPT_SSRR
+# define IPOPT_SSRR 137
+#endif
+#ifndef IPOPT_SECUR_UNCLASS
+# define IPOPT_SECUR_UNCLASS ((u_short)0x0000)
+#endif
+#ifndef IPOPT_SECUR_CONFID
+# define IPOPT_SECUR_CONFID ((u_short)0xf135)
+#endif
+#ifndef IPOPT_SECUR_EFTO
+# define IPOPT_SECUR_EFTO ((u_short)0x789a)
+#endif
+#ifndef IPOPT_SECUR_MMMM
+# define IPOPT_SECUR_MMMM ((u_short)0xbc4d)
+#endif
+#ifndef IPOPT_SECUR_RESTR
+# define IPOPT_SECUR_RESTR ((u_short)0xaf13)
+#endif
+#ifndef IPOPT_SECUR_SECRET
+# define IPOPT_SECUR_SECRET ((u_short)0xd788)
+#endif
+#ifndef IPOPT_SECUR_TOPSECRET
+# define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
+#endif
+#ifndef IPOPT_OLEN
+# define IPOPT_OLEN 1
+#endif
+#ifndef IPPROTO_GRE
+# define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */
+#endif
+#ifndef IPPROTO_ESP
+# define IPPROTO_ESP 50
+#endif
+#ifndef IPPROTO_ICMPV6
+# define IPPROTO_ICMPV6 58
+#endif
+
+#ifdef linux
+#include <linux/in_systm.h>
+/*
+ * TCP States
+ */
+#define TCPS_CLOSED 0 /* closed */
+#define TCPS_LISTEN 1 /* listening for connection */
+#define TCPS_SYN_SENT 2 /* active, have sent syn */
+#define TCPS_SYN_RECEIVED 3 /* have send and received syn */
+/* states < TCPS_ESTABLISHED are those where connections not established */
+#define TCPS_ESTABLISHED 4 /* established */
+#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
+/* states > TCPS_CLOSE_WAIT are those where user has closed */
+#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
+#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */
+#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
+/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
+#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
+#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
+
+/*
+ * file flags.
+ */
+#ifdef WRITE
+#define FWRITE WRITE
+#define FREAD READ
+#else
+#define FWRITE _IOC_WRITE
+#define FREAD _IOC_READ
+#endif
+/*
+ * mbuf related problems.
+ */
+#define mtod(m,t) (t)((m)->data)
+#define m_len len
+#define m_next next
+
+#ifdef IP_DF
+#undef IP_DF
+#endif
+#define IP_DF 0x4000
+
+typedef struct {
+ __u16 th_sport;
+ __u16 th_dport;
+ __u32 th_seq;
+ __u32 th_ack;
+# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
+ defined(vax)
+ __u8 th_res:4;
+ __u8 th_off:4;
+#else
+ __u8 th_off:4;
+ __u8 th_res:4;
+#endif
+ __u8 th_flags;
+ __u16 th_win;
+ __u16 th_sum;
+ __u16 th_urp;
+} tcphdr_t;
+
+typedef struct {
+ __u16 uh_sport;
+ __u16 uh_dport;
+ __u16 uh_ulen;
+ __u16 uh_sum;
+} udphdr_t;
+
+typedef struct {
+# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
+ defined(vax)
+ __u8 ip_hl:4;
+ __u8 ip_v:4;
+# else
+ __u8 ip_v:4;
+ __u8 ip_hl:4;
+# endif
+ __u8 ip_tos;
+ __u16 ip_len;
+ __u16 ip_id;
+ __u16 ip_off;
+ __u8 ip_ttl;
+ __u8 ip_p;
+ __u16 ip_sum;
+ struct in_addr ip_src;
+ struct in_addr ip_dst;
+} ip_t;
+
+/*
+ * Structure of an icmp header.
+ */
+typedef struct icmp {
+ __u8 icmp_type; /* type of message, see below */
+ __u8 icmp_code; /* type sub code */
+ __u16 icmp_cksum; /* ones complement cksum of struct */
+ union {
+ __u8 ih_pptr; /* ICMP_PARAMPROB */
+ struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
+ struct ih_idseq {
+ __u16 icd_id;
+ __u16 icd_seq;
+ } ih_idseq;
+ int ih_void;
+ } icmp_hun;
+# define icmp_pptr icmp_hun.ih_pptr
+# define icmp_gwaddr icmp_hun.ih_gwaddr
+# define icmp_id icmp_hun.ih_idseq.icd_id
+# define icmp_seq icmp_hun.ih_idseq.icd_seq
+# define icmp_void icmp_hun.ih_void
+ union {
+ struct id_ts {
+ n_time its_otime;
+ n_time its_rtime;
+ n_time its_ttime;
+ } id_ts;
+ struct id_ip {
+ ip_t idi_ip;
+ /* options and then 64 bits of data */
+ } id_ip;
+ u_long id_mask;
+ char id_data[1];
+ } icmp_dun;
+# define icmp_otime icmp_dun.id_ts.its_otime
+# define icmp_rtime icmp_dun.id_ts.its_rtime
+# define icmp_ttime icmp_dun.id_ts.its_ttime
+# define icmp_ip icmp_dun.id_ip.idi_ip
+# define icmp_mask icmp_dun.id_mask
+# define icmp_data icmp_dun.id_data
+} icmphdr_t;
+
+# ifndef LINUX_IPOVLY
+# define LINUX_IPOVLY
+struct ipovly {
+ caddr_t ih_next, ih_prev; /* for protocol sequence q's */
+ u_char ih_x1; /* (unused) */
+ u_char ih_pr; /* protocol */
+ short ih_len; /* protocol length */
+ struct in_addr ih_src; /* source internet address */
+ struct in_addr ih_dst; /* destination internet address */
+};
+# endif
+
+typedef struct {
+ __u8 ether_dhost[6];
+ __u8 ether_shost[6];
+ __u16 ether_type;
+} ether_header_t;
+
+typedef struct uio {
+ int uio_resid;
+ int uio_rw;
+ caddr_t uio_buf;
+} uio_t;
+
+# define UIO_READ 0
+# define UIO_WRITE 1
+# define UIOMOVE(a, b, c, d) uiomove(a,b,c,d)
+
+/*
+ * For masking struct ifnet onto struct device
+ */
+# define if_name name
+
+# ifdef KERNEL
+# define GETUNIT(x, v) dev_get(x)
+# define FREE_MB_T(m) kfree_skb(m, FREE_WRITE)
+# define uniqtime do_gettimeofday
+# undef INT_MAX
+# undef UINT_MAX
+# undef LONG_MAX
+# undef ULONG_MAX
+# include <linux/netdevice.h>
+# define SPL_X(x)
+# define SPL_NET(x)
+# define SPL_IMP(x)
+
+# define bcmp(a,b,c) memcmp(a,b,c)
+# define bcopy(a,b,c) memcpy(b,a,c)
+# define bzero(a,c) memset(a,0,c)
+
+# define UNITNAME(n) dev_get((n))
+
+# define KMALLOC(a,b) (a) = (b)kmalloc(sizeof(*(a)), GFP_ATOMIC)
+# define KMALLOCS(a,b,c) (a) = (b)kmalloc((c), GFP_ATOMIC)
+# define KFREE(x) kfree_s((x), sizeof(*(x)))
+# define KFREES(x,s) kfree_s((x), (s))
+#define IRCOPY(const void *a, void *b, size_t c) { \
+ int error; \
+
+ error = verify_area(VERIFY_READ, a ,c); \
+ if (!error) \
+ memcpy_fromfs(b, a, c); \
+ return error; \
+}
+static inline int IWCOPY(const void *a, void *b, size_t c)
+{
+ int error;
+
+ error = verify_area(VERIFY_WRITE, b, c);
+ if (!error)
+ memcpy_tofs(b, a, c);
+ return error;
+}
+static inline int IRCOPYPTR(const void *a, void *b, size_t c) {
+ caddr_t ca;
+ int error;
+
+ error = verify_area(VERIFY_READ, a ,sizeof(ca));
+ if (!error) {
+ memcpy_fromfs(ca, a, sizeof(ca));
+ error = verify_area(VERIFY_READ, ca , c);
+ if (!error)
+ memcpy_fromfs(b, ca, c);
+ }
+ return error;
+}
+static inline int IWCOPYPTR(const void *a, void *b, size_t c) {
+ caddr_t ca;
+ int error;
+
+
+ error = verify_area(VERIFY_READ, b ,sizeof(ca));
+ if (!error) {
+ memcpy_fromfs(ca, b, sizeof(ca));
+ error = verify_area(VERIFY_WRITE, ca, c);
+ if (!error)
+ memcpy_tofs(ca, a, c);
+ }
+ return error;
+}
+# else
+# define __KERNEL__
+# undef INT_MAX
+# undef UINT_MAX
+# undef LONG_MAX
+# undef ULONG_MAX
+# define s8 __s8
+# define u8 __u8
+# define s16 __s16
+# define u16 __u16
+# define s32 __s32
+# define u32 __u32
+# include <linux/netdevice.h>
+# undef __KERNEL__
+# endif
+# define ifnet device
+#else
+typedef struct tcphdr tcphdr_t;
+typedef struct udphdr udphdr_t;
+typedef struct icmp icmphdr_t;
+typedef struct ip ip_t;
+typedef struct ether_header ether_header_t;
+#endif /* linux */
+typedef struct tcpiphdr tcpiphdr_t;
+
+#if defined(hpux) || defined(linux)
+struct ether_addr {
+ char ether_addr_octet[6];
+};
+#endif
+
+/*
+ * XXX - This is one of those *awful* hacks which nobody likes
+ */
+#ifdef ultrix
+#define A_A
+#else
+#define A_A &
+#endif
+
+#if (BSD >= 199306) && !defined(m_act)
+# define m_act m_nextpkt
+#endif
+
+#ifndef ICMP_ROUTERADVERT
+# define ICMP_ROUTERADVERT 9
+#endif
+#ifndef ICMP_ROUTERSOLICIT
+# define ICMP_ROUTERSOLICIT 10
+#endif
+#undef ICMP_MAX_UNREACH
+#define ICMP_MAX_UNREACH 14
+#undef ICMP_MAXTYPE
+#define ICMP_MAXTYPE 18
+/*
+ * ICMP error replies have an IP header (20 bytes), 8 bytes of ICMP data,
+ * another IP header and then 64 bits of data, totalling 56. Of course,
+ * the last 64 bits is dependant on that being available.
+ */
+#define ICMPERR_ICMPHLEN 8
+#define ICMPERR_IPICMPHLEN (20 + 8)
+#define ICMPERR_MINPKTLEN (20 + 8 + 20)
+#define ICMPERR_MAXPKTLEN (20 + 8 + 20 + 8)
+#define ICMP6_MINLEN 8
+#define ICMP6ERR_MINPKTLEN (40 + 8)
+#define ICMP6ERR_IPICMPHLEN (40 + 8 + 40)
+
+#ifndef ICMP6_DST_UNREACH
+# define ICMP6_DST_UNREACH 1
+#endif
+#ifndef ICMP6_PACKET_TOO_BIG
+# define ICMP6_PACKET_TOO_BIG 2
+#endif
+#ifndef ICMP6_TIME_EXCEEDED
+# define ICMP6_TIME_EXCEEDED 3
+#endif
+#ifndef ICMP6_PARAM_PROB
+# define ICMP6_PARAM_PROB 4
+#endif
+
+#ifndef ICMP6_ECHO_REQUEST
+# define ICMP6_ECHO_REQUEST 128
+#endif
+#ifndef ICMP6_ECHO_REPLY
+# define ICMP6_ECHO_REPLY 129
+#endif
+#ifndef ICMP6_MEMBERSHIP_QUERY
+# define ICMP6_MEMBERSHIP_QUERY 130
+#endif
+#ifndef MLD6_LISTENER_QUERY
+# define MLD6_LISTENER_QUERY 130
+#endif
+#ifndef ICMP6_MEMBERSHIP_REPORT
+# define ICMP6_MEMBERSHIP_REPORT 131
+#endif
+#ifndef MLD6_LISTENER_REPORT
+# define MLD6_LISTENER_REPORT 131
+#endif
+#ifndef ICMP6_MEMBERSHIP_REDUCTION
+# define ICMP6_MEMBERSHIP_REDUCTION 132
+#endif
+#ifndef MLD6_LISTENER_DONE
+# define MLD6_LISTENER_DONE 132
+#endif
+#ifndef ND_ROUTER_SOLICIT
+# define ND_ROUTER_SOLICIT 133
+#endif
+#ifndef ND_ROUTER_ADVERT
+# define ND_ROUTER_ADVERT 134
+#endif
+#ifndef ND_NEIGHBOR_SOLICIT
+# define ND_NEIGHBOR_SOLICIT 135
+#endif
+#ifndef ND_NEIGHBOR_ADVERT
+# define ND_NEIGHBOR_ADVERT 136
+#endif
+#ifndef ND_REDIRECT
+# define ND_REDIRECT 137
+#endif
+#ifndef ICMP6_ROUTER_RENUMBERING
+# define ICMP6_ROUTER_RENUMBERING 138
+#endif
+#ifndef ICMP6_WRUREQUEST
+# define ICMP6_WRUREQUEST 139
+#endif
+#ifndef ICMP6_WRUREPLY
+# define ICMP6_WRUREPLY 140
+#endif
+#ifndef ICMP6_FQDN_QUERY
+# define ICMP6_FQDN_QUERY 139
+#endif
+#ifndef ICMP6_FQDN_REPLY
+# define ICMP6_FQDN_REPLY 140
+#endif
+#ifndef ICMP6_NI_QUERY
+# define ICMP6_NI_QUERY 139
+#endif
+#ifndef ICMP6_NI_REPLY
+# define ICMP6_NI_REPLY 140
+#endif
+#ifndef MLD6_MTRACE_RESP
+# define MLD6_MTRACE_RESP 200
+#endif
+#ifndef MLD6_MTRACE
+# define MLD6_MTRACE 201
+#endif
+#ifndef ICMP6_HADISCOV_REQUEST
+# define ICMP6_HADISCOV_REQUEST 202
+#endif
+#ifndef ICMP6_HADISCOV_REPLY
+# define ICMP6_HADISCOV_REPLY 203
+#endif
+#ifndef ICMP6_MOBILEPREFIX_SOLICIT
+# define ICMP6_MOBILEPREFIX_SOLICIT 204
+#endif
+#ifndef ICMP6_MOBILEPREFIX_ADVERT
+# define ICMP6_MOBILEPREFIX_ADVERT 205
+#endif
+#ifndef ICMP6_MAXTYPE
+# define ICMP6_MAXTYPE 205
+#endif
+
+#ifndef ICMP6_DST_UNREACH_NOROUTE
+# define ICMP6_DST_UNREACH_NOROUTE 0
+#endif
+#ifndef ICMP6_DST_UNREACH_ADMIN
+# define ICMP6_DST_UNREACH_ADMIN 1
+#endif
+#ifndef ICMP6_DST_UNREACH_NOTNEIGHBOR
+# define ICMP6_DST_UNREACH_NOTNEIGHBOR 2
+#endif
+#ifndef ICMP6_DST_UNREACH_BEYONDSCOPE
+# define ICMP6_DST_UNREACH_BEYONDSCOPE 2
+#endif
+#ifndef ICMP6_DST_UNREACH_ADDR
+# define ICMP6_DST_UNREACH_ADDR 3
+#endif
+#ifndef ICMP6_DST_UNREACH_NOPORT
+# define ICMP6_DST_UNREACH_NOPORT 4
+#endif
+#ifndef ICMP6_TIME_EXCEED_TRANSIT
+# define ICMP6_TIME_EXCEED_TRANSIT 0
+#endif
+#ifndef ICMP6_TIME_EXCEED_REASSEMBLY
+# define ICMP6_TIME_EXCEED_REASSEMBLY 1
+#endif
+
+#ifndef ICMP6_NI_SUCCESS
+# define ICMP6_NI_SUCCESS 0
+#endif
+#ifndef ICMP6_NI_REFUSED
+# define ICMP6_NI_REFUSED 1
+#endif
+#ifndef ICMP6_NI_UNKNOWN
+# define ICMP6_NI_UNKNOWN 2
+#endif
+
+#ifndef ICMP6_ROUTER_RENUMBERING_COMMAND
+# define ICMP6_ROUTER_RENUMBERING_COMMAND 0
+#endif
+#ifndef ICMP6_ROUTER_RENUMBERING_RESULT
+# define ICMP6_ROUTER_RENUMBERING_RESULT 1
+#endif
+#ifndef ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET
+# define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255
+#endif
+
+#ifndef ICMP6_PARAMPROB_HEADER
+# define ICMP6_PARAMPROB_HEADER 0
+#endif
+#ifndef ICMP6_PARAMPROB_NEXTHEADER
+# define ICMP6_PARAMPROB_NEXTHEADER 1
+#endif
+#ifndef ICMP6_PARAMPROB_OPTION
+# define ICMP6_PARAMPROB_OPTION 2
+#endif
+
+#ifndef ICMP6_NI_SUBJ_IPV6
+# define ICMP6_NI_SUBJ_IPV6 0
+#endif
+#ifndef ICMP6_NI_SUBJ_FQDN
+# define ICMP6_NI_SUBJ_FQDN 1
+#endif
+#ifndef ICMP6_NI_SUBJ_IPV4
+# define ICMP6_NI_SUBJ_IPV4 2
+#endif
+
+/*
+ * ECN is a new addition to TCP - RFC 2481
+ */
+#ifndef TH_ECN
+# define TH_ECN 0x40
+#endif
+#ifndef TH_CWR
+# define TH_CWR 0x80
+#endif
+#define TH_ECNALL (TH_ECN|TH_CWR)
+
+#define TCPF_ALL (TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECN|TH_CWR)
+
+#endif /* __IP_COMPAT_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c
new file mode 100644
index 0000000..6b9bafb
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_fil.c
@@ -0,0 +1,2288 @@
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+#if defined(_KERNEL) && defined(__FreeBSD_version) && \
+ (__FreeBSD_version >= 400000) && !defined(KLD_MODULE)
+#include "opt_inet6.h"
+#endif
+#include <sys/param.h>
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
+ defined(_KERNEL) && !defined(_LKM)
+# include "opt_ipfilter_log.h"
+#endif
+#if defined(__FreeBSD__) && !defined(__FreeBSD_version)
+# if !defined(_KERNEL) || defined(IPFILTER_LKM)
+# include <osreldate.h>
+# endif
+#endif
+#if defined(__sgi) && (IRIX > 602)
+# define _KMEMUSER
+# include <sys/ptimers.h>
+#endif
+#ifndef _KERNEL
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <ctype.h>
+# include <fcntl.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#if __FreeBSD_version >= 220000 && defined(_KERNEL)
+# include <sys/fcntl.h>
+# include <sys/filio.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#include <sys/time.h>
+#ifdef _KERNEL
+# include <sys/systm.h>
+#endif
+#if !SOLARIS
+# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000)
+# include <sys/dirent.h>
+# else
+# include <sys/dir.h>
+# endif
+# include <sys/mbuf.h>
+#else
+# include <sys/filio.h>
+#endif
+#include <sys/protosw.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#if __FreeBSD_version >= 300000
+# include <net/if_var.h>
+# if defined(_KERNEL) && !defined(IPFILTER_LKM)
+# include "opt_ipfilter.h"
+# endif
+# if defined(_KERNEL) && (__FreeBSD_version >= 501108) && !defined(KLD_MODULE)
+# include "opt_pfil_hooks.h"
+# endif
+#endif
+#ifdef __sgi
+#include <sys/debug.h>
+# ifdef IFF_DRVRLOCK /* IRIX6 */
+#include <sys/hashing.h>
+# endif
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#if !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /* IRIX < 6 */
+# include <netinet/in_var.h>
+#endif
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/tcpip.h>
+#include <netinet/ip_icmp.h>
+#ifndef _KERNEL
+# include <unistd.h>
+# include <syslog.h>
+#endif
+#include "netinet/ip_compat.h"
+#ifdef USE_INET6
+# include <netinet/icmp6.h>
+# if !SOLARIS
+# include <netinet6/ip6protosw.h>
+# include <netinet6/nd6.h>
+# endif
+#endif
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_proxy.h"
+#include "netinet/ip_auth.h"
+#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+#endif
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#if !SOLARIS && defined(_KERNEL) && !defined(__sgi)
+# include <sys/kernel.h>
+extern int ip_optcopy __P((struct ip *, struct ip *));
+#endif
+#if defined(OpenBSD) && (OpenBSD >= 200211) && defined(_KERNEL)
+extern int ip6_getpmtu(struct route_in6 *, struct route_in6 *,
+ struct ifnet *, struct in6_addr *, u_long *);
+#endif
+
+#include <machine/in_cksum.h>
+
+#if !defined(lint)
+static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
+/* static const char rcsid[] = "@(#)$Id: ip_fil.c,v 2.42.2.34 2001/07/23 13:49:57 darrenr Exp $"; */
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+extern struct protosw inetsw[];
+
+#ifndef _KERNEL
+# include "ipt.h"
+static struct ifnet **ifneta = NULL;
+static int nifs = 0;
+#else
+# if (BSD < 199306) || defined(__sgi)
+extern int tcp_ttl;
+# endif
+#endif
+
+#ifdef ICMP_UNREACH_FILTER_PROHIB
+int ipl_unreach = ICMP_UNREACH_FILTER_PROHIB;
+#else
+int ipl_unreach = ICMP_UNREACH_FILTER;
+#endif
+u_long ipl_frouteok[2] = {0, 0};
+
+static int frzerostats __P((caddr_t));
+#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003)
+static int frrequest __P((int, u_long, caddr_t, int));
+#else
+static int frrequest __P((int, int, caddr_t, int));
+#endif
+#ifdef _KERNEL
+static int (*fr_savep) __P((ip_t *, int, void *, int, struct mbuf **));
+static int send_ip __P((ip_t *, fr_info_t *, struct mbuf **));
+# ifdef USE_INET6
+static int ipfr_fastroute6 __P((struct mbuf *, struct mbuf **,
+ fr_info_t *, frdest_t *));
+# endif
+# ifdef __sgi
+extern int tcp_mtudisc;
+extern kmutex_t ipf_rw;
+extern KRWLOCK_T ipf_mutex;
+# endif
+#else
+void init_ifp __P((void));
+# if defined(__sgi) && (IRIX < 605)
+static int no_output __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *));
+static int write_output __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *));
+# else
+static int no_output __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *, struct rtentry *));
+static int write_output __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *, struct rtentry *));
+# endif
+#endif
+int fr_running = 0;
+
+#if (__FreeBSD_version >= 300000) && defined(_KERNEL)
+struct callout_handle ipfr_slowtimer_ch;
+#endif
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000)
+# include <sys/callout.h>
+struct callout ipfr_slowtimer_ch;
+#endif
+#if defined(__OpenBSD__)
+# include <sys/timeout.h>
+struct timeout ipfr_slowtimer_ch;
+#endif
+#if defined(__sgi) && defined(_KERNEL)
+toid_t ipfr_slowtimer_ch;
+#endif
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 106080000) && \
+ defined(_KERNEL)
+# include <sys/conf.h>
+const struct cdevsw ipl_cdevsw = {
+ iplopen, iplclose, iplread, nowrite, iplioctl,
+ nostop, notty, nopoll, nommap,
+};
+#endif
+
+#if (_BSDI_VERSION >= 199510) && defined(_KERNEL)
+# include <sys/device.h>
+# include <sys/conf.h>
+
+struct cfdriver iplcd = {
+ NULL, "ipl", NULL, NULL, DV_DULL, 0
+};
+
+struct devsw iplsw = {
+ &iplcd,
+ iplopen, iplclose, iplread, nowrite, iplioctl, noselect, nommap,
+ nostrat, nodump, nopsize, 0,
+ nostop
+};
+#endif /* _BSDI_VERSION >= 199510 && _KERNEL */
+
+#if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 500011)
+# include <sys/conf.h>
+# if defined(NETBSD_PF)
+# include <net/pfil.h>
+/*
+ * We provide the fr_checkp name just to minimize changes later.
+ */
+int (*fr_checkp) __P((ip_t *ip, int hlen, void *ifp, int out, mb_t **mp));
+# endif /* NETBSD_PF */
+#endif /* __NetBSD__ */
+
+
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105110000) && \
+ defined(_KERNEL)
+# include <net/pfil.h>
+
+static int fr_check_wrapper(void *, struct mbuf **, struct ifnet *, int );
+
+static int fr_check_wrapper(arg, mp, ifp, dir)
+void *arg;
+struct mbuf **mp;
+struct ifnet *ifp;
+int dir;
+{
+ struct ip *ip = mtod(*mp, struct ip *);
+ int rv, hlen = ip->ip_hl << 2;
+
+#if defined(M_CSUM_TCPv4)
+ /*
+ * If the packet is out-bound, we can't delay checksums
+ * here. For in-bound, the checksum has already been
+ * validated.
+ */
+ if (dir == PFIL_OUT) {
+ if ((*mp)->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) {
+ in_delayed_cksum(*mp);
+ (*mp)->m_pkthdr.csum_flags &=
+ ~(M_CSUM_TCPv4|M_CSUM_UDPv4);
+ }
+ }
+#endif /* M_CSUM_TCPv4 */
+
+ /*
+ * We get the packet with all fields in network byte
+ * order. We expect ip_len and ip_off to be in host
+ * order. We frob them, call the filter, then frob
+ * them back.
+ *
+ * Note, we don't need to update the checksum, because
+ * it has already been verified.
+ */
+ NTOHS(ip->ip_len);
+ NTOHS(ip->ip_off);
+
+ rv = fr_check(ip, hlen, ifp, (dir == PFIL_OUT), mp);
+
+ if (rv == 0 && *mp != NULL) {
+ ip = mtod(*mp, struct ip *);
+ HTONS(ip->ip_len);
+ HTONS(ip->ip_off);
+ }
+
+ return (rv);
+}
+
+# ifdef USE_INET6
+# include <netinet/ip6.h>
+
+static int fr_check_wrapper6(void *, struct mbuf **, struct ifnet *, int );
+
+static int fr_check_wrapper6(arg, mp, ifp, dir)
+void *arg;
+struct mbuf **mp;
+struct ifnet *ifp;
+int dir;
+{
+
+ return (fr_check(mtod(*mp, struct ip *), sizeof(struct ip6_hdr),
+ ifp, (dir == PFIL_OUT), mp));
+}
+# endif
+#endif /* __NetBSD_Version >= 105110000 && _KERNEL */
+#if (__FreeBSD_version >= 501108) && defined(_KERNEL)
+
+static int
+fr_check_wrapper(void *arg, struct mbuf **mp, struct ifnet *ifp, int dir)
+{
+ struct ip *ip = mtod(*mp, struct ip *);
+ return fr_check(ip, ip->ip_hl << 2, ifp, (dir == PFIL_OUT), mp);
+}
+
+# ifdef USE_INET6
+# include <netinet/ip6.h>
+
+static int
+fr_check_wrapper6(void *arg, struct mbuf **mp, struct ifnet *ifp, int dir)
+{
+ return (fr_check(mtod(*mp, struct ip *), sizeof(struct ip6_hdr),
+ ifp, (dir == PFIL_OUT), mp));
+}
+# endif
+#endif /* __FreeBSD_version >= 501108 */
+#ifdef _KERNEL
+# if defined(IPFILTER_LKM) && !defined(__sgi)
+int iplidentify(s)
+char *s;
+{
+ if (strcmp(s, "ipl") == 0)
+ return 1;
+ return 0;
+}
+# endif /* IPFILTER_LKM */
+
+
+/*
+ * Try to detect the case when compiling for NetBSD with pseudo-device
+ */
+# if defined(__NetBSD__) && defined(PFIL_HOOKS)
+void
+ipfilterattach(count)
+int count;
+{
+
+ /*
+ * Do nothing here, really. The filter will be enabled
+ * by the SIOCFRENB ioctl.
+ */
+}
+# endif
+
+
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+int ipl_enable()
+# else
+int iplattach()
+# endif
+{
+ char *defpass;
+ int s;
+# if defined(__sgi) || (defined(NETBSD_PF) && \
+ ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011)))
+ int error = 0;
+# endif
+#if (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105110000)) || \
+ (__FreeBSD_version >= 501108)
+ struct pfil_head *ph_inet;
+# ifdef USE_INET6
+ struct pfil_head *ph_inet6;
+# endif
+#endif
+
+ SPL_NET(s);
+ if (fr_running || (fr_checkp == fr_check)) {
+ printf("IP Filter: already initialized\n");
+ SPL_X(s);
+ return EBUSY;
+ }
+
+# ifdef IPFILTER_LOG
+ ipflog_init();
+# endif
+ if (nat_init() == -1) {
+ SPL_X(s);
+ return EIO;
+ }
+ if (fr_stateinit() == -1) {
+ SPL_X(s);
+ return EIO;
+ }
+ if (appr_init() == -1) {
+ SPL_X(s);
+ return EIO;
+ }
+
+# ifdef NETBSD_PF
+# if (__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011)
+# if (__NetBSD_Version__ >= 105110000) || (__FreeBSD_version >= 501108)
+ ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
+# ifdef USE_INET6
+ ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
+# endif
+ if (ph_inet == NULL
+# ifdef USE_INET6
+ && ph_inet6 == NULL
+# endif
+ )
+ return ENODEV;
+
+ if (ph_inet != NULL)
+ error = pfil_add_hook((void *)fr_check_wrapper, NULL,
+ PFIL_IN|PFIL_OUT, ph_inet);
+ else
+ error = 0;
+# else
+ error = pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
+ &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
+# endif
+ if (error) {
+# ifdef USE_INET6
+ goto pfil_error;
+# else
+ SPL_X(s);
+ appr_unload();
+ ip_natunload();
+ fr_stateunload();
+ return error;
+# endif
+ }
+# else
+ pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT);
+# endif
+# ifdef USE_INET6
+# if (__NetBSD_Version__ >= 105110000) || (__FreeBSD_version >= 501108)
+ if (ph_inet6 != NULL)
+ error = pfil_add_hook((void *)fr_check_wrapper6, NULL,
+ PFIL_IN|PFIL_OUT, ph_inet6);
+ else
+ error = 0;
+ if (error) {
+ pfil_remove_hook((void *)fr_check_wrapper6, NULL,
+ PFIL_IN|PFIL_OUT, ph_inet6);
+# else
+ error = pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
+ &inet6sw[ip6_protox[IPPROTO_IPV6]].pr_pfh);
+ if (error) {
+ pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
+ &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
+# endif
+pfil_error:
+ SPL_X(s);
+ appr_unload();
+ ip_natunload();
+ fr_stateunload();
+ return error;
+ }
+# endif
+# endif
+
+# ifdef __sgi
+ error = ipfilter_sgi_attach();
+ if (error) {
+ SPL_X(s);
+ appr_unload();
+ ip_natunload();
+ fr_stateunload();
+ return error;
+ }
+# endif
+
+ bzero((char *)frcache, sizeof(frcache));
+ fr_savep = fr_checkp;
+ fr_checkp = fr_check;
+ fr_running = 1;
+
+ SPL_X(s);
+ if (fr_pass & FR_PASS)
+ defpass = "pass";
+ else if (fr_pass & FR_BLOCK)
+ defpass = "block";
+ else
+ defpass = "no-match -> block";
+
+ printf("%s initialized. Default = %s all, Logging = %s\n",
+ ipfilter_version, defpass,
+# ifdef IPFILTER_LOG
+ "enabled");
+# else
+ "disabled");
+# endif
+#ifdef _KERNEL
+# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000)
+ callout_init(&ipfr_slowtimer_ch);
+ callout_reset(&ipfr_slowtimer_ch, hz / 2, ipfr_slowtimer, NULL);
+# else
+# if defined(__OpenBSD__)
+ timeout_set(&ipfr_slowtimer_ch, ipfr_slowtimer, NULL);
+ timeout_add(&ipfr_slowtimer_ch, hz/2);
+# else
+# if (__FreeBSD_version >= 300000) || defined(__sgi)
+ ipfr_slowtimer_ch = timeout(ipfr_slowtimer, NULL, hz/2);
+# else
+ timeout(ipfr_slowtimer, NULL, hz/2);
+# endif
+# endif
+# endif
+#endif
+ return 0;
+}
+
+
+/*
+ * Disable the filter by removing the hooks from the IP input/output
+ * stream.
+ */
+# if defined(__NetBSD__)
+int ipl_disable()
+# else
+int ipldetach()
+# endif
+{
+ int s, i;
+#if defined(NETBSD_PF) && \
+ ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011))
+ int error = 0;
+# if (__NetBSD_Version__ >= 105150000) || (__FreeBSD_version >= 501108)
+ struct pfil_head *ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
+# ifdef USE_INET6
+ struct pfil_head *ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
+# endif
+# endif
+#endif
+
+#ifdef _KERNEL
+# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000)
+ callout_stop(&ipfr_slowtimer_ch);
+# else
+# if (__FreeBSD_version >= 300000)
+ untimeout(ipfr_slowtimer, NULL, ipfr_slowtimer_ch);
+# else
+# ifdef __sgi
+ untimeout(ipfr_slowtimer_ch);
+# else
+# if defined(__OpenBSD__)
+ timeout_del(&ipfr_slowtimer_ch);
+# else
+ untimeout(ipfr_slowtimer, NULL);
+# endif /* OpenBSD */
+# endif /* __sgi */
+# endif /* FreeBSD */
+# endif /* NetBSD */
+#endif
+ SPL_NET(s);
+ if (!fr_running)
+ {
+ printf("IP Filter: not initialized\n");
+ SPL_X(s);
+ return 0;
+ }
+
+ printf("%s unloaded\n", ipfilter_version);
+
+ fr_checkp = fr_savep;
+ i = frflush(IPL_LOGIPF, 0, FR_INQUE|FR_OUTQUE|FR_INACTIVE);
+ i += frflush(IPL_LOGIPF, 0, FR_INQUE|FR_OUTQUE);
+ fr_running = 0;
+
+# ifdef NETBSD_PF
+# if ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011))
+# if (__NetBSD_Version__ >= 105110000) || (__FreeBSD_version >= 501108)
+ if (ph_inet != NULL)
+ error = pfil_remove_hook((void *)fr_check_wrapper, NULL,
+ PFIL_IN|PFIL_OUT, ph_inet);
+ else
+ error = 0;
+# else
+ error = pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
+ &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
+# endif
+ if (error) {
+ SPL_X(s);
+ return error;
+ }
+# else
+ pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT);
+# endif
+# ifdef USE_INET6
+# if (__NetBSD_Version__ >= 105110000) || (__FreeBSD_version >= 501108)
+ if (ph_inet6 != NULL)
+ error = pfil_remove_hook((void *)fr_check_wrapper6, NULL,
+ PFIL_IN|PFIL_OUT, ph_inet6);
+ else
+ error = 0;
+# else
+ error = pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
+ &inet6sw[ip6_protox[IPPROTO_IPV6]].pr_pfh);
+# endif
+ if (error) {
+ SPL_X(s);
+ return error;
+ }
+# endif
+# endif
+
+# ifdef __sgi
+ ipfilter_sgi_detach();
+# endif
+
+ appr_unload();
+ ipfr_unload();
+ ip_natunload();
+ fr_stateunload();
+ fr_authunload();
+
+ SPL_X(s);
+ return 0;
+}
+#endif /* _KERNEL */
+
+
+static int frzerostats(data)
+caddr_t data;
+{
+ friostat_t fio;
+ int error;
+
+ fr_getstat(&fio);
+ error = IWCOPYPTR((caddr_t)&fio, data, sizeof(fio));
+ if (error)
+ return EFAULT;
+
+ bzero((char *)frstats, sizeof(*frstats) * 2);
+
+ return 0;
+}
+
+
+/*
+ * Filter ioctl interface.
+ */
+#ifdef __sgi
+int IPL_EXTERN(ioctl)(dev_t dev, int cmd, caddr_t data, int mode
+# ifdef _KERNEL
+ , cred_t *cp, int *rp
+# endif
+)
+#else
+int IPL_EXTERN(ioctl)(dev, cmd, data, mode
+# if (defined(_KERNEL) && ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || \
+ (NetBSD >= 199511) || (__FreeBSD_version >= 220000) || \
+ defined(__OpenBSD__)))
+, td)
+struct thread *td;
+# else
+)
+# endif
+dev_t dev;
+# if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)
+u_long cmd;
+# else
+int cmd;
+# endif
+caddr_t data;
+int mode;
+#endif /* __sgi */
+{
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+ int error = 0, unit = 0, tmp;
+
+#if (BSD >= 199306) && defined(_KERNEL)
+ if ((securelevel >= 3) && (mode & FWRITE))
+ return EPERM;
+#endif
+#ifdef _KERNEL
+ unit = GET_MINOR(dev);
+ if ((IPL_LOGMAX < unit) || (unit < 0))
+ return ENXIO;
+#else
+ unit = dev;
+#endif
+
+ if (fr_running == 0 && (cmd != SIOCFRENB || unit != IPL_LOGIPF))
+ return ENODEV;
+
+ SPL_NET(s);
+
+ if (unit == IPL_LOGNAT) {
+ if (fr_running)
+ error = nat_ioctl(data, cmd, mode);
+ else
+ error = EIO;
+ SPL_X(s);
+ return error;
+ }
+ if (unit == IPL_LOGSTATE) {
+ if (fr_running)
+ error = fr_state_ioctl(data, cmd, mode);
+ else
+ error = EIO;
+ SPL_X(s);
+ return error;
+ }
+ if (unit == IPL_LOGAUTH) {
+ if (!fr_running)
+ error = EIO;
+ else
+ if ((cmd == SIOCADAFR) || (cmd == SIOCRMAFR)) {
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ } else {
+ error = frrequest(unit, cmd, data,
+ fr_active);
+ }
+ } else {
+ error = fr_auth_ioctl(data, mode, cmd);
+ }
+ SPL_X(s);
+ return error;
+ }
+
+ switch (cmd) {
+ case FIONREAD :
+#ifdef IPFILTER_LOG
+ error = IWCOPY((caddr_t)&iplused[IPL_LOGIPF], (caddr_t)data,
+ sizeof(iplused[IPL_LOGIPF]));
+#endif
+ break;
+#if (!defined(IPFILTER_LKM) || defined(__NetBSD__)) && defined(_KERNEL)
+ case SIOCFRENB :
+ {
+ u_int enable;
+
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ error = IRCOPY(data, (caddr_t)&enable, sizeof(enable));
+ if (error)
+ break;
+ if (enable)
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ error = ipl_enable();
+# else
+ error = iplattach();
+# endif
+ else
+# if defined(__NetBSD__)
+ error = ipl_disable();
+# else
+ error = ipldetach();
+# endif
+ }
+ break;
+ }
+#endif
+ case SIOCSETFF :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else
+ error = IRCOPY(data, (caddr_t)&fr_flags,
+ sizeof(fr_flags));
+ break;
+ case SIOCGETFF :
+ error = IWCOPY((caddr_t)&fr_flags, data, sizeof(fr_flags));
+ break;
+ case SIOCINAFR :
+ case SIOCRMAFR :
+ case SIOCADAFR :
+ case SIOCZRLST :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else
+ error = frrequest(unit, cmd, data, fr_active);
+ break;
+ case SIOCINIFR :
+ case SIOCRMIFR :
+ case SIOCADIFR :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else
+ error = frrequest(unit, cmd, data, 1 - fr_active);
+ break;
+ case SIOCSWAPA :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ bzero((char *)frcache, sizeof(frcache[0]) * 2);
+ *(u_int *)data = fr_active;
+ fr_active = 1 - fr_active;
+ }
+ break;
+ case SIOCGETFS :
+ {
+ friostat_t fio;
+
+ fr_getstat(&fio);
+ error = IWCOPYPTR((caddr_t)&fio, data, sizeof(fio));
+ if (error)
+ error = EFAULT;
+ break;
+ }
+ case SIOCFRZST :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else
+ error = frzerostats(data);
+ break;
+ case SIOCIPFFL :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ error = IRCOPY(data, (caddr_t)&tmp, sizeof(tmp));
+ if (!error) {
+ tmp = frflush(unit, 4, tmp);
+ error = IWCOPY((caddr_t)&tmp, data,
+ sizeof(tmp));
+ }
+ }
+ break;
+#ifdef USE_INET6
+ case SIOCIPFL6 :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ error = IRCOPY(data, (caddr_t)&tmp, sizeof(tmp));
+ if (!error) {
+ tmp = frflush(unit, 6, tmp);
+ error = IWCOPY((caddr_t)&tmp, data,
+ sizeof(tmp));
+ }
+ }
+ break;
+#endif
+ case SIOCSTLCK :
+ error = IRCOPY(data, (caddr_t)&tmp, sizeof(tmp));
+ if (!error) {
+ fr_state_lock = tmp;
+ fr_nat_lock = tmp;
+ fr_frag_lock = tmp;
+ fr_auth_lock = tmp;
+ } else
+ error = EFAULT;
+ break;
+#ifdef IPFILTER_LOG
+ case SIOCIPFFB :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else
+ *(int *)data = ipflog_clear(unit);
+ break;
+#endif /* IPFILTER_LOG */
+ case SIOCGFRST :
+ error = IWCOPYPTR((caddr_t)ipfr_fragstats(), data,
+ sizeof(ipfrstat_t));
+ if (error)
+ error = EFAULT;
+ break;
+ case SIOCFRSYN :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+#if defined(_KERNEL) && defined(__sgi)
+ ipfsync();
+#endif
+ frsync();
+ }
+ break;
+ default :
+ error = EINVAL;
+ break;
+ }
+ SPL_X(s);
+ return error;
+}
+
+
+void fr_forgetifp(ifp)
+void *ifp;
+{
+ register frentry_t *f;
+
+ WRITE_ENTER(&ipf_mutex);
+ for (f = ipacct[0][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipacct[1][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipfilter[0][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipfilter[1][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+#ifdef USE_INET6
+ for (f = ipacct6[0][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipacct6[1][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipfilter6[0][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+ for (f = ipfilter6[1][fr_active]; (f != NULL); f = f->fr_next)
+ if (f->fr_ifa == ifp)
+ f->fr_ifa = (void *)-1;
+#endif
+ RWLOCK_EXIT(&ipf_mutex);
+ ip_natsync(ifp);
+}
+
+
+static int frrequest(unit, req, data, set)
+int unit;
+#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003)
+u_long req;
+#else
+int req;
+#endif
+int set;
+caddr_t data;
+{
+ register frentry_t *fp, *f, **fprev;
+ register frentry_t **ftail;
+ frgroup_t *fg = NULL;
+ int error = 0, in, i;
+ u_int *p, *pp;
+ frentry_t frd;
+ frdest_t *fdp;
+ u_int group;
+
+ fp = &frd;
+ error = IRCOPYPTR(data, (caddr_t)fp, sizeof(*fp));
+ if (error)
+ return EFAULT;
+ fp->fr_ref = 0;
+#if (BSD >= 199306) && defined(_KERNEL)
+ if ((securelevel > 0) && (fp->fr_func != NULL))
+ return EPERM;
+#endif
+
+ /*
+ * Check that the group number does exist and that if a head group
+ * has been specified, doesn't exist.
+ */
+ if ((req != SIOCZRLST) && ((req == SIOCINAFR) || (req == SIOCINIFR) ||
+ (req == SIOCADAFR) || (req == SIOCADIFR)) && fp->fr_grhead &&
+ fr_findgroup((u_int)fp->fr_grhead, fp->fr_flags, unit, set, NULL))
+ return EEXIST;
+ if ((req != SIOCZRLST) && fp->fr_group &&
+ !fr_findgroup((u_int)fp->fr_group, fp->fr_flags, unit, set, NULL))
+ return ESRCH;
+
+ in = (fp->fr_flags & FR_INQUE) ? 0 : 1;
+
+ if (unit == IPL_LOGAUTH)
+ ftail = fprev = &ipauth;
+ else if ((fp->fr_flags & FR_ACCOUNT) && (fp->fr_v == 4))
+ ftail = fprev = &ipacct[in][set];
+ else if ((fp->fr_flags & (FR_OUTQUE|FR_INQUE)) && (fp->fr_v == 4))
+ ftail = fprev = &ipfilter[in][set];
+#ifdef USE_INET6
+ else if ((fp->fr_flags & FR_ACCOUNT) && (fp->fr_v == 6))
+ ftail = fprev = &ipacct6[in][set];
+ else if ((fp->fr_flags & (FR_OUTQUE|FR_INQUE)) && (fp->fr_v == 6))
+ ftail = fprev = &ipfilter6[in][set];
+#endif
+ else
+ return ESRCH;
+
+ if ((group = fp->fr_group)) {
+ if (!(fg = fr_findgroup(group, fp->fr_flags, unit, set, NULL)))
+ return ESRCH;
+ ftail = fprev = fg->fg_start;
+ }
+
+ bzero((char *)frcache, sizeof(frcache[0]) * 2);
+
+ for (i = 0; i < 4; i++) {
+ if ((fp->fr_ifnames[i][1] == '\0') &&
+ ((fp->fr_ifnames[i][0] == '-') ||
+ (fp->fr_ifnames[i][0] == '*'))) {
+ fp->fr_ifas[i] = NULL;
+ } else if (*fp->fr_ifnames[i]) {
+ fp->fr_ifas[i] = GETUNIT(fp->fr_ifnames[i], fp->fr_v);
+ if (!fp->fr_ifas[i])
+ fp->fr_ifas[i] = (void *)-1;
+ }
+ }
+
+ fdp = &fp->fr_dif;
+ fp->fr_flags &= ~FR_DUP;
+ if (*fdp->fd_ifname) {
+ fdp->fd_ifp = GETUNIT(fdp->fd_ifname, fp->fr_v);
+ if (!fdp->fd_ifp)
+ fdp->fd_ifp = (struct ifnet *)-1;
+ else
+ fp->fr_flags |= FR_DUP;
+ }
+
+ fdp = &fp->fr_tif;
+ if (*fdp->fd_ifname) {
+ fdp->fd_ifp = GETUNIT(fdp->fd_ifname, fp->fr_v);
+ if (!fdp->fd_ifp)
+ fdp->fd_ifp = (struct ifnet *)-1;
+ }
+
+ /*
+ * Look for a matching filter rule, but don't include the next or
+ * interface pointer in the comparison (fr_next, fr_ifa).
+ */
+ for (fp->fr_cksum = 0, p = (u_int *)&fp->fr_ip, pp = &fp->fr_cksum;
+ p < pp; p++)
+ fp->fr_cksum += *p;
+
+ for (; (f = *ftail); ftail = &f->fr_next)
+ if ((fp->fr_cksum == f->fr_cksum) &&
+ !bcmp((char *)&f->fr_ip, (char *)&fp->fr_ip, FR_CMPSIZ))
+ break;
+
+ /*
+ * If zero'ing statistics, copy current to caller and zero.
+ */
+ if (req == SIOCZRLST) {
+ if (!f)
+ return ESRCH;
+ error = IWCOPYPTR((caddr_t)f, data, sizeof(*f));
+ if (error)
+ return EFAULT;
+ f->fr_hits = 0;
+ f->fr_bytes = 0;
+ return 0;
+ }
+
+ if (!f) {
+ if (req != SIOCINAFR && req != SIOCINIFR)
+ while ((f = *ftail))
+ ftail = &f->fr_next;
+ else {
+ if (fp->fr_hits) {
+ ftail = fprev;
+ while (--fp->fr_hits && (f = *ftail))
+ ftail = &f->fr_next;
+ }
+ f = NULL;
+ }
+ }
+
+ if (req == SIOCRMAFR || req == SIOCRMIFR) {
+ if (!f)
+ error = ESRCH;
+ else {
+ /*
+ * Only return EBUSY if there is a group list, else
+ * it's probably just state information referencing
+ * the rule.
+ */
+ if ((f->fr_ref > 1) && f->fr_grp)
+ return EBUSY;
+ if (fg && fg->fg_head)
+ fg->fg_head->fr_ref--;
+ if (unit == IPL_LOGAUTH) {
+ return fr_preauthcmd(req, f, ftail);
+ }
+ if (f->fr_grhead)
+ fr_delgroup((u_int)f->fr_grhead, fp->fr_flags,
+ unit, set);
+ fixskip(fprev, f, -1);
+ *ftail = f->fr_next;
+ f->fr_next = NULL;
+ f->fr_ref--;
+ if (f->fr_ref == 0)
+ KFREE(f);
+ }
+ } else {
+ if (f)
+ error = EEXIST;
+ else {
+ if (unit == IPL_LOGAUTH) {
+ return fr_preauthcmd(req, fp, ftail);
+ }
+ KMALLOC(f, frentry_t *);
+ if (f != NULL) {
+ if (fg && fg->fg_head)
+ fg->fg_head->fr_ref++;
+ bcopy((char *)fp, (char *)f, sizeof(*f));
+ f->fr_ref = 1;
+ f->fr_hits = 0;
+ f->fr_next = *ftail;
+ *ftail = f;
+ if (req == SIOCINIFR || req == SIOCINAFR)
+ fixskip(fprev, f, 1);
+ f->fr_grp = NULL;
+ if ((group = f->fr_grhead))
+ fg = fr_addgroup(group, f, unit, set);
+ } else
+ error = ENOMEM;
+ }
+ }
+ return (error);
+}
+
+
+#ifdef _KERNEL
+/*
+ * routines below for saving IP headers to buffer
+ */
+# ifdef __sgi
+# ifdef _KERNEL
+int IPL_EXTERN(open)(dev_t *pdev, int flags, int devtype, cred_t *cp)
+# else
+int IPL_EXTERN(open)(dev_t dev, int flags)
+# endif
+# else
+int IPL_EXTERN(open)(dev, flags
+# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \
+ (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL)
+, devtype, td)
+int devtype;
+struct thread *td;
+# else
+)
+# endif
+dev_t dev;
+int flags;
+# endif /* __sgi */
+{
+# if defined(__sgi) && defined(_KERNEL)
+ u_int min = geteminor(*pdev);
+# else
+ u_int min = GET_MINOR(dev);
+# endif
+
+ if (IPL_LOGMAX < min)
+ min = ENXIO;
+ else
+ min = 0;
+ return min;
+}
+
+
+# ifdef __sgi
+int IPL_EXTERN(close)(dev_t dev, int flags, int devtype, cred_t *cp)
+#else
+int IPL_EXTERN(close)(dev, flags
+# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \
+ (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL)
+, devtype, td)
+int devtype;
+struct thread *td;
+# else
+)
+# endif
+dev_t dev;
+int flags;
+# endif /* __sgi */
+{
+ u_int min = GET_MINOR(dev);
+
+ if (IPL_LOGMAX < min)
+ min = ENXIO;
+ else
+ min = 0;
+ return min;
+}
+
+/*
+ * iplread/ipllog
+ * both of these must operate with at least splnet() lest they be
+ * called during packet processing and cause an inconsistancy to appear in
+ * the filter lists.
+ */
+# ifdef __sgi
+int IPL_EXTERN(read)(dev_t dev, uio_t *uio, cred_t *crp)
+# else
+# if BSD >= 199306
+int IPL_EXTERN(read)(dev, uio, ioflag)
+int ioflag;
+# else
+int IPL_EXTERN(read)(dev, uio)
+# endif
+dev_t dev;
+register struct uio *uio;
+# endif /* __sgi */
+{
+# ifdef IPFILTER_LOG
+ return ipflog_read(GET_MINOR(dev), uio);
+# else
+ return ENXIO;
+# endif
+}
+
+
+/*
+ * send_reset - this could conceivably be a call to tcp_respond(), but that
+ * requires a large amount of setting up and isn't any more efficient.
+ */
+int send_reset(oip, fin)
+struct ip *oip;
+fr_info_t *fin;
+{
+ struct tcphdr *tcp, *tcp2;
+ int tlen = 0, hlen;
+ struct mbuf *m;
+#ifdef USE_INET6
+ ip6_t *ip6, *oip6 = (ip6_t *)oip;
+#endif
+ ip_t *ip;
+
+ tcp = (struct tcphdr *)fin->fin_dp;
+ if (tcp->th_flags & TH_RST)
+ return -1; /* feedback loop */
+# if (BSD < 199306) || defined(__sgi)
+ m = m_get(M_DONTWAIT, MT_HEADER);
+# else
+ m = m_gethdr(M_DONTWAIT, MT_HEADER);
+# endif
+ if (m == NULL)
+ return ENOBUFS;
+ if (m == NULL)
+ return -1;
+
+ tlen = fin->fin_dlen - (tcp->th_off << 2) +
+ ((tcp->th_flags & TH_SYN) ? 1 : 0) +
+ ((tcp->th_flags & TH_FIN) ? 1 : 0);
+
+#ifdef USE_INET6
+ hlen = (fin->fin_v == 6) ? sizeof(ip6_t) : sizeof(ip_t);
+#else
+ hlen = sizeof(ip_t);
+#endif
+ m->m_len = sizeof(*tcp2) + hlen;
+# if BSD >= 199306
+ m->m_data += max_linkhdr;
+ m->m_pkthdr.len = m->m_len;
+ m->m_pkthdr.rcvif = (struct ifnet *)0;
+# endif
+ ip = mtod(m, struct ip *);
+# ifdef USE_INET6
+ ip6 = (ip6_t *)ip;
+# endif
+ bzero((char *)ip, sizeof(*tcp2) + hlen);
+ tcp2 = (struct tcphdr *)((char *)ip + hlen);
+
+ tcp2->th_sport = tcp->th_dport;
+ tcp2->th_dport = tcp->th_sport;
+ if (tcp->th_flags & TH_ACK) {
+ tcp2->th_seq = tcp->th_ack;
+ tcp2->th_flags = TH_RST;
+ } else {
+ tcp2->th_ack = ntohl(tcp->th_seq);
+ tcp2->th_ack += tlen;
+ tcp2->th_ack = htonl(tcp2->th_ack);
+ tcp2->th_flags = TH_RST|TH_ACK;
+ }
+ tcp2->th_off = sizeof(*tcp2) >> 2;
+# ifdef USE_INET6
+ if (fin->fin_v == 6) {
+ ip6->ip6_plen = htons(sizeof(struct tcphdr));
+ ip6->ip6_nxt = IPPROTO_TCP;
+ ip6->ip6_src = oip6->ip6_dst;
+ ip6->ip6_dst = oip6->ip6_src;
+ tcp2->th_sum = in6_cksum(m, IPPROTO_TCP,
+ sizeof(*ip6), sizeof(*tcp2));
+ return send_ip(oip, fin, &m);
+ }
+# endif
+ ip->ip_p = IPPROTO_TCP;
+ ip->ip_len = htons(sizeof(struct tcphdr));
+ ip->ip_src.s_addr = oip->ip_dst.s_addr;
+ ip->ip_dst.s_addr = oip->ip_src.s_addr;
+ tcp2->th_sum = in_cksum(m, hlen + sizeof(*tcp2));
+ ip->ip_len = hlen + sizeof(*tcp2);
+ return send_ip(oip, fin, &m);
+}
+
+
+/*
+ * Send an IP(v4/v6) datagram out into the network
+ */
+static int send_ip(oip, fin, mp)
+ip_t *oip;
+fr_info_t *fin;
+struct mbuf **mp;
+{
+ struct mbuf *m = *mp;
+ int error, hlen;
+ fr_info_t frn;
+ ip_t *ip;
+
+ bzero((char *)&frn, sizeof(frn));
+ frn.fin_ifp = fin->fin_ifp;
+ frn.fin_v = fin->fin_v;
+ frn.fin_out = fin->fin_out;
+ frn.fin_mp = fin->fin_mp;
+
+ ip = mtod(m, ip_t *);
+ hlen = sizeof(*ip);
+
+ ip->ip_v = fin->fin_v;
+ if (ip->ip_v == 4) {
+ ip->ip_hl = (sizeof(*oip) >> 2);
+ ip->ip_v = IPVERSION;
+ ip->ip_tos = oip->ip_tos;
+ ip->ip_id = oip->ip_id;
+
+# if defined(__NetBSD__) || \
+ (defined(__OpenBSD__) && (OpenBSD >= 200012))
+ if (ip_mtudisc != 0)
+ ip->ip_off = IP_DF;
+# else
+# if defined(__sgi)
+ if (ip->ip_p == IPPROTO_TCP && tcp_mtudisc != 0)
+ ip->ip_off = IP_DF;
+# endif
+# endif
+
+# if (BSD < 199306) || defined(__sgi)
+ ip->ip_ttl = tcp_ttl;
+# else
+ ip->ip_ttl = ip_defttl;
+# endif
+ ip->ip_sum = 0;
+ frn.fin_dp = (char *)(ip + 1);
+ }
+# ifdef USE_INET6
+ else if (ip->ip_v == 6) {
+ ip6_t *ip6 = (ip6_t *)ip;
+
+ hlen = sizeof(*ip6);
+ ip6->ip6_hlim = 127;
+ frn.fin_dp = (char *)(ip6 + 1);
+ }
+# endif
+# ifdef IPSEC
+ m->m_pkthdr.rcvif = NULL;
+# endif
+
+ fr_makefrip(hlen, ip, &frn);
+
+ error = ipfr_fastroute(m, mp, &frn, NULL);
+ return error;
+}
+
+
+int send_icmp_err(oip, type, fin, dst)
+ip_t *oip;
+int type;
+fr_info_t *fin;
+int dst;
+{
+ int err, hlen = 0, xtra = 0, iclen, ohlen = 0, avail, code;
+ u_short shlen, slen = 0, soff = 0;
+ struct in_addr dst4;
+ struct icmp *icmp;
+ struct mbuf *m;
+ void *ifp;
+#ifdef USE_INET6
+ ip6_t *ip6, *oip6 = (ip6_t *)oip;
+ struct in6_addr dst6;
+#endif
+ ip_t *ip;
+
+ if ((type < 0) || (type > ICMP_MAXTYPE))
+ return -1;
+
+ code = fin->fin_icode;
+#ifdef USE_INET6
+ if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int)))
+ return -1;
+#endif
+
+ avail = 0;
+ m = NULL;
+ ifp = fin->fin_ifp;
+ if (fin->fin_v == 4) {
+ if ((oip->ip_p == IPPROTO_ICMP) &&
+ !(fin->fin_fi.fi_fl & FI_SHORT))
+ switch (ntohs(fin->fin_data[0]) >> 8)
+ {
+ case ICMP_ECHO :
+ case ICMP_TSTAMP :
+ case ICMP_IREQ :
+ case ICMP_MASKREQ :
+ break;
+ default :
+ return 0;
+ }
+
+# if (BSD < 199306) || defined(__sgi)
+ avail = MLEN;
+ m = m_get(M_DONTWAIT, MT_HEADER);
+# else
+ avail = MHLEN;
+ m = m_gethdr(M_DONTWAIT, MT_HEADER);
+# endif
+ if (m == NULL)
+ return ENOBUFS;
+
+ if (dst == 0) {
+ if (fr_ifpaddr(4, ifp, &dst4) == -1)
+ return -1;
+ } else
+ dst4.s_addr = oip->ip_dst.s_addr;
+
+ hlen = sizeof(ip_t);
+ ohlen = oip->ip_hl << 2;
+ xtra = 8;
+ }
+
+#ifdef USE_INET6
+ else if (fin->fin_v == 6) {
+ hlen = sizeof(ip6_t);
+ ohlen = sizeof(ip6_t);
+ type = icmptoicmp6types[type];
+ if (type == ICMP6_DST_UNREACH)
+ code = icmptoicmp6unreach[code];
+
+ MGETHDR(m, M_DONTWAIT, MT_HEADER);
+ if (!m)
+ return ENOBUFS;
+
+ MCLGET(m, M_DONTWAIT);
+ if ((m->m_flags & M_EXT) == 0) {
+ m_freem(m);
+ return ENOBUFS;
+ }
+# ifdef M_TRAILINGSPACE
+ m->m_len = 0;
+ avail = M_TRAILINGSPACE(m);
+# else
+ avail = MCLBYTES;
+# endif
+ xtra = MIN(ntohs(oip6->ip6_plen) + sizeof(ip6_t),
+ avail - hlen - sizeof(*icmp) - max_linkhdr);
+ if (dst == 0) {
+ if (fr_ifpaddr(6, ifp, (struct in_addr *)&dst6) == -1)
+ return -1;
+ } else
+ dst6 = oip6->ip6_dst;
+ }
+#endif
+
+ iclen = hlen + sizeof(*icmp);
+# if BSD >= 199306
+ avail -= (max_linkhdr + iclen);
+ m->m_data += max_linkhdr;
+ m->m_pkthdr.rcvif = (struct ifnet *)0;
+ if (xtra > avail)
+ xtra = avail;
+ iclen += xtra;
+ m->m_pkthdr.len = iclen;
+#else
+ avail -= (m->m_off + iclen);
+ if (xtra > avail)
+ xtra = avail;
+ iclen += xtra;
+#endif
+ m->m_len = iclen;
+ ip = mtod(m, ip_t *);
+ icmp = (struct icmp *)((char *)ip + hlen);
+ bzero((char *)ip, iclen);
+
+ icmp->icmp_type = type;
+ icmp->icmp_code = fin->fin_icode;
+ icmp->icmp_cksum = 0;
+#ifdef icmp_nextmtu
+ if (type == ICMP_UNREACH &&
+ fin->fin_icode == ICMP_UNREACH_NEEDFRAG && ifp)
+ icmp->icmp_nextmtu = htons(((struct ifnet *) ifp)->if_mtu);
+#endif
+
+ if (avail) {
+ bcopy((char *)oip, (char *)&icmp->icmp_ip, MIN(ohlen, avail));
+ avail -= MIN(ohlen, avail);
+ }
+
+#ifdef USE_INET6
+ ip6 = (ip6_t *)ip;
+ if (fin->fin_v == 6) {
+ ip6->ip6_flow = 0;
+ ip6->ip6_plen = htons(iclen - hlen);
+ ip6->ip6_nxt = IPPROTO_ICMPV6;
+ ip6->ip6_hlim = 0;
+ ip6->ip6_src = dst6;
+ ip6->ip6_dst = oip6->ip6_src;
+ if (avail)
+ bcopy((char *)oip + ohlen,
+ (char *)&icmp->icmp_ip + ohlen, avail);
+ icmp->icmp_cksum = in6_cksum(m, IPPROTO_ICMPV6,
+ sizeof(*ip6), iclen - hlen);
+ } else
+#endif
+ {
+ slen = oip->ip_len;
+ oip->ip_len = htons(oip->ip_len);
+ soff = oip->ip_off;
+ oip->ip_off = htons(ip->ip_off);
+
+ ip->ip_src.s_addr = dst4.s_addr;
+ ip->ip_dst.s_addr = oip->ip_src.s_addr;
+
+ if (avail > 8)
+ avail = 8;
+ if (avail)
+ bcopy((char *)oip + ohlen,
+ (char *)&icmp->icmp_ip + ohlen, avail);
+ icmp->icmp_cksum = ipf_cksum((u_short *)icmp,
+ sizeof(*icmp) + 8);
+ ip->ip_len = iclen;
+ ip->ip_p = IPPROTO_ICMP;
+ }
+
+ shlen = fin->fin_hlen;
+ fin->fin_hlen = hlen;
+ err = send_ip(oip, fin, &m);
+ fin->fin_hlen = shlen;
+#ifdef USE_INET6
+ if (fin->fin_v == 4)
+#endif
+ {
+ oip->ip_len = slen;
+ oip->ip_off = soff;
+ }
+ return err;
+}
+
+
+# if !defined(IPFILTER_LKM) && !defined(__sgi) && \
+ (!defined(__FreeBSD_version) || (__FreeBSD_version < 300000))
+# if (BSD < 199306)
+int iplinit __P((void));
+
+int
+# else
+void iplinit __P((void));
+
+void
+# endif
+iplinit()
+{
+
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ if (ipl_enable() != 0)
+# else
+ if (iplattach() != 0)
+# endif
+ {
+ printf("IP Filter failed to attach\n");
+ }
+ ip_init();
+}
+# endif /* ! __NetBSD__ */
+
+
+/*
+ * Return the length of the entire mbuf.
+ */
+size_t mbufchainlen(m0)
+register struct mbuf *m0;
+{
+#if BSD >= 199306
+ return m0->m_pkthdr.len;
+#else
+ register size_t len = 0;
+
+ for (; m0; m0 = m0->m_next)
+ len += m0->m_len;
+ return len;
+#endif
+}
+
+
+int ipfr_fastroute(m0, mpp, fin, fdp)
+struct mbuf *m0, **mpp;
+fr_info_t *fin;
+frdest_t *fdp;
+{
+ register struct ip *ip, *mhip;
+ register struct mbuf *m = m0;
+ register struct route *ro;
+ int len, off, error = 0, hlen, code;
+ struct ifnet *ifp, *sifp;
+ struct sockaddr_in *dst;
+ struct route iproute;
+ frentry_t *fr;
+
+ ip = NULL;
+ ro = NULL;
+ ifp = NULL;
+ ro = &iproute;
+ ro->ro_rt = NULL;
+
+#ifdef USE_INET6
+ if (fin->fin_v == 6) {
+ error = ipfr_fastroute6(m0, mpp, fin, fdp);
+ if (error != 0)
+ goto bad;
+ goto done;
+ }
+#else
+ if (fin->fin_v == 6)
+ goto bad;
+#endif
+
+#ifdef M_WRITABLE
+ /*
+ * HOT FIX/KLUDGE:
+ *
+ * If the mbuf we're about to send is not writable (because of
+ * a cluster reference, for example) we'll need to make a copy
+ * of it since this routine modifies the contents.
+ *
+ * If you have non-crappy network hardware that can transmit data
+ * from the mbuf, rather than making a copy, this is gonna be a
+ * problem.
+ */
+ if (M_WRITABLE(m) == 0) {
+ if ((m0 = m_dup(m, M_DONTWAIT)) != NULL) {
+ m_freem(*mpp);
+ *mpp = m0;
+ m = m0;
+ } else {
+ error = ENOBUFS;
+ m_freem(*mpp);
+ goto done;
+ }
+ }
+#endif
+
+ hlen = fin->fin_hlen;
+ ip = mtod(m0, struct ip *);
+
+#if defined(__NetBSD__) && defined(M_CSUM_IPv4)
+ /*
+ * Clear any in-bound checksum flags for this packet.
+ */
+# if (__NetBSD_Version__ > 105009999)
+ m0->m_pkthdr.csum_flags = 0;
+# else
+ m0->m_pkthdr.csuminfo = 0;
+# endif
+#endif /* __NetBSD__ && M_CSUM_IPv4 */
+
+ /*
+ * Route packet.
+ */
+#if defined(__sgi) && (IRIX >= 605)
+ ROUTE_RDLOCK();
+#endif
+ bzero((caddr_t)ro, sizeof (*ro));
+ dst = (struct sockaddr_in *)&ro->ro_dst;
+ dst->sin_family = AF_INET;
+ dst->sin_addr = ip->ip_dst;
+
+ fr = fin->fin_fr;
+ if (fdp != NULL)
+ ifp = fdp->fd_ifp;
+ else
+ ifp = fin->fin_ifp;
+
+ /*
+ * In case we're here due to "to <if>" being used with "keep state",
+ * check that we're going in the correct direction.
+ */
+ if ((fr != NULL) && (fin->fin_rev != 0)) {
+ if ((ifp != NULL) && (fdp == &fr->fr_tif))
+ return 0;
+ } else if (fdp != NULL) {
+ if (fdp->fd_ip.s_addr != 0)
+ dst->sin_addr = fdp->fd_ip;
+ }
+
+# if BSD >= 199306
+ dst->sin_len = sizeof(*dst);
+# endif
+# if (BSD >= 199306) && !defined(__NetBSD__) && !defined(__bsdi__) && \
+ !defined(__OpenBSD__)
+# ifdef RTF_CLONING
+ rtalloc_ign(ro, RTF_CLONING);
+# else
+ rtalloc_ign(ro, RTF_PRCLONING);
+# endif
+# else
+ rtalloc(ro);
+# endif
+
+#if defined(__sgi) && (IRIX > 602)
+ ROUTE_UNLOCK();
+#endif
+
+ if (!ifp) {
+ if (!fr || !(fr->fr_flags & FR_FASTROUTE)) {
+ error = -2;
+ goto bad;
+ }
+ }
+
+ if ((ifp == NULL) && (ro->ro_rt != NULL))
+ ifp = ro->ro_rt->rt_ifp;
+
+ if ((ro->ro_rt == NULL) || (ifp == NULL)) {
+ if (in_localaddr(ip->ip_dst))
+ error = EHOSTUNREACH;
+ else
+ error = ENETUNREACH;
+ goto bad;
+ }
+
+ if (ro->ro_rt->rt_flags & RTF_GATEWAY) {
+#if BSD >= 199306
+ dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway;
+#else
+ dst = (struct sockaddr_in *)&ro->ro_rt->rt_gateway;
+#endif
+ }
+ ro->ro_rt->rt_use++;
+
+ /*
+ * For input packets which are being "fastrouted", they won't
+ * go back through output filtering and miss their chance to get
+ * NAT'd and counted.
+ */
+ if (fin->fin_out == 0) {
+ sifp = fin->fin_ifp;
+ fin->fin_ifp = ifp;
+ fin->fin_out = 1;
+ if ((fin->fin_fr = ipacct[1][fr_active]) &&
+ (fr_scanlist(FR_NOMATCH, ip, fin, m) & FR_ACCOUNT)) {
+ ATOMIC_INCL(frstats[1].fr_acct);
+ }
+ fin->fin_fr = NULL;
+ if (!fr || !(fr->fr_flags & FR_RETMASK))
+ (void) fr_checkstate(ip, fin);
+ (void) ip_natout(ip, fin);
+ fin->fin_ifp = sifp;
+ } else
+ ip->ip_sum = 0;
+ /*
+ * If small enough for interface, can just send directly.
+ */
+ if (ip->ip_len <= ifp->if_mtu) {
+# ifndef sparc
+# if (!defined(__FreeBSD__) && !(_BSDI_VERSION >= 199510)) && \
+ !(__NetBSD_Version__ >= 105110000)
+ ip->ip_id = htons(ip->ip_id);
+# endif
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
+# endif
+# if defined(__NetBSD__) && defined(M_CSUM_IPv4)
+# if (__NetBSD_Version__ > 105009999)
+ if (ifp->if_csum_flags_tx & IFCAP_CSUM_IPv4)
+ m->m_pkthdr.csum_flags |= M_CSUM_IPv4;
+ else if (ip->ip_sum == 0)
+ ip->ip_sum = in_cksum(m, hlen);
+# else
+ if (ifp->if_capabilities & IFCAP_CSUM_IPv4)
+ m->m_pkthdr.csuminfo |= M_CSUM_IPv4;
+ else if (ip->ip_sum == 0)
+ ip->ip_sum = in_cksum(m, hlen);
+# endif
+# else
+ if (!ip->ip_sum)
+ ip->ip_sum = in_cksum(m, hlen);
+# endif /* __NetBSD__ && M_CSUM_IPv4 */
+# if (BSD >= 199306) || (defined(IRIX) && (IRIX >= 605))
+ error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst,
+ ro->ro_rt);
+# else
+ error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst);
+# endif
+ goto done;
+ }
+
+ /*
+ * Too large for interface; fragment if possible.
+ * Must be able to put at least 8 bytes per fragment.
+ */
+ if (ip->ip_off & IP_DF) {
+ error = EMSGSIZE;
+ goto bad;
+ }
+ len = (ifp->if_mtu - hlen) &~ 7;
+ if (len < 8) {
+ error = EMSGSIZE;
+ goto bad;
+ }
+
+ {
+ int mhlen, firstlen = len;
+ struct mbuf **mnext = &m->m_act;
+
+ /*
+ * Loop through length of segment after first fragment,
+ * make new header and copy data of each part and link onto chain.
+ */
+ m0 = m;
+ mhlen = sizeof (struct ip);
+ for (off = hlen + len; off < ip->ip_len; off += len) {
+# ifdef MGETHDR
+ MGETHDR(m, M_DONTWAIT, MT_HEADER);
+# else
+ MGET(m, M_DONTWAIT, MT_HEADER);
+# endif
+ if (m == 0) {
+ error = ENOBUFS;
+ goto bad;
+ }
+# if BSD >= 199306
+ m->m_data += max_linkhdr;
+# else
+ m->m_off = MMAXOFF - hlen;
+# endif
+ mhip = mtod(m, struct ip *);
+ bcopy((char *)ip, (char *)mhip, sizeof(*ip));
+ if (hlen > sizeof (struct ip)) {
+ mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip);
+ mhip->ip_hl = mhlen >> 2;
+ }
+ m->m_len = mhlen;
+ mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF);
+ if (ip->ip_off & IP_MF)
+ mhip->ip_off |= IP_MF;
+ if (off + len >= ip->ip_len)
+ len = ip->ip_len - off;
+ else
+ mhip->ip_off |= IP_MF;
+ mhip->ip_len = htons((u_short)(len + mhlen));
+ m->m_next = m_copy(m0, off, len);
+ if (m->m_next == 0) {
+ error = ENOBUFS; /* ??? */
+ goto sendorfree;
+ }
+# if BSD >= 199306
+ m->m_pkthdr.len = mhlen + len;
+ m->m_pkthdr.rcvif = NULL;
+# endif
+ mhip->ip_off = htons((u_short)mhip->ip_off);
+ mhip->ip_sum = 0;
+ mhip->ip_sum = in_cksum(m, mhlen);
+ *mnext = m;
+ mnext = &m->m_act;
+ }
+ /*
+ * Update first fragment by trimming what's been copied out
+ * and updating header, then send each fragment (in order).
+ */
+ m_adj(m0, hlen + firstlen - ip->ip_len);
+ ip->ip_len = htons((u_short)(hlen + firstlen));
+ ip->ip_off = htons((u_short)(ip->ip_off | IP_MF));
+ ip->ip_sum = 0;
+ ip->ip_sum = in_cksum(m0, hlen);
+sendorfree:
+ for (m = m0; m; m = m0) {
+ m0 = m->m_act;
+ m->m_act = 0;
+ if (error == 0)
+# if (BSD >= 199306) || (defined(IRIX) && (IRIX >= 605))
+ error = (*ifp->if_output)(ifp, m,
+ (struct sockaddr *)dst, ro->ro_rt);
+# else
+ error = (*ifp->if_output)(ifp, m,
+ (struct sockaddr *)dst);
+# endif
+ else
+ m_freem(m);
+ }
+ }
+done:
+ if (!error)
+ ipl_frouteok[0]++;
+ else
+ ipl_frouteok[1]++;
+
+ if (ro->ro_rt != NULL) {
+ RTFREE(ro->ro_rt);
+ }
+ *mpp = NULL;
+ return error;
+bad:
+ if ((error == EMSGSIZE) && (fin->fin_v == 4)) {
+ sifp = fin->fin_ifp;
+ code = fin->fin_icode;
+ fin->fin_icode = ICMP_UNREACH_NEEDFRAG;
+ fin->fin_ifp = ifp;
+ (void) send_icmp_err(ip, ICMP_UNREACH, fin, 1);
+ fin->fin_ifp = sifp;
+ fin->fin_icode = code;
+ }
+ m_freem(m);
+ goto done;
+}
+
+
+/*
+ * Return true or false depending on whether the route to the
+ * given IP address uses the same interface as the one passed.
+ */
+int fr_verifysrc(ipa, ifp)
+struct in_addr ipa;
+void *ifp;
+{
+ struct sockaddr_in *dst;
+ struct route iproute;
+
+ bzero((char *)&iproute, sizeof(iproute));
+ dst = (struct sockaddr_in *)&iproute.ro_dst;
+# if (BSD >= 199306)
+ dst->sin_len = sizeof(*dst);
+# endif
+ dst->sin_family = AF_INET;
+ dst->sin_addr = ipa;
+# if (BSD >= 199306) && !defined(__NetBSD__) && !defined(__bsdi__) && \
+ !defined(__OpenBSD__)
+# ifdef RTF_CLONING
+ rtalloc_ign(&iproute, RTF_CLONING);
+# else
+ rtalloc_ign(&iproute, RTF_PRCLONING);
+# endif
+# else
+ rtalloc(&iproute);
+# endif
+ if (iproute.ro_rt == NULL)
+ return 0;
+ return (ifp == iproute.ro_rt->rt_ifp);
+}
+
+
+# ifdef USE_GETIFNAME
+char *
+get_ifname(ifp)
+struct ifnet *ifp;
+{
+ static char workbuf[64];
+
+ sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
+ return workbuf;
+}
+# endif
+
+
+# if defined(USE_INET6)
+/*
+ * This is the IPv6 specific fastroute code. It doesn't clean up the mbuf's
+ * or ensure that it is an IPv6 packet that is being forwarded, those are
+ * expected to be done by the called (ipfr_fastroute).
+ */
+static int ipfr_fastroute6(m0, mpp, fin, fdp)
+struct mbuf *m0, **mpp;
+fr_info_t *fin;
+frdest_t *fdp;
+{
+ struct route_in6 ip6route;
+ struct sockaddr_in6 *dst6;
+ struct route_in6 *ro;
+ struct ifnet *ifp;
+ frentry_t *fr;
+#if defined(OpenBSD) && (OpenBSD >= 200211)
+ struct route_in6 *ro_pmtu = NULL;
+ struct in6_addr finaldst;
+ ip6_t *ip6;
+#endif
+ u_long mtu;
+ int error;
+
+ ifp = NULL;
+ ro = &ip6route;
+ fr = fin->fin_fr;
+ bzero((caddr_t)ro, sizeof(*ro));
+ dst6 = (struct sockaddr_in6 *)&ro->ro_dst;
+ dst6->sin6_family = AF_INET6;
+ dst6->sin6_len = sizeof(struct sockaddr_in6);
+ dst6->sin6_addr = fin->fin_fi.fi_src.in6;
+
+ if (fdp != NULL)
+ ifp = fdp->fd_ifp;
+
+ if ((fr != NULL) && (fin->fin_rev != 0)) {
+ if ((ifp != NULL) && (fdp == &fr->fr_tif))
+ return 0;
+ } else if (fdp != NULL) {
+ if (IP6_NOTZERO(&fdp->fd_ip6))
+ dst6->sin6_addr = fdp->fd_ip6.in6;
+ }
+ if ((ifp == NULL) && ((fr == NULL) || !(fr->fr_flags & FR_FASTROUTE)))
+ return -2;
+
+ rtalloc((struct route *)ro);
+
+ if ((ifp == NULL) && (ro->ro_rt != NULL))
+ ifp = ro->ro_rt->rt_ifp;
+
+ if ((ro->ro_rt == NULL) || (ifp == NULL) ||
+ (ifp != ro->ro_rt->rt_ifp)) {
+ error = EHOSTUNREACH;
+ } else {
+ if (ro->ro_rt->rt_flags & RTF_GATEWAY)
+ dst6 = (struct sockaddr_in6 *)ro->ro_rt->rt_gateway;
+ ro->ro_rt->rt_use++;
+
+#if defined(OpenBSD) && (OpenBSD >= 200211)
+ ip6 = mtod(m0, ip6_t *);
+ ro_pmtu = ro;
+ finaldst = ip6->ip6_dst;
+ error = ip6_getpmtu(ro_pmtu, ro, ifp, &finaldst, &mtu);
+ if (error == 0) {
+#else
+#ifdef ND_IFINFO
+ mtu = ND_IFINFO(ifp)->linkmtu;
+#else
+ mtu = nd_ifinfo[ifp->if_index].linkmtu;
+#endif
+#endif
+ if (m0->m_pkthdr.len <= mtu)
+ error = nd6_output(ifp, fin->fin_ifp, m0,
+ dst6, ro->ro_rt);
+ else
+ error = EMSGSIZE;
+#if defined(OpenBSD) && (OpenBSD >= 200211)
+ }
+#endif
+ }
+
+ if (ro->ro_rt != NULL) {
+ RTFREE(ro->ro_rt);
+ }
+ return error;
+}
+# endif
+#else /* #ifdef _KERNEL */
+
+
+# if defined(__sgi) && (IRIX < 605)
+static int no_output __P((struct ifnet *ifp, struct mbuf *m,
+ struct sockaddr *s))
+# else
+static int no_output __P((struct ifnet *ifp, struct mbuf *m,
+ struct sockaddr *s, struct rtentry *rt))
+# endif
+{
+ return 0;
+}
+
+
+# ifdef __STDC__
+# if defined(__sgi) && (IRIX < 605)
+static int write_output __P((struct ifnet *ifp, struct mbuf *m,
+ struct sockaddr *s))
+# else
+static int write_output __P((struct ifnet *ifp, struct mbuf *m,
+ struct sockaddr *s, struct rtentry *rt))
+# endif
+{
+ ip_t *ip = (ip_t *)m;
+# else
+static int write_output(ifp, ip)
+struct ifnet *ifp;
+ip_t *ip;
+{
+# endif
+ char fname[32];
+ int fd;
+
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+ sprintf(fname, "%s", ifp->if_xname);
+# else
+ sprintf(fname, "%s%d", ifp->if_name, ifp->if_unit);
+# endif
+ fd = open(fname, O_WRONLY|O_APPEND);
+ if (fd == -1) {
+ perror("open");
+ return -1;
+ }
+ write(fd, (char *)ip, ntohs(ip->ip_len));
+ close(fd);
+ return 0;
+}
+
+
+char *get_ifname(ifp)
+struct ifnet *ifp;
+{
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+ return ifp->if_xname;
+# else
+ static char fullifname[LIFNAMSIZ];
+
+ sprintf(fullifname, "%s%d", ifp->if_name, ifp->if_unit);
+ return fullifname;
+# endif
+}
+
+
+struct ifnet *get_unit(ifname, v)
+char *ifname;
+int v;
+{
+ struct ifnet *ifp, **ifa, **old_ifneta;
+
+ for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) {
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+ if (!strncmp(ifname, ifp->if_xname, sizeof(ifp->if_xname)))
+# else
+ char fullname[LIFNAMSIZ];
+
+ sprintf(fullname, "%s%d", ifp->if_name, ifp->if_unit);
+ if (!strcmp(ifname, fullname))
+# endif
+ return ifp;
+ }
+
+ if (!ifneta) {
+ ifneta = (struct ifnet **)malloc(sizeof(ifp) * 2);
+ if (!ifneta)
+ return NULL;
+ ifneta[1] = NULL;
+ ifneta[0] = (struct ifnet *)calloc(1, sizeof(*ifp));
+ if (!ifneta[0]) {
+ free(ifneta);
+ return NULL;
+ }
+ nifs = 1;
+ } else {
+ old_ifneta = ifneta;
+ nifs++;
+ ifneta = (struct ifnet **)realloc(ifneta,
+ (nifs + 1) * sizeof(*ifa));
+ if (!ifneta) {
+ free(old_ifneta);
+ nifs = 0;
+ return NULL;
+ }
+ ifneta[nifs] = NULL;
+ ifneta[nifs - 1] = (struct ifnet *)malloc(sizeof(*ifp));
+ if (!ifneta[nifs - 1]) {
+ nifs--;
+ return NULL;
+ }
+ }
+ ifp = ifneta[nifs - 1];
+
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+ strncpy(ifp->if_xname, ifname, sizeof(ifp->if_xname));
+# else
+ ifp->if_name = strdup(ifname);
+
+ ifname = ifp->if_name;
+ while (*ifname && !isdigit(*ifname))
+ ifname++;
+ if (*ifname && isdigit(*ifname)) {
+ ifp->if_unit = atoi(ifname);
+ *ifname = '\0';
+ } else
+ ifp->if_unit = -1;
+# endif
+ ifp->if_output = no_output;
+ return ifp;
+}
+
+
+
+void init_ifp()
+{
+ struct ifnet *ifp, **ifa;
+ char fname[32];
+ int fd;
+
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
+ for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) {
+ ifp->if_output = write_output;
+ sprintf(fname, "/tmp/%s", ifp->if_xname);
+ fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600);
+ if (fd == -1)
+ perror("open");
+ else
+ close(fd);
+ }
+# else
+
+ for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) {
+ ifp->if_output = write_output;
+ sprintf(fname, "/tmp/%s%d", ifp->if_name, ifp->if_unit);
+ fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600);
+ if (fd == -1)
+ perror("open");
+ else
+ close(fd);
+ }
+# endif
+}
+
+
+int send_reset(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ verbose("- TCP RST sent\n");
+ return 0;
+}
+
+
+int send_icmp_err(ip, code, fin, dst)
+ip_t *ip;
+int code;
+fr_info_t *fin;
+int dst;
+{
+ verbose("- ICMP UNREACHABLE sent\n");
+ return 0;
+}
+
+
+void frsync()
+{
+ return;
+}
+
+void m_copydata(m, off, len, cp)
+mb_t *m;
+int off, len;
+caddr_t cp;
+{
+ bcopy((char *)m + off, cp, len);
+}
+
+
+int ipfuiomove(buf, len, rwflag, uio)
+caddr_t buf;
+int len, rwflag;
+struct uio *uio;
+{
+ int left, ioc, num, offset;
+ struct iovec *io;
+ char *start;
+
+ if (rwflag == UIO_READ) {
+ left = len;
+ ioc = 0;
+
+ offset = uio->uio_offset;
+
+ while ((left > 0) && (ioc < uio->uio_iovcnt)) {
+ io = uio->uio_iov + ioc;
+ num = io->iov_len;
+ if (num > left)
+ num = left;
+ start = (char *)io->iov_base + offset;
+ if (start > (char *)io->iov_base + io->iov_len) {
+ offset -= io->iov_len;
+ ioc++;
+ continue;
+ }
+ bcopy(buf, start, num);
+ uio->uio_resid -= num;
+ uio->uio_offset += num;
+ left -= num;
+ if (left > 0)
+ ioc++;
+ }
+ if (left > 0)
+ return EFAULT;
+ }
+ return 0;
+}
+#endif /* _KERNEL */
diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h
new file mode 100644
index 0000000..bf407c2
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_fil.h
@@ -0,0 +1,661 @@
+/*
+ * Copyright (C) 1993-2002 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ip_fil.h 1.35 6/5/96
+ * $Id: ip_fil.h,v 2.29.2.4 2000/11/12 11:54:53 darrenr Exp $
+ * $FreeBSD$
+ */
+
+#ifndef __IP_FIL_H__
+#define __IP_FIL_H__
+
+/*
+ * Pathnames for various IP Filter control devices. Used by LKM
+ * and userland, so defined here.
+ */
+#define IPNAT_NAME "/dev/ipnat"
+#define IPSTATE_NAME "/dev/ipstate"
+#define IPAUTH_NAME "/dev/ipauth"
+
+#ifndef SOLARIS
+# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+
+#ifndef __P
+# ifdef __STDC__
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+
+#ifndef offsetof
+# define offsetof(t,m) (int)((&((t *)0L)->m))
+#endif
+
+#if defined(__STDC__) || defined(__GNUC__)
+# define SIOCADAFR _IOW('r', 60, struct frentry *)
+# define SIOCRMAFR _IOW('r', 61, struct frentry *)
+# define SIOCSETFF _IOW('r', 62, u_int)
+# define SIOCGETFF _IOR('r', 63, u_int)
+# define SIOCGETFS _IOWR('r', 64, struct friostat *)
+# define SIOCIPFFL _IOWR('r', 65, int)
+# define SIOCIPFFB _IOR('r', 66, int)
+# define SIOCADIFR _IOW('r', 67, struct frentry *)
+# define SIOCRMIFR _IOW('r', 68, struct frentry *)
+# define SIOCSWAPA _IOR('r', 69, u_int)
+# define SIOCINAFR _IOW('r', 70, struct frentry *)
+# define SIOCINIFR _IOW('r', 71, struct frentry *)
+# define SIOCFRENB _IOW('r', 72, u_int)
+# define SIOCFRSYN _IOW('r', 73, u_int)
+# define SIOCFRZST _IOWR('r', 74, struct friostat *)
+# define SIOCZRLST _IOWR('r', 75, struct frentry *)
+# define SIOCAUTHW _IOWR('r', 76, struct frauth *)
+# define SIOCAUTHR _IOWR('r', 77, struct frauth *)
+# define SIOCATHST _IOWR('r', 78, struct fr_authstat *)
+# define SIOCSTLCK _IOWR('r', 79, u_int)
+# define SIOCSTPUT _IOWR('r', 80, struct ipstate_save *)
+# define SIOCSTGET _IOWR('r', 81, struct ipstate_save *)
+# define SIOCSTGSZ _IOWR('r', 82, struct natget)
+# define SIOCGFRST _IOWR('r', 83, struct ipfrstat *)
+# define SIOCIPFL6 _IOWR('r', 84, int)
+#else
+# define SIOCADAFR _IOW(r, 60, struct frentry *)
+# define SIOCRMAFR _IOW(r, 61, struct frentry *)
+# define SIOCSETFF _IOW(r, 62, u_int)
+# define SIOCGETFF _IOR(r, 63, u_int)
+# define SIOCGETFS _IOWR(r, 64, struct friostat *)
+# define SIOCIPFFL _IOWR(r, 65, int)
+# define SIOCIPFFB _IOR(r, 66, int)
+# define SIOCADIFR _IOW(r, 67, struct frentry *)
+# define SIOCRMIFR _IOW(r, 68, struct frentry *)
+# define SIOCSWAPA _IOR(r, 69, u_int)
+# define SIOCINAFR _IOW(r, 70, struct frentry *)
+# define SIOCINIFR _IOW(r, 71, struct frentry *)
+# define SIOCFRENB _IOW(r, 72, u_int)
+# define SIOCFRSYN _IOW(r, 73, u_int)
+# define SIOCFRZST _IOWR(r, 74, struct friostat *)
+# define SIOCZRLST _IOWR(r, 75, struct frentry *)
+# define SIOCAUTHW _IOWR(r, 76, struct frauth *)
+# define SIOCAUTHR _IOWR(r, 77, struct frauth *)
+# define SIOCATHST _IOWR(r, 78, struct fr_authstat *)
+# define SIOCSTLCK _IOWR(r, 79, u_int)
+# define SIOCSTPUT _IOWR(r, 80, struct ipstate_save *)
+# define SIOCSTGET _IOWR(r, 81, struct ipstate_save *)
+# define SIOCSTGSZ _IOWR(r, 82, struct natget)
+# define SIOCGFRST _IOWR(r, 83, struct ipfrstat *)
+# define SIOCIPFL6 _IOWR(r, 84, int)
+#endif
+#define SIOCADDFR SIOCADAFR
+#define SIOCDELFR SIOCRMAFR
+#define SIOCINSFR SIOCINAFR
+
+
+typedef struct fr_ip {
+ u_32_t fi_v:4; /* IP version */
+ u_32_t fi_fl:4; /* packet flags */
+ u_32_t fi_tos:8; /* IP packet TOS */
+ u_32_t fi_ttl:8; /* IP packet TTL */
+ u_32_t fi_p:8; /* IP packet protocol */
+ union i6addr fi_src; /* source address from packet */
+ union i6addr fi_dst; /* destination address from packet */
+ u_32_t fi_optmsk; /* bitmask composed from IP options */
+ u_short fi_secmsk; /* bitmask composed from IP security options */
+ u_short fi_auth; /* authentication code from IP sec. options */
+} fr_ip_t;
+
+#define FI_OPTIONS (FF_OPTIONS >> 24)
+#define FI_TCPUDP (FF_TCPUDP >> 24) /* TCP/UCP implied comparison*/
+#define FI_FRAG (FF_FRAG >> 24)
+#define FI_SHORT (FF_SHORT >> 24)
+#define FI_CMP (FI_OPTIONS|FI_TCPUDP|FI_SHORT)
+
+#define fi_saddr fi_src.in4.s_addr
+#define fi_daddr fi_dst.in4.s_addr
+
+
+/*
+ * These are both used by the state and NAT code to indicate that one port or
+ * the other should be treated as a wildcard.
+ */
+#define FI_W_SPORT 0x00000100
+#define FI_W_DPORT 0x00000200
+#define FI_WILDP (FI_W_SPORT|FI_W_DPORT)
+#define FI_W_SADDR 0x00000400
+#define FI_W_DADDR 0x00000800
+#define FI_WILDA (FI_W_SADDR|FI_W_DADDR)
+#define FI_NEWFR 0x00001000 /* Create a filter rule */
+#define FI_IGNOREPKT 0x00002000 /* Do not treat as a real packet */
+#define FI_NORULE 0x00004000 /* Not direct a result of a rule */
+
+typedef struct fr_info {
+ void *fin_ifp; /* interface packet is `on' */
+ struct fr_ip fin_fi; /* IP Packet summary */
+ u_short fin_data[2]; /* TCP/UDP ports, ICMP code/type */
+ u_int fin_out; /* in or out ? 1 == out, 0 == in */
+ u_short fin_hlen; /* length of IP header in bytes */
+ u_char fin_rev; /* state only: 1 = reverse */
+ u_char fin_tcpf; /* TCP header flags (SYN, ACK, etc) */
+ u_int fin_icode; /* ICMP error to return */
+ u_32_t fin_rule; /* rule # last matched */
+ u_32_t fin_group; /* group number, -1 for none */
+ struct frentry *fin_fr; /* last matching rule */
+ char *fin_dp; /* start of data past IP header */
+ u_short fin_plen;
+ u_short fin_off;
+ u_short fin_dlen; /* length of data portion of packet */
+ u_short fin_id; /* IP packet id field */
+ u_int fin_misc;
+ void *fin_mp; /* pointer to pointer to mbuf */
+#if SOLARIS
+ void *fin_qfm; /* pointer to mblk where pkt starts */
+ void *fin_qif;
+#endif
+} fr_info_t;
+
+#define fin_v fin_fi.fi_v
+#define fin_p fin_fi.fi_p
+#define fin_saddr fin_fi.fi_saddr
+#define fin_src fin_fi.fi_src.in4
+#define fin_daddr fin_fi.fi_daddr
+#define fin_dst fin_fi.fi_dst.in4
+#define fin_fl fin_fi.fi_fl
+
+/*
+ * Size for compares on fr_info structures
+ */
+#define FI_CSIZE offsetof(fr_info_t, fin_icode)
+#define FI_LCSIZE offsetof(fr_info_t, fin_dp)
+
+/*
+ * For fin_misc
+ */
+#define FM_BADSTATE 0x00000001
+
+/*
+ * Size for copying cache fr_info structure
+ */
+#define FI_COPYSIZE offsetof(fr_info_t, fin_dp)
+
+typedef struct frdest {
+ void *fd_ifp;
+ union i6addr fd_ip6;
+ char fd_ifname[LIFNAMSIZ];
+#if SOLARIS
+ mb_t *fd_mp; /* cache resolver for to/dup-to */
+#endif
+} frdest_t;
+
+#define fd_ip fd_ip6.in4
+
+
+typedef struct frpcmp {
+ int frp_cmp; /* data for port comparisons */
+ u_short frp_port; /* top port for <> and >< */
+ u_short frp_top; /* top port for <> and >< */
+} frpcmp_t;
+
+typedef struct frtuc {
+ u_char ftu_tcpfm; /* tcp flags mask */
+ u_char ftu_tcpf; /* tcp flags */
+ frpcmp_t ftu_src;
+ frpcmp_t ftu_dst;
+} frtuc_t;
+
+#define ftu_scmp ftu_src.frp_cmp
+#define ftu_dcmp ftu_dst.frp_cmp
+#define ftu_sport ftu_src.frp_port
+#define ftu_dport ftu_dst.frp_port
+#define ftu_stop ftu_src.frp_top
+#define ftu_dtop ftu_dst.frp_top
+
+typedef struct frentry {
+ struct frentry *fr_next;
+ struct frentry *fr_grp;
+ int fr_ref; /* reference count - for grouping */
+ void *fr_ifas[4];
+ /*
+ * These are only incremented when a packet matches this rule and
+ * it is the last match
+ */
+ U_QUAD_T fr_hits;
+ U_QUAD_T fr_bytes;
+ /*
+ * Fields after this may not change whilst in the kernel.
+ */
+ struct fr_ip fr_ip;
+ struct fr_ip fr_mip; /* mask structure */
+
+
+ u_short fr_icmpm; /* data for ICMP packets (mask) */
+ u_short fr_icmp;
+
+ u_int fr_age[2]; /* aging for state */
+ frtuc_t fr_tuc;
+ u_32_t fr_group; /* group to which this rule belongs */
+ u_32_t fr_grhead; /* group # which this rule starts */
+ u_32_t fr_flags; /* per-rule flags && options (see below) */
+ u_int fr_skip; /* # of rules to skip */
+ u_int fr_loglevel; /* syslog log facility + priority */
+ int (*fr_func) __P((int, ip_t *, fr_info_t *)); /* call this function */
+ int fr_sap; /* For solaris only */
+ u_char fr_icode; /* return ICMP code */
+ char fr_ifnames[4][LIFNAMSIZ];
+ struct frdest fr_tif; /* "to" interface */
+ struct frdest fr_dif; /* duplicate packet interfaces */
+ u_int fr_cksum; /* checksum on filter rules for performance */
+} frentry_t;
+
+#define fr_v fr_ip.fi_v
+#define fr_proto fr_ip.fi_p
+#define fr_ttl fr_ip.fi_ttl
+#define fr_tos fr_ip.fi_tos
+#define fr_tcpfm fr_tuc.ftu_tcpfm
+#define fr_tcpf fr_tuc.ftu_tcpf
+#define fr_scmp fr_tuc.ftu_scmp
+#define fr_dcmp fr_tuc.ftu_dcmp
+#define fr_dport fr_tuc.ftu_dport
+#define fr_sport fr_tuc.ftu_sport
+#define fr_stop fr_tuc.ftu_stop
+#define fr_dtop fr_tuc.ftu_dtop
+#define fr_dst fr_ip.fi_dst.in4
+#define fr_src fr_ip.fi_src.in4
+#define fr_dmsk fr_mip.fi_dst.in4
+#define fr_smsk fr_mip.fi_src.in4
+#define fr_ifname fr_ifnames[0]
+#define fr_oifname fr_ifnames[2]
+#define fr_ifa fr_ifas[0]
+#define fr_oifa fr_ifas[2]
+
+#define FR_CMPSIZ (sizeof(struct frentry) - offsetof(frentry_t, fr_ip))
+
+/*
+ * fr_flags
+ */
+#define FR_BLOCK 0x00001 /* do not allow packet to pass */
+#define FR_PASS 0x00002 /* allow packet to pass */
+#define FR_OUTQUE 0x00004 /* outgoing packets */
+#define FR_INQUE 0x00008 /* ingoing packets */
+#define FR_LOG 0x00010 /* Log */
+#define FR_LOGB 0x00011 /* Log-fail */
+#define FR_LOGP 0x00012 /* Log-pass */
+#define FR_NOTSRCIP 0x00020 /* not the src IP# */
+#define FR_NOTDSTIP 0x00040 /* not the dst IP# */
+#define FR_RETRST 0x00080 /* Return TCP RST packet - reset connection */
+#define FR_RETICMP 0x00100 /* Return ICMP unreachable packet */
+#define FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */
+#define FR_NOMATCH 0x00200 /* no match occured */
+#define FR_ACCOUNT 0x00400 /* count packet bytes */
+#define FR_KEEPFRAG 0x00800 /* keep fragment information */
+#define FR_KEEPSTATE 0x01000 /* keep `connection' state information */
+#define FR_INACTIVE 0x02000
+#define FR_QUICK 0x04000 /* match & stop processing list */
+#define FR_FASTROUTE 0x08000 /* bypass normal routing */
+#define FR_CALLNOW 0x10000 /* call another function (fr_func) if matches */
+#define FR_DUP 0x20000 /* duplicate packet */
+#define FR_LOGORBLOCK 0x40000 /* block the packet if it can't be logged */
+#define FR_LOGBODY 0x80000 /* Log the body */
+#define FR_LOGFIRST 0x100000 /* Log the first byte if state held */
+#define FR_AUTH 0x200000 /* use authentication */
+#define FR_PREAUTH 0x400000 /* require preauthentication */
+#define FR_DONTCACHE 0x800000 /* don't cache the result */
+
+#define FR_LOGMASK (FR_LOG|FR_LOGP|FR_LOGB)
+#define FR_RETMASK (FR_RETICMP|FR_RETRST|FR_FAKEICMP)
+
+/*
+ * These correspond to #define's for FI_* and are stored in fr_flags
+ */
+#define FF_OPTIONS 0x01000000
+#define FF_TCPUDP 0x02000000
+#define FF_FRAG 0x04000000
+#define FF_SHORT 0x08000000
+/*
+ * recognized flags for SIOCGETFF and SIOCSETFF, and get put in fr_flags
+ */
+#define FF_LOGPASS 0x10000000
+#define FF_LOGBLOCK 0x20000000
+#define FF_LOGNOMATCH 0x40000000
+#define FF_LOGGING (FF_LOGPASS|FF_LOGBLOCK|FF_LOGNOMATCH)
+#define FF_BLOCKNONIP 0x80000000 /* Solaris2 Only */
+
+#define FR_NONE 0
+#define FR_EQUAL 1
+#define FR_NEQUAL 2
+#define FR_LESST 3
+#define FR_GREATERT 4
+#define FR_LESSTE 5
+#define FR_GREATERTE 6
+#define FR_OUTRANGE 7
+#define FR_INRANGE 8
+
+typedef struct filterstats {
+ u_long fr_pass; /* packets allowed */
+ u_long fr_block; /* packets denied */
+ u_long fr_nom; /* packets which don't match any rule */
+ u_long fr_short; /* packets which are short */
+ u_long fr_ppkl; /* packets allowed and logged */
+ u_long fr_bpkl; /* packets denied and logged */
+ u_long fr_npkl; /* packets unmatched and logged */
+ u_long fr_pkl; /* packets logged */
+ u_long fr_skip; /* packets to be logged but buffer full */
+ u_long fr_ret; /* packets for which a return is sent */
+ u_long fr_acct; /* packets for which counting was performed */
+ u_long fr_bnfr; /* bad attempts to allocate fragment state */
+ u_long fr_nfr; /* new fragment state kept */
+ u_long fr_cfr; /* add new fragment state but complete pkt */
+ u_long fr_bads; /* bad attempts to allocate packet state */
+ u_long fr_ads; /* new packet state kept */
+ u_long fr_chit; /* cached hit */
+ u_long fr_tcpbad; /* TCP checksum check failures */
+ u_long fr_pull[2]; /* good and bad pullup attempts */
+ u_long fr_badsrc; /* source received doesn't match route */
+ u_long fr_badttl; /* TTL in packet doesn't reach minimum */
+#if SOLARIS
+ u_long fr_notdata; /* PROTO/PCPROTO that have no data */
+ u_long fr_nodata; /* mblks that have no data */
+ u_long fr_bad; /* bad IP packets to the filter */
+ u_long fr_notip; /* packets passed through no on ip queue */
+ u_long fr_drop; /* packets dropped - no info for them! */
+ u_long fr_copy; /* messages copied due to db_ref > 1 */
+#endif
+ u_long fr_ipv6[2]; /* IPv6 packets in/out */
+} filterstats_t;
+
+/*
+ * For SIOCGETFS
+ */
+typedef struct friostat {
+ struct filterstats f_st[2];
+ struct frentry *f_fin[2];
+ struct frentry *f_fout[2];
+ struct frentry *f_acctin[2];
+ struct frentry *f_acctout[2];
+ struct frentry *f_fin6[2];
+ struct frentry *f_fout6[2];
+ struct frentry *f_acctin6[2];
+ struct frentry *f_acctout6[2];
+ struct frentry *f_auth;
+ struct frgroup *f_groups[3][2];
+ u_long f_froute[2];
+ int f_defpass; /* default pass - from fr_pass */
+ char f_active; /* 1 or 0 - active rule set */
+ char f_running; /* 1 if running, else 0 */
+ char f_logging; /* 1 if enabled, else 0 */
+ char f_version[32]; /* version string */
+ int f_locks[4];
+} friostat_t;
+
+typedef struct optlist {
+ u_short ol_val;
+ int ol_bit;
+} optlist_t;
+
+
+/*
+ * Group list structure.
+ */
+typedef struct frgroup {
+ u_32_t fg_num;
+ struct frgroup *fg_next;
+ struct frentry *fg_head;
+ struct frentry **fg_start;
+} frgroup_t;
+
+
+/*
+ * Log structure. Each packet header logged is prepended by one of these.
+ * Following this in the log records read from the device will be an ipflog
+ * structure which is then followed by any packet data.
+ */
+typedef struct iplog {
+ u_32_t ipl_magic;
+ u_int ipl_count;
+ struct timeval ipl_tv;
+ size_t ipl_dsize;
+ struct iplog *ipl_next;
+} iplog_t;
+
+#define ipl_sec ipl_tv.tv_sec
+#define ipl_usec ipl_tv.tv_usec
+
+#define IPL_MAGIC 0x49504c4d /* 'IPLM' */
+#define IPLOG_SIZE sizeof(iplog_t)
+
+typedef struct ipflog {
+#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603))
+ char fl_ifname[LIFNAMSIZ];
+#else
+ u_int fl_unit;
+ char fl_ifname[LIFNAMSIZ];
+#endif
+ u_char fl_plen; /* extra data after hlen */
+ u_char fl_hlen; /* length of IP headers saved */
+ u_short fl_loglevel; /* syslog log level */
+ u_32_t fl_rule;
+ u_32_t fl_group;
+ u_32_t fl_flags;
+ u_char fl_dir;
+ u_char fl_pad[3];
+} ipflog_t;
+
+
+#ifndef ICMP_UNREACH_FILTER
+# define ICMP_UNREACH_FILTER 13
+#endif
+
+#ifndef IPF_LOGGING
+# define IPF_LOGGING 0
+#endif
+#ifndef IPF_DEFAULT_PASS
+# define IPF_DEFAULT_PASS FR_PASS
+#endif
+
+#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
+#define IPLLOGSIZE 8192
+
+#define IPF_OPTCOPY 0x07ff00 /* bit mask of copied options */
+
+/*
+ * Device filenames for reading log information. Use ipf on Solaris2 because
+ * ipl is already a name used by something else.
+ */
+#ifndef IPL_NAME
+# if SOLARIS
+# define IPL_NAME "/dev/ipf"
+# else
+# define IPL_NAME "/dev/ipl"
+# endif
+#endif
+#define IPL_NAT IPNAT_NAME
+#define IPL_STATE IPSTATE_NAME
+#define IPL_AUTH IPAUTH_NAME
+
+#define IPL_LOGIPF 0 /* Minor device #'s for accessing logs */
+#define IPL_LOGNAT 1
+#define IPL_LOGSTATE 2
+#define IPL_LOGAUTH 3
+#define IPL_LOGMAX 3
+
+#if !defined(CDEV_MAJOR) && defined (__FreeBSD_version) && \
+ (__FreeBSD_version >= 220000)
+# define CDEV_MAJOR 79
+#endif
+
+/*
+ * Post NetBSD 1.2 has the PFIL interface for packet filters. This turns
+ * on those hooks. We don't need any special mods in non-IP Filter code
+ * with this!
+ */
+#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \
+ (defined(NetBSD1_2) && NetBSD1_2 > 1) || (defined(__FreeBSD_version) && \
+ (__FreeBSD_version >= 500011))
+# if (NetBSD >= 199905)
+# define PFIL_HOOKS
+# endif
+# ifdef PFIL_HOOKS
+# define NETBSD_PF
+# endif
+#endif
+
+
+#ifndef _KERNEL
+extern char *get_ifname __P((struct ifnet *));
+extern int fr_check __P((ip_t *, int, void *, int, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
+extern int send_reset __P((ip_t *, fr_info_t *));
+extern int send_icmp_err __P((ip_t *, int, fr_info_t *, int));
+extern int ipf_log __P((void));
+extern struct ifnet *get_unit __P((char *, int));
+extern int mbuflen __P((mb_t *));
+# if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)
+extern int iplioctl __P((dev_t, u_long, caddr_t, int));
+# else
+extern int iplioctl __P((dev_t, int, caddr_t, int));
+# endif
+extern int iplopen __P((dev_t, int));
+extern int iplclose __P((dev_t, int));
+#else /* #ifndef _KERNEL */
+# if defined(__NetBSD__) && defined(PFIL_HOOKS)
+extern void ipfilterattach __P((int));
+# endif
+extern int iplattach __P((void));
+extern int ipl_enable __P((void));
+extern int ipl_disable __P((void));
+extern int send_icmp_err __P((ip_t *, int, fr_info_t *, int));
+extern int send_reset __P((ip_t *, fr_info_t *));
+# if SOLARIS
+extern int fr_check __P((ip_t *, int, void *, int, qif_t *, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *,
+ int, qif_t *, mb_t **));
+# if SOLARIS2 >= 7
+extern int iplioctl __P((dev_t, int, intptr_t, int, cred_t *, int *));
+# else
+extern int iplioctl __P((dev_t, int, int *, int, cred_t *, int *));
+# endif
+extern int iplopen __P((dev_t *, int, int, cred_t *));
+extern int iplclose __P((dev_t, int, int, cred_t *));
+extern int ipfsync __P((void));
+extern int ipfr_fastroute __P((ip_t *, mblk_t *, mblk_t **,
+ fr_info_t *, frdest_t *));
+extern void copyin_mblk __P((mblk_t *, size_t, size_t, char *));
+extern void copyout_mblk __P((mblk_t *, size_t, size_t, char *));
+extern int fr_qin __P((queue_t *, mblk_t *));
+extern int fr_qout __P((queue_t *, mblk_t *));
+extern int iplread __P((dev_t, struct uio *, cred_t *));
+# else /* SOLARIS */
+extern int fr_check __P((ip_t *, int, void *, int, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
+extern int ipfr_fastroute __P((mb_t *, mb_t **, fr_info_t *, frdest_t *));
+extern size_t mbufchainlen __P((mb_t *));
+# ifdef __sgi
+# include <sys/cred.h>
+extern int iplioctl __P((dev_t, int, caddr_t, int, cred_t *, int *));
+extern int iplopen __P((dev_t *, int, int, cred_t *));
+extern int iplclose __P((dev_t, int, int, cred_t *));
+extern int iplread __P((dev_t, struct uio *, cred_t *));
+extern int ipfsync __P((void));
+extern int ipfilter_sgi_attach __P((void));
+extern void ipfilter_sgi_detach __P((void));
+extern void ipfilter_sgi_intfsync __P((void));
+# else
+# ifdef IPFILTER_LKM
+extern int iplidentify __P((char *));
+# endif
+# if (_BSDI_VERSION >= 199510) || (__FreeBSD_version >= 220000) || \
+ (NetBSD >= 199511) || defined(__OpenBSD__)
+# if defined(__NetBSD__) || (_BSDI_VERSION >= 199701) || \
+ defined(__OpenBSD__) || (__FreeBSD_version >= 300000)
+extern int iplioctl __P((dev_t, u_long, caddr_t, int, struct thread *));
+# else
+extern int iplioctl __P((dev_t, int, caddr_t, int, struct thread *));
+# endif
+extern int iplopen __P((dev_t, int, int, struct thread *));
+extern int iplclose __P((dev_t, int, int, struct thread *));
+# else
+# ifndef linux
+extern int iplopen __P((dev_t, int));
+extern int iplclose __P((dev_t, int));
+extern int iplioctl __P((dev_t, int, caddr_t, int));
+# else
+extern int iplioctl(struct inode *, struct file *, u_int, u_long);
+extern int iplopen __P((struct inode *, struct file *));
+extern void iplclose __P((struct inode *, struct file *));
+# endif /* !linux */
+# endif /* (_BSDI_VERSION >= 199510) */
+# if BSD >= 199306
+extern int iplread __P((dev_t, struct uio *, int));
+# else
+# ifndef linux
+extern int iplread __P((dev_t, struct uio *));
+# else
+extern int iplread(struct inode *, struct file *, char *, int);
+# endif /* !linux */
+# endif /* BSD >= 199306 */
+# endif /* __ sgi */
+# endif /* SOLARIS */
+#endif /* #ifndef _KERNEL */
+
+extern char *memstr __P((char *, char *, int, int));
+extern void fixskip __P((frentry_t **, frentry_t *, int));
+extern int countbits __P((u_32_t));
+extern int ipldetach __P((void));
+extern u_short ipf_cksum __P((u_short *, int));
+extern int ircopyptr __P((void *, void *, size_t));
+extern int iwcopyptr __P((void *, void *, size_t));
+
+extern void ipflog_init __P((void));
+extern int ipflog_clear __P((minor_t));
+extern int ipflog __P((u_int, ip_t *, fr_info_t *, mb_t *));
+extern int ipllog __P((int, fr_info_t *, void **, size_t *, int *, int));
+extern int ipflog_read __P((minor_t, struct uio *));
+
+extern int frflush __P((minor_t, int, int));
+extern void frsync __P((void));
+extern frgroup_t *fr_addgroup __P((u_32_t, frentry_t *, minor_t, int));
+extern void fr_delgroup __P((u_32_t, u_32_t, minor_t, int));
+extern frgroup_t *fr_findgroup __P((u_32_t, u_32_t, minor_t, int,
+ frgroup_t ***));
+
+extern int fr_copytolog __P((int, char *, int));
+extern void fr_forgetifp __P((void *));
+extern void fr_getstat __P((struct friostat *));
+extern int fr_ifpaddr __P((int, void *, struct in_addr *));
+extern int fr_lock __P((caddr_t, int *));
+extern void fr_makefrip __P((int, ip_t *, fr_info_t *));
+extern u_short fr_tcpsum __P((mb_t *, ip_t *, tcphdr_t *));
+extern int fr_scanlist __P((u_32_t, ip_t *, fr_info_t *, void *));
+extern int fr_tcpudpchk __P((frtuc_t *, fr_info_t *));
+extern int fr_verifysrc __P((struct in_addr, void *));
+
+extern int ipl_unreach;
+extern int fr_running;
+extern u_long ipl_frouteok[2];
+extern int fr_pass;
+extern int fr_flags;
+extern int fr_active;
+extern int fr_chksrc;
+extern int fr_minttl;
+extern int fr_minttllog;
+extern fr_info_t frcache[2];
+extern char ipfilter_version[];
+extern iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];
+extern size_t iplused[IPL_LOGMAX + 1];
+extern struct frentry *ipfilter[2][2], *ipacct[2][2];
+#ifdef USE_INET6
+extern struct frentry *ipfilter6[2][2], *ipacct6[2][2];
+extern int icmptoicmp6types[ICMP_MAXTYPE+1];
+extern int icmptoicmp6unreach[ICMP_MAX_UNREACH];
+#endif
+extern struct frgroup *ipfgroups[3][2];
+extern struct filterstats frstats[];
+
+#endif /* __IP_FIL_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_frag.c b/sys/contrib/ipfilter/netinet/ip_frag.c
new file mode 100644
index 0000000..855087a
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_frag.c
@@ -0,0 +1,618 @@
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+#if defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#if !defined(_KERNEL) && !defined(KERNEL)
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000)
+# include <sys/filio.h>
+# include <sys/fcntl.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+#if defined(_KERNEL) && !defined(linux)
+# include <sys/systm.h>
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# if defined(_KERNEL) && !defined(__sgi)
+# include <sys/kernel.h>
+# endif
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/byteorder.h>
+# ifdef _KERNEL
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+# include <sys/kmem.h>
+#endif
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifndef linux
+# include <netinet/ip_var.h>
+#endif
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_auth.h"
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+# if (defined(KERNEL) || defined(_KERNEL))
+# ifndef IPFILTER_LKM
+# include <sys/libkern.h>
+# include <sys/systm.h>
+# endif
+extern struct callout_handle ipfr_slowtimer_ch;
+# endif
+#endif
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000)
+# include <sys/callout.h>
+extern struct callout ipfr_slowtimer_ch;
+#endif
+#if defined(__OpenBSD__)
+# include <sys/timeout.h>
+extern struct timeout ipfr_slowtimer_ch;
+#endif
+
+#if !defined(lint)
+static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-2000 Darren Reed";
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+
+static ipfr_t *ipfr_heads[IPFT_SIZE];
+static ipfr_t *ipfr_nattab[IPFT_SIZE];
+static ipfrstat_t ipfr_stats;
+static int ipfr_inuse = 0;
+
+int fr_ipfrttl = 120; /* 60 seconds */
+int fr_frag_lock = 0;
+
+#ifdef _KERNEL
+# if SOLARIS2 >= 7
+extern timeout_id_t ipfr_timer_id;
+# else
+extern int ipfr_timer_id;
+# endif
+#endif
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+extern KRWLOCK_T ipf_frag, ipf_natfrag, ipf_nat, ipf_mutex;
+# if SOLARIS
+extern KRWLOCK_T ipf_solaris;
+# else
+KRWLOCK_T ipf_solaris;
+# endif
+extern kmutex_t ipf_rw;
+#endif
+
+
+static ipfr_t *ipfr_new __P((ip_t *, fr_info_t *, ipfr_t **));
+static ipfr_t *ipfr_lookup __P((ip_t *, fr_info_t *, ipfr_t **));
+static void ipfr_delete __P((ipfr_t *));
+
+
+ipfrstat_t *ipfr_fragstats()
+{
+ ipfr_stats.ifs_table = ipfr_heads;
+ ipfr_stats.ifs_nattab = ipfr_nattab;
+ ipfr_stats.ifs_inuse = ipfr_inuse;
+ return &ipfr_stats;
+}
+
+
+/*
+ * add a new entry to the fragment cache, registering it as having come
+ * through this box, with the result of the filter operation.
+ */
+static ipfr_t *ipfr_new(ip, fin, table)
+ip_t *ip;
+fr_info_t *fin;
+ipfr_t *table[];
+{
+ ipfr_t **fp, *fra, frag;
+ u_int idx, off;
+
+ if (ipfr_inuse >= IPFT_SIZE)
+ return NULL;
+
+ if (!(fin->fin_fl & FI_FRAG))
+ return NULL;
+
+ frag.ipfr_p = ip->ip_p;
+ idx = ip->ip_p;
+ frag.ipfr_id = ip->ip_id;
+ idx += ip->ip_id;
+ frag.ipfr_tos = ip->ip_tos;
+ frag.ipfr_src.s_addr = ip->ip_src.s_addr;
+ idx += ip->ip_src.s_addr;
+ frag.ipfr_dst.s_addr = ip->ip_dst.s_addr;
+ idx += ip->ip_dst.s_addr;
+ frag.ipfr_ifp = fin->fin_ifp;
+ idx *= 127;
+ idx %= IPFT_SIZE;
+
+ frag.ipfr_optmsk = fin->fin_fi.fi_optmsk & IPF_OPTCOPY;
+ frag.ipfr_secmsk = fin->fin_fi.fi_secmsk;
+ frag.ipfr_auth = fin->fin_fi.fi_auth;
+
+ /*
+ * first, make sure it isn't already there...
+ */
+ for (fp = &table[idx]; (fra = *fp); fp = &fra->ipfr_next)
+ if (!bcmp((char *)&frag.ipfr_src, (char *)&fra->ipfr_src,
+ IPFR_CMPSZ)) {
+ ATOMIC_INCL(ipfr_stats.ifs_exists);
+ return NULL;
+ }
+
+ /*
+ * allocate some memory, if possible, if not, just record that we
+ * failed to do so.
+ */
+ KMALLOC(fra, ipfr_t *);
+ if (fra == NULL) {
+ ATOMIC_INCL(ipfr_stats.ifs_nomem);
+ return NULL;
+ }
+
+ if ((fra->ipfr_rule = fin->fin_fr) != NULL) {
+ ATOMIC_INC32(fin->fin_fr->fr_ref);
+ }
+
+
+ /*
+ * Instert the fragment into the fragment table, copy the struct used
+ * in the search using bcopy rather than reassign each field.
+ * Set the ttl to the default.
+ */
+ if ((fra->ipfr_next = table[idx]))
+ table[idx]->ipfr_prev = fra;
+ fra->ipfr_prev = NULL;
+ fra->ipfr_data = NULL;
+ table[idx] = fra;
+ bcopy((char *)&frag.ipfr_src, (char *)&fra->ipfr_src, IPFR_CMPSZ);
+ fra->ipfr_ttl = fr_ipfrttl;
+ /*
+ * Compute the offset of the expected start of the next packet.
+ */
+ off = ip->ip_off & IP_OFFMASK;
+ if (!off)
+ fra->ipfr_seen0 = 1;
+ fra->ipfr_off = off + (fin->fin_dlen >> 3);
+ ATOMIC_INCL(ipfr_stats.ifs_new);
+ ATOMIC_INC32(ipfr_inuse);
+ return fra;
+}
+
+
+int ipfr_newfrag(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ ipfr_t *ipf;
+
+ if ((ip->ip_v != 4) || (fr_frag_lock))
+ return -1;
+ WRITE_ENTER(&ipf_frag);
+ ipf = ipfr_new(ip, fin, ipfr_heads);
+ RWLOCK_EXIT(&ipf_frag);
+ if (ipf == NULL) {
+ ATOMIC_INCL(frstats[fin->fin_out].fr_bnfr);
+ return -1;
+ }
+ ATOMIC_INCL(frstats[fin->fin_out].fr_nfr);
+ return 0;
+}
+
+
+int ipfr_nat_newfrag(ip, fin, nat)
+ip_t *ip;
+fr_info_t *fin;
+nat_t *nat;
+{
+ ipfr_t *ipf;
+ int off;
+
+ if ((ip->ip_v != 4) || (fr_frag_lock))
+ return -1;
+
+ off = fin->fin_off;
+ off <<= 3;
+ if ((off + fin->fin_dlen) > 0xffff || (fin->fin_dlen == 0))
+ return -1;
+
+ WRITE_ENTER(&ipf_natfrag);
+ ipf = ipfr_new(ip, fin, ipfr_nattab);
+ if (ipf != NULL) {
+ ipf->ipfr_data = nat;
+ nat->nat_data = ipf;
+ }
+ RWLOCK_EXIT(&ipf_natfrag);
+ return ipf ? 0 : -1;
+}
+
+
+/*
+ * check the fragment cache to see if there is already a record of this packet
+ * with its filter result known.
+ */
+static ipfr_t *ipfr_lookup(ip, fin, table)
+ip_t *ip;
+fr_info_t *fin;
+ipfr_t *table[];
+{
+ ipfr_t *f, frag;
+ u_int idx;
+
+ /*
+ * For fragments, we record protocol, packet id, TOS and both IP#'s
+ * (these should all be the same for all fragments of a packet).
+ *
+ * build up a hash value to index the table with.
+ */
+ frag.ipfr_p = ip->ip_p;
+ idx = ip->ip_p;
+ frag.ipfr_id = ip->ip_id;
+ idx += ip->ip_id;
+ frag.ipfr_tos = ip->ip_tos;
+ frag.ipfr_src.s_addr = ip->ip_src.s_addr;
+ idx += ip->ip_src.s_addr;
+ frag.ipfr_dst.s_addr = ip->ip_dst.s_addr;
+ idx += ip->ip_dst.s_addr;
+ frag.ipfr_ifp = fin->fin_ifp;
+ idx *= 127;
+ idx %= IPFT_SIZE;
+
+ frag.ipfr_optmsk = fin->fin_fi.fi_optmsk & IPF_OPTCOPY;
+ frag.ipfr_secmsk = fin->fin_fi.fi_secmsk;
+ frag.ipfr_auth = fin->fin_fi.fi_auth;
+
+ /*
+ * check the table, careful to only compare the right amount of data
+ */
+ for (f = table[idx]; f; f = f->ipfr_next)
+ if (!bcmp((char *)&frag.ipfr_src, (char *)&f->ipfr_src,
+ IPFR_CMPSZ)) {
+ u_short atoff, off;
+
+ off = fin->fin_off;
+
+ /*
+ * XXX - We really need to be guarding against the
+ * retransmission of (src,dst,id,offset-range) here
+ * because a fragmented packet is never resent with
+ * the same IP ID#.
+ */
+ if (f->ipfr_seen0) {
+ if (!off || (fin->fin_fl & FI_SHORT))
+ continue;
+ } else if (!off)
+ f->ipfr_seen0 = 1;
+
+ if (f != table[idx]) {
+ /*
+ * move fragment info. to the top of the list
+ * to speed up searches.
+ */
+ if ((f->ipfr_prev->ipfr_next = f->ipfr_next))
+ f->ipfr_next->ipfr_prev = f->ipfr_prev;
+ f->ipfr_next = table[idx];
+ table[idx]->ipfr_prev = f;
+ f->ipfr_prev = NULL;
+ table[idx] = f;
+ }
+ atoff = off + (fin->fin_dlen >> 3);
+ /*
+ * If we've follwed the fragments, and this is the
+ * last (in order), shrink expiration time.
+ */
+ if (off == f->ipfr_off) {
+ if (!(ip->ip_off & IP_MF))
+ f->ipfr_ttl = 1;
+ else
+ f->ipfr_off = atoff;
+ }
+ ATOMIC_INCL(ipfr_stats.ifs_hits);
+ return f;
+ }
+ return NULL;
+}
+
+
+/*
+ * functional interface for NAT lookups of the NAT fragment cache
+ */
+nat_t *ipfr_nat_knownfrag(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ ipfr_t *ipf;
+ nat_t *nat;
+ int off;
+
+ if ((fin->fin_v != 4) || (fr_frag_lock))
+ return NULL;
+
+ off = fin->fin_off;
+ off <<= 3;
+ if ((off + fin->fin_dlen) > 0xffff || (fin->fin_dlen == 0))
+ return NULL;
+
+ READ_ENTER(&ipf_natfrag);
+ ipf = ipfr_lookup(ip, fin, ipfr_nattab);
+ if (ipf != NULL) {
+ nat = ipf->ipfr_data;
+ /*
+ * This is the last fragment for this packet.
+ */
+ if ((ipf->ipfr_ttl == 1) && (nat != NULL)) {
+ nat->nat_data = NULL;
+ ipf->ipfr_data = NULL;
+ }
+ } else
+ nat = NULL;
+ RWLOCK_EXIT(&ipf_natfrag);
+ return nat;
+}
+
+
+/*
+ * functional interface for normal lookups of the fragment cache
+ */
+frentry_t *ipfr_knownfrag(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ frentry_t *fr;
+ ipfr_t *fra;
+ int off;
+
+ if ((fin->fin_v != 4) || (fr_frag_lock))
+ return NULL;
+
+ off = fin->fin_off;
+ off <<= 3;
+ if ((off + fin->fin_dlen) > 0xffff || (fin->fin_dlen == 0))
+ return NULL;
+
+ READ_ENTER(&ipf_frag);
+ fra = ipfr_lookup(ip, fin, ipfr_heads);
+ if (fra != NULL)
+ fr = fra->ipfr_rule;
+ else
+ fr = NULL;
+ RWLOCK_EXIT(&ipf_frag);
+ return fr;
+}
+
+
+/*
+ * forget any references to this external object.
+ */
+void ipfr_forget(nat)
+void *nat;
+{
+ ipfr_t *fr;
+ int idx;
+
+ WRITE_ENTER(&ipf_natfrag);
+ for (idx = IPFT_SIZE - 1; idx >= 0; idx--)
+ for (fr = ipfr_heads[idx]; fr; fr = fr->ipfr_next)
+ if (fr->ipfr_data == nat)
+ fr->ipfr_data = NULL;
+
+ RWLOCK_EXIT(&ipf_natfrag);
+}
+
+
+static void ipfr_delete(fra)
+ipfr_t *fra;
+{
+ frentry_t *fr;
+
+ fr = fra->ipfr_rule;
+ if (fr != NULL) {
+ ATOMIC_DEC32(fr->fr_ref);
+ if (fr->fr_ref == 0)
+ KFREE(fr);
+ }
+ if (fra->ipfr_prev)
+ fra->ipfr_prev->ipfr_next = fra->ipfr_next;
+ if (fra->ipfr_next)
+ fra->ipfr_next->ipfr_prev = fra->ipfr_prev;
+ KFREE(fra);
+}
+
+
+/*
+ * Free memory in use by fragment state info. kept.
+ */
+void ipfr_unload()
+{
+ ipfr_t **fp, *fra;
+ nat_t *nat;
+ int idx;
+
+ WRITE_ENTER(&ipf_frag);
+ for (idx = IPFT_SIZE - 1; idx >= 0; idx--)
+ for (fp = &ipfr_heads[idx]; (fra = *fp); ) {
+ *fp = fra->ipfr_next;
+ ipfr_delete(fra);
+ }
+ RWLOCK_EXIT(&ipf_frag);
+
+ WRITE_ENTER(&ipf_nat);
+ WRITE_ENTER(&ipf_natfrag);
+ for (idx = IPFT_SIZE - 1; idx >= 0; idx--)
+ for (fp = &ipfr_nattab[idx]; (fra = *fp); ) {
+ *fp = fra->ipfr_next;
+ nat = fra->ipfr_data;
+ if (nat != NULL) {
+ if (nat->nat_data == fra)
+ nat->nat_data = NULL;
+ }
+ ipfr_delete(fra);
+ }
+ RWLOCK_EXIT(&ipf_natfrag);
+ RWLOCK_EXIT(&ipf_nat);
+}
+
+
+void ipfr_fragexpire()
+{
+ ipfr_t **fp, *fra;
+ nat_t *nat;
+ int idx;
+#if defined(_KERNEL)
+# if !SOLARIS
+ int s;
+# endif
+#endif
+
+ if (fr_frag_lock)
+ return;
+
+ SPL_NET(s);
+ WRITE_ENTER(&ipf_frag);
+
+ /*
+ * Go through the entire table, looking for entries to expire,
+ * decreasing the ttl by one for each entry. If it reaches 0,
+ * remove it from the chain and free it.
+ */
+ for (idx = IPFT_SIZE - 1; idx >= 0; idx--)
+ for (fp = &ipfr_heads[idx]; (fra = *fp); ) {
+ --fra->ipfr_ttl;
+ if (fra->ipfr_ttl == 0) {
+ *fp = fra->ipfr_next;
+ ipfr_delete(fra);
+ ATOMIC_INCL(ipfr_stats.ifs_expire);
+ ATOMIC_DEC32(ipfr_inuse);
+ } else
+ fp = &fra->ipfr_next;
+ }
+ RWLOCK_EXIT(&ipf_frag);
+
+ /*
+ * Same again for the NAT table, except that if the structure also
+ * still points to a NAT structure, and the NAT structure points back
+ * at the one to be free'd, NULL the reference from the NAT struct.
+ * NOTE: We need to grab both mutex's early, and in this order so as
+ * to prevent a deadlock if both try to expire at the same time.
+ */
+ WRITE_ENTER(&ipf_nat);
+ WRITE_ENTER(&ipf_natfrag);
+ for (idx = IPFT_SIZE - 1; idx >= 0; idx--)
+ for (fp = &ipfr_nattab[idx]; (fra = *fp); ) {
+ --fra->ipfr_ttl;
+ if (fra->ipfr_ttl == 0) {
+ ATOMIC_INCL(ipfr_stats.ifs_expire);
+ ATOMIC_DEC32(ipfr_inuse);
+ nat = fra->ipfr_data;
+ if (nat != NULL) {
+ if (nat->nat_data == fra)
+ nat->nat_data = NULL;
+ }
+ *fp = fra->ipfr_next;
+ ipfr_delete(fra);
+ } else
+ fp = &fra->ipfr_next;
+ }
+ RWLOCK_EXIT(&ipf_natfrag);
+ RWLOCK_EXIT(&ipf_nat);
+ SPL_X(s);
+}
+
+
+/*
+ * Slowly expire held state for fragments. Timeouts are set * in expectation
+ * of this being called twice per second.
+ */
+#ifdef _KERNEL
+# if (BSD >= 199306) || SOLARIS || defined(__sgi)
+# if defined(SOLARIS2) && (SOLARIS2 < 7)
+void ipfr_slowtimer()
+# else
+void ipfr_slowtimer __P((void *ptr))
+# endif
+# else
+int ipfr_slowtimer()
+# endif
+#else
+void ipfr_slowtimer()
+#endif
+{
+#if defined(_KERNEL) && SOLARIS
+ extern int fr_running;
+
+ if (fr_running <= 0)
+ return;
+ READ_ENTER(&ipf_solaris);
+#endif
+
+#if defined(__sgi) && defined(_KERNEL)
+ ipfilter_sgi_intfsync();
+#endif
+
+ ipfr_fragexpire();
+ fr_timeoutstate();
+ ip_natexpire();
+ fr_authexpire();
+#if defined(_KERNEL)
+# if SOLARIS
+ ipfr_timer_id = timeout(ipfr_slowtimer, NULL, drv_usectohz(500000));
+ RWLOCK_EXIT(&ipf_solaris);
+# else
+# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104240000)
+ callout_reset(&ipfr_slowtimer_ch, hz / 2, ipfr_slowtimer, NULL);
+# else
+# if (__FreeBSD_version >= 300000)
+ ipfr_slowtimer_ch = timeout(ipfr_slowtimer, NULL, hz/2);
+# else
+# if defined(__OpenBSD__)
+ timeout_add(&ipfr_slowtimer_ch, hz/2);
+# else
+ timeout(ipfr_slowtimer, NULL, hz/2);
+# endif
+# endif
+# if (BSD < 199306) && !defined(__sgi)
+ return 0;
+# endif /* FreeBSD */
+# endif /* NetBSD */
+# endif /* SOLARIS */
+#endif /* defined(_KERNEL) */
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_frag.h b/sys/contrib/ipfilter/netinet/ip_frag.h
new file mode 100644
index 0000000..fc737c7
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_frag.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ip_frag.h 1.5 3/24/96
+ * $Id: ip_frag.h,v 2.4.2.2 2000/11/10 13:10:54 darrenr Exp $
+ * $FreeBSD$
+ */
+
+#ifndef __IP_FRAG_H__
+#define __IP_FRAG_H__
+
+#define IPFT_SIZE 257
+
+typedef struct ipfr {
+ struct ipfr *ipfr_next, *ipfr_prev;
+ void *ipfr_data;
+ struct in_addr ipfr_src;
+ struct in_addr ipfr_dst;
+ void *ipfr_ifp;
+ u_32_t ipfr_optmsk;
+ u_short ipfr_secmsk;
+ u_short ipfr_auth;
+ u_short ipfr_id;
+ u_char ipfr_p;
+ u_char ipfr_tos;
+ u_short ipfr_off;
+ u_char ipfr_ttl;
+ u_char ipfr_seen0;
+ frentry_t *ipfr_rule;
+} ipfr_t;
+
+
+typedef struct ipfrstat {
+ u_long ifs_exists; /* add & already exists */
+ u_long ifs_nomem;
+ u_long ifs_new;
+ u_long ifs_hits;
+ u_long ifs_expire;
+ u_long ifs_inuse;
+ struct ipfr **ifs_table;
+ struct ipfr **ifs_nattab;
+} ipfrstat_t;
+
+#define IPFR_CMPSZ (offsetof(ipfr_t, ipfr_off) - \
+ offsetof(ipfr_t, ipfr_src))
+
+extern int fr_ipfrttl;
+extern int fr_frag_lock;
+extern ipfrstat_t *ipfr_fragstats __P((void));
+extern int ipfr_newfrag __P((ip_t *, fr_info_t *));
+extern int ipfr_nat_newfrag __P((ip_t *, fr_info_t *, struct nat *));
+extern nat_t *ipfr_nat_knownfrag __P((ip_t *, fr_info_t *));
+extern frentry_t *ipfr_knownfrag __P((ip_t *, fr_info_t *));
+extern void ipfr_forget __P((void *));
+extern void ipfr_unload __P((void));
+extern void ipfr_fragexpire __P((void));
+
+#ifdef _KERNEL
+# if (BSD >= 199306) || SOLARIS || defined(__sgi)
+# if defined(SOLARIS2) && (SOLARIS2 < 7)
+extern void ipfr_slowtimer __P((void));
+# else
+extern void ipfr_slowtimer __P((void *));
+# endif
+# else
+extern int ipfr_slowtimer __P((void));
+# endif /* (BSD >= 199306) || SOLARIS */
+#else
+extern void ipfr_slowtimer __P((void));
+#endif /* _KERNEL */
+
+#endif /* __IP_FIL_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
new file mode 100644
index 0000000..56973da
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
@@ -0,0 +1,1213 @@
+/*
+ * Simple FTP transparent proxy for in-kernel use. For use with the NAT
+ * code.
+ *
+ * $FreeBSD$
+ */
+#if SOLARIS && defined(_KERNEL)
+extern kmutex_t ipf_rw;
+#endif
+
+#define isdigit(x) ((x) >= '0' && (x) <= '9')
+#define isupper(x) (((unsigned)(x) >= 'A') && ((unsigned)(x) <= 'Z'))
+#define islower(x) (((unsigned)(x) >= 'a') && ((unsigned)(x) <= 'z'))
+#define isalpha(x) (isupper(x) || islower(x))
+#define toupper(x) (isupper(x) ? (x) : (x) - 'a' + 'A')
+
+#define IPF_FTP_PROXY
+
+#define IPF_MINPORTLEN 18
+#define IPF_MAXPORTLEN 30
+#define IPF_MIN227LEN 39
+#define IPF_MAX227LEN 51
+#define IPF_FTPBUFSZ 96 /* This *MUST* be >= 53! */
+
+#define FTPXY_GO 0
+#define FTPXY_INIT 1
+#define FTPXY_USER_1 2
+#define FTPXY_USOK_1 3
+#define FTPXY_PASS_1 4
+#define FTPXY_PAOK_1 5
+#define FTPXY_AUTH_1 6
+#define FTPXY_AUOK_1 7
+#define FTPXY_ADAT_1 8
+#define FTPXY_ADOK_1 9
+#define FTPXY_ACCT_1 10
+#define FTPXY_ACOK_1 11
+#define FTPXY_USER_2 12
+#define FTPXY_USOK_2 13
+#define FTPXY_PASS_2 14
+#define FTPXY_PAOK_2 15
+
+/*
+ * Values for FTP commands. Numerics cover 0-999
+ */
+#define FTPXY_C_PASV 1000
+
+int ippr_ftp_client __P((fr_info_t *, ip_t *, nat_t *, ftpinfo_t *, int));
+int ippr_ftp_complete __P((char *, size_t));
+int ippr_ftp_in __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_ftp_init __P((void));
+int ippr_ftp_new __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_ftp_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_ftp_pasv __P((fr_info_t *, ip_t *, nat_t *, ftpinfo_t *, int));
+int ippr_ftp_port __P((fr_info_t *, ip_t *, nat_t *, ftpside_t *, int));
+int ippr_ftp_process __P((fr_info_t *, ip_t *, nat_t *, ftpinfo_t *, int));
+int ippr_ftp_server __P((fr_info_t *, ip_t *, nat_t *, ftpinfo_t *, int));
+int ippr_ftp_valid __P((ftpinfo_t *, int, char *, size_t));
+int ippr_ftp_server_valid __P((ftpside_t *, char *, size_t));
+int ippr_ftp_client_valid __P((ftpside_t *, char *, size_t));
+u_short ippr_ftp_atoi __P((char **));
+
+static frentry_t ftppxyfr;
+int ippr_ftp_pasvonly = 0;
+int ippr_ftp_insecure = 0;
+int ippr_ftp_forcepasv = 0;
+
+
+/*
+ * Initialize local structures.
+ */
+int ippr_ftp_init()
+{
+ bzero((char *)&ftppxyfr, sizeof(ftppxyfr));
+ ftppxyfr.fr_ref = 1;
+ ftppxyfr.fr_flags = FR_INQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE;
+ return 0;
+}
+
+
+int ippr_ftp_new(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ftpinfo_t *ftp;
+ ftpside_t *f;
+
+ KMALLOC(ftp, ftpinfo_t *);
+ if (ftp == NULL)
+ return -1;
+ aps->aps_data = ftp;
+ aps->aps_psiz = sizeof(ftpinfo_t);
+
+ bzero((char *)ftp, sizeof(*ftp));
+ f = &ftp->ftp_side[0];
+ f->ftps_rptr = f->ftps_buf;
+ f->ftps_wptr = f->ftps_buf;
+ f = &ftp->ftp_side[1];
+ f->ftps_rptr = f->ftps_buf;
+ f->ftps_wptr = f->ftps_buf;
+ ftp->ftp_passok = FTPXY_INIT;
+ return 0;
+}
+
+
+int ippr_ftp_port(fin, ip, nat, f, dlen)
+fr_info_t *fin;
+ip_t *ip;
+nat_t *nat;
+ftpside_t *f;
+int dlen;
+{
+ tcphdr_t *tcp, tcph, *tcp2 = &tcph;
+ char newbuf[IPF_FTPBUFSZ], *s;
+ u_int a1, a2, a3, a4;
+ struct in_addr swip;
+ u_short a5, a6, sp;
+ size_t nlen, olen;
+ fr_info_t fi;
+ int inc, off;
+ nat_t *ipn;
+ mb_t *m;
+#if SOLARIS
+ mb_t *m1;
+#endif
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+ /*
+ * Check for client sending out PORT message.
+ */
+ if (dlen < IPF_MINPORTLEN) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_port:dlen(%d) < IPF_MINPORTLEN\n", dlen);
+#endif
+ return 0;
+ }
+ off = fin->fin_hlen + (tcp->th_off << 2);
+ /*
+ * Skip the PORT command + space
+ */
+ s = f->ftps_rptr + 5;
+ /*
+ * Pick out the address components, two at a time.
+ */
+ a1 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:ippr_ftp_atoi(1) failed\n");
+#endif
+ return 0;
+ }
+ a2 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:ippr_ftp_atoi(2) failed\n");
+#endif
+ return 0;
+ }
+ /*
+ * check that IP address in the PORT/PASV reply is the same as the
+ * sender of the command - prevents using PORT for port scanning.
+ */
+ a1 <<= 16;
+ a1 |= a2;
+ if (a1 != ntohl(nat->nat_inip.s_addr)) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:a1 != nat->nat_inip\n");
+#endif
+ return 0;
+ }
+
+ a5 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:ippr_ftp_atoi(3) failed\n");
+#endif
+ return 0;
+ }
+ if (*s == ')')
+ s++;
+
+ /*
+ * check for CR-LF at the end.
+ */
+ if (*s == '\n')
+ s--;
+ if ((*s == '\r') && (*(s + 1) == '\n')) {
+ s += 2;
+ a6 = a5 & 0xff;
+ } else {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:missing cr-lf\n");
+#endif
+ return 0;
+ }
+ a5 >>= 8;
+ a5 &= 0xff;
+ /*
+ * Calculate new address parts for PORT command
+ */
+ a1 = ntohl(ip->ip_src.s_addr);
+ a2 = (a1 >> 16) & 0xff;
+ a3 = (a1 >> 8) & 0xff;
+ a4 = a1 & 0xff;
+ a1 >>= 24;
+ olen = s - f->ftps_rptr;
+ /* DO NOT change this to snprintf! */
+ (void) sprintf(newbuf, "%s %u,%u,%u,%u,%u,%u\r\n",
+ "PORT", a1, a2, a3, a4, a5, a6);
+
+ nlen = strlen(newbuf);
+ inc = nlen - olen;
+ if ((inc + ip->ip_len) > 65535) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_port:inc(%d) + ip->ip_len > 65535\n", inc);
+#endif
+ return 0;
+ }
+
+#if !defined(_KERNEL)
+ m = *((mb_t **)fin->fin_mp);
+ bcopy(newbuf, (char *)m + off, nlen);
+#else
+# if SOLARIS
+ m = fin->fin_qfm;
+ for (m1 = m; m1->b_cont; m1 = m1->b_cont)
+ ;
+ if ((inc > 0) && (m1->b_datap->db_lim - m1->b_wptr < inc)) {
+ mblk_t *nm;
+
+ /* alloc enough to keep same trailer space for lower driver */
+ nm = allocb(nlen, BPRI_MED);
+ PANIC((!nm),("ippr_ftp_out: allocb failed"));
+
+ nm->b_band = m1->b_band;
+ nm->b_wptr += nlen;
+
+ m1->b_wptr -= olen;
+ PANIC((m1->b_wptr < m1->b_rptr),
+ ("ippr_ftp_out: cannot handle fragmented data block"));
+
+ linkb(m1, nm);
+ } else {
+ if (m1->b_datap->db_struiolim == m1->b_wptr)
+ m1->b_datap->db_struiolim += inc;
+ m1->b_datap->db_struioflag &= ~STRUIO_IP;
+ m1->b_wptr += inc;
+ }
+ copyin_mblk(m, off, nlen, newbuf);
+# else
+ m = *((mb_t **)fin->fin_mp);
+ if (inc < 0)
+ m_adj(m, inc);
+ /* the mbuf chain will be extended if necessary by m_copyback() */
+ m_copyback(m, off, nlen, newbuf);
+# ifdef M_PKTHDR
+ if (!(m->m_flags & M_PKTHDR))
+ m->m_pkthdr.len += inc;
+# endif
+# endif
+#endif
+ if (inc != 0) {
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+ register u_32_t sum1, sum2;
+
+ sum1 = ip->ip_len;
+ sum2 = ip->ip_len + inc;
+
+ /* Because ~1 == -2, We really need ~1 == -1 */
+ if (sum1 > sum2)
+ sum2--;
+ sum2 -= sum1;
+ sum2 = (sum2 & 0xffff) + (sum2 >> 16);
+
+ fix_outcksum(fin, &ip->ip_sum, sum2);
+#endif
+ ip->ip_len += inc;
+ }
+
+ /*
+ * Add skeleton NAT entry for connection which will come back the
+ * other way.
+ */
+ sp = (a5 << 8 | a6);
+ /*
+ * Don't allow the PORT command to specify a port < 1024 due to
+ * security crap.
+ */
+ if (sp < 1024) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_port:sp(%d) < 1024\n", sp);
+#endif
+ return 0;
+ }
+
+ /*
+ * The server may not make the connection back from port 20, but
+ * it is the most likely so use it here to check for a conflicting
+ * mapping.
+ */
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ fi.fin_data[0] = sp;
+ fi.fin_data[1] = fin->fin_data[1] - 1;
+ ipn = nat_outlookup(&fi, IPN_TCP, nat->nat_p, nat->nat_inip,
+ ip->ip_dst, 0);
+ if (ipn == NULL) {
+ int slen;
+
+ slen = ip->ip_len;
+ ip->ip_len = fin->fin_hlen + sizeof(*tcp2);
+ bzero((char *)tcp2, sizeof(*tcp2));
+ tcp2->th_win = htons(8192);
+ tcp2->th_sport = htons(sp);
+ tcp2->th_off = 5;
+ tcp2->th_flags = TH_SYN;
+ tcp2->th_dport = 0; /* XXX - don't specify remote port */
+ fi.fin_data[1] = 0;
+ fi.fin_dlen = sizeof(*tcp2);
+ fi.fin_dp = (char *)tcp2;
+ fi.fin_fr = &ftppxyfr;
+ fi.fin_out = 1;
+ swip = ip->ip_src;
+ fi.fin_fi.fi_saddr = nat->nat_inip.s_addr;
+ ip->ip_src = nat->nat_inip;
+ ipn = nat_new(&fi, ip, nat->nat_ptr, NULL, IPN_TCP|FI_W_DPORT,
+ NAT_OUTBOUND);
+ if (ipn != NULL) {
+ ipn->nat_age = fr_defnatage;
+ (void) fr_addstate(ip, &fi, NULL,
+ FI_W_DPORT|FI_IGNOREPKT);
+ }
+ ip->ip_len = slen;
+ ip->ip_src = swip;
+ }
+ return inc;
+}
+
+
+int ippr_ftp_client(fin, ip, nat, ftp, dlen)
+fr_info_t *fin;
+nat_t *nat;
+ftpinfo_t *ftp;
+ip_t *ip;
+int dlen;
+{
+ char *rptr, *wptr, cmd[6], c;
+ ftpside_t *f;
+ int inc, i;
+
+ inc = 0;
+ f = &ftp->ftp_side[0];
+ rptr = f->ftps_rptr;
+ wptr = f->ftps_wptr;
+
+ for (i = 0; (i < 5) && (i < dlen); i++) {
+ c = rptr[i];
+ if (isalpha(c)) {
+ cmd[i] = toupper(c);
+ } else {
+ cmd[i] = c;
+ }
+ }
+ cmd[i] = '\0';
+
+ ftp->ftp_incok = 0;
+ if (!strncmp(cmd, "USER ", 5) || !strncmp(cmd, "XAUT ", 5)) {
+ if (ftp->ftp_passok == FTPXY_ADOK_1 ||
+ ftp->ftp_passok == FTPXY_AUOK_1) {
+ ftp->ftp_passok = FTPXY_USER_2;
+ ftp->ftp_incok = 1;
+ } else {
+ ftp->ftp_passok = FTPXY_USER_1;
+ ftp->ftp_incok = 1;
+ }
+ } else if (!strncmp(cmd, "AUTH ", 5)) {
+ ftp->ftp_passok = FTPXY_AUTH_1;
+ ftp->ftp_incok = 1;
+ } else if (!strncmp(cmd, "PASS ", 5)) {
+ if (ftp->ftp_passok == FTPXY_USOK_1) {
+ ftp->ftp_passok = FTPXY_PASS_1;
+ ftp->ftp_incok = 1;
+ } else if (ftp->ftp_passok == FTPXY_USOK_2) {
+ ftp->ftp_passok = FTPXY_PASS_2;
+ ftp->ftp_incok = 1;
+ }
+ } else if ((ftp->ftp_passok == FTPXY_AUOK_1) &&
+ !strncmp(cmd, "ADAT ", 5)) {
+ ftp->ftp_passok = FTPXY_ADAT_1;
+ ftp->ftp_incok = 1;
+ } else if ((ftp->ftp_passok == FTPXY_PAOK_1 ||
+ ftp->ftp_passok == FTPXY_PAOK_2) &&
+ !strncmp(cmd, "ACCT ", 5)) {
+ ftp->ftp_passok = FTPXY_ACCT_1;
+ ftp->ftp_incok = 1;
+ } else if ((ftp->ftp_passok == FTPXY_GO) && !ippr_ftp_pasvonly &&
+ !strncmp(cmd, "PORT ", 5)) {
+ inc = ippr_ftp_port(fin, ip, nat, f, dlen);
+ } else if (ippr_ftp_insecure && !ippr_ftp_pasvonly &&
+ !strncmp(cmd, "PORT ", 5)) {
+ inc = ippr_ftp_port(fin, ip, nat, f, dlen);
+ }
+
+ while ((*rptr++ != '\n') && (rptr < wptr))
+ ;
+ f->ftps_rptr = rptr;
+ return inc;
+}
+
+
+int ippr_ftp_pasv(fin, ip, nat, ftp, dlen)
+fr_info_t *fin;
+ip_t *ip;
+nat_t *nat;
+ftpinfo_t *ftp;
+int dlen;
+{
+ tcphdr_t *tcp, tcph, *tcp2 = &tcph;
+ struct in_addr swip, swip2;
+ u_int a1, a2, a3, a4;
+ u_short a5, a6, dp;
+ fr_info_t fi;
+ ftpside_t *f;
+ nat_t *ipn;
+ int inc;
+ char *s;
+
+ if (ippr_ftp_forcepasv != 0 &&
+ ftp->ftp_side[0].ftps_cmds != FTPXY_C_PASV) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_pasv:ftps_cmds(%d) != FTPXY_C_PASV\n",
+ ftp->ftp_side[0].ftps_cmds);
+#endif
+ return 0;
+ }
+
+ f = &ftp->ftp_side[1];
+
+#define PASV_REPLEN 24
+ /*
+ * Check for PASV reply message.
+ */
+ if (dlen < IPF_MIN227LEN) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_pasv:dlen(%d) < IPF_MIN227LEN\n", dlen);
+#endif
+ return 0;
+ } else if (strncmp(f->ftps_rptr,
+ "227 Entering Passive Mod", PASV_REPLEN)) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:227 reply wrong\n");
+#endif
+ return 0;
+ }
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+
+ /*
+ * Skip the PASV reply + space
+ */
+ s = f->ftps_rptr + PASV_REPLEN;
+ while (*s && !isdigit(*s))
+ s++;
+ /*
+ * Pick out the address components, two at a time.
+ */
+ a1 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:ippr_ftp_atoi(1) failed\n");
+#endif
+ return 0;
+ }
+ a2 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:ippr_ftp_atoi(2) failed\n");
+#endif
+ return 0;
+ }
+
+ /*
+ * check that IP address in the PORT/PASV reply is the same as the
+ * sender of the command - prevents using PORT for port scanning.
+ */
+ a1 <<= 16;
+ a1 |= a2;
+ if (a1 != ntohl(nat->nat_oip.s_addr)) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:a1 != nat->nat_oip\n");
+#endif
+ return 0;
+ }
+
+ a5 = ippr_ftp_atoi(&s);
+ if (s == NULL) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:ippr_ftp_atoi(3) failed\n");
+#endif
+ return 0;
+ }
+
+ if (*s == ')')
+ s++;
+ if (*s == '.')
+ s++;
+ if (*s == '\n')
+ s--;
+ /*
+ * check for CR-LF at the end.
+ */
+ if ((*s == '\r') && (*(s + 1) == '\n')) {
+ s += 2;
+ a6 = a5 & 0xff;
+ } else {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_pasv:missing cr-lf\n");
+#endif
+ return 0;
+ }
+ a5 >>= 8;
+ /*
+ * Calculate new address parts for 227 reply
+ */
+ a1 = ntohl(ip->ip_src.s_addr);
+ a2 = (a1 >> 16) & 0xff;
+ a3 = (a1 >> 8) & 0xff;
+ a4 = a1 & 0xff;
+ a1 >>= 24;
+ inc = 0;
+#if 0
+ olen = s - f->ftps_rptr;
+ (void) sprintf(newbuf, "%s %u,%u,%u,%u,%u,%u\r\n",
+ "227 Entering Passive Mode", a1, a2, a3, a4, a5, a6);
+ nlen = strlen(newbuf);
+ inc = nlen - olen;
+ if ((inc + ip->ip_len) > 65535)
+ return 0;
+
+#if !defined(_KERNEL)
+ m = *((mb_t **)fin->fin_mp);
+ m_copyback(m, off, nlen, newbuf);
+#else
+# if SOLARIS
+ m = fin->fin_qfm;
+ for (m1 = m; m1->b_cont; m1 = m1->b_cont)
+ ;
+ if ((inc > 0) && (m1->b_datap->db_lim - m1->b_wptr < inc)) {
+ mblk_t *nm;
+
+ /* alloc enough to keep same trailer space for lower driver */
+ nm = allocb(nlen, BPRI_MED);
+ PANIC((!nm),("ippr_ftp_out: allocb failed"));
+
+ nm->b_band = m1->b_band;
+ nm->b_wptr += nlen;
+
+ m1->b_wptr -= olen;
+ PANIC((m1->b_wptr < m1->b_rptr),
+ ("ippr_ftp_out: cannot handle fragmented data block"));
+
+ linkb(m1, nm);
+ } else {
+ m1->b_wptr += inc;
+ }
+ /*copyin_mblk(m, off, nlen, newbuf);*/
+# else /* SOLARIS */
+ m = *((mb_t **)fin->fin_mp);
+ if (inc < 0)
+ m_adj(m, inc);
+ /* the mbuf chain will be extended if necessary by m_copyback() */
+ /*m_copyback(m, off, nlen, newbuf);*/
+# endif /* SOLARIS */
+#endif /* _KERNEL */
+ if (inc != 0) {
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+ register u_32_t sum1, sum2;
+
+ sum1 = ip->ip_len;
+ sum2 = ip->ip_len + inc;
+
+ /* Because ~1 == -2, We really need ~1 == -1 */
+ if (sum1 > sum2)
+ sum2--;
+ sum2 -= sum1;
+ sum2 = (sum2 & 0xffff) + (sum2 >> 16);
+
+ fix_outcksum(fin, &ip->ip_sum, sum2);
+#endif /* SOLARIS || defined(__sgi) */
+ ip->ip_len += inc;
+ }
+#endif /* 0 */
+
+ /*
+ * Add skeleton NAT entry for connection which will come back the
+ * other way.
+ */
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ fi.fin_data[0] = 0;
+ dp = htons(fin->fin_data[1] - 1);
+ fi.fin_data[1] = ntohs(dp);
+ ipn = nat_outlookup(&fi, IPN_TCP, nat->nat_p, nat->nat_inip,
+ ip->ip_dst, 0);
+ if (ipn == NULL) {
+ int slen;
+
+ slen = ip->ip_len;
+ ip->ip_len = fin->fin_hlen + sizeof(*tcp2);
+ bzero((char *)tcp2, sizeof(*tcp2));
+ tcp2->th_win = htons(8192);
+ tcp2->th_sport = 0; /* XXX - fake it for nat_new */
+ tcp2->th_off = 5;
+ tcp2->th_flags = TH_SYN;
+ fi.fin_data[1] = a5 << 8 | a6;
+ fi.fin_dlen = sizeof(*tcp2);
+ tcp2->th_dport = htons(fi.fin_data[1]);
+ fi.fin_data[0] = 0;
+ fi.fin_dp = (char *)tcp2;
+ fi.fin_fr = &ftppxyfr;
+ fi.fin_out = 1;
+ swip = ip->ip_src;
+ swip2 = ip->ip_dst;
+ fi.fin_fi.fi_daddr = ip->ip_src.s_addr;
+ fi.fin_fi.fi_saddr = nat->nat_inip.s_addr;
+ ip->ip_dst = ip->ip_src;
+ ip->ip_src = nat->nat_inip;
+ ipn = nat_new(&fi, ip, nat->nat_ptr, NULL, IPN_TCP|FI_W_SPORT,
+ NAT_OUTBOUND);
+ if (ipn != NULL) {
+ ipn->nat_age = fr_defnatage;
+ (void) fr_addstate(ip, &fi, NULL,
+ FI_W_SPORT|FI_IGNOREPKT);
+ }
+ ip->ip_len = slen;
+ ip->ip_src = swip;
+ ip->ip_dst = swip2;
+ }
+ return inc;
+}
+
+
+int ippr_ftp_server(fin, ip, nat, ftp, dlen)
+fr_info_t *fin;
+ip_t *ip;
+nat_t *nat;
+ftpinfo_t *ftp;
+int dlen;
+{
+ char *rptr, *wptr;
+ ftpside_t *f;
+ int inc;
+
+ inc = 0;
+ f = &ftp->ftp_side[1];
+ rptr = f->ftps_rptr;
+ wptr = f->ftps_wptr;
+
+ if (!isdigit(*rptr) || !isdigit(*(rptr + 1)) || !isdigit(*(rptr + 2)))
+ return 0;
+ if (ftp->ftp_passok == FTPXY_GO) {
+ if (!strncmp(rptr, "227 ", 4))
+ inc = ippr_ftp_pasv(fin, ip, nat, ftp, dlen);
+ } else if (ippr_ftp_insecure && !strncmp(rptr, "227 ", 4)) {
+ inc = ippr_ftp_pasv(fin, ip, nat, ftp, dlen);
+ } else if (*rptr == '5' || *rptr == '4')
+ ftp->ftp_passok = FTPXY_INIT;
+ else if (ftp->ftp_incok) {
+ if (*rptr == '3') {
+ if (ftp->ftp_passok == FTPXY_ACCT_1)
+ ftp->ftp_passok = FTPXY_GO;
+ else
+ ftp->ftp_passok++;
+ } else if (*rptr == '2') {
+ switch (ftp->ftp_passok)
+ {
+ case FTPXY_USER_1 :
+ case FTPXY_USER_2 :
+ case FTPXY_PASS_1 :
+ case FTPXY_PASS_2 :
+ case FTPXY_ACCT_1 :
+ ftp->ftp_passok = FTPXY_GO;
+ break;
+ default :
+ ftp->ftp_passok += 3;
+ break;
+ }
+ }
+ }
+ ftp->ftp_incok = 0;
+
+ while ((*rptr++ != '\n') && (rptr < wptr))
+ ;
+ f->ftps_rptr = rptr;
+ return inc;
+}
+
+
+/*
+ * Look to see if the buffer starts with something which we recognise as
+ * being the correct syntax for the FTP protocol.
+ */
+int ippr_ftp_client_valid(ftps, buf, len)
+ftpside_t *ftps;
+char *buf;
+size_t len;
+{
+ register char *s, c;
+ register size_t i = len;
+ char cmd[5];
+
+ if (i < 5) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_client_valid:i(%d) < 5\n", i);
+#endif
+ return 2;
+ }
+ s = buf;
+ c = *s++;
+ i--;
+
+ if (isalpha(c)) {
+ cmd[0] = toupper(c);
+ c = *s++;
+ i--;
+ if (isalpha(c)) {
+ cmd[1] = toupper(c);
+ c = *s++;
+ i--;
+ if (isalpha(c)) {
+ cmd[2] = toupper(c);
+ c = *s++;
+ i--;
+ if (isalpha(c)) {
+ cmd[3] = toupper(c);
+ c = *s++;
+ i--;
+ if ((c != ' ') && (c != '\r'))
+ goto bad_client_command;
+ } else if ((c != ' ') && (c != '\r'))
+ goto bad_client_command;
+ } else
+ goto bad_client_command;
+ } else
+ goto bad_client_command;
+ } else {
+bad_client_command:
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_client_valid:bad cmd:len %d i %d c 0x%x\n",
+ i, len, c);
+#endif
+ return 1;
+ }
+
+ for (; i; i--) {
+ c = *s++;
+ if (c == '\n') {
+ cmd[4] = '\0';
+ if (!strcmp(cmd, "PASV"))
+ ftps->ftps_cmds = FTPXY_C_PASV;
+ else
+ ftps->ftps_cmds = 0;
+ return 0;
+ }
+ }
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_client_valid:junk after cmd[%s]\n", buf);
+#endif
+ return 2;
+}
+
+
+int ippr_ftp_server_valid(ftps, buf, len)
+ftpside_t *ftps;
+char *buf;
+size_t len;
+{
+ register char *s, c;
+ register size_t i = len;
+ int cmd;
+
+ if (i < 5)
+ return 2;
+ s = buf;
+ c = *s++;
+ cmd = 0;
+ i--;
+
+ if (isdigit(c)) {
+ cmd = (c - '0') * 100;
+ c = *s++;
+ i--;
+ if (isdigit(c)) {
+ cmd += (c - '0') * 10;
+ c = *s++;
+ i--;
+ if (isdigit(c)) {
+ cmd += (c - '0');
+ c = *s++;
+ i--;
+ if ((c != '-') && (c != ' '))
+ goto bad_server_command;
+ } else
+ goto bad_server_command;
+ } else
+ goto bad_server_command;
+ } else {
+bad_server_command:
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_server_valid:bad cmd:len %d i %d c 0x%x\n",
+ i, len, c);
+#endif
+ return 1;
+ }
+
+ for (; i; i--) {
+ c = *s++;
+ if (c == '\n') {
+ ftps->ftps_cmds = cmd;
+ return 0;
+ }
+ }
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout, "ippr_ftp_server_valid:junk after cmd[%s]\n", buf);
+#endif
+ return 2;
+}
+
+
+int ippr_ftp_valid(ftp, side, buf, len)
+ftpinfo_t *ftp;
+int side;
+char *buf;
+size_t len;
+{
+ ftpside_t *ftps;
+ int ret;
+
+ ftps = &ftp->ftp_side[side];
+
+ if (side == 0)
+ ret = ippr_ftp_client_valid(ftps, buf, len);
+ else
+ ret = ippr_ftp_server_valid(ftps, buf, len);
+ return ret;
+}
+
+
+/*
+ * rv == 0 for outbound processing,
+ * rv == 1 for inbound processing.
+ */
+int ippr_ftp_process(fin, ip, nat, ftp, rv)
+fr_info_t *fin;
+ip_t *ip;
+nat_t *nat;
+ftpinfo_t *ftp;
+int rv;
+{
+ int mlen, len, off, inc, i, sel, sel2, ok, ackoff, seqoff;
+ u_32_t thseq, thack;
+ char *rptr, *wptr;
+ ap_session_t *aps;
+ ftpside_t *f, *t;
+ tcphdr_t *tcp;
+ mb_t *m;
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+ off = fin->fin_hlen + (tcp->th_off << 2);
+#if SOLARIS && defined(_KERNEL)
+ m = fin->fin_qfm;
+#else
+ m = *((mb_t **)fin->fin_mp);
+#endif
+
+#ifndef _KERNEL
+ mlen = mbuflen(m);
+#else
+# if SOLARIS
+ mlen = msgdsize(m);
+# else
+ mlen = mbufchainlen(m);
+# endif
+#endif
+ mlen -= off;
+
+ aps = nat->nat_aps;
+ t = &ftp->ftp_side[1 - rv];
+ f = &ftp->ftp_side[rv];
+ thseq = ntohl(tcp->th_seq);
+ thack = ntohl(tcp->th_ack);
+
+ sel = aps->aps_sel[1 - rv];
+ sel2 = aps->aps_sel[rv];
+ if (rv == 0) {
+ seqoff = aps->aps_seqoff[sel];
+ if (aps->aps_seqmin[sel] > seqoff + thseq)
+ seqoff = aps->aps_seqoff[!sel];
+ ackoff = aps->aps_ackoff[sel2];
+ if (aps->aps_ackmin[sel2] > ackoff + thack)
+ ackoff = aps->aps_ackoff[!sel2];
+ } else {
+#if PROXY_DEBUG
+ printf("seqoff %d thseq %x ackmin %x\n", seqoff, thseq,
+ aps->aps_ackmin[sel]);
+#endif
+ seqoff = aps->aps_ackoff[sel];
+ if (aps->aps_ackmin[sel] > seqoff + thseq)
+ seqoff = aps->aps_ackoff[!sel];
+
+#if PROXY_DEBUG
+ printf("ackoff %d thack %x seqmin %x\n", ackoff, thack,
+ aps->aps_seqmin[sel2]);
+#endif
+ ackoff = aps->aps_seqoff[sel2];
+ if (ackoff > 0) {
+ if (aps->aps_seqmin[sel2] > ackoff + thack)
+ ackoff = aps->aps_seqoff[!sel2];
+ } else {
+ if (aps->aps_seqmin[sel2] > thack)
+ ackoff = aps->aps_seqoff[!sel2];
+ }
+ }
+#if PROXY_DEBUG
+ printf("%s: %x seq %x/%d ack %x/%d len %d\n", rv ? "IN" : "OUT",
+ tcp->th_flags, thseq, seqoff, thack, ackoff, mlen);
+ printf("sel %d seqmin %x/%x offset %d/%d\n", sel,
+ aps->aps_seqmin[sel], aps->aps_seqmin[sel2],
+ aps->aps_seqoff[sel], aps->aps_seqoff[sel2]);
+ printf("sel %d ackmin %x/%x offset %d/%d\n", sel2,
+ aps->aps_ackmin[sel], aps->aps_ackmin[sel2],
+ aps->aps_ackoff[sel], aps->aps_ackoff[sel2]);
+#endif
+
+ /*
+ * XXX - Ideally, this packet should get dropped because we now know
+ * that it is out of order (and there is no real danger in doing so
+ * apart from causing packets to go through here ordered).
+ */
+#if PROXY_DEBUG
+ printf("rv %d t:seq[0] %x seq[1] %x %d/%d\n",
+ rv, t->ftps_seq[0], t->ftps_seq[1], seqoff, ackoff);
+#endif
+
+ ok = 0;
+ if (t->ftps_seq[0] == 0) {
+ t->ftps_seq[0] = thack;
+ ok = 1;
+ } else {
+ if (ackoff == 0) {
+ if (t->ftps_seq[0] == thack)
+ ok = 1;
+ else if (t->ftps_seq[1] == thack) {
+ t->ftps_seq[0] = thack;
+ ok = 1;
+ }
+ } else {
+ if (t->ftps_seq[0] + ackoff == thack)
+ ok = 1;
+ else if (t->ftps_seq[0] == thack + ackoff)
+ ok = 1;
+ else if (t->ftps_seq[1] + ackoff == thack) {
+ t->ftps_seq[0] = thack - ackoff;
+ ok = 1;
+ } else if (t->ftps_seq[1] == thack + ackoff) {
+ t->ftps_seq[0] = thack - ackoff;
+ ok = 1;
+ }
+ }
+ }
+
+#if PROXY_DEBUG
+ if (!ok)
+ printf("not ok\n");
+#endif
+
+ if (!mlen) {
+ if (t->ftps_seq[0] + ackoff != thack) {
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_process:seq[0](%x) + ackoff(%x) != thack(%x)\n",
+ t->ftps_seq[0], ackoff, thack);
+#endif
+ return APR_ERR(1);
+ }
+
+#if PROXY_DEBUG
+ printf("f:seq[0] %x seq[1] %x\n", f->ftps_seq[0], f->ftps_seq[1]);
+#endif
+ if (tcp->th_flags & TH_FIN) {
+ if (thseq == f->ftps_seq[1]) {
+ f->ftps_seq[0] = f->ftps_seq[1] - seqoff;
+ f->ftps_seq[1] = thseq + 1 - seqoff;
+ } else {
+#if PROXY_DEBUG || (!defined(_KERNEL) && !defined(KERNEL))
+ printf("FIN: thseq %x seqoff %d ftps_seq %x\n",
+ thseq, seqoff, f->ftps_seq[0]);
+#endif
+ return APR_ERR(1);
+ }
+ }
+ f->ftps_len = 0;
+ return 0;
+ }
+
+ ok = 0;
+ if ((thseq == f->ftps_seq[0]) || (thseq == f->ftps_seq[1])) {
+ ok = 1;
+ /*
+ * Retransmitted data packet.
+ */
+ } else if ((thseq + mlen == f->ftps_seq[0]) ||
+ (thseq + mlen == f->ftps_seq[1])) {
+ ok = 1;
+ }
+
+ if (ok == 0) {
+ inc = thseq - f->ftps_seq[0];
+#if PROXY_DEBUG || (!defined(_KERNEL) && !defined(KERNEL))
+ printf("inc %d sel %d rv %d\n", inc, sel, rv);
+ printf("th_seq %x ftps_seq %x/%x\n", thseq, f->ftps_seq[0],
+ f->ftps_seq[1]);
+ printf("ackmin %x ackoff %d\n", aps->aps_ackmin[sel],
+ aps->aps_ackoff[sel]);
+ printf("seqmin %x seqoff %d\n", aps->aps_seqmin[sel],
+ aps->aps_seqoff[sel]);
+#endif
+
+ return APR_ERR(1);
+ }
+
+ inc = 0;
+ rptr = f->ftps_rptr;
+ wptr = f->ftps_wptr;
+ f->ftps_seq[0] = thseq;
+ f->ftps_seq[1] = f->ftps_seq[0] + mlen;
+ f->ftps_len = mlen;
+
+ while (mlen > 0) {
+ len = MIN(mlen, FTP_BUFSZ / 2);
+
+#if !defined(_KERNEL)
+ bcopy((char *)m + off, wptr, len);
+#else
+# if SOLARIS
+ copyout_mblk(m, off, len, wptr);
+# else
+ m_copydata(m, off, len, wptr);
+# endif
+#endif
+ mlen -= len;
+ off += len;
+ wptr += len;
+ f->ftps_wptr = wptr;
+ if (f->ftps_junk == 2)
+ f->ftps_junk = ippr_ftp_valid(ftp, rv, rptr,
+ wptr - rptr);
+
+ while ((f->ftps_junk == 0) && (wptr > rptr)) {
+ f->ftps_junk = ippr_ftp_valid(ftp, rv, rptr,
+ wptr - rptr);
+ if (f->ftps_junk == 0) {
+ f->ftps_cmds++;
+ len = wptr - rptr;
+ f->ftps_rptr = rptr;
+ if (rv)
+ inc += ippr_ftp_server(fin, ip, nat,
+ ftp, len);
+ else
+ inc += ippr_ftp_client(fin, ip, nat,
+ ftp, len);
+ rptr = f->ftps_rptr;
+ wptr = f->ftps_wptr;
+ }
+ }
+
+ /*
+ * Off to a bad start so lets just forget about using the
+ * ftp proxy for this connection.
+ */
+ if ((f->ftps_cmds == 0) && (f->ftps_junk == 1)) {
+ /* f->ftps_seq[1] += inc; */
+#if !defined(_KERNEL) && !defined(KERNEL)
+ fprintf(stdout,
+ "ippr_ftp_process:cmds == 0 junk == 1\n");
+#endif
+ return APR_ERR(2);
+ }
+
+ while ((f->ftps_junk == 1) && (rptr < wptr)) {
+ while ((rptr < wptr) && (*rptr != '\r'))
+ rptr++;
+
+ if (*rptr == '\r') {
+ if (rptr + 1 < wptr) {
+ if (*(rptr + 1) == '\n') {
+ rptr += 2;
+ f->ftps_junk = 0;
+ } else
+ rptr++;
+ } else
+ break;
+ }
+ }
+ f->ftps_rptr = rptr;
+
+ if (rptr == wptr) {
+ rptr = wptr = f->ftps_buf;
+ } else {
+ if ((wptr > f->ftps_buf + FTP_BUFSZ / 2)) {
+ i = wptr - rptr;
+ if ((rptr == f->ftps_buf) ||
+ (wptr - rptr > FTP_BUFSZ / 2)) {
+ f->ftps_junk = 1;
+ rptr = wptr = f->ftps_buf;
+ } else {
+ bcopy(rptr, f->ftps_buf, i);
+ wptr = f->ftps_buf + i;
+ rptr = f->ftps_buf;
+ }
+ }
+ f->ftps_rptr = rptr;
+ f->ftps_wptr = wptr;
+ }
+ }
+
+ /* f->ftps_seq[1] += inc; */
+ if (tcp->th_flags & TH_FIN)
+ f->ftps_seq[1]++;
+#if PROXY_DEBUG
+# ifndef _KERNEL
+ mlen = mbuflen(m);
+# else
+# if SOLARIS
+ mlen = msgdsize(m);
+# else
+ mlen = mbufchainlen(m);
+# endif
+# endif
+ mlen -= off;
+ printf("ftps_seq[1] = %x inc %d len %d\n", f->ftps_seq[1], inc, mlen);
+#endif
+
+ f->ftps_rptr = rptr;
+ f->ftps_wptr = wptr;
+ return APR_INC(inc);
+}
+
+
+int ippr_ftp_out(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ftpinfo_t *ftp;
+
+ ftp = aps->aps_data;
+ if (ftp == NULL)
+ return 0;
+ return ippr_ftp_process(fin, ip, nat, ftp, 0);
+}
+
+
+int ippr_ftp_in(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ftpinfo_t *ftp;
+
+ ftp = aps->aps_data;
+ if (ftp == NULL)
+ return 0;
+ return ippr_ftp_process(fin, ip, nat, ftp, 1);
+}
+
+
+/*
+ * ippr_ftp_atoi - implement a version of atoi which processes numbers in
+ * pairs separated by commas (which are expected to be in the range 0 - 255),
+ * returning a 16 bit number combining either side of the , as the MSB and
+ * LSB.
+ */
+u_short ippr_ftp_atoi(ptr)
+char **ptr;
+{
+ register char *s = *ptr, c;
+ register u_char i = 0, j = 0;
+
+ while ((c = *s++) && isdigit(c)) {
+ i *= 10;
+ i += c - '0';
+ }
+ if (c != ',') {
+ *ptr = NULL;
+ return 0;
+ }
+ while ((c = *s++) && isdigit(c)) {
+ j *= 10;
+ j += c - '0';
+ }
+ *ptr = s;
+ i &= 0xff;
+ j &= 0xff;
+ return (i << 8) | j;
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_ipsec_pxy.c b/sys/contrib/ipfilter/netinet/ip_ipsec_pxy.c
new file mode 100644
index 0000000..40ce131
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_ipsec_pxy.c
@@ -0,0 +1,292 @@
+/*
+ * Simple ISAKMP transparent proxy for in-kernel use. For use with the NAT
+ * code.
+ *
+ * $Id: ip_ipsec_pxy.c,v 1.1.2.10 2002/01/13 04:58:29 darrenr Exp $
+ *
+ */
+#define IPF_IPSEC_PROXY
+
+
+int ippr_ipsec_init __P((void));
+int ippr_ipsec_new __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+void ippr_ipsec_del __P((ap_session_t *));
+int ippr_ipsec_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_ipsec_match __P((fr_info_t *, ap_session_t *, nat_t *));
+
+static frentry_t ipsecfr;
+
+
+static char ipsec_buffer[1500];
+
+/*
+ * RCMD application proxy initialization.
+ */
+int ippr_ipsec_init()
+{
+ bzero((char *)&ipsecfr, sizeof(ipsecfr));
+ ipsecfr.fr_ref = 1;
+ ipsecfr.fr_flags = FR_OUTQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE;
+ return 0;
+}
+
+
+/*
+ * Setup for a new IPSEC proxy.
+ */
+int ippr_ipsec_new(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ipsec_pxy_t *ipsec;
+ fr_info_t fi;
+ ipnat_t *ipn;
+ char *ptr;
+ int p, off, dlen;
+ mb_t *m;
+
+ bzero(ipsec_buffer, sizeof(ipsec_buffer));
+ off = fin->fin_hlen + sizeof(udphdr_t);
+#ifdef _KERNEL
+# if SOLARIS
+ m = fin->fin_qfm;
+
+ dlen = msgdsize(m) - off;
+ if (dlen < 16)
+ return -1;
+ copyout_mblk(m, off, MIN(sizeof(ipsec_buffer), dlen), ipsec_buffer);
+# else
+ m = *(mb_t **)fin->fin_mp;
+ dlen = mbufchainlen(m) - off;
+ if (dlen < 16)
+ return -1;
+ m_copydata(m, off, MIN(sizeof(ipsec_buffer), dlen), ipsec_buffer);
+# endif
+#else
+ m = *(mb_t **)fin->fin_mp;
+ dlen = ip->ip_len - off;
+ ptr = (char *)m;
+ ptr += off;
+ bcopy(ptr, ipsec_buffer, MIN(sizeof(ipsec_buffer), dlen));
+#endif
+
+ /*
+ * Because _new() gets called from nat_new(), ipf_nat is held with a
+ * write lock so pass rw=1 to nat_outlookup().
+ */
+ if (nat_outlookup(fin, 0, IPPROTO_ESP, nat->nat_inip,
+ ip->ip_dst, 1) != NULL)
+ return -1;
+
+ aps->aps_psiz = sizeof(*ipsec);
+ KMALLOCS(aps->aps_data, ipsec_pxy_t *, sizeof(*ipsec));
+ if (aps->aps_data == NULL)
+ return -1;
+
+ ipsec = aps->aps_data;
+ bzero((char *)ipsec, sizeof(*ipsec));
+
+ /*
+ * Create NAT rule against which the tunnel/transport mapping is
+ * created. This is required because the current NAT rule does not
+ * describe ESP but UDP instead.
+ */
+ ipn = &ipsec->ipsc_rule;
+ ipn->in_ifp = fin->fin_ifp;
+ ipn->in_apr = NULL;
+ ipn->in_use = 1;
+ ipn->in_hits = 1;
+ ipn->in_nip = ntohl(nat->nat_outip.s_addr);
+ ipn->in_ippip = 1;
+ ipn->in_inip = nat->nat_inip.s_addr;
+ ipn->in_inmsk = 0xffffffff;
+ ipn->in_outip = nat->nat_outip.s_addr;
+ ipn->in_outmsk = 0xffffffff;
+ ipn->in_srcip = fin->fin_saddr;
+ ipn->in_srcmsk = 0xffffffff;
+ ipn->in_redir = NAT_MAP;
+ bcopy(nat->nat_ptr->in_ifname, ipn->in_ifname, sizeof(ipn->in_ifname));
+ ipn->in_p = IPPROTO_ESP;
+
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ fi.fin_fi.fi_p = IPPROTO_ESP;
+ fi.fin_fr = &ipsecfr;
+ fi.fin_data[0] = 0;
+ fi.fin_data[1] = 0;
+ p = ip->ip_p;
+ ip->ip_p = IPPROTO_ESP;
+ fi.fin_fl &= ~FI_TCPUDP;
+
+ ptr = ipsec_buffer;
+ bcopy(ptr, ipsec->ipsc_icookie, sizeof(ipsec_cookie_t));
+ ptr += sizeof(ipsec_cookie_t);
+ bcopy(ptr, ipsec->ipsc_rcookie, sizeof(ipsec_cookie_t));
+ /*
+ * The responder cookie should only be non-zero if the initiator
+ * cookie is non-zero. Therefore, it is safe to assume(!) that the
+ * cookies are both set after copying if the responder is non-zero.
+ */
+ if ((ipsec->ipsc_rcookie[0]|ipsec->ipsc_rcookie[1]) != 0)
+ ipsec->ipsc_rckset = 1;
+ else
+ nat->nat_age = 60; /* 30 seconds */
+
+ ipsec->ipsc_nat = nat_new(&fi, ip, ipn, &ipsec->ipsc_nat, FI_IGNOREPKT,
+ NAT_OUTBOUND);
+ if (ipsec->ipsc_nat != NULL) {
+ fi.fin_data[0] = 0;
+ fi.fin_data[1] = 0;
+ ipsec->ipsc_state = fr_addstate(ip, &fi, &ipsec->ipsc_state,
+ FI_IGNOREPKT|FI_NORULE);
+ }
+ ip->ip_p = p;
+ return 0;
+}
+
+
+/*
+ * For outgoing IKE packets. refresh timeouts for NAT & stat entries, if
+ * we can. If they have disappeared, recreate them.
+ */
+int ippr_ipsec_out(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ipsec_pxy_t *ipsec;
+ fr_info_t fi;
+ int p;
+
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ fi.fin_fi.fi_p = IPPROTO_ESP;
+ fi.fin_fr = &ipsecfr;
+ fi.fin_data[0] = 0;
+ fi.fin_data[1] = 0;
+ p = ip->ip_p;
+ ip->ip_p = IPPROTO_ESP;
+ fi.fin_fl &= ~FI_TCPUDP;
+
+ ipsec = aps->aps_data;
+ if (ipsec != NULL) {
+ /*
+ * Update NAT timeout/create NAT if missing.
+ */
+ if (ipsec->ipsc_rckset == 0)
+ nat->nat_age = 60; /* 30 seconds */
+ if (ipsec->ipsc_nat != NULL)
+ ipsec->ipsc_nat->nat_age = nat->nat_age;
+ else
+ ipsec->ipsc_nat = nat_new(&fi, ip, &ipsec->ipsc_rule,
+ &ipsec->ipsc_nat,
+ FI_IGNOREPKT, NAT_OUTBOUND);
+
+ /*
+ * Update state timeout/create state if missing.
+ */
+ READ_ENTER(&ipf_state);
+ if (ipsec->ipsc_state != NULL) {
+ ipsec->ipsc_state->is_age = nat->nat_age;
+ RWLOCK_EXIT(&ipf_state);
+ } else {
+ RWLOCK_EXIT(&ipf_state);
+ fi.fin_data[0] = 0;
+ fi.fin_data[1] = 0;
+ ipsec->ipsc_state = fr_addstate(ip, &fi,
+ &ipsec->ipsc_state,
+ FI_IGNOREPKT|FI_NORULE);
+ }
+ }
+ ip->ip_p = p;
+ return 0;
+}
+
+
+/*
+ * This extends the NAT matching to be based on the cookies associated with
+ * a session and found at the front of IKE packets. The cookies are always
+ * in the same order (not reversed depending on packet flow direction as with
+ * UDP/TCP port numbers).
+ */
+int ippr_ipsec_match(fin, aps, nat)
+fr_info_t *fin;
+ap_session_t *aps;
+nat_t *nat;
+{
+ ipsec_pxy_t *ipsec;
+ u_32_t cookies[4];
+ mb_t *m;
+ int off;
+
+ if ((fin->fin_dlen < sizeof(cookies)) || (fin->fin_fl & FI_FRAG))
+ return -1;
+
+ ipsec = aps->aps_data;
+ off = fin->fin_hlen + sizeof(udphdr_t);
+#ifdef _KERNEL
+# if SOLARIS
+ m = fin->fin_qfm;
+
+ copyout_mblk(m, off, sizeof(cookies), (char *)cookies);
+# else
+ m = *(mb_t **)fin->fin_mp;
+ m_copydata(m, off, sizeof(cookies), (char *)cookies);
+# endif
+#else
+ m = *(mb_t **)fin->fin_mp;
+ bcopy((char *)m + off, cookies, sizeof(cookies));
+#endif
+
+ if ((cookies[0] != ipsec->ipsc_icookie[0]) ||
+ (cookies[1] != ipsec->ipsc_icookie[1]))
+ return -1;
+
+ if (ipsec->ipsc_rckset == 0) {
+ if ((cookies[2]|cookies[3]) == 0) {
+ nat->nat_age = 60; /* 30 seconds */
+ return 0;
+ }
+ ipsec->ipsc_rckset = 1;
+ ipsec->ipsc_rcookie[0] = cookies[2];
+ ipsec->ipsc_rcookie[1] = cookies[3];
+ return 0;
+ }
+
+ if ((cookies[2] != ipsec->ipsc_rcookie[0]) ||
+ (cookies[3] != ipsec->ipsc_rcookie[1]))
+ return -1;
+ return 0;
+}
+
+
+/*
+ * clean up after ourselves.
+ */
+void ippr_ipsec_del(aps)
+ap_session_t *aps;
+{
+ ipsec_pxy_t *ipsec;
+
+ ipsec = aps->aps_data;
+
+ if (ipsec != NULL) {
+ /*
+ * Don't delete it from here, just schedule it to be
+ * deleted ASAP.
+ */
+ if (ipsec->ipsc_nat != NULL) {
+ ipsec->ipsc_nat->nat_age = 1;
+ ipsec->ipsc_nat->nat_ptr = NULL;
+ }
+
+ READ_ENTER(&ipf_state);
+ if (ipsec->ipsc_state != NULL)
+ ipsec->ipsc_state->is_age = 1;
+ RWLOCK_EXIT(&ipf_state);
+
+ ipsec->ipsc_state = NULL;
+ ipsec->ipsc_nat = NULL;
+ }
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_log.c b/sys/contrib/ipfilter/netinet/ip_log.c
new file mode 100644
index 0000000..431b9fc
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_log.c
@@ -0,0 +1,510 @@
+/*
+ * Copyright (C) 1997-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id: ip_log.c,v 2.5.2.1 2000/07/19 13:11:47 darrenr Exp $
+ * $FreeBSD$
+ */
+#include <sys/param.h>
+#if defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
+ defined(_KERNEL)
+# include "opt_ipfilter_log.h"
+#endif
+#ifdef __FreeBSD__
+# if defined(IPFILTER_LKM) || defined(_KERNEL)
+# if !defined(__FreeBSD_version)
+# include <sys/osreldate.h>
+# endif
+# if !defined(IPFILTER_LKM)
+# if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
+# include "opt_ipfilter.h"
+# endif
+# endif
+# else
+# ifdef KLD_MODULE
+# ifndef __FreeBSD_cc_version
+# include <osreldate.h>
+# else
+# if __FreeBSD_cc_version < 430000
+# include <osreldate.h>
+# endif
+# endif
+# endif
+# endif
+#endif
+#ifdef IPFILTER_LOG
+# ifndef SOLARIS
+# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# endif
+# ifndef _KERNEL
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <ctype.h>
+# endif
+# include <sys/errno.h>
+# include <sys/types.h>
+# include <sys/file.h>
+# if __FreeBSD_version >= 220000 && defined(_KERNEL)
+# include <sys/fcntl.h>
+# include <sys/filio.h>
+# else
+# include <sys/ioctl.h>
+# endif
+# include <sys/time.h>
+# if defined(_KERNEL)
+# include <sys/systm.h>
+# endif
+# if !SOLARIS
+# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000)
+# include <sys/dirent.h>
+# else
+# include <sys/dir.h>
+# endif
+# include <sys/mbuf.h>
+# else
+# include <sys/filio.h>
+# include <sys/cred.h>
+# include <sys/kmem.h>
+# ifdef _KERNEL
+# include <sys/ddi.h>
+# include <sys/sunddi.h>
+# include <sys/ksynch.h>
+# include <sys/dditypes.h>
+# include <sys/cmn_err.h>
+# endif
+# endif
+# include <sys/protosw.h>
+# include <sys/socket.h>
+
+# include <net/if.h>
+# ifdef sun
+# include <net/af.h>
+# endif
+# if __FreeBSD_version >= 300000
+# include <net/if_var.h>
+# endif
+# include <net/route.h>
+# include <netinet/in.h>
+# ifdef __sgi
+# define _KMEMUSER
+# include <sys/ddi.h>
+# ifdef IFF_DRVRLOCK /* IRIX6 */
+# include <sys/hashing.h>
+# endif
+# endif
+# if !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/
+# include <netinet/in_var.h>
+# endif
+# include <netinet/in_systm.h>
+# include <netinet/ip.h>
+# include <netinet/tcp.h>
+# include <netinet/udp.h>
+# include <netinet/ip_icmp.h>
+# ifdef USE_INET6
+# include <netinet/icmp6.h>
+# endif
+# include <netinet/ip_var.h>
+# ifndef _KERNEL
+# include <syslog.h>
+# endif
+# include "netinet/ip_compat.h"
+# include <netinet/tcpip.h>
+# include "netinet/ip_fil.h"
+# if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+# endif
+
+# ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+# endif
+# ifdef IPFILTER_LOGSIZE
+# undef IPLLOGSIZE
+# define IPLLOGSIZE IPFILTER_LOGSIZE
+# endif
+
+
+# if SOLARIS || defined(__sgi)
+extern kmutex_t ipl_mutex;
+# if SOLARIS
+extern kcondvar_t iplwait;
+# endif
+# endif
+
+iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1], *ipll[IPL_LOGMAX+1];
+size_t iplused[IPL_LOGMAX+1];
+static fr_info_t iplcrc[IPL_LOGMAX+1];
+
+
+/*
+ * Initialise log buffers & pointers. Also iniialised the CRC to a local
+ * secret for use in calculating the "last log checksum".
+ */
+void ipflog_init()
+{
+ int i;
+
+ for (i = IPL_LOGMAX; i >= 0; i--) {
+ iplt[i] = NULL;
+ ipll[i] = NULL;
+ iplh[i] = &iplt[i];
+ iplused[i] = 0;
+ bzero((char *)&iplcrc[i], sizeof(iplcrc[i]));
+ }
+}
+
+
+/*
+ * ipflog
+ * Create a log record for a packet given that it has been triggered by a
+ * rule (or the default setting). Calculate the transport protocol header
+ * size using predetermined size of a couple of popular protocols and thus
+ * how much data to copy into the log, including part of the data body if
+ * requested.
+ */
+int ipflog(flags, ip, fin, m)
+u_int flags;
+ip_t *ip;
+fr_info_t *fin;
+mb_t *m;
+{
+ ipflog_t ipfl;
+ register size_t mlen, hlen;
+ size_t sizes[2];
+ void *ptrs[2];
+ int types[2];
+ u_char p;
+# if SOLARIS && defined(_KERNEL)
+ ill_t *ifp = fin->fin_ifp;
+# else
+ struct ifnet *ifp = fin->fin_ifp;
+# endif
+
+ /*
+ * calculate header size.
+ */
+ hlen = fin->fin_hlen;
+ if (fin->fin_off == 0) {
+ p = fin->fin_fi.fi_p;
+ if (p == IPPROTO_TCP)
+ hlen += MIN(sizeof(tcphdr_t), fin->fin_dlen);
+ else if (p == IPPROTO_UDP)
+ hlen += MIN(sizeof(udphdr_t), fin->fin_dlen);
+ else if (p == IPPROTO_ICMP) {
+ struct icmp *icmp;
+
+ icmp = (struct icmp *)fin->fin_dp;
+
+ /*
+ * For ICMP, if the packet is an error packet, also
+ * include the information about the packet which
+ * caused the error.
+ */
+ switch (icmp->icmp_type)
+ {
+ case ICMP_UNREACH :
+ case ICMP_SOURCEQUENCH :
+ case ICMP_REDIRECT :
+ case ICMP_TIMXCEED :
+ case ICMP_PARAMPROB :
+ hlen += MIN(sizeof(struct icmp) + 8,
+ fin->fin_dlen);
+ break;
+ default :
+ hlen += MIN(sizeof(struct icmp),
+ fin->fin_dlen);
+ break;
+ }
+ }
+#ifdef USE_INET6
+ else if (p == IPPROTO_ICMPV6) {
+ struct icmp6_hdr *icmp;
+
+ icmp = (struct icmp6_hdr *)fin->fin_dp;
+
+ /*
+ * For ICMPV6, if the packet is an error packet, also
+ * include the information about the packet which
+ * caused the error.
+ */
+ if (icmp->icmp6_type < 128) {
+ hlen += MIN(sizeof(struct icmp6_hdr) + 8,
+ fin->fin_dlen);
+ } else {
+ hlen += MIN(sizeof(struct icmp6_hdr),
+ fin->fin_dlen);
+ }
+ }
+#endif
+ }
+ /*
+ * Get the interface number and name to which this packet is
+ * currently associated.
+ */
+ bzero((char *)ipfl.fl_ifname, sizeof(ipfl.fl_ifname));
+# if SOLARIS && defined(_KERNEL)
+ ipfl.fl_unit = (u_char)ifp->ill_ppa;
+ bcopy(ifp->ill_name, ipfl.fl_ifname,
+ MIN(ifp->ill_name_length, sizeof(ipfl.fl_ifname)));
+ mlen = (flags & FR_LOGBODY) ? MIN(msgdsize(m) - hlen, 128) : 0;
+# else
+# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) )
+ strncpy(ipfl.fl_ifname, ifp->if_xname, IFNAMSIZ);
+# else
+ ipfl.fl_unit = (u_char)ifp->if_unit;
+ strncpy(ipfl.fl_ifname, ifp->if_name, MIN(sizeof(ipfl.fl_ifname),
+ sizeof(ifp->if_name)));
+# endif
+ mlen = (flags & FR_LOGBODY) ? MIN(fin->fin_plen - hlen, 128) : 0;
+# endif
+ ipfl.fl_plen = (u_char)mlen;
+ ipfl.fl_hlen = (u_char)hlen;
+ ipfl.fl_rule = fin->fin_rule;
+ ipfl.fl_group = fin->fin_group;
+ if (fin->fin_fr != NULL)
+ ipfl.fl_loglevel = fin->fin_fr->fr_loglevel;
+ else
+ ipfl.fl_loglevel = 0xffff;
+ ipfl.fl_flags = flags;
+ ipfl.fl_dir = fin->fin_out;
+ ptrs[0] = (void *)&ipfl;
+ sizes[0] = sizeof(ipfl);
+ types[0] = 0;
+# if SOLARIS && defined(_KERNEL)
+ /*
+ * Are we copied from the mblk or an aligned array ?
+ */
+ if (ip == (ip_t *)m->b_rptr) {
+ ptrs[1] = m;
+ sizes[1] = hlen + mlen;
+ types[1] = 1;
+ } else {
+ ptrs[1] = ip;
+ sizes[1] = hlen + mlen;
+ types[1] = 0;
+ }
+# else
+ ptrs[1] = m;
+ sizes[1] = hlen + mlen;
+ types[1] = 1;
+# endif
+ return ipllog(IPL_LOGIPF, fin, ptrs, sizes, types, 2);
+}
+
+
+/*
+ * ipllog
+ */
+int ipllog(dev, fin, items, itemsz, types, cnt)
+int dev;
+fr_info_t *fin;
+void **items;
+size_t *itemsz;
+int *types, cnt;
+{
+ caddr_t buf, s;
+ iplog_t *ipl;
+ size_t len;
+ int i;
+
+ /*
+ * Check to see if this log record has a CRC which matches the last
+ * record logged. If it does, just up the count on the previous one
+ * rather than create a new one.
+ */
+ MUTEX_ENTER(&ipl_mutex);
+ if (fin != NULL) {
+ if ((ipll[dev] != NULL) &&
+ bcmp((char *)fin, (char *)&iplcrc[dev], FI_LCSIZE) == 0) {
+ ipll[dev]->ipl_count++;
+ MUTEX_EXIT(&ipl_mutex);
+ return 1;
+ }
+ bcopy((char *)fin, (char *)&iplcrc[dev], FI_LCSIZE);
+ } else
+ bzero((char *)&iplcrc[dev], FI_LCSIZE);
+ MUTEX_EXIT(&ipl_mutex);
+
+ /*
+ * Get the total amount of data to be logged.
+ */
+ for (i = 0, len = IPLOG_SIZE; i < cnt; i++)
+ len += itemsz[i];
+
+ /*
+ * check that we have space to record this information and can
+ * allocate that much.
+ */
+ KMALLOCS(buf, caddr_t, len);
+ if (!buf)
+ return 0;
+ MUTEX_ENTER(&ipl_mutex);
+ if ((iplused[dev] + len) > IPLLOGSIZE) {
+ MUTEX_EXIT(&ipl_mutex);
+ KFREES(buf, len);
+ return 0;
+ }
+ iplused[dev] += len;
+ MUTEX_EXIT(&ipl_mutex);
+
+ /*
+ * advance the log pointer to the next empty record and deduct the
+ * amount of space we're going to use.
+ */
+ ipl = (iplog_t *)buf;
+ ipl->ipl_magic = IPL_MAGIC;
+ ipl->ipl_count = 1;
+ ipl->ipl_next = NULL;
+ ipl->ipl_dsize = len;
+# ifdef _KERNEL
+# if SOLARIS || defined(sun)
+ uniqtime(&ipl->ipl_tv);
+# else
+# if BSD >= 199306 || defined(__FreeBSD__) || defined(__sgi)
+ microtime(&ipl->ipl_tv);
+# endif
+# endif
+# else
+ ipl->ipl_sec = 0;
+ ipl->ipl_usec = 0;
+# endif
+
+ /*
+ * Loop through all the items to be logged, copying each one to the
+ * buffer. Use bcopy for normal data or the mb_t copyout routine.
+ */
+ for (i = 0, s = buf + IPLOG_SIZE; i < cnt; i++) {
+ if (types[i] == 0)
+ bcopy(items[i], s, itemsz[i]);
+ else if (types[i] == 1) {
+# if SOLARIS && defined(_KERNEL)
+ copyout_mblk(items[i], 0, itemsz[i], s);
+# else
+ m_copydata(items[i], 0, itemsz[i], s);
+# endif
+ }
+ s += itemsz[i];
+ }
+ MUTEX_ENTER(&ipl_mutex);
+ ipll[dev] = ipl;
+ *iplh[dev] = ipl;
+ iplh[dev] = &ipl->ipl_next;
+# if SOLARIS && defined(_KERNEL)
+ cv_signal(&iplwait);
+ mutex_exit(&ipl_mutex);
+# else
+ MUTEX_EXIT(&ipl_mutex);
+ WAKEUP(&iplh[dev]);
+# endif
+ return 1;
+}
+
+
+int ipflog_read(unit, uio)
+minor_t unit;
+struct uio *uio;
+{
+ size_t dlen, copied;
+ int error = 0;
+ iplog_t *ipl;
+# if defined(_KERNEL) && !SOLARIS
+ int s;
+# endif
+
+ /*
+ * Sanity checks. Make sure the minor # is valid and we're copying
+ * a valid chunk of data.
+ */
+ if (IPL_LOGMAX < unit)
+ return ENXIO;
+ if (!uio->uio_resid)
+ return 0;
+ if (uio->uio_resid < IPLOG_SIZE)
+ return EINVAL;
+
+ /*
+ * Lock the log so we can snapshot the variables. Wait for a signal
+ * if the log is empty.
+ */
+ SPL_NET(s);
+ MUTEX_ENTER(&ipl_mutex);
+
+ while (!iplused[unit] || !iplt[unit]) {
+# if SOLARIS && defined(_KERNEL)
+ if (!cv_wait_sig(&iplwait, &ipl_mutex)) {
+ MUTEX_EXIT(&ipl_mutex);
+ return EINTR;
+ }
+# else
+ MUTEX_EXIT(&ipl_mutex);
+ error = SLEEP(&iplh[unit], "ipl sleep");
+ if (error) {
+ SPL_X(s);
+ return error;
+ }
+ MUTEX_ENTER(&ipl_mutex);
+# endif /* SOLARIS */
+ }
+
+# if BSD >= 199306 || defined(__FreeBSD__)
+ uio->uio_rw = UIO_READ;
+# endif
+
+ for (copied = 0; (ipl = iplt[unit]); copied += dlen) {
+ dlen = ipl->ipl_dsize;
+ if (dlen > uio->uio_resid)
+ break;
+ /*
+ * Don't hold the mutex over the uiomove call.
+ */
+ iplt[unit] = ipl->ipl_next;
+ iplused[unit] -= dlen;
+ MUTEX_EXIT(&ipl_mutex);
+ error = UIOMOVE((caddr_t)ipl, dlen, UIO_READ, uio);
+ MUTEX_ENTER(&ipl_mutex);
+ if (error) {
+ ipl->ipl_next = iplt[unit];
+ iplt[unit] = ipl;
+ iplused[unit] += dlen;
+ break;
+ }
+ KFREES((caddr_t)ipl, dlen);
+ }
+ if (!iplt[unit]) {
+ iplused[unit] = 0;
+ iplh[unit] = &iplt[unit];
+ ipll[unit] = NULL;
+ }
+
+ MUTEX_EXIT(&ipl_mutex);
+ SPL_X(s);
+ return error;
+}
+
+
+int ipflog_clear(unit)
+minor_t unit;
+{
+ iplog_t *ipl;
+ int used;
+
+ MUTEX_ENTER(&ipl_mutex);
+ while ((ipl = iplt[unit])) {
+ iplt[unit] = ipl->ipl_next;
+ KFREES((caddr_t)ipl, ipl->ipl_dsize);
+ }
+ iplh[unit] = &iplt[unit];
+ ipll[unit] = NULL;
+ used = iplused[unit];
+ iplused[unit] = 0;
+ bzero((char *)&iplcrc[unit], FI_LCSIZE);
+ MUTEX_EXIT(&ipl_mutex);
+ return used;
+}
+#endif /* IPFILTER_LOG */
diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c
new file mode 100644
index 0000000..90fd20d
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_nat.c
@@ -0,0 +1,3011 @@
+/*
+ * Copyright (C) 1995-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * Added redirect stuff and a LOT of bug fixes. (mcn@EnGarde.com)
+ */
+
+#if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL)
+#define _KERNEL
+#endif
+
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
+ defined(_KERNEL)
+# include "opt_ipfilter_log.h"
+#endif
+#if !defined(_KERNEL) && !defined(KERNEL)
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000)
+# include <sys/filio.h>
+# include <sys/fcntl.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#include <sys/fcntl.h>
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+#if defined(_KERNEL) && !defined(linux)
+# include <sys/systm.h>
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/filio.h>
+# include <sys/byteorder.h>
+# ifdef _KERNEL
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+# include <sys/kmem.h>
+#endif
+#if __FreeBSD_version >= 300000
+# include <sys/queue.h>
+#endif
+#include <net/if.h>
+#if __FreeBSD_version >= 300000
+# include <net/if_var.h>
+# if defined(_KERNEL) && !defined(IPFILTER_LKM)
+# include "opt_ipfilter.h"
+# endif
+#endif
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+#ifdef __sgi
+# ifdef IFF_DRVRLOCK /* IRIX6 */
+#include <sys/hashing.h>
+#include <netinet/in_var.h>
+# endif
+#endif
+
+#ifdef RFC1825
+# include <vpn/md5.h>
+# include <vpn/ipsec.h>
+extern struct ifnet vpnif;
+#endif
+
+#ifndef linux
+# include <netinet/ip_var.h>
+# include <netinet/tcp_fsm.h>
+#endif
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_proxy.h"
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+#endif
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#undef SOCKADDR_IN
+#define SOCKADDR_IN struct sockaddr_in
+
+#if !defined(lint)
+static const char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed";
+/* static const char rcsid[] = "@(#)$Id: ip_nat.c,v 2.37.2.44 2001/07/21 07:17:22 darrenr Exp $"; */
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+nat_t **nat_table[2] = { NULL, NULL },
+ *nat_instances = NULL;
+ipnat_t *nat_list = NULL;
+u_int ipf_nattable_sz = NAT_TABLE_SZ;
+u_int ipf_natrules_sz = NAT_SIZE;
+u_int ipf_rdrrules_sz = RDR_SIZE;
+u_int ipf_hostmap_sz = HOSTMAP_SIZE;
+u_32_t nat_masks = 0;
+u_32_t rdr_masks = 0;
+ipnat_t **nat_rules = NULL;
+ipnat_t **rdr_rules = NULL;
+hostmap_t **maptable = NULL;
+
+u_long fr_defnatage = DEF_NAT_AGE,
+ fr_defnaticmpage = 6; /* 3 seconds */
+natstat_t nat_stats;
+int fr_nat_lock = 0;
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+extern kmutex_t ipf_rw;
+extern KRWLOCK_T ipf_nat;
+#endif
+
+static int nat_flushtable __P((void));
+static void nat_addnat __P((struct ipnat *));
+static void nat_addrdr __P((struct ipnat *));
+static void nat_delete __P((struct nat *));
+static void nat_delrdr __P((struct ipnat *));
+static void nat_delnat __P((struct ipnat *));
+static int fr_natgetent __P((caddr_t));
+static int fr_natgetsz __P((caddr_t));
+static int fr_natputent __P((caddr_t));
+static void nat_tabmove __P((fr_info_t *, nat_t *));
+static int nat_match __P((fr_info_t *, ipnat_t *, ip_t *));
+static hostmap_t *nat_hostmap __P((ipnat_t *, struct in_addr,
+ struct in_addr));
+static void nat_hostmapdel __P((struct hostmap *));
+static void nat_mssclamp __P((tcphdr_t *, u_32_t, fr_info_t *, u_short *));
+
+
+int nat_init()
+{
+ KMALLOCS(nat_table[0], nat_t **, sizeof(nat_t *) * ipf_nattable_sz);
+ if (nat_table[0] != NULL)
+ bzero((char *)nat_table[0], ipf_nattable_sz * sizeof(nat_t *));
+ else
+ return -1;
+
+ KMALLOCS(nat_table[1], nat_t **, sizeof(nat_t *) * ipf_nattable_sz);
+ if (nat_table[1] != NULL)
+ bzero((char *)nat_table[1], ipf_nattable_sz * sizeof(nat_t *));
+ else
+ return -1;
+
+ KMALLOCS(nat_rules, ipnat_t **, sizeof(ipnat_t *) * ipf_natrules_sz);
+ if (nat_rules != NULL)
+ bzero((char *)nat_rules, ipf_natrules_sz * sizeof(ipnat_t *));
+ else
+ return -1;
+
+ KMALLOCS(rdr_rules, ipnat_t **, sizeof(ipnat_t *) * ipf_rdrrules_sz);
+ if (rdr_rules != NULL)
+ bzero((char *)rdr_rules, ipf_rdrrules_sz * sizeof(ipnat_t *));
+ else
+ return -1;
+
+ KMALLOCS(maptable, hostmap_t **, sizeof(hostmap_t *) * ipf_hostmap_sz);
+ if (maptable != NULL)
+ bzero((char *)maptable, sizeof(hostmap_t *) * ipf_hostmap_sz);
+ else
+ return -1;
+ return 0;
+}
+
+
+static void nat_addrdr(n)
+ipnat_t *n;
+{
+ ipnat_t **np;
+ u_32_t j;
+ u_int hv;
+ int k;
+
+ k = countbits(n->in_outmsk);
+ if ((k >= 0) && (k != 32))
+ rdr_masks |= 1 << k;
+ j = (n->in_outip & n->in_outmsk);
+ hv = NAT_HASH_FN(j, 0, ipf_rdrrules_sz);
+ np = rdr_rules + hv;
+ while (*np != NULL)
+ np = &(*np)->in_rnext;
+ n->in_rnext = NULL;
+ n->in_prnext = np;
+ *np = n;
+}
+
+
+static void nat_addnat(n)
+ipnat_t *n;
+{
+ ipnat_t **np;
+ u_32_t j;
+ u_int hv;
+ int k;
+
+ k = countbits(n->in_inmsk);
+ if ((k >= 0) && (k != 32))
+ nat_masks |= 1 << k;
+ j = (n->in_inip & n->in_inmsk);
+ hv = NAT_HASH_FN(j, 0, ipf_natrules_sz);
+ np = nat_rules + hv;
+ while (*np != NULL)
+ np = &(*np)->in_mnext;
+ n->in_mnext = NULL;
+ n->in_pmnext = np;
+ *np = n;
+}
+
+
+static void nat_delrdr(n)
+ipnat_t *n;
+{
+ if (n->in_rnext)
+ n->in_rnext->in_prnext = n->in_prnext;
+ *n->in_prnext = n->in_rnext;
+}
+
+
+static void nat_delnat(n)
+ipnat_t *n;
+{
+ if (n->in_mnext)
+ n->in_mnext->in_pmnext = n->in_pmnext;
+ *n->in_pmnext = n->in_mnext;
+}
+
+
+/*
+ * check if an ip address has already been allocated for a given mapping that
+ * is not doing port based translation.
+ *
+ * Must be called with ipf_nat held as a write lock.
+ */
+static struct hostmap *nat_hostmap(np, real, map)
+ipnat_t *np;
+struct in_addr real;
+struct in_addr map;
+{
+ hostmap_t *hm;
+ u_int hv;
+
+ hv = real.s_addr % HOSTMAP_SIZE;
+ for (hm = maptable[hv]; hm; hm = hm->hm_next)
+ if ((hm->hm_realip.s_addr == real.s_addr) &&
+ (np == hm->hm_ipnat)) {
+ hm->hm_ref++;
+ return hm;
+ }
+
+ KMALLOC(hm, hostmap_t *);
+ if (hm) {
+ hm->hm_next = maptable[hv];
+ hm->hm_pnext = maptable + hv;
+ if (maptable[hv])
+ maptable[hv]->hm_pnext = &hm->hm_next;
+ maptable[hv] = hm;
+ hm->hm_ipnat = np;
+ hm->hm_realip = real;
+ hm->hm_mapip = map;
+ hm->hm_ref = 1;
+ }
+ return hm;
+}
+
+
+/*
+ * Must be called with ipf_nat held as a write lock.
+ */
+static void nat_hostmapdel(hm)
+struct hostmap *hm;
+{
+ ATOMIC_DEC32(hm->hm_ref);
+ if (hm->hm_ref == 0) {
+ if (hm->hm_next)
+ hm->hm_next->hm_pnext = hm->hm_pnext;
+ *hm->hm_pnext = hm->hm_next;
+ KFREE(hm);
+ }
+}
+
+
+void fix_outcksum(fin, sp, n)
+fr_info_t *fin;
+u_short *sp;
+u_32_t n;
+{
+ register u_short sumshort;
+ register u_32_t sum1;
+
+ if (!n)
+ return;
+ else if (n & NAT_HW_CKSUM) {
+ n &= 0xffff;
+ n += fin->fin_dlen;
+ n = (n & 0xffff) + (n >> 16);
+ *sp = n & 0xffff;
+ return;
+ }
+ sum1 = (~ntohs(*sp)) & 0xffff;
+ sum1 += (n);
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ /* Again */
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ sumshort = ~(u_short)sum1;
+ *(sp) = htons(sumshort);
+}
+
+
+void fix_incksum(fin, sp, n)
+fr_info_t *fin;
+u_short *sp;
+u_32_t n;
+{
+ register u_short sumshort;
+ register u_32_t sum1;
+
+ if (!n)
+ return;
+ else if (n & NAT_HW_CKSUM) {
+ n &= 0xffff;
+ n += fin->fin_dlen;
+ n = (n & 0xffff) + (n >> 16);
+ *sp = n & 0xffff;
+ return;
+ }
+#ifdef sparc
+ sum1 = (~(*sp)) & 0xffff;
+#else
+ sum1 = (~ntohs(*sp)) & 0xffff;
+#endif
+ sum1 += ~(n) & 0xffff;
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ /* Again */
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ sumshort = ~(u_short)sum1;
+ *(sp) = htons(sumshort);
+}
+
+
+/*
+ * fix_datacksum is used *only* for the adjustments of checksums in the data
+ * section of an IP packet.
+ *
+ * The only situation in which you need to do this is when NAT'ing an
+ * ICMP error message. Such a message, contains in its body the IP header
+ * of the original IP packet, that causes the error.
+ *
+ * You can't use fix_incksum or fix_outcksum in that case, because for the
+ * kernel the data section of the ICMP error is just data, and no special
+ * processing like hardware cksum or ntohs processing have been done by the
+ * kernel on the data section.
+ */
+void fix_datacksum(sp, n)
+u_short *sp;
+u_32_t n;
+{
+ register u_short sumshort;
+ register u_32_t sum1;
+
+ if (!n)
+ return;
+
+ sum1 = (~ntohs(*sp)) & 0xffff;
+ sum1 += (n);
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ /* Again */
+ sum1 = (sum1 >> 16) + (sum1 & 0xffff);
+ sumshort = ~(u_short)sum1;
+ *(sp) = htons(sumshort);
+}
+
+/*
+ * How the NAT is organised and works.
+ *
+ * Inside (interface y) NAT Outside (interface x)
+ * -------------------- -+- -------------------------------------
+ * Packet going | out, processsed by ip_natout() for x
+ * ------------> | ------------>
+ * src=10.1.1.1 | src=192.1.1.1
+ * |
+ * | in, processed by ip_natin() for x
+ * <------------ | <------------
+ * dst=10.1.1.1 | dst=192.1.1.1
+ * -------------------- -+- -------------------------------------
+ * ip_natout() - changes ip_src and if required, sport
+ * - creates a new mapping, if required.
+ * ip_natin() - changes ip_dst and if required, dport
+ *
+ * In the NAT table, internal source is recorded as "in" and externally
+ * seen as "out".
+ */
+
+/*
+ * Handle ioctls which manipulate the NAT.
+ */
+int nat_ioctl(data, cmd, mode)
+#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003)
+u_long cmd;
+#else
+int cmd;
+#endif
+caddr_t data;
+int mode;
+{
+ register ipnat_t *nat, *nt, *n = NULL, **np = NULL;
+ int error = 0, ret, arg, getlock;
+ ipnat_t natd;
+ u_32_t i, j;
+
+#if (BSD >= 199306) && defined(_KERNEL)
+ if ((securelevel >= 3) && (mode & FWRITE))
+ return EPERM;
+#endif
+
+ nat = NULL; /* XXX gcc -Wuninitialized */
+ KMALLOC(nt, ipnat_t *);
+ getlock = (mode & NAT_LOCKHELD) ? 0 : 1;
+ if ((cmd == SIOCADNAT) || (cmd == SIOCRMNAT)) {
+ if (mode & NAT_SYSSPACE) {
+ bcopy(data, (char *)&natd, sizeof(natd));
+ error = 0;
+ } else {
+ error = IRCOPYPTR(data, (char *)&natd, sizeof(natd));
+ }
+ } else if (cmd == SIOCIPFFL) { /* SIOCFLNAT & SIOCCNATL */
+ error = IRCOPY(data, (char *)&arg, sizeof(arg));
+ if (error)
+ error = EFAULT;
+ }
+
+ if (error)
+ goto done;
+
+ /*
+ * For add/delete, look to see if the NAT entry is already present
+ */
+ if (getlock == 1) {
+ WRITE_ENTER(&ipf_nat);
+ }
+ if ((cmd == SIOCADNAT) || (cmd == SIOCRMNAT)) {
+ nat = &natd;
+ nat->in_flags &= IPN_USERFLAGS;
+ if ((nat->in_redir & NAT_MAPBLK) == 0) {
+ if ((nat->in_flags & IPN_SPLIT) == 0)
+ nat->in_inip &= nat->in_inmsk;
+ if ((nat->in_flags & IPN_IPRANGE) == 0)
+ nat->in_outip &= nat->in_outmsk;
+ }
+ for (np = &nat_list; (n = *np); np = &n->in_next)
+ if (!bcmp((char *)&nat->in_flags, (char *)&n->in_flags,
+ IPN_CMPSIZ)) {
+ if (n->in_redir == NAT_REDIRECT &&
+ n->in_pnext != nat->in_pnext)
+ continue;
+ break;
+ }
+ }
+
+ switch (cmd)
+ {
+#ifdef IPFILTER_LOG
+ case SIOCIPFFB :
+ {
+ int tmp;
+
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ tmp = ipflog_clear(IPL_LOGNAT);
+ IWCOPY((char *)&tmp, (char *)data, sizeof(tmp));
+ }
+ break;
+ }
+#endif
+ case SIOCADNAT :
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ break;
+ }
+ if (n) {
+ error = EEXIST;
+ break;
+ }
+ if (nt == NULL) {
+ error = ENOMEM;
+ break;
+ }
+ n = nt;
+ nt = NULL;
+ bcopy((char *)nat, (char *)n, sizeof(*n));
+ n->in_ifp = (void *)GETUNIT(n->in_ifname, 4);
+ if (!n->in_ifp)
+ n->in_ifp = (void *)-1;
+ if (n->in_plabel[0] != '\0') {
+ n->in_apr = appr_lookup(n->in_p, n->in_plabel);
+ if (!n->in_apr) {
+ error = ENOENT;
+ break;
+ }
+ }
+ n->in_next = NULL;
+ *np = n;
+
+ if (n->in_redir & NAT_REDIRECT) {
+ n->in_flags &= ~IPN_NOTDST;
+ nat_addrdr(n);
+ }
+ if (n->in_redir & (NAT_MAP|NAT_MAPBLK)) {
+ n->in_flags &= ~IPN_NOTSRC;
+ nat_addnat(n);
+ }
+
+ n->in_use = 0;
+ if (n->in_redir & NAT_MAPBLK)
+ n->in_space = USABLE_PORTS * ~ntohl(n->in_outmsk);
+ else if (n->in_flags & IPN_AUTOPORTMAP)
+ n->in_space = USABLE_PORTS * ~ntohl(n->in_inmsk);
+ else if (n->in_flags & IPN_IPRANGE)
+ n->in_space = ntohl(n->in_outmsk) - ntohl(n->in_outip);
+ else if (n->in_flags & IPN_SPLIT)
+ n->in_space = 2;
+ else
+ n->in_space = ~ntohl(n->in_outmsk);
+ /*
+ * Calculate the number of valid IP addresses in the output
+ * mapping range. In all cases, the range is inclusive of
+ * the start and ending IP addresses.
+ * If to a CIDR address, lose 2: broadcast + network address
+ * (so subtract 1)
+ * If to a range, add one.
+ * If to a single IP address, set to 1.
+ */
+ if (n->in_space) {
+ if ((n->in_flags & IPN_IPRANGE) != 0)
+ n->in_space += 1;
+ else
+ n->in_space -= 1;
+ } else
+ n->in_space = 1;
+ if ((n->in_outmsk != 0xffffffff) && (n->in_outmsk != 0) &&
+ ((n->in_flags & (IPN_IPRANGE|IPN_SPLIT)) == 0))
+ n->in_nip = ntohl(n->in_outip) + 1;
+ else if ((n->in_flags & IPN_SPLIT) &&
+ (n->in_redir & NAT_REDIRECT))
+ n->in_nip = ntohl(n->in_inip);
+ else
+ n->in_nip = ntohl(n->in_outip);
+ if (n->in_redir & NAT_MAP) {
+ n->in_pnext = ntohs(n->in_pmin);
+ /*
+ * Multiply by the number of ports made available.
+ */
+ if (ntohs(n->in_pmax) >= ntohs(n->in_pmin)) {
+ n->in_space *= (ntohs(n->in_pmax) -
+ ntohs(n->in_pmin) + 1);
+ /*
+ * Because two different sources can map to
+ * different destinations but use the same
+ * local IP#/port #.
+ * If the result is smaller than in_space, then
+ * we may have wrapped around 32bits.
+ */
+ i = n->in_inmsk;
+ if ((i != 0) && (i != 0xffffffff)) {
+ j = n->in_space * (~ntohl(i) + 1);
+ if (j >= n->in_space)
+ n->in_space = j;
+ else
+ n->in_space = 0xffffffff;
+ }
+ }
+ /*
+ * If no protocol is specified, multiple by 256.
+ */
+ if ((n->in_flags & IPN_TCPUDP) == 0) {
+ j = n->in_space * 256;
+ if (j >= n->in_space)
+ n->in_space = j;
+ else
+ n->in_space = 0xffffffff;
+ }
+ }
+ /* Otherwise, these fields are preset */
+ n = NULL;
+ nat_stats.ns_rules++;
+ break;
+ case SIOCRMNAT :
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ n = NULL;
+ break;
+ }
+ if (!n) {
+ error = ESRCH;
+ break;
+ }
+ if (n->in_redir & NAT_REDIRECT)
+ nat_delrdr(n);
+ if (n->in_redir & (NAT_MAPBLK|NAT_MAP))
+ nat_delnat(n);
+ if (nat_list == NULL) {
+ nat_masks = 0;
+ rdr_masks = 0;
+ }
+ *np = n->in_next;
+ if (!n->in_use) {
+ if (n->in_apr)
+ appr_free(n->in_apr);
+ KFREE(n);
+ nat_stats.ns_rules--;
+ } else {
+ n->in_flags |= IPN_DELETE;
+ n->in_next = NULL;
+ }
+ n = NULL;
+ break;
+ case SIOCGNATS :
+ MUTEX_DOWNGRADE(&ipf_nat);
+ nat_stats.ns_table[0] = nat_table[0];
+ nat_stats.ns_table[1] = nat_table[1];
+ nat_stats.ns_list = nat_list;
+ nat_stats.ns_maptable = maptable;
+ nat_stats.ns_nattab_sz = ipf_nattable_sz;
+ nat_stats.ns_rultab_sz = ipf_natrules_sz;
+ nat_stats.ns_rdrtab_sz = ipf_rdrrules_sz;
+ nat_stats.ns_hostmap_sz = ipf_hostmap_sz;
+ nat_stats.ns_instances = nat_instances;
+ nat_stats.ns_apslist = ap_sess_list;
+ error = IWCOPYPTR((char *)&nat_stats, (char *)data,
+ sizeof(nat_stats));
+ break;
+ case SIOCGNATL :
+ {
+ natlookup_t nl;
+
+ MUTEX_DOWNGRADE(&ipf_nat);
+ error = IRCOPYPTR((char *)data, (char *)&nl, sizeof(nl));
+ if (error)
+ break;
+
+ if (nat_lookupredir(&nl)) {
+ error = IWCOPYPTR((char *)&nl, (char *)data,
+ sizeof(nl));
+ } else
+ error = ESRCH;
+ break;
+ }
+ case SIOCIPFFL : /* old SIOCFLNAT & SIOCCNATL */
+ if (!(mode & FWRITE)) {
+ error = EPERM;
+ break;
+ }
+ error = 0;
+ if (arg == 0)
+ ret = nat_flushtable();
+ else if (arg == 1)
+ ret = nat_clearlist();
+ else
+ error = EINVAL;
+ MUTEX_DOWNGRADE(&ipf_nat);
+ if (!error) {
+ error = IWCOPY((caddr_t)&ret, data, sizeof(ret));
+ if (error)
+ error = EFAULT;
+ }
+ break;
+ case SIOCSTLCK :
+ error = IRCOPY(data, (caddr_t)&arg, sizeof(arg));
+ if (!error) {
+ error = IWCOPY((caddr_t)&fr_nat_lock, data,
+ sizeof(fr_nat_lock));
+ if (!error)
+ fr_nat_lock = arg;
+ } else
+ error = EFAULT;
+ break;
+ case SIOCSTPUT :
+ if (fr_nat_lock)
+ error = fr_natputent(data);
+ else
+ error = EACCES;
+ break;
+ case SIOCSTGSZ :
+ if (fr_nat_lock)
+ error = fr_natgetsz(data);
+ else
+ error = EACCES;
+ break;
+ case SIOCSTGET :
+ if (fr_nat_lock)
+ error = fr_natgetent(data);
+ else
+ error = EACCES;
+ break;
+ case FIONREAD :
+#ifdef IPFILTER_LOG
+ arg = (int)iplused[IPL_LOGNAT];
+ MUTEX_DOWNGRADE(&ipf_nat);
+ error = IWCOPY((caddr_t)&arg, (caddr_t)data, sizeof(arg));
+ if (error)
+ error = EFAULT;
+#endif
+ break;
+ default :
+ error = EINVAL;
+ break;
+ }
+ if (getlock == 1) {
+ RWLOCK_EXIT(&ipf_nat); /* READ/WRITE */
+ }
+done:
+ if (nt)
+ KFREE(nt);
+ return error;
+}
+
+
+static int fr_natgetsz(data)
+caddr_t data;
+{
+ ap_session_t *aps;
+ nat_t *nat, *n;
+ int error = 0;
+ natget_t ng;
+
+ error = IRCOPY(data, (caddr_t)&ng, sizeof(ng));
+ if (error)
+ return EFAULT;
+
+ nat = ng.ng_ptr;
+ if (!nat) {
+ nat = nat_instances;
+ ng.ng_sz = 0;
+ if (nat == NULL) {
+ error = IWCOPY((caddr_t)&ng, data, sizeof(ng));
+ if (error)
+ error = EFAULT;
+ return error;
+ }
+ } else {
+ /*
+ * Make sure the pointer we're copying from exists in the
+ * current list of entries. Security precaution to prevent
+ * copying of random kernel data.
+ */
+ for (n = nat_instances; n; n = n->nat_next)
+ if (n == nat)
+ break;
+ if (!n)
+ return ESRCH;
+ }
+
+ ng.ng_sz = sizeof(nat_save_t);
+ aps = nat->nat_aps;
+ if ((aps != NULL) && (aps->aps_data != 0)) {
+ ng.ng_sz += sizeof(ap_session_t);
+ ng.ng_sz += aps->aps_psiz;
+ }
+
+ error = IWCOPY((caddr_t)&ng, data, sizeof(ng));
+ if (error)
+ error = EFAULT;
+ return error;
+}
+
+
+static int fr_natgetent(data)
+caddr_t data;
+{
+ nat_save_t ipn, *ipnp, *ipnn = NULL;
+ register nat_t *n, *nat;
+ ap_session_t *aps;
+ int error;
+
+ error = IRCOPY(data, (caddr_t)&ipnp, sizeof(ipnp));
+ if (error)
+ return EFAULT;
+ error = IRCOPY((caddr_t)ipnp, (caddr_t)&ipn, sizeof(ipn));
+ if (error)
+ return EFAULT;
+
+ nat = ipn.ipn_next;
+ if (!nat) {
+ nat = nat_instances;
+ if (nat == NULL) {
+ if (nat_instances == NULL)
+ return ENOENT;
+ return 0;
+ }
+ } else {
+ /*
+ * Make sure the pointer we're copying from exists in the
+ * current list of entries. Security precaution to prevent
+ * copying of random kernel data.
+ */
+ for (n = nat_instances; n; n = n->nat_next)
+ if (n == nat)
+ break;
+ if (!n)
+ return ESRCH;
+ }
+
+ ipn.ipn_next = nat->nat_next;
+ ipn.ipn_dsize = 0;
+ bcopy((char *)nat, (char *)&ipn.ipn_nat, sizeof(ipn.ipn_nat));
+ ipn.ipn_nat.nat_data = NULL;
+
+ if (nat->nat_ptr) {
+ bcopy((char *)nat->nat_ptr, (char *)&ipn.ipn_ipnat,
+ sizeof(ipn.ipn_ipnat));
+ }
+
+ if (nat->nat_fr)
+ bcopy((char *)nat->nat_fr, (char *)&ipn.ipn_rule,
+ sizeof(ipn.ipn_rule));
+
+ if ((aps = nat->nat_aps)) {
+ ipn.ipn_dsize = sizeof(*aps);
+ if (aps->aps_data)
+ ipn.ipn_dsize += aps->aps_psiz;
+ KMALLOCS(ipnn, nat_save_t *, sizeof(*ipnn) + ipn.ipn_dsize);
+ if (ipnn == NULL)
+ return ENOMEM;
+ bcopy((char *)&ipn, (char *)ipnn, sizeof(ipn));
+
+ bcopy((char *)aps, (char *)ipnn->ipn_data, sizeof(*aps));
+ if (aps->aps_data) {
+ bcopy(aps->aps_data, ipnn->ipn_data + sizeof(*aps),
+ aps->aps_psiz);
+ ipnn->ipn_dsize += aps->aps_psiz;
+ }
+ error = IWCOPY((caddr_t)ipnn, ipnp,
+ sizeof(ipn) + ipn.ipn_dsize);
+ if (error)
+ error = EFAULT;
+ KFREES(ipnn, sizeof(*ipnn) + ipn.ipn_dsize);
+ } else {
+ error = IWCOPY((caddr_t)&ipn, ipnp, sizeof(ipn));
+ if (error)
+ error = EFAULT;
+ }
+ return error;
+}
+
+
+static int fr_natputent(data)
+caddr_t data;
+{
+ nat_save_t ipn, *ipnp, *ipnn = NULL;
+ register nat_t *n, *nat;
+ ap_session_t *aps;
+ frentry_t *fr;
+ ipnat_t *in;
+
+ int error;
+
+ error = IRCOPY(data, (caddr_t)&ipnp, sizeof(ipnp));
+ if (error)
+ return EFAULT;
+ error = IRCOPY((caddr_t)ipnp, (caddr_t)&ipn, sizeof(ipn));
+ if (error)
+ return EFAULT;
+ nat = NULL;
+ if (ipn.ipn_dsize) {
+ KMALLOCS(ipnn, nat_save_t *, sizeof(ipn) + ipn.ipn_dsize);
+ if (ipnn == NULL)
+ return ENOMEM;
+ bcopy((char *)&ipn, (char *)ipnn, sizeof(ipn));
+ error = IRCOPY((caddr_t)ipnp, (caddr_t)ipn.ipn_data,
+ ipn.ipn_dsize);
+ if (error) {
+ error = EFAULT;
+ goto junkput;
+ }
+ } else
+ ipnn = NULL;
+
+ KMALLOC(nat, nat_t *);
+ if (nat == NULL) {
+ error = EFAULT;
+ goto junkput;
+ }
+
+ bcopy((char *)&ipn.ipn_nat, (char *)nat, sizeof(*nat));
+ /*
+ * Initialize all these so that nat_delete() doesn't cause a crash.
+ */
+ nat->nat_phnext[0] = NULL;
+ nat->nat_phnext[1] = NULL;
+ fr = nat->nat_fr;
+ nat->nat_fr = NULL;
+ aps = nat->nat_aps;
+ nat->nat_aps = NULL;
+ in = nat->nat_ptr;
+ nat->nat_ptr = NULL;
+ nat->nat_hm = NULL;
+ nat->nat_data = NULL;
+ nat->nat_ifp = GETUNIT(nat->nat_ifname, 4);
+
+ /*
+ * Restore the rule associated with this nat session
+ */
+ if (in) {
+ KMALLOC(in, ipnat_t *);
+ if (in == NULL) {
+ error = ENOMEM;
+ goto junkput;
+ }
+ nat->nat_ptr = in;
+ bcopy((char *)&ipn.ipn_ipnat, (char *)in, sizeof(*in));
+ in->in_use = 1;
+ in->in_flags |= IPN_DELETE;
+ in->in_next = NULL;
+ in->in_rnext = NULL;
+ in->in_prnext = NULL;
+ in->in_mnext = NULL;
+ in->in_pmnext = NULL;
+ in->in_ifp = GETUNIT(in->in_ifname, 4);
+ if (in->in_plabel[0] != '\0') {
+ in->in_apr = appr_lookup(in->in_p, in->in_plabel);
+ }
+ }
+
+ /*
+ * Restore ap_session_t structure. Include the private data allocated
+ * if it was there.
+ */
+ if (aps) {
+ KMALLOC(aps, ap_session_t *);
+ if (aps == NULL) {
+ error = ENOMEM;
+ goto junkput;
+ }
+ nat->nat_aps = aps;
+ aps->aps_next = ap_sess_list;
+ ap_sess_list = aps;
+ bcopy(ipnn->ipn_data, (char *)aps, sizeof(*aps));
+ if (in)
+ aps->aps_apr = in->in_apr;
+ if (aps->aps_psiz) {
+ KMALLOCS(aps->aps_data, void *, aps->aps_psiz);
+ if (aps->aps_data == NULL) {
+ error = ENOMEM;
+ goto junkput;
+ }
+ bcopy(ipnn->ipn_data + sizeof(*aps), aps->aps_data,
+ aps->aps_psiz);
+ } else {
+ aps->aps_psiz = 0;
+ aps->aps_data = NULL;
+ }
+ }
+
+ /*
+ * If there was a filtering rule associated with this entry then
+ * build up a new one.
+ */
+ if (fr != NULL) {
+ if (nat->nat_flags & FI_NEWFR) {
+ KMALLOC(fr, frentry_t *);
+ nat->nat_fr = fr;
+ if (fr == NULL) {
+ error = ENOMEM;
+ goto junkput;
+ }
+ bcopy((char *)&ipn.ipn_fr, (char *)fr, sizeof(*fr));
+ ipn.ipn_nat.nat_fr = fr;
+ error = IWCOPY((caddr_t)&ipn, ipnp, sizeof(ipn));
+ if (error) {
+ error = EFAULT;
+ goto junkput;
+ }
+ } else {
+ for (n = nat_instances; n; n = n->nat_next)
+ if (n->nat_fr == fr)
+ break;
+ if (!n) {
+ error = ESRCH;
+ goto junkput;
+ }
+ }
+ }
+
+ if (ipnn)
+ KFREES(ipnn, sizeof(ipn) + ipn.ipn_dsize);
+ nat_insert(nat);
+ return 0;
+junkput:
+ if (ipnn)
+ KFREES(ipnn, sizeof(ipn) + ipn.ipn_dsize);
+ if (nat)
+ nat_delete(nat);
+ return error;
+}
+
+
+/*
+ * Delete a nat entry from the various lists and table.
+ */
+static void nat_delete(natd)
+struct nat *natd;
+{
+ struct ipnat *ipn;
+
+ if (natd->nat_flags & FI_WILDP)
+ nat_stats.ns_wilds--;
+ if (natd->nat_hnext[0])
+ natd->nat_hnext[0]->nat_phnext[0] = natd->nat_phnext[0];
+ *natd->nat_phnext[0] = natd->nat_hnext[0];
+ if (natd->nat_hnext[1])
+ natd->nat_hnext[1]->nat_phnext[1] = natd->nat_phnext[1];
+ *natd->nat_phnext[1] = natd->nat_hnext[1];
+ if (natd->nat_me != NULL)
+ *natd->nat_me = NULL;
+
+ if (natd->nat_fr != NULL) {
+ ATOMIC_DEC32(natd->nat_fr->fr_ref);
+ }
+
+ if (natd->nat_hm != NULL)
+ nat_hostmapdel(natd->nat_hm);
+
+ /*
+ * If there is an active reference from the nat entry to its parent
+ * rule, decrement the rule's reference count and free it too if no
+ * longer being used.
+ */
+ ipn = natd->nat_ptr;
+ if (ipn != NULL) {
+ ipn->in_space++;
+ ipn->in_use--;
+ if (!ipn->in_use && (ipn->in_flags & IPN_DELETE)) {
+ if (ipn->in_apr)
+ appr_free(ipn->in_apr);
+ KFREE(ipn);
+ nat_stats.ns_rules--;
+ }
+ }
+
+ MUTEX_DESTROY(&natd->nat_lock);
+ /*
+ * If there's a fragment table entry too for this nat entry, then
+ * dereference that as well.
+ */
+ ipfr_forget((void *)natd);
+ aps_free(natd->nat_aps);
+ nat_stats.ns_inuse--;
+ KFREE(natd);
+}
+
+
+/*
+ * nat_flushtable - clear the NAT table of all mapping entries.
+ * (this is for the dynamic mappings)
+ */
+static int nat_flushtable()
+{
+ register nat_t *nat, **natp;
+ register int j = 0;
+
+ /*
+ * ALL NAT mappings deleted, so lets just make the deletions
+ * quicker.
+ */
+ if (nat_table[0] != NULL)
+ bzero((char *)nat_table[0],
+ sizeof(nat_table[0]) * ipf_nattable_sz);
+ if (nat_table[1] != NULL)
+ bzero((char *)nat_table[1],
+ sizeof(nat_table[1]) * ipf_nattable_sz);
+
+ for (natp = &nat_instances; (nat = *natp); ) {
+ *natp = nat->nat_next;
+#ifdef IPFILTER_LOG
+ nat_log(nat, NL_FLUSH);
+#endif
+ nat_delete(nat);
+ j++;
+ }
+ nat_stats.ns_inuse = 0;
+ return j;
+}
+
+
+/*
+ * nat_clearlist - delete all rules in the active NAT mapping list.
+ * (this is for NAT/RDR rules)
+ */
+int nat_clearlist()
+{
+ register ipnat_t *n, **np = &nat_list;
+ int i = 0;
+
+ if (nat_rules != NULL)
+ bzero((char *)nat_rules, sizeof(*nat_rules) * ipf_natrules_sz);
+ if (rdr_rules != NULL)
+ bzero((char *)rdr_rules, sizeof(*rdr_rules) * ipf_rdrrules_sz);
+
+ while ((n = *np)) {
+ *np = n->in_next;
+ if (!n->in_use) {
+ if (n->in_apr)
+ appr_free(n->in_apr);
+ KFREE(n);
+ nat_stats.ns_rules--;
+ } else {
+ n->in_flags |= IPN_DELETE;
+ n->in_next = NULL;
+ }
+ i++;
+ }
+ nat_masks = 0;
+ rdr_masks = 0;
+ return i;
+}
+
+
+/*
+ * Create a new NAT table entry.
+ * NOTE: Assumes write lock on ipf_nat has been obtained already.
+ * If you intend on changing this, beware: appr_new() may call nat_new()
+ * recursively!
+ */
+nat_t *nat_new(fin, ip, np, natsave, flags, direction)
+fr_info_t *fin;
+ip_t *ip;
+ipnat_t *np;
+nat_t **natsave;
+u_int flags;
+int direction;
+{
+ register u_32_t sum1, sum2, sumd, l;
+ u_short port = 0, sport = 0, dport = 0, nport = 0;
+ struct in_addr in, inb;
+ u_short nflags, sp, dp;
+ tcphdr_t *tcp = NULL;
+ hostmap_t *hm = NULL;
+ nat_t *nat, *natl;
+#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6)
+ qif_t *qf = fin->fin_qif;
+#endif
+
+ nflags = flags & np->in_flags;
+ if (flags & IPN_TCPUDP) {
+ tcp = (tcphdr_t *)fin->fin_dp;
+ sport = htons(fin->fin_data[0]);
+ dport = htons(fin->fin_data[1]);
+ }
+
+ /* Give me a new nat */
+ KMALLOC(nat, nat_t *);
+ if (nat == NULL) {
+ nat_stats.ns_memfail++;
+ return NULL;
+ }
+
+ bzero((char *)nat, sizeof(*nat));
+ nat->nat_flags = flags;
+ if (flags & FI_WILDP)
+ nat_stats.ns_wilds++;
+ /*
+ * Search the current table for a match.
+ */
+ if (direction == NAT_OUTBOUND) {
+ /*
+ * Values at which the search for a free resouce starts.
+ */
+ u_32_t st_ip;
+ u_short st_port;
+
+ /*
+ * If it's an outbound packet which doesn't match any existing
+ * record, then create a new port
+ */
+ l = 0;
+ st_ip = np->in_nip;
+ st_port = np->in_pnext;
+
+ do {
+ port = 0;
+ in.s_addr = htonl(np->in_nip);
+ if (l == 0) {
+ /*
+ * Check to see if there is an existing NAT
+ * setup for this IP address pair.
+ */
+ hm = nat_hostmap(np, fin->fin_src, in);
+ if (hm != NULL)
+ in.s_addr = hm->hm_mapip.s_addr;
+ } else if ((l == 1) && (hm != NULL)) {
+ nat_hostmapdel(hm);
+ hm = NULL;
+ }
+ in.s_addr = ntohl(in.s_addr);
+
+ nat->nat_hm = hm;
+
+ if ((np->in_outmsk == 0xffffffff) &&
+ (np->in_pnext == 0)) {
+ if (l > 0)
+ goto badnat;
+ }
+
+ if (np->in_redir & NAT_MAPBLK) {
+ if ((l >= np->in_ppip) || ((l > 0) &&
+ !(flags & IPN_TCPUDP)))
+ goto badnat;
+ /*
+ * map-block - Calculate destination address.
+ */
+ in.s_addr = ntohl(fin->fin_saddr);
+ in.s_addr &= ntohl(~np->in_inmsk);
+ inb.s_addr = in.s_addr;
+ in.s_addr /= np->in_ippip;
+ in.s_addr &= ntohl(~np->in_outmsk);
+ in.s_addr += ntohl(np->in_outip);
+ /*
+ * Calculate destination port.
+ */
+ if ((flags & IPN_TCPUDP) &&
+ (np->in_ppip != 0)) {
+ port = ntohs(sport) + l;
+ port %= np->in_ppip;
+ port += np->in_ppip *
+ (inb.s_addr % np->in_ippip);
+ port += MAPBLK_MINPORT;
+ port = htons(port);
+ }
+ } else if (!np->in_outip &&
+ (np->in_outmsk == 0xffffffff)) {
+ /*
+ * 0/32 - use the interface's IP address.
+ */
+ if ((l > 0) ||
+ fr_ifpaddr(4, fin->fin_ifp, &in) == -1)
+ goto badnat;
+ in.s_addr = ntohl(in.s_addr);
+ } else if (!np->in_outip && !np->in_outmsk) {
+ /*
+ * 0/0 - use the original source address/port.
+ */
+ if (l > 0)
+ goto badnat;
+ in.s_addr = ntohl(fin->fin_saddr);
+ } else if ((np->in_outmsk != 0xffffffff) &&
+ (np->in_pnext == 0) &&
+ ((l > 0) || (hm == NULL)))
+ np->in_nip++;
+ natl = NULL;
+
+ if ((nflags & IPN_TCPUDP) &&
+ ((np->in_redir & NAT_MAPBLK) == 0) &&
+ (np->in_flags & IPN_AUTOPORTMAP)) {
+ if ((l > 0) && (l % np->in_ppip == 0)) {
+ if (l > np->in_space) {
+ goto badnat;
+ } else if ((l > np->in_ppip) &&
+ np->in_outmsk != 0xffffffff)
+ np->in_nip++;
+ }
+ if (np->in_ppip != 0) {
+ port = ntohs(sport);
+ port += (l % np->in_ppip);
+ port %= np->in_ppip;
+ port += np->in_ppip *
+ (ntohl(fin->fin_saddr) %
+ np->in_ippip);
+ port += MAPBLK_MINPORT;
+ port = htons(port);
+ }
+ } else if (((np->in_redir & NAT_MAPBLK) == 0) &&
+ (nflags & IPN_TCPUDP) &&
+ (np->in_pnext != 0)) {
+ port = htons(np->in_pnext++);
+ if (np->in_pnext > ntohs(np->in_pmax)) {
+ np->in_pnext = ntohs(np->in_pmin);
+ if (np->in_outmsk != 0xffffffff)
+ np->in_nip++;
+ }
+ }
+
+ if (np->in_flags & IPN_IPRANGE) {
+ if (np->in_nip > ntohl(np->in_outmsk))
+ np->in_nip = ntohl(np->in_outip);
+ } else {
+ if ((np->in_outmsk != 0xffffffff) &&
+ ((np->in_nip + 1) & ntohl(np->in_outmsk)) >
+ ntohl(np->in_outip))
+ np->in_nip = ntohl(np->in_outip) + 1;
+ }
+
+ if (!port && (flags & IPN_TCPUDP))
+ port = sport;
+
+ /*
+ * Here we do a lookup of the connection as seen from
+ * the outside. If an IP# pair already exists, try
+ * again. So if you have A->B becomes C->B, you can
+ * also have D->E become C->E but not D->B causing
+ * another C->B. Also take protocol and ports into
+ * account when determining whether a pre-existing
+ * NAT setup will cause an external conflict where
+ * this is appropriate.
+ */
+ inb.s_addr = htonl(in.s_addr);
+ sp = fin->fin_data[0];
+ dp = fin->fin_data[1];
+ fin->fin_data[0] = fin->fin_data[1];
+ fin->fin_data[1] = htons(port);
+ natl = nat_inlookup(fin, flags & ~FI_WILDP,
+ (u_int)fin->fin_p, fin->fin_dst,
+ inb, 1);
+ fin->fin_data[0] = sp;
+ fin->fin_data[1] = dp;
+
+ /*
+ * Has the search wrapped around and come back to the
+ * start ?
+ */
+ if ((natl != NULL) &&
+ (np->in_pnext != 0) && (st_port == np->in_pnext) &&
+ (np->in_nip != 0) && (st_ip == np->in_nip))
+ goto badnat;
+ l++;
+ } while (natl != NULL);
+
+ if (np->in_space > 0)
+ np->in_space--;
+
+ /* Setup the NAT table */
+ nat->nat_inip = fin->fin_src;
+ nat->nat_outip.s_addr = htonl(in.s_addr);
+ nat->nat_oip = fin->fin_dst;
+ if (nat->nat_hm == NULL)
+ nat->nat_hm = nat_hostmap(np, fin->fin_src,
+ nat->nat_outip);
+
+ sum1 = LONG_SUM(ntohl(fin->fin_saddr)) + ntohs(sport);
+ sum2 = LONG_SUM(in.s_addr) + ntohs(port);
+
+ if (flags & IPN_TCPUDP) {
+ nat->nat_inport = sport;
+ nat->nat_outport = port; /* sport */
+ nat->nat_oport = dport;
+ }
+ } else {
+ /*
+ * Otherwise, it's an inbound packet. Most likely, we don't
+ * want to rewrite source ports and source addresses. Instead,
+ * we want to rewrite to a fixed internal address and fixed
+ * internal port.
+ */
+ if (np->in_flags & IPN_SPLIT) {
+ in.s_addr = np->in_nip;
+ if (np->in_inip == htonl(in.s_addr))
+ np->in_nip = ntohl(np->in_inmsk);
+ else {
+ np->in_nip = ntohl(np->in_inip);
+ if (np->in_flags & IPN_ROUNDR) {
+ nat_delrdr(np);
+ nat_addrdr(np);
+ }
+ }
+ } else {
+ in.s_addr = ntohl(np->in_inip);
+ if (np->in_flags & IPN_ROUNDR) {
+ nat_delrdr(np);
+ nat_addrdr(np);
+ }
+ }
+ if (!np->in_pnext)
+ nport = dport;
+ else {
+ /*
+ * Whilst not optimized for the case where
+ * pmin == pmax, the gain is not significant.
+ */
+ if (np->in_pmin != np->in_pmax) {
+ nport = ntohs(dport) - ntohs(np->in_pmin) +
+ ntohs(np->in_pnext);
+ nport = ntohs(nport);
+ } else
+ nport = np->in_pnext;
+ }
+
+ /*
+ * When the redirect-to address is set to 0.0.0.0, just
+ * assume a blank `forwarding' of the packet.
+ */
+ if (in.s_addr == 0)
+ in.s_addr = ntohl(fin->fin_daddr);
+
+ nat->nat_inip.s_addr = htonl(in.s_addr);
+ nat->nat_outip = fin->fin_dst;
+ nat->nat_oip = fin->fin_src;
+
+ sum1 = LONG_SUM(ntohl(fin->fin_daddr)) + ntohs(dport);
+ sum2 = LONG_SUM(in.s_addr) + ntohs(nport);
+
+ if (flags & IPN_TCPUDP) {
+ nat->nat_inport = nport;
+ nat->nat_outport = dport;
+ nat->nat_oport = sport;
+ }
+ }
+
+ CALC_SUMD(sum1, sum2, sumd);
+ nat->nat_sumd[0] = (sumd & 0xffff) + (sumd >> 16);
+#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6)
+ if ((flags & IPN_TCPUDP) && dohwcksum &&
+ (qf->qf_ill->ill_ick.ick_magic == ICK_M_CTL_MAGIC)) {
+ if (direction == NAT_OUTBOUND)
+ sum1 = LONG_SUM(ntohl(in.s_addr));
+ else
+ sum1 = LONG_SUM(ntohl(fin->fin_saddr));
+ sum1 += LONG_SUM(ntohl(fin->fin_daddr));
+ sum1 += IPPROTO_TCP;
+ sum1 = (sum1 & 0xffff) + (sum1 >> 16);
+ nat->nat_sumd[1] = NAT_HW_CKSUM|(sum1 & 0xffff);
+ } else
+#endif
+ nat->nat_sumd[1] = nat->nat_sumd[0];
+
+ if ((flags & IPN_TCPUDP) && ((sport != port) || (dport != nport))) {
+ if (direction == NAT_OUTBOUND)
+ sum1 = LONG_SUM(ntohl(fin->fin_saddr));
+ else
+ sum1 = LONG_SUM(ntohl(fin->fin_daddr));
+
+ sum2 = LONG_SUM(in.s_addr);
+
+ CALC_SUMD(sum1, sum2, sumd);
+ nat->nat_ipsumd = (sumd & 0xffff) + (sumd >> 16);
+ } else
+ nat->nat_ipsumd = nat->nat_sumd[0];
+
+ in.s_addr = htonl(in.s_addr);
+
+ strncpy(nat->nat_ifname, IFNAME(fin->fin_ifp), IFNAMSIZ);
+
+ nat->nat_me = natsave;
+ nat->nat_dir = direction;
+ nat->nat_ifp = fin->fin_ifp;
+ nat->nat_ptr = np;
+ nat->nat_p = fin->fin_p;
+ nat->nat_bytes = 0;
+ nat->nat_pkts = 0;
+ nat->nat_mssclamp = np->in_mssclamp;
+ nat->nat_fr = fin->fin_fr;
+ if (nat->nat_fr != NULL) {
+ ATOMIC_INC32(nat->nat_fr->fr_ref);
+ }
+ if (direction == NAT_OUTBOUND) {
+ if (flags & IPN_TCPUDP)
+ tcp->th_sport = port;
+ } else {
+ if (flags & IPN_TCPUDP)
+ tcp->th_dport = nport;
+ }
+
+ nat_insert(nat);
+
+ if ((np->in_apr != NULL) && (np->in_dport == 0 ||
+ (tcp != NULL && dport == np->in_dport)))
+ (void) appr_new(fin, ip, nat);
+
+ np->in_use++;
+#ifdef IPFILTER_LOG
+ nat_log(nat, (u_int)np->in_redir);
+#endif
+ return nat;
+badnat:
+ nat_stats.ns_badnat++;
+ if ((hm = nat->nat_hm) != NULL)
+ nat_hostmapdel(hm);
+ KFREE(nat);
+ return NULL;
+}
+
+
+/*
+ * Insert a NAT entry into the hash tables for searching and add it to the
+ * list of active NAT entries. Adjust global counters when complete.
+ */
+void nat_insert(nat)
+nat_t *nat;
+{
+ u_int hv1, hv2;
+ nat_t **natp;
+
+ MUTEX_INIT(&nat->nat_lock, "nat entry lock", NULL);
+
+ nat->nat_age = fr_defnatage;
+ nat->nat_ifname[sizeof(nat->nat_ifname) - 1] = '\0';
+ if (nat->nat_ifname[0] !='\0') {
+ nat->nat_ifp = GETUNIT(nat->nat_ifname, 4);
+ }
+
+ nat->nat_next = nat_instances;
+ nat_instances = nat;
+
+ if (!(nat->nat_flags & (FI_W_SPORT|FI_W_DPORT))) {
+ hv1 = NAT_HASH_FN(nat->nat_inip.s_addr, nat->nat_inport,
+ 0xffffffff);
+ hv1 = NAT_HASH_FN(nat->nat_oip.s_addr, hv1 + nat->nat_oport,
+ ipf_nattable_sz);
+ hv2 = NAT_HASH_FN(nat->nat_outip.s_addr, nat->nat_outport,
+ 0xffffffff);
+ hv2 = NAT_HASH_FN(nat->nat_oip.s_addr, hv2 + nat->nat_oport,
+ ipf_nattable_sz);
+ } else {
+ hv1 = NAT_HASH_FN(nat->nat_oip.s_addr, nat->nat_inip.s_addr,
+ ipf_nattable_sz);
+ hv2 = NAT_HASH_FN(nat->nat_oip.s_addr, nat->nat_outip.s_addr,
+ ipf_nattable_sz);
+ }
+
+ natp = &nat_table[0][hv1];
+ if (*natp)
+ (*natp)->nat_phnext[0] = &nat->nat_hnext[0];
+ nat->nat_phnext[0] = natp;
+ nat->nat_hnext[0] = *natp;
+ *natp = nat;
+
+ natp = &nat_table[1][hv2];
+ if (*natp)
+ (*natp)->nat_phnext[1] = &nat->nat_hnext[1];
+ nat->nat_phnext[1] = natp;
+ nat->nat_hnext[1] = *natp;
+ *natp = nat;
+
+ nat_stats.ns_added++;
+ nat_stats.ns_inuse++;
+}
+
+
+nat_t *nat_icmplookup(ip, fin, dir)
+ip_t *ip;
+fr_info_t *fin;
+int dir;
+{
+ icmphdr_t *icmp;
+ tcphdr_t *tcp = NULL;
+ ip_t *oip;
+ int flags = 0, type, minlen;
+
+ icmp = (icmphdr_t *)fin->fin_dp;
+ /*
+ * Does it at least have the return (basic) IP header ?
+ * Only a basic IP header (no options) should be with an ICMP error
+ * header.
+ */
+ if ((ip->ip_hl != 5) || (ip->ip_len < ICMPERR_MINPKTLEN))
+ return NULL;
+ type = icmp->icmp_type;
+ /*
+ * If it's not an error type, then return.
+ */
+ if ((type != ICMP_UNREACH) && (type != ICMP_SOURCEQUENCH) &&
+ (type != ICMP_REDIRECT) && (type != ICMP_TIMXCEED) &&
+ (type != ICMP_PARAMPROB))
+ return NULL;
+
+ oip = (ip_t *)((char *)fin->fin_dp + 8);
+ minlen = (oip->ip_hl << 2);
+ if (minlen < sizeof(ip_t))
+ return NULL;
+ if (ip->ip_len < ICMPERR_IPICMPHLEN + minlen)
+ return NULL;
+ /*
+ * Is the buffer big enough for all of it ? It's the size of the IP
+ * header claimed in the encapsulated part which is of concern. It
+ * may be too big to be in this buffer but not so big that it's
+ * outside the ICMP packet, leading to TCP deref's causing problems.
+ * This is possible because we don't know how big oip_hl is when we
+ * do the pullup early in fr_check() and thus can't gaurantee it is
+ * all here now.
+ */
+#ifdef _KERNEL
+ {
+ mb_t *m;
+
+# if SOLARIS
+ m = fin->fin_qfm;
+ if ((char *)oip + fin->fin_dlen - ICMPERR_ICMPHLEN > (char *)m->b_wptr)
+ return NULL;
+# else
+ m = *(mb_t **)fin->fin_mp;
+ if ((char *)oip + fin->fin_dlen - ICMPERR_ICMPHLEN >
+ (char *)ip + m->m_len)
+ return NULL;
+# endif
+ }
+#endif
+
+ if (oip->ip_p == IPPROTO_TCP)
+ flags = IPN_TCP;
+ else if (oip->ip_p == IPPROTO_UDP)
+ flags = IPN_UDP;
+ if (flags & IPN_TCPUDP) {
+ u_short data[2];
+ nat_t *nat;
+
+ minlen += 8; /* + 64bits of data to get ports */
+ if (ip->ip_len < ICMPERR_IPICMPHLEN + minlen)
+ return NULL;
+
+ data[0] = fin->fin_data[0];
+ data[1] = fin->fin_data[1];
+ tcp = (tcphdr_t *)((char *)oip + (oip->ip_hl << 2));
+ fin->fin_data[0] = ntohs(tcp->th_dport);
+ fin->fin_data[1] = ntohs(tcp->th_sport);
+
+ if (dir == NAT_INBOUND) {
+ nat = nat_inlookup(fin, flags, (u_int)oip->ip_p,
+ oip->ip_dst, oip->ip_src, 0);
+ } else {
+ nat = nat_outlookup(fin, flags, (u_int)oip->ip_p,
+ oip->ip_dst, oip->ip_src, 0);
+ }
+ fin->fin_data[0] = data[0];
+ fin->fin_data[1] = data[1];
+ return nat;
+ }
+ if (dir == NAT_INBOUND)
+ return nat_inlookup(fin, 0, (u_int)oip->ip_p,
+ oip->ip_dst, oip->ip_src, 0);
+ else
+ return nat_outlookup(fin, 0, (u_int)oip->ip_p,
+ oip->ip_dst, oip->ip_src, 0);
+}
+
+
+/*
+ * This should *ONLY* be used for incoming packets to make sure a NAT'd ICMP
+ * packet gets correctly recognised.
+ */
+nat_t *nat_icmp(ip, fin, nflags, dir)
+ip_t *ip;
+fr_info_t *fin;
+u_int *nflags;
+int dir;
+{
+ u_32_t sum1, sum2, sumd, sumd2 = 0;
+ struct in_addr in;
+ int flags, dlen;
+ icmphdr_t *icmp;
+ udphdr_t *udp;
+ tcphdr_t *tcp;
+ nat_t *nat;
+ ip_t *oip;
+
+ if ((fin->fin_fl & FI_SHORT) || (fin->fin_off != 0))
+ return NULL;
+ /*
+ * nat_icmplookup() will return NULL for `defective' packets.
+ */
+ if ((ip->ip_v != 4) || !(nat = nat_icmplookup(ip, fin, dir)))
+ return NULL;
+
+ flags = 0;
+ *nflags = IPN_ICMPERR;
+ icmp = (icmphdr_t *)fin->fin_dp;
+ oip = (ip_t *)&icmp->icmp_ip;
+ if (oip->ip_p == IPPROTO_TCP)
+ flags = IPN_TCP;
+ else if (oip->ip_p == IPPROTO_UDP)
+ flags = IPN_UDP;
+ udp = (udphdr_t *)((((char *)oip) + (oip->ip_hl << 2)));
+ dlen = ip->ip_len - ((char *)udp - (char *)ip);
+ /*
+ * XXX - what if this is bogus hl and we go off the end ?
+ * In this case, nat_icmplookup() will have returned NULL.
+ */
+ tcp = (tcphdr_t *)udp;
+
+ /*
+ * Need to adjust ICMP header to include the real IP#'s and
+ * port #'s. Only apply a checksum change relative to the
+ * IP address change as it will be modified again in ip_natout
+ * for both address and port. Two checksum changes are
+ * necessary for the two header address changes. Be careful
+ * to only modify the checksum once for the port # and twice
+ * for the IP#.
+ */
+
+ /*
+ * Step 1
+ * Fix the IP addresses in the offending IP packet. You also need
+ * to adjust the IP header checksum of that offending IP packet
+ * and the ICMP checksum of the ICMP error message itself.
+ *
+ * Unfortunately, for UDP and TCP, the IP addresses are also contained
+ * in the pseudo header that is used to compute the UDP resp. TCP
+ * checksum. So, we must compensate that as well. Even worse, the
+ * change in the UDP and TCP checksums require yet another
+ * adjustment of the ICMP checksum of the ICMP error message.
+ *
+ */
+
+ if (oip->ip_dst.s_addr == nat->nat_oip.s_addr) {
+ sum1 = LONG_SUM(ntohl(oip->ip_src.s_addr));
+ in = nat->nat_inip;
+ oip->ip_src = in;
+ } else {
+ sum1 = LONG_SUM(ntohl(oip->ip_dst.s_addr));
+ in = nat->nat_outip;
+ oip->ip_dst = in;
+ }
+
+ sum2 = LONG_SUM(ntohl(in.s_addr));
+
+ CALC_SUMD(sum1, sum2, sumd);
+
+ if (nat->nat_dir == NAT_OUTBOUND) {
+ /*
+ * Fix IP checksum of the offending IP packet to adjust for
+ * the change in the IP address.
+ *
+ * Normally, you would expect that the ICMP checksum of the
+ * ICMP error message needs to be adjusted as well for the
+ * IP address change in oip.
+ * However, this is a NOP, because the ICMP checksum is
+ * calculated over the complete ICMP packet, which includes the
+ * changed oip IP addresses and oip->ip_sum. However, these
+ * two changes cancel each other out (if the delta for
+ * the IP address is x, then the delta for ip_sum is minus x),
+ * so no change in the icmp_cksum is necessary.
+ *
+ * Be careful that nat_dir refers to the direction of the
+ * offending IP packet (oip), not to its ICMP response (icmp)
+ */
+ fix_datacksum(&oip->ip_sum, sumd);
+
+ /*
+ * Fix UDP pseudo header checksum to compensate for the
+ * IP address change.
+ */
+ if (oip->ip_p == IPPROTO_UDP && udp->uh_sum) {
+ /*
+ * The UDP checksum is optional, only adjust it
+ * if it has been set.
+ */
+ sum1 = ntohs(udp->uh_sum);
+ fix_datacksum(&udp->uh_sum, sumd);
+ sum2 = ntohs(udp->uh_sum);
+
+ /*
+ * Fix ICMP checksum to compensate the UDP
+ * checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 = sumd;
+ }
+
+ /*
+ * Fix TCP pseudo header checksum to compensate for the
+ * IP address change. Before we can do the change, we
+ * must make sure that oip is sufficient large to hold
+ * the TCP checksum (normally it does not!).
+ */
+ if (oip->ip_p == IPPROTO_TCP && dlen >= 18) {
+
+ sum1 = ntohs(tcp->th_sum);
+ fix_datacksum(&tcp->th_sum, sumd);
+ sum2 = ntohs(tcp->th_sum);
+
+ /*
+ * Fix ICMP checksum to compensate the TCP
+ * checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 = sumd;
+ }
+ } else {
+
+ /*
+ * Fix IP checksum of the offending IP packet to adjust for
+ * the change in the IP address.
+ *
+ * Normally, you would expect that the ICMP checksum of the
+ * ICMP error message needs to be adjusted as well for the
+ * IP address change in oip.
+ * However, this is a NOP, because the ICMP checksum is
+ * calculated over the complete ICMP packet, which includes the
+ * changed oip IP addresses and oip->ip_sum. However, these
+ * two changes cancel each other out (if the delta for
+ * the IP address is x, then the delta for ip_sum is minus x),
+ * so no change in the icmp_cksum is necessary.
+ *
+ * Be careful that nat_dir refers to the direction of the
+ * offending IP packet (oip), not to its ICMP response (icmp)
+ */
+ fix_datacksum(&oip->ip_sum, sumd);
+
+/* XXX FV : without having looked at Solaris source code, it seems unlikely
+ * that SOLARIS would compensate this in the kernel (a body of an IP packet
+ * in the data section of an ICMP packet). I have the feeling that this should
+ * be unconditional, but I'm not in a position to check.
+ */
+#if !SOLARIS && !defined(__sgi)
+ /*
+ * Fix UDP pseudo header checksum to compensate for the
+ * IP address change.
+ */
+ if (oip->ip_p == IPPROTO_UDP && udp->uh_sum) {
+ /*
+ * The UDP checksum is optional, only adjust it
+ * if it has been set
+ */
+ sum1 = ntohs(udp->uh_sum);
+ fix_datacksum(&udp->uh_sum, sumd);
+ sum2 = ntohs(udp->uh_sum);
+
+ /*
+ * Fix ICMP checksum to compensate the UDP
+ * checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 = sumd;
+ }
+
+ /*
+ * Fix TCP pseudo header checksum to compensate for the
+ * IP address change. Before we can do the change, we
+ * must make sure that oip is sufficient large to hold
+ * the TCP checksum (normally it does not!).
+ */
+ if (oip->ip_p == IPPROTO_TCP && dlen >= 18) {
+
+ sum1 = ntohs(tcp->th_sum);
+ fix_datacksum(&tcp->th_sum, sumd);
+ sum2 = ntohs(tcp->th_sum);
+
+ /*
+ * Fix ICMP checksum to compensate the TCP
+ * checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 = sumd;
+ }
+#endif
+ }
+
+ if ((flags & IPN_TCPUDP) != 0) {
+ /*
+ * Step 2 :
+ * For offending TCP/UDP IP packets, translate the ports as
+ * well, based on the NAT specification. Of course such
+ * a change must be reflected in the ICMP checksum as well.
+ *
+ * Advance notice : Now it becomes complicated :-)
+ *
+ * Since the port fields are part of the TCP/UDP checksum
+ * of the offending IP packet, you need to adjust that checksum
+ * as well... but, if you change, you must change the icmp
+ * checksum *again*, to reflect that change.
+ *
+ * To further complicate: the TCP checksum is not in the first
+ * 8 bytes of the offending ip packet, so it most likely is not
+ * available. Some OSses like Solaris return enough bytes to
+ * include the TCP checksum. So we have to check if the
+ * ip->ip_len actually holds the TCP checksum of the oip!
+ */
+
+ if (nat->nat_oport == tcp->th_dport) {
+ if (tcp->th_sport != nat->nat_inport) {
+ /*
+ * Fix ICMP checksum to compensate port
+ * adjustment.
+ */
+ sum1 = ntohs(tcp->th_sport);
+ sum2 = ntohs(nat->nat_inport);
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ tcp->th_sport = nat->nat_inport;
+
+ /*
+ * Fix udp checksum to compensate port
+ * adjustment. NOTE : the offending IP packet
+ * flows the other direction compared to the
+ * ICMP message.
+ *
+ * The UDP checksum is optional, only adjust
+ * it if it has been set.
+ */
+ if (oip->ip_p == IPPROTO_UDP && udp->uh_sum) {
+
+ sum1 = ntohs(udp->uh_sum);
+ fix_datacksum(&udp->uh_sum, sumd);
+ sum2 = ntohs(udp->uh_sum);
+
+ /*
+ * Fix ICMP checksum to
+ * compensate UDP checksum
+ * adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ }
+
+ /*
+ * Fix tcp checksum (if present) to compensate
+ * port adjustment. NOTE : the offending IP
+ * packet flows the other direction compared to
+ * the ICMP message.
+ */
+ if (oip->ip_p == IPPROTO_TCP && dlen >= 18) {
+
+ sum1 = ntohs(tcp->th_sum);
+ fix_datacksum(&tcp->th_sum, sumd);
+ sum2 = ntohs(tcp->th_sum);
+
+ /*
+ * Fix ICMP checksum to
+ * compensate TCP checksum
+ * adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ }
+ }
+ } else {
+ if (tcp->th_dport != nat->nat_outport) {
+ /*
+ * Fix ICMP checksum to compensate port
+ * adjustment.
+ */
+ sum1 = ntohs(tcp->th_dport);
+ sum2 = ntohs(nat->nat_outport);
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ tcp->th_dport = nat->nat_outport;
+
+ /*
+ * Fix udp checksum to compensate port
+ * adjustment. NOTE : the offending IP
+ * packet flows the other direction compared
+ * to the ICMP message.
+ *
+ * The UDP checksum is optional, only adjust
+ * it if it has been set.
+ */
+ if (oip->ip_p == IPPROTO_UDP && udp->uh_sum) {
+
+ sum1 = ntohs(udp->uh_sum);
+ fix_datacksum(&udp->uh_sum, sumd);
+ sum2 = ntohs(udp->uh_sum);
+
+ /*
+ * Fix ICMP checksum to compensate
+ * UDP checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ }
+
+ /*
+ * Fix tcp checksum (if present) to compensate
+ * port adjustment. NOTE : the offending IP
+ * packet flows the other direction compared to
+ * the ICMP message.
+ */
+ if (oip->ip_p == IPPROTO_TCP && dlen >= 18) {
+
+ sum1 = ntohs(tcp->th_sum);
+ fix_datacksum(&tcp->th_sum, sumd);
+ sum2 = ntohs(tcp->th_sum);
+
+ /*
+ * Fix ICMP checksum to compensate
+ * UDP checksum adjustment.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ sumd2 += sumd;
+ }
+ }
+ }
+ if (sumd2) {
+ sumd2 = (sumd2 & 0xffff) + (sumd2 >> 16);
+ sumd2 = (sumd2 & 0xffff) + (sumd2 >> 16);
+ if (nat->nat_dir == NAT_OUTBOUND) {
+ fix_outcksum(fin, &icmp->icmp_cksum, sumd2);
+ } else {
+ fix_incksum(fin, &icmp->icmp_cksum, sumd2);
+ }
+ }
+ }
+ if (oip->ip_p == IPPROTO_ICMP)
+ nat->nat_age = fr_defnaticmpage;
+ return nat;
+}
+
+
+/*
+ * NB: these lookups don't lock access to the list, it assume it has already
+ * been done!
+ */
+/*
+ * Lookup a nat entry based on the mapped destination ip address/port and
+ * real source address/port. We use this lookup when receiving a packet,
+ * we're looking for a table entry, based on the destination address.
+ * NOTE: THE PACKET BEING CHECKED (IF FOUND) HAS A MAPPING ALREADY.
+ */
+nat_t *nat_inlookup(fin, flags, p, src, mapdst, rw)
+fr_info_t *fin;
+register u_int flags, p;
+struct in_addr src , mapdst;
+int rw;
+{
+ register u_short sport, dport;
+ register nat_t *nat;
+ register int nflags;
+ register u_32_t dst;
+ ipnat_t *ipn;
+ void *ifp;
+ u_int hv;
+
+ if (fin != NULL)
+ ifp = fin->fin_ifp;
+ else
+ ifp = NULL;
+ dst = mapdst.s_addr;
+ if (flags & IPN_TCPUDP) {
+ sport = htons(fin->fin_data[0]);
+ dport = htons(fin->fin_data[1]);
+ } else {
+ sport = 0;
+ dport = 0;
+ }
+
+ hv = NAT_HASH_FN(dst, dport, 0xffffffff);
+ hv = NAT_HASH_FN(src.s_addr, hv + sport, ipf_nattable_sz);
+ nat = nat_table[1][hv];
+ for (; nat; nat = nat->nat_hnext[1]) {
+ nflags = nat->nat_flags;
+ if ((!ifp || ifp == nat->nat_ifp) &&
+ nat->nat_oip.s_addr == src.s_addr &&
+ nat->nat_outip.s_addr == dst &&
+ ((p == 0) || (p == nat->nat_p))) {
+ switch (p)
+ {
+ case IPPROTO_TCP :
+ case IPPROTO_UDP :
+ if (nat->nat_oport != sport)
+ continue;
+ if (nat->nat_outport != dport)
+ continue;
+ break;
+ default :
+ break;
+ }
+
+ ipn = nat->nat_ptr;
+ if ((ipn != NULL) && (nat->nat_aps != NULL))
+ if (appr_match(fin, nat) != 0)
+ continue;
+ return nat;
+ }
+ }
+ if (!nat_stats.ns_wilds || !(flags & FI_WILDP))
+ return NULL;
+ if (!rw) {
+ RWLOCK_EXIT(&ipf_nat);
+ }
+ hv = NAT_HASH_FN(dst, 0, 0xffffffff);
+ hv = NAT_HASH_FN(src.s_addr, dst, ipf_nattable_sz);
+ if (!rw) {
+ WRITE_ENTER(&ipf_nat);
+ }
+ nat = nat_table[1][hv];
+ for (; nat; nat = nat->nat_hnext[1]) {
+ nflags = nat->nat_flags;
+ if (ifp && ifp != nat->nat_ifp)
+ continue;
+ if (!(nflags & FI_WILDP))
+ continue;
+ if (nat->nat_oip.s_addr != src.s_addr ||
+ nat->nat_outip.s_addr != dst)
+ continue;
+ if (((nat->nat_oport == sport) || (nflags & FI_W_DPORT)) &&
+ ((nat->nat_outport == dport) || (nflags & FI_W_SPORT))) {
+ nat_tabmove(fin, nat);
+ break;
+ }
+ }
+ if (!rw) {
+ MUTEX_DOWNGRADE(&ipf_nat);
+ }
+ return nat;
+}
+
+
+/*
+ * This function is only called for TCP/UDP NAT table entries where the
+ * original was placed in the table without hashing on the ports and we now
+ * want to include hashing on port numbers.
+ */
+static void nat_tabmove(fin, nat)
+fr_info_t *fin;
+nat_t *nat;
+{
+ register u_short sport, dport;
+ u_int hv, nflags;
+ nat_t **natp;
+
+ nflags = nat->nat_flags;
+
+ sport = ntohs(fin->fin_data[0]);
+ dport = ntohs(fin->fin_data[1]);
+
+ /*
+ * Remove the NAT entry from the old location
+ */
+ if (nat->nat_hnext[0])
+ nat->nat_hnext[0]->nat_phnext[0] = nat->nat_phnext[0];
+ *nat->nat_phnext[0] = nat->nat_hnext[0];
+
+ if (nat->nat_hnext[1])
+ nat->nat_hnext[1]->nat_phnext[1] = nat->nat_phnext[1];
+ *nat->nat_phnext[1] = nat->nat_hnext[1];
+
+ /*
+ * Add into the NAT table in the new position
+ */
+ hv = NAT_HASH_FN(nat->nat_inip.s_addr, sport, 0xffffffff);
+ hv = NAT_HASH_FN(nat->nat_oip.s_addr, hv + dport, ipf_nattable_sz);
+ natp = &nat_table[0][hv];
+ if (*natp)
+ (*natp)->nat_phnext[0] = &nat->nat_hnext[0];
+ nat->nat_phnext[0] = natp;
+ nat->nat_hnext[0] = *natp;
+ *natp = nat;
+
+ hv = NAT_HASH_FN(nat->nat_outip.s_addr, sport, 0xffffffff);
+ hv = NAT_HASH_FN(nat->nat_oip.s_addr, hv + dport, ipf_nattable_sz);
+ natp = &nat_table[1][hv];
+ if (*natp)
+ (*natp)->nat_phnext[1] = &nat->nat_hnext[1];
+ nat->nat_phnext[1] = natp;
+ nat->nat_hnext[1] = *natp;
+ *natp = nat;
+}
+
+
+/*
+ * Lookup a nat entry based on the source 'real' ip address/port and
+ * destination address/port. We use this lookup when sending a packet out,
+ * we're looking for a table entry, based on the source address.
+ * NOTE: THE PACKET BEING CHECKED (IF FOUND) HAS A MAPPING ALREADY.
+ */
+nat_t *nat_outlookup(fin, flags, p, src, dst, rw)
+fr_info_t *fin;
+register u_int flags, p;
+struct in_addr src , dst;
+int rw;
+{
+ register u_short sport, dport;
+ register nat_t *nat;
+ register int nflags;
+ ipnat_t *ipn;
+ u_32_t srcip;
+ void *ifp;
+ u_int hv;
+
+ ifp = fin->fin_ifp;
+ srcip = src.s_addr;
+ if (flags & IPN_TCPUDP) {
+ sport = ntohs(fin->fin_data[0]);
+ dport = ntohs(fin->fin_data[1]);
+ } else {
+ sport = 0;
+ dport = 0;
+ }
+
+ hv = NAT_HASH_FN(srcip, sport, 0xffffffff);
+ hv = NAT_HASH_FN(dst.s_addr, hv + dport, ipf_nattable_sz);
+ nat = nat_table[0][hv];
+ for (; nat; nat = nat->nat_hnext[0]) {
+ nflags = nat->nat_flags;
+
+ if ((!ifp || ifp == nat->nat_ifp) &&
+ nat->nat_inip.s_addr == srcip &&
+ nat->nat_oip.s_addr == dst.s_addr &&
+ ((p == 0) || (p == nat->nat_p))) {
+ switch (p)
+ {
+ case IPPROTO_TCP :
+ case IPPROTO_UDP :
+ if (nat->nat_oport != dport)
+ continue;
+ if (nat->nat_inport != sport)
+ continue;
+ break;
+ default :
+ break;
+ }
+
+ ipn = nat->nat_ptr;
+ if ((ipn != NULL) && (nat->nat_aps != NULL))
+ if (appr_match(fin, nat) != 0)
+ continue;
+ return nat;
+ }
+ }
+ if (!nat_stats.ns_wilds || !(flags & FI_WILDP))
+ return NULL;
+ if (!rw) {
+ RWLOCK_EXIT(&ipf_nat);
+ }
+
+ hv = NAT_HASH_FN(dst.s_addr, srcip, ipf_nattable_sz);
+ if (!rw) {
+ WRITE_ENTER(&ipf_nat);
+ }
+ nat = nat_table[0][hv];
+ for (; nat; nat = nat->nat_hnext[0]) {
+ nflags = nat->nat_flags;
+ if (ifp && ifp != nat->nat_ifp)
+ continue;
+ if (!(nflags & FI_WILDP))
+ continue;
+ if ((nat->nat_inip.s_addr != srcip) ||
+ (nat->nat_oip.s_addr != dst.s_addr))
+ continue;
+ if (((nat->nat_inport == sport) || (nflags & FI_W_SPORT)) &&
+ ((nat->nat_oport == dport) || (nflags & FI_W_DPORT))) {
+ nat_tabmove(fin, nat);
+ break;
+ }
+ }
+ if (!rw) {
+ MUTEX_DOWNGRADE(&ipf_nat);
+ }
+ return nat;
+}
+
+
+/*
+ * Lookup the NAT tables to search for a matching redirect
+ */
+nat_t *nat_lookupredir(np)
+register natlookup_t *np;
+{
+ nat_t *nat;
+ fr_info_t fi;
+
+ bzero((char *)&fi, sizeof(fi));
+ fi.fin_data[0] = ntohs(np->nl_inport);
+ fi.fin_data[1] = ntohs(np->nl_outport);
+
+ /*
+ * If nl_inip is non null, this is a lookup based on the real
+ * ip address. Else, we use the fake.
+ */
+ if ((nat = nat_outlookup(&fi, np->nl_flags, 0, np->nl_inip,
+ np->nl_outip, 0))) {
+ np->nl_realip = nat->nat_outip;
+ np->nl_realport = nat->nat_outport;
+ }
+ return nat;
+}
+
+
+static int nat_match(fin, np, ip)
+fr_info_t *fin;
+ipnat_t *np;
+ip_t *ip;
+{
+ frtuc_t *ft;
+
+ if (ip->ip_v != 4)
+ return 0;
+
+ if (np->in_p && fin->fin_p != np->in_p)
+ return 0;
+ if (fin->fin_out) {
+ if (!(np->in_redir & (NAT_MAP|NAT_MAPBLK)))
+ return 0;
+ if (((fin->fin_fi.fi_saddr & np->in_inmsk) != np->in_inip)
+ ^ ((np->in_flags & IPN_NOTSRC) != 0))
+ return 0;
+ if (((fin->fin_fi.fi_daddr & np->in_srcmsk) != np->in_srcip)
+ ^ ((np->in_flags & IPN_NOTDST) != 0))
+ return 0;
+ } else {
+ if (!(np->in_redir & NAT_REDIRECT))
+ return 0;
+ if (((fin->fin_fi.fi_saddr & np->in_srcmsk) != np->in_srcip)
+ ^ ((np->in_flags & IPN_NOTSRC) != 0))
+ return 0;
+ if (((fin->fin_fi.fi_daddr & np->in_outmsk) != np->in_outip)
+ ^ ((np->in_flags & IPN_NOTDST) != 0))
+ return 0;
+ }
+
+ ft = &np->in_tuc;
+ if (!(fin->fin_fl & FI_TCPUDP) ||
+ (fin->fin_fl & FI_SHORT) || (fin->fin_off != 0)) {
+ if (ft->ftu_scmp || ft->ftu_dcmp)
+ return 0;
+ return 1;
+ }
+
+ return fr_tcpudpchk(ft, fin);
+}
+
+
+/*
+ * Packets going out on the external interface go through this.
+ * Here, the source address requires alteration, if anything.
+ */
+int ip_natout(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ register ipnat_t *np = NULL;
+ register u_32_t ipa;
+ tcphdr_t *tcp = NULL;
+ u_short sport = 0, dport = 0, *csump = NULL;
+ int natadd = 1, i, icmpset = 1;
+ u_int nflags = 0, hv, msk;
+ struct ifnet *ifp;
+ frentry_t *fr;
+ void *sifp;
+ u_32_t iph;
+ nat_t *nat;
+
+ if (nat_list == NULL || (fr_nat_lock))
+ return 0;
+
+ if ((fr = fin->fin_fr) && !(fr->fr_flags & FR_DUP) &&
+ fr->fr_tif.fd_ifp && fr->fr_tif.fd_ifp != (void *)-1) {
+ sifp = fin->fin_ifp;
+ fin->fin_ifp = fr->fr_tif.fd_ifp;
+ } else
+ sifp = fin->fin_ifp;
+ ifp = fin->fin_ifp;
+
+ if ((fin->fin_off == 0) && !(fin->fin_fl & FI_SHORT)) {
+ if (fin->fin_p == IPPROTO_TCP)
+ nflags = IPN_TCP;
+ else if (fin->fin_p == IPPROTO_UDP)
+ nflags = IPN_UDP;
+ if ((nflags & IPN_TCPUDP)) {
+ tcp = (tcphdr_t *)fin->fin_dp;
+ sport = tcp->th_sport;
+ dport = tcp->th_dport;
+ }
+ }
+
+ ipa = fin->fin_saddr;
+
+ READ_ENTER(&ipf_nat);
+
+ if ((fin->fin_p == IPPROTO_ICMP) &&
+ (nat = nat_icmp(ip, fin, &nflags, NAT_OUTBOUND)))
+ icmpset = 1;
+ else if ((fin->fin_fl & FI_FRAG) &&
+ (nat = ipfr_nat_knownfrag(ip, fin)))
+ natadd = 0;
+ else if ((nat = nat_outlookup(fin, nflags|FI_WILDP|FI_WILDA,
+ (u_int)fin->fin_p, fin->fin_src,
+ fin->fin_dst, 0))) {
+ nflags = nat->nat_flags;
+ if ((nflags & (FI_W_SPORT|FI_W_DPORT)) != 0) {
+ if ((nflags & FI_W_SPORT) &&
+ (nat->nat_inport != sport))
+ nat->nat_inport = sport;
+ if ((nflags & FI_W_DPORT) &&
+ (nat->nat_oport != dport))
+ nat->nat_oport = dport;
+
+ if (nat->nat_outport == 0)
+ nat->nat_outport = sport;
+ nat->nat_flags &= ~(FI_W_DPORT|FI_W_SPORT);
+ nflags = nat->nat_flags;
+ nat_stats.ns_wilds--;
+ }
+ } else {
+ RWLOCK_EXIT(&ipf_nat);
+
+ msk = 0xffffffff;
+ i = 32;
+
+ WRITE_ENTER(&ipf_nat);
+ /*
+ * If there is no current entry in the nat table for this IP#,
+ * create one for it (if there is a matching rule).
+ */
+maskloop:
+ iph = ipa & htonl(msk);
+ hv = NAT_HASH_FN(iph, 0, ipf_natrules_sz);
+ for (np = nat_rules[hv]; np; np = np->in_mnext)
+ {
+ if (np->in_ifp && (np->in_ifp != ifp))
+ continue;
+ if ((np->in_flags & IPN_RF) &&
+ !(np->in_flags & nflags))
+ continue;
+ if (np->in_flags & IPN_FILTER) {
+ if (!nat_match(fin, np, ip))
+ continue;
+ } else if ((ipa & np->in_inmsk) != np->in_inip)
+ continue;
+ if (*np->in_plabel && !appr_ok(ip, tcp, np))
+ continue;
+ nat = nat_new(fin, ip, np, NULL,
+ (u_int)nflags, NAT_OUTBOUND);
+ if (nat != NULL) {
+ np->in_hits++;
+ break;
+ }
+ }
+ if ((np == NULL) && (i > 0)) {
+ do {
+ i--;
+ msk <<= 1;
+ } while ((i >= 0) && ((nat_masks & (1 << i)) == 0));
+ if (i >= 0)
+ goto maskloop;
+ }
+ MUTEX_DOWNGRADE(&ipf_nat);
+ }
+
+ /*
+ * NOTE: ipf_nat must now only be held as a read lock
+ */
+ if (nat) {
+ np = nat->nat_ptr;
+ if (natadd && (fin->fin_fl & FI_FRAG) && np)
+ ipfr_nat_newfrag(ip, fin, nat);
+ MUTEX_ENTER(&nat->nat_lock);
+ if (fin->fin_p != IPPROTO_TCP) {
+ if (np && np->in_age[1])
+ nat->nat_age = np->in_age[1];
+ else if (!icmpset && (fin->fin_p == IPPROTO_ICMP))
+ nat->nat_age = fr_defnaticmpage;
+ else
+ nat->nat_age = fr_defnatage;
+ }
+ nat->nat_bytes += ip->ip_len;
+ nat->nat_pkts++;
+ MUTEX_EXIT(&nat->nat_lock);
+
+ /*
+ * Fix up checksums, not by recalculating them, but
+ * simply computing adjustments.
+ */
+ if (nflags == IPN_ICMPERR) {
+ u_32_t s1, s2, sumd;
+
+ s1 = LONG_SUM(ntohl(fin->fin_saddr));
+ s2 = LONG_SUM(ntohl(nat->nat_outip.s_addr));
+ CALC_SUMD(s1, s2, sumd);
+
+ if (nat->nat_dir == NAT_OUTBOUND)
+ fix_outcksum(fin, &ip->ip_sum, sumd);
+ else
+ fix_incksum(fin, &ip->ip_sum, sumd);
+ }
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+ else {
+ if (nat->nat_dir == NAT_OUTBOUND)
+ fix_outcksum(fin, &ip->ip_sum, nat->nat_ipsumd);
+ else
+ fix_incksum(fin, &ip->ip_sum, nat->nat_ipsumd);
+ }
+#endif
+ /*
+ * Only change the packet contents, not what is filtered upon.
+ */
+ ip->ip_src = nat->nat_outip;
+
+ if ((fin->fin_off == 0) && !(fin->fin_fl & FI_SHORT)) {
+
+ if ((nat->nat_outport != 0) && (tcp != NULL)) {
+ tcp->th_sport = nat->nat_outport;
+ fin->fin_data[0] = ntohs(tcp->th_sport);
+ }
+
+ if (fin->fin_p == IPPROTO_TCP) {
+ csump = &tcp->th_sum;
+ MUTEX_ENTER(&nat->nat_lock);
+ fr_tcp_age(&nat->nat_age,
+ nat->nat_tcpstate, fin, 1, 0);
+ if (nat->nat_age < fr_defnaticmpage)
+ nat->nat_age = fr_defnaticmpage;
+#ifdef LARGE_NAT
+ else if (nat->nat_age > fr_defnatage)
+ nat->nat_age = fr_defnatage;
+#endif
+ /*
+ * Increase this because we may have
+ * "keep state" following this too and
+ * packet storms can occur if this is
+ * removed too quickly.
+ */
+ if (nat->nat_age == fr_tcpclosed)
+ nat->nat_age = fr_tcplastack;
+
+ /*
+ * Do a MSS CLAMPING on a SYN packet,
+ * only deal IPv4 for now.
+ */
+ if (nat->nat_mssclamp &&
+ (tcp->th_flags & TH_SYN) != 0)
+ nat_mssclamp(tcp, nat->nat_mssclamp,
+ fin, csump);
+
+ MUTEX_EXIT(&nat->nat_lock);
+ } else if (fin->fin_p == IPPROTO_UDP) {
+ udphdr_t *udp = (udphdr_t *)tcp;
+
+ if (udp->uh_sum)
+ csump = &udp->uh_sum;
+ }
+
+ if (csump) {
+ if (nat->nat_dir == NAT_OUTBOUND)
+ fix_outcksum(fin, csump,
+ nat->nat_sumd[1]);
+ else
+ fix_incksum(fin, csump,
+ nat->nat_sumd[1]);
+ }
+ }
+
+ if (np && (np->in_apr != NULL) && (np->in_dport == 0 ||
+ (tcp != NULL && dport == np->in_dport))) {
+ i = appr_check(ip, fin, nat);
+ if (i == 0)
+ i = 1;
+ else if (i == -1)
+ nat->nat_drop[1]++;
+ } else
+ i = 1;
+ ATOMIC_INCL(nat_stats.ns_mapped[1]);
+ RWLOCK_EXIT(&ipf_nat); /* READ */
+ fin->fin_ifp = sifp;
+ return i;
+ }
+ RWLOCK_EXIT(&ipf_nat); /* READ/WRITE */
+ fin->fin_ifp = sifp;
+ return 0;
+}
+
+
+/*
+ * Packets coming in from the external interface go through this.
+ * Here, the destination address requires alteration, if anything.
+ */
+int ip_natin(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ register struct in_addr src;
+ register struct in_addr in;
+ register ipnat_t *np;
+ u_short sport = 0, dport = 0, *csump = NULL;
+ u_int nflags = 0, natadd = 1, hv, msk;
+ struct ifnet *ifp = fin->fin_ifp;
+ tcphdr_t *tcp = NULL;
+ int i, icmpset = 0;
+ nat_t *nat;
+ u_32_t iph;
+
+ if ((nat_list == NULL) || (ip->ip_v != 4) || (fr_nat_lock))
+ return 0;
+
+ if ((fin->fin_off == 0) && !(fin->fin_fl & FI_SHORT)) {
+ if (fin->fin_p == IPPROTO_TCP)
+ nflags = IPN_TCP;
+ else if (fin->fin_p == IPPROTO_UDP)
+ nflags = IPN_UDP;
+ if ((nflags & IPN_TCPUDP)) {
+ tcp = (tcphdr_t *)fin->fin_dp;
+ sport = tcp->th_sport;
+ dport = tcp->th_dport;
+ }
+ }
+
+ in = fin->fin_dst;
+ /* make sure the source address is to be redirected */
+ src = fin->fin_src;
+
+ READ_ENTER(&ipf_nat);
+
+ if ((fin->fin_p == IPPROTO_ICMP) &&
+ (nat = nat_icmp(ip, fin, &nflags, NAT_INBOUND)))
+ icmpset = 1;
+ else if ((fin->fin_fl & FI_FRAG) &&
+ (nat = ipfr_nat_knownfrag(ip, fin)))
+ natadd = 0;
+ else if ((nat = nat_inlookup(fin, nflags|FI_WILDP|FI_WILDA,
+ (u_int)fin->fin_p, fin->fin_src, in, 0))) {
+ nflags = nat->nat_flags;
+ if ((nflags & (FI_W_SPORT|FI_W_DPORT)) != 0) {
+ if ((nat->nat_oport != sport) && (nflags & FI_W_DPORT))
+ nat->nat_oport = sport;
+ if ((nat->nat_outport != dport) &&
+ (nflags & FI_W_SPORT))
+ nat->nat_outport = dport;
+ nat->nat_flags &= ~(FI_W_SPORT|FI_W_DPORT);
+ nflags = nat->nat_flags;
+ nat_stats.ns_wilds--;
+ }
+ } else {
+ RWLOCK_EXIT(&ipf_nat);
+
+ msk = 0xffffffff;
+ i = 32;
+
+ WRITE_ENTER(&ipf_nat);
+ /*
+ * If there is no current entry in the nat table for this IP#,
+ * create one for it (if there is a matching rule).
+ */
+maskloop:
+ iph = in.s_addr & htonl(msk);
+ hv = NAT_HASH_FN(iph, 0, ipf_rdrrules_sz);
+ for (np = rdr_rules[hv]; np; np = np->in_rnext) {
+ if ((np->in_ifp && (np->in_ifp != ifp)) ||
+ (np->in_p && (np->in_p != fin->fin_p)) ||
+ (np->in_flags && !(nflags & np->in_flags)))
+ continue;
+ if (np->in_flags & IPN_FILTER) {
+ if (!nat_match(fin, np, ip))
+ continue;
+ } else if ((in.s_addr & np->in_outmsk) != np->in_outip)
+ continue;
+ if ((!np->in_pmin || (np->in_flags & IPN_FILTER) ||
+ ((ntohs(np->in_pmax) >= ntohs(dport)) &&
+ (ntohs(dport) >= ntohs(np->in_pmin)))))
+ if ((nat = nat_new(fin, ip, np, NULL, nflags,
+ NAT_INBOUND))) {
+ np->in_hits++;
+ break;
+ }
+ }
+
+ if ((np == NULL) && (i > 0)) {
+ do {
+ i--;
+ msk <<= 1;
+ } while ((i >= 0) && ((rdr_masks & (1 << i)) == 0));
+ if (i >= 0)
+ goto maskloop;
+ }
+ MUTEX_DOWNGRADE(&ipf_nat);
+ }
+
+ /*
+ * NOTE: ipf_nat must now only be held as a read lock
+ */
+ if (nat) {
+ np = nat->nat_ptr;
+ fin->fin_fr = nat->nat_fr;
+ if (natadd && (fin->fin_fl & FI_FRAG) && np)
+ ipfr_nat_newfrag(ip, fin, nat);
+ if (np && (np->in_apr != NULL) && (np->in_dport == 0 ||
+ (tcp != NULL && sport == np->in_dport))) {
+ i = appr_check(ip, fin, nat);
+ if (i == -1) {
+ nat->nat_drop[0]++;
+ RWLOCK_EXIT(&ipf_nat);
+ return i;
+ }
+ }
+
+ MUTEX_ENTER(&nat->nat_lock);
+ if (fin->fin_p != IPPROTO_TCP) {
+ if (np && np->in_age[0])
+ nat->nat_age = np->in_age[0];
+ else if (!icmpset && (fin->fin_p == IPPROTO_ICMP))
+ nat->nat_age = fr_defnaticmpage;
+ else
+ nat->nat_age = fr_defnatage;
+ }
+ nat->nat_bytes += ip->ip_len;
+ nat->nat_pkts++;
+ MUTEX_EXIT(&nat->nat_lock);
+ ip->ip_dst = nat->nat_inip;
+ fin->fin_fi.fi_daddr = nat->nat_inip.s_addr;
+
+ /*
+ * Fix up checksums, not by recalculating them, but
+ * simply computing adjustments.
+ */
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+ if (nat->nat_dir == NAT_OUTBOUND)
+ fix_incksum(fin, &ip->ip_sum, nat->nat_ipsumd);
+ else
+ fix_outcksum(fin, &ip->ip_sum, nat->nat_ipsumd);
+#endif
+ if ((fin->fin_off == 0) && !(fin->fin_fl & FI_SHORT)) {
+
+ if ((nat->nat_inport != 0) && (tcp != NULL)) {
+ tcp->th_dport = nat->nat_inport;
+ fin->fin_data[1] = ntohs(tcp->th_dport);
+ }
+
+ if (fin->fin_p == IPPROTO_TCP) {
+ csump = &tcp->th_sum;
+ MUTEX_ENTER(&nat->nat_lock);
+ fr_tcp_age(&nat->nat_age,
+ nat->nat_tcpstate, fin, 0, 0);
+ if (nat->nat_age < fr_defnaticmpage)
+ nat->nat_age = fr_defnaticmpage;
+#ifdef LARGE_NAT
+ else if (nat->nat_age > fr_defnatage)
+ nat->nat_age = fr_defnatage;
+#endif
+ /*
+ * Increase this because we may have
+ * "keep state" following this too and
+ * packet storms can occur if this is
+ * removed too quickly.
+ */
+ if (nat->nat_age == fr_tcpclosed)
+ nat->nat_age = fr_tcplastack;
+ /*
+ * Do a MSS CLAMPING on a SYN packet,
+ * only deal IPv4 for now.
+ */
+ if (nat->nat_mssclamp &&
+ (tcp->th_flags & TH_SYN) != 0)
+ nat_mssclamp(tcp, nat->nat_mssclamp,
+ fin, csump);
+
+ MUTEX_EXIT(&nat->nat_lock);
+ } else if (fin->fin_p == IPPROTO_UDP) {
+ udphdr_t *udp = (udphdr_t *)tcp;
+
+ if (udp->uh_sum)
+ csump = &udp->uh_sum;
+ }
+
+ if (csump) {
+ if (nat->nat_dir == NAT_OUTBOUND)
+ fix_incksum(fin, csump,
+ nat->nat_sumd[0]);
+ else
+ fix_outcksum(fin, csump,
+ nat->nat_sumd[0]);
+ }
+ }
+ ATOMIC_INCL(nat_stats.ns_mapped[0]);
+ RWLOCK_EXIT(&ipf_nat); /* READ */
+ return 1;
+ }
+ RWLOCK_EXIT(&ipf_nat); /* READ/WRITE */
+ return 0;
+}
+
+
+/*
+ * Free all memory used by NAT structures allocated at runtime.
+ */
+void ip_natunload()
+{
+ WRITE_ENTER(&ipf_nat);
+ (void) nat_clearlist();
+ (void) nat_flushtable();
+ RWLOCK_EXIT(&ipf_nat);
+
+ if (nat_table[0] != NULL) {
+ KFREES(nat_table[0], sizeof(nat_t *) * ipf_nattable_sz);
+ nat_table[0] = NULL;
+ }
+ if (nat_table[1] != NULL) {
+ KFREES(nat_table[1], sizeof(nat_t *) * ipf_nattable_sz);
+ nat_table[1] = NULL;
+ }
+ if (nat_rules != NULL) {
+ KFREES(nat_rules, sizeof(ipnat_t *) * ipf_natrules_sz);
+ nat_rules = NULL;
+ }
+ if (rdr_rules != NULL) {
+ KFREES(rdr_rules, sizeof(ipnat_t *) * ipf_rdrrules_sz);
+ rdr_rules = NULL;
+ }
+ if (maptable != NULL) {
+ KFREES(maptable, sizeof(hostmap_t *) * ipf_hostmap_sz);
+ maptable = NULL;
+ }
+}
+
+
+/*
+ * Slowly expire held state for NAT entries. Timeouts are set in
+ * expectation of this being called twice per second.
+ */
+void ip_natexpire()
+{
+ register struct nat *nat, **natp;
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+
+ SPL_NET(s);
+ WRITE_ENTER(&ipf_nat);
+ for (natp = &nat_instances; (nat = *natp); ) {
+ nat->nat_age--;
+ if (nat->nat_age) {
+ natp = &nat->nat_next;
+ continue;
+ }
+ *natp = nat->nat_next;
+#ifdef IPFILTER_LOG
+ nat_log(nat, NL_EXPIRE);
+#endif
+ nat_delete(nat);
+ nat_stats.ns_expire++;
+ }
+ RWLOCK_EXIT(&ipf_nat);
+ SPL_X(s);
+}
+
+
+/*
+ */
+void ip_natsync(ifp)
+void *ifp;
+{
+ register ipnat_t *n;
+ register nat_t *nat;
+ register u_32_t sum1, sum2, sumd;
+ struct in_addr in;
+ ipnat_t *np;
+ void *ifp2;
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+
+ /*
+ * Change IP addresses for NAT sessions for any protocol except TCP
+ * since it will break the TCP connection anyway.
+ */
+ SPL_NET(s);
+ WRITE_ENTER(&ipf_nat);
+ for (nat = nat_instances; nat; nat = nat->nat_next)
+ if (((ifp == NULL) || (ifp == nat->nat_ifp)) &&
+ !(nat->nat_flags & IPN_TCP) && (np = nat->nat_ptr) &&
+ (np->in_outmsk == 0xffffffff) && !np->in_nip) {
+ ifp2 = nat->nat_ifp;
+ /*
+ * Change the map-to address to be the same as the
+ * new one.
+ */
+ sum1 = nat->nat_outip.s_addr;
+ if (fr_ifpaddr(4, ifp2, &in) != -1)
+ nat->nat_outip = in;
+ sum2 = nat->nat_outip.s_addr;
+
+ if (sum1 == sum2)
+ continue;
+ /*
+ * Readjust the checksum adjustment to take into
+ * account the new IP#.
+ */
+ CALC_SUMD(sum1, sum2, sumd);
+ /* XXX - dont change for TCP when solaris does
+ * hardware checksumming.
+ */
+ sumd += nat->nat_sumd[0];
+ nat->nat_sumd[0] = (sumd & 0xffff) + (sumd >> 16);
+ nat->nat_sumd[1] = nat->nat_sumd[0];
+ }
+
+ for (n = nat_list; (n != NULL); n = n->in_next)
+ if (n->in_ifp == ifp) {
+ n->in_ifp = (void *)GETUNIT(n->in_ifname, 4);
+ if (!n->in_ifp)
+ n->in_ifp = (void *)-1;
+ }
+ RWLOCK_EXIT(&ipf_nat);
+ SPL_X(s);
+}
+
+
+#ifdef IPFILTER_LOG
+void nat_log(nat, type)
+struct nat *nat;
+u_int type;
+{
+ struct ipnat *np;
+ struct natlog natl;
+ void *items[1];
+ size_t sizes[1];
+ int rulen, types[1];
+
+ natl.nl_inip = nat->nat_inip;
+ natl.nl_outip = nat->nat_outip;
+ natl.nl_origip = nat->nat_oip;
+ natl.nl_bytes = nat->nat_bytes;
+ natl.nl_pkts = nat->nat_pkts;
+ natl.nl_origport = nat->nat_oport;
+ natl.nl_inport = nat->nat_inport;
+ natl.nl_outport = nat->nat_outport;
+ natl.nl_p = nat->nat_p;
+ natl.nl_type = type;
+ natl.nl_rule = -1;
+#ifndef LARGE_NAT
+ if (nat->nat_ptr != NULL) {
+ for (rulen = 0, np = nat_list; np; np = np->in_next, rulen++)
+ if (np == nat->nat_ptr) {
+ natl.nl_rule = rulen;
+ break;
+ }
+ }
+#endif
+ items[0] = &natl;
+ sizes[0] = sizeof(natl);
+ types[0] = 0;
+
+ (void) ipllog(IPL_LOGNAT, NULL, items, sizes, types, 1);
+}
+#endif
+
+
+#if defined(__OpenBSD__)
+void nat_ifdetach(ifp)
+void *ifp;
+{
+ frsync();
+ return;
+}
+#endif
+
+
+/*
+ * Check for MSS option and clamp it if necessary.
+ */
+static void nat_mssclamp(tcp, maxmss, fin, csump)
+tcphdr_t *tcp;
+u_32_t maxmss;
+fr_info_t *fin;
+u_short *csump;
+{
+ u_char *cp, *ep, opt;
+ int hlen, advance;
+ u_32_t mss, sumd;
+ u_short v;
+
+ hlen = tcp->th_off << 2;
+ if (hlen > sizeof(*tcp)) {
+ cp = (u_char *)tcp + sizeof(*tcp);
+ ep = (u_char *)tcp + hlen;
+
+ while (cp < ep) {
+ opt = cp[0];
+ if (opt == TCPOPT_EOL)
+ break;
+ else if (opt == TCPOPT_NOP) {
+ cp++;
+ continue;
+ }
+
+ if (&cp[1] >= ep)
+ break;
+ advance = cp[1];
+ if (&cp[advance] >= ep)
+ break;
+ switch (opt) {
+ case TCPOPT_MAXSEG:
+ if (advance != 4)
+ break;
+ bcopy(&cp[2], &v, sizeof(v));
+ mss = ntohs(v);
+ if (mss > maxmss) {
+ v = htons(maxmss);
+ bcopy(&v, &cp[2], sizeof(v));
+ CALC_SUMD(mss, maxmss, sumd);
+ fix_outcksum(fin, csump, sumd);
+ }
+ break;
+ default:
+ /* ignore unknown options */
+ break;
+ }
+
+ cp += advance;
+ }
+ }
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_nat.h b/sys/contrib/ipfilter/netinet/ip_nat.h
new file mode 100644
index 0000000..6b3fe66
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_nat.h
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 1995-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ip_nat.h 1.5 2/4/96
+ * $Id: ip_nat.h,v 2.17.2.14 2000/11/18 03:58:04 darrenr Exp $
+ * $FreeBSD$
+ */
+
+#ifndef __IP_NAT_H__
+#define __IP_NAT_H__
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(__STDC__) || defined(__GNUC__)
+#define SIOCADNAT _IOW('r', 60, struct ipnat *)
+#define SIOCRMNAT _IOW('r', 61, struct ipnat *)
+#define SIOCGNATS _IOWR('r', 62, struct natstat *)
+#define SIOCGNATL _IOWR('r', 63, struct natlookup *)
+#else
+#define SIOCADNAT _IOW(r, 60, struct ipnat *)
+#define SIOCRMNAT _IOW(r, 61, struct ipnat *)
+#define SIOCGNATS _IOWR(r, 62, struct natstat *)
+#define SIOCGNATL _IOWR(r, 63, struct natlookup *)
+#endif
+
+#undef LARGE_NAT /* define this if you're setting up a system to NAT
+ * LARGE numbers of networks/hosts - i.e. in the
+ * hundreds or thousands. In such a case, you should
+ * also change the RDR_SIZE and NAT_SIZE below to more
+ * appropriate sizes. The figures below were used for
+ * a setup with 1000-2000 networks to NAT.
+ */
+#ifndef NAT_SIZE
+# define NAT_SIZE 127
+#endif
+#ifndef RDR_SIZE
+# define RDR_SIZE 127
+#endif
+#ifndef HOSTMAP_SIZE
+# define HOSTMAP_SIZE 127
+#endif
+#ifndef NAT_TABLE_SZ
+# define NAT_TABLE_SZ 127
+#endif
+#ifdef LARGE_NAT
+#undef NAT_SIZE
+#undef RDR_SIZE
+#undef NAT_TABLE_SZ
+#undef HOSTMAP_SIZE 127
+#define NAT_SIZE 2047
+#define RDR_SIZE 2047
+#define NAT_TABLE_SZ 16383
+#define HOSTMAP_SIZE 8191
+#endif
+#ifndef APR_LABELLEN
+#define APR_LABELLEN 16
+#endif
+#define NAT_HW_CKSUM 0x80000000
+
+#define DEF_NAT_AGE 1200 /* 10 minutes (600 seconds) */
+
+struct ap_session;
+
+typedef struct nat {
+ u_long nat_age;
+ int nat_flags;
+ u_32_t nat_sumd[2];
+ u_32_t nat_ipsumd;
+ void *nat_data;
+ struct ap_session *nat_aps; /* proxy session */
+ struct frentry *nat_fr; /* filter rule ptr if appropriate */
+ struct in_addr nat_inip;
+ struct in_addr nat_outip;
+ struct in_addr nat_oip; /* other ip */
+ U_QUAD_T nat_pkts;
+ U_QUAD_T nat_bytes;
+ u_int nat_drop[2];
+ u_short nat_oport; /* other port */
+ u_short nat_inport;
+ u_short nat_outport;
+ u_short nat_use;
+ u_char nat_tcpstate[2];
+ u_char nat_p; /* protocol for NAT */
+ u_32_t nat_mssclamp; /* if != zero clamp MSS to this */
+ struct ipnat *nat_ptr; /* pointer back to the rule */
+ struct hostmap *nat_hm;
+ struct nat *nat_next;
+ struct nat *nat_hnext[2];
+ struct nat **nat_phnext[2];
+ struct nat **nat_me;
+ void *nat_ifp;
+ int nat_dir;
+ char nat_ifname[IFNAMSIZ];
+#if SOLARIS || defined(__sgi)
+ kmutex_t nat_lock;
+#endif
+} nat_t;
+
+typedef struct ipnat {
+ struct ipnat *in_next;
+ struct ipnat *in_rnext;
+ struct ipnat **in_prnext;
+ struct ipnat *in_mnext;
+ struct ipnat **in_pmnext;
+ void *in_ifp;
+ void *in_apr;
+ u_long in_space;
+ u_int in_use;
+ u_int in_hits;
+ struct in_addr in_nextip;
+ u_short in_pnext;
+ u_short in_ippip; /* IP #'s per IP# */
+ u_32_t in_flags; /* From here to in_dport must be reflected */
+ u_32_t in_mssclamp; /* if != zero clamp MSS to this */
+ u_short in_spare;
+ u_short in_ppip; /* ports per IP */
+ u_short in_port[2]; /* correctly in IPN_CMPSIZ */
+ struct in_addr in_in[2];
+ struct in_addr in_out[2];
+ struct in_addr in_src[2];
+ struct frtuc in_tuc;
+ u_int in_age[2]; /* Aging for NAT entries. Not for TCP */
+ int in_redir; /* 0 if it's a mapping, 1 if it's a hard redir */
+ char in_ifname[IFNAMSIZ];
+ char in_plabel[APR_LABELLEN]; /* proxy label */
+ char in_p; /* protocol */
+} ipnat_t;
+
+#define in_pmin in_port[0] /* Also holds static redir port */
+#define in_pmax in_port[1]
+#define in_nip in_nextip.s_addr
+#define in_inip in_in[0].s_addr
+#define in_inmsk in_in[1].s_addr
+#define in_outip in_out[0].s_addr
+#define in_outmsk in_out[1].s_addr
+#define in_srcip in_src[0].s_addr
+#define in_srcmsk in_src[1].s_addr
+#define in_scmp in_tuc.ftu_scmp
+#define in_dcmp in_tuc.ftu_dcmp
+#define in_stop in_tuc.ftu_stop
+#define in_dtop in_tuc.ftu_dtop
+#define in_sport in_tuc.ftu_sport
+#define in_dport in_tuc.ftu_dport
+
+#define NAT_OUTBOUND 0
+#define NAT_INBOUND 1
+
+#define NAT_MAP 0x01
+#define NAT_REDIRECT 0x02
+#define NAT_BIMAP (NAT_MAP|NAT_REDIRECT)
+#define NAT_MAPBLK 0x04
+/* 0x100 reserved for FI_W_SPORT */
+/* 0x200 reserved for FI_W_DPORT */
+/* 0x400 reserved for FI_W_SADDR */
+/* 0x800 reserved for FI_W_DADDR */
+/* 0x1000 reserved for FI_W_NEWFR */
+
+#define MAPBLK_MINPORT 1024 /* don't use reserved ports for src port */
+#define USABLE_PORTS (65536 - MAPBLK_MINPORT)
+
+#define IPN_CMPSIZ (sizeof(ipnat_t) - offsetof(ipnat_t, in_flags))
+
+typedef struct natlookup {
+ struct in_addr nl_inip;
+ struct in_addr nl_outip;
+ struct in_addr nl_realip;
+ int nl_flags;
+ u_short nl_inport;
+ u_short nl_outport;
+ u_short nl_realport;
+} natlookup_t;
+
+
+typedef struct nat_save {
+ void *ipn_next;
+ struct nat ipn_nat;
+ struct ipnat ipn_ipnat;
+ struct frentry ipn_fr;
+ int ipn_dsize;
+ char ipn_data[4];
+} nat_save_t;
+
+#define ipn_rule ipn_nat.nat_fr
+
+typedef struct natget {
+ void *ng_ptr;
+ int ng_sz;
+} natget_t;
+
+
+typedef struct hostmap {
+ struct hostmap *hm_next;
+ struct hostmap **hm_pnext;
+ struct ipnat *hm_ipnat;
+ struct in_addr hm_realip;
+ struct in_addr hm_mapip;
+ int hm_ref;
+} hostmap_t;
+
+
+typedef struct natstat {
+ u_long ns_mapped[2];
+ u_long ns_rules;
+ u_long ns_added;
+ u_long ns_expire;
+ u_long ns_inuse;
+ u_long ns_logged;
+ u_long ns_logfail;
+ u_long ns_memfail;
+ u_long ns_badnat;
+ nat_t **ns_table[2];
+ hostmap_t **ns_maptable;
+ ipnat_t *ns_list;
+ void *ns_apslist;
+ u_int ns_nattab_sz;
+ u_int ns_rultab_sz;
+ u_int ns_rdrtab_sz;
+ u_int ns_hostmap_sz;
+ nat_t *ns_instances;
+ u_int ns_wilds;
+} natstat_t;
+
+#define IPN_ANY 0x000
+#define IPN_TCP 0x001
+#define IPN_UDP 0x002
+#define IPN_TCPUDP (IPN_TCP|IPN_UDP)
+#define IPN_DELETE 0x004
+#define IPN_ICMPERR 0x008
+#define IPN_RF (IPN_TCPUDP|IPN_DELETE|IPN_ICMPERR)
+#define IPN_AUTOPORTMAP 0x010
+#define IPN_IPRANGE 0x020
+#define IPN_USERFLAGS (IPN_TCPUDP|IPN_AUTOPORTMAP|IPN_IPRANGE|IPN_SPLIT|\
+ IPN_ROUNDR|IPN_FILTER|IPN_NOTSRC|IPN_NOTDST|IPN_FRAG)
+#define IPN_FILTER 0x040
+#define IPN_SPLIT 0x080
+#define IPN_ROUNDR 0x100
+#define IPN_NOTSRC 0x080000
+#define IPN_NOTDST 0x100000
+#define IPN_FRAG 0x200000
+
+
+typedef struct natlog {
+ struct in_addr nl_origip;
+ struct in_addr nl_outip;
+ struct in_addr nl_inip;
+ u_short nl_origport;
+ u_short nl_outport;
+ u_short nl_inport;
+ u_short nl_type;
+ int nl_rule;
+ U_QUAD_T nl_pkts;
+ U_QUAD_T nl_bytes;
+ u_char nl_p;
+} natlog_t;
+
+
+#define NL_NEWMAP NAT_MAP
+#define NL_NEWRDR NAT_REDIRECT
+#define NL_NEWBIMAP NAT_BIMAP
+#define NL_NEWBLOCK NAT_MAPBLK
+#define NL_FLUSH 0xfffe
+#define NL_EXPIRE 0xffff
+
+#define NAT_HASH_FN(k,l,m) (((k) + ((k) >> 12) + l) % (m))
+
+#define LONG_SUM(in) (((in) & 0xffff) + ((in) >> 16))
+
+#define CALC_SUMD(s1, s2, sd) { \
+ (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
+ (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
+ /* Do it twice */ \
+ (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
+ (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
+ /* Because ~1 == -2, We really need ~1 == -1 */ \
+ if ((s1) > (s2)) (s2)--; \
+ (sd) = (s2) - (s1); \
+ (sd) = ((sd) & 0xffff) + ((sd) >> 16); }
+
+#define NAT_SYSSPACE 0x80000000
+#define NAT_LOCKHELD 0x40000000
+
+extern u_int ipf_nattable_sz;
+extern u_int ipf_natrules_sz;
+extern u_int ipf_rdrrules_sz;
+extern int fr_nat_lock;
+extern void ip_natsync __P((void *));
+extern u_long fr_defnatage;
+extern u_long fr_defnaticmpage;
+extern nat_t **nat_table[2];
+extern nat_t *nat_instances;
+extern ipnat_t **nat_rules;
+extern ipnat_t **rdr_rules;
+extern ipnat_t *nat_list;
+extern natstat_t nat_stats;
+#if defined(__OpenBSD__)
+extern void nat_ifdetach __P((void *));
+#endif
+#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003)
+extern int nat_ioctl __P((caddr_t, u_long, int));
+#else
+extern int nat_ioctl __P((caddr_t, int, int));
+#endif
+extern int nat_init __P((void));
+extern nat_t *nat_new __P((fr_info_t *, ip_t *, ipnat_t *, nat_t **,
+ u_int, int));
+extern nat_t *nat_outlookup __P((fr_info_t *, u_int, u_int, struct in_addr,
+ struct in_addr, int));
+extern nat_t *nat_inlookup __P((fr_info_t *, u_int, u_int, struct in_addr,
+ struct in_addr, int));
+extern nat_t *nat_lookupredir __P((natlookup_t *));
+extern nat_t *nat_icmplookup __P((ip_t *, fr_info_t *, int));
+extern nat_t *nat_icmp __P((ip_t *, fr_info_t *, u_int *, int));
+extern int nat_clearlist __P((void));
+extern void nat_insert __P((nat_t *));
+
+extern int ip_natout __P((ip_t *, fr_info_t *));
+extern int ip_natin __P((ip_t *, fr_info_t *));
+extern void ip_natunload __P((void)), ip_natexpire __P((void));
+extern void nat_log __P((struct nat *, u_int));
+extern void fix_incksum __P((fr_info_t *, u_short *, u_32_t));
+extern void fix_outcksum __P((fr_info_t *, u_short *, u_32_t));
+extern void fix_datacksum __P((u_short *, u_32_t));
+
+#endif /* __IP_NAT_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_netbios_pxy.c b/sys/contrib/ipfilter/netinet/ip_netbios_pxy.c
new file mode 100644
index 0000000..ee9b0c4
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_netbios_pxy.c
@@ -0,0 +1,109 @@
+/*
+ * Simple netbios-dgm transparent proxy for in-kernel use.
+ * For use with the NAT code.
+ * $Id: ip_netbios_pxy.c,v 1.1.2.3 2002/01/09 09:28:37 darrenr Exp $
+ */
+
+/*-
+ * Copyright (c) 2002 Paul J. Ledbetter III
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: ip_netbios_pxy.c,v 1.1.2.3 2002/01/09 09:28:37 darrenr Exp $
+ */
+
+#define IPF_NETBIOS_PROXY
+
+int ippr_netbios_init __P((void));
+int ippr_netbios_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+
+static frentry_t netbiosfr;
+
+/*
+ * Initialize local structures.
+ */
+int ippr_netbios_init()
+{
+ bzero((char *)&netbiosfr, sizeof(netbiosfr));
+ netbiosfr.fr_ref = 1;
+ netbiosfr.fr_flags = FR_INQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE;
+ return 0;
+}
+
+int ippr_netbios_out(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ char dgmbuf[6];
+
+ int off, dlen;
+ udphdr_t *udp;
+ mb_t *m;
+
+ m = *(mb_t **)fin->fin_mp;
+ off = fin->fin_hlen + sizeof(udphdr_t);
+#if SOLARIS
+ dlen = msgdsize(m);
+#else
+ dlen = mbufchainlen(m);
+#endif
+ dlen -= off;
+
+ /*
+ * no net bios datagram could possibly be shorter than this
+ */
+ if (dlen < 11)
+ return 0;
+
+ udp = (udphdr_t *)fin->fin_dp;
+
+ /*
+ * move past the
+ * ip header;
+ * udp header;
+ * 4 bytes into the net bios dgm header.
+ * According to rfc1002, this should be the exact location of
+ * the source address/port
+ */
+ off += 4;
+
+ /* Copy NATed source Address/port*/
+ dgmbuf[0] = (char)((ip->ip_src.s_addr ) &0xFF);
+ dgmbuf[1] = (char)((ip->ip_src.s_addr >> 8) &0xFF);
+ dgmbuf[2] = (char)((ip->ip_src.s_addr >> 16)&0xFF);
+ dgmbuf[3] = (char)((ip->ip_src.s_addr >> 24)&0xFF);
+
+ dgmbuf[4] = (char)((udp->uh_sport )&0xFF);
+ dgmbuf[5] = (char)((udp->uh_sport >> 8)&0xFF);
+
+ /* replace data in packet */
+#if SOLARIS
+ copyin_mblk(m, off, sizeof(dgmbuf), dgmbuf);
+#else
+ m_copyback(m, off, sizeof(dgmbuf), dgmbuf);
+#endif
+
+ return 0;
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c
new file mode 100644
index 0000000..da90a9d
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_proxy.c
@@ -0,0 +1,612 @@
+/*
+ * Copyright (C) 1997-2002 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+
+#if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#if !defined(__FreeBSD_version)
+# include <sys/ioctl.h>
+#endif
+#include <sys/fcntl.h>
+#if !defined(_KERNEL) && !defined(KERNEL)
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+#if defined(_KERNEL)
+# if !defined(linux)
+# include <sys/systm.h>
+# else
+# include <linux/string.h>
+# endif
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/byteorder.h>
+# ifdef _KERNEL
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+# include <sys/kmem.h>
+#endif
+#if __FreeBSD__ > 2
+# include <sys/queue.h>
+#endif
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifndef linux
+# include <netinet/ip_var.h>
+#endif
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_proxy.h"
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+#endif
+
+#if !defined(lint)
+/* static const char rcsid[] = "@(#)$Id: ip_proxy.c,v 2.9.2.6 2001/07/15 22:06:15 darrenr Exp $"; */
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+#if defined(_KERNEL) && (SOLARIS || defined(__sgi))
+extern KRWLOCK_T ipf_nat, ipf_state;
+#endif
+
+static int appr_fixseqack __P((fr_info_t *, ip_t *, ap_session_t *, int ));
+
+
+#define PROXY_DEBUG 0
+
+#define AP_SESS_SIZE 53
+
+#include "netinet/ip_ftp_pxy.c"
+#if defined(_KERNEL)
+#include "netinet/ip_rcmd_pxy.c"
+#include "netinet/ip_raudio_pxy.c"
+#include "netinet/ip_netbios_pxy.c"
+#include "netinet/ip_ipsec_pxy.c"
+#endif
+
+ap_session_t *ap_sess_tab[AP_SESS_SIZE];
+ap_session_t *ap_sess_list = NULL;
+aproxy_t *ap_proxylist = NULL;
+aproxy_t ap_proxies[] = {
+#ifdef IPF_FTP_PROXY
+ { NULL, "ftp", (char)IPPROTO_TCP, 0, 0, ippr_ftp_init, NULL,
+ ippr_ftp_new, NULL, ippr_ftp_in, ippr_ftp_out, NULL },
+#endif
+#ifdef IPF_RCMD_PROXY
+ { NULL, "rcmd", (char)IPPROTO_TCP, 0, 0, ippr_rcmd_init, NULL,
+ ippr_rcmd_new, NULL, NULL, ippr_rcmd_out, NULL },
+#endif
+#ifdef IPF_RAUDIO_PROXY
+ { NULL, "raudio", (char)IPPROTO_TCP, 0, 0, ippr_raudio_init, NULL,
+ ippr_raudio_new, NULL, ippr_raudio_in, ippr_raudio_out, NULL },
+#endif
+#ifdef IPF_IPSEC_PROXY
+ { NULL, "ipsec", (char)IPPROTO_UDP, 0, 0, ippr_ipsec_init, NULL,
+ ippr_ipsec_new, ippr_ipsec_del, NULL, ippr_ipsec_out,
+ ippr_ipsec_match },
+#endif
+#ifdef IPF_NETBIOS_PROXY
+ { NULL, "netbios", (char)IPPROTO_UDP, 0, 0, ippr_netbios_init, NULL,
+ NULL, NULL, NULL, ippr_netbios_out, NULL },
+#endif
+#ifdef IPF_H323_PROXY
+ { NULL, "h323", (char)IPPROTO_TCP, 0, 0, ippr_h323_init, NULL,
+ ippr_h323_new, ippr_h323_del, ippr_h323_in, ippr_h323_out, NULL },
+ { NULL, "h245", (char)IPPROTO_TCP, 0, 0, ippr_h245_init, NULL,
+ ippr_h245_new, NULL, NULL, ippr_h245_out, NULL },
+#endif
+ { NULL, "", '\0', 0, 0, NULL, NULL, NULL }
+};
+
+
+/*
+ * Dynamically add a new kernel proxy. Ensure that it is unique in the
+ * collection compiled in and dynamically added.
+ */
+int appr_add(ap)
+aproxy_t *ap;
+{
+ aproxy_t *a;
+
+ for (a = ap_proxies; a->apr_p; a++)
+ if ((a->apr_p == ap->apr_p) &&
+ !strncmp(a->apr_label, ap->apr_label,
+ sizeof(ap->apr_label)))
+ return -1;
+
+ for (a = ap_proxylist; a && a->apr_p; a = a->apr_next)
+ if ((a->apr_p == ap->apr_p) &&
+ !strncmp(a->apr_label, ap->apr_label,
+ sizeof(ap->apr_label)))
+ return -1;
+ ap->apr_next = ap_proxylist;
+ ap_proxylist = ap;
+ return (*ap->apr_init)();
+}
+
+
+/*
+ * Delete a proxy that has been added dynamically from those available.
+ * If it is in use, return 1 (do not destroy NOW), not in use 0 or -1
+ * if it cannot be matched.
+ */
+int appr_del(ap)
+aproxy_t *ap;
+{
+ aproxy_t *a, **app;
+
+ for (app = &ap_proxylist; (a = *app); app = &a->apr_next)
+ if (a == ap) {
+ a->apr_flags |= APR_DELETE;
+ *app = a->apr_next;
+ if (ap->apr_ref != 0)
+ return 1;
+ return 0;
+ }
+ return -1;
+}
+
+
+/*
+ * Return 1 if the packet is a good match against a proxy, else 0.
+ */
+int appr_ok(ip, tcp, nat)
+ip_t *ip;
+tcphdr_t *tcp;
+ipnat_t *nat;
+{
+ aproxy_t *apr = nat->in_apr;
+ u_short dport = nat->in_dport;
+
+ if ((apr == NULL) || (apr->apr_flags & APR_DELETE) ||
+ (ip->ip_p != apr->apr_p))
+ return 0;
+ if (((tcp != NULL) && (tcp->th_dport != dport)) || (!tcp && dport))
+ return 0;
+ return 1;
+}
+
+
+/*
+ * If a proxy has a match function, call that to do extended packet
+ * matching.
+ */
+int appr_match(fin, nat)
+fr_info_t *fin;
+nat_t *nat;
+{
+ aproxy_t *apr;
+ ipnat_t *ipn;
+
+ ipn = nat->nat_ptr;
+ if (ipn == NULL)
+ return -1;
+ apr = ipn->in_apr;
+ if ((apr == NULL) || (apr->apr_flags & APR_DELETE) ||
+ (nat->nat_aps == NULL))
+ return -1;
+ if (apr->apr_match != NULL)
+ if ((*apr->apr_match)(fin, nat->nat_aps, nat) != 0)
+ return -1;
+ return 0;
+}
+
+
+/*
+ * Allocate a new application proxy structure and fill it in with the
+ * relevant details. call the init function once complete, prior to
+ * returning.
+ */
+int appr_new(fin, ip, nat)
+fr_info_t *fin;
+ip_t *ip;
+nat_t *nat;
+{
+ register ap_session_t *aps;
+ aproxy_t *apr;
+
+ if ((nat->nat_ptr == NULL) || (nat->nat_aps != NULL))
+ return -1;
+
+ apr = nat->nat_ptr->in_apr;
+
+ if (!apr || (apr->apr_flags & APR_DELETE) || (ip->ip_p != apr->apr_p))
+ return -1;
+
+ KMALLOC(aps, ap_session_t *);
+ if (!aps)
+ return -1;
+ bzero((char *)aps, sizeof(*aps));
+ aps->aps_p = ip->ip_p;
+ aps->aps_data = NULL;
+ aps->aps_apr = apr;
+ aps->aps_psiz = 0;
+ if (apr->apr_new != NULL)
+ if ((*apr->apr_new)(fin, ip, aps, nat) == -1) {
+ if ((aps->aps_data != NULL) && (aps->aps_psiz != 0)) {
+ KFREES(aps->aps_data, aps->aps_psiz);
+ }
+ KFREE(aps);
+ return -1;
+ }
+ aps->aps_nat = nat;
+ aps->aps_next = ap_sess_list;
+ ap_sess_list = aps;
+ nat->nat_aps = aps;
+
+ return 0;
+}
+
+
+/*
+ * check to see if a packet should be passed through an active proxy routine
+ * if one has been setup for it.
+ */
+int appr_check(ip, fin, nat)
+ip_t *ip;
+fr_info_t *fin;
+nat_t *nat;
+{
+#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6)
+ mb_t *m = fin->fin_qfm;
+ int dosum = 1;
+#endif
+ tcphdr_t *tcp = NULL;
+ ap_session_t *aps;
+ aproxy_t *apr;
+ u_32_t sum;
+ short rv;
+ int err;
+
+ aps = nat->nat_aps;
+ if ((aps != NULL) && (aps->aps_p == ip->ip_p)) {
+ if (ip->ip_p == IPPROTO_TCP) {
+ tcp = (tcphdr_t *)fin->fin_dp;
+ /*
+ * verify that the checksum is correct. If not, then
+ * don't do anything with this packet.
+ */
+#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6)
+ if (dohwcksum && (m->b_ick_flag == ICK_VALID)) {
+ sum = tcp->th_sum;
+ dosum = 0;
+ }
+ if (dosum)
+ sum = fr_tcpsum(fin->fin_qfm, ip, tcp);
+#else
+ sum = fr_tcpsum(*(mb_t **)fin->fin_mp, ip, tcp);
+#endif
+ if (sum != tcp->th_sum) {
+#if PROXY_DEBUG || (!defined(_KERNEL) && !defined(KERNEL))
+ printf("proxy tcp checksum failure\n");
+#endif
+ frstats[fin->fin_out].fr_tcpbad++;
+ return -1;
+ }
+
+ /*
+ * Don't bother the proxy with these...or in fact,
+ * should we free up proxy stuff when seen?
+ */
+ if ((tcp->th_flags & TH_RST) != 0)
+ return 0;
+ }
+
+ apr = aps->aps_apr;
+ err = 0;
+ if (fin->fin_out != 0) {
+ if (apr->apr_outpkt != NULL)
+ err = (*apr->apr_outpkt)(fin, ip, aps, nat);
+ } else {
+ if (apr->apr_inpkt != NULL)
+ err = (*apr->apr_inpkt)(fin, ip, aps, nat);
+ }
+
+ rv = APR_EXIT(err);
+ if (rv == 1) {
+#if PROXY_DEBUG || (!defined(_KERNEL) && !defined(KERNEL))
+ printf("proxy says bad packet received\n");
+#endif
+ return -1;
+ }
+ if (rv == 2) {
+#if PROXY_DEBUG || (!defined(_KERNEL) && !defined(KERNEL))
+ printf("proxy says free app proxy data\n");
+#endif
+ appr_free(apr);
+ nat->nat_aps = NULL;
+ return -1;
+ }
+
+ if (tcp != NULL) {
+ err = appr_fixseqack(fin, ip, aps, APR_INC(err));
+#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6)
+ if (dosum)
+ tcp->th_sum = fr_tcpsum(fin->fin_qfm, ip, tcp);
+#else
+ tcp->th_sum = fr_tcpsum(*(mb_t **)fin->fin_mp, ip, tcp);
+#endif
+ }
+ aps->aps_bytes += ip->ip_len;
+ aps->aps_pkts++;
+ return 1;
+ }
+ return 0;
+}
+
+
+/*
+ * Search for an proxy by the protocol it is being used with and its name.
+ */
+aproxy_t *appr_lookup(pr, name)
+u_int pr;
+char *name;
+{
+ aproxy_t *ap;
+
+ for (ap = ap_proxies; ap->apr_p; ap++)
+ if ((ap->apr_p == pr) &&
+ !strncmp(name, ap->apr_label, sizeof(ap->apr_label))) {
+ ap->apr_ref++;
+ return ap;
+ }
+
+ for (ap = ap_proxylist; ap; ap = ap->apr_next)
+ if ((ap->apr_p == pr) &&
+ !strncmp(name, ap->apr_label, sizeof(ap->apr_label))) {
+ ap->apr_ref++;
+ return ap;
+ }
+ return NULL;
+}
+
+
+void appr_free(ap)
+aproxy_t *ap;
+{
+ ap->apr_ref--;
+}
+
+
+void aps_free(aps)
+ap_session_t *aps;
+{
+ ap_session_t *a, **ap;
+ aproxy_t *apr;
+
+ if (!aps)
+ return;
+
+ for (ap = &ap_sess_list; (a = *ap); ap = &a->aps_next)
+ if (a == aps) {
+ *ap = a->aps_next;
+ break;
+ }
+
+ apr = aps->aps_apr;
+ if ((apr != NULL) && (apr->apr_del != NULL))
+ (*apr->apr_del)(aps);
+
+ if ((aps->aps_data != NULL) && (aps->aps_psiz != 0))
+ KFREES(aps->aps_data, aps->aps_psiz);
+ KFREE(aps);
+}
+
+
+/*
+ * returns 2 if ack or seq number in TCP header is changed, returns 0 otherwise
+ */
+static int appr_fixseqack(fin, ip, aps, inc)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+int inc;
+{
+ int sel, ch = 0, out, nlen;
+ u_32_t seq1, seq2;
+ tcphdr_t *tcp;
+ short inc2;
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+ out = fin->fin_out;
+ /*
+ * ip_len has already been adjusted by 'inc'.
+ */
+ nlen = ip->ip_len;
+ nlen -= (ip->ip_hl << 2) + (tcp->th_off << 2);
+
+ inc2 = inc;
+ inc = (int)inc2;
+
+ if (out != 0) {
+ seq1 = (u_32_t)ntohl(tcp->th_seq);
+ sel = aps->aps_sel[out];
+
+ /* switch to other set ? */
+ if ((aps->aps_seqmin[!sel] > aps->aps_seqmin[sel]) &&
+ (seq1 > aps->aps_seqmin[!sel])) {
+#if PROXY_DEBUG
+ printf("proxy out switch set seq %d -> %d %x > %x\n",
+ sel, !sel, seq1, aps->aps_seqmin[!sel]);
+#endif
+ sel = aps->aps_sel[out] = !sel;
+ }
+
+ if (aps->aps_seqoff[sel]) {
+ seq2 = aps->aps_seqmin[sel] - aps->aps_seqoff[sel];
+ if (seq1 > seq2) {
+ seq2 = aps->aps_seqoff[sel];
+ seq1 += seq2;
+ tcp->th_seq = htonl(seq1);
+ ch = 1;
+ }
+ }
+
+ if (inc && (seq1 > aps->aps_seqmin[!sel])) {
+ aps->aps_seqmin[sel] = seq1 + nlen - 1;
+ aps->aps_seqoff[sel] = aps->aps_seqoff[sel] + inc;
+#if PROXY_DEBUG
+ printf("proxy seq set %d at %x to %d + %d\n", sel,
+ aps->aps_seqmin[sel], aps->aps_seqoff[sel],
+ inc);
+#endif
+ }
+
+ /***/
+
+ seq1 = ntohl(tcp->th_ack);
+ sel = aps->aps_sel[1 - out];
+
+ /* switch to other set ? */
+ if ((aps->aps_ackmin[!sel] > aps->aps_ackmin[sel]) &&
+ (seq1 > aps->aps_ackmin[!sel])) {
+#if PROXY_DEBUG
+ printf("proxy out switch set ack %d -> %d %x > %x\n",
+ sel, !sel, seq1, aps->aps_ackmin[!sel]);
+#endif
+ sel = aps->aps_sel[1 - out] = !sel;
+ }
+
+ if (aps->aps_ackoff[sel] && (seq1 > aps->aps_ackmin[sel])) {
+ seq2 = aps->aps_ackoff[sel];
+ tcp->th_ack = htonl(seq1 - seq2);
+ ch = 1;
+ }
+ } else {
+ seq1 = ntohl(tcp->th_seq);
+ sel = aps->aps_sel[out];
+
+ /* switch to other set ? */
+ if ((aps->aps_ackmin[!sel] > aps->aps_ackmin[sel]) &&
+ (seq1 > aps->aps_ackmin[!sel])) {
+#if PROXY_DEBUG
+ printf("proxy in switch set ack %d -> %d %x > %x\n",
+ sel, !sel, seq1, aps->aps_ackmin[!sel]);
+#endif
+ sel = aps->aps_sel[out] = !sel;
+ }
+
+ if (aps->aps_ackoff[sel]) {
+ seq2 = aps->aps_ackmin[sel] - aps->aps_ackoff[sel];
+ if (seq1 > seq2) {
+ seq2 = aps->aps_ackoff[sel];
+ seq1 += seq2;
+ tcp->th_seq = htonl(seq1);
+ ch = 1;
+ }
+ }
+
+ if (inc && (seq1 > aps->aps_ackmin[!sel])) {
+ aps->aps_ackmin[!sel] = seq1 + nlen - 1;
+ aps->aps_ackoff[!sel] = aps->aps_ackoff[sel] + inc;
+#if PROXY_DEBUG
+ printf("proxy ack set %d at %x to %d + %d\n", !sel,
+ aps->aps_seqmin[!sel], aps->aps_seqoff[sel],
+ inc);
+#endif
+ }
+
+ /***/
+
+ seq1 = ntohl(tcp->th_ack);
+ sel = aps->aps_sel[1 - out];
+
+ /* switch to other set ? */
+ if ((aps->aps_seqmin[!sel] > aps->aps_seqmin[sel]) &&
+ (seq1 > aps->aps_seqmin[!sel])) {
+#if PROXY_DEBUG
+ printf("proxy in switch set seq %d -> %d %x > %x\n",
+ sel, !sel, seq1, aps->aps_seqmin[!sel]);
+#endif
+ sel = aps->aps_sel[1 - out] = !sel;
+ }
+
+ if (aps->aps_seqoff[sel] != 0) {
+#if PROXY_DEBUG
+ printf("sel %d seqoff %d seq1 %x seqmin %x\n", sel,
+ aps->aps_seqoff[sel], seq1,
+ aps->aps_seqmin[sel]);
+#endif
+ if (seq1 > aps->aps_seqmin[sel]) {
+ seq2 = aps->aps_seqoff[sel];
+ tcp->th_ack = htonl(seq1 - seq2);
+ ch = 1;
+ }
+ }
+ }
+#if PROXY_DEBUG
+ printf("appr_fixseqack: seq %x ack %x\n", ntohl(tcp->th_seq),
+ ntohl(tcp->th_ack));
+#endif
+ return ch ? 2 : 0;
+}
+
+
+/*
+ * Initialise hook for kernel application proxies.
+ * Call the initialise routine for all the compiled in kernel proxies.
+ */
+int appr_init()
+{
+ aproxy_t *ap;
+ int err = 0;
+
+ for (ap = ap_proxies; ap->apr_p; ap++) {
+ err = (*ap->apr_init)();
+ if (err != 0)
+ break;
+ }
+ return err;
+}
+
+
+/*
+ * Unload hook for kernel application proxies.
+ * Call the finialise routine for all the compiled in kernel proxies.
+ */
+void appr_unload()
+{
+ aproxy_t *ap;
+
+ for (ap = ap_proxies; ap->apr_p; ap++)
+ if (ap->apr_fini)
+ (*ap->apr_fini)();
+ for (ap = ap_proxylist; ap; ap = ap->apr_next)
+ if (ap->apr_fini)
+ (*ap->apr_fini)();
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.h b/sys/contrib/ipfilter/netinet/ip_proxy.h
new file mode 100644
index 0000000..8488188
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_proxy.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 1997-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id: ip_proxy.h,v 2.8.2.4 2000/12/02 00:15:03 darrenr Exp $
+ * $FreeBSD$
+ */
+
+#ifndef __IP_PROXY_H__
+#define __IP_PROXY_H__
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#ifndef APR_LABELLEN
+#define APR_LABELLEN 16
+#endif
+#define AP_SESS_SIZE 53
+
+struct nat;
+struct ipnat;
+
+typedef struct ap_tcp {
+ u_short apt_sport; /* source port */
+ u_short apt_dport; /* destination port */
+ short apt_sel[2]; /* {seq,ack}{off,min} set selector */
+ short apt_seqoff[2]; /* sequence # difference */
+ tcp_seq apt_seqmin[2]; /* don't change seq-off until after this */
+ short apt_ackoff[2]; /* sequence # difference */
+ tcp_seq apt_ackmin[2]; /* don't change seq-off until after this */
+ u_char apt_state[2]; /* connection state */
+} ap_tcp_t;
+
+typedef struct ap_udp {
+ u_short apu_sport; /* source port */
+ u_short apu_dport; /* destination port */
+} ap_udp_t;
+
+typedef struct ap_session {
+ struct aproxy *aps_apr;
+ union {
+ struct ap_tcp apu_tcp;
+ struct ap_udp apu_udp;
+ } aps_un;
+ u_int aps_flags;
+ U_QUAD_T aps_bytes; /* bytes sent */
+ U_QUAD_T aps_pkts; /* packets sent */
+ void *aps_nat; /* pointer back to nat struct */
+ void *aps_data; /* private data */
+ int aps_p; /* protocol */
+ int aps_psiz; /* size of private data */
+ struct ap_session *aps_hnext;
+ struct ap_session *aps_next;
+} ap_session_t;
+
+#define aps_sport aps_un.apu_tcp.apt_sport
+#define aps_dport aps_un.apu_tcp.apt_dport
+#define aps_sel aps_un.apu_tcp.apt_sel
+#define aps_seqoff aps_un.apu_tcp.apt_seqoff
+#define aps_seqmin aps_un.apu_tcp.apt_seqmin
+#define aps_state aps_un.apu_tcp.apt_state
+#define aps_ackoff aps_un.apu_tcp.apt_ackoff
+#define aps_ackmin aps_un.apu_tcp.apt_ackmin
+
+
+typedef struct aproxy {
+ struct aproxy *apr_next;
+ char apr_label[APR_LABELLEN]; /* Proxy label # */
+ u_char apr_p; /* protocol */
+ int apr_ref; /* +1 per rule referencing it */
+ int apr_flags;
+ int (* apr_init) __P((void));
+ void (* apr_fini) __P((void));
+ int (* apr_new) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+ void (* apr_del) __P((ap_session_t *));
+ int (* apr_inpkt) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+ int (* apr_outpkt) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+ int (* apr_match) __P((fr_info_t *, ap_session_t *, struct nat *));
+} aproxy_t;
+
+#define APR_DELETE 1
+
+#define APR_ERR(x) (((x) & 0xffff) << 16)
+#define APR_EXIT(x) (((x) >> 16) & 0xffff)
+#define APR_INC(x) ((x) & 0xffff)
+
+#define FTP_BUFSZ 160
+/*
+ * For the ftp proxy.
+ */
+typedef struct ftpside {
+ char *ftps_rptr;
+ char *ftps_wptr;
+ u_32_t ftps_seq[2];
+ u_32_t ftps_len;
+ int ftps_junk;
+ int ftps_cmds;
+ int ftps_cmd;
+ char ftps_buf[FTP_BUFSZ];
+} ftpside_t;
+
+typedef struct ftpinfo {
+ int ftp_passok;
+ int ftp_incok;
+ ftpside_t ftp_side[2];
+} ftpinfo_t;
+
+/*
+ * Real audio proxy structure and #defines
+ */
+typedef struct raudio_s {
+ int rap_seenpna;
+ int rap_seenver;
+ int rap_version;
+ int rap_eos; /* End Of Startup */
+ int rap_gotid;
+ int rap_gotlen;
+ int rap_mode;
+ int rap_sdone;
+ u_short rap_plport;
+ u_short rap_prport;
+ u_short rap_srport;
+ char rap_svr[19];
+ u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have
+ * been filled
+ */
+ tcp_seq rap_sseq;
+} raudio_t;
+
+#define RA_ID_END 0
+#define RA_ID_UDP 1
+#define RA_ID_ROBUST 7
+
+#define RAP_M_UDP 1
+#define RAP_M_ROBUST 2
+#define RAP_M_TCP 4
+#define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST)
+
+/*
+ * IPSec proxy
+ */
+typedef u_32_t ipsec_cookie_t[2];
+
+typedef struct ipsec_pxy {
+ ipsec_cookie_t ipsc_icookie;
+ ipsec_cookie_t ipsc_rcookie;
+ int ipsc_rckset;
+ ipnat_t ipsc_rule;
+ nat_t *ipsc_nat;
+ ipstate_t *ipsc_state;
+} ipsec_pxy_t;
+
+extern ap_session_t *ap_sess_tab[AP_SESS_SIZE];
+extern ap_session_t *ap_sess_list;
+extern aproxy_t ap_proxies[];
+extern int ippr_ftp_pasvonly;
+
+extern int appr_add __P((aproxy_t *));
+extern int appr_del __P((aproxy_t *));
+extern int appr_init __P((void));
+extern void appr_unload __P((void));
+extern int appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *));
+extern int appr_match __P((fr_info_t *, struct nat *));
+extern void appr_free __P((aproxy_t *));
+extern void aps_free __P((ap_session_t *));
+extern int appr_check __P((ip_t *, fr_info_t *, struct nat *));
+extern aproxy_t *appr_lookup __P((u_int, char *));
+extern int appr_new __P((fr_info_t *, ip_t *, struct nat *));
+
+#endif /* __IP_PROXY_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c b/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c
new file mode 100644
index 0000000..5d5d9d4
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c
@@ -0,0 +1,317 @@
+/*
+ * $FreeBSD$
+ */
+#if SOLARIS && defined(_KERNEL)
+extern kmutex_t ipf_rw;
+#endif
+
+#define IPF_RAUDIO_PROXY
+
+
+int ippr_raudio_init __P((void));
+int ippr_raudio_new __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_raudio_in __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_raudio_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+
+static frentry_t raudiofr;
+
+
+/*
+ * Real Audio application proxy initialization.
+ */
+int ippr_raudio_init()
+{
+ bzero((char *)&raudiofr, sizeof(raudiofr));
+ raudiofr.fr_ref = 1;
+ raudiofr.fr_flags = FR_INQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE;
+ return 0;
+}
+
+
+/*
+ * Setup for a new proxy to handle Real Audio.
+ */
+int ippr_raudio_new(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ raudio_t *rap;
+
+
+ KMALLOCS(aps->aps_data, void *, sizeof(raudio_t));
+ if (aps->aps_data == NULL)
+ return -1;
+
+ bzero(aps->aps_data, sizeof(raudio_t));
+ rap = aps->aps_data;
+ aps->aps_psiz = sizeof(raudio_t);
+ rap->rap_mode = RAP_M_TCP; /* default is for TCP */
+ return 0;
+}
+
+
+
+int ippr_raudio_out(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ raudio_t *rap = aps->aps_data;
+ unsigned char membuf[512 + 1], *s;
+ u_short id = 0;
+ int off, dlen;
+ tcphdr_t *tcp;
+ int len = 0;
+ mb_t *m;
+#if SOLARIS
+ mb_t *m1;
+#endif
+
+ /*
+ * If we've already processed the start messages, then nothing left
+ * for the proxy to do.
+ */
+ if (rap->rap_eos == 1)
+ return 0;
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+ off = fin->fin_hlen + (tcp->th_off << 2);
+ bzero(membuf, sizeof(membuf));
+#if SOLARIS
+ m = fin->fin_qfm;
+
+ dlen = msgdsize(m) - off;
+ if (dlen <= 0)
+ return 0;
+ dlen = MIN(sizeof(membuf), dlen);
+ copyout_mblk(m, off, dlen, (char *)membuf);
+#else
+ m = *(mb_t **)fin->fin_mp;
+
+ dlen = mbufchainlen(m) - off;
+ if (dlen <= 0)
+ return 0;
+ dlen = MIN(sizeof(membuf), dlen);
+ m_copydata(m, off, dlen, (char *)membuf);
+#endif
+ /*
+ * In all the startup parsing, ensure that we don't go outside
+ * the packet buffer boundary.
+ */
+ /*
+ * Look for the start of connection "PNA" string if not seen yet.
+ */
+ if (rap->rap_seenpna == 0) {
+ s = (u_char *)memstr("PNA", (char *)membuf, 3, dlen);
+ if (s == NULL)
+ return 0;
+ s += 3;
+ rap->rap_seenpna = 1;
+ } else
+ s = membuf;
+
+ /*
+ * Directly after the PNA will be the version number of this
+ * connection.
+ */
+ if (rap->rap_seenpna == 1 && rap->rap_seenver == 0) {
+ if ((s + 1) - membuf < dlen) {
+ rap->rap_version = (*s << 8) | *(s + 1);
+ s += 2;
+ rap->rap_seenver = 1;
+ } else
+ return 0;
+ }
+
+ /*
+ * Now that we've been past the PNA and version number, we're into the
+ * startup messages block. This ends when a message with an ID of 0.
+ */
+ while ((rap->rap_eos == 0) && ((s + 1) - membuf < dlen)) {
+ if (rap->rap_gotid == 0) {
+ id = (*s << 8) | *(s + 1);
+ s += 2;
+ rap->rap_gotid = 1;
+ if (id == RA_ID_END) {
+ rap->rap_eos = 1;
+ break;
+ }
+ } else if (rap->rap_gotlen == 0) {
+ len = (*s << 8) | *(s + 1);
+ s += 2;
+ rap->rap_gotlen = 1;
+ }
+
+ if (rap->rap_gotid == 1 && rap->rap_gotlen == 1) {
+ if (id == RA_ID_UDP) {
+ rap->rap_mode &= ~RAP_M_TCP;
+ rap->rap_mode |= RAP_M_UDP;
+ rap->rap_plport = (*s << 8) | *(s + 1);
+ } else if (id == RA_ID_ROBUST) {
+ rap->rap_mode |= RAP_M_ROBUST;
+ rap->rap_prport = (*s << 8) | *(s + 1);
+ }
+ s += len;
+ rap->rap_gotlen = 0;
+ rap->rap_gotid = 0;
+ }
+ }
+ return 0;
+}
+
+
+int ippr_raudio_in(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ unsigned char membuf[IPF_MAXPORTLEN + 1], *s;
+ tcphdr_t *tcp, tcph, *tcp2 = &tcph;
+ raudio_t *rap = aps->aps_data;
+ int off, dlen, slen, clen;
+ struct in_addr swa, swb;
+ int a1, a2, a3, a4;
+ u_short sp, dp;
+ fr_info_t fi;
+ tcp_seq seq;
+ nat_t *ipn;
+ u_char swp;
+ mb_t *m;
+#if SOLARIS
+ mb_t *m1;
+#endif
+
+ /*
+ * Wait until we've seen the end of the start messages and even then
+ * only proceed further if we're using UDP. If they want to use TCP
+ * then data is sent back on the same channel that is already open.
+ */
+ if (rap->rap_sdone != 0)
+ return 0;
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+ off = fin->fin_hlen + (tcp->th_off << 2);
+ m = *(mb_t **)fin->fin_mp;
+
+#if SOLARIS
+ m = fin->fin_qfm;
+
+ dlen = msgdsize(m) - off;
+ if (dlen <= 0)
+ return 0;
+ bzero(membuf, sizeof(membuf));
+ clen = MIN(sizeof(membuf), dlen);
+ copyout_mblk(m, off, clen, (char *)membuf);
+#else
+ dlen = mbufchainlen(m) - off;
+ if (dlen <= 0)
+ return 0;
+ bzero(membuf, sizeof(membuf));
+ clen = MIN(sizeof(membuf), dlen);
+ m_copydata(m, off, clen, (char *)membuf);
+#endif
+
+ seq = ntohl(tcp->th_seq);
+ /*
+ * Check to see if the data in this packet is of interest to us.
+ * We only care for the first 19 bytes coming back from the server.
+ */
+ if (rap->rap_sseq == 0) {
+ s = (u_char *)memstr("PNA", (char *)membuf, 3, clen);
+ if (s == NULL)
+ return 0;
+ a1 = s - membuf;
+ dlen -= a1;
+ a1 = 0;
+ rap->rap_sseq = seq;
+ a2 = MIN(dlen, sizeof(rap->rap_svr));
+ } else if (seq <= rap->rap_sseq + sizeof(rap->rap_svr)) {
+ /*
+ * seq # which is the start of data and from that the offset
+ * into the buffer array.
+ */
+ a1 = seq - rap->rap_sseq;
+ a2 = MIN(dlen, sizeof(rap->rap_svr));
+ a2 -= a1;
+ s = membuf;
+ } else
+ return 0;
+
+ for (a3 = a1, a4 = a2; (a4 > 0) && (a3 < 19) && (a3 >= 0); a4--,a3++) {
+ rap->rap_sbf |= (1 << a3);
+ rap->rap_svr[a3] = *s++;
+ }
+
+ if ((rap->rap_sbf != 0x7ffff) || (!rap->rap_eos)) /* 19 bits */
+ return 0;
+ rap->rap_sdone = 1;
+
+ s = (u_char *)rap->rap_svr + 11;
+ if (((*s << 8) | *(s + 1)) == RA_ID_ROBUST) {
+ s += 2;
+ rap->rap_srport = (*s << 8) | *(s + 1);
+ }
+
+ swp = ip->ip_p;
+ swa = ip->ip_src;
+ swb = ip->ip_dst;
+
+ ip->ip_p = IPPROTO_UDP;
+ ip->ip_src = nat->nat_inip;
+ ip->ip_dst = nat->nat_oip;
+
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ bzero((char *)tcp2, sizeof(*tcp2));
+ tcp2->th_off = 5;
+ fi.fin_dp = (char *)tcp2;
+ fi.fin_fr = &raudiofr;
+ fi.fin_dlen = sizeof(*tcp2);
+ tcp2->th_win = htons(8192);
+ slen = ip->ip_len;
+ ip->ip_len = fin->fin_hlen + sizeof(*tcp);
+
+ if (((rap->rap_mode & RAP_M_UDP_ROBUST) == RAP_M_UDP_ROBUST) &&
+ (rap->rap_srport != 0)) {
+ dp = rap->rap_srport;
+ sp = rap->rap_prport;
+ tcp2->th_sport = htons(sp);
+ tcp2->th_dport = htons(dp);
+ fi.fin_data[0] = dp;
+ fi.fin_data[1] = sp;
+ fi.fin_out = 0;
+ ipn = nat_new(&fi, ip, nat->nat_ptr, NULL,
+ IPN_UDP | (sp ? 0 : FI_W_SPORT), NAT_OUTBOUND);
+ if (ipn != NULL) {
+ ipn->nat_age = fr_defnatage;
+ (void) fr_addstate(ip, &fi, NULL,
+ FI_IGNOREPKT|FI_NORULE|
+ (sp ? 0 : FI_W_SPORT));
+ }
+ }
+
+ if ((rap->rap_mode & RAP_M_UDP) == RAP_M_UDP) {
+ sp = rap->rap_plport;
+ tcp2->th_sport = htons(sp);
+ tcp2->th_dport = 0; /* XXX - don't specify remote port */
+ fi.fin_data[0] = sp;
+ fi.fin_data[1] = 0;
+ fi.fin_out = 1;
+ ipn = nat_new(&fi, ip, nat->nat_ptr, NULL, IPN_UDP|FI_W_DPORT,
+ NAT_OUTBOUND);
+ if (ipn != NULL) {
+ ipn->nat_age = fr_defnatage;
+ (void) fr_addstate(ip, &fi, NULL,
+ FI_W_DPORT|FI_IGNOREPKT|FI_NORULE);
+ }
+ }
+
+ ip->ip_p = swp;
+ ip->ip_len = slen;
+ ip->ip_src = swa;
+ ip->ip_dst = swb;
+ return 0;
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c b/sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c
new file mode 100644
index 0000000..6715b07
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c
@@ -0,0 +1,175 @@
+/*
+ * $Id: ip_rcmd_pxy.c,v 1.4.2.6 2002/10/01 15:24:59 darrenr Exp $
+ */
+/*
+ * Simple RCMD transparent proxy for in-kernel use. For use with the NAT
+ * code.
+ * $FreeBSD$
+ */
+#if SOLARIS && defined(_KERNEL)
+extern kmutex_t ipf_rw;
+#endif
+
+#define isdigit(x) ((x) >= '0' && (x) <= '9')
+
+#define IPF_RCMD_PROXY
+
+
+int ippr_rcmd_init __P((void));
+int ippr_rcmd_new __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+int ippr_rcmd_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+u_short ipf_rcmd_atoi __P((char *));
+int ippr_rcmd_portmsg __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *));
+
+static frentry_t rcmdfr;
+
+
+/*
+ * RCMD application proxy initialization.
+ */
+int ippr_rcmd_init()
+{
+ bzero((char *)&rcmdfr, sizeof(rcmdfr));
+ rcmdfr.fr_ref = 1;
+ rcmdfr.fr_flags = FR_INQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE;
+ return 0;
+}
+
+
+/*
+ * Setup for a new RCMD proxy.
+ */
+int ippr_rcmd_new(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ tcphdr_t *tcp = (tcphdr_t *)fin->fin_dp;
+
+ aps->aps_psiz = sizeof(u_32_t);
+ KMALLOCS(aps->aps_data, u_32_t *, sizeof(u_32_t));
+ if (aps->aps_data == NULL)
+ return -1;
+ *(u_32_t *)aps->aps_data = 0;
+ aps->aps_sport = tcp->th_sport;
+ aps->aps_dport = tcp->th_dport;
+ return 0;
+}
+
+
+/*
+ * ipf_rcmd_atoi - implement a simple version of atoi
+ */
+u_short ipf_rcmd_atoi(ptr)
+char *ptr;
+{
+ register char *s = ptr, c;
+ register u_short i = 0;
+
+ while ((c = *s++) && isdigit(c)) {
+ i *= 10;
+ i += c - '0';
+ }
+ return i;
+}
+
+
+int ippr_rcmd_portmsg(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ char portbuf[8], *s;
+ struct in_addr swip;
+ int off, dlen;
+ tcphdr_t *tcp, tcph, *tcp2 = &tcph;
+ fr_info_t fi;
+ u_short sp;
+ nat_t *ipn;
+ mb_t *m;
+#if SOLARIS
+ mb_t *m1;
+#endif
+
+ tcp = (tcphdr_t *)fin->fin_dp;
+
+ if (tcp->th_flags & TH_SYN) {
+ *(u_32_t *)aps->aps_data = htonl(ntohl(tcp->th_seq) + 1);
+ return 0;
+ }
+
+ if ((*(u_32_t *)aps->aps_data != 0) &&
+ (tcp->th_seq != *(u_32_t *)aps->aps_data))
+ return 0;
+
+ off = fin->fin_hlen + (tcp->th_off << 2);
+
+#if SOLARIS
+ m = fin->fin_qfm;
+
+ dlen = msgdsize(m) - off;
+ bzero(portbuf, sizeof(portbuf));
+ copyout_mblk(m, off, MIN(sizeof(portbuf), dlen), portbuf);
+#else
+ m = *(mb_t **)fin->fin_mp;
+ dlen = mbufchainlen(m) - off;
+ bzero(portbuf, sizeof(portbuf));
+ m_copydata(m, off, MIN(sizeof(portbuf), dlen), portbuf);
+#endif
+
+ portbuf[sizeof(portbuf) - 1] = '\0';
+ s = portbuf;
+ sp = ipf_rcmd_atoi(s);
+ if (!sp)
+ return 0;
+
+ /*
+ * Add skeleton NAT entry for connection which will come back the
+ * other way.
+ */
+ bcopy((char *)fin, (char *)&fi, sizeof(fi));
+ fi.fin_data[0] = sp;
+ fi.fin_data[1] = fin->fin_data[1];
+ ipn = nat_outlookup(&fi, IPN_TCP, nat->nat_p, nat->nat_inip,
+ ip->ip_dst, 0);
+ if (ipn == NULL) {
+ int slen;
+
+ slen = ip->ip_len;
+ ip->ip_len = fin->fin_hlen + sizeof(*tcp);
+ bzero((char *)tcp2, sizeof(*tcp2));
+ tcp2->th_win = htons(8192);
+ tcp2->th_sport = htons(sp);
+ tcp2->th_dport = 0; /* XXX - don't specify remote port */
+ tcp2->th_off = 5;
+ tcp2->th_flags = TH_SYN;
+ fi.fin_data[1] = 0;
+ fi.fin_dp = (char *)tcp2;
+ fi.fin_dlen = sizeof(*tcp2);
+ swip = ip->ip_src;
+ ip->ip_src = nat->nat_inip;
+ ipn = nat_new(&fi, ip, nat->nat_ptr, NULL, IPN_TCP|FI_W_DPORT,
+ NAT_OUTBOUND);
+ if (ipn != NULL) {
+ ipn->nat_age = fr_defnatage;
+ fi.fin_fr = &rcmdfr;
+ (void) fr_addstate(ip, &fi, NULL,
+ FI_W_DPORT|FI_IGNOREPKT);
+ }
+ ip->ip_len = slen;
+ ip->ip_src = swip;
+ }
+ return 0;
+}
+
+
+int ippr_rcmd_out(fin, ip, aps, nat)
+fr_info_t *fin;
+ip_t *ip;
+ap_session_t *aps;
+nat_t *nat;
+{
+ return ippr_rcmd_portmsg(fin, ip, aps, nat);
+}
diff --git a/sys/contrib/ipfilter/netinet/ip_state.c b/sys/contrib/ipfilter/netinet/ip_state.c
new file mode 100644
index 0000000..b443e46
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_state.c
@@ -0,0 +1,2278 @@
+/*
+ * Copyright (C) 1995-2002 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+
+#if defined(__sgi) && (IRIX > 602)
+# include <sys/ptimers.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
+ defined(_KERNEL)
+# include "opt_ipfilter_log.h"
+#endif
+#if defined(_KERNEL) && defined(__FreeBSD_version) && \
+ (__FreeBSD_version >= 400000) && !defined(KLD_MODULE)
+#include "opt_inet6.h"
+#endif
+#if !defined(_KERNEL) && !defined(KERNEL) && !defined(__KERNEL__)
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifdef linux
+# include <linux/kernel.h>
+# include <linux/module.h>
+# endif
+#endif
+#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000)
+# include <sys/filio.h>
+# include <sys/fcntl.h>
+# if (__FreeBSD_version >= 300000) && !defined(IPFILTER_LKM)
+# include "opt_ipfilter.h"
+# endif
+#else
+# include <sys/ioctl.h>
+#endif
+#include <sys/time.h>
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+#if (defined(_KERNEL) || defined(KERNEL)) && !defined(linux)
+# include <sys/systm.h>
+#endif
+#if !defined(__SVR4) && !defined(__svr4__)
+# ifndef linux
+# include <sys/mbuf.h>
+# endif
+#else
+# include <sys/filio.h>
+# include <sys/byteorder.h>
+# ifdef _KERNEL
+# include <sys/dditypes.h>
+# endif
+# include <sys/stream.h>
+# include <sys/kmem.h>
+#endif
+
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#ifndef linux
+# include <netinet/ip_var.h>
+# include <netinet/tcp_fsm.h>
+#endif
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#ifdef USE_INET6
+#include <netinet/icmp6.h>
+#endif
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+# if (defined(_KERNEL) || defined(KERNEL)) && !defined(IPFILTER_LKM)
+# include <sys/libkern.h>
+# include <sys/systm.h>
+# endif
+#endif
+
+#if !defined(lint)
+static const char sccsid[] = "@(#)ip_state.c 1.8 6/5/96 (C) 1993-2000 Darren Reed";
+/* static const char rcsid[] = "@(#)$Id: ip_state.c,v 2.30.2.38 2001/07/23 13:49:46 darrenr Exp $"; */
+static const char rcsid[] = "@(#)$FreeBSD$";
+#endif
+
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+
+#define TCP_CLOSE (TH_FIN|TH_RST)
+
+static ipstate_t **ips_table = NULL;
+static int ips_num = 0;
+static int ips_wild = 0;
+static ips_stat_t ips_stats;
+#if (SOLARIS || defined(__sgi)) && defined(_KERNEL)
+extern KRWLOCK_T ipf_state, ipf_mutex;
+extern kmutex_t ipf_rw;
+#endif
+
+#ifdef USE_INET6
+static frentry_t *fr_checkicmp6matchingstate __P((ip6_t *, fr_info_t *));
+#endif
+static int fr_matchsrcdst __P((ipstate_t *, union i6addr, union i6addr,
+ fr_info_t *, tcphdr_t *));
+static frentry_t *fr_checkicmpmatchingstate __P((ip_t *, fr_info_t *));
+static int fr_matchicmpqueryreply __P((int, ipstate_t *, icmphdr_t *, int));
+static int fr_state_flush __P((int, int));
+static ips_stat_t *fr_statetstats __P((void));
+static void fr_delstate __P((ipstate_t *));
+static int fr_state_remove __P((caddr_t));
+static void fr_ipsmove __P((ipstate_t **, ipstate_t *, u_int));
+static int fr_tcpoptions __P((tcphdr_t *));
+int fr_stputent __P((caddr_t));
+int fr_stgetent __P((caddr_t));
+void fr_stinsert __P((ipstate_t *));
+
+
+#define FIVE_DAYS (2 * 5 * 86400) /* 5 days: half closed session */
+
+#define TCP_MSL 240 /* 2 minutes */
+u_long fr_tcpidletimeout = FIVE_DAYS,
+ fr_tcpclosewait = 2 * TCP_MSL,
+ fr_tcplastack = 2 * TCP_MSL,
+ fr_tcptimeout = 2 * TCP_MSL,
+ fr_tcpclosed = 120,
+ fr_tcphalfclosed = 2 * 2 * 3600, /* 2 hours */
+ fr_udptimeout = 240,
+ fr_udpacktimeout = 24,
+ fr_icmptimeout = 120,
+ fr_icmpacktimeout = 12;
+int fr_statemax = IPSTATE_MAX,
+ fr_statesize = IPSTATE_SIZE;
+int fr_state_doflush = 0,
+ fr_state_lock = 0;
+ipstate_t *ips_list = NULL;
+
+static int icmpreplytype4[ICMP_MAXTYPE + 1];
+#ifdef USE_INET6
+static int icmpreplytype6[ICMP6_MAXTYPE + 1];
+#endif
+
+int fr_stateinit()
+{
+ int i;
+
+ KMALLOCS(ips_table, ipstate_t **, fr_statesize * sizeof(ipstate_t *));
+ if (ips_table != NULL)
+ bzero((char *)ips_table, fr_statesize * sizeof(ipstate_t *));
+ else
+ return -1;
+
+ /* fill icmp reply type table */
+ for (i = 0; i <= ICMP_MAXTYPE; i++)
+ icmpreplytype4[i] = -1;
+ icmpreplytype4[ICMP_ECHO] = ICMP_ECHOREPLY;
+ icmpreplytype4[ICMP_TSTAMP] = ICMP_TSTAMPREPLY;
+ icmpreplytype4[ICMP_IREQ] = ICMP_IREQREPLY;
+ icmpreplytype4[ICMP_MASKREQ] = ICMP_MASKREPLY;
+#ifdef USE_INET6
+ /* fill icmp reply type table */
+ for (i = 0; i <= ICMP6_MAXTYPE; i++)
+ icmpreplytype6[i] = -1;
+ icmpreplytype6[ICMP6_ECHO_REQUEST] = ICMP6_ECHO_REPLY;
+ icmpreplytype6[ICMP6_MEMBERSHIP_QUERY] = ICMP6_MEMBERSHIP_REPORT;
+ icmpreplytype6[ICMP6_NI_QUERY] = ICMP6_NI_REPLY;
+ icmpreplytype6[ND_ROUTER_SOLICIT] = ND_ROUTER_ADVERT;
+ icmpreplytype6[ND_NEIGHBOR_SOLICIT] = ND_NEIGHBOR_ADVERT;
+#endif
+
+ return 0;
+}
+
+
+static ips_stat_t *fr_statetstats()
+{
+ ips_stats.iss_active = ips_num;
+ ips_stats.iss_table = ips_table;
+ ips_stats.iss_list = ips_list;
+ return &ips_stats;
+}
+
+
+/*
+ * flush state tables. two actions currently defined:
+ * which == 0 : flush all state table entries
+ * which == 1 : flush TCP connections which have started to close but are
+ * stuck for some reason.
+ * which == 2 : flush TCP connections which have been idle for a long time,
+ * starting at > 4 days idle and working back in successive half-
+ * days to at most 12 hours old.
+ */
+static int fr_state_flush(which, proto)
+int which, proto;
+{
+ ipstate_t *is, **isp;
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+ int delete, removed = 0, try;
+
+ SPL_NET(s);
+ for (isp = &ips_list; (is = *isp); ) {
+ delete = 0;
+
+ if ((proto != 0) && (is->is_v != proto))
+ continue;
+
+ switch (which)
+ {
+ case 0 :
+ delete = 1;
+ break;
+ case 1 :
+ case 2 :
+ if (is->is_p != IPPROTO_TCP)
+ break;
+ if ((is->is_state[0] != TCPS_ESTABLISHED) ||
+ (is->is_state[1] != TCPS_ESTABLISHED))
+ delete = 1;
+ break;
+ }
+
+ if (delete) {
+ if (is->is_p == IPPROTO_TCP)
+ ips_stats.iss_fin++;
+ else
+ ips_stats.iss_expire++;
+#ifdef IPFILTER_LOG
+ ipstate_log(is, ISL_FLUSH);
+#endif
+ fr_delstate(is);
+ removed++;
+ } else
+ isp = &is->is_next;
+ }
+
+ /*
+ * Asked to remove inactive entries, try again if first attempt
+ * failed. In this case, 86400 is half a day because the counter is
+ * activated every half second.
+ */
+ if ((which == 2) && (removed == 0)) {
+ try = 86400; /* half a day */
+ for (; (try < FIVE_DAYS) && (removed == 0); try += 86400) {
+ for (isp = &ips_list; (is = *isp); ) {
+ delete = 0;
+ if ((is->is_p == IPPROTO_TCP) &&
+ ((is->is_state[0] == TCPS_ESTABLISHED) ||
+ (is->is_state[1] == TCPS_ESTABLISHED)) &&
+ (is->is_age < try)) {
+ ips_stats.iss_fin++;
+ delete = 1;
+ } else if ((is->is_p != IPPROTO_TCP) &&
+ (is->is_pkts > 1)) {
+ ips_stats.iss_expire++;
+ delete = 1;
+ }
+ if (delete) {
+#ifdef IPFILTER_LOG
+ ipstate_log(is, ISL_FLUSH);
+#endif
+ fr_delstate(is);
+ removed++;
+ } else
+ isp = &is->is_next;
+ }
+ }
+ }
+
+ SPL_X(s);
+ return removed;
+}
+
+
+static int fr_state_remove(data)
+caddr_t data;
+{
+ ipstate_t *sp, st;
+ int error;
+
+ sp = &st;
+ error = IRCOPYPTR(data, (caddr_t)&st, sizeof(st));
+ if (error)
+ return EFAULT;
+
+ WRITE_ENTER(&ipf_state);
+ for (sp = ips_list; sp; sp = sp->is_next)
+ if ((sp->is_p == st.is_p) && (sp->is_v == st.is_v) &&
+ !bcmp((char *)&sp->is_src, (char *)&st.is_src,
+ sizeof(st.is_src)) &&
+ !bcmp((char *)&sp->is_dst, (char *)&st.is_dst,
+ sizeof(st.is_dst)) &&
+ !bcmp((char *)&sp->is_ps, (char *)&st.is_ps,
+ sizeof(st.is_ps))) {
+#ifdef IPFILTER_LOG
+ ipstate_log(sp, ISL_REMOVE);
+#endif
+ fr_delstate(sp);
+ RWLOCK_EXIT(&ipf_state);
+ return 0;
+ }
+ RWLOCK_EXIT(&ipf_state);
+ return ESRCH;
+}
+
+
+int fr_state_ioctl(data, cmd, mode)
+caddr_t data;
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+u_long cmd;
+#else
+int cmd;
+#endif
+int mode;
+{
+ int arg, ret, error = 0;
+
+ switch (cmd)
+ {
+ case SIOCDELST :
+ error = fr_state_remove(data);
+ break;
+ case SIOCIPFFL :
+ error = IRCOPY(data, (caddr_t)&arg, sizeof(arg));
+ if (error)
+ break;
+ if (arg == 0 || arg == 1) {
+ WRITE_ENTER(&ipf_state);
+ ret = fr_state_flush(arg, 4);
+ RWLOCK_EXIT(&ipf_state);
+ error = IWCOPY((caddr_t)&ret, data, sizeof(ret));
+ } else
+ error = EINVAL;
+ break;
+#ifdef USE_INET6
+ case SIOCIPFL6 :
+ error = IRCOPY(data, (caddr_t)&arg, sizeof(arg));
+ if (error)
+ break;
+ if (arg == 0 || arg == 1) {
+ WRITE_ENTER(&ipf_state);
+ ret = fr_state_flush(arg, 6);
+ RWLOCK_EXIT(&ipf_state);
+ error = IWCOPY((caddr_t)&ret, data, sizeof(ret));
+ } else
+ error = EINVAL;
+ break;
+#endif
+#ifdef IPFILTER_LOG
+ case SIOCIPFFB :
+ if (!(mode & FWRITE))
+ error = EPERM;
+ else {
+ int tmp;
+
+ tmp = ipflog_clear(IPL_LOGSTATE);
+ IWCOPY((char *)&tmp, data, sizeof(tmp));
+ }
+ break;
+#endif
+ case SIOCGETFS :
+ error = IWCOPYPTR((caddr_t)fr_statetstats(), data,
+ sizeof(ips_stat_t));
+ break;
+ case FIONREAD :
+#ifdef IPFILTER_LOG
+ arg = (int)iplused[IPL_LOGSTATE];
+ error = IWCOPY((caddr_t)&arg, (caddr_t)data, sizeof(arg));
+#endif
+ break;
+ case SIOCSTLCK :
+ error = fr_lock(data, &fr_state_lock);
+ break;
+ case SIOCSTPUT :
+ if (!fr_state_lock) {
+ error = EACCES;
+ break;
+ }
+ error = fr_stputent(data);
+ break;
+ case SIOCSTGET :
+ if (!fr_state_lock) {
+ error = EACCES;
+ break;
+ }
+ error = fr_stgetent(data);
+ break;
+ default :
+ error = EINVAL;
+ break;
+ }
+ return error;
+}
+
+
+/*
+ * Copy out state information from the kernel to a user space process.
+ */
+int fr_stgetent(data)
+caddr_t data;
+{
+ register ipstate_t *is, *isn;
+ ipstate_save_t ips;
+ int error;
+
+ error = IRCOPYPTR(data, (caddr_t)&ips, sizeof(ips));
+ if (error)
+ return error;
+
+ isn = ips.ips_next;
+ if (!isn) {
+ isn = ips_list;
+ if (isn == NULL) {
+ if (ips.ips_next == NULL)
+ return ENOENT;
+ return 0;
+ }
+ } else {
+ /*
+ * Make sure the pointer we're copying from exists in the
+ * current list of entries. Security precaution to prevent
+ * copying of random kernel data.
+ */
+ for (is = ips_list; is; is = is->is_next)
+ if (is == isn)
+ break;
+ if (!is)
+ return ESRCH;
+ }
+ ips.ips_next = isn->is_next;
+ bcopy((char *)isn, (char *)&ips.ips_is, sizeof(ips.ips_is));
+ if (isn->is_rule)
+ bcopy((char *)isn->is_rule, (char *)&ips.ips_fr,
+ sizeof(ips.ips_fr));
+ error = IWCOPYPTR((caddr_t)&ips, data, sizeof(ips));
+ if (error)
+ error = EFAULT;
+ return error;
+}
+
+
+int fr_stputent(data)
+caddr_t data;
+{
+ register ipstate_t *is, *isn;
+ ipstate_save_t ips;
+ int error, out, i;
+ frentry_t *fr;
+ char *name;
+
+ error = IRCOPYPTR(data, (caddr_t)&ips, sizeof(ips));
+ if (error)
+ return error;
+
+ KMALLOC(isn, ipstate_t *);
+ if (isn == NULL)
+ return ENOMEM;
+
+ bcopy((char *)&ips.ips_is, (char *)isn, sizeof(*isn));
+ fr = isn->is_rule;
+ if (fr != NULL) {
+ if (isn->is_flags & FI_NEWFR) {
+ KMALLOC(fr, frentry_t *);
+ if (fr == NULL) {
+ KFREE(isn);
+ return ENOMEM;
+ }
+ bcopy((char *)&ips.ips_fr, (char *)fr, sizeof(*fr));
+ out = fr->fr_flags & FR_OUTQUE ? 1 : 0;
+ isn->is_rule = fr;
+ ips.ips_is.is_rule = fr;
+
+ /*
+ * Look up all the interface names in the rule.
+ */
+ for (i = 0; i < 4; i++) {
+ name = fr->fr_ifnames[i];
+ if ((name[1] == '\0') &&
+ ((name[0] == '-') || (name[0] == '*'))) {
+ fr->fr_ifas[i] = NULL;
+ } else if (*name != '\0') {
+ fr->fr_ifas[i] = GETUNIT(name,
+ fr->fr_v);
+ if (fr->fr_ifas[i] == NULL)
+ fr->fr_ifas[i] = (void *)-1;
+ else {
+ strncpy(isn->is_ifname[i],
+ IFNAME(fr->fr_ifas[i]),
+ IFNAMSIZ);
+ }
+ }
+ isn->is_ifp[out] = fr->fr_ifas[i];
+ }
+
+ /*
+ * send a copy back to userland of what we ended up
+ * to allow for verification.
+ */
+ error = IWCOPYPTR((caddr_t)&ips, data, sizeof(ips));
+ if (error) {
+ KFREE(isn);
+ KFREE(fr);
+ return EFAULT;
+ }
+ } else {
+ for (is = ips_list; is; is = is->is_next)
+ if (is->is_rule == fr)
+ break;
+ if (!is) {
+ KFREE(isn);
+ return ESRCH;
+ }
+ }
+ }
+ fr_stinsert(isn);
+ return 0;
+}
+
+
+/*
+ * Insert a state table entry manually.
+ */
+void fr_stinsert(is)
+register ipstate_t *is;
+{
+ register u_int hv = is->is_hv;
+ char *name;
+ int i;
+
+ MUTEX_INIT(&is->is_lock, "ipf state entry", NULL);
+
+ /*
+ * Look up all the interface names in the state entry.
+ */
+ for (i = 0; i < 4; i++) {
+ name = is->is_ifname[i];
+ if ((name[1] == '\0') &&
+ ((name[0] == '-') || (name[0] == '*'))) {
+ is->is_ifp[0] = NULL;
+ } else if (*name != '\0') {
+ is->is_ifp[i] = GETUNIT(name, is->is_v);
+ if (is->is_ifp[i] == NULL)
+ is->is_ifp[i] = (void *)-1;
+ }
+ }
+
+
+ /*
+ * add into list table.
+ */
+ if (ips_list)
+ ips_list->is_pnext = &is->is_next;
+ is->is_pnext = &ips_list;
+ is->is_next = ips_list;
+ ips_list = is;
+ if (ips_table[hv])
+ ips_table[hv]->is_phnext = &is->is_hnext;
+ else
+ ips_stats.iss_inuse++;
+ is->is_phnext = ips_table + hv;
+ is->is_hnext = ips_table[hv];
+ ips_table[hv] = is;
+ ips_num++;
+}
+
+
+/*
+ * Create a new ipstate structure and hang it off the hash table.
+ */
+ipstate_t *fr_addstate(ip, fin, stsave, flags)
+ip_t *ip;
+fr_info_t *fin;
+ipstate_t **stsave;
+u_int flags;
+{
+ register tcphdr_t *tcp = NULL;
+ register ipstate_t *is;
+ register u_int hv;
+ struct icmp *ic;
+ ipstate_t ips;
+ int out, ws;
+ u_int pass;
+ void *ifp;
+
+ if (fr_state_lock || (fin->fin_off != 0) || (fin->fin_fl & FI_SHORT) ||
+ (fin->fin_misc & FM_BADSTATE))
+ return NULL;
+ if (ips_num == fr_statemax) {
+ ips_stats.iss_max++;
+ fr_state_doflush = 1;
+ return NULL;
+ }
+ out = fin->fin_out;
+ is = &ips;
+ bzero((char *)is, sizeof(*is));
+ ips.is_age = 1;
+ /*
+ * Copy and calculate...
+ */
+ hv = (is->is_p = fin->fin_fi.fi_p);
+ is->is_src = fin->fin_fi.fi_src;
+ hv += is->is_saddr;
+ is->is_dst = fin->fin_fi.fi_dst;
+ hv += is->is_daddr;
+#ifdef USE_INET6
+ if (fin->fin_v == 6) {
+ if ((is->is_p == IPPROTO_ICMPV6) &&
+ IN6_IS_ADDR_MULTICAST(&is->is_dst.in6)) {
+ /*
+ * So you can do keep state with neighbour discovery.
+ */
+ flags |= FI_W_DADDR;
+ hv -= is->is_daddr;
+ } else {
+ hv += is->is_dst.i6[1];
+ hv += is->is_dst.i6[2];
+ hv += is->is_dst.i6[3];
+ }
+ hv += is->is_src.i6[1];
+ hv += is->is_src.i6[2];
+ hv += is->is_src.i6[3];
+ }
+#endif
+
+ switch (is->is_p)
+ {
+ int off;
+
+#ifdef USE_INET6
+ case IPPROTO_ICMPV6 :
+ ic = (struct icmp *)fin->fin_dp;
+ if ((ic->icmp_type & ICMP6_INFOMSG_MASK) == 0)
+ return NULL;
+
+ switch (ic->icmp_type)
+ {
+ case ICMP6_ECHO_REQUEST :
+ is->is_icmp.ics_type = ic->icmp_type;
+ hv += (is->is_icmp.ics_id = ic->icmp_id);
+ hv += (is->is_icmp.ics_seq = ic->icmp_seq);
+ break;
+ case ICMP6_MEMBERSHIP_QUERY :
+ case ND_ROUTER_SOLICIT :
+ case ND_NEIGHBOR_SOLICIT :
+ case ICMP6_NI_QUERY :
+ is->is_icmp.ics_type = ic->icmp_type;
+ break;
+ default :
+ return NULL;
+ }
+ ATOMIC_INCL(ips_stats.iss_icmp);
+ is->is_age = fr_icmptimeout;
+ break;
+#endif
+ case IPPROTO_ICMP :
+ ic = (struct icmp *)fin->fin_dp;
+
+ switch (ic->icmp_type)
+ {
+ case ICMP_ECHO :
+ case ICMP_TSTAMP :
+ case ICMP_IREQ :
+ case ICMP_MASKREQ :
+ is->is_icmp.ics_type = ic->icmp_type;
+ hv += (is->is_icmp.ics_id = ic->icmp_id);
+ hv += (is->is_icmp.ics_seq = ic->icmp_seq);
+ break;
+ default :
+ return NULL;
+ }
+ ATOMIC_INCL(ips_stats.iss_icmp);
+ is->is_age = fr_icmptimeout;
+ break;
+ case IPPROTO_TCP :
+ tcp = (tcphdr_t *)fin->fin_dp;
+
+ if (tcp->th_flags & TH_RST)
+ return NULL;
+ /*
+ * The endian of the ports doesn't matter, but the ack and
+ * sequence numbers do as we do mathematics on them later.
+ */
+ is->is_sport = htons(fin->fin_data[0]);
+ is->is_dport = htons(fin->fin_data[1]);
+ if ((flags & (FI_W_DPORT|FI_W_SPORT)) == 0) {
+ hv += is->is_sport;
+ hv += is->is_dport;
+ }
+ if ((flags & FI_IGNOREPKT) == 0) {
+ is->is_send = ntohl(tcp->th_seq) + fin->fin_dlen -
+ (off = (tcp->th_off << 2)) +
+ ((tcp->th_flags & TH_SYN) ? 1 : 0) +
+ ((tcp->th_flags & TH_FIN) ? 1 : 0);
+ is->is_maxsend = is->is_send;
+
+ if ((tcp->th_flags & TH_SYN) &&
+ ((tcp->th_off << 2) >= (sizeof(*tcp) + 4))) {
+ ws = fr_tcpoptions(tcp);
+ if (ws >= 0)
+ is->is_swscale = ws;
+ }
+ }
+
+ is->is_maxdwin = 1;
+ is->is_maxswin = ntohs(tcp->th_win);
+ if (is->is_maxswin == 0)
+ is->is_maxswin = 1;
+
+ if ((tcp->th_flags & TH_OPENING) == TH_SYN)
+ is->is_fsm = 1;
+
+ /*
+ * If we're creating state for a starting connection, start the
+ * timer on it as we'll never see an error if it fails to
+ * connect.
+ */
+ ATOMIC_INCL(ips_stats.iss_tcp);
+ break;
+
+ case IPPROTO_UDP :
+ tcp = (tcphdr_t *)fin->fin_dp;
+
+ is->is_sport = htons(fin->fin_data[0]);
+ is->is_dport = htons(fin->fin_data[1]);
+ if ((flags & (FI_W_DPORT|FI_W_SPORT)) == 0) {
+ hv += is->is_sport;
+ hv += is->is_dport;
+ }
+ ATOMIC_INCL(ips_stats.iss_udp);
+ is->is_age = fr_udptimeout;
+ break;
+ default :
+ is->is_age = fr_udptimeout;
+ break;
+ }
+
+ KMALLOC(is, ipstate_t *);
+ if (is == NULL) {
+ ATOMIC_INCL(ips_stats.iss_nomem);
+ return NULL;
+ }
+ bcopy((char *)&ips, (char *)is, sizeof(*is));
+ hv %= fr_statesize;
+ is->is_hv = hv;
+ is->is_rule = fin->fin_fr;
+ if (is->is_rule != NULL) {
+ is->is_group = is->is_rule->fr_group;
+ ATOMIC_INC32(is->is_rule->fr_ref);
+ pass = is->is_rule->fr_flags;
+ is->is_frage[0] = is->is_rule->fr_age[0];
+ is->is_frage[1] = is->is_rule->fr_age[1];
+ if (is->is_frage[0] != 0)
+ is->is_age = is->is_frage[0];
+
+ is->is_ifp[(out << 1) + 1] = is->is_rule->fr_ifas[1];
+ is->is_ifp[(1 - out) << 1] = is->is_rule->fr_ifas[2];
+ is->is_ifp[((1 - out) << 1) + 1] = is->is_rule->fr_ifas[3];
+
+ if (((ifp = is->is_rule->fr_ifas[1]) != NULL) &&
+ (ifp != (void *)-1))
+ strncpy(is->is_ifname[(out << 1) + 1],
+ IFNAME(ifp), IFNAMSIZ);
+ if (((ifp = is->is_rule->fr_ifas[2]) != NULL) &&
+ (ifp != (void *)-1))
+ strncpy(is->is_ifname[(1 - out) << 1],
+ IFNAME(ifp), IFNAMSIZ);
+ if (((ifp = is->is_rule->fr_ifas[3]) != NULL) &&
+ (ifp != (void *)-1))
+ strncpy(is->is_ifname[((1 - out) << 1) + 1],
+ IFNAME(ifp), IFNAMSIZ);
+ } else
+ pass = fr_flags;
+
+ is->is_ifp[out << 1] = fin->fin_ifp;
+ strncpy(is->is_ifname[out << 1], IFNAME(fin->fin_ifp), IFNAMSIZ);
+
+ WRITE_ENTER(&ipf_state);
+
+ is->is_pass = pass;
+ if ((flags & FI_IGNOREPKT) == 0) {
+ is->is_pkts = 1;
+ is->is_bytes = fin->fin_dlen + fin->fin_hlen;
+ }
+ /*
+ * We want to check everything that is a property of this packet,
+ * but we don't (automatically) care about it's fragment status as
+ * this may change.
+ */
+ is->is_v = fin->fin_v;
+ is->is_rulen = fin->fin_rule;
+ is->is_opt = fin->fin_fi.fi_optmsk;
+ is->is_optmsk = 0xffffffff;
+ is->is_sec = fin->fin_fi.fi_secmsk;
+ is->is_secmsk = 0xffff;
+ is->is_auth = fin->fin_fi.fi_auth;
+ is->is_authmsk = 0xffff;
+ is->is_flags = fin->fin_fl & FI_CMP;
+ is->is_flags |= FI_CMP << 4;
+ is->is_flags |= flags & (FI_WILDP|FI_WILDA);
+ if (flags & (FI_WILDP|FI_WILDA))
+ ips_wild++;
+
+ if (pass & FR_LOGFIRST)
+ is->is_pass &= ~(FR_LOGFIRST|FR_LOG);
+ fr_stinsert(is);
+ is->is_me = stsave;
+ if (is->is_p == IPPROTO_TCP) {
+ fr_tcp_age(&is->is_age, is->is_state, fin,
+ 0, is->is_fsm); /* 0 = packet from the source */
+ }
+#ifdef IPFILTER_LOG
+ ipstate_log(is, ISL_NEW);
+#endif
+ RWLOCK_EXIT(&ipf_state);
+ fin->fin_rev = IP6NEQ(is->is_dst, fin->fin_fi.fi_dst);
+ if ((fin->fin_fl & FI_FRAG) && (pass & FR_KEEPFRAG))
+ ipfr_newfrag(ip, fin);
+ return is;
+}
+
+
+static int fr_tcpoptions(tcp)
+tcphdr_t *tcp;
+{
+ u_char *opt, *last;
+ int wscale;
+
+ opt = (u_char *) (tcp + 1);
+ last = ((u_char *)tcp) + (tcp->th_off << 2);
+
+ /* If we don't find wscale here, we need to clear it */
+ wscale = -2;
+
+ /* Termination condition picked such that opt[0 .. 2] exist */
+ while ((opt < last - 2) && (*opt != TCPOPT_EOL)) {
+ switch (*opt) {
+ case TCPOPT_NOP:
+ opt++;
+ continue;
+ case TCPOPT_WSCALE:
+ /* Proper length ? */
+ if (opt[1] == 3) {
+ if (opt[2] > 14)
+ wscale = 14;
+ else
+ wscale = opt[2];
+ }
+ break;
+ default:
+ /* Unknown options must be two bytes+ */
+ if (opt[1] < 2)
+ break;
+ opt += opt[1];
+ continue;
+ }
+ break;
+ }
+ return wscale;
+}
+
+
+
+/*
+ * check to see if a packet with TCP headers fits within the TCP window.
+ * change timeout depending on whether new packet is a SYN-ACK returning for a
+ * SYN or a RST or FIN which indicate time to close up shop.
+ */
+int fr_tcpstate(is, fin, ip, tcp)
+register ipstate_t *is;
+fr_info_t *fin;
+ip_t *ip;
+tcphdr_t *tcp;
+{
+ register tcp_seq seq, ack, end;
+ register int ackskew;
+ tcpdata_t *fdata, *tdata;
+ u_32_t win, maxwin;
+ int ret = 0, off;
+ int source;
+ int wscale;
+
+ /*
+ * Find difference between last checked packet and this packet.
+ */
+ source = IP6EQ(fin->fin_fi.fi_src, is->is_src);
+ if (source && (ntohs(is->is_sport) != fin->fin_data[0]))
+ source = 0;
+ fdata = &is->is_tcp.ts_data[!source];
+ tdata = &is->is_tcp.ts_data[source];
+ off = tcp->th_off << 2;
+ seq = ntohl(tcp->th_seq);
+ ack = ntohl(tcp->th_ack);
+ win = ntohs(tcp->th_win);
+ end = seq + fin->fin_dlen - off +
+ ((tcp->th_flags & TH_SYN) ? 1 : 0) +
+ ((tcp->th_flags & TH_FIN) ? 1 : 0);
+
+
+ if ((tcp->th_flags & TH_SYN) && (off >= sizeof(*tcp) + 4))
+ wscale = fr_tcpoptions(tcp);
+ else
+ wscale = -1;
+
+ MUTEX_ENTER(&is->is_lock);
+
+ if (wscale >= 0)
+ fdata->td_wscale = wscale;
+ else if (wscale == -2)
+ fdata->td_wscale = tdata->td_wscale = 0;
+ win <<= fdata->td_wscale;
+
+ if ((fdata->td_end == 0) &&
+ (!is->is_fsm || ((tcp->th_flags & TH_OPENING) == TH_OPENING))) {
+ /*
+ * Must be a (outgoing) SYN-ACK in reply to a SYN.
+ */
+ fdata->td_end = end;
+ fdata->td_maxwin = 1;
+ fdata->td_maxend = end + win;
+ if (win == 0)
+ fdata->td_maxend++;
+ }
+
+ if (!(tcp->th_flags & TH_ACK)) { /* Pretend an ack was sent */
+ ack = tdata->td_end;
+ } else if (((tcp->th_flags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) &&
+ (ack == 0)) {
+ /* gross hack to get around certain broken tcp stacks */
+ ack = tdata->td_end;
+ }
+
+ if (seq == end)
+ seq = end = fdata->td_end;
+
+ maxwin = tdata->td_maxwin;
+ ackskew = tdata->td_end - ack;
+
+#define SEQ_GE(a,b) ((int)((a) - (b)) >= 0)
+#define SEQ_GT(a,b) ((int)((a) - (b)) > 0)
+ if ((SEQ_GE(fdata->td_maxend, end)) &&
+ (SEQ_GE(seq, fdata->td_end - maxwin)) &&
+/* XXX what about big packets */
+#define MAXACKWINDOW 66000
+ (ackskew >= -MAXACKWINDOW) &&
+ (ackskew <= MAXACKWINDOW)) {
+ /* if ackskew < 0 then this should be due to fragented
+ * packets. There is no way to know the length of the
+ * total packet in advance.
+ * We do know the total length from the fragment cache though.
+ * Note however that there might be more sessions with
+ * exactly the same source and destination paramters in the
+ * state cache (and source and destination is the only stuff
+ * that is saved in the fragment cache). Note further that
+ * some TCP connections in the state cache are hashed with
+ * sport and dport as well which makes it not worthwhile to
+ * look for them.
+ * Thus, when ackskew is negative but still seems to belong
+ * to this session, we bump up the destinations end value.
+ */
+ /*
+ * Nearing end of connection, start timeout.
+ */
+ /* source ? 0 : 1 -> !source */
+ if (fr_tcp_age(&is->is_age, is->is_state, fin, !source,
+ (int)is->is_fsm) == 0) {
+ if (ackskew < 0)
+ tdata->td_end = ack;
+
+ /* update max window seen */
+ if (fdata->td_maxwin < win)
+ fdata->td_maxwin = win;
+ if (SEQ_GT(end, fdata->td_end))
+ fdata->td_end = end;
+ if (SEQ_GE(ack + win, tdata->td_maxend)) {
+ tdata->td_maxend = ack + win;
+ if (win == 0)
+ tdata->td_maxend++;
+ }
+
+ ATOMIC_INCL(ips_stats.iss_hits);
+ ret = 1;
+ }
+ }
+ MUTEX_EXIT(&is->is_lock);
+ if ((ret == 0) && ((tcp->th_flags & TH_OPENING) != TH_SYN))
+ fin->fin_misc |= FM_BADSTATE;
+ return ret;
+}
+
+
+/*
+ * Match a state table entry against an IP packet.
+ */
+static int fr_matchsrcdst(is, src, dst, fin, tcp)
+ipstate_t *is;
+union i6addr src, dst;
+fr_info_t *fin;
+tcphdr_t *tcp;
+{
+ int ret = 0, rev, out, flags, idx;
+ u_short sp, dp;
+ void *ifp;
+
+ rev = IP6NEQ(is->is_dst, dst);
+ ifp = fin->fin_ifp;
+ out = fin->fin_out;
+ flags = is->is_flags & (FI_WILDA|FI_WILDP);
+ sp = 0;
+ dp = 0;
+
+ if (tcp != NULL) {
+ flags = is->is_flags;
+ sp = tcp->th_sport;
+ dp = tcp->th_dport;
+ if (!rev) {
+ if (!(flags & FI_W_SPORT) && (sp != is->is_sport))
+ rev = 1;
+ else if (!(flags & FI_W_DPORT) && (dp != is->is_dport))
+ rev = 1;
+ }
+ }
+
+ idx = (out << 1) + rev;
+
+ if ((is->is_ifp[idx] == NULL &&
+ (*is->is_ifname[idx] == '\0' || *is->is_ifname[idx] == '*')) ||
+ is->is_ifp[idx] == ifp)
+ ret = 1;
+
+ if (ret == 0)
+ return 0;
+ ret = 0;
+
+ if (rev == 0) {
+ if ((IP6EQ(is->is_dst, dst) || (flags & FI_W_DADDR)) &&
+ (IP6EQ(is->is_src, src) || (flags & FI_W_SADDR)) &&
+ (!tcp || ((sp == is->is_sport || flags & FI_W_SPORT) &&
+ (dp == is->is_dport || flags & FI_W_DPORT)))) {
+ ret = 1;
+ }
+ } else {
+ if ((IP6EQ(is->is_dst, src) || (flags & FI_W_DADDR)) &&
+ (IP6EQ(is->is_src, dst) || (flags & FI_W_SADDR)) &&
+ (!tcp || ((sp == is->is_dport || flags & FI_W_DPORT) &&
+ (dp == is->is_sport || flags & FI_W_SPORT)))) {
+ ret = 1;
+ }
+ }
+ if (ret == 0)
+ return 0;
+
+ /*
+ * Whether or not this should be here, is questionable, but the aim
+ * is to get this out of the main line.
+ */
+ if (tcp == NULL)
+ flags = is->is_flags & (FI_CMP|(FI_CMP<<4));
+
+ if (((fin->fin_fl & (flags >> 4)) != (flags & FI_CMP)) ||
+ (fin->fin_fi.fi_optmsk != is->is_opt) ||
+ (fin->fin_fi.fi_secmsk != is->is_sec) ||
+ (fin->fin_fi.fi_auth != is->is_auth))
+ return 0;
+
+ flags = is->is_flags & (FI_WILDA|FI_WILDP);
+ if ((flags & (FI_W_SADDR|FI_W_DADDR))) {
+ if ((flags & FI_W_SADDR) != 0) {
+ if (rev == 0) {
+ is->is_src = fin->fin_fi.fi_src;
+ } else {
+ is->is_src = fin->fin_fi.fi_dst;
+ }
+ } else if ((flags & FI_W_DADDR) != 0) {
+ if (rev == 0) {
+ is->is_dst = fin->fin_fi.fi_dst;
+ } else {
+ is->is_dst = fin->fin_fi.fi_src;
+ }
+ }
+ is->is_flags &= ~(FI_W_SADDR|FI_W_DADDR);
+ if ((is->is_flags & (FI_WILDA|FI_WILDP)) == 0)
+ ips_wild--;
+ }
+
+ if ((flags & (FI_W_SPORT|FI_W_DPORT))) {
+ if ((flags & FI_W_SPORT) != 0) {
+ if (rev == 0) {
+ is->is_sport = sp;
+ is->is_send = htonl(tcp->th_seq);
+ } else {
+ is->is_sport = dp;
+ is->is_send = htonl(tcp->th_ack);
+ }
+ is->is_maxsend = is->is_send + 1;
+ } else if ((flags & FI_W_DPORT) != 0) {
+ if (rev == 0) {
+ is->is_dport = dp;
+ is->is_dend = htonl(tcp->th_ack);
+ } else {
+ is->is_dport = sp;
+ is->is_dend = htonl(tcp->th_seq);
+ }
+ is->is_maxdend = is->is_dend + 1;
+ }
+ is->is_flags &= ~(FI_W_SPORT|FI_W_DPORT);
+ ips_wild--;
+ }
+
+ ret = -1;
+
+ if (is->is_ifp[idx] == NULL &&
+ (*is->is_ifname[idx] == '\0' || *is->is_ifname[idx] == '*'))
+ ret = idx;
+
+ if (ret >= 0) {
+ is->is_ifp[ret] = ifp;
+ strncpy(is->is_ifname[ret], IFNAME(ifp),
+ sizeof(is->is_ifname[ret]));
+ }
+ fin->fin_rev = rev;
+ return 1;
+}
+
+static int fr_matchicmpqueryreply(v, is, icmp, rev)
+int v;
+ipstate_t *is;
+icmphdr_t *icmp;
+int rev;
+{
+ if (v == 4) {
+ /*
+ * If we matched its type on the way in, then when going out
+ * it will still be the same type.
+ */
+ if ((!rev && (icmp->icmp_type == is->is_type)) ||
+ (rev && (icmpreplytype4[is->is_type] == icmp->icmp_type))) {
+ if (icmp->icmp_type != ICMP_ECHOREPLY)
+ return 1;
+ if ((icmp->icmp_id == is->is_icmp.ics_id) &&
+ (icmp->icmp_seq == is->is_icmp.ics_seq))
+ return 1;
+ }
+ }
+#ifdef USE_INET6
+ else if (is->is_v == 6) {
+ if ((!rev && (icmp->icmp_type == is->is_type)) ||
+ (rev && (icmpreplytype6[is->is_type] == icmp->icmp_type))) {
+ if (icmp->icmp_type != ICMP6_ECHO_REPLY)
+ return 1;
+ if ((icmp->icmp_id == is->is_icmp.ics_id) &&
+ (icmp->icmp_seq == is->is_icmp.ics_seq))
+ return 1;
+ }
+ }
+#endif
+ return 0;
+}
+
+static frentry_t *fr_checkicmpmatchingstate(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ register ipstate_t *is, **isp;
+ register u_short sport, dport;
+ register u_char pr;
+ u_short savelen, ohlen;
+ union i6addr dst, src;
+ struct icmp *ic;
+ icmphdr_t *icmp;
+ fr_info_t ofin;
+ int type, len;
+ tcphdr_t *tcp;
+ frentry_t *fr;
+ ip_t *oip;
+ u_int hv;
+
+ /*
+ * Does it at least have the return (basic) IP header ?
+ * Only a basic IP header (no options) should be with
+ * an ICMP error header.
+ */
+ if (((ip->ip_v != 4) || (ip->ip_hl != 5)) ||
+ (fin->fin_plen < ICMPERR_MINPKTLEN))
+ return NULL;
+
+ ic = (struct icmp *)fin->fin_dp;
+ type = ic->icmp_type;
+ /*
+ * If it's not an error type, then return
+ */
+ if ((type != ICMP_UNREACH) && (type != ICMP_SOURCEQUENCH) &&
+ (type != ICMP_REDIRECT) && (type != ICMP_TIMXCEED) &&
+ (type != ICMP_PARAMPROB))
+ return NULL;
+
+ oip = (ip_t *)((char *)ic + ICMPERR_ICMPHLEN);
+ ohlen = oip->ip_hl << 2;
+ if (fin->fin_plen < ICMPERR_MAXPKTLEN + ohlen - sizeof(*oip))
+ return NULL;
+
+ /*
+ * Sanity checks.
+ */
+ len = fin->fin_dlen - ICMPERR_ICMPHLEN;
+ if ((len <= 0) || (ohlen > len))
+ return NULL;
+
+ /*
+ * Is the buffer big enough for all of it ? It's the size of the IP
+ * header claimed in the encapsulated part which is of concern. It
+ * may be too big to be in this buffer but not so big that it's
+ * outside the ICMP packet, leading to TCP deref's causing problems.
+ * This is possible because we don't know how big oip_hl is when we
+ * do the pullup early in fr_check() and thus can't gaurantee it is
+ * all here now.
+ */
+#ifdef _KERNEL
+ {
+ mb_t *m;
+
+# if SOLARIS
+ m = fin->fin_qfm;
+ if ((char *)oip + len > (char *)m->b_wptr)
+ return NULL;
+# else
+ m = *(mb_t **)fin->fin_mp;
+ if ((char *)oip + len > (char *)ip + m->m_len)
+ return NULL;
+# endif
+ }
+#endif
+
+ /*
+ * in the IPv4 case we must zero the i6addr union otherwise
+ * the IP6EQ and IP6NEQ macros produce the wrong results because
+ * of the 'junk' in the unused part of the union
+ */
+ bzero((char *)&src, sizeof(src));
+ bzero((char *)&dst, sizeof(dst));
+ bzero((char *)&ofin, sizeof(ofin));
+ ofin.fin_ifp = fin->fin_ifp;
+ ofin.fin_out = !fin->fin_out;
+ ofin.fin_v = 4;
+ fr = NULL;
+
+ switch (oip->ip_p)
+ {
+ case IPPROTO_ICMP :
+ icmp = (icmphdr_t *)((char *)oip + ohlen);
+
+ /*
+ * a ICMP error can only be generated as a result of an
+ * ICMP query, not as the response on an ICMP error
+ *
+ * XXX theoretically ICMP_ECHOREP and the other reply's are
+ * ICMP query's as well, but adding them here seems strange XXX
+ */
+ if ((icmp->icmp_type != ICMP_ECHO) &&
+ (icmp->icmp_type != ICMP_TSTAMP) &&
+ (icmp->icmp_type != ICMP_IREQ) &&
+ (icmp->icmp_type != ICMP_MASKREQ))
+ return NULL;
+
+ /*
+ * perform a lookup of the ICMP packet in the state table
+ */
+ hv = (pr = oip->ip_p);
+ src.in4 = oip->ip_src;
+ hv += src.in4.s_addr;
+ dst.in4 = oip->ip_dst;
+ hv += dst.in4.s_addr;
+ hv += icmp->icmp_id;
+ hv += icmp->icmp_seq;
+ hv %= fr_statesize;
+
+ savelen = oip->ip_len;
+ oip->ip_len = len;
+ fr_makefrip(ohlen, oip, &ofin);
+ oip->ip_len = savelen;
+
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hv]; (is = *isp); isp = &is->is_hnext)
+ if ((is->is_p == pr) && (is->is_v == 4) &&
+ fr_matchsrcdst(is, src, dst, &ofin, NULL) &&
+ fr_matchicmpqueryreply(is->is_v, is, icmp, fin->fin_rev)) {
+ ips_stats.iss_hits++;
+ is->is_pkts++;
+ is->is_bytes += ip->ip_len;
+ fr = is->is_rule;
+ break;
+ }
+ RWLOCK_EXIT(&ipf_state);
+ return fr;
+
+ case IPPROTO_TCP :
+ case IPPROTO_UDP :
+ if (fin->fin_plen < ICMPERR_MAXPKTLEN)
+ return NULL;
+ break;
+ default :
+ return NULL;
+ }
+
+ tcp = (tcphdr_t *)((char *)oip + ohlen);
+ dport = tcp->th_dport;
+ sport = tcp->th_sport;
+
+ hv = (pr = oip->ip_p);
+ src.in4 = oip->ip_src;
+ hv += src.in4.s_addr;
+ dst.in4 = oip->ip_dst;
+ hv += dst.in4.s_addr;
+ hv += dport;
+ hv += sport;
+ hv %= fr_statesize;
+ /*
+ * we make an fin entry to be able to feed it to
+ * matchsrcdst note that not all fields are encessary
+ * but this is the cleanest way. Note further we fill
+ * in fin_mp such that if someone uses it we'll get
+ * a kernel panic. fr_matchsrcdst does not use this.
+ *
+ * watch out here, as ip is in host order and oip in network
+ * order. Any change we make must be undone afterwards.
+ */
+ savelen = oip->ip_len;
+ oip->ip_len = len;
+ fr_makefrip(ohlen, oip, &ofin);
+ oip->ip_len = savelen;
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hv]; (is = *isp); isp = &is->is_hnext) {
+ /*
+ * Only allow this icmp though if the
+ * encapsulated packet was allowed through the
+ * other way around. Note that the minimal amount
+ * of info present does not allow for checking against
+ * tcp internals such as seq and ack numbers.
+ */
+ if ((is->is_p == pr) && (is->is_v == 4) &&
+ fr_matchsrcdst(is, src, dst, &ofin, tcp)) {
+ fr = is->is_rule;
+ ips_stats.iss_hits++;
+ is->is_pkts++;
+ is->is_bytes += fin->fin_plen;
+ /*
+ * we deliberately do not touch the timeouts
+ * for the accompanying state table entry.
+ * It remains to be seen if that is correct. XXX
+ */
+ break;
+ }
+ }
+ RWLOCK_EXIT(&ipf_state);
+ return fr;
+}
+
+
+/*
+ * Move a state hash table entry from its old location at is->is_hv to
+ * its new location, indexed by hv % fr_statesize.
+ */
+static void fr_ipsmove(isp, is, hv)
+ipstate_t **isp, *is;
+u_int hv;
+{
+ u_int hvm;
+
+ hvm = is->is_hv;
+ /*
+ * Remove the hash from the old location...
+ */
+ if (is->is_hnext)
+ is->is_hnext->is_phnext = isp;
+ *isp = is->is_hnext;
+ if (ips_table[hvm] == NULL)
+ ips_stats.iss_inuse--;
+
+ /*
+ * ...and put the hash in the new one.
+ */
+ hvm = hv % fr_statesize;
+ is->is_hv = hvm;
+ isp = &ips_table[hvm];
+ if (*isp)
+ (*isp)->is_phnext = &is->is_hnext;
+ else
+ ips_stats.iss_inuse++;
+ is->is_phnext = isp;
+ is->is_hnext = *isp;
+ *isp = is;
+}
+
+
+/*
+ * Check if a packet has a registered state.
+ */
+frentry_t *fr_checkstate(ip, fin)
+ip_t *ip;
+fr_info_t *fin;
+{
+ union i6addr dst, src;
+ register ipstate_t *is, **isp;
+ register u_char pr;
+ u_int hv, hvm, hlen, tryagain, pass, v;
+ struct icmp *ic;
+ frentry_t *fr;
+ tcphdr_t *tcp;
+ int rev;
+
+ if ((ips_list == NULL) || (fin->fin_off != 0) || fr_state_lock ||
+ (fin->fin_fl & FI_SHORT))
+ return NULL;
+
+ is = NULL;
+ hlen = fin->fin_hlen;
+ tcp = (tcphdr_t *)((char *)ip + hlen);
+ ic = (struct icmp *)tcp;
+ hv = (pr = fin->fin_fi.fi_p);
+ src = fin->fin_fi.fi_src;
+ dst = fin->fin_fi.fi_dst;
+ hv += src.in4.s_addr;
+ hv += dst.in4.s_addr;
+
+ /*
+ * Search the hash table for matching packet header info.
+ * At the bottom of this switch statement, the following is expected:
+ * is == NULL, no lock on ipf_state is held.
+ * is != NULL, a lock on ipf_state is held.
+ */
+ v = fin->fin_fi.fi_v;
+#ifdef USE_INET6
+ if (v == 6) {
+ hv += fin->fin_fi.fi_src.i6[1];
+ hv += fin->fin_fi.fi_src.i6[2];
+ hv += fin->fin_fi.fi_src.i6[3];
+
+ if ((fin->fin_p == IPPROTO_ICMPV6) &&
+ IN6_IS_ADDR_MULTICAST(&fin->fin_fi.fi_dst.in6)) {
+ hv -= dst.in4.s_addr;
+ } else {
+ hv += fin->fin_fi.fi_dst.i6[1];
+ hv += fin->fin_fi.fi_dst.i6[2];
+ hv += fin->fin_fi.fi_dst.i6[3];
+ }
+ }
+#endif
+
+ switch (fin->fin_p)
+ {
+#ifdef USE_INET6
+ case IPPROTO_ICMPV6 :
+ tcp = NULL;
+ tryagain = 0;
+ if (v == 6) {
+ if ((ic->icmp_type == ICMP6_ECHO_REQUEST) ||
+ (ic->icmp_type == ICMP6_ECHO_REPLY)) {
+ hv += ic->icmp_id;
+ hv += ic->icmp_seq;
+ }
+ }
+ READ_ENTER(&ipf_state);
+icmp6again:
+ hvm = hv % fr_statesize;
+ for (isp = &ips_table[hvm]; (is = *isp); isp = &is->is_hnext)
+ if ((is->is_p == pr) && (is->is_v == v) &&
+ fr_matchsrcdst(is, src, dst, fin, NULL) &&
+ fr_matchicmpqueryreply(v, is, ic, fin->fin_rev)) {
+ rev = fin->fin_rev;
+ if (is->is_frage[rev] != 0)
+ is->is_age = is->is_frage[rev];
+ else if (rev != 0)
+ is->is_age = fr_icmpacktimeout;
+ else
+ is->is_age = fr_icmptimeout;
+ break;
+ }
+
+ if (is != NULL) {
+ if (tryagain && !(is->is_flags & FI_W_DADDR)) {
+ hv += fin->fin_fi.fi_src.i6[0];
+ hv += fin->fin_fi.fi_src.i6[1];
+ hv += fin->fin_fi.fi_src.i6[2];
+ hv += fin->fin_fi.fi_src.i6[3];
+ fr_ipsmove(isp, is, hv);
+ MUTEX_DOWNGRADE(&ipf_state);
+ }
+ break;
+ }
+ RWLOCK_EXIT(&ipf_state);
+
+ /*
+ * No matching icmp state entry. Perhaps this is a
+ * response to another state entry.
+ */
+ if ((ips_wild != 0) && (v == 6) && (tryagain == 0) &&
+ !IN6_IS_ADDR_MULTICAST(&fin->fin_fi.fi_src.in6)) {
+ hv -= fin->fin_fi.fi_src.i6[0];
+ hv -= fin->fin_fi.fi_src.i6[1];
+ hv -= fin->fin_fi.fi_src.i6[2];
+ hv -= fin->fin_fi.fi_src.i6[3];
+ tryagain = 1;
+ WRITE_ENTER(&ipf_state);
+ goto icmp6again;
+ }
+
+ fr = fr_checkicmp6matchingstate((ip6_t *)ip, fin);
+ if (fr)
+ return fr;
+ break;
+#endif
+ case IPPROTO_ICMP :
+ tcp = NULL;
+ if (v == 4) {
+ hv += ic->icmp_id;
+ hv += ic->icmp_seq;
+ }
+ hvm = hv % fr_statesize;
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hvm]; (is = *isp); isp = &is->is_hnext)
+ if ((is->is_p == pr) && (is->is_v == v) &&
+ fr_matchsrcdst(is, src, dst, fin, NULL) &&
+ fr_matchicmpqueryreply(v, is, ic, fin->fin_rev)) {
+ rev = fin->fin_rev;
+ if (is->is_frage[rev] != 0)
+ is->is_age = is->is_frage[rev];
+ else if (fin->fin_rev)
+ is->is_age = fr_icmpacktimeout;
+ else
+ is->is_age = fr_icmptimeout;
+ break;
+ }
+
+ if (is != NULL)
+ break;
+ RWLOCK_EXIT(&ipf_state);
+ /*
+ * No matching icmp state entry. Perhaps this is a
+ * response to another state entry.
+ */
+ fr = fr_checkicmpmatchingstate(ip, fin);
+ if (fr)
+ return fr;
+ break;
+ case IPPROTO_TCP :
+ /*
+ * Just plain ignore RST flag set with either FIN or SYN.
+ */
+ if ((tcp->th_flags & TH_RST) &&
+ ((tcp->th_flags & (TH_FIN|TH_SYN|TH_RST)) != TH_RST))
+ break;
+ case IPPROTO_UDP :
+ {
+ register u_short dport, sport;
+
+ dport = tcp->th_dport;
+ sport = tcp->th_sport;
+ tryagain = 0;
+ hv += dport;
+ hv += sport;
+ READ_ENTER(&ipf_state);
+retry_tcpudp:
+ hvm = hv % fr_statesize;
+ for (isp = &ips_table[hvm]; (is = *isp); isp = &is->is_hnext)
+ if ((is->is_p == pr) && (is->is_v == v) &&
+ fr_matchsrcdst(is, src, dst, fin, tcp)) {
+ rev = fin->fin_rev;
+ if ((pr == IPPROTO_TCP)) {
+ if (!fr_tcpstate(is, fin, ip, tcp))
+ is = NULL;
+ } else if ((pr == IPPROTO_UDP)) {
+ if (is->is_frage[rev] != 0)
+ is->is_age = is->is_frage[rev];
+ else if (fin->fin_rev)
+ is->is_age = fr_udpacktimeout;
+ else
+ is->is_age = fr_udptimeout;
+ }
+ break;
+ }
+ if (is != NULL) {
+ if (tryagain &&
+ !(is->is_flags & (FI_WILDP|FI_WILDA))) {
+ hv += dport;
+ hv += sport;
+ fr_ipsmove(isp, is, hv);
+ MUTEX_DOWNGRADE(&ipf_state);
+ }
+ break;
+ }
+
+ RWLOCK_EXIT(&ipf_state);
+ if (!tryagain && ips_wild) {
+ hv -= dport;
+ hv -= sport;
+ tryagain = 1;
+ WRITE_ENTER(&ipf_state);
+ goto retry_tcpudp;
+ }
+ break;
+ }
+ default :
+ tcp = NULL;
+ hv %= fr_statesize;
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hv]; (is = *isp); isp = &is->is_hnext) {
+ if ((is->is_p == pr) && (is->is_v == v) &&
+ fr_matchsrcdst(is, src, dst, fin, NULL)) {
+ rev = fin->fin_rev;
+ if (is->is_frage[rev] != 0)
+ is->is_age = is->is_frage[rev];
+ else
+ is->is_age = fr_udptimeout;
+ break;
+ }
+ }
+ if (is == NULL) {
+ RWLOCK_EXIT(&ipf_state);
+ }
+ break;
+ }
+
+ if (is == NULL) {
+ ATOMIC_INCL(ips_stats.iss_miss);
+ return NULL;
+ }
+
+ MUTEX_ENTER(&is->is_lock);
+ is->is_bytes += fin->fin_plen;
+ ips_stats.iss_hits++;
+ is->is_pkts++;
+ MUTEX_EXIT(&is->is_lock);
+ fr = is->is_rule;
+ fin->fin_rule = is->is_rulen;
+ if (fr != NULL) {
+ fin->fin_group = fr->fr_group;
+ fin->fin_icode = fr->fr_icode;
+ }
+ fin->fin_fr = fr;
+ pass = is->is_pass;
+ RWLOCK_EXIT(&ipf_state);
+ if ((fin->fin_fl & FI_FRAG) && (pass & FR_KEEPFRAG))
+ ipfr_newfrag(ip, fin);
+#ifndef _KERNEL
+ if ((tcp != NULL) && (tcp->th_flags & TCP_CLOSE))
+ fr_delstate(is);
+#endif
+ return fr;
+}
+
+
+/*
+ * Sync. state entries. If interfaces come or go or just change position,
+ * this is needed.
+ */
+void ip_statesync(ifp)
+void *ifp;
+{
+ register ipstate_t *is;
+ int i;
+
+ WRITE_ENTER(&ipf_state);
+ for (is = ips_list; is; is = is->is_next) {
+ for (i = 0; i < 4; i++) {
+ if (is->is_ifp[i] == ifp) {
+ is->is_ifp[i] = GETUNIT(is->is_ifname[i],
+ is->is_v);
+ if (!is->is_ifp[i])
+ is->is_ifp[i] = (void *)-1;
+ }
+ }
+ }
+ RWLOCK_EXIT(&ipf_state);
+}
+
+
+/*
+ * Must always be called with fr_ipfstate held as a write lock.
+ */
+static void fr_delstate(is)
+ipstate_t *is;
+{
+ frentry_t *fr;
+
+ if (is->is_flags & (FI_WILDP|FI_WILDA))
+ ips_wild--;
+ if (is->is_next)
+ is->is_next->is_pnext = is->is_pnext;
+ *is->is_pnext = is->is_next;
+ if (is->is_hnext)
+ is->is_hnext->is_phnext = is->is_phnext;
+ *is->is_phnext = is->is_hnext;
+ if (ips_table[is->is_hv] == NULL)
+ ips_stats.iss_inuse--;
+ if (is->is_me)
+ *is->is_me = NULL;
+
+ fr = is->is_rule;
+ if (fr != NULL) {
+ fr->fr_ref--;
+ if (fr->fr_ref == 0) {
+ KFREE(fr);
+ }
+ }
+#ifdef _KERNEL
+ MUTEX_DESTROY(&is->is_lock);
+#endif
+ KFREE(is);
+ ips_num--;
+}
+
+
+/*
+ * Free memory in use by all state info. kept.
+ */
+void fr_stateunload()
+{
+ register ipstate_t *is;
+
+ WRITE_ENTER(&ipf_state);
+ while ((is = ips_list))
+ fr_delstate(is);
+ ips_stats.iss_inuse = 0;
+ ips_num = 0;
+ RWLOCK_EXIT(&ipf_state);
+ if (ips_table)
+ KFREES(ips_table, fr_statesize * sizeof(ipstate_t *));
+ ips_table = NULL;
+}
+
+
+/*
+ * Slowly expire held state for thingslike UDP and ICMP. Timeouts are set
+ * in expectation of this being called twice per second.
+ */
+void fr_timeoutstate()
+{
+ register ipstate_t *is, **isp;
+#if defined(_KERNEL) && !SOLARIS
+ int s;
+#endif
+
+ SPL_NET(s);
+ WRITE_ENTER(&ipf_state);
+ for (isp = &ips_list; (is = *isp); )
+ if (is->is_age && !--is->is_age) {
+ if (is->is_p == IPPROTO_TCP)
+ ips_stats.iss_fin++;
+ else
+ ips_stats.iss_expire++;
+#ifdef IPFILTER_LOG
+ ipstate_log(is, ISL_EXPIRE);
+#endif
+ fr_delstate(is);
+ } else
+ isp = &is->is_next;
+ if (fr_state_doflush) {
+ (void) fr_state_flush(2, 0);
+ fr_state_doflush = 0;
+ }
+ RWLOCK_EXIT(&ipf_state);
+ SPL_X(s);
+}
+
+
+/*
+ * Original idea freom Pradeep Krishnan for use primarily with NAT code.
+ * (pkrishna@netcom.com)
+ *
+ * Rewritten by Arjan de Vet <Arjan.deVet@adv.iae.nl>, 2000-07-29:
+ *
+ * - (try to) base state transitions on real evidence only,
+ * i.e. packets that are sent and have been received by ipfilter;
+ * diagram 18.12 of TCP/IP volume 1 by W. Richard Stevens was used.
+ *
+ * - deal with half-closed connections correctly;
+ *
+ * - store the state of the source in state[0] such that ipfstat
+ * displays the state as source/dest instead of dest/source; the calls
+ * to fr_tcp_age have been changed accordingly.
+ *
+ * Parameters:
+ *
+ * state[0] = state of source (host that initiated connection)
+ * state[1] = state of dest (host that accepted the connection)
+ *
+ * dir == 0 : a packet from source to dest
+ * dir == 1 : a packet from dest to source
+ *
+ */
+int fr_tcp_age(age, state, fin, dir, fsm)
+u_long *age;
+u_char *state;
+fr_info_t *fin;
+int dir, fsm;
+{
+ tcphdr_t *tcp = (tcphdr_t *)fin->fin_dp;
+ u_char flags = tcp->th_flags;
+ int dlen, ostate;
+ u_long newage;
+
+ ostate = state[1 - dir];
+
+ dlen = fin->fin_plen - fin->fin_hlen - (tcp->th_off << 2);
+
+ if (flags & TH_RST) {
+ if (!(tcp->th_flags & TH_PUSH) && !dlen) {
+ *age = fr_tcpclosed;
+ state[dir] = TCPS_CLOSED;
+ } else {
+ *age = fr_tcpclosewait;
+ state[dir] = TCPS_CLOSE_WAIT;
+ }
+ return 0;
+ }
+
+ newage = 0;
+
+ switch(state[dir])
+ {
+ case TCPS_CLOSED: /* 0 */
+ if ((flags & TH_OPENING) == TH_OPENING) {
+ /*
+ * 'dir' received an S and sends SA in response,
+ * CLOSED -> SYN_RECEIVED
+ */
+ state[dir] = TCPS_SYN_RECEIVED;
+ newage = fr_tcptimeout;
+ } else if ((flags & TH_OPENING) == TH_SYN) {
+ /* 'dir' sent S, CLOSED -> SYN_SENT */
+ state[dir] = TCPS_SYN_SENT;
+ newage = fr_tcptimeout;
+ }
+
+ /*
+ * It is apparently possible that a hosts sends two syncs
+ * before the remote party is able to respond with a SA. In
+ * such a case the remote server sometimes ACK's the second
+ * sync, and then responds with a SA. The following code
+ * is used to prevent this ack from being blocked.
+ *
+ * We do not reset the timeout here to fr_tcptimeout because
+ * a connection connect timeout does not renew after every
+ * packet that is sent. We need to set newage to something
+ * to indicate the packet has passed the check for its flags
+ * being valid in the TCP FSM.
+ */
+ else if ((ostate == TCPS_SYN_SENT) &&
+ ((flags & (TH_FIN|TH_SYN|TH_RST|TH_ACK)) == TH_ACK)) {
+ newage = *age;
+ }
+
+ /*
+ * The next piece of code makes it possible to get
+ * already established connections into the state table
+ * after a restart or reload of the filter rules; this
+ * does not work when a strict 'flags S keep state' is
+ * used for tcp connections of course, however, use a
+ * lower time-out so the state disappears quickly if
+ * the other side does not pick it up.
+ */
+ else if (!fsm &&
+ (flags & (TH_FIN|TH_SYN|TH_RST|TH_ACK)) == TH_ACK) {
+ /* we saw an A, guess 'dir' is in ESTABLISHED mode */
+ if (ostate == TCPS_CLOSED) {
+ state[dir] = TCPS_ESTABLISHED;
+ newage = fr_tcptimeout;
+ } else if (ostate == TCPS_ESTABLISHED) {
+ state[dir] = TCPS_ESTABLISHED;
+ newage = fr_tcpidletimeout;
+ }
+ }
+ /*
+ * TODO: besides regular ACK packets we can have other
+ * packets as well; it is yet to be determined how we
+ * should initialize the states in those cases
+ */
+ break;
+
+ case TCPS_LISTEN: /* 1 */
+ /* NOT USED */
+ break;
+
+ case TCPS_SYN_SENT: /* 2 */
+ if ((flags & ~(TH_ECN|TH_CWR)) == TH_SYN) {
+ /*
+ * A retransmitted SYN packet. We do not reset the
+ * timeout here to fr_tcptimeout because a connection
+ * connect timeout does not renew after every packet
+ * that is sent. We need to set newage to something
+ * to indicate the packet has passed the check for its
+ * flags being valid in the TCP FSM.
+ */
+ newage = *age;
+ } else if ((flags & (TH_SYN|TH_FIN|TH_ACK)) == TH_ACK) {
+ /*
+ * We see an A from 'dir' which is in SYN_SENT
+ * state: 'dir' sent an A in response to an SA
+ * which it received, SYN_SENT -> ESTABLISHED
+ */
+ state[dir] = TCPS_ESTABLISHED;
+ newage = fr_tcpidletimeout;
+ } else if (flags & TH_FIN) {
+ /*
+ * We see an F from 'dir' which is in SYN_SENT
+ * state and wants to close its side of the
+ * connection; SYN_SENT -> FIN_WAIT_1
+ */
+ state[dir] = TCPS_FIN_WAIT_1;
+ newage = fr_tcpidletimeout; /* or fr_tcptimeout? */
+ } else if ((flags & TH_OPENING) == TH_OPENING) {
+ /*
+ * We see an SA from 'dir' which is already in
+ * SYN_SENT state, this means we have a
+ * simultaneous open; SYN_SENT -> SYN_RECEIVED
+ */
+ state[dir] = TCPS_SYN_RECEIVED;
+ newage = fr_tcptimeout;
+ }
+ break;
+
+ case TCPS_SYN_RECEIVED: /* 3 */
+ if ((flags & (TH_SYN|TH_FIN|TH_ACK)) == TH_ACK) {
+ /*
+ * We see an A from 'dir' which was in SYN_RECEIVED
+ * state so it must now be in established state,
+ * SYN_RECEIVED -> ESTABLISHED
+ */
+ state[dir] = TCPS_ESTABLISHED;
+ newage = fr_tcpidletimeout;
+ } else if ((flags & ~(TH_ECN|TH_CWR)) == TH_OPENING) {
+ /*
+ * We see an SA from 'dir' which is already in
+ * SYN_RECEIVED state.
+ */
+ newage = fr_tcptimeout;
+ } else if (flags & TH_FIN) {
+ /*
+ * We see an F from 'dir' which is in SYN_RECEIVED
+ * state and wants to close its side of the connection;
+ * SYN_RECEIVED -> FIN_WAIT_1
+ */
+ state[dir] = TCPS_FIN_WAIT_1;
+ newage = fr_tcpidletimeout;
+ }
+ break;
+
+ case TCPS_ESTABLISHED: /* 4 */
+ if (flags & TH_FIN) {
+ /*
+ * 'dir' closed its side of the connection; this
+ * gives us a half-closed connection;
+ * ESTABLISHED -> FIN_WAIT_1
+ */
+ state[dir] = TCPS_FIN_WAIT_1;
+ newage = fr_tcphalfclosed;
+ } else if (flags & TH_ACK) {
+ /* an ACK, should we exclude other flags here? */
+ if (ostate == TCPS_FIN_WAIT_1) {
+ /*
+ * We know the other side did an active close,
+ * so we are ACKing the recvd FIN packet (does
+ * the window matching code guarantee this?)
+ * and go into CLOSE_WAIT state; this gives us
+ * a half-closed connection
+ */
+ state[dir] = TCPS_CLOSE_WAIT;
+ newage = fr_tcphalfclosed;
+ } else if (ostate < TCPS_CLOSE_WAIT)
+ /*
+ * Still a fully established connection,
+ * reset timeout
+ */
+ newage = fr_tcpidletimeout;
+ }
+ break;
+
+ case TCPS_CLOSE_WAIT: /* 5 */
+ if (flags & TH_FIN) {
+ /*
+ * Application closed and 'dir' sent a FIN, we're now
+ * going into LAST_ACK state
+ */
+ newage = fr_tcplastack;
+ state[dir] = TCPS_LAST_ACK;
+ } else {
+ /*
+ * We remain in CLOSE_WAIT because the other side has
+ * closed already and we did not close our side yet;
+ * reset timeout
+ */
+ newage = fr_tcphalfclosed;
+ }
+ break;
+
+ case TCPS_FIN_WAIT_1: /* 6 */
+ if ((flags & TH_ACK) && ostate > TCPS_CLOSE_WAIT) {
+ /*
+ * If the other side is not active anymore it has sent
+ * us a FIN packet that we are ack'ing now with an ACK;
+ * this means both sides have now closed the connection
+ * and we go into TIME_WAIT
+ */
+ /*
+ * XXX: how do we know we really are ACKing the FIN
+ * packet here? does the window code guarantee that?
+ */
+ state[dir] = TCPS_TIME_WAIT;
+ newage = fr_tcptimeout;
+ } else
+ /*
+ * We closed our side of the connection already but the
+ * other side is still active (ESTABLISHED/CLOSE_WAIT);
+ * continue with this half-closed connection
+ */
+ newage = fr_tcphalfclosed;
+ break;
+
+ case TCPS_CLOSING: /* 7 */
+ /* NOT USED */
+ break;
+
+ case TCPS_LAST_ACK: /* 8 */
+ if (flags & TH_ACK) {
+ if ((flags & TH_PUSH) || dlen)
+ /*
+ * There is still data to be delivered, reset
+ * timeout
+ */
+ newage = fr_tcplastack;
+ else
+ newage = *age;
+ }
+ /*
+ * We cannot detect when we go out of LAST_ACK state to CLOSED
+ * because that is based on the reception of ACK packets;
+ * ipfilter can only detect that a packet has been sent by a
+ * host
+ */
+ break;
+
+ case TCPS_FIN_WAIT_2: /* 9 */
+ /* NOT USED */
+ break;
+
+ case TCPS_TIME_WAIT: /* 10 */
+ newage = fr_tcptimeout; /* default 4 mins */
+ /* we're in 2MSL timeout now */
+ break;
+ }
+
+ if (newage != 0) {
+ *age = newage;
+ return 0;
+ }
+ return -1;
+}
+
+
+#ifdef IPFILTER_LOG
+void ipstate_log(is, type)
+struct ipstate *is;
+u_int type;
+{
+ struct ipslog ipsl;
+ void *items[1];
+ size_t sizes[1];
+ int types[1];
+
+ ipsl.isl_type = type;
+ ipsl.isl_pkts = is->is_pkts;
+ ipsl.isl_bytes = is->is_bytes;
+ ipsl.isl_src = is->is_src;
+ ipsl.isl_dst = is->is_dst;
+ ipsl.isl_p = is->is_p;
+ ipsl.isl_v = is->is_v;
+ ipsl.isl_flags = is->is_flags;
+ ipsl.isl_rulen = is->is_rulen;
+ ipsl.isl_group = is->is_group;
+ if (ipsl.isl_p == IPPROTO_TCP || ipsl.isl_p == IPPROTO_UDP) {
+ ipsl.isl_sport = is->is_sport;
+ ipsl.isl_dport = is->is_dport;
+ if (ipsl.isl_p == IPPROTO_TCP) {
+ ipsl.isl_state[0] = is->is_state[0];
+ ipsl.isl_state[1] = is->is_state[1];
+ }
+ } else if (ipsl.isl_p == IPPROTO_ICMP) {
+ ipsl.isl_itype = is->is_icmp.ics_type;
+ } else if (ipsl.isl_p == IPPROTO_ICMPV6) {
+ ipsl.isl_itype = is->is_icmp.ics_type;
+ } else {
+ ipsl.isl_ps.isl_filler[0] = 0;
+ ipsl.isl_ps.isl_filler[1] = 0;
+ }
+ items[0] = &ipsl;
+ sizes[0] = sizeof(ipsl);
+ types[0] = 0;
+
+ (void) ipllog(IPL_LOGSTATE, NULL, items, sizes, types, 1);
+}
+#endif
+
+
+#ifdef USE_INET6
+frentry_t *fr_checkicmp6matchingstate(ip, fin)
+ip6_t *ip;
+fr_info_t *fin;
+{
+ register ipstate_t *is, **isp;
+ register u_short sport, dport;
+ register u_char pr;
+ struct icmp6_hdr *ic, *oic;
+ union i6addr dst, src;
+ u_short savelen;
+ fr_info_t ofin;
+ tcphdr_t *tcp;
+ frentry_t *fr;
+ ip6_t *oip;
+ int type;
+ u_int hv;
+
+ /*
+ * Does it at least have the return (basic) IP header ?
+ * Only a basic IP header (no options) should be with
+ * an ICMP error header.
+ */
+ if ((fin->fin_v != 6) || (fin->fin_plen < ICMP6ERR_MINPKTLEN))
+ return NULL;
+ ic = (struct icmp6_hdr *)fin->fin_dp;
+ type = ic->icmp6_type;
+ /*
+ * If it's not an error type, then return
+ */
+ if ((type != ICMP6_DST_UNREACH) && (type != ICMP6_PACKET_TOO_BIG) &&
+ (type != ICMP6_TIME_EXCEEDED) && (type != ICMP6_PARAM_PROB))
+ return NULL;
+
+ oip = (ip6_t *)((char *)ic + ICMPERR_ICMPHLEN);
+ if (fin->fin_plen < sizeof(*oip))
+ return NULL;
+
+ if ((oip->ip6_nxt != IPPROTO_TCP) && (oip->ip6_nxt != IPPROTO_UDP) &&
+ (oip->ip6_nxt != IPPROTO_ICMPV6))
+ return NULL;
+
+ bzero((char *)&ofin, sizeof(ofin));
+ ofin.fin_out = !fin->fin_out;
+ ofin.fin_ifp = fin->fin_ifp;
+ ofin.fin_v = 6;
+
+ if (oip->ip6_nxt == IPPROTO_ICMPV6) {
+ oic = (struct icmp6_hdr *)(oip + 1);
+ /*
+ * a ICMP error can only be generated as a result of an
+ * ICMP query, not as the response on an ICMP error
+ *
+ * XXX theoretically ICMP_ECHOREP and the other reply's are
+ * ICMP query's as well, but adding them here seems strange XXX
+ */
+ if (!(oic->icmp6_type & ICMP6_INFOMSG_MASK))
+ return NULL;
+
+ /*
+ * perform a lookup of the ICMP packet in the state table
+ */
+ hv = (pr = oip->ip6_nxt);
+ src.in6 = oip->ip6_src;
+ hv += src.in4.s_addr;
+ dst.in6 = oip->ip6_dst;
+ hv += dst.in4.s_addr;
+ hv += oic->icmp6_id;
+ hv += oic->icmp6_seq;
+ hv %= fr_statesize;
+
+ oip->ip6_plen = ntohs(oip->ip6_plen);
+ fr_makefrip(sizeof(*oip), (ip_t *)oip, &ofin);
+ oip->ip6_plen = htons(oip->ip6_plen);
+
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hv]; (is = *isp); isp = &is->is_hnext)
+ if ((is->is_p == pr) &&
+ (oic->icmp6_id == is->is_icmp.ics_id) &&
+ (oic->icmp6_seq == is->is_icmp.ics_seq) &&
+ fr_matchsrcdst(is, src, dst, &ofin, NULL)) {
+ /*
+ * in the state table ICMP query's are stored
+ * with the type of the corresponding ICMP
+ * response. Correct here
+ */
+ if (((is->is_type == ICMP6_ECHO_REPLY) &&
+ (oic->icmp6_type == ICMP6_ECHO_REQUEST)) ||
+ (is->is_type - 1 == oic->icmp6_type )) {
+ ips_stats.iss_hits++;
+ is->is_pkts++;
+ is->is_bytes += fin->fin_plen;
+ return is->is_rule;
+ }
+ }
+ RWLOCK_EXIT(&ipf_state);
+
+ return NULL;
+ }
+
+ tcp = (tcphdr_t *)(oip + 1);
+ dport = tcp->th_dport;
+ sport = tcp->th_sport;
+
+ hv = (pr = oip->ip6_nxt);
+ src.in6 = oip->ip6_src;
+ hv += src.in4.s_addr;
+ hv += src.i6[1];
+ hv += src.i6[2];
+ hv += src.i6[3];
+ dst.in6 = oip->ip6_dst;
+ hv += dst.in4.s_addr;
+ hv += dst.i6[1];
+ hv += dst.i6[2];
+ hv += dst.i6[3];
+ hv += dport;
+ hv += sport;
+ hv %= fr_statesize;
+ /*
+ * we make an fin entry to be able to feed it to
+ * matchsrcdst note that not all fields are encessary
+ * but this is the cleanest way. Note further we fill
+ * in fin_mp such that if someone uses it we'll get
+ * a kernel panic. fr_matchsrcdst does not use this.
+ *
+ * watch out here, as ip is in host order and oip in network
+ * order. Any change we make must be undone afterwards.
+ */
+ savelen = oip->ip6_plen;
+ oip->ip6_plen = ip->ip6_plen - sizeof(*ip) - ICMPERR_ICMPHLEN;
+ fr_makefrip(sizeof(*oip), (ip_t *)oip, &ofin);
+ oip->ip6_plen = savelen;
+ READ_ENTER(&ipf_state);
+ for (isp = &ips_table[hv]; (is = *isp); isp = &is->is_hnext) {
+ /*
+ * Only allow this icmp though if the
+ * encapsulated packet was allowed through the
+ * other way around. Note that the minimal amount
+ * of info present does not allow for checking against
+ * tcp internals such as seq and ack numbers.
+ */
+ if ((is->is_p == pr) && (is->is_v == 6) &&
+ fr_matchsrcdst(is, src, dst, &ofin, tcp)) {
+ fr = is->is_rule;
+ ips_stats.iss_hits++;
+ is->is_pkts++;
+ is->is_bytes += fin->fin_plen;
+ /*
+ * we deliberately do not touch the timeouts
+ * for the accompanying state table entry.
+ * It remains to be seen if that is correct. XXX
+ */
+ RWLOCK_EXIT(&ipf_state);
+ return fr;
+ }
+ }
+ RWLOCK_EXIT(&ipf_state);
+ return NULL;
+}
+#endif
diff --git a/sys/contrib/ipfilter/netinet/ip_state.h b/sys/contrib/ipfilter/netinet/ip_state.h
new file mode 100644
index 0000000..bd21cbc
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ip_state.h
@@ -0,0 +1,212 @@
+/*
+ * Copyright (C) 1995-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ip_state.h 1.3 1/12/96 (C) 1995 Darren Reed
+ * $Id: ip_state.h,v 2.13.2.1 2000/07/08 02:15:35 darrenr Exp $
+ * $FreeBSD$
+ */
+#ifndef __IP_STATE_H__
+#define __IP_STATE_H__
+
+#if defined(__STDC__) || defined(__GNUC__)
+# define SIOCDELST _IOW('r', 61, struct ipstate *)
+#else
+# define SIOCDELST _IOW(r, 61, struct ipstate *)
+#endif
+
+#ifndef IPSTATE_SIZE
+# define IPSTATE_SIZE 5737
+#endif
+#ifndef IPSTATE_MAX
+# define IPSTATE_MAX 4013 /* Maximum number of states held */
+#endif
+
+#define PAIRS(s1,d1,s2,d2) ((((s1) == (s2)) && ((d1) == (d2))) ||\
+ (((s1) == (d2)) && ((d1) == (s2))))
+#define IPPAIR(s1,d1,s2,d2) PAIRS((s1).s_addr, (d1).s_addr, \
+ (s2).s_addr, (d2).s_addr)
+
+
+typedef struct udpstate {
+ u_short us_sport;
+ u_short us_dport;
+} udpstate_t;
+
+typedef struct icmpstate {
+ u_short ics_id;
+ u_short ics_seq;
+ u_char ics_type;
+} icmpstate_t;
+
+typedef struct tcpdata {
+ u_32_t td_end;
+ u_32_t td_maxend;
+ u_32_t td_maxwin;
+ u_char td_wscale;
+} tcpdata_t;
+
+typedef struct tcpstate {
+ u_short ts_sport;
+ u_short ts_dport;
+ tcpdata_t ts_data[2];
+ u_char ts_state[2];
+} tcpstate_t;
+
+typedef struct ipstate {
+ struct ipstate *is_next;
+ struct ipstate **is_pnext;
+ struct ipstate *is_hnext;
+ struct ipstate **is_phnext;
+ struct ipstate **is_me;
+ frentry_t *is_rule;
+ U_QUAD_T is_pkts;
+ U_QUAD_T is_bytes;
+ union i6addr is_src;
+ union i6addr is_dst;
+ void *is_ifp[4];
+ u_long is_age;
+ u_int is_frage[2]; /* age from filter rule, forward & reverse */
+ u_int is_pass;
+ u_char is_p; /* Protocol */
+ u_char is_v; /* IP version */
+ u_char is_fsm; /* 1 = following FSM, 0 = not */
+ u_char is_xxx; /* pad */
+ u_int is_hv; /* hash value for this in the table */
+ u_32_t is_rulen; /* rule number */
+ u_32_t is_flags; /* flags for this structure */
+ u_32_t is_opt; /* packet options set */
+ u_32_t is_optmsk; /* " " mask */
+ u_short is_sec; /* security options set */
+ u_short is_secmsk; /* " " mask */
+ u_short is_auth; /* authentication options set */
+ u_short is_authmsk; /* " " mask */
+ union {
+ icmpstate_t is_ics;
+ tcpstate_t is_ts;
+ udpstate_t is_us;
+ } is_ps;
+ u_32_t is_group;
+ char is_ifname[4][IFNAMSIZ];
+#if SOLARIS || defined(__sgi)
+ kmutex_t is_lock;
+#endif
+} ipstate_t;
+
+#define is_saddr is_src.in4.s_addr
+#define is_daddr is_dst.in4.s_addr
+#define is_icmp is_ps.is_ics
+#define is_type is_icmp.ics_type
+#define is_code is_icmp.ics_code
+#define is_tcp is_ps.is_ts
+#define is_udp is_ps.is_us
+#define is_send is_tcp.ts_data[0].td_end
+#define is_dend is_tcp.ts_data[1].td_end
+#define is_maxswin is_tcp.ts_data[0].td_maxwin
+#define is_maxdwin is_tcp.ts_data[1].td_maxwin
+#define is_swscale is_tcp.ts_data[0].td_wscale
+#define is_dwscale is_tcp.ts_data[1].td_wscale
+#define is_maxsend is_tcp.ts_data[0].td_maxend
+#define is_maxdend is_tcp.ts_data[1].td_maxend
+#define is_sport is_tcp.ts_sport
+#define is_dport is_tcp.ts_dport
+#define is_state is_tcp.ts_state
+#define is_ifpin is_ifp[0]
+#define is_ifpout is_ifp[2]
+
+#define TH_OPENING (TH_SYN|TH_ACK)
+/*
+ * is_flags:
+ * Bits 0 - 3 are use as a mask with the current packet's bits to check for
+ * whether it is short, tcp/udp, a fragment or the presence of IP options.
+ * Bits 4 - 7 are set from the initial packet and contain what the packet
+ * anded with bits 0-3 must match.
+ * Bits 8,9 are used to indicate wildcard source/destination port matching.
+ */
+
+typedef struct ipstate_save {
+ void *ips_next;
+ struct ipstate ips_is;
+ struct frentry ips_fr;
+} ipstate_save_t;
+
+#define ips_rule ips_is.is_rule
+
+
+typedef struct ipslog {
+ U_QUAD_T isl_pkts;
+ U_QUAD_T isl_bytes;
+ union i6addr isl_src;
+ union i6addr isl_dst;
+ u_short isl_type;
+ union {
+ u_short isl_filler[2];
+ u_short isl_ports[2];
+ u_short isl_icmp;
+ } isl_ps;
+ u_char isl_v;
+ u_char isl_p;
+ u_char isl_flags;
+ u_char isl_state[2];
+ u_32_t isl_rulen;
+ u_32_t isl_group;
+} ipslog_t;
+
+#define isl_sport isl_ps.isl_ports[0]
+#define isl_dport isl_ps.isl_ports[1]
+#define isl_itype isl_ps.isl_icmp
+
+#define ISL_NEW 0
+#define ISL_EXPIRE 0xffff
+#define ISL_FLUSH 0xfffe
+#define ISL_REMOVE 0xfffd
+
+
+typedef struct ips_stat {
+ u_long iss_hits;
+ u_long iss_miss;
+ u_long iss_max;
+ u_long iss_tcp;
+ u_long iss_udp;
+ u_long iss_icmp;
+ u_long iss_nomem;
+ u_long iss_expire;
+ u_long iss_fin;
+ u_long iss_active;
+ u_long iss_logged;
+ u_long iss_logfail;
+ u_long iss_inuse;
+ ipstate_t **iss_table;
+ ipstate_t *iss_list;
+} ips_stat_t;
+
+
+extern u_long fr_tcpidletimeout;
+extern u_long fr_tcpclosewait;
+extern u_long fr_tcplastack;
+extern u_long fr_tcptimeout;
+extern u_long fr_tcpclosed;
+extern u_long fr_tcphalfclosed;
+extern u_long fr_udptimeout;
+extern u_long fr_udpacktimeout;
+extern u_long fr_icmptimeout;
+extern u_long fr_icmpacktimeout;
+extern ipstate_t *ips_list;
+extern int fr_state_lock;
+extern int fr_stateinit __P((void));
+extern int fr_tcpstate __P((ipstate_t *, fr_info_t *, ip_t *, tcphdr_t *));
+extern ipstate_t *fr_addstate __P((ip_t *, fr_info_t *, ipstate_t **, u_int));
+extern frentry_t *fr_checkstate __P((ip_t *, fr_info_t *));
+extern void ip_statesync __P((void *));
+extern void fr_timeoutstate __P((void));
+extern int fr_tcp_age __P((u_long *, u_char *, fr_info_t *, int, int));
+extern void fr_stateunload __P((void));
+extern void ipstate_log __P((struct ipstate *, u_int));
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+extern int fr_state_ioctl __P((caddr_t, u_long, int));
+#else
+extern int fr_state_ioctl __P((caddr_t, int, int));
+#endif
+
+#endif /* __IP_STATE_H__ */
diff --git a/sys/contrib/ipfilter/netinet/ipl.h b/sys/contrib/ipfilter/netinet/ipl.h
new file mode 100644
index 0000000..d618986
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/ipl.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 1993-2002 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * @(#)ipl.h 1.21 6/5/96
+ * $FreeBSD$
+ */
+
+#ifndef __IPL_H__
+#define __IPL_H__
+
+#define IPL_VERSION "IP Filter: v3.4.31"
+
+#endif
diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c
new file mode 100644
index 0000000..f150003
--- /dev/null
+++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright 1999 Guido van Rooij. All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/conf.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <net/if.h>
+#include <netinet/in_systm.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#if (__FreeBSD_version >= 199511)
+# include <net/route.h>
+# include <netinet/ip_var.h>
+# include <netinet/tcp.h>
+# include <netinet/tcpip.h>
+#endif
+
+
+#include <netinet/ipl.h>
+#include <netinet/ip_compat.h>
+#include <netinet/ip_fil.h>
+#include <netinet/ip_state.h>
+#include <netinet/ip_nat.h>
+#include <netinet/ip_auth.h>
+#include <netinet/ip_frag.h>
+#include <netinet/ip_proxy.h>
+
+static dev_t ipf_devs[IPL_LOGMAX + 1];
+
+SYSCTL_DECL(_net_inet);
+SYSCTL_NODE(_net_inet, OID_AUTO, ipf, CTLFLAG_RW, 0, "IPF");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_flags, CTLFLAG_RW, &fr_flags, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_pass, CTLFLAG_RW, &fr_pass, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_active, CTLFLAG_RD, &fr_active, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcpidletimeout, CTLFLAG_RW,
+ &fr_tcpidletimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcpclosewait, CTLFLAG_RW,
+ &fr_tcpclosewait, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcplastack, CTLFLAG_RW,
+ &fr_tcplastack, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcptimeout, CTLFLAG_RW,
+ &fr_tcptimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcpclosed, CTLFLAG_RW,
+ &fr_tcpclosed, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_tcphalfclosed, CTLFLAG_RW,
+ &fr_tcphalfclosed, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_udptimeout, CTLFLAG_RW,
+ &fr_udptimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_udpacktimeout, CTLFLAG_RW,
+ &fr_udpacktimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_icmptimeout, CTLFLAG_RW,
+ &fr_icmptimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_icmpacktimeout, CTLFLAG_RW,
+ &fr_icmpacktimeout, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_defnatage, CTLFLAG_RW,
+ &fr_defnatage, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_ipfrttl, CTLFLAG_RW,
+ &fr_ipfrttl, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, ipl_unreach, CTLFLAG_RW,
+ &ipl_unreach, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_running, CTLFLAG_RD,
+ &fr_running, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authsize, CTLFLAG_RD,
+ &fr_authsize, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authused, CTLFLAG_RD,
+ &fr_authused, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_defaultauthage, CTLFLAG_RW,
+ &fr_defaultauthage, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_chksrc, CTLFLAG_RW, &fr_chksrc, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, ippr_ftp_pasvonly, CTLFLAG_RW,
+ &ippr_ftp_pasvonly, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_minttl, CTLFLAG_RW, &fr_minttl, 0, "");
+SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_minttllog, CTLFLAG_RW,
+ &fr_minttllog, 0, "");
+
+#define CDEV_MAJOR 79
+static struct cdevsw ipl_cdevsw = {
+ .d_open = iplopen,
+ .d_close = iplclose,
+ .d_read = iplread,
+ .d_ioctl = iplioctl,
+ .d_name = "ipl",
+ .d_maj = CDEV_MAJOR,
+};
+
+static int
+ipfilter_modevent(module_t mod, int type, void *unused)
+{
+ char *c;
+ int i, error = 0;
+
+ switch (type) {
+ case MOD_LOAD :
+
+ error = iplattach();
+ if (error)
+ break;
+
+ c = NULL;
+ for(i=strlen(IPL_NAME); i>0; i--)
+ if (IPL_NAME[i] == '/') {
+ c = &IPL_NAME[i+1];
+ break;
+ }
+ if (!c)
+ c = IPL_NAME;
+ ipf_devs[IPL_LOGIPF] =
+ make_dev(&ipl_cdevsw, IPL_LOGIPF, 0, 0, 0600, c);
+
+ c = NULL;
+ for(i=strlen(IPL_NAT); i>0; i--)
+ if (IPL_NAT[i] == '/') {
+ c = &IPL_NAT[i+1];
+ break;
+ }
+ if (!c)
+ c = IPL_NAT;
+ ipf_devs[IPL_LOGNAT] =
+ make_dev(&ipl_cdevsw, IPL_LOGNAT, 0, 0, 0600, c);
+
+ c = NULL;
+ for(i=strlen(IPL_STATE); i>0; i--)
+ if (IPL_STATE[i] == '/') {
+ c = &IPL_STATE[i+1];
+ break;
+ }
+ if (!c)
+ c = IPL_STATE;
+ ipf_devs[IPL_LOGSTATE] =
+ make_dev(&ipl_cdevsw, IPL_LOGSTATE, 0, 0, 0600, c);
+
+ c = NULL;
+ for(i=strlen(IPL_AUTH); i>0; i--)
+ if (IPL_AUTH[i] == '/') {
+ c = &IPL_AUTH[i+1];
+ break;
+ }
+ if (!c)
+ c = IPL_AUTH;
+ ipf_devs[IPL_LOGAUTH] =
+ make_dev(&ipl_cdevsw, IPL_LOGAUTH, 0, 0, 0600, c);
+
+ break;
+ case MOD_UNLOAD :
+ destroy_dev(ipf_devs[IPL_LOGIPF]);
+ destroy_dev(ipf_devs[IPL_LOGNAT]);
+ destroy_dev(ipf_devs[IPL_LOGSTATE]);
+ destroy_dev(ipf_devs[IPL_LOGAUTH]);
+ error = ipldetach();
+ break;
+ default:
+ error = EINVAL;
+ break;
+ }
+ return error;
+}
+
+static moduledata_t ipfiltermod = {
+ IPL_VERSION,
+ ipfilter_modevent,
+ 0
+};
+DECLARE_MODULE(ipfilter, ipfiltermod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
diff --git a/sys/contrib/ngatm/FREEBSD-upgrade b/sys/contrib/ngatm/FREEBSD-upgrade
new file mode 100644
index 0000000..d0846ba
--- /dev/null
+++ b/sys/contrib/ngatm/FREEBSD-upgrade
@@ -0,0 +1,14 @@
+$FreeBSD$
+
+This is the part of the NgATM stuff that is shared by kernel and user.
+Be careful to feed changes back to the maintainer <harti@freebsd.org>,
+because the code here is actually shared with other environments besides
+FreeBSD.
+
+Import should be done by:
+
+ cvs import \
+ -m "Virgin import of NgATM shared kernel/user part X.Y" \
+ src/sys/contrib/ngatm BEGEMOT NGATM_X_Y
+
+harti
OpenPOWER on IntegriCloud