Merge ACPICA 20130117.
This commit is contained in:
commit
efcc2a3054
@ -283,6 +283,7 @@ contrib/altq/altq/altq_rio.c optional altq
|
||||
contrib/altq/altq/altq_rmclass.c optional altq
|
||||
contrib/altq/altq/altq_subr.c optional altq
|
||||
contrib/dev/acpica/components/debugger/dbcmds.c optional acpi acpi_debug
|
||||
contrib/dev/acpica/components/debugger/dbconvert.c optional acpi acpi_debug
|
||||
contrib/dev/acpica/components/debugger/dbdisply.c optional acpi acpi_debug
|
||||
contrib/dev/acpica/components/debugger/dbexec.c optional acpi acpi_debug
|
||||
contrib/dev/acpica/components/debugger/dbfileio.c optional acpi acpi_debug
|
||||
@ -324,6 +325,7 @@ contrib/dev/acpica/components/events/evgpe.c optional acpi
|
||||
contrib/dev/acpica/components/events/evgpeblk.c optional acpi
|
||||
contrib/dev/acpica/components/events/evgpeinit.c optional acpi
|
||||
contrib/dev/acpica/components/events/evgpeutil.c optional acpi
|
||||
contrib/dev/acpica/components/events/evhandler.c optional acpi
|
||||
contrib/dev/acpica/components/events/evmisc.c optional acpi
|
||||
contrib/dev/acpica/components/events/evregion.c optional acpi
|
||||
contrib/dev/acpica/components/events/evrgnini.c optional acpi
|
||||
@ -376,6 +378,7 @@ contrib/dev/acpica/components/namespace/nsnames.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsobject.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsparse.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nspredef.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsprepkg.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsrepair.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsrepair2.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nssearch.c optional acpi
|
||||
@ -386,7 +389,9 @@ contrib/dev/acpica/components/namespace/nsxfname.c optional acpi
|
||||
contrib/dev/acpica/components/namespace/nsxfobj.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psargs.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psloop.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psobject.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psopcode.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psopinfo.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psparse.c optional acpi
|
||||
contrib/dev/acpica/components/parser/psscope.c optional acpi
|
||||
contrib/dev/acpica/components/parser/pstree.c optional acpi
|
||||
@ -397,6 +402,7 @@ contrib/dev/acpica/components/resources/rsaddr.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rscalc.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rscreate.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rsdump.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rsdumpinfo.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rsinfo.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rsio.c optional acpi
|
||||
contrib/dev/acpica/components/resources/rsirq.c optional acpi
|
||||
@ -431,8 +437,10 @@ contrib/dev/acpica/components/utilities/utmisc.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utmutex.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utobject.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utosi.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utownerid.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utresrc.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utstate.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utstring.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utxface.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utxferror.c optional acpi
|
||||
contrib/dev/acpica/components/utilities/utxfinit.c optional acpi
|
||||
|
@ -1,9 +1,155 @@
|
||||
----------------------------------------
|
||||
17 January 2013. Summary of changes for version 20130117:
|
||||
|
||||
|
||||
1) ACPICA Kernel-resident Subsystem:
|
||||
|
||||
Updated the AcpiGetSleepTypeData interface: Allow the \_Sx methods to
|
||||
return either 1 or 2 integers. Although the ACPI spec defines the \_Sx
|
||||
objects to return a package containing one integer, most BIOS code returns
|
||||
two integers and the previous code reflects that. However, we also need to
|
||||
support BIOS code that actually implements to the ACPI spec, and this
|
||||
change reflects this.
|
||||
|
||||
Fixed two issues with the ACPI_DEBUG_PRINT macros:
|
||||
1) Added the ACPI_DO_WHILE macro to the main DEBUG_PRINT helper macro for
|
||||
C compilers that require this support.
|
||||
2) Renamed the internal ACPI_DEBUG macro to ACPI_DO_DEBUG_PRINT since
|
||||
ACPI_DEBUG is already used by many of the various hosts.
|
||||
|
||||
Updated all ACPICA copyrights and signons to 2013. Added the 2013
|
||||
copyright to all module headers and signons, including the standard Linux
|
||||
header. This affects virtually every file in the ACPICA core subsystem,
|
||||
iASL compiler, all ACPICA utilities, and the test suites.
|
||||
|
||||
Example Code and Data Size: These are the sizes for the OS-independent
|
||||
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
|
||||
debug version of the code includes the debug output trace mechanism and
|
||||
has a much larger code and data size.
|
||||
|
||||
Previous Release:
|
||||
Non-Debug Version: 94.5K Code, 25.5K Data, 120.0K Total
|
||||
Debug Version: 182.2K Code, 74.9K Data, 257.1K Total
|
||||
Current Release:
|
||||
Non-Debug Version: 94.5K Code, 25.4K Data, 119.9K Total
|
||||
Debug Version: 182.3K Code, 75.0K Data, 257.3K Total
|
||||
|
||||
|
||||
2) iASL Compiler/Disassembler and Tools:
|
||||
|
||||
Generic Unix OSL: Use a buffer to eliminate multiple vfprintf()s and
|
||||
prevent a possible fault on some hosts. Some C libraries modify the arg
|
||||
pointer parameter to vfprintf making it difficult to call it twice in the
|
||||
AcpiOsVprintf function. Use a local buffer to workaround this issue. This
|
||||
does not affect the Windows OSL since the Win C library does not modify
|
||||
the arg pointer. Chao Guan, Bob Moore.
|
||||
|
||||
iASL: Fixed a possible infinite loop when the maximum error count is
|
||||
reached. If an output file other than the .AML file is specified (such as
|
||||
a listing file), and the maximum number of errors is reached, do not
|
||||
attempt to flush data to the output file(s) as the compiler is aborting.
|
||||
This can cause an infinite loop as the max error count code essentially
|
||||
keeps calling itself.
|
||||
|
||||
iASL/Disassembler: Added an option (-in) to ignore NOOP opcodes/operators.
|
||||
Implemented for both the compiler and the disassembler. Often, the NOOP
|
||||
opcode is used as padding for packages that are changed dynamically by the
|
||||
BIOS. When disassembled and recompiled, these NOOPs will cause syntax
|
||||
errors. This option causes the disassembler to ignore all NOOP opcodes
|
||||
(0xA3), and it also causes the compiler to ignore all ASL source code NOOP
|
||||
statements as well.
|
||||
|
||||
Debugger: Enhanced the Sleep command to execute all sleep states. This
|
||||
change allows Sleep to be invoked with no arguments and causes the
|
||||
debugger to execute all of the sleep states, 0-5, automatically.
|
||||
|
||||
----------------------------------------
|
||||
20 December 2012. Summary of changes for version 20121220:
|
||||
|
||||
1) ACPICA Kernel-resident Subsystem:
|
||||
|
||||
Implemented a new interface, AcpiWalkResourceBuffer. This interface is an
|
||||
alternate entry point for AcpiWalkResources and improves the usability of
|
||||
the resource manager by accepting as input a buffer containing the output
|
||||
of either a _CRS, _PRS, or _AEI method. The key functionality is that the
|
||||
input buffer is not deleted by this interface so that it can be used by
|
||||
the host later. See the ACPICA reference for details.
|
||||
|
||||
Interpreter: Add a warning if a 64-bit constant appears in a 32-bit table
|
||||
(DSDT version < 2). The constant will be truncated and this warning
|
||||
reflects that behavior.
|
||||
|
||||
Resource Manager: Add support for the new ACPI 5.0 wake bit in the IRQ,
|
||||
ExtendedInterrupt, and GpioInt descriptors. This change adds support to
|
||||
both get and set the new wake bit in these descriptors, separately from
|
||||
the existing share bit. Reported by Aaron Lu.
|
||||
|
||||
Interpreter: Fix Store() when an implicit conversion is not possible. For
|
||||
example, in the cases such as a store of a string to an existing package
|
||||
object, implement the store as a CopyObject(). This is a small departure
|
||||
from the ACPI specification which states that the control method should be
|
||||
aborted in this case. However, the ASLTS suite depends on this behavior.
|
||||
|
||||
Performance improvement for the various FUNCTION_TRACE and DEBUG_PRINT
|
||||
macros: check if debug output is currently enabled as soon as possible to
|
||||
minimize performance impact if debug is in fact not enabled.
|
||||
|
||||
Source code restructuring: Cleanup to improve modularity. The following
|
||||
new files have been added: dbconvert.c, evhandler.c, nsprepkg.c,
|
||||
psopinfo.c, psobject.c, rsdumpinfo.c, utstring.c, and utownerid.c.
|
||||
Associated makefiles and project files have been updated.
|
||||
|
||||
Changed an exception code for LoadTable operator. For the case where one
|
||||
of the input strings is too long, change the returned exception code from
|
||||
AE_BAD_PARAMETER to AE_AML_STRING_LIMIT.
|
||||
|
||||
Fixed a possible memory leak in dispatcher error path. On error, delete
|
||||
the mutex object created during method mutex creation. Reported by
|
||||
tim.gardner@canonical.com.
|
||||
|
||||
Example Code and Data Size: These are the sizes for the OS-independent
|
||||
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
|
||||
debug version of the code includes the debug output trace mechanism and
|
||||
has a much larger code and data size.
|
||||
|
||||
Previous Release:
|
||||
Non-Debug Version: 94.3K Code, 25.3K Data, 119.6K Total
|
||||
Debug Version: 175.5K Code, 74.5K Data, 250.0K Total
|
||||
Current Release:
|
||||
Non-Debug Version: 94.5K Code, 25.5K Data, 120.0K Total
|
||||
Debug Version: 182.2K Code, 74.9K Data, 257.1K Total
|
||||
|
||||
|
||||
2) iASL Compiler/Disassembler and Tools:
|
||||
|
||||
iASL: Disallow a method call as argument to the ObjectType ASL operator.
|
||||
This change tracks an errata to the ACPI 5.0 document. The AML grammar
|
||||
will not allow the interpreter to differentiate between a method and a
|
||||
method invocation when these are used as an argument to the ObjectType
|
||||
operator. The ACPI specification change is to disallow a method invocation
|
||||
(UserTerm) for the ObjectType operator.
|
||||
|
||||
Finish support for the TPM2 and CSRT tables in the headers, table
|
||||
compiler, and disassembler.
|
||||
|
||||
Unix user-space OSL: Fix a problem with WaitSemaphore where the timeout
|
||||
always expires immediately if the semaphore is not available. The original
|
||||
code was using a relative-time timeout, but sem_timedwait requires the use
|
||||
of an absolute time.
|
||||
|
||||
iASL: Added a remark if the Timer() operator is used within a 32-bit
|
||||
table. This operator returns a 64-bit time value that will be truncated
|
||||
within a 32-bit table.
|
||||
|
||||
iASL Source code restructuring: Cleanup to improve modularity. The
|
||||
following new files have been added: aslhex.c, aslxref.c, aslnamesp.c,
|
||||
aslmethod.c, and aslfileio.c. Associated makefiles and project files have
|
||||
been updated.
|
||||
|
||||
|
||||
----------------------------------------
|
||||
14 November 2012. Summary of changes for version 20121114:
|
||||
|
||||
This release is available at https://www.acpica.org/downloads
|
||||
The ACPI 5.0 specification is available at www.acpi.info
|
||||
|
||||
1) ACPICA Kernel-resident Subsystem:
|
||||
|
||||
Implemented a performance enhancement for ACPI/AML Package objects. This
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -69,11 +69,11 @@ extern int AslCompilerdebug;
|
||||
#endif
|
||||
|
||||
ACPI_STATUS
|
||||
LsDisplayNamespace (
|
||||
NsDisplayNamespace (
|
||||
void);
|
||||
|
||||
void
|
||||
LsSetupNsList (
|
||||
NsSetupNamespaceListing (
|
||||
void *Handle);
|
||||
|
||||
|
||||
@ -429,8 +429,8 @@ AdAmlDisassemble (
|
||||
{
|
||||
AcpiOsPrintf ("/**** Before second load\n");
|
||||
|
||||
LsSetupNsList (File);
|
||||
LsDisplayNamespace ();
|
||||
NsSetupNamespaceListing (File);
|
||||
NsDisplayNamespace ();
|
||||
AcpiOsPrintf ("*****/\n");
|
||||
}
|
||||
|
||||
@ -498,8 +498,8 @@ AdAmlDisassemble (
|
||||
if (AslCompilerdebug)
|
||||
{
|
||||
AcpiOsPrintf ("/**** After second load and resource conversion\n");
|
||||
LsSetupNsList (File);
|
||||
LsDisplayNamespace ();
|
||||
NsSetupNamespaceListing (File);
|
||||
NsDisplayNamespace ();
|
||||
AcpiOsPrintf ("*****/\n");
|
||||
|
||||
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
|
||||
@ -549,8 +549,8 @@ Cleanup:
|
||||
{
|
||||
if (AslCompilerdebug) /* Display final namespace, with transforms */
|
||||
{
|
||||
LsSetupNsList (File);
|
||||
LsDisplayNamespace ();
|
||||
NsSetupNamespaceListing (File);
|
||||
NsDisplayNamespace ();
|
||||
}
|
||||
|
||||
fclose (File);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -89,7 +89,7 @@ AcpiDmAddResourceToNamespace (
|
||||
UINT32 Length,
|
||||
UINT32 Offset,
|
||||
UINT8 ResourceIndex,
|
||||
void *Context);
|
||||
void **Context);
|
||||
|
||||
static void
|
||||
AcpiDmAddResourcesToNamespace (
|
||||
@ -993,7 +993,7 @@ AcpiDmAddResourcesToNamespace (
|
||||
*/
|
||||
AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
|
||||
(ACPI_SIZE) NextOp->Common.Value.Integer,
|
||||
AcpiDmAddResourceToNamespace, BufferNode);
|
||||
AcpiDmAddResourceToNamespace, (void **) BufferNode);
|
||||
}
|
||||
|
||||
|
||||
@ -1019,7 +1019,7 @@ AcpiDmAddResourceToNamespace (
|
||||
UINT32 Length,
|
||||
UINT32 Offset,
|
||||
UINT8 ResourceIndex,
|
||||
void *Context)
|
||||
void **Context)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_GENERIC_STATE ScopeInfo;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -281,7 +281,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
|
||||
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
|
||||
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
|
||||
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, NULL, NULL, "Core System Resource Table"},
|
||||
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
|
||||
{ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"},
|
||||
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
|
||||
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
|
||||
@ -310,6 +310,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
|
||||
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
|
||||
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
|
||||
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
|
||||
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
|
||||
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
|
||||
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -614,6 +614,7 @@ AcpiDmDumpCsrt (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CSRT_GROUP *SubTable;
|
||||
ACPI_CSRT_SHARED_INFO *SharedInfoTable;
|
||||
ACPI_CSRT_DESCRIPTOR *SubSubTable;
|
||||
UINT32 Length = Table->Length;
|
||||
UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
|
||||
@ -629,6 +630,8 @@ AcpiDmDumpCsrt (
|
||||
SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
|
||||
while (Offset < Table->Length)
|
||||
{
|
||||
/* Resource group subtable */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
Status = AcpiDmDumpTable (Length, Offset, SubTable,
|
||||
SubTable->Length, AcpiDmTableInfoCsrt0);
|
||||
@ -637,15 +640,23 @@ AcpiDmDumpCsrt (
|
||||
return;
|
||||
}
|
||||
|
||||
/* Shared info subtable (One per resource group) */
|
||||
|
||||
SubOffset = sizeof (ACPI_CSRT_GROUP);
|
||||
SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
|
||||
Offset + SubOffset);
|
||||
|
||||
/* Shared resource group info buffer */
|
||||
AcpiOsPrintf ("\n");
|
||||
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
|
||||
sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiDmDumpBuffer (SubTable, SubOffset, SubTable->InfoLength,
|
||||
Offset+SubOffset, "Shared Data");
|
||||
SubOffset += SubTable->InfoLength;
|
||||
SubOffset += SubTable->SharedInfoLength;
|
||||
|
||||
/* Sub-Sub-tables (Resource Descriptors) */
|
||||
/* Sub-Subtables (Resource Descriptors) */
|
||||
|
||||
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
|
||||
Offset + SubOffset);
|
||||
@ -655,7 +666,7 @@ AcpiDmDumpCsrt (
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
|
||||
SubSubTable->Length, AcpiDmTableInfoCsrt1);
|
||||
SubSubTable->Length, AcpiDmTableInfoCsrt2);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
@ -671,7 +682,7 @@ AcpiDmDumpCsrt (
|
||||
Offset + SubOffset + SubSubOffset, "ResourceInfo");
|
||||
SubSubOffset += InfoLength;
|
||||
|
||||
/* Point to next sub-sub-table */
|
||||
/* Point to next sub-subtable */
|
||||
|
||||
SubOffset += SubSubTable->Length;
|
||||
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -111,6 +111,7 @@
|
||||
#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
|
||||
#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
|
||||
#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
|
||||
#define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f)
|
||||
#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
|
||||
#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f)
|
||||
#define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f)
|
||||
@ -128,7 +129,8 @@
|
||||
#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
|
||||
#define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
|
||||
#define ACPI_CSRT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f)
|
||||
#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f)
|
||||
#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_SHARED_INFO,f)
|
||||
#define ACPI_CSRT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f)
|
||||
#define ACPI_DBG20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DBG2_DEVICE,f)
|
||||
#define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
|
||||
#define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
|
||||
@ -662,18 +664,38 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] =
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (SubdeviceId), "Subdevice ID", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Revision), "Revision", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (InfoLength), "InfoLength", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SharedInfoLength), "Shared Info Length", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* Resource Descriptor subtable */
|
||||
/* Shared Info subtable */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] =
|
||||
{
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Length), "Length", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Type), "Type", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Subtype), "Subtype", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Uid), "UID", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (MajorVersion), "Major Version", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (MinorVersion), "Minor Version", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MmioBaseLow), "MMIO Base Address Low", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MmioBaseHigh), "MMIO Base Address High", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (GsiInterrupt), "GSI Interrupt", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (InterruptPolarity), "Interrupt Polarity", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (InterruptMode), "Interrupt Mode", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (NumChannels), "Num Channels", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (DmaAddressWidth), "DMA Address Width", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (BaseRequestLine), "Base Request Line", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (NumHandshakeSignals), "Num Handshake Signals", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MaxBlockSize), "Max Block Size", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/* Resource Descriptor subtable */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] =
|
||||
{
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Type), "Type", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Subtype), "Subtype", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Uid), "UID", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
@ -1982,6 +2004,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[] =
|
||||
{
|
||||
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (Flags), "Flags", 0},
|
||||
{ACPI_DMT_UINT64, ACPI_TPM2_OFFSET (ControlAddress), "Control Address", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* UEFI - UEFI Boot optimization Table
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -617,7 +617,7 @@ CmDoCompile (
|
||||
/* Namespace cross-reference */
|
||||
|
||||
AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
|
||||
Status = LkCrossReferenceNamespace ();
|
||||
Status = XfCrossReferenceNamespace ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto ErrorExit;
|
||||
@ -639,8 +639,8 @@ CmDoCompile (
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n");
|
||||
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
|
||||
AnMethodAnalysisWalkBegin,
|
||||
AnMethodAnalysisWalkEnd, &AnalysisWalkInfo);
|
||||
MtMethodAnalysisWalkBegin,
|
||||
MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);
|
||||
UtEndEvent (Event);
|
||||
|
||||
/* Semantic error checking part two - typing of method returns */
|
||||
@ -719,11 +719,11 @@ CmDoOutputFiles (
|
||||
/* Create listings and hex files */
|
||||
|
||||
LsDoListings ();
|
||||
LsDoHexOutput ();
|
||||
HxDoHexOutput ();
|
||||
|
||||
/* Dump the namespace to the .nsp file if requested */
|
||||
|
||||
(void) LsDisplayNamespace ();
|
||||
(void) NsDisplayNamespace ();
|
||||
}
|
||||
|
||||
|
||||
@ -766,12 +766,12 @@ CmDumpAllEvents (
|
||||
|
||||
Delta = (UINT32) (Event->EndTime - Event->StartTime);
|
||||
|
||||
USec = Delta / 10;
|
||||
MSec = Delta / 10000;
|
||||
USec = Delta / ACPI_100NSEC_PER_USEC;
|
||||
MSec = Delta / ACPI_100NSEC_PER_MSEC;
|
||||
|
||||
/* Round milliseconds up */
|
||||
|
||||
if ((USec - (MSec * 1000)) >= 500)
|
||||
if ((USec - (MSec * ACPI_USEC_PER_MSEC)) >= 500)
|
||||
{
|
||||
MSec++;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -187,18 +187,6 @@ AnOperandTypecheckWalkEnd (
|
||||
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
|
||||
AnMethodTypingWalkEnd (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -206,6 +194,22 @@ AnMethodTypingWalkEnd (
|
||||
void *Context);
|
||||
|
||||
|
||||
/*
|
||||
* aslmethod - Control method analysis walk
|
||||
*/
|
||||
ACPI_STATUS
|
||||
MtMethodAnalysisWalkBegin (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
MtMethodAnalysisWalkEnd (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
|
||||
/*
|
||||
* aslbtypes - bitfield data types
|
||||
*/
|
||||
@ -341,6 +345,12 @@ void
|
||||
LsDoListings (
|
||||
void);
|
||||
|
||||
void
|
||||
LsDumpAsciiInComment (
|
||||
UINT32 FileId,
|
||||
UINT32 Count,
|
||||
UINT8 *Buffer);
|
||||
|
||||
void
|
||||
LsWriteNodeToAsmListing (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
@ -350,14 +360,19 @@ LsWriteNode (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 FileId);
|
||||
|
||||
void
|
||||
LsDoHexOutput (
|
||||
void);
|
||||
|
||||
void
|
||||
LsDumpParseTree (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslhex - generate all "hex" output files (C, ASM, ASL)
|
||||
*/
|
||||
void
|
||||
HxDoHexOutput (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslfold - constant folding
|
||||
*/
|
||||
@ -689,25 +704,33 @@ LdLoadNamespace (
|
||||
|
||||
|
||||
/*
|
||||
* asllookup - namespace cross reference
|
||||
* asllookup - namespace lookup functions
|
||||
*/
|
||||
ACPI_STATUS
|
||||
LkCrossReferenceNamespace (
|
||||
void);
|
||||
|
||||
void
|
||||
LkFindUnreferencedObjects (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslnamesp - namespace output file generation
|
||||
*/
|
||||
ACPI_STATUS
|
||||
LsDisplayNamespace (
|
||||
NsDisplayNamespace (
|
||||
void);
|
||||
|
||||
void
|
||||
LsSetupNsList (
|
||||
NsSetupNamespaceListing (
|
||||
void *Handle);
|
||||
|
||||
|
||||
/*
|
||||
* aslxref - namespace cross reference
|
||||
*/
|
||||
ACPI_STATUS
|
||||
XfCrossReferenceNamespace (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslutils - common compiler utilites
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -201,7 +201,7 @@ NamePathTail [.]{NameSeg}
|
||||
"Mutex" { count (2); return (PARSEOP_MUTEX); }
|
||||
"Name" { count (2); return (PARSEOP_NAME); }
|
||||
"NAnd" { count (3); return (PARSEOP_NAND); }
|
||||
"Noop" { count (3); return (PARSEOP_NOOP); }
|
||||
"Noop" { if (!AcpiGbl_IgnoreNoopOperator) {count (3); return (PARSEOP_NOOP);} }
|
||||
"NOr" { count (3); return (PARSEOP_NOR); }
|
||||
"Not" { count (3); return (PARSEOP_NOT); }
|
||||
"Notify" { count (3); return (PARSEOP_NOTIFY); }
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -661,6 +661,7 @@ void * AslLocalAllocate (unsigned int Size);
|
||||
/* Types */
|
||||
|
||||
%type <n> SuperName
|
||||
%type <n> ObjectTypeName
|
||||
%type <n> ArgTerm
|
||||
%type <n> LocalTerm
|
||||
%type <n> DebugTerm
|
||||
@ -1991,7 +1992,7 @@ NotTerm
|
||||
|
||||
ObjectTypeTerm
|
||||
: PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
|
||||
SuperName
|
||||
ObjectTypeName
|
||||
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
|
||||
| PARSEOP_OBJECTTYPE '('
|
||||
error ')' {$$ = AslDoError(); yyclearin;}
|
||||
@ -2439,6 +2440,18 @@ SuperName
|
||||
| LocalTerm {}
|
||||
| DebugTerm {}
|
||||
| Type6Opcode {}
|
||||
|
||||
/* For ObjectType: SuperName except for UserTerm (method invocation) */
|
||||
|
||||
ObjectTypeName
|
||||
: NameString {}
|
||||
| ArgTerm {}
|
||||
| LocalTerm {}
|
||||
| DebugTerm {}
|
||||
| RefOfTerm {}
|
||||
| DerefOfTerm {}
|
||||
| IndexTerm {}
|
||||
|
||||
/* | UserTerm {} */ /* Caused reduce/reduce with Type6Opcode->UserTerm */
|
||||
;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -660,7 +660,6 @@ AslCommonError (
|
||||
|
||||
Gbl_SourceLine = 0;
|
||||
Gbl_NextError = Gbl_ErrorLog;
|
||||
CmDoOutputFiles ();
|
||||
CmCleanupAndExit ();
|
||||
exit(1);
|
||||
}
|
||||
|
393
sys/contrib/dev/acpica/compiler/aslfileio.c
Normal file
393
sys/contrib/dev/acpica/compiler/aslfileio.c
Normal file
@ -0,0 +1,393 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslfileio - File I/O support
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslfileio")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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_STDERR);
|
||||
if (Gbl_DebugFlag)
|
||||
{
|
||||
/* Print error summary to stdout also */
|
||||
|
||||
AePrintErrorLog (ASL_FILE_STDOUT);
|
||||
}
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* DESCRIPTION: Open a file.
|
||||
* NOTE: Aborts compiler on any error.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
FlOpenFile (
|
||||
UINT32 FileId,
|
||||
char *Filename,
|
||||
char *Mode)
|
||||
{
|
||||
FILE *File;
|
||||
|
||||
|
||||
File = fopen (Filename, Mode);
|
||||
if (!File)
|
||||
{
|
||||
FlFileError (FileId, ASL_MSG_OPEN);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
Gbl_Files[FileId].Filename = Filename;
|
||||
Gbl_Files[FileId].Handle = File;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlGetFileSize
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: File Size
|
||||
*
|
||||
* DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId)
|
||||
{
|
||||
FILE *fp;
|
||||
UINT32 FileSize;
|
||||
long Offset;
|
||||
|
||||
|
||||
fp = Gbl_Files[FileId].Handle;
|
||||
Offset = ftell (fp);
|
||||
|
||||
fseek (fp, 0, SEEK_END);
|
||||
FileSize = (UINT32) ftell (fp);
|
||||
|
||||
/* Restore file pointer */
|
||||
|
||||
fseek (fp, Offset, SEEK_SET);
|
||||
return (FileSize);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* 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);
|
||||
va_end (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: None
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* 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);
|
||||
if (Error)
|
||||
{
|
||||
FlFileError (FileId, ASL_MSG_CLOSE);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
Gbl_Files[FileId].Handle = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlDeleteFile
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Delete a file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
FlDeleteFile (
|
||||
UINT32 FileId)
|
||||
{
|
||||
ASL_FILE_INFO *Info = &Gbl_Files[FileId];
|
||||
|
||||
|
||||
if (!Info->Filename)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (remove (Info->Filename))
|
||||
{
|
||||
printf ("%s (%s file) ",
|
||||
Info->Filename, Info->Description);
|
||||
perror ("Could not delete");
|
||||
}
|
||||
|
||||
Info->Filename = NULL;
|
||||
return;
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslfiles - file I/O suppoert
|
||||
* Module Name: aslfiles - File support functions
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -62,352 +62,6 @@ FlParseInputPathname (
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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_STDERR);
|
||||
if (Gbl_DebugFlag)
|
||||
{
|
||||
/* Print error summary to stdout also */
|
||||
|
||||
AePrintErrorLog (ASL_FILE_STDOUT);
|
||||
}
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* DESCRIPTION: Open a file.
|
||||
* NOTE: Aborts compiler on any error.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
FlOpenFile (
|
||||
UINT32 FileId,
|
||||
char *Filename,
|
||||
char *Mode)
|
||||
{
|
||||
FILE *File;
|
||||
|
||||
|
||||
File = fopen (Filename, Mode);
|
||||
if (!File)
|
||||
{
|
||||
FlFileError (FileId, ASL_MSG_OPEN);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
Gbl_Files[FileId].Filename = Filename;
|
||||
Gbl_Files[FileId].Handle = File;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlGetFileSize
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: File Size
|
||||
*
|
||||
* DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId)
|
||||
{
|
||||
FILE *fp;
|
||||
UINT32 FileSize;
|
||||
long Offset;
|
||||
|
||||
|
||||
fp = Gbl_Files[FileId].Handle;
|
||||
Offset = ftell (fp);
|
||||
|
||||
fseek (fp, 0, SEEK_END);
|
||||
FileSize = (UINT32) ftell (fp);
|
||||
|
||||
/* Restore file pointer */
|
||||
|
||||
fseek (fp, Offset, SEEK_SET);
|
||||
return (FileSize);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* 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);
|
||||
va_end (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: None
|
||||
*
|
||||
* 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: None
|
||||
*
|
||||
* 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);
|
||||
if (Error)
|
||||
{
|
||||
FlFileError (FileId, ASL_MSG_CLOSE);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
Gbl_Files[FileId].Handle = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlDeleteFile
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Delete a file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
FlDeleteFile (
|
||||
UINT32 FileId)
|
||||
{
|
||||
ASL_FILE_INFO *Info = &Gbl_Files[FileId];
|
||||
|
||||
|
||||
if (!Info->Filename)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (remove (Info->Filename))
|
||||
{
|
||||
printf ("%s (%s file) ",
|
||||
Info->Filename, Info->Description);
|
||||
perror ("Could not delete");
|
||||
}
|
||||
|
||||
Info->Filename = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlSetLineNumber
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
401
sys/contrib/dev/acpica/compiler/aslhex.c
Normal file
401
sys/contrib/dev/acpica/compiler/aslhex.c
Normal file
@ -0,0 +1,401 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslhex - ASCII hex output file generation (C, ASM, and ASL)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("ashex")
|
||||
|
||||
/*
|
||||
* This module emits ASCII hex output files in either C, ASM, or ASL format
|
||||
*/
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void
|
||||
HxDoHexOutputC (
|
||||
void);
|
||||
|
||||
static void
|
||||
HxDoHexOutputAsl (
|
||||
void);
|
||||
|
||||
static void
|
||||
HxDoHexOutputAsm (
|
||||
void);
|
||||
|
||||
static UINT32
|
||||
HxReadAmlOutputFile (
|
||||
UINT8 *Buffer);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: HxDoHexOutput
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file. Note: data is obtained by reading
|
||||
* the entire AML output file that was previously generated.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
HxDoHexOutput (
|
||||
void)
|
||||
{
|
||||
|
||||
switch (Gbl_HexOutputFlag)
|
||||
{
|
||||
case HEX_OUTPUT_C:
|
||||
|
||||
HxDoHexOutputC ();
|
||||
break;
|
||||
|
||||
case HEX_OUTPUT_ASM:
|
||||
|
||||
HxDoHexOutputAsm ();
|
||||
break;
|
||||
|
||||
case HEX_OUTPUT_ASL:
|
||||
|
||||
HxDoHexOutputAsl ();
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No other output types supported */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: HxReadAmlOutputFile
|
||||
*
|
||||
* PARAMETERS: Buffer - Where to return data
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Read a line of the AML output prior to formatting the data
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static UINT32
|
||||
HxReadAmlOutputFile (
|
||||
UINT8 *Buffer)
|
||||
{
|
||||
UINT32 Actual;
|
||||
|
||||
|
||||
Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
|
||||
if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
|
||||
{
|
||||
FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
return (Actual);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: HxDoHexOutputC
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
HxDoHexOutputC (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = HxReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: HxDoHexOutputAsl
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
HxDoHexOutputAsl (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = HxReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: HxDoHexOutputAsm
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
HxDoHexOutputAsm (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
|
||||
AmlFileSize);
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = HxReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the last byte of the line
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
|
||||
if ((i + 1) < LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -59,12 +59,6 @@ LsDumpAscii (
|
||||
UINT32 Count,
|
||||
UINT8 *Buffer);
|
||||
|
||||
static void
|
||||
LsDumpAsciiInComment (
|
||||
UINT32 FileId,
|
||||
UINT32 Count,
|
||||
UINT8 *Buffer);
|
||||
|
||||
static ACPI_STATUS
|
||||
LsAmlListingWalk (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -117,27 +111,57 @@ LsWriteNodeToListing (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 FileId);
|
||||
|
||||
static void
|
||||
LsDoHexOutputC (
|
||||
void);
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsm (
|
||||
void);
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void);
|
||||
|
||||
static ACPI_STATUS
|
||||
LsTreeWriteWalk (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
static UINT32
|
||||
LsReadAmlOutputFile (
|
||||
UINT8 *Buffer);
|
||||
#define ASL_LISTING_LINE_PREFIX ": "
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -147,7 +171,7 @@ LsReadAmlOutputFile (
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
*
|
||||
* RETURN: None.
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump entire parse tree, for compiler debug only
|
||||
*
|
||||
@ -196,7 +220,7 @@ LsDumpParseTree (
|
||||
* Count - Number of bytes to convert
|
||||
* Buffer - Buffer of bytes to convert
|
||||
*
|
||||
* RETURN: None.
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Convert hex bytes to ascii
|
||||
*
|
||||
@ -239,13 +263,13 @@ LsDumpAscii (
|
||||
* Count - Number of bytes to convert
|
||||
* Buffer - Buffer of bytes to convert
|
||||
*
|
||||
* RETURN: None.
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Convert hex bytes to ascii
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
void
|
||||
LsDumpAsciiInComment (
|
||||
UINT32 FileId,
|
||||
UINT32 Count,
|
||||
@ -372,50 +396,6 @@ LsGenerateListing (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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
|
||||
@ -687,7 +667,8 @@ LsWriteListingHexBytes (
|
||||
{
|
||||
case ASL_FILE_LISTING_OUTPUT:
|
||||
|
||||
FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset);
|
||||
FlPrintFile (FileId, "%8.8X%s", Gbl_CurrentAmlOffset,
|
||||
ASL_LISTING_LINE_PREFIX);
|
||||
break;
|
||||
|
||||
case ASL_FILE_ASM_SOURCE_OUTPUT:
|
||||
@ -747,6 +728,24 @@ LsWriteOneSourceLine (
|
||||
Gbl_SourceLine++;
|
||||
Gbl_ListingNode->LineNumber++;
|
||||
|
||||
/* Ignore lines that are completely blank (but count the line above) */
|
||||
|
||||
if (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) != AE_OK)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
if (FileByte == '\n')
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a non-empty line, we will print the entire line with
|
||||
* the line number and possibly other prefixes and transforms.
|
||||
*/
|
||||
|
||||
/* Line prefixes for special files, C and ASM output */
|
||||
|
||||
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
|
||||
{
|
||||
FlPrintFile (FileId, " *");
|
||||
@ -762,19 +761,21 @@ LsWriteOneSourceLine (
|
||||
* 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);
|
||||
FlPrintFile (FileId, "%12s %5d%s",
|
||||
Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber,
|
||||
ASL_LISTING_LINE_PREFIX);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No include files, just print the line number */
|
||||
|
||||
FlPrintFile (FileId, "%8d....", Gbl_SourceLine);
|
||||
FlPrintFile (FileId, "%8u%s", Gbl_SourceLine,
|
||||
ASL_LISTING_LINE_PREFIX);
|
||||
}
|
||||
|
||||
/* Read one line (up to a newline or EOF) */
|
||||
/* Read the rest of this line (up to a newline or EOF) */
|
||||
|
||||
while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK)
|
||||
do
|
||||
{
|
||||
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
|
||||
{
|
||||
@ -788,13 +789,15 @@ LsWriteOneSourceLine (
|
||||
if (FileByte == '\n')
|
||||
{
|
||||
/*
|
||||
* This line has been completed.
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
} while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK);
|
||||
|
||||
/* EOF on the input file was reached */
|
||||
|
||||
@ -1241,332 +1244,3 @@ LsWriteNodeToListing (
|
||||
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;
|
||||
|
||||
case HEX_OUTPUT_ASL:
|
||||
|
||||
LsDoHexOutputAsl ();
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No other output types supported */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsReadAmlOutputFile
|
||||
*
|
||||
* PARAMETERS: Buffer - Where to return data
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Read a line of the AML output prior to formatting the data
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static UINT32
|
||||
LsReadAmlOutputFile (
|
||||
UINT8 *Buffer)
|
||||
{
|
||||
UINT32 Actual;
|
||||
|
||||
|
||||
Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
|
||||
if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
|
||||
{
|
||||
FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
return (Actual);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
LsDoHexOutputC (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = LsReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoHexOutputAsl
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = LsReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsm (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
|
||||
AmlFileSize);
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = LsReadAmlOutputFile (FileData);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the last byte of the line
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
|
||||
if ((i + 1) < LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -153,6 +153,7 @@ Options (
|
||||
ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones");
|
||||
ACPI_OPTION ("-on", "Disable named reference string optimization");
|
||||
ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
|
||||
ACPI_OPTION ("-in", "Ignore NoOp operators");
|
||||
ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
|
||||
|
||||
printf ("\nASL Listing Files:\n");
|
||||
@ -172,6 +173,7 @@ Options (
|
||||
ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)");
|
||||
ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution");
|
||||
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
|
||||
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
|
||||
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
|
||||
|
||||
printf ("\nHelp:\n");
|
||||
@ -622,6 +624,13 @@ AslDoOptions (
|
||||
Gbl_C_IncludeOutputFlag = TRUE;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
|
||||
/* Compiler/Disassembler: Ignore the NOOP operator */
|
||||
|
||||
AcpiGbl_IgnoreNoopOperator = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown option: -i%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -190,6 +190,7 @@ typedef enum
|
||||
ASL_MSG_TAG_SMALLER,
|
||||
ASL_MSG_TIMEOUT,
|
||||
ASL_MSG_TOO_MANY_TEMPS,
|
||||
ASL_MSG_TRUNCATION,
|
||||
ASL_MSG_UNKNOWN_RESERVED_NAME,
|
||||
ASL_MSG_UNREACHABLE_CODE,
|
||||
ASL_MSG_UNSUPPORTED,
|
||||
@ -274,7 +275,7 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits",
|
||||
/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
|
||||
/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
|
||||
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating",
|
||||
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT version < 2)",
|
||||
/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
|
||||
/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
|
||||
/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
|
||||
@ -366,6 +367,7 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_TAG_SMALLER */ "ResourceTag smaller than Field",
|
||||
/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed",
|
||||
/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
|
||||
/* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT version < 2)",
|
||||
/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
|
||||
/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
|
||||
/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
|
||||
|
619
sys/contrib/dev/acpica/compiler/aslmethod.c
Normal file
619
sys/contrib/dev/acpica/compiler/aslmethod.c
Normal file
@ -0,0 +1,619 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslmethod.c - Control method analysis walk
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslmethod")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: MtMethodAnalysisWalkBegin
|
||||
*
|
||||
* 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
|
||||
MtMethodAnalysisWalkBegin (
|
||||
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_PARSE_OBJECT *ArgNode;
|
||||
ACPI_PARSE_OBJECT *NextType;
|
||||
ACPI_PARSE_OBJECT *NextParamType;
|
||||
UINT8 ActualArgs = 0;
|
||||
|
||||
|
||||
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 name node, ignored here */
|
||||
|
||||
Next = Op->Asl.Child;
|
||||
|
||||
/* Get the NumArguments node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
MethodInfo->NumArguments = (UINT8)
|
||||
(((UINT8) Next->Asl.Value.Integer) & 0x07);
|
||||
|
||||
/* Get the SerializeRule and SyncLevel nodes, ignored here */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
Next = Next->Asl.Next;
|
||||
ArgNode = Next;
|
||||
|
||||
/* Get the ReturnType node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
|
||||
NextType = Next->Asl.Child;
|
||||
while (NextType)
|
||||
{
|
||||
/* Get and map each of the ReturnTypes */
|
||||
|
||||
MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
|
||||
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
NextType = NextType->Asl.Next;
|
||||
}
|
||||
|
||||
/* Get the ParameterType node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
|
||||
NextType = Next->Asl.Child;
|
||||
while (NextType)
|
||||
{
|
||||
if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
NextParamType = NextType->Asl.Child;
|
||||
while (NextParamType)
|
||||
{
|
||||
MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
|
||||
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
NextParamType = NextParamType->Asl.Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo->ValidArgTypes[ActualArgs] =
|
||||
AnMapObjTypeToBtype (NextType);
|
||||
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
ActualArgs++;
|
||||
}
|
||||
|
||||
NextType = NextType->Asl.Next;
|
||||
}
|
||||
|
||||
if ((MethodInfo->NumArguments) &&
|
||||
(MethodInfo->NumArguments != ActualArgs))
|
||||
{
|
||||
/* error: Param list did not match number of args */
|
||||
}
|
||||
|
||||
/* Allow numarguments == 0 for Function() */
|
||||
|
||||
if ((!MethodInfo->NumArguments) && (ActualArgs))
|
||||
{
|
||||
MethodInfo->NumArguments = ActualArgs;
|
||||
ArgNode->Asl.Value.Integer |= ActualArgs;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
/*
|
||||
* Local was used outside a control method, or there was an error
|
||||
* in the method declaration.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
|
||||
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.
|
||||
*
|
||||
* The only operator that accepts an uninitialized value is ObjectType()
|
||||
*/
|
||||
else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
|
||||
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
|
||||
{
|
||||
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)
|
||||
{
|
||||
/*
|
||||
* Arg was used outside a control method, or there was an error
|
||||
* in the method declaration.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
|
||||
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.
|
||||
*
|
||||
* The only operator that accepts an uninitialized value is ObjectType()
|
||||
*/
|
||||
else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
|
||||
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
|
||||
{
|
||||
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_WARNING ((AE_INFO, "%p, No parent method", Op));
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* A child indicates a possible return value. A simple Return or
|
||||
* Return() is marked with NODE_IS_NULL_RETURN by the parser so
|
||||
* that it is not counted as a "real" return-with-value, although
|
||||
* the AML code that is actually emitted is Return(0). The AML
|
||||
* definition of Return has a required parameter, so we are
|
||||
* forced to convert a null return to Return(0).
|
||||
*/
|
||||
if ((Op->Asl.Child) &&
|
||||
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN)))
|
||||
{
|
||||
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_STALL:
|
||||
|
||||
/* We can range check if the argument is an integer */
|
||||
|
||||
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
|
||||
(Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, 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 = ApCheckForPredefinedName (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:
|
||||
|
||||
/* Typecheck any predefined names statically defined with Name() */
|
||||
|
||||
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
|
||||
|
||||
/* Special typechecking for _HID */
|
||||
|
||||
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
|
||||
{
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
AnCheckId (Next, ASL_TYPE_HID);
|
||||
}
|
||||
|
||||
/* Special typechecking for _CID */
|
||||
|
||||
else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
|
||||
{
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
|
||||
if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
|
||||
(Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
|
||||
{
|
||||
Next = Next->Asl.Child;
|
||||
while (Next)
|
||||
{
|
||||
AnCheckId (Next, ASL_TYPE_CID);
|
||||
Next = Next->Asl.Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AnCheckId (Next, ASL_TYPE_CID);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: MtMethodAnalysisWalkEnd
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Ascending callback for analysis walk. Complete method
|
||||
* return analysis.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
MtMethodAnalysisWalkEnd (
|
||||
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. Also, some special checks
|
||||
* For GPE and _REG methods.
|
||||
*/
|
||||
if (ApCheckForPredefinedMethod (Op, MethodInfo))
|
||||
{
|
||||
/* Special check for two names like _L01 and _E01 in same scope */
|
||||
|
||||
ApCheckForGpeNameConflict (Op);
|
||||
|
||||
/*
|
||||
* Special check for _REG: Must have an operation region definition
|
||||
* within the same scope!
|
||||
*/
|
||||
ApCheckRegMethod (Op);
|
||||
}
|
||||
|
||||
ACPI_FREE (MethodInfo);
|
||||
break;
|
||||
|
||||
|
||||
case PARSEOP_NAME:
|
||||
|
||||
/* Special check for two names like _L01 and _E01 in same scope */
|
||||
|
||||
ApCheckForGpeNameConflict (Op);
|
||||
break;
|
||||
|
||||
|
||||
case PARSEOP_RETURN:
|
||||
|
||||
/*
|
||||
* If the parent is a predefined method name, attempt to typecheck
|
||||
* the return value. Only static types can be validated.
|
||||
*/
|
||||
ApCheckPredefinedReturnValue (Op, MethodInfo);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/* Used in the "typing" pass later */
|
||||
|
||||
Op->Asl.ParentMethod = MethodInfo->Op;
|
||||
|
||||
/*
|
||||
* 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 preceding 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);
|
||||
}
|
422
sys/contrib/dev/acpica/compiler/aslnamesp.c
Normal file
422
sys/contrib/dev/acpica/compiler/aslnamesp.c
Normal file
@ -0,0 +1,422 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslnamesp - Namespace output file generation
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
#include <contrib/dev/acpica/include/acnamesp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslnamesp")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static ACPI_STATUS
|
||||
NsDoOneNamespaceObject (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
static ACPI_STATUS
|
||||
NsDoOnePathname (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: NsSetupNamespaceListing
|
||||
*
|
||||
* PARAMETERS: Handle - local file handle
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Set the namespace output file to the input handle
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
NsSetupNamespaceListing (
|
||||
void *Handle)
|
||||
{
|
||||
|
||||
Gbl_NsOutputFlag = TRUE;
|
||||
Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: NsDisplayNamespace
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Walk the namespace an display information about each node
|
||||
* in the tree. Information is written to the optional
|
||||
* namespace output file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
NsDisplayNamespace (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
if (!Gbl_NsOutputFlag)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
Gbl_NumNamespaceObjects = 0;
|
||||
|
||||
/* 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, NsDoOneNamespaceObject, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
/* Print the full pathname for each namespace node */
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: NsDoOneNamespaceObject
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
NsDoOneNamespaceObject (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
|
||||
|
||||
Gbl_NumNamespaceObjects++;
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
|
||||
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
|
||||
&Node->Name,
|
||||
AcpiUtGetTypeName (Node->Type));
|
||||
|
||||
Op = Node->Op;
|
||||
ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
|
||||
|
||||
if (!Op)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
if ((ObjDesc) &&
|
||||
(ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))
|
||||
{
|
||||
switch (Node->Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Initial Value 0x%8.8X%8.8X]",
|
||||
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Initial Value \"%s\"]",
|
||||
ObjDesc->String.Pointer);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Nothing to do for other types */
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Node->Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
|
||||
{
|
||||
Op = Op->Asl.Child;
|
||||
}
|
||||
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
|
||||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
|
||||
{
|
||||
Op = Op->Asl.Next;
|
||||
}
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Initial Value 0x%8.8X%8.8X]",
|
||||
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
|
||||
{
|
||||
Op = Op->Asl.Child;
|
||||
}
|
||||
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%04X Length 0x%04X bits]",
|
||||
Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
||||
switch (Op->Asl.ParseOpcode)
|
||||
{
|
||||
case PARSEOP_CREATEBYTEFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]");
|
||||
break;
|
||||
|
||||
case PARSEOP_CREATEDWORDFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]");
|
||||
break;
|
||||
|
||||
case PARSEOP_CREATEQWORDFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]");
|
||||
break;
|
||||
|
||||
case PARSEOP_CREATEWORDFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]");
|
||||
break;
|
||||
|
||||
case PARSEOP_CREATEBITFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]");
|
||||
break;
|
||||
|
||||
case PARSEOP_CREATEFIELD:
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
|
||||
{
|
||||
Op = Op->Asl.Child;
|
||||
}
|
||||
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
|
||||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
|
||||
{
|
||||
Op = Op->Asl.Next;
|
||||
}
|
||||
Op = Op->Asl.Child;
|
||||
|
||||
if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
|
||||
(Op->Asl.ParseOpcode == PARSEOP_RAW_DATA))
|
||||
{
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Initial Length 0x%.2X elements]",
|
||||
Op->Asl.Value.Integer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
|
||||
{
|
||||
Op = Op->Asl.Child;
|
||||
}
|
||||
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
|
||||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
|
||||
{
|
||||
Op = Op->Asl.Next;
|
||||
}
|
||||
Op = Op->Asl.Child;
|
||||
|
||||
if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
|
||||
{
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Initial Length 0x%.2X bytes]",
|
||||
Op->Asl.Value.Integer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Code Length 0x%.4X bytes]",
|
||||
Op->Asl.AmlSubtreeLength);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_RESOURCE:
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Desc Offset 0x%.4X Bytes]", Node->Value);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
" [Field Offset 0x%.4X Bits 0x%.4X Bytes] ",
|
||||
Node->Value, Node->Value / 8);
|
||||
|
||||
if (Node->Flags & ANOBJ_IS_REFERENCED)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
"Referenced");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
|
||||
"Name not referenced");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* Nothing to do for other types */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: NsDoOnePathname
|
||||
*
|
||||
* PARAMETERS: ACPI_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Print the full pathname for a namespace node.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
NsDoOnePathname (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_BUFFER TargetPath;
|
||||
|
||||
|
||||
TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
Status = AcpiNsHandleToPathname (Node, &TargetPath);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
|
||||
ACPI_FREE (TargetPath.Pointer);
|
||||
|
||||
return (AE_OK);
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -802,6 +802,14 @@ OpcGenerateAmlOpcode (
|
||||
Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
break;
|
||||
|
||||
case PARSEOP_TIMER:
|
||||
|
||||
if (AcpiGbl_IntegerBitWidth == 32)
|
||||
{
|
||||
AslError (ASL_REMARK, ASL_MSG_TRUNCATION, Op, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Nothing to do for other opcodes */
|
||||
break;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -305,7 +305,7 @@ OptBuildShortestPath (
|
||||
|
||||
for (i = 0; i < NumCarats; i++)
|
||||
{
|
||||
NewPathExternal[i] = '^';
|
||||
NewPathExternal[i] = AML_PARENT_PREFIX;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -329,7 +329,7 @@ OptBuildShortestPath (
|
||||
|
||||
if (Op->Asl.AmlOpcode == AML_SCOPE_OP)
|
||||
{
|
||||
NewPathExternal[i] = '^';
|
||||
NewPathExternal[i] = AML_PARENT_PREFIX;
|
||||
i++;
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)"));
|
||||
}
|
||||
@ -448,7 +448,7 @@ OptOptimizeNameDeclaration (
|
||||
|
||||
if (((CurrentNode == AcpiGbl_RootNode) ||
|
||||
(Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) &&
|
||||
(AmlNameString[0] == '\\'))
|
||||
(ACPI_IS_ROOT_PREFIX (AmlNameString[0])))
|
||||
{
|
||||
/*
|
||||
* The current scope is the root, and the namepath has a root prefix
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -66,6 +66,7 @@ ApCheckForSpecialName (
|
||||
|
||||
static void
|
||||
ApCheckObjectType (
|
||||
const char *PredefinedName,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 ExpectedBtypes);
|
||||
|
||||
@ -383,7 +384,8 @@ ApCheckPredefinedReturnValue (
|
||||
|
||||
/* Static data return object - check against expected type */
|
||||
|
||||
ApCheckObjectType (ReturnValueOp,
|
||||
ApCheckObjectType (PredefinedNames[Index].Info.Name,
|
||||
ReturnValueOp,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
break;
|
||||
|
||||
@ -482,7 +484,8 @@ ApCheckForPredefinedObject (
|
||||
|
||||
/* Typecheck the actual object, it is the next argument */
|
||||
|
||||
ApCheckObjectType (Op->Asl.Child->Asl.Next,
|
||||
ApCheckObjectType (PredefinedNames[Index].Info.Name,
|
||||
Op->Asl.Child->Asl.Next,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
return;
|
||||
}
|
||||
@ -640,7 +643,8 @@ ApCheckForSpecialName (
|
||||
*
|
||||
* FUNCTION: ApCheckObjectType
|
||||
*
|
||||
* PARAMETERS: Op - Current parse node
|
||||
* PARAMETERS: PredefinedName - Name of the predefined object we are checking
|
||||
* Op - Current parse node
|
||||
* ExpectedBtypes - Bitmap of expected return type(s)
|
||||
*
|
||||
* RETURN: None
|
||||
@ -653,6 +657,7 @@ ApCheckForSpecialName (
|
||||
|
||||
static void
|
||||
ApCheckObjectType (
|
||||
const char *PredefinedName,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 ExpectedBtypes)
|
||||
{
|
||||
@ -701,8 +706,8 @@ TypeErrorExit:
|
||||
|
||||
ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
|
||||
|
||||
sprintf (MsgBuffer, "found %s, requires %s",
|
||||
UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
|
||||
sprintf (MsgBuffer, "%s: found %s, requires %s",
|
||||
PredefinedName, UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
|
||||
MsgBuffer);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -341,7 +341,7 @@ AslDoOneFile (
|
||||
/* TBD: Handle additional output files for disassembler */
|
||||
|
||||
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
|
||||
LsDisplayNamespace ();
|
||||
NsDisplayNamespace ();
|
||||
#endif
|
||||
|
||||
/* Shutdown compiler and ACPICA subsystem */
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -826,7 +826,8 @@ UtAttachNameseg (
|
||||
/* No dots in the namepath, there is only a single nameseg. */
|
||||
/* Handle prefixes */
|
||||
|
||||
while ((*Name == '\\') || (*Name == '^'))
|
||||
while (ACPI_IS_ROOT_PREFIX (*Name) ||
|
||||
ACPI_IS_PARENT_PREFIX (*Name))
|
||||
{
|
||||
Name++;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,11 +1,11 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslwalks.c - major analytical parse tree walks
|
||||
* Module Name: aslwalks.c - Miscellaneous analytical parse tree walks
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -52,575 +52,6 @@
|
||||
ACPI_MODULE_NAME ("aslwalks")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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_PARSE_OBJECT *ArgNode;
|
||||
ACPI_PARSE_OBJECT *NextType;
|
||||
ACPI_PARSE_OBJECT *NextParamType;
|
||||
UINT8 ActualArgs = 0;
|
||||
|
||||
|
||||
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 name node, ignored here */
|
||||
|
||||
Next = Op->Asl.Child;
|
||||
|
||||
/* Get the NumArguments node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
MethodInfo->NumArguments = (UINT8)
|
||||
(((UINT8) Next->Asl.Value.Integer) & 0x07);
|
||||
|
||||
/* Get the SerializeRule and SyncLevel nodes, ignored here */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
Next = Next->Asl.Next;
|
||||
ArgNode = Next;
|
||||
|
||||
/* Get the ReturnType node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
|
||||
NextType = Next->Asl.Child;
|
||||
while (NextType)
|
||||
{
|
||||
/* Get and map each of the ReturnTypes */
|
||||
|
||||
MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
|
||||
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
NextType = NextType->Asl.Next;
|
||||
}
|
||||
|
||||
/* Get the ParameterType node */
|
||||
|
||||
Next = Next->Asl.Next;
|
||||
|
||||
NextType = Next->Asl.Child;
|
||||
while (NextType)
|
||||
{
|
||||
if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
NextParamType = NextType->Asl.Child;
|
||||
while (NextParamType)
|
||||
{
|
||||
MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
|
||||
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
NextParamType = NextParamType->Asl.Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo->ValidArgTypes[ActualArgs] =
|
||||
AnMapObjTypeToBtype (NextType);
|
||||
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
||||
ActualArgs++;
|
||||
}
|
||||
|
||||
NextType = NextType->Asl.Next;
|
||||
}
|
||||
|
||||
if ((MethodInfo->NumArguments) &&
|
||||
(MethodInfo->NumArguments != ActualArgs))
|
||||
{
|
||||
/* error: Param list did not match number of args */
|
||||
}
|
||||
|
||||
/* Allow numarguments == 0 for Function() */
|
||||
|
||||
if ((!MethodInfo->NumArguments) && (ActualArgs))
|
||||
{
|
||||
MethodInfo->NumArguments = ActualArgs;
|
||||
ArgNode->Asl.Value.Integer |= ActualArgs;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
/*
|
||||
* Local was used outside a control method, or there was an error
|
||||
* in the method declaration.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
|
||||
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.
|
||||
*
|
||||
* The only operator that accepts an uninitialized value is ObjectType()
|
||||
*/
|
||||
else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
|
||||
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
|
||||
{
|
||||
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)
|
||||
{
|
||||
/*
|
||||
* Arg was used outside a control method, or there was an error
|
||||
* in the method declaration.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
|
||||
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.
|
||||
*
|
||||
* The only operator that accepts an uninitialized value is ObjectType()
|
||||
*/
|
||||
else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
|
||||
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
|
||||
{
|
||||
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_WARNING ((AE_INFO, "%p, No parent method", Op));
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* A child indicates a possible return value. A simple Return or
|
||||
* Return() is marked with NODE_IS_NULL_RETURN by the parser so
|
||||
* that it is not counted as a "real" return-with-value, although
|
||||
* the AML code that is actually emitted is Return(0). The AML
|
||||
* definition of Return has a required parameter, so we are
|
||||
* forced to convert a null return to Return(0).
|
||||
*/
|
||||
if ((Op->Asl.Child) &&
|
||||
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN)))
|
||||
{
|
||||
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_STALL:
|
||||
|
||||
/* We can range check if the argument is an integer */
|
||||
|
||||
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
|
||||
(Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, 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 = ApCheckForPredefinedName (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:
|
||||
|
||||
/* Typecheck any predefined names statically defined with Name() */
|
||||
|
||||
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
|
||||
|
||||
/* Special typechecking for _HID */
|
||||
|
||||
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
|
||||
{
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
AnCheckId (Next, ASL_TYPE_HID);
|
||||
}
|
||||
|
||||
/* Special typechecking for _CID */
|
||||
|
||||
else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
|
||||
{
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
|
||||
if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
|
||||
(Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
|
||||
{
|
||||
Next = Next->Asl.Child;
|
||||
while (Next)
|
||||
{
|
||||
AnCheckId (Next, ASL_TYPE_CID);
|
||||
Next = Next->Asl.Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AnCheckId (Next, ASL_TYPE_CID);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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. Also, some special checks
|
||||
* For GPE and _REG methods.
|
||||
*/
|
||||
if (ApCheckForPredefinedMethod (Op, MethodInfo))
|
||||
{
|
||||
/* Special check for two names like _L01 and _E01 in same scope */
|
||||
|
||||
ApCheckForGpeNameConflict (Op);
|
||||
|
||||
/*
|
||||
* Special check for _REG: Must have an operation region definition
|
||||
* within the same scope!
|
||||
*/
|
||||
ApCheckRegMethod (Op);
|
||||
}
|
||||
|
||||
ACPI_FREE (MethodInfo);
|
||||
break;
|
||||
|
||||
|
||||
case PARSEOP_NAME:
|
||||
|
||||
/* Special check for two names like _L01 and _E01 in same scope */
|
||||
|
||||
ApCheckForGpeNameConflict (Op);
|
||||
break;
|
||||
|
||||
|
||||
case PARSEOP_RETURN:
|
||||
|
||||
/*
|
||||
* If the parent is a predefined method name, attempt to typecheck
|
||||
* the return value. Only static types can be validated.
|
||||
*/
|
||||
ApCheckPredefinedReturnValue (Op, MethodInfo);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/* Used in the "typing" pass later */
|
||||
|
||||
Op->Asl.ParentMethod = MethodInfo->Op;
|
||||
|
||||
/*
|
||||
* 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 preceding 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: AnMethodTypingWalkEnd
|
||||
|
874
sys/contrib/dev/acpica/compiler/aslxref.c
Normal file
874
sys/contrib/dev/acpica/compiler/aslxref.c
Normal file
@ -0,0 +1,874 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslxref - Namespace cross-reference
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
#include <contrib/dev/acpica/include/acparser.h>
|
||||
#include <contrib/dev/acpica/include/amlcode.h>
|
||||
#include <contrib/dev/acpica/include/acnamesp.h>
|
||||
#include <contrib/dev/acpica/include/acdispat.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslxref")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static ACPI_STATUS
|
||||
XfNamespaceLocateBegin (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
static ACPI_STATUS
|
||||
XfNamespaceLocateEnd (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
static BOOLEAN
|
||||
XfObjectExists (
|
||||
char *Name);
|
||||
|
||||
static ACPI_STATUS
|
||||
XfCompareOneNamespaceObject (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
static void
|
||||
XfCheckFieldRange (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 RegionBitLength,
|
||||
UINT32 FieldBitOffset,
|
||||
UINT32 FieldBitLength,
|
||||
UINT32 AccessBitWidth);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: XfCrossReferenceNamespace
|
||||
*
|
||||
* 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
|
||||
XfCrossReferenceNamespace (
|
||||
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, XfNamespaceLocateBegin,
|
||||
XfNamespaceLocateEnd, WalkState);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: XfObjectExists
|
||||
*
|
||||
* PARAMETERS: Name - 4 char ACPI name
|
||||
*
|
||||
* RETURN: TRUE if name exists in namespace
|
||||
*
|
||||
* DESCRIPTION: Walk the namespace to find an object
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static BOOLEAN
|
||||
XfObjectExists (
|
||||
char *Name)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Walk entire namespace from the supplied root */
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL,
|
||||
Name, NULL);
|
||||
if (Status == AE_CTRL_TRUE)
|
||||
{
|
||||
/* At least one instance of the name was found */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: XfCompareOneNamespaceObject
|
||||
*
|
||||
* PARAMETERS: ACPI_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Compare name of one object.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
XfCompareOneNamespaceObject (
|
||||
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: XfCheckFieldRange
|
||||
*
|
||||
* 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
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
XfCheckFieldRange (
|
||||
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: XfNamespaceLocateBegin
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
XfNamespaceLocateBegin (
|
||||
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 Offset;
|
||||
UINT32 FieldBitLength;
|
||||
UINT32 TagBitLength;
|
||||
UINT8 Message = 0;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
UINT32 Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, 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);
|
||||
}
|
||||
|
||||
/*
|
||||
* One special case: CondRefOf operator - we don't care if the name exists
|
||||
* or not at this point, just ignore it, the point of the operator is to
|
||||
* determine if the name exists at runtime.
|
||||
*/
|
||||
if ((Op->Asl.Parent) &&
|
||||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
|
||||
{
|
||||
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 nearly 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 (XfObjectExists (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);
|
||||
}
|
||||
|
||||
/* Check for a reference vs. name declaration */
|
||||
|
||||
if (!(OpInfo->Flags & AML_NAMED) &&
|
||||
!(OpInfo->Flags & AML_CREATE))
|
||||
{
|
||||
/* This node has been referenced, mark it for reference check */
|
||||
|
||||
Node->Flags |= ANOBJ_IS_REFERENCED;
|
||||
}
|
||||
|
||||
/* Attempt to optimize the NamePath */
|
||||
|
||||
OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
|
||||
|
||||
/*
|
||||
* 1) 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 = Node->Op;
|
||||
|
||||
/* The first child is the alias target op */
|
||||
|
||||
NextOp = NextOp->Asl.Child;
|
||||
|
||||
/* That in turn points back to original target alias node */
|
||||
|
||||
if (NextOp->Asl.Node)
|
||||
{
|
||||
Node = NextOp->Asl.Node;
|
||||
}
|
||||
|
||||
/* Else - forward reference to alias, will be resolved later */
|
||||
}
|
||||
|
||||
/* 2) Check for a reference to a resource descriptor */
|
||||
|
||||
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
|
||||
*/
|
||||
Offset = Node->Value;
|
||||
TagBitLength = Node->Length;
|
||||
|
||||
/*
|
||||
* If a field is being created, generate the length (in bits) of
|
||||
* the field. Note: Opcodes other than CreateXxxField and Index
|
||||
* can come through here. For other opcodes, we just need to
|
||||
* convert the resource tag reference to an integer offset.
|
||||
*/
|
||||
switch (Op->Asl.Parent->Asl.AmlOpcode)
|
||||
{
|
||||
case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */
|
||||
/*
|
||||
* We know the length operand is an integer constant because
|
||||
* we know that it contains a reference to a resource
|
||||
* descriptor tag.
|
||||
*/
|
||||
FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case AML_CREATE_BIT_FIELD_OP:
|
||||
FieldBitLength = 1;
|
||||
break;
|
||||
|
||||
case AML_CREATE_BYTE_FIELD_OP:
|
||||
case AML_INDEX_OP:
|
||||
FieldBitLength = 8;
|
||||
break;
|
||||
|
||||
case AML_CREATE_WORD_FIELD_OP:
|
||||
FieldBitLength = 16;
|
||||
break;
|
||||
|
||||
case AML_CREATE_DWORD_FIELD_OP:
|
||||
FieldBitLength = 32;
|
||||
break;
|
||||
|
||||
case AML_CREATE_QWORD_FIELD_OP:
|
||||
FieldBitLength = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
FieldBitLength = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check the field length against the length of the resource tag */
|
||||
|
||||
if (FieldBitLength)
|
||||
{
|
||||
if (TagBitLength < FieldBitLength)
|
||||
{
|
||||
Message = ASL_MSG_TAG_SMALLER;
|
||||
}
|
||||
else if (TagBitLength > FieldBitLength)
|
||||
{
|
||||
Message = ASL_MSG_TAG_LARGER;
|
||||
}
|
||||
|
||||
if (Message)
|
||||
{
|
||||
sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
|
||||
TagBitLength, (TagBitLength > 1) ? "s" : "",
|
||||
FieldBitLength, (FieldBitLength > 1) ? "s" : "");
|
||||
|
||||
AslError (ASL_WARNING, Message, Op, MsgBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert the BitOffset to a ByteOffset for certain opcodes */
|
||||
|
||||
switch (Op->Asl.Parent->Asl.AmlOpcode)
|
||||
{
|
||||
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:
|
||||
|
||||
Offset = ACPI_DIV_8 (Offset);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now convert this node to an integer whose value is the field offset */
|
||||
|
||||
Op->Asl.AmlLength = 0;
|
||||
Op->Asl.ParseOpcode = PARSEOP_INTEGER;
|
||||
Op->Asl.Value.Integer = (UINT64) Offset;
|
||||
Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
|
||||
|
||||
OpcGenerateAmlOpcode (Op);
|
||||
}
|
||||
|
||||
/* 3) 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))
|
||||
{
|
||||
|
||||
/*
|
||||
* A reference to a method within one of these opcodes is not an
|
||||
* invocation of the method, it is simply a reference to the method.
|
||||
*/
|
||||
if ((Op->Asl.Parent) &&
|
||||
((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) ||
|
||||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) ||
|
||||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
/*
|
||||
* 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->Value != ASL_EXTERNAL_METHOD)
|
||||
{
|
||||
/*
|
||||
* Check the parsed arguments with the number expected by the
|
||||
* method declaration itself
|
||||
*/
|
||||
if (PassedArgs != Node->Value)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
|
||||
Node->Value);
|
||||
|
||||
if (PassedArgs < Node->Value)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 4) 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 = Node->Op;
|
||||
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 ACPI_ADR_SPACE_EC:
|
||||
case ACPI_ADR_SPACE_CMOS:
|
||||
case ACPI_ADR_SPACE_GPIO:
|
||||
|
||||
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_ADR_SPACE_SMBUS:
|
||||
case ACPI_ADR_SPACE_IPMI:
|
||||
case ACPI_ADR_SPACE_GSBUS:
|
||||
|
||||
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)
|
||||
{
|
||||
XfCheckFieldRange (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: XfNamespaceLocateEnd
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Ascending callback used during cross reference. We only
|
||||
* need to worry about scope management here.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
XfNamespaceLocateEnd (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (XfNamespaceLocateEnd);
|
||||
|
||||
|
||||
/* 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));
|
||||
|
||||
(void) AcpiDsScopeStackPop (WalkState);
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -165,7 +165,7 @@ DtDoCompile (
|
||||
/* Write the binary, then the optional hex file */
|
||||
|
||||
DtOutputBinary (Gbl_RootTable);
|
||||
LsDoHexOutput ();
|
||||
HxDoHexOutput ();
|
||||
DtWriteTableToListing ();
|
||||
|
||||
CleanupAndExit:
|
||||
@ -284,6 +284,7 @@ DtCompileDataTable (
|
||||
char *Signature;
|
||||
ACPI_TABLE_HEADER *AcpiTableHeader;
|
||||
ACPI_STATUS Status;
|
||||
DT_FIELD *RootField = *FieldList;
|
||||
|
||||
|
||||
/* Verify that we at least have a table signature and save it */
|
||||
@ -354,7 +355,7 @@ DtCompileDataTable (
|
||||
if (!TableData || Gbl_CompileGeneric)
|
||||
{
|
||||
DtCompileGeneric ((void **) FieldList);
|
||||
goto Out;
|
||||
goto FinishHeader;
|
||||
}
|
||||
|
||||
/* Dispatch to per-table compile */
|
||||
@ -391,7 +392,8 @@ DtCompileDataTable (
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
Out:
|
||||
FinishHeader:
|
||||
|
||||
/* Set the final table length and then the checksum */
|
||||
|
||||
DtSetTableLength ();
|
||||
@ -399,6 +401,8 @@ Out:
|
||||
ACPI_TABLE_HEADER, Gbl_RootTable->Buffer);
|
||||
DtSetTableChecksum (&AcpiTableHeader->Checksum);
|
||||
|
||||
DtDumpFieldList (RootField);
|
||||
DtDumpSubtableList ();
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -113,6 +113,7 @@ typedef struct dt_subtable
|
||||
UINT32 Length;
|
||||
UINT32 TotalLength;
|
||||
UINT32 SizeOfLengthField;
|
||||
UINT16 Depth;
|
||||
UINT8 Flags;
|
||||
|
||||
} DT_SUBTABLE;
|
||||
@ -167,6 +168,14 @@ void
|
||||
DtOutputBinary (
|
||||
DT_SUBTABLE *RootTable);
|
||||
|
||||
void
|
||||
DtDumpSubtableList (
|
||||
void);
|
||||
|
||||
void
|
||||
DtDumpFieldList (
|
||||
DT_FIELD *Field);
|
||||
|
||||
void
|
||||
DtWriteFieldToListing (
|
||||
UINT8 *Buffer,
|
||||
@ -386,6 +395,10 @@ ACPI_STATUS
|
||||
DtCompileCpep (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileCsrt (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileDmar (
|
||||
void **PFieldList);
|
||||
@ -481,6 +494,7 @@ extern const unsigned char TemplateBoot[];
|
||||
extern const unsigned char TemplateBert[];
|
||||
extern const unsigned char TemplateBgrt[];
|
||||
extern const unsigned char TemplateCpep[];
|
||||
extern const unsigned char TemplateCsrt[];
|
||||
extern const unsigned char TemplateDbgp[];
|
||||
extern const unsigned char TemplateDmar[];
|
||||
extern const unsigned char TemplateEcdt[];
|
||||
@ -507,6 +521,7 @@ extern const unsigned char TemplateSpcr[];
|
||||
extern const unsigned char TemplateSpmi[];
|
||||
extern const unsigned char TemplateSrat[];
|
||||
extern const unsigned char TemplateTcpa[];
|
||||
extern const unsigned char TemplateTpm2[];
|
||||
extern const unsigned char TemplateUefi[];
|
||||
extern const unsigned char TemplateWaet[];
|
||||
extern const unsigned char TemplateWdat[];
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -79,6 +79,18 @@ DtDumpBuffer (
|
||||
UINT32 Offset,
|
||||
UINT32 Length);
|
||||
|
||||
static void
|
||||
DtDumpSubtableInfo (
|
||||
DT_SUBTABLE *Subtable,
|
||||
void *Context,
|
||||
void *ReturnValue);
|
||||
|
||||
static void
|
||||
DtDumpSubtableTree (
|
||||
DT_SUBTABLE *Subtable,
|
||||
void *Context,
|
||||
void *ReturnValue);
|
||||
|
||||
|
||||
/* States for DtGetNextLine */
|
||||
|
||||
@ -708,7 +720,6 @@ DtScanFile (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT32 Offset;
|
||||
DT_FIELD *Next;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME (DtScanFile);
|
||||
@ -738,28 +749,7 @@ DtScanFile (
|
||||
|
||||
/* Dump the parse tree if debug enabled */
|
||||
|
||||
if (Gbl_DebugFlag)
|
||||
{
|
||||
Next = Gbl_FieldList;
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Tree: %32s %32s %8s %8s %8s %8s %8s %8s\n\n",
|
||||
"Name", "Value", "Line", "ByteOff", "NameCol", "Column", "TableOff", "Flags");
|
||||
|
||||
while (Next)
|
||||
{
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Field: %32.32s %32.32s %.8X %.8X %.8X %.8X %.8X %.8X\n",
|
||||
Next->Name,
|
||||
Next->Value,
|
||||
Next->Line,
|
||||
Next->ByteOffset,
|
||||
Next->NameColumn,
|
||||
Next->Column,
|
||||
Next->TableOffset,
|
||||
Next->Flags);
|
||||
|
||||
Next = Next->Next;
|
||||
}
|
||||
}
|
||||
|
||||
DtDumpFieldList (Gbl_FieldList);
|
||||
return (Gbl_FieldList);
|
||||
}
|
||||
|
||||
@ -911,6 +901,123 @@ DtDumpBuffer (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtDumpFieldList
|
||||
*
|
||||
* PARAMETERS: Field - Root field
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump the entire field list
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
DtDumpFieldList (
|
||||
DT_FIELD *Field)
|
||||
{
|
||||
|
||||
if (!Gbl_DebugFlag || !Field)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "\nField List:\n"
|
||||
"LineNo ByteOff NameCol Column TableOff "
|
||||
"Flags %32s : %s\n\n", "Name", "Value");
|
||||
while (Field)
|
||||
{
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%.08X %.08X %.08X %.08X %.08X %.08X %32s : %s\n",
|
||||
Field->Line, Field->ByteOffset, Field->NameColumn,
|
||||
Field->Column, Field->TableOffset, Field->Flags,
|
||||
Field->Name, Field->Value);
|
||||
|
||||
Field = Field->Next;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "\n\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtDumpSubtableInfo, DtDumpSubtableTree
|
||||
*
|
||||
* PARAMETERS: DT_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Info - dump a subtable tree entry with extra information.
|
||||
* Tree - dump a subtable tree formatted by depth indentation.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void
|
||||
DtDumpSubtableInfo (
|
||||
DT_SUBTABLE *Subtable,
|
||||
void *Context,
|
||||
void *ReturnValue)
|
||||
{
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"[%.04X] %.08X %.08X %.08X %.08X %.08X %p %p %p\n",
|
||||
Subtable->Depth, Subtable->Length, Subtable->TotalLength,
|
||||
Subtable->SizeOfLengthField, Subtable->Flags, Subtable,
|
||||
Subtable->Parent, Subtable->Child, Subtable->Peer);
|
||||
}
|
||||
|
||||
static void
|
||||
DtDumpSubtableTree (
|
||||
DT_SUBTABLE *Subtable,
|
||||
void *Context,
|
||||
void *ReturnValue)
|
||||
{
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"[%.04X] %*s%08X (%.02X) - (%.02X)\n",
|
||||
Subtable->Depth, (4 * Subtable->Depth), " ",
|
||||
Subtable, Subtable->Length, Subtable->TotalLength);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtDumpSubtableList
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump the raw list of subtables with information, and also
|
||||
* dump the subtable list in formatted tree format. Assists with
|
||||
* the development of new table code.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
DtDumpSubtableList (
|
||||
void)
|
||||
{
|
||||
|
||||
if (!Gbl_DebugFlag || !Gbl_RootTable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"Subtable Info:\n"
|
||||
"Depth Length TotalLen LenSize Flags "
|
||||
"This Parent Child Peer\n\n");
|
||||
DtWalkTableTree (Gbl_RootTable, DtDumpSubtableInfo, NULL, NULL);
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"\nSubtable Tree: (Depth, Subtable, Length, TotalLength)\n\n");
|
||||
DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtWriteFieldToListing
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -112,6 +112,7 @@ DtInsertSubtable (
|
||||
|
||||
Subtable->Peer = NULL;
|
||||
Subtable->Parent = ParentTable;
|
||||
Subtable->Depth = ParentTable->Depth + 1;
|
||||
|
||||
/* Link the new entry into the child list */
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -418,6 +418,94 @@ DtCompileCpep (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompileCsrt
|
||||
*
|
||||
* PARAMETERS: List - Current field list pointer
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Compile CSRT.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileCsrt (
|
||||
void **List)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
DT_SUBTABLE *Subtable;
|
||||
DT_SUBTABLE *ParentTable;
|
||||
DT_FIELD **PFieldList = (DT_FIELD **) List;
|
||||
UINT32 DescriptorCount;
|
||||
UINT32 GroupLength;
|
||||
|
||||
|
||||
/* Sub-tables (Resource Groups) */
|
||||
|
||||
while (*PFieldList)
|
||||
{
|
||||
/* Resource group subtable */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Compute the number of resource descriptors */
|
||||
|
||||
GroupLength =
|
||||
(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
||||
Subtable->Buffer))->Length -
|
||||
(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
||||
Subtable->Buffer))->SharedInfoLength -
|
||||
sizeof (ACPI_CSRT_GROUP);
|
||||
|
||||
DescriptorCount = (GroupLength /
|
||||
sizeof (ACPI_CSRT_DESCRIPTOR));
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
DtPushSubtable (Subtable);
|
||||
|
||||
/* Shared info subtable (One per resource group) */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
/* Sub-Subtables (Resource Descriptors) */
|
||||
|
||||
while (*PFieldList && DescriptorCount)
|
||||
{
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
DescriptorCount--;
|
||||
}
|
||||
|
||||
DtPopSubtable ();
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompileDmar
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -128,6 +128,52 @@ const unsigned char TemplateCpep[] =
|
||||
0x00,0x00,0x00,0x00 /* 00000030 "...." */
|
||||
};
|
||||
|
||||
const unsigned char TemplateCsrt[] =
|
||||
{
|
||||
0x43,0x53,0x52,0x54,0x4C,0x01,0x00,0x00, /* 00000000 "CSRTL..." */
|
||||
0x01,0x0D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
|
||||
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
|
||||
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
|
||||
0x14,0x11,0x12,0x20,0x88,0x00,0x00,0x00, /* 00000020 "... ...." */
|
||||
0x49,0x4E,0x54,0x4C,0x00,0x00,0x00,0x00, /* 00000028 "INTL...." */
|
||||
0x60,0x9C,0x00,0x00,0x02,0x00,0x00,0x00, /* 00000030 "`......." */
|
||||
0x1C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */
|
||||
0x00,0x00,0xA0,0xB3,0x00,0x00,0x00,0x00, /* 00000040 "........" */
|
||||
0x2A,0x00,0x00,0x00,0x02,0x00,0x06,0x20, /* 00000048 "*...... " */
|
||||
0x00,0x00,0x10,0x00,0xFF,0x0F,0x00,0x00, /* 00000050 "........" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x01,0x00, /* 00000058 "........" */
|
||||
0x53,0x50,0x49,0x20,0x0C,0x00,0x00,0x00, /* 00000060 "SPI ...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x30, /* 00000068 "....CHA0" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 00000070 "........" */
|
||||
0x43,0x48,0x41,0x31,0x0C,0x00,0x00,0x00, /* 00000078 "CHA1...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x32, /* 00000080 "....CHA2" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 00000088 "........" */
|
||||
0x43,0x48,0x41,0x33,0x0C,0x00,0x00,0x00, /* 00000090 "CHA3...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x34, /* 00000098 "....CHA4" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000A0 "........" */
|
||||
0x43,0x48,0x41,0x35,0xA0,0x00,0x00,0x00, /* 000000A8 "CHA5...." */
|
||||
0x49,0x4E,0x54,0x4C,0x00,0x00,0x00,0x00, /* 000000B0 "INTL...." */
|
||||
0x60,0x9C,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000B8 "`......." */
|
||||
0x1C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000C0 "........" */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
|
||||
0x2B,0x00,0x00,0x00,0x02,0x00,0x08,0x20, /* 000000D0 "+...... " */
|
||||
0x10,0x00,0x10,0x00,0xFF,0x0F,0x00,0x00, /* 000000D8 "........" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x01,0x00, /* 000000E0 "........" */
|
||||
0x49,0x32,0x43,0x20,0x0C,0x00,0x00,0x00, /* 000000E8 "I2C ...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x30, /* 000000F0 "....CHA0" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000F8 "........" */
|
||||
0x43,0x48,0x41,0x31,0x0C,0x00,0x00,0x00, /* 00000100 "CHA1...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x32, /* 00000108 "....CHA2" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 00000110 "........" */
|
||||
0x43,0x48,0x41,0x33,0x0C,0x00,0x00,0x00, /* 00000118 "CHA3...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x34, /* 00000120 "....CHA4" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 00000128 "........" */
|
||||
0x43,0x48,0x41,0x35,0x0C,0x00,0x00,0x00, /* 00000130 "CHA5...." */
|
||||
0x03,0x00,0x00,0x00,0x43,0x48,0x41,0x36, /* 00000138 "....CHA6" */
|
||||
0x0C,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 00000140 "........" */
|
||||
0x43,0x48,0x41,0x37 /* 00000148 "CHA7" */
|
||||
};
|
||||
|
||||
const unsigned char TemplateDbgp[] =
|
||||
{
|
||||
0x44,0x42,0x47,0x50,0x34,0x00,0x00,0x00, /* 00000000 "DBGP4..." */
|
||||
@ -825,6 +871,17 @@ const unsigned char TemplateTcpa[] =
|
||||
0x00,0x00 /* 00000030 ".." */
|
||||
};
|
||||
|
||||
const unsigned char TemplateTpm2[] =
|
||||
{
|
||||
0x54,0x50,0x4D,0x32,0x34,0x00,0x00,0x00, /* 00000000 "TPM24..." */
|
||||
0x03,0x42,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".BINTEL " */
|
||||
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
|
||||
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
|
||||
0x14,0x11,0x12,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */
|
||||
0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00, /* 00000028 "wfUD3".." */
|
||||
0x01,0x00,0x00,0x00 /* 00000030 "...." */
|
||||
};
|
||||
|
||||
const unsigned char TemplateUefi[] =
|
||||
{
|
||||
0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -82,17 +82,21 @@ AcpiDbDeviceResources (
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
static void
|
||||
AcpiDbDoOneSleepState (
|
||||
UINT8 SleepState);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToNode
|
||||
*
|
||||
* PARAMETERS: InString - String to convert
|
||||
* PARAMETERS: InString - String to convert
|
||||
*
|
||||
* RETURN: Pointer to a NS node
|
||||
*
|
||||
* DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
|
||||
* alpha strings.
|
||||
* alphanumeric strings.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -126,9 +130,9 @@ AcpiDbConvertToNode (
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Alpha argument */
|
||||
/* The parameter is a name string that must be resolved to a
|
||||
* Named obj
|
||||
/*
|
||||
* Alpha argument: The parameter is a name string that must be
|
||||
* resolved to a Namespace object.
|
||||
*/
|
||||
Node = AcpiDbLocalNsLookup (InString);
|
||||
if (!Node)
|
||||
@ -145,11 +149,12 @@ AcpiDbConvertToNode (
|
||||
*
|
||||
* FUNCTION: AcpiDbSleep
|
||||
*
|
||||
* PARAMETERS: ObjectArg - Desired sleep state (0-5)
|
||||
* PARAMETERS: ObjectArg - Desired sleep state (0-5). NULL means
|
||||
* invoke all possible sleep states.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Simulate a sleep/wake sequence
|
||||
* DESCRIPTION: Simulate sleep/wake sequences
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -157,50 +162,124 @@ ACPI_STATUS
|
||||
AcpiDbSleep (
|
||||
char *ObjectArg)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT8 SleepState;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiDbSleep);
|
||||
|
||||
|
||||
SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
|
||||
/* Null input (no arguments) means to invoke all sleep states */
|
||||
|
||||
AcpiOsPrintf ("**** Prepare to sleep ****\n");
|
||||
if (!ObjectArg)
|
||||
{
|
||||
AcpiOsPrintf ("Invoking all possible sleep states, 0-%d\n",
|
||||
ACPI_S_STATES_MAX);
|
||||
|
||||
for (i = 0; i <= ACPI_S_STATES_MAX; i++)
|
||||
{
|
||||
AcpiDbDoOneSleepState ((UINT8) i);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Convert argument to binary and invoke the sleep state */
|
||||
|
||||
SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
|
||||
AcpiDbDoOneSleepState (SleepState);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbDoOneSleepState
|
||||
*
|
||||
* PARAMETERS: SleepState - Desired sleep state (0-5)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Simulate a sleep/wake sequence
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
AcpiDbDoOneSleepState (
|
||||
UINT8 SleepState)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT8 SleepTypeA;
|
||||
UINT8 SleepTypeB;
|
||||
|
||||
|
||||
/* Validate parameter */
|
||||
|
||||
if (SleepState > ACPI_S_STATES_MAX)
|
||||
{
|
||||
AcpiOsPrintf ("Sleep state %d out of range (%d max)\n",
|
||||
SleepState, ACPI_S_STATES_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\n---- Invoking sleep state S%d (%s):\n",
|
||||
SleepState, AcpiGbl_SleepStateNames[SleepState]);
|
||||
|
||||
/* Get the values for the sleep type registers (for display only) */
|
||||
|
||||
Status = AcpiGetSleepTypeData (SleepState, &SleepTypeA, &SleepTypeB);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not evaluate [%s] method, %s\n",
|
||||
AcpiGbl_SleepStateNames[SleepState],
|
||||
AcpiFormatException (Status));
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (
|
||||
"Register values for sleep state S%d: Sleep-A: %.2X, Sleep-B: %.2X\n",
|
||||
SleepState, SleepTypeA, SleepTypeB);
|
||||
|
||||
/* Invoke the various sleep/wake interfaces */
|
||||
|
||||
AcpiOsPrintf ("**** Sleep: Prepare to sleep (S%d) ****\n",
|
||||
SleepState);
|
||||
Status = AcpiEnterSleepStatePrep (SleepState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("**** Going to sleep ****\n");
|
||||
AcpiOsPrintf ("**** Sleep: Going to sleep (S%d) ****\n",
|
||||
SleepState);
|
||||
Status = AcpiEnterSleepState (SleepState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("**** Prepare to return from sleep ****\n");
|
||||
AcpiOsPrintf ("**** Wake: Prepare to return from sleep (S%d) ****\n",
|
||||
SleepState);
|
||||
Status = AcpiLeaveSleepStatePrep (SleepState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("**** Returning from sleep ****\n");
|
||||
AcpiOsPrintf ("**** Wake: Return from sleep (S%d) ****\n",
|
||||
SleepState);
|
||||
Status = AcpiLeaveSleepState (SleepState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
return;
|
||||
|
||||
|
||||
ErrorExit:
|
||||
|
||||
ACPI_EXCEPTION ((AE_INFO, Status, "During sleep test"));
|
||||
return_ACPI_STATUS (Status);
|
||||
ACPI_EXCEPTION ((AE_INFO, Status, "During invocation of sleep state S%d",
|
||||
SleepState));
|
||||
}
|
||||
|
||||
|
||||
@ -236,7 +315,7 @@ AcpiDbDisplayLocks (
|
||||
*
|
||||
* FUNCTION: AcpiDbDisplayTableInfo
|
||||
*
|
||||
* PARAMETERS: TableArg - String with name of table to be displayed
|
||||
* PARAMETERS: TableArg - Name of table to be displayed
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -377,8 +456,8 @@ AcpiDbUnloadAcpiTable (
|
||||
*
|
||||
* FUNCTION: AcpiDbSendNotify
|
||||
*
|
||||
* PARAMETERS: Name - Name of ACPI object to send the notify to
|
||||
* Value - Value of the notify to send.
|
||||
* PARAMETERS: Name - Name of ACPI object where to send notify
|
||||
* Value - Value of the notify to send.
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -416,7 +495,8 @@ AcpiDbSendNotify (
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
|
||||
AcpiOsPrintf (
|
||||
"Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
|
||||
AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));
|
||||
}
|
||||
}
|
||||
@ -453,7 +533,6 @@ AcpiDbDisplayInterfaces (
|
||||
ACPI_WAIT_FOREVER);
|
||||
|
||||
NextInterface = AcpiGbl_SupportedInterfaces;
|
||||
|
||||
while (NextInterface)
|
||||
{
|
||||
if (!(NextInterface->Flags & ACPI_OSI_INVALID))
|
||||
@ -518,7 +597,7 @@ AcpiDbDisplayInterfaces (
|
||||
*
|
||||
* FUNCTION: AcpiDbDisplayTemplate
|
||||
*
|
||||
* PARAMETERS: BufferArg - Buffer name or addrss
|
||||
* PARAMETERS: BufferArg - Buffer name or address
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -532,7 +611,7 @@ AcpiDbDisplayTemplate (
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_BUFFER ReturnObj;
|
||||
ACPI_BUFFER ReturnBuffer;
|
||||
|
||||
|
||||
/* Translate BufferArg to an Named object */
|
||||
@ -553,12 +632,12 @@ AcpiDbDisplayTemplate (
|
||||
return;
|
||||
}
|
||||
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
|
||||
/* Attempt to convert the raw buffer to a resource list */
|
||||
|
||||
Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj);
|
||||
Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer);
|
||||
|
||||
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
|
||||
AcpiDbgLevel |= ACPI_LV_RESOURCES;
|
||||
@ -573,7 +652,7 @@ AcpiDbDisplayTemplate (
|
||||
/* Now we can dump the resource list */
|
||||
|
||||
AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
|
||||
ReturnObj.Pointer));
|
||||
ReturnBuffer.Pointer));
|
||||
|
||||
DumpBuffer:
|
||||
AcpiOsPrintf ("\nRaw data buffer:\n");
|
||||
@ -666,7 +745,8 @@ AcpiDmCompareAmlResources (
|
||||
{
|
||||
if (Aml1[i] != Aml2[i])
|
||||
{
|
||||
AcpiOsPrintf ("Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
|
||||
AcpiOsPrintf (
|
||||
"Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
|
||||
i, Aml2[i], Aml1[i]);
|
||||
}
|
||||
}
|
||||
@ -693,8 +773,8 @@ AcpiDmCompareAmlResources (
|
||||
*
|
||||
* FUNCTION: AcpiDmTestResourceConversion
|
||||
*
|
||||
* PARAMETERS: Node - Parent device node
|
||||
* Name - resource method name (_CRS)
|
||||
* PARAMETERS: Node - Parent device node
|
||||
* Name - resource method name (_CRS)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -709,8 +789,8 @@ AcpiDmTestResourceConversion (
|
||||
char *Name)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_BUFFER ReturnObj;
|
||||
ACPI_BUFFER ResourceObj;
|
||||
ACPI_BUFFER ReturnBuffer;
|
||||
ACPI_BUFFER ResourceBuffer;
|
||||
ACPI_BUFFER NewAml;
|
||||
ACPI_OBJECT *OriginalAml;
|
||||
|
||||
@ -718,12 +798,12 @@ AcpiDmTestResourceConversion (
|
||||
AcpiOsPrintf ("Resource Conversion Comparison:\n");
|
||||
|
||||
NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
ResourceBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
|
||||
/* Get the original _CRS AML resource template */
|
||||
|
||||
Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj);
|
||||
Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not obtain %s: %s\n",
|
||||
@ -733,7 +813,7 @@ AcpiDmTestResourceConversion (
|
||||
|
||||
/* Get the AML resource template, converted to internal resource structs */
|
||||
|
||||
Status = AcpiGetCurrentResources (Node, &ResourceObj);
|
||||
Status = AcpiGetCurrentResources (Node, &ResourceBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
|
||||
@ -743,7 +823,7 @@ AcpiDmTestResourceConversion (
|
||||
|
||||
/* Convert internal resource list to external AML resource template */
|
||||
|
||||
Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml);
|
||||
Status = AcpiRsCreateAmlResources (ResourceBuffer.Pointer, &NewAml);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
|
||||
@ -753,7 +833,7 @@ AcpiDmTestResourceConversion (
|
||||
|
||||
/* Compare original AML to the newly created AML resource list */
|
||||
|
||||
OriginalAml = ReturnObj.Pointer;
|
||||
OriginalAml = ReturnBuffer.Pointer;
|
||||
|
||||
AcpiDmCompareAmlResources (
|
||||
OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
|
||||
@ -763,9 +843,9 @@ AcpiDmTestResourceConversion (
|
||||
|
||||
ACPI_FREE (NewAml.Pointer);
|
||||
Exit2:
|
||||
ACPI_FREE (ResourceObj.Pointer);
|
||||
ACPI_FREE (ResourceBuffer.Pointer);
|
||||
Exit1:
|
||||
ACPI_FREE (ReturnObj.Pointer);
|
||||
ACPI_FREE (ReturnBuffer.Pointer);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
@ -778,7 +858,8 @@ Exit1:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Simple callback to exercise AcpiWalkResources
|
||||
* DESCRIPTION: Simple callback to exercise AcpiWalkResources and
|
||||
* AcpiWalkResourceBuffer.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -817,7 +898,7 @@ AcpiDbDeviceResources (
|
||||
ACPI_NAMESPACE_NODE *PrsNode = NULL;
|
||||
ACPI_NAMESPACE_NODE *AeiNode = NULL;
|
||||
char *ParentPath;
|
||||
ACPI_BUFFER ReturnObj;
|
||||
ACPI_BUFFER ReturnBuffer;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
@ -843,8 +924,8 @@ AcpiDbDeviceResources (
|
||||
|
||||
/* Prepare for a return object of arbitrary size */
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
|
||||
/* _PRT */
|
||||
@ -853,7 +934,7 @@ AcpiDbDeviceResources (
|
||||
{
|
||||
AcpiOsPrintf ("Evaluating _PRT\n");
|
||||
|
||||
Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnObj);
|
||||
Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not evaluate _PRT: %s\n",
|
||||
@ -861,10 +942,10 @@ AcpiDbDeviceResources (
|
||||
goto GetCrs;
|
||||
}
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
|
||||
Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
|
||||
@ -883,10 +964,10 @@ GetCrs:
|
||||
{
|
||||
AcpiOsPrintf ("Evaluating _CRS\n");
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnObj);
|
||||
Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not evaluate _CRS: %s\n",
|
||||
@ -894,7 +975,7 @@ GetCrs:
|
||||
goto GetPrs;
|
||||
}
|
||||
|
||||
/* This code is here to exercise the AcpiWalkResources interface */
|
||||
/* This code exercises the AcpiWalkResources interface */
|
||||
|
||||
Status = AcpiWalkResources (Node, METHOD_NAME__CRS,
|
||||
AcpiDbResourceCallback, NULL);
|
||||
@ -905,12 +986,12 @@ GetCrs:
|
||||
goto GetPrs;
|
||||
}
|
||||
|
||||
/* Get the _CRS resource list */
|
||||
/* Get the _CRS resource list (test ALLOCATE buffer) */
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = NULL;
|
||||
ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
|
||||
Status = AcpiGetCurrentResources (Node, &ReturnObj);
|
||||
Status = AcpiGetCurrentResources (Node, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
|
||||
@ -918,26 +999,41 @@ GetCrs:
|
||||
goto GetPrs;
|
||||
}
|
||||
|
||||
/* This code exercises the AcpiWalkResourceBuffer interface */
|
||||
|
||||
Status = AcpiWalkResourceBuffer (&ReturnBuffer,
|
||||
AcpiDbResourceCallback, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiWalkResourceBuffer failed: %s\n",
|
||||
AcpiFormatException (Status));
|
||||
goto EndCrs;
|
||||
}
|
||||
|
||||
/* Dump the _CRS resource list */
|
||||
|
||||
AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
|
||||
ReturnObj.Pointer));
|
||||
ReturnBuffer.Pointer));
|
||||
|
||||
/*
|
||||
* Perform comparison of original AML to newly created AML. This tests both
|
||||
* the AML->Resource conversion and the Resource->Aml conversion.
|
||||
* Perform comparison of original AML to newly created AML. This
|
||||
* tests both the AML->Resource conversion and the Resource->AML
|
||||
* conversion.
|
||||
*/
|
||||
Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
|
||||
(void) AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
|
||||
|
||||
/* Execute _SRS with the resource list */
|
||||
|
||||
Status = AcpiSetCurrentResources (Node, &ReturnObj);
|
||||
Status = AcpiSetCurrentResources (Node, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
|
||||
AcpiFormatException (Status));
|
||||
goto GetPrs;
|
||||
goto EndCrs;
|
||||
}
|
||||
|
||||
EndCrs:
|
||||
ACPI_FREE_BUFFER (ReturnBuffer);
|
||||
}
|
||||
|
||||
|
||||
@ -948,10 +1044,10 @@ GetPrs:
|
||||
{
|
||||
AcpiOsPrintf ("Evaluating _PRS\n");
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnObj);
|
||||
Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not evaluate _PRS: %s\n",
|
||||
@ -959,10 +1055,10 @@ GetPrs:
|
||||
goto GetAei;
|
||||
}
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiGetPossibleResources (Node, &ReturnObj);
|
||||
Status = AcpiGetPossibleResources (Node, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
|
||||
@ -981,10 +1077,10 @@ GetAei:
|
||||
{
|
||||
AcpiOsPrintf ("Evaluating _AEI\n");
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnObj);
|
||||
Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not evaluate _AEI: %s\n",
|
||||
@ -992,10 +1088,10 @@ GetAei:
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
ReturnObj.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
|
||||
ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
|
||||
|
||||
Status = AcpiGetEventResources (Node, &ReturnObj);
|
||||
Status = AcpiGetEventResources (Node, &ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("AcpiGetEventResources failed: %s\n",
|
||||
@ -1017,8 +1113,9 @@ Cleanup:
|
||||
*
|
||||
* FUNCTION: AcpiDbDisplayResources
|
||||
*
|
||||
* PARAMETERS: ObjectArg - String object name or object pointer.
|
||||
* "*" means "display resources for all devices"
|
||||
* PARAMETERS: ObjectArg - String object name or object pointer.
|
||||
* "*" means "display resources for all
|
||||
* devices"
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -1071,13 +1168,13 @@ AcpiDbDisplayResources (
|
||||
*
|
||||
* FUNCTION: AcpiDbGenerateGpe
|
||||
*
|
||||
* PARAMETERS: GpeArg - Raw GPE number, ascii string
|
||||
* BlockArg - GPE block number, ascii string
|
||||
* 0 or 1 for FADT GPE blocks
|
||||
* PARAMETERS: GpeArg - Raw GPE number, ascii string
|
||||
* BlockArg - GPE block number, ascii string
|
||||
* 0 or 1 for FADT GPE blocks
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Generate a GPE
|
||||
* DESCRIPTION: Simulate firing of a GPE
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
525
sys/contrib/dev/acpica/components/debugger/dbconvert.c
Normal file
525
sys/contrib/dev/acpica/components/debugger/dbconvert.c
Normal file
@ -0,0 +1,525 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dbconvert - debugger miscellaneous conversion routines
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* 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
|
||||
* substantially 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 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/include/acpi.h>
|
||||
#include <contrib/dev/acpica/include/accommon.h>
|
||||
#include <contrib/dev/acpica/include/acdebug.h>
|
||||
|
||||
#ifdef ACPI_DEBUGGER
|
||||
|
||||
#define _COMPONENT ACPI_CA_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dbconvert")
|
||||
|
||||
|
||||
#define DB_DEFAULT_PKG_ELEMENTS 33
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbHexCharToValue
|
||||
*
|
||||
* PARAMETERS: HexChar - Ascii Hex digit, 0-9|a-f|A-F
|
||||
* ReturnValue - Where the converted value is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a single hex character to a 4-bit number (0-16).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDbHexCharToValue (
|
||||
int HexChar,
|
||||
UINT8 *ReturnValue)
|
||||
{
|
||||
UINT8 Value;
|
||||
|
||||
|
||||
/* Digit must be ascii [0-9a-fA-F] */
|
||||
|
||||
if (!ACPI_IS_XDIGIT (HexChar))
|
||||
{
|
||||
return (AE_BAD_HEX_CONSTANT);
|
||||
}
|
||||
|
||||
if (HexChar <= 0x39)
|
||||
{
|
||||
Value = (UINT8) (HexChar - 0x30);
|
||||
}
|
||||
else
|
||||
{
|
||||
Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37);
|
||||
}
|
||||
|
||||
*ReturnValue = Value;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbHexByteToBinary
|
||||
*
|
||||
* PARAMETERS: HexByte - Double hex digit (0x00 - 0xFF) in format:
|
||||
* HiByte then LoByte.
|
||||
* ReturnValue - Where the converted value is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbHexByteToBinary (
|
||||
char *HexByte,
|
||||
UINT8 *ReturnValue)
|
||||
{
|
||||
UINT8 Local0;
|
||||
UINT8 Local1;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* High byte */
|
||||
|
||||
Status = AcpiDbHexCharToValue (HexByte[0], &Local0);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Low byte */
|
||||
|
||||
Status = AcpiDbHexCharToValue (HexByte[1], &Local1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
*ReturnValue = (UINT8) ((Local0 << 4) | Local1);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToBuffer
|
||||
*
|
||||
* PARAMETERS: String - Input string to be converted
|
||||
* Object - Where the buffer object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a string to a buffer object. String is treated a list
|
||||
* of buffer elements, each separated by a space or comma.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToBuffer (
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
UINT32 Length;
|
||||
UINT8 *Buffer;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Generate the final buffer length */
|
||||
|
||||
for (i = 0, Length = 0; String[i];)
|
||||
{
|
||||
i+=2;
|
||||
Length++;
|
||||
|
||||
while (String[i] &&
|
||||
((String[i] == ',') || (String[i] == ' ')))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Buffer = ACPI_ALLOCATE (Length);
|
||||
if (!Buffer)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Convert the command line bytes to the buffer */
|
||||
|
||||
for (i = 0, j = 0; String[i];)
|
||||
{
|
||||
Status = AcpiDbHexByteToBinary (&String[i], &Buffer[j]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_FREE (Buffer);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
j++;
|
||||
i+=2;
|
||||
while (String[i] &&
|
||||
((String[i] == ',') || (String[i] == ' ')))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Object->Type = ACPI_TYPE_BUFFER;
|
||||
Object->Buffer.Pointer = Buffer;
|
||||
Object->Buffer.Length = Length;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToPackage
|
||||
*
|
||||
* PARAMETERS: String - Input string to be converted
|
||||
* Object - Where the package object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a string to a package object. Handles nested packages
|
||||
* via recursion with AcpiDbConvertToObject.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDbConvertToPackage (
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
char *This;
|
||||
char *Next;
|
||||
UINT32 i;
|
||||
ACPI_OBJECT_TYPE Type;
|
||||
ACPI_OBJECT *Elements;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
Elements = ACPI_ALLOCATE_ZEROED (
|
||||
DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT));
|
||||
|
||||
This = String;
|
||||
for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++)
|
||||
{
|
||||
This = AcpiDbGetNextToken (This, &Next, &Type);
|
||||
if (!This)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recursive call to convert each package element */
|
||||
|
||||
Status = AcpiDbConvertToObject (Type, This, &Elements[i]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiDbDeleteObjects (i + 1, Elements);
|
||||
ACPI_FREE (Elements);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
This = Next;
|
||||
}
|
||||
|
||||
Object->Type = ACPI_TYPE_PACKAGE;
|
||||
Object->Package.Count = i;
|
||||
Object->Package.Elements = Elements;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToObject
|
||||
*
|
||||
* PARAMETERS: Type - Object type as determined by parser
|
||||
* String - Input string to be converted
|
||||
* Object - Where the new object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a typed and tokenized string to an ACPI_OBJECT. Typing:
|
||||
* 1) String objects were surrounded by quotes.
|
||||
* 2) Buffer objects were surrounded by parentheses.
|
||||
* 3) Package objects were surrounded by brackets "[]".
|
||||
* 4) All standalone tokens are treated as integers.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDbConvertToObject (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case ACPI_TYPE_STRING:
|
||||
Object->Type = ACPI_TYPE_STRING;
|
||||
Object->String.Pointer = String;
|
||||
Object->String.Length = (UINT32) ACPI_STRLEN (String);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
Status = AcpiDbConvertToBuffer (String, Object);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
Status = AcpiDbConvertToPackage (String, Object);
|
||||
break;
|
||||
|
||||
default:
|
||||
Object->Type = ACPI_TYPE_INTEGER;
|
||||
Status = AcpiUtStrtoul64 (String, 16, &Object->Integer.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbEncodePldBuffer
|
||||
*
|
||||
* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)
|
||||
*
|
||||
* RETURN: Encode _PLD buffer suitable for return value from _PLD
|
||||
*
|
||||
* DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT8 *
|
||||
AcpiDbEncodePldBuffer (
|
||||
ACPI_PLD_INFO *PldInfo)
|
||||
{
|
||||
UINT32 *Buffer;
|
||||
UINT32 Dword;
|
||||
|
||||
|
||||
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
|
||||
if (!Buffer)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* First 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
|
||||
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
|
||||
ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
|
||||
|
||||
/* Second 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
|
||||
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
|
||||
|
||||
/* Third 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
|
||||
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
|
||||
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
|
||||
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
|
||||
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
|
||||
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
|
||||
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
|
||||
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
|
||||
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
|
||||
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
|
||||
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
|
||||
|
||||
/* Fourth 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
|
||||
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
|
||||
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
|
||||
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
|
||||
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
|
||||
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
|
||||
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
|
||||
|
||||
if (PldInfo->Revision >= 2)
|
||||
{
|
||||
/* Fifth 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
|
||||
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (UINT8, Buffer));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbDumpPldBuffer
|
||||
*
|
||||
* PARAMETERS: ObjDesc - Object returned from _PLD method
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Dumps formatted contents of a _PLD return buffer.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define ACPI_PLD_OUTPUT "%20s : %-6X\n"
|
||||
|
||||
void
|
||||
AcpiDbDumpPldBuffer (
|
||||
ACPI_OBJECT *ObjDesc)
|
||||
{
|
||||
ACPI_OBJECT *BufferDesc;
|
||||
ACPI_PLD_INFO *PldInfo;
|
||||
UINT8 *NewBuffer;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Object must be of type Package with at least one Buffer element */
|
||||
|
||||
if (ObjDesc->Type != ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BufferDesc = &ObjDesc->Package.Elements[0];
|
||||
if (BufferDesc->Type != ACPI_TYPE_BUFFER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Convert _PLD buffer to local _PLD struct */
|
||||
|
||||
Status = AcpiDecodePldBuffer (BufferDesc->Buffer.Pointer,
|
||||
BufferDesc->Buffer.Length, &PldInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Encode local _PLD struct back to a _PLD buffer */
|
||||
|
||||
NewBuffer = AcpiDbEncodePldBuffer (PldInfo);
|
||||
if (!NewBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* The two bit-packed buffers should match */
|
||||
|
||||
if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer,
|
||||
BufferDesc->Buffer.Length))
|
||||
{
|
||||
AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n");
|
||||
|
||||
AcpiUtDumpBuffer (NewBuffer,
|
||||
BufferDesc->Buffer.Length, DB_BYTE_DISPLAY, 0);
|
||||
}
|
||||
|
||||
/* First 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color);
|
||||
|
||||
/* Second 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height);
|
||||
|
||||
/* Third 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay);
|
||||
|
||||
/* Fourth 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order);
|
||||
|
||||
/* Fifth 32-bit dword */
|
||||
|
||||
if (BufferDesc->Buffer.Length > 16)
|
||||
{
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset);
|
||||
}
|
||||
|
||||
ACPI_FREE (PldInfo);
|
||||
ACPI_FREE (NewBuffer);
|
||||
}
|
||||
|
||||
#endif /* ACPI_DEBUGGER */
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -54,7 +54,6 @@
|
||||
|
||||
|
||||
static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo;
|
||||
#define DB_DEFAULT_PKG_ELEMENTS 33
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
@ -82,308 +81,6 @@ AcpiDbExecutionWalk (
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbHexCharToValue (
|
||||
int HexChar,
|
||||
UINT8 *ReturnValue);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToPackage (
|
||||
char *String,
|
||||
ACPI_OBJECT *Object);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToObject (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
char *String,
|
||||
ACPI_OBJECT *Object);
|
||||
|
||||
static void
|
||||
AcpiDbDeleteObjects (
|
||||
UINT32 Count,
|
||||
ACPI_OBJECT *Objects);
|
||||
|
||||
|
||||
static UINT8 *
|
||||
AcpiDbEncodePldBuffer (
|
||||
ACPI_PLD_INFO *PldInfo);
|
||||
|
||||
static void
|
||||
AcpiDbDumpPldBuffer (
|
||||
ACPI_OBJECT *ObjDesc);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbHexCharToValue
|
||||
*
|
||||
* PARAMETERS: HexChar - Ascii Hex digit, 0-9|a-f|A-F
|
||||
* ReturnValue - Where the converted value is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a single hex character to a 4-bit number (0-16).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbHexCharToValue (
|
||||
int HexChar,
|
||||
UINT8 *ReturnValue)
|
||||
{
|
||||
UINT8 Value;
|
||||
|
||||
|
||||
/* Digit must be ascii [0-9a-fA-F] */
|
||||
|
||||
if (!ACPI_IS_XDIGIT (HexChar))
|
||||
{
|
||||
return (AE_BAD_HEX_CONSTANT);
|
||||
}
|
||||
|
||||
if (HexChar <= 0x39)
|
||||
{
|
||||
Value = (UINT8) (HexChar - 0x30);
|
||||
}
|
||||
else
|
||||
{
|
||||
Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37);
|
||||
}
|
||||
|
||||
*ReturnValue = Value;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbHexByteToBinary
|
||||
*
|
||||
* PARAMETERS: HexByte - Double hex digit (0x00 - 0xFF) in format:
|
||||
* HiByte then LoByte.
|
||||
* ReturnValue - Where the converted value is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbHexByteToBinary (
|
||||
char *HexByte,
|
||||
UINT8 *ReturnValue)
|
||||
{
|
||||
UINT8 Local0;
|
||||
UINT8 Local1;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* High byte */
|
||||
|
||||
Status = AcpiDbHexCharToValue (HexByte[0], &Local0);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Low byte */
|
||||
|
||||
Status = AcpiDbHexCharToValue (HexByte[1], &Local1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
*ReturnValue = (UINT8) ((Local0 << 4) | Local1);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToBuffer
|
||||
*
|
||||
* PARAMETERS: String - Input string to be converted
|
||||
* Object - Where the buffer object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a string to a buffer object. String is treated a list
|
||||
* of buffer elements, each separated by a space or comma.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToBuffer (
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
UINT32 Length;
|
||||
UINT8 *Buffer;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Generate the final buffer length */
|
||||
|
||||
for (i = 0, Length = 0; String[i];)
|
||||
{
|
||||
i+=2;
|
||||
Length++;
|
||||
|
||||
while (String[i] &&
|
||||
((String[i] == ',') || (String[i] == ' ')))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Buffer = ACPI_ALLOCATE (Length);
|
||||
if (!Buffer)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Convert the command line bytes to the buffer */
|
||||
|
||||
for (i = 0, j = 0; String[i];)
|
||||
{
|
||||
Status = AcpiDbHexByteToBinary (&String[i], &Buffer[j]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_FREE (Buffer);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
j++;
|
||||
i+=2;
|
||||
while (String[i] &&
|
||||
((String[i] == ',') || (String[i] == ' ')))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Object->Type = ACPI_TYPE_BUFFER;
|
||||
Object->Buffer.Pointer = Buffer;
|
||||
Object->Buffer.Length = Length;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToPackage
|
||||
*
|
||||
* PARAMETERS: String - Input string to be converted
|
||||
* Object - Where the package object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a string to a package object. Handles nested packages
|
||||
* via recursion with AcpiDbConvertToObject.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToPackage (
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
char *This;
|
||||
char *Next;
|
||||
UINT32 i;
|
||||
ACPI_OBJECT_TYPE Type;
|
||||
ACPI_OBJECT *Elements;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
Elements = ACPI_ALLOCATE_ZEROED (
|
||||
DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT));
|
||||
|
||||
This = String;
|
||||
for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++)
|
||||
{
|
||||
This = AcpiDbGetNextToken (This, &Next, &Type);
|
||||
if (!This)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recursive call to convert each package element */
|
||||
|
||||
Status = AcpiDbConvertToObject (Type, This, &Elements[i]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiDbDeleteObjects (i + 1, Elements);
|
||||
ACPI_FREE (Elements);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
This = Next;
|
||||
}
|
||||
|
||||
Object->Type = ACPI_TYPE_PACKAGE;
|
||||
Object->Package.Count = i;
|
||||
Object->Package.Elements = Elements;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbConvertToObject
|
||||
*
|
||||
* PARAMETERS: Type - Object type as determined by parser
|
||||
* String - Input string to be converted
|
||||
* Object - Where the new object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert a typed and tokenized string to an ACPI_OBJECT. Typing:
|
||||
* 1) String objects were surrounded by quotes.
|
||||
* 2) Buffer objects were surrounded by parentheses.
|
||||
* 3) Package objects were surrounded by brackets "[]".
|
||||
* 4) All standalone tokens are treated as integers.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDbConvertToObject (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
char *String,
|
||||
ACPI_OBJECT *Object)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case ACPI_TYPE_STRING:
|
||||
Object->Type = ACPI_TYPE_STRING;
|
||||
Object->String.Pointer = String;
|
||||
Object->String.Length = (UINT32) ACPI_STRLEN (String);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
Status = AcpiDbConvertToBuffer (String, Object);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
Status = AcpiDbConvertToPackage (String, Object);
|
||||
break;
|
||||
|
||||
default:
|
||||
Object->Type = ACPI_TYPE_INTEGER;
|
||||
Status = AcpiUtStrtoul64 (String, 16, &Object->Integer.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -399,7 +96,7 @@ AcpiDbConvertToObject (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
void
|
||||
AcpiDbDeleteObjects (
|
||||
UINT32 Count,
|
||||
ACPI_OBJECT *Objects)
|
||||
@ -718,202 +415,6 @@ AcpiDbExecutionWalk (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbEncodePldBuffer
|
||||
*
|
||||
* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)
|
||||
*
|
||||
* RETURN: Encode _PLD buffer suitable for return value from _PLD
|
||||
*
|
||||
* DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static UINT8 *
|
||||
AcpiDbEncodePldBuffer (
|
||||
ACPI_PLD_INFO *PldInfo)
|
||||
{
|
||||
UINT32 *Buffer;
|
||||
UINT32 Dword;
|
||||
|
||||
|
||||
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
|
||||
if (!Buffer)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* First 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
|
||||
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
|
||||
ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
|
||||
|
||||
/* Second 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
|
||||
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
|
||||
|
||||
/* Third 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
|
||||
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
|
||||
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
|
||||
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
|
||||
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
|
||||
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
|
||||
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
|
||||
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
|
||||
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
|
||||
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
|
||||
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
|
||||
|
||||
/* Fourth 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
|
||||
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
|
||||
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
|
||||
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
|
||||
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
|
||||
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
|
||||
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
|
||||
|
||||
if (PldInfo->Revision >= 2)
|
||||
{
|
||||
/* Fifth 32 bits */
|
||||
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
|
||||
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (UINT8, Buffer));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbDumpPldBuffer
|
||||
*
|
||||
* PARAMETERS: ObjDesc - Object returned from _PLD method
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Dumps formatted contents of a _PLD return buffer.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define ACPI_PLD_OUTPUT "%20s : %-6X\n"
|
||||
|
||||
static void
|
||||
AcpiDbDumpPldBuffer (
|
||||
ACPI_OBJECT *ObjDesc)
|
||||
{
|
||||
ACPI_OBJECT *BufferDesc;
|
||||
ACPI_PLD_INFO *PldInfo;
|
||||
UINT8 *NewBuffer;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Object must be of type Package with at least one Buffer element */
|
||||
|
||||
if (ObjDesc->Type != ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BufferDesc = &ObjDesc->Package.Elements[0];
|
||||
if (BufferDesc->Type != ACPI_TYPE_BUFFER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Convert _PLD buffer to local _PLD struct */
|
||||
|
||||
Status = AcpiDecodePldBuffer (BufferDesc->Buffer.Pointer,
|
||||
BufferDesc->Buffer.Length, &PldInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Encode local _PLD struct back to a _PLD buffer */
|
||||
|
||||
NewBuffer = AcpiDbEncodePldBuffer (PldInfo);
|
||||
if (!NewBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* The two bit-packed buffers should match */
|
||||
|
||||
if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer,
|
||||
BufferDesc->Buffer.Length))
|
||||
{
|
||||
AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n");
|
||||
|
||||
AcpiUtDumpBuffer (NewBuffer,
|
||||
BufferDesc->Buffer.Length, DB_BYTE_DISPLAY, 0);
|
||||
}
|
||||
|
||||
/* First 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color);
|
||||
|
||||
/* Second 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height);
|
||||
|
||||
/* Third 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay);
|
||||
|
||||
/* Fourth 32-bit dword */
|
||||
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order);
|
||||
|
||||
/* Fifth 32-bit dword */
|
||||
|
||||
if (BufferDesc->Buffer.Length > 16)
|
||||
{
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset);
|
||||
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset);
|
||||
}
|
||||
|
||||
ACPI_FREE (PldInfo);
|
||||
ACPI_FREE (NewBuffer);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbExecute
|
||||
@ -983,12 +484,10 @@ AcpiDbExecute (
|
||||
|
||||
Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
|
||||
&AcpiGbl_DbMethodInfo.Method);
|
||||
if (ACPI_FAILURE (Status))
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
return;
|
||||
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
|
||||
}
|
||||
|
||||
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
|
||||
ACPI_FREE (NameString);
|
||||
}
|
||||
|
||||
@ -998,7 +497,6 @@ AcpiDbExecute (
|
||||
*/
|
||||
AcpiOsSleep ((UINT64) 10);
|
||||
|
||||
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
|
||||
/* Memory allocation tracking */
|
||||
|
@ -6,7 +6,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -210,7 +210,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
|
||||
{"RESOURCES", 1},
|
||||
{"RESULTS", 0},
|
||||
{"SET", 3},
|
||||
{"SLEEP", 1},
|
||||
{"SLEEP", 0},
|
||||
{"STATS", 1},
|
||||
{"STOP", 0},
|
||||
{"TABLES", 0},
|
||||
@ -274,7 +274,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
|
||||
{1, " References <Addr>", "Find all references to object at addr\n"},
|
||||
{1, " Resources <DeviceName | *>", "Display Device resources (* = all devices)\n"},
|
||||
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
|
||||
{1, " Sleep <SleepState>", "Simulate sleep/wake sequence\n"},
|
||||
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
|
||||
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
|
||||
{1, " Terminate", "Delete namespace and all internal objects\n"},
|
||||
{1, " Type <Object>", "Display object type\n"},
|
||||
@ -1168,6 +1168,8 @@ AcpiDbUserCommands (
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
|
||||
/* TBD: [Restructure] Need a separate command line buffer for step mode */
|
||||
|
||||
while (!AcpiGbl_DbTerminateThreads)
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -396,7 +396,7 @@ AcpiDbDisassembleMethod (
|
||||
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
|
||||
|
||||
Status = AcpiPsParseAml (WalkState);
|
||||
AcpiDmParseDeferredOps (Op);
|
||||
(void) AcpiDmParseDeferredOps (Op);
|
||||
|
||||
/* Now we can disassemble the method */
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -159,7 +159,7 @@ AcpiDbSetScope (
|
||||
|
||||
AcpiDbPrepNamestring (Name);
|
||||
|
||||
if (Name[0] == '\\')
|
||||
if (ACPI_IS_ROOT_PREFIX (Name[0]))
|
||||
{
|
||||
/* Validate new scope from the root */
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -286,7 +286,7 @@ AcpiDbPrepNamestring (
|
||||
|
||||
/* Ignore a leading backslash, this is the root prefix */
|
||||
|
||||
if (*Name == '\\')
|
||||
if (ACPI_IS_ROOT_PREFIX (*Name))
|
||||
{
|
||||
Name++;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -421,9 +421,9 @@ AcpiDbInitialize (
|
||||
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
|
||||
|
||||
AcpiGbl_DbOpt_tables = FALSE;
|
||||
AcpiGbl_DbOpt_disasm = FALSE;
|
||||
AcpiGbl_DbOpt_stats = FALSE;
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
AcpiGbl_DbOpt_disasm = FALSE;
|
||||
AcpiGbl_DbOpt_verbose = TRUE;
|
||||
#endif
|
||||
AcpiGbl_DbOpt_ini_methods = TRUE;
|
||||
@ -437,7 +437,7 @@ AcpiDbInitialize (
|
||||
|
||||
/* Initial scope is the root */
|
||||
|
||||
AcpiGbl_DbScopeBuf [0] = '\\';
|
||||
AcpiGbl_DbScopeBuf [0] = AML_ROOT_PREFIX;
|
||||
AcpiGbl_DbScopeBuf [1] = 0;
|
||||
AcpiGbl_DbScopeNode = AcpiGbl_RootNode;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -83,7 +83,7 @@ AcpiDmParseDeferredOps (
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME (DmParseDeferredOps);
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* Traverse the entire parse tree */
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -44,7 +44,6 @@
|
||||
|
||||
#include <contrib/dev/acpica/include/acpi.h>
|
||||
#include <contrib/dev/acpica/include/accommon.h>
|
||||
#include <contrib/dev/acpica/include/acparser.h>
|
||||
#include <contrib/dev/acpica/include/amlcode.h>
|
||||
#include <contrib/dev/acpica/include/acnamesp.h>
|
||||
#include <contrib/dev/acpica/include/acdisasm.h>
|
||||
@ -226,7 +225,8 @@ AcpiDmNamestring (
|
||||
|
||||
/* Handle all Scope Prefix operators */
|
||||
|
||||
while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))
|
||||
while (ACPI_IS_ROOT_PREFIX (ACPI_GET8 (Name)) ||
|
||||
ACPI_IS_PARENT_PREFIX (ACPI_GET8 (Name)))
|
||||
{
|
||||
/* Append prefix character */
|
||||
|
||||
@ -323,7 +323,7 @@ AcpiDmDisplayPath (
|
||||
|
||||
if ((NamePath) &&
|
||||
(NamePath->Common.Value.String) &&
|
||||
(NamePath->Common.Value.String[0] == '\\'))
|
||||
(ACPI_IS_ROOT_PREFIX (NamePath->Common.Value.String[0])))
|
||||
{
|
||||
AcpiDmNamestring (NamePath->Common.Value.String);
|
||||
return;
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -415,7 +415,8 @@ AcpiDmIsResourceTemplate (
|
||||
|
||||
/* Walk the byte list, abort on any invalid descriptor type or length */
|
||||
|
||||
Status = AcpiUtWalkAmlResources (WalkState, Aml, Length, NULL, &EndAml);
|
||||
Status = AcpiUtWalkAmlResources (WalkState, Aml, Length,
|
||||
NULL, (void **) &EndAml);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_TYPE);
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2012, Intel Corp.
|
||||
* Copyright (C) 2000 - 2013, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -441,7 +441,30 @@ AcpiDmDescendingOp (
|
||||
* This is a first-level element of a term list,
|
||||
* indent a new line
|
||||
*/
|
||||
AcpiDmIndent (Level);
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_NOOP_OP:
|
||||
/*
|
||||
* Optionally just ignore this opcode. Some tables use
|
||||
* NoOp opcodes for "padding" out packages that the BIOS
|
||||
* changes dynamically. This can leave hundreds or
|
||||
* thousands of NoOp opcodes that if disassembled,
|
||||
* cannot be compiled because they are syntactically
|
||||
* incorrect.
|
||||
*/
|
||||
if (AcpiGbl_IgnoreNoopOperator)
|
||||
{
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Fallthrough */
|
||||
|
||||
default:
|
||||
AcpiDmIndent (Level);
|
||||
break;
|
||||
}
|
||||
|
||||
Info->LastLevel = Level;
|
||||
Info->Count = 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user