Import ACPICA 20170929.
This commit is contained in:
parent
e307708b8c
commit
47a1bf954c
100
changes.txt
100
changes.txt
@ -1,3 +1,103 @@
|
||||
----------------------------------------
|
||||
29 September 2017. Summary of changes for version 20170929:
|
||||
|
||||
|
||||
1) ACPICA kernel-resident subsystem:
|
||||
|
||||
Redesigned and implemented an improved ASL While() loop timeout
|
||||
mechanism. This mechanism is used to prevent infinite loops in the kernel
|
||||
AML interpreter caused by either non-responsive hardware or incorrect AML
|
||||
code. The new implementation uses AcpiOsGetTimer instead of a simple
|
||||
maximum loop count, and is thus more accurate and constant across
|
||||
different machines. The default timeout is currently 30 seconds, but this
|
||||
may be adjusted later.
|
||||
|
||||
Renamed the ACPI_AML_INFINITE_LOOP exception to AE_AML_LOOP_TIMEOUT to
|
||||
better reflect the new implementation of the loop timeout mechanism.
|
||||
|
||||
Updated the AcpiGetTimerDuration interface to cleanup the 64-bit support
|
||||
and to fix an off-by-one error. Jung-uk Kim.
|
||||
|
||||
Fixed an EFI build problem by updating the makefiles to for a new file
|
||||
that was added, utstrsuppt.c
|
||||
|
||||
|
||||
2) iASL Compiler/Disassembler and Tools:
|
||||
|
||||
Implemented full support for the PDTT, SDEV, and TPM2 ACPI tables. This
|
||||
includes support in the table disassembler, compiler, and template
|
||||
generator.
|
||||
|
||||
iASL: Added an exception for an illegal type of recursive method
|
||||
invocation. If a method creates named objects, the first recursive call
|
||||
will fail at runtime. This change adds an error detection at compile time
|
||||
to catch the problem up front. Note: Marking such a method as
|
||||
"serialized" will not help with this problem, because the same thread can
|
||||
acquire the method mutex more than once. Example compiler and runtime
|
||||
output:
|
||||
|
||||
Method (MTH1)
|
||||
{
|
||||
Name (INT1, 1)
|
||||
MTH1 ()
|
||||
}
|
||||
|
||||
dsdt.asl 22: MTH1 ()
|
||||
Error 6152 - ^ Illegal recursive call to method
|
||||
that creates named objects (MTH1)
|
||||
|
||||
Previous runtime exception:
|
||||
ACPI Error: [INT1] Namespace lookup failure,
|
||||
AE_ALREADY_EXISTS (20170831/dswload2-465)
|
||||
|
||||
iASL: Updated support for External() opcodes to improve namespace
|
||||
management and error detection. These changes are related to issues seen
|
||||
with multiple-segment namespace pathnames within External declarations,
|
||||
such as below:
|
||||
|
||||
External(\_SB.PCI0.GFX0, DeviceObj)
|
||||
External(\_SB.PCI0.GFX0.ALSI)
|
||||
|
||||
iASL: Implemented support for multi-line error/warning messages. This
|
||||
enables more detailed and helpful error messages as below, from the
|
||||
initial deployment for the duplicate names error:
|
||||
|
||||
DSDT.iiii 1692: Device(PEG2) {
|
||||
Error 6074 - ^ Name already exists in scope
|
||||
(PEG2)
|
||||
|
||||
Original name creation/declaration below:
|
||||
DSDT.iiii 93: External(\_SB.PCI0.PEG2, DeviceObj)
|
||||
|
||||
AcpiXtract: Added additional flexibility to support differing input hex
|
||||
dump formats. Specifically, hex dumps that contain partial disassembly
|
||||
and/or comments within the ACPI table data definition. There exist some
|
||||
dump utilities seen in the field that create this type of hex dump (such
|
||||
as Simics). For example:
|
||||
|
||||
DSDT @ 0xdfffd0c0 (10999 bytes)
|
||||
Signature DSDT
|
||||
Length 10999
|
||||
Revision 1
|
||||
Checksum 0xf3 (Ok)
|
||||
OEM_ID BXPC
|
||||
OEM_table_id BXDSDT
|
||||
OEM_revision 1
|
||||
Creator_id 1280593481
|
||||
Creator_revision 537399345
|
||||
0000: 44 53 44 54 f7 2a 00 00 01 f3 42 58 50 43 00 00
|
||||
...
|
||||
2af0: 5f 4c 30 46 00 a4 01
|
||||
|
||||
Test suite: Miscellaneous changes/fixes:
|
||||
More cleanup and simplification of makefiles
|
||||
Continue compilation of test cases after a compile failure
|
||||
Do not perform binary compare unless both files actually exist
|
||||
|
||||
iASL: Performed some code/module restructuring. Moved all memory
|
||||
allocation functions to new modules. Two new files, aslallocate.c and
|
||||
aslcache.c
|
||||
|
||||
----------------------------------------
|
||||
31 August 2017. Summary of changes for version 20170831:
|
||||
|
||||
|
@ -140,6 +140,7 @@ OBJECTS = \
|
||||
$(OBJDIR)/hwpci.o\
|
||||
$(OBJDIR)/hwregs.o\
|
||||
$(OBJDIR)/hwsleep.o\
|
||||
$(OBJDIR)/hwtimer.o\
|
||||
$(OBJDIR)/hwvalid.o\
|
||||
$(OBJDIR)/hwxface.o\
|
||||
$(OBJDIR)/hwxfsleep.o\
|
||||
|
@ -51,9 +51,11 @@ OBJECTS = \
|
||||
$(OBJDIR)/ahpredef.o\
|
||||
$(OBJDIR)/ahtable.o\
|
||||
$(OBJDIR)/ahuuids.o\
|
||||
$(OBJDIR)/aslallocate.o\
|
||||
$(OBJDIR)/aslanalyze.o\
|
||||
$(OBJDIR)/aslascii.o\
|
||||
$(OBJDIR)/aslbtypes.o\
|
||||
$(OBJDIR)/aslcache.o\
|
||||
$(OBJDIR)/aslcodegen.o\
|
||||
$(OBJDIR)/aslcompile.o\
|
||||
$(OBJDIR)/asldebug.o\
|
||||
|
@ -314,7 +314,7 @@ FlGenerateFilename (
|
||||
* Copy the original filename to a new buffer. Leave room for the worst
|
||||
* case where we append the suffix, an added dot and the null terminator.
|
||||
*/
|
||||
NewFilename = UtStringCacheCalloc ((ACPI_SIZE)
|
||||
NewFilename = UtLocalCacheCalloc ((ACPI_SIZE)
|
||||
strlen (InputFilename) + strlen (Suffix) + 2);
|
||||
strcpy (NewFilename, InputFilename);
|
||||
|
||||
@ -358,7 +358,7 @@ FlStrdup (
|
||||
char *NewString;
|
||||
|
||||
|
||||
NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1);
|
||||
NewString = UtLocalCacheCalloc ((ACPI_SIZE) strlen (String) + 1);
|
||||
strcpy (NewString, String);
|
||||
return (NewString);
|
||||
}
|
||||
|
@ -232,6 +232,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] =
|
||||
{ACPI_SIG_MTMR, "MID Timer Table"},
|
||||
{ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"},
|
||||
{ACPI_SIG_PCCT, "Platform Communications Channel Table"},
|
||||
{ACPI_SIG_PDTT, "Platform Debug Trigger Table"},
|
||||
{ACPI_SIG_PMTT, "Platform Memory Topology Table"},
|
||||
{ACPI_SIG_PPTT, "Processor Properties Topology Table"},
|
||||
{ACPI_SIG_RASF, "RAS Features Table"},
|
||||
@ -240,6 +241,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] =
|
||||
{ACPI_SIG_S3PT, "S3 Performance Table"},
|
||||
{ACPI_SIG_SBST, "Smart Battery Specification Table"},
|
||||
{ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"},
|
||||
{ACPI_SIG_SDEV, "Secure Devices table"},
|
||||
{ACPI_SIG_SLIC, "Software Licensing Description Table"},
|
||||
{ACPI_SIG_SLIT, "System Locality Information Table"},
|
||||
{ACPI_SIG_SPCR, "Serial Port Console Redirection table"},
|
||||
|
@ -154,7 +154,6 @@
|
||||
#include "acdisasm.h"
|
||||
#include "actables.h"
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
/* This module used for application-level code only */
|
||||
|
||||
@ -290,9 +289,9 @@ static const char *AcpiDmHestSubnames[] =
|
||||
"IA-32 Machine Check Exception",
|
||||
"IA-32 Corrected Machine Check",
|
||||
"IA-32 Non-Maskable Interrupt",
|
||||
"Unknown SubTable Type", /* 3 - Reserved */
|
||||
"Unknown SubTable Type", /* 4 - Reserved */
|
||||
"Unknown SubTable Type", /* 5 - Reserved */
|
||||
"Unknown Subtable Type", /* 3 - Reserved */
|
||||
"Unknown Subtable Type", /* 4 - Reserved */
|
||||
"Unknown Subtable Type", /* 5 - Reserved */
|
||||
"PCI Express Root Port AER",
|
||||
"PCI Express AER (AER Endpoint)",
|
||||
"PCI Express/PCI-X Bridge AER",
|
||||
@ -374,7 +373,7 @@ static const char *AcpiDmPmttSubnames[] =
|
||||
{
|
||||
"Socket", /* ACPI_PMTT_TYPE_SOCKET */
|
||||
"Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */
|
||||
"Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
|
||||
"Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */
|
||||
"Unknown Subtable Type" /* Reserved */
|
||||
};
|
||||
|
||||
@ -382,7 +381,14 @@ static const char *AcpiDmPpttSubnames[] =
|
||||
{
|
||||
"Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */
|
||||
"Cache Type", /* ACPI_PPTT_TYPE_CACHE */
|
||||
"ID", /* ACPI_PMTT_TYPE_ID */
|
||||
"ID", /* ACPI_PPTT_TYPE_ID */
|
||||
"Unknown Subtable Type" /* Reserved */
|
||||
};
|
||||
|
||||
static const char *AcpiDmSdevSubnames[] =
|
||||
{
|
||||
"Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
|
||||
"PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
|
||||
"Unknown Subtable Type" /* Reserved */
|
||||
};
|
||||
|
||||
@ -396,6 +402,23 @@ static const char *AcpiDmSratSubnames[] =
|
||||
"Unknown Subtable Type" /* Reserved */
|
||||
};
|
||||
|
||||
static const char *AcpiDmTpm2Subnames[] =
|
||||
{
|
||||
"Illegal Start Method value",
|
||||
"Reserved",
|
||||
"ACPI Start Method",
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
"Memory Mapped I/O",
|
||||
"Command Response Buffer",
|
||||
"Command Response Buffer with ACPI Start Method",
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
"Command Response Buffer with ARM SMC",
|
||||
"Unknown Subtable Type" /* Reserved */
|
||||
};
|
||||
|
||||
static const char *AcpiDmIvrsSubnames[] =
|
||||
{
|
||||
"Hardware Definition Block",
|
||||
@ -487,6 +510,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr},
|
||||
{ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit},
|
||||
{ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct},
|
||||
{ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt},
|
||||
{ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt},
|
||||
{ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt},
|
||||
{ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
|
||||
@ -494,6 +518,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt},
|
||||
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst},
|
||||
{ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei},
|
||||
{ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev},
|
||||
{ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic},
|
||||
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit},
|
||||
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr},
|
||||
@ -501,7 +526,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
|
||||
{ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
|
||||
{ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
|
||||
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
|
||||
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2},
|
||||
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
|
||||
{ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
|
||||
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet},
|
||||
@ -917,6 +942,7 @@ AcpiDmDumpTable (
|
||||
case ACPI_DMT_PCCT:
|
||||
case ACPI_DMT_PMTT:
|
||||
case ACPI_DMT_PPTT:
|
||||
case ACPI_DMT_SDEV:
|
||||
case ACPI_DMT_SRAT:
|
||||
case ACPI_DMT_ASF:
|
||||
case ACPI_DMT_HESTNTYP:
|
||||
@ -948,6 +974,7 @@ AcpiDmDumpTable (
|
||||
case ACPI_DMT_NAME4:
|
||||
case ACPI_DMT_SIG:
|
||||
case ACPI_DMT_LPIT:
|
||||
case ACPI_DMT_TPM2:
|
||||
|
||||
ByteLength = 4;
|
||||
break;
|
||||
@ -1583,6 +1610,20 @@ AcpiDmDumpTable (
|
||||
CurrentOffset, NULL);
|
||||
break;
|
||||
|
||||
case ACPI_DMT_SDEV:
|
||||
|
||||
/* SDEV subtable types */
|
||||
|
||||
Temp8 = *Target;
|
||||
if (Temp8 > ACPI_SDEV_TYPE_RESERVED)
|
||||
{
|
||||
Temp8 = ACPI_SDEV_TYPE_RESERVED;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (UINT8_FORMAT, *Target,
|
||||
AcpiDmSdevSubnames[Temp8]);
|
||||
break;
|
||||
|
||||
case ACPI_DMT_SRAT:
|
||||
|
||||
/* SRAT subtable types */
|
||||
@ -1597,6 +1638,22 @@ AcpiDmDumpTable (
|
||||
AcpiDmSratSubnames[Temp8]);
|
||||
break;
|
||||
|
||||
case ACPI_DMT_TPM2:
|
||||
|
||||
/* TPM2 Start Method types */
|
||||
|
||||
Temp8 = *Target;
|
||||
if (Temp8 > ACPI_TPM2_RESERVED)
|
||||
{
|
||||
Temp8 = ACPI_TPM2_RESERVED;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (UINT8_FORMAT, *Target,
|
||||
AcpiDmTpm2Subnames[Temp8]);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case ACPI_DMT_FADTPM:
|
||||
|
||||
/* FADT Preferred PM Profile names */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -214,11 +214,13 @@
|
||||
#define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f)
|
||||
#define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f)
|
||||
#define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f)
|
||||
#define ACPI_PDTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PDTT,f)
|
||||
#define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f)
|
||||
#define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f)
|
||||
#define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f)
|
||||
#define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f)
|
||||
#define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f)
|
||||
#define ACPI_SDEV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEV,f)
|
||||
#define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
|
||||
#define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f)
|
||||
#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
|
||||
@ -339,6 +341,7 @@
|
||||
#define ACPI_PCCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f)
|
||||
#define ACPI_PCCT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f)
|
||||
#define ACPI_PCCT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f)
|
||||
#define ACPI_PDTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PDTT_CHANNEL,f)
|
||||
#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f)
|
||||
#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f)
|
||||
#define ACPI_PMTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f)
|
||||
@ -351,6 +354,10 @@
|
||||
#define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f)
|
||||
#define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f)
|
||||
#define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f)
|
||||
#define ACPI_SDEVH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_HEADER,f)
|
||||
#define ACPI_SDEV0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_NAMESPACE,f)
|
||||
#define ACPI_SDEV1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE,f)
|
||||
#define ACPI_SDEV1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE_PATH,f)
|
||||
#define ACPI_SLIC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIC,f)
|
||||
#define ACPI_SRATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
|
||||
#define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
|
||||
@ -360,6 +367,8 @@
|
||||
#define ACPI_SRAT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GIC_ITS_AFFINITY,f)
|
||||
#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f)
|
||||
#define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f)
|
||||
#define ACPI_TPM2A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_TRAILER,f)
|
||||
#define ACPI_TPM211_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_ARM_SMC,f)
|
||||
#define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)
|
||||
#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)
|
||||
|
||||
@ -415,7 +424,9 @@
|
||||
#define ACPI_PCCT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f,o)
|
||||
#define ACPI_PCCT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f,o)
|
||||
#define ACPI_PCCT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f,o)
|
||||
#define ACPI_PDTT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PDTT_CHANNEL,f,o)
|
||||
#define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o)
|
||||
#define ACPI_SDEVH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SDEV_HEADER,f,o)
|
||||
#define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o)
|
||||
#define ACPI_WSMT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WSMT,f,o)
|
||||
#define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o)
|
||||
@ -896,7 +907,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/* Resource Descriptor subtable */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] =
|
||||
@ -1260,6 +1270,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[] =
|
||||
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesExit), "Exit Services Exit", 0},
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* GTDT - Generic Timer Description Table
|
||||
@ -1853,6 +1864,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* IVRS - I/O Virtualization Reporting Structure
|
||||
@ -2219,6 +2231,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* MCFG - PCI Memory Mapped Configuration table and Subtable
|
||||
@ -2696,6 +2709,31 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* PDTT - Platform Debug Trigger Table (ACPI 6.2)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[] =
|
||||
{
|
||||
{ACPI_DMT_UINT8, ACPI_PDTT_OFFSET (TriggerCount), "Trigger Count", 0},
|
||||
{ACPI_DMT_UINT24, ACPI_PDTT_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PDTT_OFFSET (ArrayOffset), "Array Offset", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[] =
|
||||
{
|
||||
{ACPI_DMT_UINT8, ACPI_PDTT0_OFFSET (SubchannelId), "Subchannel Id", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_PDTT0_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG},
|
||||
{ACPI_DMT_FLAG0, ACPI_PDTT0_FLAG_OFFSET (Flags,0), "Runtime Trigger", 0},
|
||||
{ACPI_DMT_FLAG1, ACPI_PDTT0_FLAG_OFFSET (Flags,0), "Wait for Completion", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* PMTT - Platform Memory Topology Table
|
||||
@ -2768,16 +2806,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SDEI - Software Delegated Execption Interface Descriptor Table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] =
|
||||
{
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -2801,7 +2829,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[] =
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[] =
|
||||
{
|
||||
{ACPI_DMT_UINT16, ACPI_PPTT0_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Flags), "Flags", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Flags), "Flags (decoded below)", 0},
|
||||
{ACPI_DMT_FLAG0, ACPI_PPTT0_FLAG_OFFSET (Flags,0), "Physical package", 0},
|
||||
{ACPI_DMT_FLAG1, ACPI_PPTT0_FLAG_OFFSET (Flags,0), "ACPI Processor ID valid", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Parent), "Parent", 0},
|
||||
@ -2821,7 +2849,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[] =
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[] =
|
||||
{
|
||||
{ACPI_DMT_UINT16, ACPI_PPTT1_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Flags), "Flags", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Flags), "Flags (decoded below)", 0},
|
||||
{ACPI_DMT_FLAG0, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Size valid", 0},
|
||||
{ACPI_DMT_FLAG1, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Number of Sets valid", 0},
|
||||
{ACPI_DMT_FLAG2, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Associativity valid", 0},
|
||||
@ -2855,6 +2883,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* RASF - RAS Feature table
|
||||
@ -2867,6 +2896,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[] =
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* S3PT - S3 Performance Table
|
||||
@ -2925,6 +2955,86 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] =
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SDEI - Software Delegated Execption Interface Descriptor Table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] =
|
||||
{
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SDEV - Secure Devices Table (ACPI 6.2)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev[] =
|
||||
{
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* Common Subtable header (one per Subtable) */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdevHdr[] =
|
||||
{
|
||||
{ACPI_DMT_SDEV, ACPI_SDEVH_OFFSET (Type), "Subtable Type", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_SDEVH_OFFSET (Flags), "Flags (decoded below)", 0},
|
||||
{ACPI_DMT_FLAG0, ACPI_SDEVH_FLAG_OFFSET (Flags,0), "Allow handoff to unsecure OS", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEVH_OFFSET (Length), "Length", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* SDEV Subtables */
|
||||
|
||||
/* 0: Namespace Device Based Secure Device Structure */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0[] =
|
||||
{
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (DeviceIdOffset), "Device ID Offset", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (DeviceIdLength), "Device ID Length", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (VendorDataOffset), "Vendor Data Offset", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (VendorDataLength), "Vendor Data Length", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0a[] =
|
||||
{
|
||||
{ACPI_DMT_STRING, 0, "Namepath", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* 1: PCIe Endpoint Device Based Device Structure */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1[] =
|
||||
{
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (Segment), "Segment", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (StartBus), "Start Bus", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (PathOffset), "Path Offset", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (PathLength), "Path Length", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (VendorDataOffset), "Vendor Data Offset", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (VendorDataLength), "Vendor Data Length", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1a[] =
|
||||
{
|
||||
{ACPI_DMT_UINT8, ACPI_SDEV1A_OFFSET (Device), "Device", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_SDEV1A_OFFSET (Function), "Function", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1b[] =
|
||||
{
|
||||
{ACPI_DMT_RAW_BUFFER, 0, "Vendor Data", 0}, /*, DT_OPTIONAL}, */
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SLIC - Software Licensing Description Table. This table contains the standard
|
||||
@ -3186,7 +3296,29 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[] =
|
||||
{ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (PlatformClass), "Platform Class", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT64, ACPI_TPM2_OFFSET (ControlAddress), "Control Address", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0},
|
||||
{ACPI_DMT_TPM2, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* Optional trailer. LogLength and LogAddress are additionally optional */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2a[] =
|
||||
{
|
||||
{ACPI_DMT_BUF12, ACPI_TPM2A_OFFSET (MethodParameters), "Method Parameters", DT_OPTIONAL},
|
||||
{ACPI_DMT_UINT32, ACPI_TPM2A_OFFSET (MinimumLogLength), "Minimum Log Length", DT_OPTIONAL},
|
||||
{ACPI_DMT_UINT64, ACPI_TPM2A_OFFSET (LogAddress), "Log Address", DT_OPTIONAL},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
/* 11: Start Method for ARM SMC */
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoTpm211[] =
|
||||
{
|
||||
{ACPI_DMT_UINT32, ACPI_TPM211_OFFSET (GlobalInterrupt), "Global Interrupt", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_TPM211_OFFSET (InterruptFlags), "Interrupt Flags", 0},
|
||||
{ACPI_DMT_UINT8, ACPI_TPM211_OFFSET (OperationFlags), "Operation Flags", 0},
|
||||
{ACPI_DMT_UINT16, ACPI_TPM211_OFFSET (Reserved), "Reserved", 0},
|
||||
{ACPI_DMT_UINT32, ACPI_TPM211_OFFSET (FunctionId), "Function ID", 0},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
303
source/compiler/aslallocate.c
Normal file
303
source/compiler/aslallocate.c
Normal file
@ -0,0 +1,303 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslallocate -- Local memory allocation
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Alternatively, you may choose to be licensed under the terms of the
|
||||
* following license:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Alternatively, you may choose to be licensed under the terms of the
|
||||
* GNU General Public License ("GPL") version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
|
||||
/*
|
||||
* Local heap allocation wrappers. See aslcache.c for allocation from local
|
||||
* cache alloctions
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCalloc
|
||||
*
|
||||
* PARAMETERS: Size - Bytes to be allocated
|
||||
*
|
||||
* RETURN: Pointer to the allocated memory. If this function returns
|
||||
* (the compiler is not aborted), the pointer is guaranteed to
|
||||
* be valid.
|
||||
*
|
||||
* DESCRIPTION: Allocate zero-initialized memory. The point of this function
|
||||
* is to abort the compile on an allocation failure, on the
|
||||
* assumption that nothing more can be accomplished.
|
||||
*
|
||||
* NOTE: For allocation from the local caches, see aslcache.c
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void *
|
||||
UtLocalCalloc (
|
||||
UINT32 Size)
|
||||
{
|
||||
void *Allocated;
|
||||
|
||||
|
||||
Allocated = ACPI_ALLOCATE_ZEROED (Size);
|
||||
if (!Allocated)
|
||||
{
|
||||
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
|
||||
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
|
||||
Gbl_InputByteCount, Gbl_CurrentColumn,
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
|
||||
|
||||
CmCleanupAndExit ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
TotalAllocations++;
|
||||
TotalAllocated += Size;
|
||||
return (Allocated);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtExpandLineBuffers
|
||||
*
|
||||
* PARAMETERS: None. Updates global line buffer pointers.
|
||||
*
|
||||
* RETURN: None. Reallocates the global line buffers
|
||||
*
|
||||
* DESCRIPTION: Called if the current line buffer becomes filled. Reallocates
|
||||
* all global line buffers and updates Gbl_LineBufferSize. NOTE:
|
||||
* Also used for the initial allocation of the buffers, when
|
||||
* all of the buffer pointers are NULL. Initial allocations are
|
||||
* of size ASL_DEFAULT_LINE_BUFFER_SIZE
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
UtExpandLineBuffers (
|
||||
void)
|
||||
{
|
||||
UINT32 NewSize;
|
||||
|
||||
|
||||
/* Attempt to double the size of all line buffers */
|
||||
|
||||
NewSize = Gbl_LineBufferSize * 2;
|
||||
if (Gbl_CurrentLineBuffer)
|
||||
{
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"Increasing line buffer size from %u to %u\n",
|
||||
Gbl_LineBufferSize, NewSize);
|
||||
}
|
||||
|
||||
UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
|
||||
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
|
||||
Gbl_LineBufferSize = NewSize;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtReallocLineBuffers
|
||||
*
|
||||
* PARAMETERS: Buffer - Buffer to realloc
|
||||
* OldSize - Old size of Buffer
|
||||
* NewSize - New size of Buffer
|
||||
*
|
||||
* RETURN: none
|
||||
*
|
||||
* DESCRIPTION: Reallocate and initialize Buffer
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
UtReallocLineBuffers (
|
||||
char **Buffer,
|
||||
UINT32 OldSize,
|
||||
UINT32 NewSize)
|
||||
{
|
||||
|
||||
*Buffer = realloc (*Buffer, NewSize);
|
||||
if (*Buffer)
|
||||
{
|
||||
memset (*Buffer + OldSize, 0, NewSize - OldSize);
|
||||
return;
|
||||
}
|
||||
|
||||
printf ("Could not increase line buffer size from %u to %u\n",
|
||||
OldSize, NewSize);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, NULL, NULL);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtFreeLineBuffers
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Free all line buffers
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
UtFreeLineBuffers (
|
||||
void)
|
||||
{
|
||||
|
||||
free (Gbl_CurrentLineBuffer);
|
||||
free (Gbl_MainTokenBuffer);
|
||||
free (Gbl_MacroTokenBuffer);
|
||||
free (Gbl_ExpressionTokenBuffer);
|
||||
}
|
481
source/compiler/aslcache.c
Normal file
481
source/compiler/aslcache.c
Normal file
@ -0,0 +1,481 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslcache -- Local cache support for iASL
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Alternatively, you may choose to be licensed under the terms of the
|
||||
* following license:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Alternatively, you may choose to be licensed under the terms of the
|
||||
* GNU General Public License ("GPL") version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
|
||||
/*
|
||||
* Local caches. The caches are fully deleted after the compilation/disassembly
|
||||
* of each individual input file. Thus, individual allocations from the cache
|
||||
* memory do not need to be freed or even released back into the cache.
|
||||
*
|
||||
* See aslallocate.c for standard heap allocations.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCacheCalloc
|
||||
*
|
||||
* PARAMETERS: Length - Size of buffer requested
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts compiler on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a string buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
UtLocalCacheCalloc (
|
||||
UINT32 Length)
|
||||
{
|
||||
char *Buffer;
|
||||
ASL_CACHE_INFO *Cache;
|
||||
UINT32 CacheSize = ASL_STRING_CACHE_SIZE;
|
||||
|
||||
|
||||
if (Length > CacheSize)
|
||||
{
|
||||
CacheSize = Length;
|
||||
|
||||
if (Gbl_StringCacheList)
|
||||
{
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
|
||||
|
||||
/* Link new cache buffer just following head of list */
|
||||
|
||||
Cache->Next = Gbl_StringCacheList->Next;
|
||||
Gbl_StringCacheList->Next = Cache;
|
||||
|
||||
/* Leave cache management pointers alone as they pertain to head */
|
||||
|
||||
Gbl_StringCount++;
|
||||
Gbl_StringSize += Length;
|
||||
|
||||
return (Cache->Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_StringCacheList;
|
||||
Gbl_StringCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_StringCacheNext = Cache->Buffer;
|
||||
Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize;
|
||||
}
|
||||
|
||||
Gbl_StringCount++;
|
||||
Gbl_StringSize += Length;
|
||||
|
||||
Buffer = Gbl_StringCacheNext;
|
||||
Gbl_StringCacheNext += Length;
|
||||
return (Buffer);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtParseOpCacheCalloc
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: New parse op. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a new parse op for the parse tree. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
UtParseOpCacheCalloc (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_ParseOpCacheList;
|
||||
Gbl_ParseOpCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer);
|
||||
Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_ParseOpCount++;
|
||||
return (Gbl_ParseOpCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtSubtableCacheCalloc - Data Table compiler
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a subtable object buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
DT_SUBTABLE *
|
||||
UtSubtableCacheCalloc (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_SubtableCacheList;
|
||||
Gbl_SubtableCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer);
|
||||
Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_SubtableCount++;
|
||||
return (Gbl_SubtableCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtFieldCacheCalloc - Data Table compiler
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a field object buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
DT_FIELD *
|
||||
UtFieldCacheCalloc (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_FieldCacheList;
|
||||
Gbl_FieldCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer);
|
||||
Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_FieldCount++;
|
||||
return (Gbl_FieldCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtDeleteLocalCaches
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Delete all local cache buffer blocks
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
UtDeleteLocalCaches (
|
||||
void)
|
||||
{
|
||||
UINT32 BufferCount;
|
||||
ASL_CACHE_INFO *Next;
|
||||
|
||||
|
||||
/*
|
||||
* Generic cache, arbitrary size allocations
|
||||
*/
|
||||
BufferCount = 0;
|
||||
while (Gbl_StringCacheList)
|
||||
{
|
||||
Next = Gbl_StringCacheList->Next;
|
||||
ACPI_FREE (Gbl_StringCacheList);
|
||||
Gbl_StringCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n",
|
||||
Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount);
|
||||
|
||||
/* Reset cache globals */
|
||||
|
||||
Gbl_StringSize = 0;
|
||||
Gbl_StringCount = 0;
|
||||
Gbl_StringCacheNext = NULL;
|
||||
Gbl_StringCacheLast = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Parse Op cache
|
||||
*/
|
||||
BufferCount = 0;
|
||||
while (Gbl_ParseOpCacheList)
|
||||
{
|
||||
Next = Gbl_ParseOpCacheList->Next;
|
||||
ACPI_FREE (Gbl_ParseOpCacheList);
|
||||
Gbl_ParseOpCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n",
|
||||
Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE,
|
||||
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
|
||||
|
||||
/* Reset cache globals */
|
||||
|
||||
Gbl_ParseOpCount = 0;
|
||||
Gbl_ParseOpCacheNext = NULL;
|
||||
Gbl_ParseOpCacheLast = NULL;
|
||||
Gbl_ParseTreeRoot = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Table Compiler - Field cache
|
||||
*/
|
||||
BufferCount = 0;
|
||||
while (Gbl_FieldCacheList)
|
||||
{
|
||||
Next = Gbl_FieldCacheList->Next;
|
||||
ACPI_FREE (Gbl_FieldCacheList);
|
||||
Gbl_FieldCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n",
|
||||
Gbl_FieldCount, ASL_FIELD_CACHE_SIZE,
|
||||
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
|
||||
|
||||
/* Reset cache globals */
|
||||
|
||||
Gbl_FieldCount = 0;
|
||||
Gbl_FieldCacheNext = NULL;
|
||||
Gbl_FieldCacheLast = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Table Compiler - Subtable cache
|
||||
*/
|
||||
BufferCount = 0;
|
||||
while (Gbl_SubtableCacheList)
|
||||
{
|
||||
Next = Gbl_SubtableCacheList->Next;
|
||||
ACPI_FREE (Gbl_SubtableCacheList);
|
||||
Gbl_SubtableCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n",
|
||||
Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE,
|
||||
(sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
|
||||
|
||||
/* Reset cache globals */
|
||||
|
||||
Gbl_SubtableCount = 0;
|
||||
Gbl_SubtableCacheNext = NULL;
|
||||
Gbl_SubtableCacheLast = NULL;
|
||||
}
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -932,70 +931,7 @@ CmCleanupAndExit (
|
||||
|
||||
if (!Gbl_DoAslConversion)
|
||||
{
|
||||
CmDeleteCaches ();
|
||||
UtDeleteLocalCaches ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: CmDeleteCaches
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Delete all local cache buffer blocks
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
CmDeleteCaches (
|
||||
void)
|
||||
{
|
||||
UINT32 BufferCount;
|
||||
ASL_CACHE_INFO *Next;
|
||||
|
||||
|
||||
/* Parse Op cache */
|
||||
|
||||
BufferCount = 0;
|
||||
while (Gbl_ParseOpCacheList)
|
||||
{
|
||||
Next = Gbl_ParseOpCacheList->Next;
|
||||
ACPI_FREE (Gbl_ParseOpCacheList);
|
||||
Gbl_ParseOpCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n",
|
||||
Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE,
|
||||
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
|
||||
|
||||
Gbl_ParseOpCount = 0;
|
||||
Gbl_ParseOpCacheNext = NULL;
|
||||
Gbl_ParseOpCacheLast = NULL;
|
||||
Gbl_ParseTreeRoot = NULL;
|
||||
|
||||
/* Generic string cache */
|
||||
|
||||
BufferCount = 0;
|
||||
while (Gbl_StringCacheList)
|
||||
{
|
||||
Next = Gbl_StringCacheList->Next;
|
||||
ACPI_FREE (Gbl_StringCacheList);
|
||||
Gbl_StringCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n",
|
||||
Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount);
|
||||
|
||||
Gbl_StringSize = 0;
|
||||
Gbl_StringCount = 0;
|
||||
Gbl_StringCacheNext = NULL;
|
||||
Gbl_StringCacheLast = NULL;
|
||||
}
|
||||
|
@ -181,6 +181,7 @@
|
||||
#include "aslmessages.h"
|
||||
#include "aslglobal.h"
|
||||
#include "preprocess.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -265,8 +266,50 @@ void
|
||||
CmCleanupAndExit (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslallocate - memory allocation
|
||||
*/
|
||||
void *
|
||||
UtLocalCalloc (
|
||||
UINT32 Size);
|
||||
|
||||
void
|
||||
CmDeleteCaches (
|
||||
UtExpandLineBuffers (
|
||||
void);
|
||||
|
||||
void
|
||||
UtReallocLineBuffers (
|
||||
char **Buffer,
|
||||
UINT32 OldSize,
|
||||
UINT32 NewSize);
|
||||
|
||||
void
|
||||
UtFreeLineBuffers (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslcache - local cache support
|
||||
*/
|
||||
char *
|
||||
UtLocalCacheCalloc (
|
||||
UINT32 Length);
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
UtParseOpCacheCalloc (
|
||||
void);
|
||||
|
||||
DT_SUBTABLE *
|
||||
UtSubtableCacheCalloc (
|
||||
void);
|
||||
|
||||
DT_FIELD *
|
||||
UtFieldCacheCalloc (
|
||||
void);
|
||||
|
||||
void
|
||||
UtDeleteLocalCaches (
|
||||
void);
|
||||
|
||||
|
||||
@ -406,6 +449,16 @@ void
|
||||
AslAbort (
|
||||
void);
|
||||
|
||||
void
|
||||
AslDualParseOpError (
|
||||
UINT8 Level,
|
||||
UINT16 MainMessageId,
|
||||
ACPI_PARSE_OBJECT *MainOp,
|
||||
char *MainMessage,
|
||||
UINT16 SecondMessageId,
|
||||
ACPI_PARSE_OBJECT *SecondOp,
|
||||
char *SecondaryMessage);
|
||||
|
||||
void
|
||||
AslError (
|
||||
UINT8 Level,
|
||||
@ -1150,10 +1203,6 @@ void
|
||||
UtEndEvent (
|
||||
UINT8 Event);
|
||||
|
||||
void *
|
||||
UtLocalCalloc (
|
||||
UINT32 Size);
|
||||
|
||||
void
|
||||
UtDisplaySummary (
|
||||
UINT32 FileId);
|
||||
@ -1176,18 +1225,6 @@ void
|
||||
UtSetParseOpName (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
char *
|
||||
UtStringCacheCalloc (
|
||||
UINT32 Length);
|
||||
|
||||
void
|
||||
UtExpandLineBuffers (
|
||||
void);
|
||||
|
||||
void
|
||||
UtFreeLineBuffers (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
UtInternalizeName (
|
||||
char *ExternalName,
|
||||
|
@ -813,7 +813,7 @@ NamePathTail [.]{NameSeg}
|
||||
|
||||
{NameSeg} { char *s;
|
||||
count (0);
|
||||
s=UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
|
||||
s=UtLocalCacheCalloc (ACPI_NAME_SIZE + 1);
|
||||
if (strcmp (AslCompilertext, "\\"))
|
||||
{
|
||||
strcpy (s, "____");
|
||||
@ -826,7 +826,7 @@ NamePathTail [.]{NameSeg}
|
||||
|
||||
{NameString} { char *s;
|
||||
count (0);
|
||||
s=UtStringCacheCalloc (strlen (AslCompilertext)+1);
|
||||
s=UtLocalCacheCalloc (strlen (AslCompilertext)+1);
|
||||
AcpiUtStrupr (AslCompilertext);
|
||||
strcpy (s, AslCompilertext);
|
||||
AslCompilerlval.s = s;
|
||||
|
@ -356,7 +356,7 @@ UtCreateEscapeSequences (
|
||||
|
||||
/* New string buffer, 3 extra chars per escape (4 total) */
|
||||
|
||||
OutString = UtLocalCalloc (InStringLength + (EscapeCount * 3));
|
||||
OutString = UtLocalCacheCalloc (InStringLength + (EscapeCount * 3));
|
||||
OutStringPtr = OutString;
|
||||
|
||||
/* Convert non-ascii or non-printable chars to escape sequences */
|
||||
|
@ -170,6 +170,37 @@ AslIsExceptionDisabled (
|
||||
UINT8 Level,
|
||||
UINT16 MessageId);
|
||||
|
||||
static void AslInitEnode (
|
||||
ASL_ERROR_MSG **Enode,
|
||||
UINT8 Level,
|
||||
UINT16 MessageId,
|
||||
UINT32 LineNumber,
|
||||
UINT32 LogicalLineNumber,
|
||||
UINT32 LogicalByteOffset,
|
||||
UINT32 Column,
|
||||
char *Filename,
|
||||
char *Message,
|
||||
char *SourceLine,
|
||||
ASL_ERROR_MSG *SubError);
|
||||
|
||||
static void
|
||||
AslLogNewError (
|
||||
UINT8 Level,
|
||||
UINT16 MessageId,
|
||||
UINT32 LineNumber,
|
||||
UINT32 LogicalLineNumber,
|
||||
UINT32 LogicalByteOffset,
|
||||
UINT32 Column,
|
||||
char *Filename,
|
||||
char *Message,
|
||||
char *SourceLine,
|
||||
ASL_ERROR_MSG *SubError);
|
||||
|
||||
static void
|
||||
AePrintSubError (
|
||||
FILE *OutputFile,
|
||||
ASL_ERROR_MSG *Enode);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -220,6 +251,7 @@ AeClearErrorLog (
|
||||
ASL_ERROR_MSG *Enode = Gbl_ErrorLog;
|
||||
ASL_ERROR_MSG *Next;
|
||||
|
||||
|
||||
/* Walk the error node list */
|
||||
|
||||
while (Enode)
|
||||
@ -270,8 +302,7 @@ AeAddToErrorLog (
|
||||
Prev = NULL;
|
||||
Next = Gbl_ErrorLog;
|
||||
|
||||
while ((Next) &&
|
||||
(Next->LogicalLineNumber <= Enode->LogicalLineNumber))
|
||||
while ((Next) && (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
|
||||
{
|
||||
Prev = Next;
|
||||
Next = Next->Next;
|
||||
@ -294,240 +325,33 @@ AeAddToErrorLog (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AePrintException
|
||||
* FUNCTION: AeDecodeErrorMessageId
|
||||
*
|
||||
* PARAMETERS: FileId - ID of output file
|
||||
* PARAMETERS: OutputFile - Output file
|
||||
* Enode - Error node to print
|
||||
* Header - Additional text before each message
|
||||
* PrematureEOF - True = PrematureEOF has been reached
|
||||
* Total - Total legth of line
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Print the contents of an error node.
|
||||
*
|
||||
* NOTE: We don't use the FlxxxFile I/O functions here because on error
|
||||
* they abort the compiler and call this function! Since we
|
||||
* are reporting errors here, we ignore most output errors and
|
||||
* just try to get out as much as we can.
|
||||
* DESCRIPTION: Print the source line of an error.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AePrintException (
|
||||
UINT32 FileId,
|
||||
static void
|
||||
AeDecodeErrorMessageId (
|
||||
FILE *OutputFile,
|
||||
ASL_ERROR_MSG *Enode,
|
||||
char *Header)
|
||||
BOOLEAN PrematureEOF,
|
||||
UINT32 Total)
|
||||
{
|
||||
UINT8 SourceByte;
|
||||
int Actual;
|
||||
size_t RActual;
|
||||
UINT32 MsgLength;
|
||||
const char *MainMessage;
|
||||
char *ExtraMessage;
|
||||
UINT32 SourceColumn;
|
||||
UINT32 ErrorColumn;
|
||||
FILE *OutputFile;
|
||||
FILE *SourceFile = NULL;
|
||||
long FileSize;
|
||||
BOOLEAN PrematureEOF = FALSE;
|
||||
UINT32 Total = 0;
|
||||
|
||||
|
||||
if (Gbl_NoErrors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only listing files have a header, and remarks/optimizations
|
||||
* are always output
|
||||
*/
|
||||
if (!Header)
|
||||
{
|
||||
/* Ignore remarks if requested */
|
||||
|
||||
switch (Enode->Level)
|
||||
{
|
||||
case ASL_WARNING:
|
||||
case ASL_WARNING2:
|
||||
case ASL_WARNING3:
|
||||
|
||||
if (!Gbl_DisplayWarnings)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASL_REMARK:
|
||||
|
||||
if (!Gbl_DisplayRemarks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASL_OPTIMIZATION:
|
||||
|
||||
if (!Gbl_DisplayOptimizations)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the various required file handles */
|
||||
|
||||
OutputFile = Gbl_Files[FileId].Handle;
|
||||
|
||||
if (!Enode->SourceLine)
|
||||
{
|
||||
/*
|
||||
* Use the merged header/source file if present, otherwise
|
||||
* use input file
|
||||
*/
|
||||
SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
|
||||
if (!SourceFile)
|
||||
{
|
||||
SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
|
||||
}
|
||||
|
||||
if (SourceFile)
|
||||
{
|
||||
/* Determine if the error occurred at source file EOF */
|
||||
|
||||
fseek (SourceFile, 0, SEEK_END);
|
||||
FileSize = ftell (SourceFile);
|
||||
|
||||
if ((long) Enode->LogicalByteOffset >= FileSize)
|
||||
{
|
||||
PrematureEOF = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Header)
|
||||
{
|
||||
fprintf (OutputFile, "%s", Header);
|
||||
}
|
||||
|
||||
/* Print filename and line number if present and valid */
|
||||
|
||||
if (Enode->Filename)
|
||||
{
|
||||
if (Gbl_VerboseErrors)
|
||||
{
|
||||
fprintf (OutputFile, "%-8s", Enode->Filename);
|
||||
|
||||
if (Enode->LineNumber)
|
||||
{
|
||||
if (Enode->SourceLine)
|
||||
{
|
||||
fprintf (OutputFile, " %6u: %s",
|
||||
Enode->LineNumber, Enode->SourceLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (OutputFile, " %6u: ", Enode->LineNumber);
|
||||
|
||||
/*
|
||||
* If not at EOF, get the corresponding source code line
|
||||
* and display it. Don't attempt this if we have a
|
||||
* premature EOF condition.
|
||||
*/
|
||||
if (!PrematureEOF)
|
||||
{
|
||||
/*
|
||||
* Seek to the offset in the combined source file,
|
||||
* read the source line, and write it to the output.
|
||||
*/
|
||||
Actual = fseek (SourceFile,
|
||||
(long) Enode->LogicalByteOffset, (int) SEEK_SET);
|
||||
if (Actual)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Seek error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
RActual = fread (&SourceByte, 1, 1, SourceFile);
|
||||
if (RActual != 1)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Read error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read/write the source line, up to the maximum line length */
|
||||
|
||||
while (RActual && SourceByte && (SourceByte != '\n'))
|
||||
{
|
||||
if (Total < 256)
|
||||
{
|
||||
/* After the max line length, we will just read the line, no write */
|
||||
|
||||
if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
|
||||
{
|
||||
printf ("[*** iASL: Write error on output file ***]\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Total == 256)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"\n[*** iASL: Very long input line, message below refers to column %u ***]",
|
||||
Enode->Column);
|
||||
}
|
||||
|
||||
RActual = fread (&SourceByte, 1, 1, SourceFile);
|
||||
if (RActual != 1)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Read error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
return;
|
||||
}
|
||||
Total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (OutputFile, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Less verbose version of the error message, enabled via the
|
||||
* -vi switch. The format is compatible with MS Visual Studio.
|
||||
*/
|
||||
fprintf (OutputFile, "%s", Enode->Filename);
|
||||
|
||||
if (Enode->LineNumber)
|
||||
{
|
||||
fprintf (OutputFile, "(%u) : ",
|
||||
Enode->LineNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If a NULL message ID, just print the raw message */
|
||||
|
||||
if (Enode->MessageId == 0)
|
||||
{
|
||||
fprintf (OutputFile, "%s\n", Enode->Message);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Decode the message ID */
|
||||
|
||||
fprintf (OutputFile, "%s %4.4d -",
|
||||
AeDecodeExceptionLevel (Enode->Level),
|
||||
AeBuildFullExceptionCode (Enode->Level, Enode->MessageId));
|
||||
@ -602,13 +426,328 @@ AePrintException (
|
||||
}
|
||||
|
||||
fprintf (OutputFile, "\n");
|
||||
if (Gbl_VerboseErrors)
|
||||
if (Gbl_VerboseErrors && !Enode->SubError)
|
||||
{
|
||||
fprintf (OutputFile, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AePrintErrorSourceLine
|
||||
*
|
||||
* PARAMETERS: OutputFile - Output file
|
||||
* Enode - Error node to print
|
||||
* PrematureEOF - True = PrematureEOF has been reached
|
||||
* Total - amount of characters printed so far
|
||||
*
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Print the source line of an error.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AePrintErrorSourceLine (
|
||||
FILE *OutputFile,
|
||||
ASL_ERROR_MSG *Enode,
|
||||
BOOLEAN *PrematureEOF,
|
||||
UINT32 *Total)
|
||||
{
|
||||
UINT8 SourceByte;
|
||||
int Actual;
|
||||
size_t RActual;
|
||||
FILE *SourceFile = NULL;
|
||||
long FileSize;
|
||||
|
||||
|
||||
if (!Enode->SourceLine)
|
||||
{
|
||||
/*
|
||||
* Use the merged header/source file if present, otherwise
|
||||
* use input file
|
||||
*/
|
||||
SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
|
||||
if (!SourceFile)
|
||||
{
|
||||
SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
|
||||
}
|
||||
|
||||
if (SourceFile)
|
||||
{
|
||||
/* Determine if the error occurred at source file EOF */
|
||||
|
||||
fseek (SourceFile, 0, SEEK_END);
|
||||
FileSize = ftell (SourceFile);
|
||||
|
||||
if ((long) Enode->LogicalByteOffset >= FileSize)
|
||||
{
|
||||
*PrematureEOF = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Source File Does not exist ***]\n");
|
||||
return AE_IO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print filename and line number if present and valid */
|
||||
|
||||
if (Gbl_VerboseErrors)
|
||||
{
|
||||
fprintf (OutputFile, "%-8s", Enode->Filename);
|
||||
|
||||
if (Enode->SourceLine && Enode->LineNumber)
|
||||
{
|
||||
fprintf (OutputFile, " %6u: %s",
|
||||
Enode->LineNumber, Enode->SourceLine);
|
||||
}
|
||||
else if (Enode->LineNumber)
|
||||
{
|
||||
fprintf (OutputFile, " %6u: ", Enode->LineNumber);
|
||||
|
||||
/*
|
||||
* If not at EOF, get the corresponding source code line
|
||||
* and display it. Don't attempt this if we have a
|
||||
* premature EOF condition.
|
||||
*/
|
||||
if (*PrematureEOF)
|
||||
{
|
||||
fprintf (OutputFile, "\n");
|
||||
return AE_OK;
|
||||
}
|
||||
/*
|
||||
* Seek to the offset in the combined source file,
|
||||
* read the source line, and write it to the output.
|
||||
*/
|
||||
Actual = fseek (SourceFile,
|
||||
(long) Enode->LogicalByteOffset, (int) SEEK_SET);
|
||||
if (Actual)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Seek error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
|
||||
fprintf (OutputFile, "\n");
|
||||
return AE_OK;
|
||||
}
|
||||
RActual = fread (&SourceByte, 1, 1, SourceFile);
|
||||
if (RActual != 1)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Read error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
return AE_IO_ERROR;
|
||||
}
|
||||
/* Read/write the source line, up to the maximum line length */
|
||||
|
||||
while (RActual && SourceByte && (SourceByte != '\n'))
|
||||
{
|
||||
if (*Total < 256)
|
||||
{
|
||||
/* After the max line length, we will just read the line, no write */
|
||||
|
||||
if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
|
||||
{
|
||||
printf ("[*** iASL: Write error on output file ***]\n");
|
||||
return AE_IO_ERROR;
|
||||
}
|
||||
}
|
||||
else if (*Total == 256)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"\n[*** iASL: Very long input line, message below refers to column %u ***]",
|
||||
Enode->Column);
|
||||
}
|
||||
|
||||
RActual = fread (&SourceByte, 1, 1, SourceFile);
|
||||
if (RActual != 1)
|
||||
{
|
||||
fprintf (OutputFile,
|
||||
"[*** iASL: Read error on source code temp file %s ***]",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
|
||||
return AE_IO_ERROR;
|
||||
}
|
||||
*Total += 1;
|
||||
}
|
||||
|
||||
fprintf (OutputFile, "\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Less verbose version of the error message, enabled via the
|
||||
* -vi switch. The format is compatible with MS Visual Studio.
|
||||
*/
|
||||
fprintf (OutputFile, "%s", Enode->Filename);
|
||||
|
||||
if (Enode->LineNumber)
|
||||
{
|
||||
fprintf (OutputFile, "(%u) : ",
|
||||
Enode->LineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AePrintException
|
||||
*
|
||||
* PARAMETERS: FileId - ID of output file
|
||||
* Enode - Error node to print
|
||||
* Header - Additional text before each message
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Print the contents of an error node.
|
||||
*
|
||||
* NOTE: We don't use the FlxxxFile I/O functions here because on error
|
||||
* they abort the compiler and call this function! Since we
|
||||
* are reporting errors here, we ignore most output errors and
|
||||
* just try to get out as much as we can.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AePrintException (
|
||||
UINT32 FileId,
|
||||
ASL_ERROR_MSG *Enode,
|
||||
char *Header)
|
||||
{
|
||||
FILE *OutputFile;
|
||||
BOOLEAN PrematureEOF = FALSE;
|
||||
UINT32 Total = 0;
|
||||
ACPI_STATUS Status;
|
||||
ASL_ERROR_MSG *Child = Enode->SubError;
|
||||
|
||||
|
||||
if (Gbl_NoErrors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only listing files have a header, and remarks/optimizations
|
||||
* are always output
|
||||
*/
|
||||
if (!Header)
|
||||
{
|
||||
/* Ignore remarks if requested */
|
||||
|
||||
switch (Enode->Level)
|
||||
{
|
||||
case ASL_WARNING:
|
||||
case ASL_WARNING2:
|
||||
case ASL_WARNING3:
|
||||
|
||||
if (!Gbl_DisplayWarnings)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASL_REMARK:
|
||||
|
||||
if (!Gbl_DisplayRemarks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASL_OPTIMIZATION:
|
||||
|
||||
if (!Gbl_DisplayOptimizations)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the various required file handles */
|
||||
|
||||
OutputFile = Gbl_Files[FileId].Handle;
|
||||
|
||||
if (Header)
|
||||
{
|
||||
fprintf (OutputFile, "%s", Header);
|
||||
}
|
||||
|
||||
if (!Enode->Filename)
|
||||
{
|
||||
AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
|
||||
return;
|
||||
}
|
||||
|
||||
Status = AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* If a NULL message ID, just print the raw message */
|
||||
|
||||
if (Enode->MessageId == 0)
|
||||
{
|
||||
fprintf (OutputFile, "%s\n", Enode->Message);
|
||||
return;
|
||||
}
|
||||
|
||||
AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
|
||||
|
||||
while (Child)
|
||||
{
|
||||
fprintf (OutputFile, "\n");
|
||||
AePrintSubError (OutputFile, Child);
|
||||
Child = Child->SubError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AePrintSubError
|
||||
*
|
||||
* PARAMETERS: OutputFile - Output file
|
||||
* Enode - Error node to print
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Print the contents of an error nodes. This function is tailored
|
||||
* to print error nodes that are SubErrors within ASL_ERROR_MSG
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
AePrintSubError (
|
||||
FILE *OutputFile,
|
||||
ASL_ERROR_MSG *Enode)
|
||||
{
|
||||
UINT32 Total = 0;
|
||||
BOOLEAN PrematureEOF = FALSE;
|
||||
const char *MainMessage;
|
||||
|
||||
|
||||
MainMessage = AeDecodeMessageId (Enode->MessageId);
|
||||
|
||||
fprintf (OutputFile, " %s%s", MainMessage, "\n ");
|
||||
(void) AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
|
||||
fprintf (OutputFile, "\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AePrintErrorLog
|
||||
@ -638,6 +777,87 @@ AePrintErrorLog (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslInitEnode
|
||||
*
|
||||
* PARAMETERS: InputEnode - Input Error node to initialize
|
||||
* Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
* CurrentLineNumber - Actual file line number
|
||||
* LogicalLineNumber - Cumulative line number
|
||||
* LogicalByteOffset - Byte offset in source file
|
||||
* Column - Column in current line
|
||||
* Filename - source filename
|
||||
* ExtraMessage - additional error message
|
||||
* SourceLine - Line of error source code
|
||||
* SubError - SubError of this InputEnode
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Initialize an Error node
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void AslInitEnode (
|
||||
ASL_ERROR_MSG **InputEnode,
|
||||
UINT8 Level,
|
||||
UINT16 MessageId,
|
||||
UINT32 LineNumber,
|
||||
UINT32 LogicalLineNumber,
|
||||
UINT32 LogicalByteOffset,
|
||||
UINT32 Column,
|
||||
char *Filename,
|
||||
char *ExtraMessage,
|
||||
char *SourceLine,
|
||||
ASL_ERROR_MSG *SubError)
|
||||
{
|
||||
ASL_ERROR_MSG *Enode;
|
||||
|
||||
|
||||
*InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
|
||||
Enode = *InputEnode;
|
||||
Enode->Level = Level;
|
||||
Enode->MessageId = MessageId;
|
||||
Enode->LineNumber = LineNumber;
|
||||
Enode->LogicalLineNumber = LogicalLineNumber;
|
||||
Enode->LogicalByteOffset = LogicalByteOffset;
|
||||
Enode->Column = Column;
|
||||
Enode->SubError = SubError;
|
||||
Enode->Message = NULL;
|
||||
Enode->SourceLine = NULL;
|
||||
Enode->Filename = NULL;
|
||||
|
||||
if (ExtraMessage)
|
||||
{
|
||||
/* Allocate a buffer for the message and a new error node */
|
||||
|
||||
Enode->Message = UtLocalCacheCalloc (strlen (ExtraMessage) + 1);
|
||||
|
||||
/* Keep a copy of the extra message */
|
||||
|
||||
strcpy (Enode->Message, ExtraMessage);
|
||||
}
|
||||
|
||||
if (SourceLine)
|
||||
{
|
||||
Enode->SourceLine = UtLocalCalloc (strlen (SourceLine) + 1);
|
||||
strcpy (Enode->SourceLine, SourceLine);
|
||||
}
|
||||
|
||||
|
||||
if (Filename)
|
||||
{
|
||||
Enode->Filename = Filename;
|
||||
Enode->FilenameLength = strlen (Filename);
|
||||
if (Enode->FilenameLength < 6)
|
||||
{
|
||||
Enode->FilenameLength = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslCommonError2
|
||||
@ -666,60 +886,8 @@ AslCommonError2 (
|
||||
char *Filename,
|
||||
char *ExtraMessage)
|
||||
{
|
||||
char *MessageBuffer = NULL;
|
||||
char *LineBuffer;
|
||||
ASL_ERROR_MSG *Enode;
|
||||
|
||||
|
||||
Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
|
||||
|
||||
if (ExtraMessage)
|
||||
{
|
||||
/* Allocate a buffer for the message and a new error node */
|
||||
|
||||
MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
|
||||
|
||||
/* Keep a copy of the extra message */
|
||||
|
||||
strcpy (MessageBuffer, ExtraMessage);
|
||||
}
|
||||
|
||||
LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
|
||||
strcpy (LineBuffer, SourceLine);
|
||||
|
||||
/* Initialize the error node */
|
||||
|
||||
if (Filename)
|
||||
{
|
||||
Enode->Filename = Filename;
|
||||
Enode->FilenameLength = strlen (Filename);
|
||||
if (Enode->FilenameLength < 6)
|
||||
{
|
||||
Enode->FilenameLength = 6;
|
||||
}
|
||||
}
|
||||
|
||||
Enode->MessageId = MessageId;
|
||||
Enode->Level = Level;
|
||||
Enode->LineNumber = LineNumber;
|
||||
Enode->LogicalLineNumber = LineNumber;
|
||||
Enode->LogicalByteOffset = 0;
|
||||
Enode->Column = Column;
|
||||
Enode->Message = MessageBuffer;
|
||||
Enode->SourceLine = LineBuffer;
|
||||
|
||||
/* Add the new node to the error node list */
|
||||
|
||||
AeAddToErrorLog (Enode);
|
||||
|
||||
if (Gbl_DebugFlag)
|
||||
{
|
||||
/* stderr is a file, send error to it immediately */
|
||||
|
||||
AePrintException (ASL_FILE_STDERR, Enode, NULL);
|
||||
}
|
||||
|
||||
Gbl_ExceptionCount[Level]++;
|
||||
AslLogNewError (Level, MessageId, LineNumber, LineNumber, 0, Column,
|
||||
Filename, ExtraMessage, SourceLine, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -753,48 +921,51 @@ AslCommonError (
|
||||
char *Filename,
|
||||
char *ExtraMessage)
|
||||
{
|
||||
char *MessageBuffer = NULL;
|
||||
ASL_ERROR_MSG *Enode;
|
||||
AslLogNewError (Level, MessageId, CurrentLineNumber, LogicalLineNumber,
|
||||
LogicalByteOffset, Column, Filename, ExtraMessage,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (AslIsExceptionIgnored (Level, MessageId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslLogNewError
|
||||
*
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
* CurrentLineNumber - Actual file line number
|
||||
* LogicalLineNumber - Cumulative line number
|
||||
* LogicalByteOffset - Byte offset in source file
|
||||
* Column - Column in current line
|
||||
* Filename - source filename
|
||||
* Message - additional error message
|
||||
* SourceLine - Actual line of source code
|
||||
* SubError - Sub-error associated with this error
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Create a new error node and add it to the error log
|
||||
*
|
||||
******************************************************************************/
|
||||
static void
|
||||
AslLogNewError (
|
||||
UINT8 Level,
|
||||
UINT16 MessageId,
|
||||
UINT32 LineNumber,
|
||||
UINT32 LogicalLineNumber,
|
||||
UINT32 LogicalByteOffset,
|
||||
UINT32 Column,
|
||||
char *Filename,
|
||||
char *Message,
|
||||
char *SourceLine,
|
||||
ASL_ERROR_MSG *SubError)
|
||||
{
|
||||
ASL_ERROR_MSG *Enode = NULL;
|
||||
|
||||
Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
|
||||
|
||||
if (ExtraMessage)
|
||||
{
|
||||
/* Allocate a buffer for the message and a new error node */
|
||||
|
||||
MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
|
||||
|
||||
/* Keep a copy of the extra message */
|
||||
|
||||
strcpy (MessageBuffer, ExtraMessage);
|
||||
}
|
||||
|
||||
/* Initialize the error node */
|
||||
|
||||
if (Filename)
|
||||
{
|
||||
Enode->Filename = Filename;
|
||||
Enode->FilenameLength = strlen (Filename);
|
||||
if (Enode->FilenameLength < 6)
|
||||
{
|
||||
Enode->FilenameLength = 6;
|
||||
}
|
||||
}
|
||||
|
||||
Enode->MessageId = MessageId;
|
||||
Enode->Level = Level;
|
||||
Enode->LineNumber = CurrentLineNumber;
|
||||
Enode->LogicalLineNumber = LogicalLineNumber;
|
||||
Enode->LogicalByteOffset = LogicalByteOffset;
|
||||
Enode->Column = Column;
|
||||
Enode->Message = MessageBuffer;
|
||||
Enode->SourceLine = NULL;
|
||||
AslInitEnode (&Enode, Level, MessageId, LineNumber, LogicalLineNumber,
|
||||
LogicalByteOffset, Column, Filename, Message, SourceLine,
|
||||
SubError);
|
||||
|
||||
/* Add the new node to the error node list */
|
||||
|
||||
@ -825,8 +996,8 @@ AslCommonError (
|
||||
*
|
||||
* FUNCTION: AslIsExceptionIgnored
|
||||
*
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
*
|
||||
* RETURN: BOOLEAN
|
||||
*
|
||||
@ -840,7 +1011,7 @@ AslIsExceptionIgnored (
|
||||
UINT8 Level,
|
||||
UINT16 MessageId)
|
||||
{
|
||||
BOOLEAN ExceptionIgnored;
|
||||
BOOLEAN ExceptionIgnored;
|
||||
|
||||
|
||||
/* Note: this allows exception to be disabled and expected */
|
||||
@ -869,7 +1040,8 @@ void
|
||||
AslCheckExpectedExceptions (
|
||||
void)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT8 i;
|
||||
|
||||
|
||||
for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i)
|
||||
{
|
||||
@ -980,8 +1152,8 @@ AslDisableException (
|
||||
*
|
||||
* FUNCTION: AslIsExceptionDisabled
|
||||
*
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MessageId - Index into global message buffer
|
||||
*
|
||||
* RETURN: TRUE if exception/message should be ignored
|
||||
*
|
||||
@ -999,9 +1171,8 @@ AslIsExceptionExpected (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/*
|
||||
* Mark this exception as received
|
||||
*/
|
||||
/* Mark this exception as received */
|
||||
|
||||
EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId);
|
||||
for (i = 0; i < Gbl_ExpectedMessagesIndex; i++)
|
||||
{
|
||||
@ -1080,6 +1251,61 @@ AslIsExceptionDisabled (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslDualParseOpError
|
||||
*
|
||||
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
|
||||
* MainMsgId - Index into global message buffer
|
||||
* MainOp - Parse node where error happened
|
||||
* MainMsg - Message pertaining to the MainOp
|
||||
* SubMsgId - Index into global message buffer
|
||||
* SubOp - Additional parse node for better message
|
||||
* SubMsg - Message pertainint to SubOp
|
||||
*
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Main error reporting routine for the ASL compiler for error
|
||||
* messages that point to multiple parse objects.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AslDualParseOpError (
|
||||
UINT8 Level,
|
||||
UINT16 MainMsgId,
|
||||
ACPI_PARSE_OBJECT *MainOp,
|
||||
char *MainMsg,
|
||||
UINT16 SubMsgId,
|
||||
ACPI_PARSE_OBJECT *SubOp,
|
||||
char *SubMsg)
|
||||
{
|
||||
ASL_ERROR_MSG *SubEnode = NULL;
|
||||
|
||||
|
||||
/* Check if user wants to ignore this exception */
|
||||
|
||||
if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (SubOp)
|
||||
{
|
||||
AslInitEnode (&SubEnode, Level, SubMsgId, SubOp->Asl.LineNumber,
|
||||
SubOp->Asl.LogicalLineNumber, SubOp->Asl.LogicalByteOffset,
|
||||
SubOp->Asl.Column, SubOp->Asl.Filename, SubMsg,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
AslLogNewError (Level, MainMsgId, MainOp->Asl.LineNumber,
|
||||
MainOp->Asl.LogicalLineNumber, MainOp->Asl.LogicalByteOffset,
|
||||
MainOp->Asl.Column, MainOp->Asl.Filename, MainMsg,
|
||||
NULL, SubEnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslError
|
||||
|
@ -151,7 +151,6 @@
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "acapps.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslfiles")
|
||||
@ -326,14 +325,14 @@ FlMergePathnames (
|
||||
(*FilePathname == '/') ||
|
||||
(FilePathname[1] == ':'))
|
||||
{
|
||||
Pathname = UtStringCacheCalloc (strlen (FilePathname) + 1);
|
||||
Pathname = UtLocalCacheCalloc (strlen (FilePathname) + 1);
|
||||
strcpy (Pathname, FilePathname);
|
||||
goto ConvertBackslashes;
|
||||
}
|
||||
|
||||
/* Need a local copy of the prefix directory path */
|
||||
|
||||
CommonPath = UtStringCacheCalloc (strlen (PrefixDir) + 1);
|
||||
CommonPath = UtLocalCacheCalloc (strlen (PrefixDir) + 1);
|
||||
strcpy (CommonPath, PrefixDir);
|
||||
|
||||
/*
|
||||
@ -369,7 +368,7 @@ FlMergePathnames (
|
||||
/* Build the final merged pathname */
|
||||
|
||||
ConcatenatePaths:
|
||||
Pathname = UtStringCacheCalloc (
|
||||
Pathname = UtLocalCacheCalloc (
|
||||
strlen (CommonPath) + strlen (FilePathname) + 2);
|
||||
if (LastElement && *CommonPath)
|
||||
{
|
||||
|
@ -173,6 +173,7 @@ void
|
||||
Usage (
|
||||
void)
|
||||
{
|
||||
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
|
||||
printf ("%s\n\n", ASL_COMPLIANCE);
|
||||
ACPI_USAGE_HEADER ("iasl [Options] [Files]");
|
||||
|
||||
|
@ -327,8 +327,9 @@ LdLoadFieldElements (
|
||||
* The name already exists in this scope
|
||||
* But continue processing the elements
|
||||
*/
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
|
||||
Child->Asl.Value.String);
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
|
||||
Child->Asl.Value.String, ASL_MSG_FOUND_HERE, Node->Op,
|
||||
Node->Op->Asl.ExternalName);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -388,8 +389,10 @@ LdLoadResourceElements (
|
||||
{
|
||||
/* Actual node causing the error was saved in ParentMethod */
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS,
|
||||
(ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath);
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS,
|
||||
(ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod,
|
||||
Op->Asl.Namepath, ASL_MSG_FOUND_HERE, Node->Op,
|
||||
Node->Op->Asl.ExternalName);
|
||||
return (AE_OK);
|
||||
}
|
||||
return (Status);
|
||||
@ -805,8 +808,8 @@ LdNamespace1Begin (
|
||||
/*
|
||||
* Allow one create on an object or segment that was
|
||||
* previously declared External only if WalkState->OwnerId and
|
||||
* Node->OwnerId are found in different tables (meaning that
|
||||
* they have differnt OwnerIds).
|
||||
* Node->OwnerId are different (meaning that the current WalkState
|
||||
* and the Node are in different tables).
|
||||
*/
|
||||
Node->Flags &= ~ANOBJ_IS_EXTERNAL;
|
||||
Node->Type = (UINT8) ObjectType;
|
||||
@ -827,8 +830,9 @@ LdNamespace1Begin (
|
||||
if (Node->OwnerId == WalkState->OwnerId &&
|
||||
!(Node->Flags & IMPLICIT_EXTERNAL))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName);
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op,
|
||||
Node->Op->Asl.ExternalName);
|
||||
}
|
||||
if (Node->Flags & IMPLICIT_EXTERNAL)
|
||||
{
|
||||
@ -849,8 +853,9 @@ LdNamespace1Begin (
|
||||
|
||||
if (Node->OwnerId == WalkState->OwnerId)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName);
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op,
|
||||
Node->Op->Asl.ExternalName);
|
||||
}
|
||||
}
|
||||
else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
|
||||
@ -905,8 +910,9 @@ LdNamespace1Begin (
|
||||
{
|
||||
/* Valid error, object already exists */
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName);
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op,
|
||||
Node->Op->Asl.ExternalName);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ MpCreateGpioInfo (
|
||||
* sorted by both source device name and then the pin number. There is
|
||||
* one block per pin.
|
||||
*/
|
||||
Buffer = UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO));
|
||||
Buffer = UtLocalCacheCalloc (sizeof (ACPI_GPIO_INFO));
|
||||
Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer);
|
||||
|
||||
NextGpio = Gbl_GpioList;
|
||||
@ -409,7 +409,7 @@ MpCreateSerialInfo (
|
||||
* Allocate a new info block and insert it into the global Serial list
|
||||
* sorted by both source device name and then the address.
|
||||
*/
|
||||
Buffer = UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO));
|
||||
Buffer = UtLocalCacheCalloc (sizeof (ACPI_SERIAL_INFO));
|
||||
Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer);
|
||||
|
||||
NextSerial = Gbl_SerialList;
|
||||
|
@ -212,7 +212,7 @@ MpGetHidFromParseTree (
|
||||
|
||||
/* Convert EISAID to a string */
|
||||
|
||||
HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE);
|
||||
HidString = UtLocalCacheCalloc (ACPI_EISAID_STRING_SIZE);
|
||||
AcpiExEisaIdToString (HidString, Arg->Asl.Value.Integer);
|
||||
return (HidString);
|
||||
|
||||
@ -277,7 +277,7 @@ MpGetHidValue (
|
||||
|
||||
/* Convert EISAID to a string */
|
||||
|
||||
HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE);
|
||||
HidString = UtLocalCacheCalloc (ACPI_EISAID_STRING_SIZE);
|
||||
AcpiExEisaIdToString (HidString, HidNode->Object->Integer.Value);
|
||||
return (HidString);
|
||||
|
||||
|
@ -350,7 +350,9 @@ const char *AslCompilerMsgs [] =
|
||||
/* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression",
|
||||
/* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT",
|
||||
/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:",
|
||||
/* ASL_MSG_NULL_RESOURCE_TEMPLATE */ "Empty Resource Template (END_TAG only)"
|
||||
/* ASL_MSG_NULL_RESOURCE_TEMPLATE */ "Empty Resource Template (END_TAG only)",
|
||||
/* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ",
|
||||
/* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects"
|
||||
};
|
||||
|
||||
/* Table compiler */
|
||||
|
@ -353,6 +353,8 @@ typedef enum
|
||||
ASL_MSG_CROSS_TABLE_SCOPE,
|
||||
ASL_MSG_EXCEPTION_NOT_RECEIVED,
|
||||
ASL_MSG_NULL_RESOURCE_TEMPLATE,
|
||||
ASL_MSG_FOUND_HERE,
|
||||
ASL_MSG_ILLEGAL_RECURSION,
|
||||
|
||||
/* These messages are used by the Data Table compiler only */
|
||||
|
||||
|
@ -347,10 +347,31 @@ MtMethodAnalysisWalkBegin (
|
||||
|
||||
case PARSEOP_METHODCALL:
|
||||
|
||||
/* Check for a recursive method call */
|
||||
|
||||
if (MethodInfo &&
|
||||
(Op->Asl.Node == MethodInfo->Op->Asl.Node))
|
||||
{
|
||||
AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
|
||||
if (MethodInfo->CreatesNamedObjects)
|
||||
{
|
||||
/*
|
||||
* This is an error, as it will fail at runtime on all ACPI
|
||||
* implementations. Any named object declarations will be
|
||||
* executed twice, causing failure the second time. Note,
|
||||
* this is independent of whether the method is declared
|
||||
* Serialized, because the same thread is attempting to
|
||||
* reenter the method, and this will always succeed.
|
||||
*/
|
||||
AslDualParseOpError (ASL_ERROR, ASL_MSG_ILLEGAL_RECURSION, Op,
|
||||
Op->Asl.Value.String, ASL_MSG_FOUND_HERE, MethodInfo->Op,
|
||||
MethodInfo->Op->Asl.ExternalName);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Method does not create objects, issue a remark */
|
||||
|
||||
AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -622,20 +643,28 @@ MtCheckNamedObjectInMethod (
|
||||
return;
|
||||
}
|
||||
|
||||
/* Determine if we are creating a named object */
|
||||
/* Determine if we are creating a named object within a method */
|
||||
|
||||
if (!MethodInfo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
|
||||
if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
|
||||
{
|
||||
/*
|
||||
* If we have a named object created within a non-serialized method,
|
||||
* emit a remark that the method should be serialized.
|
||||
* 1) Mark the method as a method that creates named objects.
|
||||
*
|
||||
* 2) If the method is non-serialized, emit a remark that the method
|
||||
* should be serialized.
|
||||
*
|
||||
* Reason: If a thread blocks within the method for any reason, and
|
||||
* another thread enters the method, the method will fail because an
|
||||
* attempt will be made to create the same object twice.
|
||||
* another thread enters the method, the method will fail because
|
||||
* an attempt will be made to create the same object twice.
|
||||
*/
|
||||
if (MethodInfo && !MethodInfo->ShouldBeSerialized)
|
||||
MethodInfo->CreatesNamedObjects = TRUE;
|
||||
if (!MethodInfo->ShouldBeSerialized)
|
||||
{
|
||||
AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,
|
||||
"due to creation of named objects within");
|
||||
|
@ -1037,7 +1037,7 @@ OpnDoDefinitionBlock (
|
||||
* We will use the AML filename that is embedded in the source file
|
||||
* for the output filename.
|
||||
*/
|
||||
Filename = UtStringCacheCalloc (strlen (Gbl_DirectoryPath) +
|
||||
Filename = UtLocalCacheCalloc (strlen (Gbl_DirectoryPath) +
|
||||
strlen ((char *) Child->Asl.Value.Buffer) + 1);
|
||||
|
||||
/* Prepend the current directory path */
|
||||
@ -1094,7 +1094,7 @@ OpnDoDefinitionBlock (
|
||||
if (Child->Asl.Value.String)
|
||||
{
|
||||
Length = strlen (Child->Asl.Value.String);
|
||||
Gbl_TableId = UtStringCacheCalloc (Length + 1);
|
||||
Gbl_TableId = UtLocalCacheCalloc (Length + 1);
|
||||
strcpy (Gbl_TableId, Child->Asl.Value.String);
|
||||
|
||||
/*
|
||||
|
@ -275,7 +275,7 @@ OptSearchToRoot (
|
||||
|
||||
/* We must allocate a new string for the name (TargetPath gets deleted) */
|
||||
|
||||
*NewPath = UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
|
||||
*NewPath = UtLocalCacheCalloc (ACPI_NAME_SIZE + 1);
|
||||
strcpy (*NewPath, Path);
|
||||
|
||||
if (strncmp (*NewPath, "_T_", 3))
|
||||
|
@ -178,9 +178,6 @@ AslDoResponseFile (
|
||||
#define ASL_TOKEN_SEPARATORS " \t\n"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|t|T+G^v^w|x:z"
|
||||
|
||||
static char ASL_BUILD_DATE[] = __DATE__;
|
||||
static char ASL_BUILD_TIME[] = __TIME__;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -207,7 +204,6 @@ AslCommandLine (
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
|
||||
Usage ();
|
||||
exit (1);
|
||||
}
|
||||
@ -541,7 +537,6 @@ AslDoOptions (
|
||||
{
|
||||
case '^':
|
||||
|
||||
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
|
||||
Usage ();
|
||||
exit (0);
|
||||
|
||||
@ -891,8 +886,8 @@ AslDoOptions (
|
||||
|
||||
case 'd':
|
||||
|
||||
printf ("%s Build date/time: %s %s\n",
|
||||
ASL_COMPILER_NAME, ASL_BUILD_DATE, ASL_BUILD_TIME);
|
||||
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
exit (0);
|
||||
|
||||
case 'e':
|
||||
|
@ -158,13 +158,6 @@
|
||||
ACPI_MODULE_NAME ("aslparseop")
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static ACPI_PARSE_OBJECT *
|
||||
TrGetOpFromCache (
|
||||
void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrCreateOp
|
||||
@ -490,7 +483,7 @@ TrCreateTargetOp (
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Op = TrGetOpFromCache ();
|
||||
Op = UtParseOpCacheCalloc ();
|
||||
|
||||
/* Copy the pertinent values (omit link pointer fields) */
|
||||
|
||||
@ -788,7 +781,7 @@ TrAllocateOp (
|
||||
ACPI_PARSE_OBJECT *LatestOp;
|
||||
|
||||
|
||||
Op = TrGetOpFromCache ();
|
||||
Op = UtParseOpCacheCalloc ();
|
||||
|
||||
Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
|
||||
Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
|
||||
@ -875,50 +868,6 @@ TrAllocateOp (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrGetOpFromCache
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: New parse op. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a new parse op for the parse tree. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_PARSE_OBJECT *
|
||||
TrGetOpFromCache (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_ParseOpCacheList;
|
||||
Gbl_ParseOpCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer);
|
||||
Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_ParseOpCount++;
|
||||
return (Gbl_ParseOpCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrPrintOpFlags
|
||||
|
@ -293,7 +293,7 @@ OpcParsePrintf (
|
||||
|
||||
if (StringToProcess)
|
||||
{
|
||||
NewString = UtStringCacheCalloc (StringLength + 1);
|
||||
NewString = UtLocalCacheCalloc (StringLength + 1);
|
||||
strncpy (NewString, StartPosition, StringLength);
|
||||
|
||||
NewOp = TrAllocateOp (PARSEOP_STRING_LITERAL);
|
||||
@ -382,7 +382,7 @@ OpcParsePrintf (
|
||||
|
||||
if (StringToProcess)
|
||||
{
|
||||
NewString = UtStringCacheCalloc (StringLength + 1);
|
||||
NewString = UtLocalCacheCalloc (StringLength + 1);
|
||||
strncpy (NewString, StartPosition, StringLength);
|
||||
|
||||
NewOp = TrAllocateOp (PARSEOP_STRING_LITERAL);
|
||||
|
@ -410,7 +410,7 @@ AslDoDisassembly (
|
||||
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
|
||||
|
||||
CmDeleteCaches ();
|
||||
UtDeleteLocalCaches ();
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@ -453,7 +453,7 @@ AslDoOneFile (
|
||||
/* Take a copy of the input filename, convert any backslashes */
|
||||
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename =
|
||||
UtStringCacheCalloc (strlen (Filename) + 1);
|
||||
UtLocalCacheCalloc (strlen (Filename) + 1);
|
||||
|
||||
strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
|
||||
UtConvertBackslashes (Gbl_Files[ASL_FILE_INPUT].Filename);
|
||||
|
@ -382,7 +382,7 @@ AslPushInputFileStack (
|
||||
/* Reset the global line count and filename */
|
||||
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename =
|
||||
UtStringCacheCalloc (strlen (Filename) + 1);
|
||||
UtLocalCacheCalloc (strlen (Filename) + 1);
|
||||
|
||||
strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
|
||||
|
||||
@ -1009,7 +1009,7 @@ CompletedString:
|
||||
*/
|
||||
*StringBuffer = 0;
|
||||
|
||||
CleanString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
CleanString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
strcpy (CleanString, MsgBuffer);
|
||||
AslCompilerlval.s = CleanString;
|
||||
return (TRUE);
|
||||
|
@ -202,6 +202,7 @@ typedef struct asl_method_info
|
||||
UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS];
|
||||
UINT8 HasBeenTyped;
|
||||
UINT8 ShouldBeSerialized;
|
||||
UINT8 CreatesNamedObjects;
|
||||
|
||||
} ASL_METHOD_INFO;
|
||||
|
||||
@ -337,8 +338,11 @@ typedef struct asl_include_dir
|
||||
} ASL_INCLUDE_DIR;
|
||||
|
||||
|
||||
/* An entry in the exception list, one for each error/warning */
|
||||
|
||||
/*
|
||||
* An entry in the exception list, one for each error/warning
|
||||
* Note: SubError nodes would be treated with the same messageId and Level
|
||||
* as the parent error node.
|
||||
*/
|
||||
typedef struct asl_error_msg
|
||||
{
|
||||
UINT32 LineNumber;
|
||||
@ -347,6 +351,7 @@ typedef struct asl_error_msg
|
||||
UINT32 Column;
|
||||
char *Message;
|
||||
struct asl_error_msg *Next;
|
||||
struct asl_error_msg *SubError;
|
||||
char *Filename;
|
||||
char *SourceLine;
|
||||
UINT32 FilenameLength;
|
||||
|
@ -174,12 +174,6 @@ UtAttachNameseg (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name);
|
||||
|
||||
static void
|
||||
UtReallocLineBuffers (
|
||||
char **Buffer,
|
||||
UINT32 OldSize,
|
||||
UINT32 NewSize);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -309,45 +303,6 @@ UtDisplayConstantOpcodes (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCalloc
|
||||
*
|
||||
* PARAMETERS: Size - Bytes to be allocated
|
||||
*
|
||||
* RETURN: Pointer to the allocated memory. Guaranteed to be valid.
|
||||
*
|
||||
* DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an
|
||||
* allocation failure, on the assumption that nothing more can be
|
||||
* accomplished.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void *
|
||||
UtLocalCalloc (
|
||||
UINT32 Size)
|
||||
{
|
||||
void *Allocated;
|
||||
|
||||
|
||||
Allocated = ACPI_ALLOCATE_ZEROED (Size);
|
||||
if (!Allocated)
|
||||
{
|
||||
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
|
||||
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
|
||||
Gbl_InputByteCount, Gbl_CurrentColumn,
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
|
||||
|
||||
CmCleanupAndExit ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
TotalAllocations++;
|
||||
TotalAllocated += Size;
|
||||
return (Allocated);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtBeginEvent
|
||||
@ -635,180 +590,6 @@ UtCheckIntegerRange (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtStringCacheCalloc
|
||||
*
|
||||
* PARAMETERS: Length - Size of buffer requested
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts compiler on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a string buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
UtStringCacheCalloc (
|
||||
UINT32 Length)
|
||||
{
|
||||
char *Buffer;
|
||||
ASL_CACHE_INFO *Cache;
|
||||
UINT32 CacheSize = ASL_STRING_CACHE_SIZE;
|
||||
|
||||
|
||||
if (Length > CacheSize)
|
||||
{
|
||||
CacheSize = Length;
|
||||
|
||||
if (Gbl_StringCacheList)
|
||||
{
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
|
||||
|
||||
/* Link new cache buffer just following head of list */
|
||||
|
||||
Cache->Next = Gbl_StringCacheList->Next;
|
||||
Gbl_StringCacheList->Next = Cache;
|
||||
|
||||
/* Leave cache management pointers alone as they pertain to head */
|
||||
|
||||
Gbl_StringCount++;
|
||||
Gbl_StringSize += Length;
|
||||
|
||||
return (Cache->Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_StringCacheList;
|
||||
Gbl_StringCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_StringCacheNext = Cache->Buffer;
|
||||
Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize;
|
||||
}
|
||||
|
||||
Gbl_StringCount++;
|
||||
Gbl_StringSize += Length;
|
||||
|
||||
Buffer = Gbl_StringCacheNext;
|
||||
Gbl_StringCacheNext += Length;
|
||||
return (Buffer);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtExpandLineBuffers
|
||||
*
|
||||
* PARAMETERS: None. Updates global line buffer pointers.
|
||||
*
|
||||
* RETURN: None. Reallocates the global line buffers
|
||||
*
|
||||
* DESCRIPTION: Called if the current line buffer becomes filled. Reallocates
|
||||
* all global line buffers and updates Gbl_LineBufferSize. NOTE:
|
||||
* Also used for the initial allocation of the buffers, when
|
||||
* all of the buffer pointers are NULL. Initial allocations are
|
||||
* of size ASL_DEFAULT_LINE_BUFFER_SIZE
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
UtExpandLineBuffers (
|
||||
void)
|
||||
{
|
||||
UINT32 NewSize;
|
||||
|
||||
|
||||
/* Attempt to double the size of all line buffers */
|
||||
|
||||
NewSize = Gbl_LineBufferSize * 2;
|
||||
if (Gbl_CurrentLineBuffer)
|
||||
{
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"Increasing line buffer size from %u to %u\n",
|
||||
Gbl_LineBufferSize, NewSize);
|
||||
}
|
||||
|
||||
UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize);
|
||||
|
||||
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
|
||||
Gbl_LineBufferSize = NewSize;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtReallocLineBuffers
|
||||
*
|
||||
* PARAMETERS: Buffer - Buffer to realloc
|
||||
* OldSize - Old size of Buffer
|
||||
* NewSize - New size of Buffer
|
||||
*
|
||||
* RETURN: none
|
||||
*
|
||||
* DESCRIPTION: Reallocate and initialize Buffer
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void
|
||||
UtReallocLineBuffers (
|
||||
char **Buffer,
|
||||
UINT32 OldSize,
|
||||
UINT32 NewSize)
|
||||
{
|
||||
|
||||
*Buffer = realloc (*Buffer, NewSize);
|
||||
if (*Buffer)
|
||||
{
|
||||
memset (*Buffer + OldSize, 0, NewSize - OldSize);
|
||||
return;
|
||||
}
|
||||
|
||||
printf ("Could not increase line buffer size from %u to %u\n",
|
||||
OldSize, NewSize);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, NULL, NULL);
|
||||
AslAbort ();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtFreeLineBuffers
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Free all line buffers
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
UtFreeLineBuffers (
|
||||
void)
|
||||
{
|
||||
|
||||
free (Gbl_CurrentLineBuffer);
|
||||
free (Gbl_MainTokenBuffer);
|
||||
free (Gbl_MacroTokenBuffer);
|
||||
free (Gbl_ExpressionTokenBuffer);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtInternalizeName
|
||||
@ -843,7 +624,7 @@ UtInternalizeName (
|
||||
|
||||
/* We need a segment to store the internal name */
|
||||
|
||||
Info.InternalName = UtStringCacheCalloc (Info.Length);
|
||||
Info.InternalName = UtLocalCacheCalloc (Info.Length);
|
||||
|
||||
/* Build the name */
|
||||
|
||||
|
@ -193,7 +193,7 @@ CvProcessComment (
|
||||
*StringBuffer = 0;
|
||||
|
||||
CvDbgPrint ("Multi-line comment\n");
|
||||
CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
strcpy (CommentString, MsgBuffer);
|
||||
|
||||
CvDbgPrint ("CommentString: %s\n", CommentString);
|
||||
@ -208,7 +208,7 @@ CvProcessComment (
|
||||
|
||||
if (LineToken)
|
||||
{
|
||||
FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
|
||||
FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1);
|
||||
strcpy (FinalLineToken, LineToken);
|
||||
|
||||
/* Get rid of any carriage returns */
|
||||
@ -238,7 +238,7 @@ CvProcessComment (
|
||||
}
|
||||
}
|
||||
|
||||
FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
|
||||
FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1);
|
||||
strcat (FinalLineToken, LineToken);
|
||||
|
||||
/* Get rid of any carriage returns */
|
||||
@ -268,7 +268,7 @@ CvProcessComment (
|
||||
* spacing.
|
||||
*/
|
||||
FinalCommentString =
|
||||
UtStringCacheCalloc (strlen (CommentString) +
|
||||
UtLocalCacheCalloc (strlen (CommentString) +
|
||||
CurrentState.SpacesBefore + 1);
|
||||
|
||||
for (i = 0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) &&
|
||||
@ -313,7 +313,7 @@ CvProcessCommentType2 (
|
||||
{
|
||||
*StringBuffer = 0; /* null terminate */
|
||||
CvDbgPrint ("Single-line comment\n");
|
||||
CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1);
|
||||
strcpy (CommentString, MsgBuffer);
|
||||
|
||||
/* If this comment lies on the same line as the latest parse op,
|
||||
@ -342,7 +342,7 @@ CvProcessCommentType2 (
|
||||
* [ (spaces) (comment) ( * /) ('\0') ]
|
||||
*
|
||||
*/
|
||||
FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore +
|
||||
FinalCommentString = UtLocalCacheCalloc (CurrentState.SpacesBefore +
|
||||
strlen (CommentString) + 3 + 1);
|
||||
|
||||
for (i = 0; (CurrentState.CommentType != 1) &&
|
||||
@ -507,7 +507,7 @@ CgWriteAmlDefBlockComment(
|
||||
|
||||
/* First, print the file name comment after changing .asl to .dsl */
|
||||
|
||||
NewFilename = UtStringCacheCalloc (strlen (Op->Asl.Filename));
|
||||
NewFilename = UtLocalCacheCalloc (strlen (Op->Asl.Filename));
|
||||
strcpy (NewFilename, Op->Asl.Filename);
|
||||
DirectoryPosition = strrchr (NewFilename, '/');
|
||||
Position = strrchr (NewFilename, '.');
|
||||
@ -944,7 +944,7 @@ CvAppendInlineComment (
|
||||
|
||||
Size = strlen (ToAdd);
|
||||
Size += strlen (InlineComment);
|
||||
Str = UtStringCacheCalloc (Size + 1);
|
||||
Str = UtLocalCacheCalloc (Size + 1);
|
||||
|
||||
strcpy (Str, InlineComment);
|
||||
strcat (Str, ToAdd);
|
||||
|
@ -714,7 +714,7 @@ CvCaptureCommentsOnly (
|
||||
UINT8 *Aml = ParserState->Aml;
|
||||
UINT16 Opcode = (UINT16) ACPI_GET8 (Aml);
|
||||
UINT32 Length = 0;
|
||||
UINT8 CommentOption = (UINT16) ACPI_GET8 (Aml+1);
|
||||
UINT8 CommentOption;
|
||||
BOOLEAN StdDefBlockFlag = FALSE;
|
||||
ACPI_COMMENT_NODE *CommentNode;
|
||||
ACPI_FILE_NODE *FileNode;
|
||||
|
@ -152,7 +152,6 @@
|
||||
#define _DECLARE_DT_GLOBALS
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dtcompile")
|
||||
@ -281,7 +280,6 @@ DtDoCompile (
|
||||
CleanupAndExit:
|
||||
|
||||
AcpiUtDeleteCaches ();
|
||||
DtDeleteCaches ();
|
||||
CmCleanupAndExit ();
|
||||
return (Status);
|
||||
}
|
||||
@ -412,7 +410,7 @@ DtCompileDataTable (
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
Gbl_Signature = UtStringCacheCalloc (strlen (Signature) + 1);
|
||||
Gbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1);
|
||||
strcpy (Gbl_Signature, Signature);
|
||||
|
||||
/*
|
||||
@ -585,7 +583,7 @@ DtCompileTable (
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
String = UtStringCacheCalloc (Length);
|
||||
String = UtLocalCacheCalloc (Length);
|
||||
Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
|
||||
}
|
||||
|
||||
@ -828,7 +826,7 @@ DtCompilePadding (
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
String = UtStringCacheCalloc (Length);
|
||||
String = UtLocalCacheCalloc (Length);
|
||||
Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,6 @@
|
||||
#ifndef _DTCOMPILER
|
||||
#define _DTCOMPILER
|
||||
|
||||
#include <stdio.h>
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
@ -510,18 +509,6 @@ void
|
||||
DtSetTableLength(
|
||||
void);
|
||||
|
||||
DT_SUBTABLE *
|
||||
UtSubtableCacheCalloc (
|
||||
void);
|
||||
|
||||
DT_FIELD *
|
||||
UtFieldCacheCalloc (
|
||||
void);
|
||||
|
||||
void
|
||||
DtDeleteCaches (
|
||||
void);
|
||||
|
||||
|
||||
/* dttable - individual table compilation */
|
||||
|
||||
@ -621,6 +608,14 @@ ACPI_STATUS
|
||||
DtCompileNfit (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompilePcct (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompilePdtt (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompilePmtt (
|
||||
void **PFieldList);
|
||||
@ -629,10 +624,6 @@ ACPI_STATUS
|
||||
DtCompilePptt (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompilePcct (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileRsdt (
|
||||
void **PFieldList);
|
||||
@ -641,6 +632,10 @@ ACPI_STATUS
|
||||
DtCompileS3pt (
|
||||
DT_FIELD **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileSdev (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileSlic (
|
||||
void **PFieldList);
|
||||
@ -661,6 +656,10 @@ ACPI_STATUS
|
||||
DtCompileTcpa (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileTpm2 (
|
||||
void **PFieldList);
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileUefi (
|
||||
void **PFieldList);
|
||||
@ -724,6 +723,7 @@ extern const unsigned char TemplateMsdm[];
|
||||
extern const unsigned char TemplateMtmr[];
|
||||
extern const unsigned char TemplateNfit[];
|
||||
extern const unsigned char TemplatePcct[];
|
||||
extern const unsigned char TemplatePdtt[];
|
||||
extern const unsigned char TemplatePmtt[];
|
||||
extern const unsigned char TemplatePptt[];
|
||||
extern const unsigned char TemplateRasf[];
|
||||
@ -731,6 +731,7 @@ extern const unsigned char TemplateRsdt[];
|
||||
extern const unsigned char TemplateS3pt[];
|
||||
extern const unsigned char TemplateSbst[];
|
||||
extern const unsigned char TemplateSdei[];
|
||||
extern const unsigned char TemplateSdev[];
|
||||
extern const unsigned char TemplateSlic[];
|
||||
extern const unsigned char TemplateSlit[];
|
||||
extern const unsigned char TemplateSpcr[];
|
||||
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
#include "dtparser.y.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dtfield")
|
||||
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
#include "acapps.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
@ -239,7 +238,7 @@ DtTrim (
|
||||
|
||||
if (!strcmp (String, " "))
|
||||
{
|
||||
ReturnString = UtStringCacheCalloc (1);
|
||||
ReturnString = UtLocalCacheCalloc (1);
|
||||
return (ReturnString);
|
||||
}
|
||||
|
||||
@ -287,7 +286,7 @@ DtTrim (
|
||||
/* Create the trimmed return string */
|
||||
|
||||
Length = ACPI_PTR_DIFF (End, Start) + 1;
|
||||
ReturnString = UtStringCacheCalloc (Length + 1);
|
||||
ReturnString = UtLocalCacheCalloc (Length + 1);
|
||||
if (strlen (Start))
|
||||
{
|
||||
strncpy (ReturnString, Start, Length);
|
||||
|
@ -151,7 +151,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dtparser")
|
||||
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dtsubtable")
|
||||
@ -186,7 +185,7 @@ DtCreateSubtable (
|
||||
|
||||
/* Create a new buffer for the subtable data */
|
||||
|
||||
String = UtStringCacheCalloc (Length);
|
||||
String = UtLocalCacheCalloc (Length);
|
||||
Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
|
||||
memcpy (Subtable->Buffer, Buffer, Length);
|
||||
|
||||
|
@ -152,7 +152,6 @@
|
||||
/* Compile routines for the basic ACPI tables */
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dttable")
|
||||
|
@ -152,7 +152,6 @@
|
||||
/* Compile all complex data tables, signatures starting with A-I */
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dttable1")
|
||||
|
@ -152,7 +152,6 @@
|
||||
/* Compile all complex data tables, signatures starting with L-Z */
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
ACPI_MODULE_NAME ("dttable2")
|
||||
@ -902,6 +901,66 @@ DtCompilePcct (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompilePdtt
|
||||
*
|
||||
* PARAMETERS: List - Current field list pointer
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Compile PDTT.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompilePdtt (
|
||||
void **List)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
DT_SUBTABLE *Subtable;
|
||||
DT_SUBTABLE *ParentTable;
|
||||
DT_FIELD **PFieldList = (DT_FIELD **) List;
|
||||
ACPI_TABLE_PDTT *PdttHeader;
|
||||
UINT32 Count = 0;
|
||||
|
||||
|
||||
/* Main table */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt, &Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
PdttHeader = ACPI_CAST_PTR (ACPI_TABLE_PDTT, ParentTable->Buffer);
|
||||
PdttHeader->ArrayOffset = sizeof (ACPI_TABLE_PDTT);
|
||||
|
||||
/* There is only one type of subtable at this time, no need to decode */
|
||||
|
||||
while (*PFieldList)
|
||||
{
|
||||
/* List of subchannel IDs, each 2 bytes */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt0,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
Count++;
|
||||
}
|
||||
|
||||
PdttHeader->TriggerCount = (UINT8) Count;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompilePmtt
|
||||
@ -1283,6 +1342,219 @@ DtCompileS3pt (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompileSdev
|
||||
*
|
||||
* PARAMETERS: List - Current field list pointer
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Compile SDEV.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileSdev (
|
||||
void **List)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_SDEV_HEADER *SdevHeader;
|
||||
DT_SUBTABLE *Subtable;
|
||||
DT_SUBTABLE *ParentTable;
|
||||
ACPI_DMTABLE_INFO *InfoTable;
|
||||
DT_FIELD **PFieldList = (DT_FIELD **) List;
|
||||
DT_FIELD *SubtableStart;
|
||||
ACPI_SDEV_PCIE *Pcie = NULL;
|
||||
ACPI_SDEV_NAMESPACE *Namesp = NULL;
|
||||
UINT32 EntryCount;
|
||||
|
||||
|
||||
/* Subtables */
|
||||
|
||||
while (*PFieldList)
|
||||
{
|
||||
/* Compile common SDEV subtable header */
|
||||
|
||||
SubtableStart = *PFieldList;
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdevHdr,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
DtPushSubtable (Subtable);
|
||||
|
||||
SdevHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer);
|
||||
SdevHeader->Length = (UINT8)(sizeof (ACPI_SDEV_HEADER));
|
||||
|
||||
switch (SdevHeader->Type)
|
||||
{
|
||||
case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
|
||||
|
||||
InfoTable = AcpiDmTableInfoSdev0;
|
||||
Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable->Buffer);
|
||||
break;
|
||||
|
||||
case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
|
||||
|
||||
InfoTable = AcpiDmTableInfoSdev1;
|
||||
Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable->Buffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/* Compile SDEV subtable body */
|
||||
|
||||
Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
/* Optional data fields are appended to the main subtable body */
|
||||
|
||||
switch (SdevHeader->Type)
|
||||
{
|
||||
case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
|
||||
|
||||
/* Append DeviceId namespace string */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev0a,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (!Subtable)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
Namesp->DeviceIdOffset = sizeof (ACPI_SDEV_NAMESPACE);
|
||||
Namesp->DeviceIdLength = (UINT16) Subtable->Length;
|
||||
|
||||
/* Append Vendor data */
|
||||
|
||||
Namesp->VendorDataLength = 0;
|
||||
Namesp->VendorDataOffset = 0;
|
||||
|
||||
if (*PFieldList)
|
||||
{
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (Subtable)
|
||||
{
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
Namesp->VendorDataOffset =
|
||||
Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
|
||||
Namesp->VendorDataLength =
|
||||
(UINT16) Subtable->Length;
|
||||
}
|
||||
}
|
||||
|
||||
/* Final size of entire namespace structure */
|
||||
|
||||
SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_NAMESPACE) +
|
||||
Subtable->Length + Namesp->DeviceIdLength);
|
||||
break;
|
||||
|
||||
case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
|
||||
|
||||
/* Append the PCIe path info first */
|
||||
|
||||
EntryCount = 0;
|
||||
while (*PFieldList && !strcmp ((*PFieldList)->Name, "Device"))
|
||||
{
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1a,
|
||||
&Subtable, FALSE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (!Subtable)
|
||||
{
|
||||
DtPopSubtable ();
|
||||
break;
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
EntryCount++;
|
||||
}
|
||||
|
||||
/* Path offset will point immediately after the main subtable */
|
||||
|
||||
Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE);
|
||||
Pcie->PathLength = (UINT16)
|
||||
(EntryCount * sizeof (ACPI_SDEV_PCIE_PATH));
|
||||
|
||||
/* Append the Vendor Data last */
|
||||
|
||||
Pcie->VendorDataLength = 0;
|
||||
Pcie->VendorDataOffset = 0;
|
||||
|
||||
if (*PFieldList)
|
||||
{
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (Subtable)
|
||||
{
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
Pcie->VendorDataOffset =
|
||||
Pcie->PathOffset + Pcie->PathLength;
|
||||
Pcie->VendorDataLength = (UINT16)
|
||||
Subtable->Length;
|
||||
}
|
||||
}
|
||||
|
||||
SdevHeader->Length =
|
||||
sizeof (ACPI_SDEV_PCIE) +
|
||||
Pcie->PathLength + Pcie->VendorDataLength;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV");
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
DtPopSubtable ();
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompileSlic
|
||||
@ -1601,6 +1873,109 @@ DtCompileTcpa (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtCompileTpm2
|
||||
*
|
||||
* PARAMETERS: PFieldList - Current field list pointer
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Compile TPM2.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DtCompileTpm2 (
|
||||
void **List)
|
||||
{
|
||||
DT_FIELD **PFieldList = (DT_FIELD **) List;
|
||||
DT_SUBTABLE *Subtable;
|
||||
ACPI_TABLE_TPM2 *Tpm2Header;
|
||||
DT_SUBTABLE *ParentTable;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
/* Compile the main table */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
Tpm2Header = ACPI_CAST_PTR (ACPI_TABLE_TPM2, ParentTable->Buffer);
|
||||
|
||||
/* Method parameters */
|
||||
/* Optional: Log area minimum length */
|
||||
/* Optional: Log area start address */
|
||||
/* TBD: Optional fields above not fully implemented (not optional at this time) */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2a,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
|
||||
|
||||
/* Subtable type depends on the StartMethod */
|
||||
|
||||
switch (Tpm2Header->StartMethod)
|
||||
{
|
||||
case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
|
||||
|
||||
/* Subtable specific to to ARM_SMC */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm211,
|
||||
&Subtable, TRUE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
break;
|
||||
|
||||
case ACPI_TPM2_START_METHOD:
|
||||
case ACPI_TPM2_MEMORY_MAPPED:
|
||||
case ACPI_TPM2_COMMAND_BUFFER:
|
||||
case ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD:
|
||||
break;
|
||||
|
||||
case ACPI_TPM2_RESERVED1:
|
||||
case ACPI_TPM2_RESERVED3:
|
||||
case ACPI_TPM2_RESERVED4:
|
||||
case ACPI_TPM2_RESERVED5:
|
||||
case ACPI_TPM2_RESERVED9:
|
||||
case ACPI_TPM2_RESERVED10:
|
||||
|
||||
AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
|
||||
Tpm2Header->StartMethod);
|
||||
Status = AE_ERROR;
|
||||
break;
|
||||
|
||||
case ACPI_TPM2_NOT_ALLOWED:
|
||||
default:
|
||||
|
||||
AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
|
||||
Tpm2Header->StartMethod);
|
||||
Status = AE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtGetGenericTableInfo
|
||||
|
@ -151,7 +151,6 @@
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "acapps.h"
|
||||
#include "dtcompiler.h"
|
||||
#include "dttemplate.h" /* Contains the hex ACPI table templates */
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
@ -315,7 +314,7 @@ DtCreateTemplates (
|
||||
/* Shutdown ACPICA subsystem */
|
||||
|
||||
(void) AcpiTerminate ();
|
||||
CmDeleteCaches ();
|
||||
UtDeleteLocalCaches ();
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
@ -1079,6 +1079,17 @@ const unsigned char TemplatePcct[] =
|
||||
0x55,0x55,0x55,0x55,0x55,0x55 /* 00000248 "UUUUUU| */
|
||||
};
|
||||
|
||||
const unsigned char TemplatePdtt[] =
|
||||
{
|
||||
0x50,0x44,0x54,0x54,0x34,0x00,0x00,0x00, /* 00000000 "PDTT4..." */
|
||||
0x01,0xCB,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
|
||||
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
|
||||
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
|
||||
0x31,0x08,0x17,0x20,0x04,0x00,0x00,0x00, /* 00000020 "1.. ...." */
|
||||
0x2C,0x00,0x00,0x00,0xAA,0x03,0xBB,0x02, /* 00000028 ",......." */
|
||||
0xCC,0x01,0xDD,0x00 /* 00000030 "...." */
|
||||
};
|
||||
|
||||
const unsigned char TemplatePmtt[] =
|
||||
{
|
||||
0x50,0x4D,0x54,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "PMTT...." */
|
||||
@ -1187,6 +1198,25 @@ const unsigned char TemplateSdei[] =
|
||||
0x30,0x09,0x16,0x20 /* 00000028 "0.. " */
|
||||
};
|
||||
|
||||
const unsigned char TemplateSdev[] =
|
||||
{
|
||||
0x53,0x44,0x45,0x56,0x72,0x00,0x00,0x00, /* 00000000 "SDEVr..." */
|
||||
0x01,0x2F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "./INTEL " */
|
||||
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
|
||||
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
|
||||
0x31,0x08,0x17,0x20,0x00,0x01,0x2A,0x00, /* 00000020 "1.. ..*." */
|
||||
0x0C,0x00,0x16,0x00,0x22,0x00,0x08,0x00, /* 00000028 "...."..." */
|
||||
0x5C,0x5C,0x5F,0x53,0x42,0x5F,0x2E,0x50, /* 00000030 "\\_SB_.P" */
|
||||
0x43,0x49,0x30,0x2E,0x55,0x53,0x42,0x31, /* 00000038 "CI0.USB1" */
|
||||
0x2E,0x53,0x55,0x42,0x31,0x00,0x00,0x11, /* 00000040 ".SUB1..." */
|
||||
0x22,0x33,0x44,0x55,0x66,0x77,0x01,0x01, /* 00000048 ""3DUfw.." */
|
||||
0x24,0x00,0x10,0x00,0x20,0x00,0x10,0x00, /* 00000050 "$... ..." */
|
||||
0x04,0x00,0x14,0x00,0x10,0x00,0x11,0x22, /* 00000058 "......."" */
|
||||
0x33,0x44,0xEE,0xDD,0xCC,0xBB,0xAA,0x55, /* 00000060 "3D.....U" */
|
||||
0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD, /* 00000068 "fw......" */
|
||||
0xEE,0xFF /* 00000070 ".." */
|
||||
};
|
||||
|
||||
const unsigned char TemplateSlic[] =
|
||||
{
|
||||
0x53,0x4C,0x49,0x43,0x76,0x01,0x00,0x00, /* 00000000 "SLICv..." */
|
||||
@ -1388,13 +1418,17 @@ const unsigned char TemplateTcpa[] =
|
||||
|
||||
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" */
|
||||
0x54,0x50,0x4D,0x32,0x58,0x00,0x00,0x00, /* 00000000 "TPM2X..." */
|
||||
0x03,0xAB,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
|
||||
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 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 "...." */
|
||||
0x31,0x08,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "1.. ...." */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
|
||||
0x0B,0x00,0x00,0x00,0x01,0x02,0x03,0x04, /* 00000030 "........" */
|
||||
0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C, /* 00000038 "........" */
|
||||
0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
|
||||
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 00000048 "........" */
|
||||
0x01,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF /* 00000050 "........" */
|
||||
};
|
||||
|
||||
const unsigned char TemplateUefi[] =
|
||||
|
@ -150,7 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
#include "actables.h"
|
||||
|
||||
#define _COMPONENT DT_COMPILER
|
||||
@ -570,6 +569,7 @@ DtGetFieldLength (
|
||||
case ACPI_DMT_PCCT:
|
||||
case ACPI_DMT_PMTT:
|
||||
case ACPI_DMT_PPTT:
|
||||
case ACPI_DMT_SDEV:
|
||||
case ACPI_DMT_SRAT:
|
||||
case ACPI_DMT_ASF:
|
||||
case ACPI_DMT_HESTNTYP:
|
||||
@ -602,6 +602,7 @@ DtGetFieldLength (
|
||||
case ACPI_DMT_NAME4:
|
||||
case ACPI_DMT_SIG:
|
||||
case ACPI_DMT_LPIT:
|
||||
case ACPI_DMT_TPM2:
|
||||
|
||||
ByteLength = 4;
|
||||
break;
|
||||
@ -920,153 +921,3 @@ DtWalkTableTree (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtSubtableCacheCalloc
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a subtable object buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
DT_SUBTABLE *
|
||||
UtSubtableCacheCalloc (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_SubtableCacheList;
|
||||
Gbl_SubtableCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer);
|
||||
Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_SubtableCount++;
|
||||
return (Gbl_SubtableCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtFieldCacheCalloc
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Pointer to the buffer. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a field object buffer. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
DT_FIELD *
|
||||
UtFieldCacheCalloc (
|
||||
void)
|
||||
{
|
||||
ASL_CACHE_INFO *Cache;
|
||||
|
||||
|
||||
if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast)
|
||||
{
|
||||
/* Allocate a new buffer */
|
||||
|
||||
Cache = UtLocalCalloc (sizeof (Cache->Next) +
|
||||
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE));
|
||||
|
||||
/* Link new cache buffer to head of list */
|
||||
|
||||
Cache->Next = Gbl_FieldCacheList;
|
||||
Gbl_FieldCacheList = Cache;
|
||||
|
||||
/* Setup cache management pointers */
|
||||
|
||||
Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer);
|
||||
Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE;
|
||||
}
|
||||
|
||||
Gbl_FieldCount++;
|
||||
return (Gbl_FieldCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: DtDeleteCaches
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Delete all local cache buffer blocks
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
DtDeleteCaches (
|
||||
void)
|
||||
{
|
||||
UINT32 BufferCount;
|
||||
ASL_CACHE_INFO *Next;
|
||||
|
||||
|
||||
/* Field cache */
|
||||
|
||||
BufferCount = 0;
|
||||
while (Gbl_FieldCacheList)
|
||||
{
|
||||
Next = Gbl_FieldCacheList->Next;
|
||||
ACPI_FREE (Gbl_FieldCacheList);
|
||||
Gbl_FieldCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n",
|
||||
Gbl_FieldCount, ASL_FIELD_CACHE_SIZE,
|
||||
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
|
||||
|
||||
Gbl_FieldCount = 0;
|
||||
Gbl_FieldCacheNext = NULL;
|
||||
Gbl_FieldCacheLast = NULL;
|
||||
|
||||
/* Subtable cache */
|
||||
|
||||
BufferCount = 0;
|
||||
while (Gbl_SubtableCacheList)
|
||||
{
|
||||
Next = Gbl_SubtableCacheList->Next;
|
||||
ACPI_FREE (Gbl_SubtableCacheList);
|
||||
Gbl_SubtableCacheList = Next;
|
||||
BufferCount++;
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n",
|
||||
Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE,
|
||||
(sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
|
||||
|
||||
Gbl_SubtableCount = 0;
|
||||
Gbl_SubtableCacheNext = NULL;
|
||||
Gbl_SubtableCacheLast = NULL;
|
||||
}
|
||||
|
@ -150,8 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
|
||||
#define _COMPONENT ASL_PREPROCESSOR
|
||||
ACPI_MODULE_NAME ("prexpress")
|
||||
|
@ -150,8 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
|
||||
#define _COMPONENT ASL_PREPROCESSOR
|
||||
ACPI_MODULE_NAME ("prmacros")
|
||||
|
@ -151,7 +151,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
#define _COMPONENT ASL_PREPROCESSOR
|
||||
ACPI_MODULE_NAME ("prparser")
|
||||
|
@ -152,7 +152,6 @@
|
||||
#define _DECLARE_PR_GLOBALS
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
/*
|
||||
* TBDs:
|
||||
|
@ -150,8 +150,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
|
||||
#define _COMPONENT ASL_PREPROCESSOR
|
||||
ACPI_MODULE_NAME ("prutils")
|
||||
@ -514,7 +512,7 @@ PrPushInputFileStack (
|
||||
/* Reset the global line count and filename */
|
||||
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename =
|
||||
UtStringCacheCalloc (strlen (Filename) + 1);
|
||||
UtLocalCacheCalloc (strlen (Filename) + 1);
|
||||
strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
|
||||
|
||||
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
|
||||
|
@ -234,7 +234,8 @@ AcpiDsExecBeginControlOp (
|
||||
WalkState->ParserState.PkgEnd;
|
||||
ControlState->Control.Opcode =
|
||||
Op->Common.AmlOpcode;
|
||||
|
||||
ControlState->Control.LoopTimeout = AcpiOsGetTimer () +
|
||||
(UINT64) (AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC);
|
||||
|
||||
/* Push the control state on this walk's control stack */
|
||||
|
||||
@ -327,15 +328,15 @@ AcpiDsExecEndControlOp (
|
||||
/* Predicate was true, the body of the loop was just executed */
|
||||
|
||||
/*
|
||||
* This loop counter mechanism allows the interpreter to escape
|
||||
* possibly infinite loops. This can occur in poorly written AML
|
||||
* when the hardware does not respond within a while loop and the
|
||||
* loop does not implement a timeout.
|
||||
* This infinite loop detection mechanism allows the interpreter
|
||||
* to escape possibly infinite loops. This can occur in poorly
|
||||
* written AML when the hardware does not respond within a while
|
||||
* loop and the loop does not implement a timeout.
|
||||
*/
|
||||
ControlState->Control.LoopCount++;
|
||||
if (ControlState->Control.LoopCount > AcpiGbl_MaxLoopIterations)
|
||||
if (ACPI_TIME_AFTER (AcpiOsGetTimer (),
|
||||
ControlState->Control.LoopTimeout))
|
||||
{
|
||||
Status = AE_AML_INFINITE_LOOP;
|
||||
Status = AE_AML_LOOP_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ AcpiGetTimerDuration (
|
||||
UINT32 *TimeElapsed)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT32 DeltaTicks;
|
||||
UINT64 DeltaTicks;
|
||||
UINT64 Quotient;
|
||||
|
||||
|
||||
@ -302,34 +302,33 @@ AcpiGetTimerDuration (
|
||||
return_ACPI_STATUS (AE_SUPPORT);
|
||||
}
|
||||
|
||||
if (StartTicks == EndTicks)
|
||||
{
|
||||
*TimeElapsed = 0;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute Tick Delta:
|
||||
* Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
|
||||
*/
|
||||
if (StartTicks < EndTicks)
|
||||
{
|
||||
DeltaTicks = EndTicks - StartTicks;
|
||||
}
|
||||
else if (StartTicks > EndTicks)
|
||||
DeltaTicks = EndTicks;
|
||||
if (StartTicks > EndTicks)
|
||||
{
|
||||
if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
|
||||
{
|
||||
/* 24-bit Timer */
|
||||
|
||||
DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
|
||||
DeltaTicks |= (UINT64) 1 << 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 32-bit Timer */
|
||||
|
||||
DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
|
||||
DeltaTicks |= (UINT64) 1 << 32;
|
||||
}
|
||||
}
|
||||
else /* StartTicks == EndTicks */
|
||||
{
|
||||
*TimeElapsed = 0;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
DeltaTicks -= StartTicks;
|
||||
|
||||
/*
|
||||
* Compute Duration (Requires a 64-bit multiply and divide):
|
||||
@ -337,7 +336,7 @@ AcpiGetTimerDuration (
|
||||
* TimeElapsed (microseconds) =
|
||||
* (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
|
||||
*/
|
||||
Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * ACPI_USEC_PER_SEC,
|
||||
Status = AcpiUtShortDivide (DeltaTicks * ACPI_USEC_PER_SEC,
|
||||
ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL);
|
||||
|
||||
*TimeElapsed = (UINT32) Quotient;
|
||||
|
@ -775,19 +775,19 @@ AcpiNsLookup (
|
||||
ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object;
|
||||
}
|
||||
}
|
||||
#ifdef ACPI_ASL_COMPILER
|
||||
if (!AcpiGbl_DisasmFlag &&
|
||||
(ThisNode->Flags & ANOBJ_IS_EXTERNAL))
|
||||
{
|
||||
ThisNode->Flags |= IMPLICIT_EXTERNAL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Special handling for the last segment (NumSegments == 0) */
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef ACPI_ASL_COMPILER
|
||||
if (!AcpiGbl_DisasmFlag && (ThisNode->Flags & ANOBJ_IS_EXTERNAL))
|
||||
{
|
||||
ThisNode->Flags &= ~IMPLICIT_EXTERNAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Sanity typecheck of the target object:
|
||||
*
|
||||
|
@ -545,6 +545,7 @@ AcpiNsSearchAndEnter (
|
||||
(WalkState && WalkState->Opcode == AML_SCOPE_OP))
|
||||
{
|
||||
NewNode->Flags |= ANOBJ_IS_EXTERNAL;
|
||||
NewNode->Flags |= IMPLICIT_EXTERNAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -500,15 +500,10 @@ AcpiPsCreateOp (
|
||||
* external declaration opcode. Setting WalkState->Aml to
|
||||
* WalkState->ParserState.Aml + 2 moves increments the
|
||||
* WalkState->Aml past the object type and the paramcount of the
|
||||
* external opcode. For the error message, only print the AML
|
||||
* offset. We could attempt to print the name but this may cause
|
||||
* a segmentation fault when printing the namepath because the
|
||||
* AML may be incorrect.
|
||||
* external opcode.
|
||||
*/
|
||||
AcpiOsPrintf (
|
||||
"// Invalid external declaration at AML offset 0x%x.\n",
|
||||
WalkState->Aml - WalkState->ParserState.AmlStart);
|
||||
WalkState->Aml = WalkState->ParserState.Aml + 2;
|
||||
WalkState->ParserState.Aml = WalkState->Aml;
|
||||
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
|
||||
}
|
||||
#endif
|
||||
|
@ -292,11 +292,11 @@ AcpiPsAllocOp (
|
||||
{
|
||||
AcpiGbl_CurrentScope = Op;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gbl_CaptureComments)
|
||||
{
|
||||
ASL_CV_TRANSFER_COMMENTS (Op);
|
||||
if (Gbl_CaptureComments)
|
||||
{
|
||||
ASL_CV_TRANSFER_COMMENTS (Op);
|
||||
}
|
||||
}
|
||||
|
||||
return (Op);
|
||||
|
@ -334,7 +334,6 @@ AcpiUtInitGlobals (
|
||||
AcpiGbl_NextOwnerIdOffset = 0;
|
||||
AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
|
||||
AcpiGbl_OsiMutex = NULL;
|
||||
AcpiGbl_MaxLoopIterations = ACPI_MAX_LOOP_COUNT;
|
||||
|
||||
/* Hardware oriented */
|
||||
|
||||
|
@ -260,7 +260,7 @@ AcpiUtShortShiftLeft (
|
||||
if ((Count & 63) >= 32)
|
||||
{
|
||||
OperandOvl.Part.Hi = OperandOvl.Part.Lo;
|
||||
OperandOvl.Part.Lo ^= OperandOvl.Part.Lo;
|
||||
OperandOvl.Part.Lo = 0;
|
||||
Count = (Count & 63) - 32;
|
||||
}
|
||||
ACPI_SHIFT_LEFT_64_BY_32 (OperandOvl.Part.Hi,
|
||||
@ -305,7 +305,7 @@ AcpiUtShortShiftRight (
|
||||
if ((Count & 63) >= 32)
|
||||
{
|
||||
OperandOvl.Part.Lo = OperandOvl.Part.Hi;
|
||||
OperandOvl.Part.Hi ^= OperandOvl.Part.Hi;
|
||||
OperandOvl.Part.Hi = 0;
|
||||
Count = (Count & 63) - 32;
|
||||
}
|
||||
ACPI_SHIFT_RIGHT_64_BY_32 (OperandOvl.Part.Hi,
|
||||
|
@ -188,6 +188,9 @@
|
||||
Prefix, ACPICA_COPYRIGHT, \
|
||||
Prefix
|
||||
|
||||
#define ACPI_COMMON_BUILD_TIME \
|
||||
"Build date/time: %s %s\n", __DATE__, __TIME__
|
||||
|
||||
/* Macros for usage messages */
|
||||
|
||||
#define ACPI_USAGE_HEADER(Usage) \
|
||||
|
@ -255,9 +255,9 @@
|
||||
|
||||
#define ACPI_ADDRESS_RANGE_MAX 2
|
||||
|
||||
/* Maximum number of While() loops before abort */
|
||||
/* Maximum time (default 30s) of While() loops before abort */
|
||||
|
||||
#define ACPI_MAX_LOOP_COUNT 0x000FFFFF
|
||||
#define ACPI_MAX_LOOP_TIMEOUT 30
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -272,8 +272,10 @@ typedef enum
|
||||
ACPI_DMT_PMTT,
|
||||
ACPI_DMT_PPTT,
|
||||
ACPI_DMT_SDEI,
|
||||
ACPI_DMT_SDEV,
|
||||
ACPI_DMT_SLIC,
|
||||
ACPI_DMT_SRAT,
|
||||
ACPI_DMT_TPM2,
|
||||
|
||||
/* Special opcodes */
|
||||
|
||||
@ -502,6 +504,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[];
|
||||
@ -515,6 +518,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct3[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[];
|
||||
@ -529,6 +533,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevHdr[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0a[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1a[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1b[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[];
|
||||
@ -546,6 +557,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2a[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm211[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc0[];
|
||||
@ -586,7 +599,7 @@ AcpiDmDumpTable (
|
||||
UINT32 TableLength,
|
||||
UINT32 TableOffset,
|
||||
void *Table,
|
||||
UINT32 SubTableLength,
|
||||
UINT32 SubtableLength,
|
||||
ACPI_DMTABLE_INFO *Info);
|
||||
|
||||
void
|
||||
@ -712,6 +725,10 @@ void
|
||||
AcpiDmDumpPcct (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpPdtt (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpPmtt (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
@ -732,6 +749,10 @@ UINT32
|
||||
AcpiDmDumpS3pt (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpSdev (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpSlic (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
@ -752,6 +773,10 @@ void
|
||||
AcpiDmDumpTcpa (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpTpm2 (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
void
|
||||
AcpiDmDumpVrtc (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
@ -309,7 +309,7 @@ typedef struct acpi_exception_info
|
||||
#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
|
||||
#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
|
||||
#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
|
||||
#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021)
|
||||
#define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021)
|
||||
#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
|
||||
#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
|
||||
|
||||
@ -441,7 +441,7 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Aml[] =
|
||||
EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE", "Two references refer to each other"),
|
||||
EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH", "The length of a Resource Descriptor in the AML is incorrect"),
|
||||
EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS", "A memory, I/O, or PCI configuration address is invalid"),
|
||||
EXCEP_TXT ("AE_AML_INFINITE_LOOP", "An apparent infinite AML While loop, method was aborted"),
|
||||
EXCEP_TXT ("AE_AML_LOOP_TIMEOUT", "An AML While loop exceeded the maximum execution time"),
|
||||
EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved"),
|
||||
EXCEP_TXT ("AE_AML_TARGET_TYPE", "A target operand of an incorrect type was encountered")
|
||||
};
|
||||
|
@ -834,7 +834,7 @@ typedef struct acpi_control_state
|
||||
union acpi_parse_object *PredicateOp;
|
||||
UINT8 *AmlPredicateStart; /* Start of if/while predicate */
|
||||
UINT8 *PackageEnd; /* End of if/while block */
|
||||
UINT32 LoopCount; /* While() loop counter */
|
||||
UINT64 LoopTimeout; /* While() loop timeout */
|
||||
|
||||
} ACPI_CONTROL_STATE;
|
||||
|
||||
|
@ -154,7 +154,7 @@
|
||||
|
||||
/* Current ACPICA subsystem version in YYYYMMDD format */
|
||||
|
||||
#define ACPI_CA_VERSION 0x20170831
|
||||
#define ACPI_CA_VERSION 0x20170929
|
||||
|
||||
#include "acconfig.h"
|
||||
#include "actypes.h"
|
||||
@ -370,11 +370,11 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0);
|
||||
ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE);
|
||||
|
||||
/*
|
||||
* Maximum number of While() loop iterations before forced method abort.
|
||||
* Maximum timeout for While() loop iterations before forced method abort.
|
||||
* This mechanism is intended to prevent infinite loops during interpreter
|
||||
* execution within a host kernel.
|
||||
*/
|
||||
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_COUNT);
|
||||
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_TIMEOUT);
|
||||
|
||||
/*
|
||||
* This mechanism is used to trace a specified AML method. The method is
|
||||
|
@ -179,9 +179,10 @@
|
||||
#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
|
||||
#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
|
||||
#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
|
||||
#define ACPI_SIG_PDTT "PDTT" /* Processor Debug Trigger Table */
|
||||
#define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */
|
||||
#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
|
||||
#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
|
||||
#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */
|
||||
#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
|
||||
#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
|
||||
#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
|
||||
@ -1603,7 +1604,7 @@ typedef struct acpi_nfit_flush_address
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* PDTT - Processor Debug Trigger Table (ACPI 6.2)
|
||||
* PDTT - Platform Debug Trigger Table (ACPI 6.2)
|
||||
* Version 0
|
||||
*
|
||||
******************************************************************************/
|
||||
@ -1625,16 +1626,15 @@ typedef struct acpi_table_pdtt
|
||||
*/
|
||||
typedef struct acpi_pdtt_channel
|
||||
{
|
||||
UINT16 SubChannelId;
|
||||
UINT8 SubchannelId;
|
||||
UINT8 Flags;
|
||||
|
||||
} ACPI_PDTT_CHANNEL;
|
||||
|
||||
/* Flags for above */
|
||||
|
||||
/* Mask and Flags for above */
|
||||
|
||||
#define ACPI_PDTT_SUBCHANNEL_ID_MASK 0x00FF
|
||||
#define ACPI_PDTT_RUNTIME_TRIGGER (1<<8)
|
||||
#define ACPI_PPTT_WAIT_COMPLETION (1<<9)
|
||||
#define ACPI_PDTT_RUNTIME_TRIGGER (1)
|
||||
#define ACPI_PPTT_WAIT_COMPLETION (1<<1)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1746,6 +1746,82 @@ typedef struct acpi_table_sbst
|
||||
} ACPI_TABLE_SBST;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SDEV - Secure Devices Table (ACPI 6.2)
|
||||
* Version 1
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
typedef struct acpi_table_sdev
|
||||
{
|
||||
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
|
||||
|
||||
} ACPI_TABLE_SDEV;
|
||||
|
||||
|
||||
typedef struct acpi_sdev_header
|
||||
{
|
||||
UINT8 Type;
|
||||
UINT8 Flags;
|
||||
UINT16 Length;
|
||||
|
||||
} ACPI_SDEV_HEADER;
|
||||
|
||||
|
||||
/* Values for subtable type above */
|
||||
|
||||
enum AcpiSdevType
|
||||
{
|
||||
ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
|
||||
ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
|
||||
ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
|
||||
};
|
||||
|
||||
/* Values for flags above */
|
||||
|
||||
#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
|
||||
|
||||
/*
|
||||
* SDEV subtables
|
||||
*/
|
||||
|
||||
/* 0: Namespace Device Based Secure Device Structure */
|
||||
|
||||
typedef struct acpi_sdev_namespace
|
||||
{
|
||||
ACPI_SDEV_HEADER Header;
|
||||
UINT16 DeviceIdOffset;
|
||||
UINT16 DeviceIdLength;
|
||||
UINT16 VendorDataOffset;
|
||||
UINT16 VendorDataLength;
|
||||
|
||||
} ACPI_SDEV_NAMESPACE;
|
||||
|
||||
/* 1: PCIe Endpoint Device Based Device Structure */
|
||||
|
||||
typedef struct acpi_sdev_pcie
|
||||
{
|
||||
ACPI_SDEV_HEADER Header;
|
||||
UINT16 Segment;
|
||||
UINT16 StartBus;
|
||||
UINT16 PathOffset;
|
||||
UINT16 PathLength;
|
||||
UINT16 VendorDataOffset;
|
||||
UINT16 VendorDataLength;
|
||||
|
||||
} ACPI_SDEV_PCIE;
|
||||
|
||||
/* 1a: PCIe Endpoint path entry */
|
||||
|
||||
typedef struct acpi_sdev_pcie_path
|
||||
{
|
||||
UINT8 Device;
|
||||
UINT8 Function;
|
||||
|
||||
} ACPI_SDEV_PCIE_PATH;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SLIT - System Locality Distance Information Table
|
||||
|
@ -1550,6 +1550,8 @@ enum AcpiSpmiInterfaceTypes
|
||||
* TCPA - Trusted Computing Platform Alliance table
|
||||
* Version 2
|
||||
*
|
||||
* TCG Hardware Interface Table for TPM 1.2 Clients and Servers
|
||||
*
|
||||
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
|
||||
* Version 1.2, Revision 8
|
||||
* February 27, 2017
|
||||
@ -1622,6 +1624,8 @@ typedef struct acpi_table_tcpa_server
|
||||
* TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
|
||||
* Version 4
|
||||
*
|
||||
* TCG Hardware Interface Table for TPM 2.0 Clients and Servers
|
||||
*
|
||||
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
|
||||
* Version 1.2, Revision 8
|
||||
* February 27, 2017
|
||||
@ -1643,17 +1647,25 @@ typedef struct acpi_table_tpm2
|
||||
/* Values for StartMethod above */
|
||||
|
||||
#define ACPI_TPM2_NOT_ALLOWED 0
|
||||
#define ACPI_TPM2_RESERVED1 1
|
||||
#define ACPI_TPM2_START_METHOD 2
|
||||
#define ACPI_TPM2_RESERVED3 3
|
||||
#define ACPI_TPM2_RESERVED4 4
|
||||
#define ACPI_TPM2_RESERVED5 5
|
||||
#define ACPI_TPM2_MEMORY_MAPPED 6
|
||||
#define ACPI_TPM2_COMMAND_BUFFER 7
|
||||
#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8
|
||||
#define ACPI_TPM2_RESERVED9 9
|
||||
#define ACPI_TPM2_RESERVED10 10
|
||||
#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */
|
||||
#define ACPI_TPM2_RESERVED 12
|
||||
|
||||
|
||||
/* Trailer appears after any StartMethod subtables */
|
||||
/* Optional trailer appears after any StartMethod subtables */
|
||||
|
||||
typedef struct acpi_tpm2_trailer
|
||||
{
|
||||
UINT8 MethodParameters[12];
|
||||
UINT32 MinimumLogLength; /* Minimum length for the event log area */
|
||||
UINT64 LogAddress; /* Address of the event log area */
|
||||
|
||||
|
@ -586,6 +586,8 @@ typedef void * ACPI_HANDLE; /* Actually a ptr to a N
|
||||
#define ACPI_NSEC_PER_MSEC 1000000L
|
||||
#define ACPI_NSEC_PER_SEC 1000000000L
|
||||
|
||||
#define ACPI_TIME_AFTER(a, b) ((INT64)((b) - (a)) < 0)
|
||||
|
||||
|
||||
/* Owner IDs are used to track namespace nodes for selective deletion */
|
||||
|
||||
|
@ -160,7 +160,7 @@ AbDisplayUsage (
|
||||
|
||||
|
||||
#define AB_UTILITY_NAME "ACPI Binary Table Dump Utility"
|
||||
#define AB_SUPPORTED_OPTIONS "a:c:d:h:o:s:tv"
|
||||
#define AB_SUPPORTED_OPTIONS "a:c:d:h:o:s:tv^"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -192,6 +192,7 @@ AbDisplayUsage (
|
||||
ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
|
||||
ACPI_OPTION ("-t", "Terse mode");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
}
|
||||
|
||||
|
||||
@ -292,7 +293,23 @@ main (
|
||||
|
||||
case 'v': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
return (0);
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case '^': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
return (1);
|
||||
|
||||
case 'd':
|
||||
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (1);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
@ -199,7 +199,7 @@ UINT32 CurrentAction = 0;
|
||||
|
||||
|
||||
#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
|
||||
#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz"
|
||||
#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:sv^xz"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -223,6 +223,7 @@ ApDisplayUsage (
|
||||
ACPI_OPTION ("-r <Address>", "Dump tables from specified RSDP");
|
||||
ACPI_OPTION ("-s", "Print table summaries only");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
ACPI_OPTION ("-z", "Verbose mode");
|
||||
|
||||
ACPI_USAGE_TEXT ("\nTable Options:\n");
|
||||
@ -369,10 +370,27 @@ ApDoOptions (
|
||||
}
|
||||
continue;
|
||||
|
||||
case 'v': /* Revision/version */
|
||||
case 'v': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
AcpiOsPrintf (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
|
||||
return (1);
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case '^': /* -v: (Version) */
|
||||
|
||||
fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
|
||||
return (1);
|
||||
|
||||
case 'd':
|
||||
|
||||
fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (1);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'z': /* Verbose mode */
|
||||
|
||||
|
@ -190,6 +190,7 @@ typedef struct ae_debug_regions
|
||||
|
||||
|
||||
extern BOOLEAN AcpiGbl_IgnoreErrors;
|
||||
extern BOOLEAN AcpiGbl_AbortLoopOnTimeout;
|
||||
extern UINT8 AcpiGbl_RegionFillValue;
|
||||
extern UINT8 AcpiGbl_UseHwReducedFadt;
|
||||
extern BOOLEAN AcpiGbl_DisplayRegionAccess;
|
||||
|
@ -196,13 +196,22 @@ AeExceptionHandler (
|
||||
Exception = AcpiFormatException (AmlStatus);
|
||||
AcpiOsPrintf (AE_PREFIX
|
||||
"Exception %s during execution\n", Exception);
|
||||
|
||||
if (Name)
|
||||
{
|
||||
AcpiOsPrintf (AE_PREFIX
|
||||
"Evaluating Method or Node: [%4.4s]",
|
||||
"Evaluating Method or Node: [%4.4s]\n",
|
||||
(char *) &Name);
|
||||
}
|
||||
|
||||
/* Be terse about loop timeouts */
|
||||
|
||||
if ((AmlStatus == AE_AML_LOOP_TIMEOUT) && AcpiGbl_AbortLoopOnTimeout)
|
||||
{
|
||||
AcpiOsPrintf (AE_PREFIX "Aborting loop after timeout\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\n" AE_PREFIX
|
||||
"AML Opcode [%s], Method Offset ~%5.5X\n",
|
||||
AcpiPsGetOpcodeName (Opcode), AmlOffset);
|
||||
|
@ -715,6 +715,7 @@ AeMiscellaneousTests (
|
||||
ACPI_HANDLE Handle;
|
||||
|
||||
#if (!ACPI_REDUCED_HARDWARE)
|
||||
UINT32 Temp;
|
||||
UINT32 LockHandle1;
|
||||
UINT32 LockHandle2;
|
||||
ACPI_VENDOR_UUID Uuid =
|
||||
@ -973,5 +974,17 @@ AeMiscellaneousTests (
|
||||
Status = AcpiReleaseGlobalLock (LockHandle2);
|
||||
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
|
||||
|
||||
/* Test timer interfaces */
|
||||
|
||||
Status = AcpiGetTimerResolution (&Temp);
|
||||
ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
|
||||
|
||||
Status = AcpiGetTimer (&Temp);
|
||||
ACPI_CHECK_OK (AcpiGetTimer, Status);
|
||||
|
||||
Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
|
||||
ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
|
||||
|
||||
|
||||
#endif /* !ACPI_REDUCED_HARDWARE */
|
||||
}
|
||||
|
@ -189,6 +189,7 @@ AeDoOptions (
|
||||
|
||||
UINT8 AcpiGbl_RegionFillValue = 0;
|
||||
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
|
||||
BOOLEAN AcpiGbl_AbortLoopOnTimeout = FALSE;
|
||||
BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
|
||||
UINT8 AcpiGbl_UseHwReducedFadt = FALSE;
|
||||
BOOLEAN AcpiGbl_DoInterfaceTests = FALSE;
|
||||
@ -196,11 +197,9 @@ BOOLEAN AcpiGbl_LoadTestTables = FALSE;
|
||||
BOOLEAN AcpiGbl_AeLoadOnly = FALSE;
|
||||
static UINT8 AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP;
|
||||
static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buffer */
|
||||
static char AeBuildDate[] = __DATE__;
|
||||
static char AeBuildTime[] = __TIME__;
|
||||
|
||||
#define ACPIEXEC_NAME "AML Execution/Debug Utility"
|
||||
#define AE_SUPPORTED_OPTIONS "?b:d:e:f^ghi:lm^rv^:x:"
|
||||
#define AE_SUPPORTED_OPTIONS "?b:d:e:f^ghlm^rt^v^:x:"
|
||||
|
||||
|
||||
/* Stubs for the disassembler */
|
||||
@ -270,9 +269,12 @@ usage (
|
||||
ACPI_OPTION ("-fv <Value>", "Operation Region initialization fill value");
|
||||
printf ("\n");
|
||||
|
||||
ACPI_OPTION ("-i <Count>", "Maximum iterations for AML while loops");
|
||||
ACPI_OPTION ("-l", "Load tables and namespace only");
|
||||
ACPI_OPTION ("-r", "Use hardware-reduced FADT V5");
|
||||
ACPI_OPTION ("-te", "Exit loop on timeout instead of aborting method");
|
||||
ACPI_OPTION ("-to <Seconds>", "Set timeout period for AML while loops");
|
||||
printf ("\n");
|
||||
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
ACPI_OPTION ("-vi", "Verbose initialization output");
|
||||
@ -461,20 +463,6 @@ AeDoOptions (
|
||||
usage();
|
||||
return (1);
|
||||
|
||||
case 'i':
|
||||
|
||||
Temp = strtoul (AcpiGbl_Optarg, NULL, 0);
|
||||
if (!Temp || (Temp > ACPI_UINT16_MAX))
|
||||
{
|
||||
printf ("%s: Invalid max loops value\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
AcpiGbl_MaxLoopIterations = (UINT16) Temp;
|
||||
printf ("Max Loop Iterations is %u (0x%X)\n",
|
||||
AcpiGbl_MaxLoopIterations, AcpiGbl_MaxLoopIterations);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
|
||||
AcpiGbl_AeLoadOnly = TRUE;
|
||||
@ -503,6 +491,42 @@ AeDoOptions (
|
||||
printf ("Using ACPI 5.0 Hardware Reduced Mode via version 5 FADT\n");
|
||||
break;
|
||||
|
||||
case 't':
|
||||
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case 'o': /* -to: Set loop timeout in seconds */
|
||||
|
||||
if (AcpiGetoptArgument (argc, argv))
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
Temp = strtoul (AcpiGbl_Optarg, NULL, 0);
|
||||
if (!Temp || (Temp > ACPI_UINT16_MAX))
|
||||
{
|
||||
printf ("%s: Invalid loop timeout value\n",
|
||||
AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
AcpiGbl_MaxLoopIterations = (UINT16) Temp;
|
||||
printf ("Automatic loop timeout after %u seconds\n",
|
||||
AcpiGbl_MaxLoopIterations);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
|
||||
AcpiGbl_AbortLoopOnTimeout = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
@ -514,7 +538,7 @@ AeDoOptions (
|
||||
|
||||
case 'd':
|
||||
|
||||
printf ("Build date/time: %s %s\n", AeBuildDate, AeBuildTime);
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (1);
|
||||
|
||||
case 'i':
|
||||
@ -598,6 +622,10 @@ main (
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/* Use a shorter timeout value for acpiexec */
|
||||
|
||||
AcpiGbl_MaxLoopIterations = 1;
|
||||
|
||||
/* Initialize the AML debugger */
|
||||
|
||||
Status = AcpiInitializeDebugger ();
|
||||
|
@ -160,7 +160,7 @@ AhDisplayUsage (
|
||||
void);
|
||||
|
||||
#define AH_UTILITY_NAME "ACPI Help Utility"
|
||||
#define AH_SUPPORTED_OPTIONS "adeghikmopstuv"
|
||||
#define AH_SUPPORTED_OPTIONS "adeghikmopstuv^"
|
||||
|
||||
|
||||
#if defined ACPI_OPTION
|
||||
@ -187,6 +187,7 @@ AhDisplayUsage (
|
||||
ACPI_USAGE_HEADER ("acpihelp <options> [Name/Prefix | HexValue]");
|
||||
ACPI_OPTION ("-h", "Display help");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
|
||||
ACPI_USAGE_TEXT ("\nAML Names and Encodings (ACPI Machine Language):\n");
|
||||
ACPI_OPTION ("-a [Name/Prefix | *]", "Display both ASL operator and AML opcode name(s)");
|
||||
@ -310,7 +311,23 @@ main (
|
||||
|
||||
case 'v': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
return (0);
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case '^': /* -v: (Version) */
|
||||
|
||||
return (1);
|
||||
|
||||
case 'd':
|
||||
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (1);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
|
@ -179,7 +179,7 @@ BOOLEAN AcpiGbl_NsLoadOnly = FALSE;
|
||||
|
||||
|
||||
#define AN_UTILITY_NAME "ACPI Namespace Dump Utility"
|
||||
#define AN_SUPPORTED_OPTIONS "?hlvx:"
|
||||
#define AN_SUPPORTED_OPTIONS "?hlv^x:"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -203,6 +203,7 @@ usage (
|
||||
ACPI_OPTION ("-?", "Display this message");
|
||||
ACPI_OPTION ("-l", "Load namespace only, no display");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
ACPI_OPTION ("-x <DebugLevel>", "Debug output level");
|
||||
}
|
||||
|
||||
@ -259,9 +260,25 @@ main (
|
||||
AcpiGbl_NsLoadOnly = TRUE;
|
||||
break;
|
||||
|
||||
case 'v': /* -v: (Version): signon already emitted, just exit */
|
||||
case 'v':
|
||||
|
||||
return (0);
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case '^': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
exit (0);
|
||||
|
||||
case 'd':
|
||||
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (0);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
|
||||
|
@ -374,6 +374,7 @@ AsDisplayUsage (
|
||||
ACPI_OPTION ("-s", "Generate source statistics only");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vb", "Verbose mode");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
ACPI_OPTION ("-y", "Suppress file overwrite prompts");
|
||||
}
|
||||
|
||||
@ -478,6 +479,11 @@ main (
|
||||
Gbl_VerboseMode = TRUE;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (0);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
|
@ -663,12 +663,14 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
|
||||
{"ACPI_TABLE_MSDM", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_NFIT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_PCCT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_PDTT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_PPTT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_RSDP", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_RSDT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_MCHI", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_S3PT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_SBST", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_SDEV", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_SLIC", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_SLIT", SRC_TYPE_STRUCT},
|
||||
{"ACPI_TABLE_SPCR", SRC_TYPE_STRUCT},
|
||||
@ -806,13 +808,18 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
|
||||
{"ACPI_PCCT_EXT_PCC_SLAVE", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PCCT_SHARED_MEMORY", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PCCT_SUBSPACE", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PPTT_PROCESSOR", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PDTT_CHANNEL", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PPTT_CACHE", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PPTT_ID", SRC_TYPE_STRUCT},
|
||||
{"ACPI_PPTT_PROCESSOR", SRC_TYPE_STRUCT},
|
||||
{"ACPI_RSDP_COMMON", SRC_TYPE_STRUCT},
|
||||
{"ACPI_RSDP_EXTENSION", SRC_TYPE_STRUCT},
|
||||
{"ACPI_S3PT_RESUME", SRC_TYPE_STRUCT},
|
||||
{"ACPI_S3PT_SUSPEND", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SDEV_HEADER", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SDEV_NAMESPACE", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SDEV_PCIE", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SDEV_PCIE_PATH", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SRAT_CPU_AFFINITY", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SRAT_HEADER", SRC_TYPE_STRUCT},
|
||||
{"ACPI_SRAT_GIC_ITS_AFFINITY", SRC_TYPE_STRUCT},
|
||||
|
@ -1,6 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: acpixtract - convert ascii ACPI tables to binary
|
||||
* Module Name: acpixtract - Top level functions to convert ascii/hex
|
||||
* ACPI tables to the original binary tables
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -152,13 +153,6 @@
|
||||
#include "acpixtract.h"
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static BOOLEAN
|
||||
AxIsFileAscii (
|
||||
FILE *Handle);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxExtractTables
|
||||
@ -217,14 +211,14 @@ AxExtractTables (
|
||||
/* Are there enough instances of the table to continue? */
|
||||
|
||||
AxNormalizeSignature (UpperSignature);
|
||||
|
||||
Instances = AxCountTableInstances (InputPathname, UpperSignature);
|
||||
|
||||
if (Instances < MinimumInstances)
|
||||
{
|
||||
printf ("Table [%s] was not found in %s\n",
|
||||
UpperSignature, InputPathname);
|
||||
fclose (InputFile);
|
||||
return (-1);
|
||||
return (0); /* Don't abort */
|
||||
}
|
||||
|
||||
if (Instances == 0)
|
||||
@ -238,6 +232,28 @@ AxExtractTables (
|
||||
|
||||
while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
|
||||
{
|
||||
/*
|
||||
* Check up front if we have a header line of the form:
|
||||
* DSDT @ 0xdfffd0c0 (10999 bytes)
|
||||
*/
|
||||
if (AX_IS_TABLE_BLOCK_HEADER &&
|
||||
(State == AX_STATE_EXTRACT_DATA))
|
||||
{
|
||||
/* End of previous table, start of new table */
|
||||
|
||||
if (ThisTableBytesWritten)
|
||||
{
|
||||
printf (AX_TABLE_INFO_FORMAT, ThisSignature, ThisTableBytesWritten,
|
||||
ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl_TableCount--;
|
||||
}
|
||||
|
||||
State = AX_STATE_FIND_HEADER;
|
||||
}
|
||||
|
||||
switch (State)
|
||||
{
|
||||
case AX_STATE_FIND_HEADER:
|
||||
@ -301,10 +317,15 @@ AxExtractTables (
|
||||
|
||||
case AX_STATE_EXTRACT_DATA:
|
||||
|
||||
if (!AxIsHexDataLine ())
|
||||
{
|
||||
continue; /* Toss any lines that are not raw hex data */
|
||||
}
|
||||
|
||||
/* Empty line or non-data line terminates the data block */
|
||||
|
||||
BytesConverted = AxProcessOneTextLine (
|
||||
OutputFile, ThisSignature, ThisTableBytesWritten);
|
||||
BytesConverted = AxConvertAndWrite (OutputFile, ThisSignature,
|
||||
ThisTableBytesWritten);
|
||||
switch (BytesConverted)
|
||||
{
|
||||
case 0:
|
||||
@ -341,14 +362,8 @@ AxExtractTables (
|
||||
{
|
||||
/* Received an input file EOF while extracting data */
|
||||
|
||||
printf (AX_TABLE_INFO_FORMAT,
|
||||
ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
}
|
||||
|
||||
if (Gbl_TableCount > 1)
|
||||
{
|
||||
printf ("\n%u binary ACPI tables extracted\n",
|
||||
Gbl_TableCount);
|
||||
printf (AX_TABLE_INFO_FORMAT, ThisSignature, ThisTableBytesWritten,
|
||||
ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
}
|
||||
|
||||
if (OutputFile)
|
||||
@ -385,7 +400,7 @@ AxExtractToMultiAmlFile (
|
||||
int Status = 0;
|
||||
unsigned int TotalBytesWritten = 0;
|
||||
unsigned int ThisTableBytesWritten = 0;
|
||||
unsigned int BytesConverted;
|
||||
unsigned int BytesConverted;
|
||||
char ThisSignature[4];
|
||||
unsigned int State = AX_STATE_FIND_HEADER;
|
||||
|
||||
@ -421,6 +436,28 @@ AxExtractToMultiAmlFile (
|
||||
|
||||
while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
|
||||
{
|
||||
/*
|
||||
* Check up front if we have a header line of the form:
|
||||
* DSDT @ 0xdfffd0c0 (10999 bytes)
|
||||
*/
|
||||
if (AX_IS_TABLE_BLOCK_HEADER &&
|
||||
(State == AX_STATE_EXTRACT_DATA))
|
||||
{
|
||||
/* End of previous table, start of new table */
|
||||
|
||||
if (ThisTableBytesWritten)
|
||||
{
|
||||
printf (AX_TABLE_INFO_FORMAT, ThisSignature, ThisTableBytesWritten,
|
||||
ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl_TableCount--;
|
||||
}
|
||||
|
||||
State = AX_STATE_FIND_HEADER;
|
||||
}
|
||||
|
||||
switch (State)
|
||||
{
|
||||
case AX_STATE_FIND_HEADER:
|
||||
@ -451,9 +488,14 @@ AxExtractToMultiAmlFile (
|
||||
|
||||
case AX_STATE_EXTRACT_DATA:
|
||||
|
||||
if (!AxIsHexDataLine ())
|
||||
{
|
||||
continue; /* Toss any lines that are not raw hex data */
|
||||
}
|
||||
|
||||
/* Empty line or non-data line terminates the data block */
|
||||
|
||||
BytesConverted = AxProcessOneTextLine (
|
||||
BytesConverted = AxConvertAndWrite (
|
||||
OutputFile, ThisSignature, ThisTableBytesWritten);
|
||||
switch (BytesConverted)
|
||||
{
|
||||
@ -487,8 +529,8 @@ AxExtractToMultiAmlFile (
|
||||
{
|
||||
/* Received an input file EOF or error while writing data */
|
||||
|
||||
printf (AX_TABLE_INFO_FORMAT,
|
||||
ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
printf (AX_TABLE_INFO_FORMAT, ThisSignature, ThisTableBytesWritten,
|
||||
ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
}
|
||||
|
||||
printf ("\n%u binary ACPI tables extracted and written to %s (%u bytes)\n",
|
||||
@ -502,7 +544,7 @@ AxExtractToMultiAmlFile (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxListTables
|
||||
* FUNCTION: AxListAllTables
|
||||
*
|
||||
* PARAMETERS: InputPathname - Filename for acpidump file
|
||||
*
|
||||
@ -514,13 +556,13 @@ AxExtractToMultiAmlFile (
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AxListTables (
|
||||
AxListAllTables (
|
||||
char *InputPathname)
|
||||
{
|
||||
FILE *InputFile;
|
||||
size_t HeaderSize;
|
||||
unsigned char Header[48];
|
||||
ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header;
|
||||
UINT32 ByteCount = 0;
|
||||
unsigned int State = AX_STATE_FIND_HEADER;
|
||||
|
||||
|
||||
/* Open input in text mode, output is in binary mode */
|
||||
@ -538,133 +580,74 @@ AxListTables (
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Dump the headers for all tables found in the input file */
|
||||
/* Info header */
|
||||
|
||||
printf ("\nSignature Length Revision OemId OemTableId"
|
||||
" OemRevision CompilerId CompilerRevision\n\n");
|
||||
printf ("\n Signature Length Version Oem Oem "
|
||||
"Oem Compiler Compiler\n");
|
||||
printf ( " Id TableId "
|
||||
"RevisionId Name Revision\n");
|
||||
printf ( " _________ __________ ____ ________ __________ "
|
||||
"__________ _______ __________\n\n");
|
||||
|
||||
/* Dump the headers for all tables found in the input file */
|
||||
|
||||
while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
|
||||
{
|
||||
/* Ignore empty lines and lines that start with a space */
|
||||
/* Ignore empty lines */
|
||||
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer) ||
|
||||
(Gbl_LineBuffer[0] == ' '))
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get the 36 byte header and display the fields */
|
||||
|
||||
HeaderSize = AxGetTableHeader (InputFile, Header);
|
||||
if (HeaderSize < 16)
|
||||
/*
|
||||
* Check up front if we have a header line of the form:
|
||||
* DSDT @ 0xdfffd0c0 (10999 bytes)
|
||||
*/
|
||||
if (AX_IS_TABLE_BLOCK_HEADER &&
|
||||
(State == AX_STATE_EXTRACT_DATA))
|
||||
{
|
||||
continue;
|
||||
State = AX_STATE_FIND_HEADER;
|
||||
}
|
||||
|
||||
/* RSDP has an oddball signature and header */
|
||||
|
||||
if (!strncmp (TableHeader->Signature, "RSD PTR ", 8))
|
||||
switch (State)
|
||||
{
|
||||
AxCheckAscii ((char *) &Header[9], 6);
|
||||
printf ("%7.4s \"%6.6s\"\n", "RSDP",
|
||||
&Header[9]);
|
||||
Gbl_TableCount++;
|
||||
case AX_STATE_FIND_HEADER:
|
||||
|
||||
ByteCount = 0;
|
||||
if (!AxIsDataBlockHeader ())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
State = AX_STATE_EXTRACT_DATA;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Minimum size for table with standard header */
|
||||
case AX_STATE_EXTRACT_DATA:
|
||||
|
||||
if (HeaderSize < sizeof (ACPI_TABLE_HEADER))
|
||||
{
|
||||
/* Ignore any lines that don't look like a data line */
|
||||
|
||||
if (!AxIsHexDataLine ())
|
||||
{
|
||||
continue; /* Toss any lines that are not raw hex data */
|
||||
}
|
||||
|
||||
/* Convert header to hex and display it */
|
||||
|
||||
ByteCount += AxConvertToBinary (Gbl_LineBuffer, &Header[ByteCount]);
|
||||
if (ByteCount >= sizeof (ACPI_TABLE_HEADER))
|
||||
{
|
||||
AxDumpTableHeader (Header);
|
||||
State = AX_STATE_FIND_HEADER;
|
||||
}
|
||||
continue;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!AcpiUtValidNameseg (TableHeader->Signature))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Signature and Table length */
|
||||
|
||||
Gbl_TableCount++;
|
||||
printf ("%7.4s 0x%8.8X", TableHeader->Signature,
|
||||
TableHeader->Length);
|
||||
|
||||
/* FACS has only signature and length */
|
||||
|
||||
if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS"))
|
||||
{
|
||||
printf ("\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* OEM IDs and Compiler IDs */
|
||||
|
||||
AxCheckAscii (TableHeader->OemId, 6);
|
||||
AxCheckAscii (TableHeader->OemTableId, 8);
|
||||
AxCheckAscii (TableHeader->AslCompilerId, 4);
|
||||
|
||||
printf (
|
||||
" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X"
|
||||
" \"%4.4s\" 0x%8.8X\n",
|
||||
TableHeader->Revision, TableHeader->OemId,
|
||||
TableHeader->OemTableId, TableHeader->OemRevision,
|
||||
TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);
|
||||
}
|
||||
|
||||
printf ("\nFound %u ACPI tables in %s\n", Gbl_TableCount, InputPathname);
|
||||
fclose (InputFile);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsFileAscii
|
||||
*
|
||||
* PARAMETERS: Handle - To open input file
|
||||
*
|
||||
* RETURN: TRUE if file is entirely ASCII and printable
|
||||
*
|
||||
* DESCRIPTION: Verify that the input file is entirely ASCII.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static BOOLEAN
|
||||
AxIsFileAscii (
|
||||
FILE *Handle)
|
||||
{
|
||||
UINT8 Byte;
|
||||
|
||||
|
||||
/* Read the entire file */
|
||||
|
||||
while (fread (&Byte, 1, 1, Handle) == 1)
|
||||
{
|
||||
/* Check for an ASCII character */
|
||||
|
||||
if (!ACPI_IS_ASCII (Byte))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/* Ensure character is either printable or a "space" char */
|
||||
|
||||
else if (!isprint (Byte) && !isspace (Byte))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
}
|
||||
|
||||
/* File is OK (100% ASCII) */
|
||||
|
||||
fseek (Handle, 0, SEEK_SET);
|
||||
return (TRUE);
|
||||
|
||||
ErrorExit:
|
||||
|
||||
printf ("File is binary (contains non-text or non-ascii characters)\n");
|
||||
fseek (Handle, 0, SEEK_SET);
|
||||
return (FALSE);
|
||||
|
||||
}
|
||||
|
@ -180,9 +180,9 @@
|
||||
#define AX_REQUIRED_TABLE 1
|
||||
|
||||
#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility"
|
||||
#define AX_SUPPORTED_OPTIONS "ahlms:v"
|
||||
#define AX_SUPPORTED_OPTIONS "ahlms:v^"
|
||||
#define AX_MULTI_TABLE_FILENAME "amltables.dat"
|
||||
#define AX_TABLE_INFO_FORMAT "Acpi table [%4.4s] - %7u bytes written to %s\n"
|
||||
#define AX_TABLE_INFO_FORMAT " %4.4s - %7u bytes written (0x%8.8X) - %s\n"
|
||||
|
||||
/* Extraction states */
|
||||
|
||||
@ -193,6 +193,8 @@
|
||||
|
||||
#define AX_LINE_BUFFER_SIZE 256
|
||||
#define AX_MIN_BLOCK_HEADER_LENGTH 6 /* strlen ("DSDT @") */
|
||||
#define AX_IS_TABLE_BLOCK_HEADER strstr (Gbl_LineBuffer, " @ ")
|
||||
#define AX_END_OF_HEX_DATA 55
|
||||
|
||||
|
||||
typedef struct AxTableInfo
|
||||
@ -210,12 +212,12 @@ typedef struct AxTableInfo
|
||||
ACPI_GLOBAL (char, Gbl_LineBuffer[AX_LINE_BUFFER_SIZE]);
|
||||
ACPI_GLOBAL (char, Gbl_HeaderBuffer[AX_LINE_BUFFER_SIZE]);
|
||||
ACPI_GLOBAL (char, Gbl_InstanceBuffer[AX_LINE_BUFFER_SIZE]);
|
||||
|
||||
ACPI_GLOBAL (AX_TABLE_INFO, *Gbl_TableListHead);
|
||||
ACPI_GLOBAL (char, Gbl_OutputFilename[32]);
|
||||
ACPI_GLOBAL (unsigned char, Gbl_BinaryData[16]);
|
||||
ACPI_GLOBAL (unsigned int, Gbl_TableCount);
|
||||
|
||||
|
||||
/*
|
||||
* acpixtract.c
|
||||
*/
|
||||
@ -230,18 +232,13 @@ AxExtractToMultiAmlFile (
|
||||
char *InputPathname);
|
||||
|
||||
int
|
||||
AxListTables (
|
||||
AxListAllTables (
|
||||
char *InputPathname);
|
||||
|
||||
|
||||
/*
|
||||
* axutils.c
|
||||
*/
|
||||
size_t
|
||||
AxGetTableHeader (
|
||||
FILE *InputFile,
|
||||
unsigned char *OutputData);
|
||||
|
||||
unsigned int
|
||||
AxCountTableInstances (
|
||||
char *InputPathname,
|
||||
@ -261,21 +258,33 @@ AxCheckAscii (
|
||||
char *Name,
|
||||
int Count);
|
||||
|
||||
int
|
||||
BOOLEAN
|
||||
AxIsFileAscii (
|
||||
FILE *Handle);
|
||||
|
||||
BOOLEAN
|
||||
AxIsHexDataLine (
|
||||
void);
|
||||
|
||||
BOOLEAN
|
||||
AxIsEmptyLine (
|
||||
char *Buffer);
|
||||
|
||||
int
|
||||
BOOLEAN
|
||||
AxIsDataBlockHeader (
|
||||
void);
|
||||
|
||||
long
|
||||
AxProcessOneTextLine (
|
||||
AxConvertAndWrite (
|
||||
FILE *OutputFile,
|
||||
char *ThisSignature,
|
||||
unsigned int ThisTableBytesWritten);
|
||||
|
||||
size_t
|
||||
AxConvertLine (
|
||||
AxConvertToBinary (
|
||||
char *InputLine,
|
||||
unsigned char *OutputData);
|
||||
|
||||
void
|
||||
AxDumpTableHeader (
|
||||
unsigned char *Header);
|
||||
|
@ -180,6 +180,7 @@ DisplayUsage (
|
||||
ACPI_OPTION ("-m", "Extract multiple DSDT/SSDTs to a single file");
|
||||
ACPI_OPTION ("-s <signature>", "Extract all tables with <signature>");
|
||||
ACPI_OPTION ("-v", "Display version information");
|
||||
ACPI_OPTION ("-vd", "Display build date and time");
|
||||
|
||||
ACPI_USAGE_TEXT ("\nExtract binary ACPI tables from text acpidump output\n");
|
||||
ACPI_USAGE_TEXT ("Default invocation extracts the DSDT and all SSDTs\n");
|
||||
@ -243,9 +244,25 @@ main (
|
||||
AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */
|
||||
break;
|
||||
|
||||
case 'v': /* -v: (Version): signon already emitted, just exit */
|
||||
case 'v':
|
||||
|
||||
return (0);
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case '^': /* -v: (Version): signon already emitted, just exit */
|
||||
|
||||
exit (0);
|
||||
|
||||
case 'd':
|
||||
|
||||
printf (ACPI_COMMON_BUILD_TIME);
|
||||
return (0);
|
||||
|
||||
default:
|
||||
|
||||
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
@ -279,7 +296,7 @@ main (
|
||||
|
||||
case AX_LIST_ALL:
|
||||
|
||||
Status = AxListTables (Filename);
|
||||
Status = AxListAllTables (Filename);
|
||||
break;
|
||||
|
||||
case AX_EXTRACT_SIGNATURE:
|
||||
|
@ -184,6 +184,70 @@ AxCheckAscii (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsFileAscii
|
||||
*
|
||||
* PARAMETERS: Handle - To open input file
|
||||
*
|
||||
* RETURN: TRUE if file is entirely ASCII and printable
|
||||
*
|
||||
* DESCRIPTION: Verify that the input file is entirely ASCII.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AxIsFileAscii (
|
||||
FILE *Handle)
|
||||
{
|
||||
UINT8 Byte;
|
||||
|
||||
|
||||
/* Read the entire file */
|
||||
|
||||
fseek (Handle, 0, SEEK_SET);
|
||||
while (fread (&Byte, 1, 1, Handle) == 1)
|
||||
{
|
||||
/*
|
||||
* Ignore null characters. Some acpidump-type utilities insert
|
||||
* a few of these, probably a bug in the utility. As long as these
|
||||
* characters are in lines that are tossed (non-data), they
|
||||
* won't cause a problem.
|
||||
*/
|
||||
if (!Byte)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check for an ASCII character */
|
||||
|
||||
if (!ACPI_IS_ASCII (Byte))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/* Ensure character is either printable or a "space" char */
|
||||
|
||||
else if (!isprint (Byte) && !isspace (Byte))
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
}
|
||||
|
||||
/* File is OK (100% ASCII) */
|
||||
|
||||
fseek (Handle, 0, SEEK_SET);
|
||||
return (TRUE);
|
||||
|
||||
ErrorExit:
|
||||
|
||||
printf ("File appears to be binary "
|
||||
"(contains non-text or non-ascii characters)\n");
|
||||
fseek (Handle, 0, SEEK_SET);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsEmptyLine
|
||||
@ -196,7 +260,7 @@ AxCheckAscii (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
BOOLEAN
|
||||
AxIsEmptyLine (
|
||||
char *Buffer)
|
||||
{
|
||||
@ -219,6 +283,96 @@ AxIsEmptyLine (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsHexDataLine
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status. 1 if the table header is valid, 0 otherwise.
|
||||
*
|
||||
* DESCRIPTION: Check for a valid line of hex data of the form:
|
||||
*
|
||||
* 00a0: 0c 00 00 00 03 00 00 00 43 48 41 35 0c 00 00 00 ........CHA5....
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AxIsHexDataLine (
|
||||
void)
|
||||
{
|
||||
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer) ||
|
||||
(Gbl_LineBuffer[0] != ' '))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!strstr (Gbl_LineBuffer, ": "))
|
||||
{
|
||||
/* Not valid data line */
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsDataBlockHeader
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status. 1 if the table header is valid, 0 otherwise.
|
||||
*
|
||||
* DESCRIPTION: Check if the ACPI table identifier in the input acpidump text
|
||||
* file is valid (of the form: <sig> @ <addr>).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AxIsDataBlockHeader (
|
||||
void)
|
||||
{
|
||||
|
||||
/* Ignore lines that are too short to be header lines */
|
||||
|
||||
if (strlen (Gbl_LineBuffer) < AX_MIN_BLOCK_HEADER_LENGTH)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Ignore empty lines and lines that start with a space */
|
||||
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer) ||
|
||||
(Gbl_LineBuffer[0] == ' '))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ignore lines that are not headers of the form <sig> @ <addr>.
|
||||
* Basically, just look for the '@' symbol, surrounded by spaces.
|
||||
*
|
||||
* Examples of headers that must be supported:
|
||||
*
|
||||
* DSDT @ 0x737e4000
|
||||
* XSDT @ 0x737f2fff
|
||||
* RSD PTR @ 0xf6cd0
|
||||
* SSDT @ (nil)
|
||||
*/
|
||||
if (!AX_IS_TABLE_BLOCK_HEADER)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
AxNormalizeSignature (Gbl_LineBuffer);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxNormalizeSignature
|
||||
@ -245,7 +399,7 @@ AxNormalizeSignature (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxConvertLine
|
||||
* FUNCTION: AxConvertToBinary
|
||||
*
|
||||
* PARAMETERS: InputLine - One line from the input acpidump file
|
||||
* OutputData - Where the converted data is returned
|
||||
@ -254,27 +408,30 @@ AxNormalizeSignature (
|
||||
*
|
||||
* DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes)
|
||||
*
|
||||
* NOTE: Assumes the input data line has been validated to be of the form:
|
||||
*
|
||||
* 0010: 48 53 57 55 4c 54 2d 52 01 00 00 00 49 4e 54 4c HSWULT-R....INTL
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
size_t
|
||||
AxConvertLine (
|
||||
AxConvertToBinary (
|
||||
char *InputLine,
|
||||
unsigned char *OutputData)
|
||||
{
|
||||
char *End;
|
||||
int BytesConverted;
|
||||
int Converted[16];
|
||||
int i;
|
||||
|
||||
|
||||
/* Terminate the input line at the end of the actual data (for sscanf) */
|
||||
|
||||
End = strstr (InputLine + 2, " ");
|
||||
if (!End)
|
||||
{
|
||||
return (0); /* Don't understand the format */
|
||||
}
|
||||
*End = 0;
|
||||
/*
|
||||
* Terminate input line immediately after the data. Otherwise, the
|
||||
* second line below will not scan correctly.
|
||||
*
|
||||
* 00b0: 03 00 00 00 43 48 41 36 0c 00 00 00 03 00 00 00 ....CHA6........
|
||||
* 00c0: 43 48 41 37 CHA7
|
||||
*/
|
||||
InputLine [AX_END_OF_HEX_DATA] = 0;
|
||||
|
||||
/*
|
||||
* Convert one line of table data, of the form:
|
||||
@ -284,7 +441,7 @@ AxConvertLine (
|
||||
* 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........
|
||||
*/
|
||||
BytesConverted = sscanf (InputLine,
|
||||
"%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
|
||||
"%*s %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X",
|
||||
&Converted[0], &Converted[1], &Converted[2], &Converted[3],
|
||||
&Converted[4], &Converted[5], &Converted[6], &Converted[7],
|
||||
&Converted[8], &Converted[9], &Converted[10], &Converted[11],
|
||||
@ -301,52 +458,6 @@ AxConvertLine (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxGetTableHeader
|
||||
*
|
||||
* PARAMETERS: InputFile - Handle for the input acpidump file
|
||||
* OutputData - Where the table header is returned
|
||||
*
|
||||
* RETURN: The actual number of bytes converted
|
||||
*
|
||||
* DESCRIPTION: Extract and convert an ACPI table header
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
size_t
|
||||
AxGetTableHeader (
|
||||
FILE *InputFile,
|
||||
unsigned char *OutputData)
|
||||
{
|
||||
size_t BytesConverted;
|
||||
size_t TotalConverted = 0;
|
||||
int i;
|
||||
|
||||
|
||||
/* Get the full 36 byte ACPI table header, requires 3 input text lines */
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (!fgets (Gbl_HeaderBuffer, AX_LINE_BUFFER_SIZE, InputFile))
|
||||
{
|
||||
return (TotalConverted);
|
||||
}
|
||||
|
||||
BytesConverted = AxConvertLine (Gbl_HeaderBuffer, OutputData);
|
||||
TotalConverted += BytesConverted;
|
||||
OutputData += 16;
|
||||
|
||||
if (BytesConverted != 16)
|
||||
{
|
||||
return (TotalConverted);
|
||||
}
|
||||
}
|
||||
|
||||
return (TotalConverted);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxCountTableInstances
|
||||
@ -467,61 +578,7 @@ AxGetNextInstance (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxIsDataBlockHeader
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status. 1 if the table header is valid, 0 otherwise.
|
||||
*
|
||||
* DESCRIPTION: Check if the ACPI table identifier in the input acpidump text
|
||||
* file is valid (of the form: <sig> @ <addr>).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AxIsDataBlockHeader (
|
||||
void)
|
||||
{
|
||||
|
||||
/* Ignore lines that are too short to be header lines */
|
||||
|
||||
if (strlen (Gbl_LineBuffer) < AX_MIN_BLOCK_HEADER_LENGTH)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Ignore empty lines and lines that start with a space */
|
||||
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer) ||
|
||||
(Gbl_LineBuffer[0] == ' '))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ignore lines that are not headers of the form <sig> @ <addr>.
|
||||
* Basically, just look for the '@' symbol, surrounded by spaces.
|
||||
*
|
||||
* Examples of headers that must be supported:
|
||||
*
|
||||
* DSDT @ 0x737e4000
|
||||
* XSDT @ 0x737f2fff
|
||||
* RSD PTR @ 0xf6cd0
|
||||
* SSDT @ (nil)
|
||||
*/
|
||||
if (!strstr (Gbl_LineBuffer, " @ "))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
AxNormalizeSignature (Gbl_LineBuffer);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxProcessOneTextLine
|
||||
* FUNCTION: AxConvertAndWrite
|
||||
*
|
||||
* PARAMETERS: OutputFile - Where to write the binary data
|
||||
* ThisSignature - Signature of current ACPI table
|
||||
@ -532,10 +589,14 @@ AxIsDataBlockHeader (
|
||||
* DESCRIPTION: Convert one line of input hex ascii text to binary, and write
|
||||
* the binary data to the table output file.
|
||||
*
|
||||
* NOTE: Assumes the input data line has been validated to be of the form:
|
||||
*
|
||||
* 0010: 48 53 57 55 4c 54 2d 52 01 00 00 00 49 4e 54 4c HSWULT-R....INTL
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
long
|
||||
AxProcessOneTextLine (
|
||||
AxConvertAndWrite (
|
||||
FILE *OutputFile,
|
||||
char *ThisSignature,
|
||||
unsigned int ThisTableBytesWritten)
|
||||
@ -544,22 +605,17 @@ AxProcessOneTextLine (
|
||||
size_t BytesConverted;
|
||||
|
||||
|
||||
/* Check for the end of this table data block */
|
||||
|
||||
if (AxIsEmptyLine (Gbl_LineBuffer) ||
|
||||
(Gbl_LineBuffer[0] != ' '))
|
||||
{
|
||||
printf (AX_TABLE_INFO_FORMAT,
|
||||
ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Convert one line of ascii hex data to binary */
|
||||
|
||||
BytesConverted = AxConvertLine (Gbl_LineBuffer, Gbl_BinaryData);
|
||||
BytesConverted = AxConvertToBinary (Gbl_LineBuffer, Gbl_BinaryData);
|
||||
|
||||
/* Write the binary data */
|
||||
|
||||
if (!BytesConverted)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
BytesWritten = fwrite (Gbl_BinaryData, 1, BytesConverted, OutputFile);
|
||||
if (BytesWritten != BytesConverted)
|
||||
{
|
||||
@ -569,3 +625,107 @@ AxProcessOneTextLine (
|
||||
|
||||
return (BytesWritten);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AxDumpTableHeader
|
||||
*
|
||||
* PARAMETERS: Header - A binary ACPI table header
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Display the contents of a standard ACPI table header
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AxDumpTableHeader (
|
||||
unsigned char *Header)
|
||||
{
|
||||
ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header;
|
||||
ACPI_TABLE_RSDP *Rsdp = (ACPI_TABLE_RSDP *) (void *) Header;
|
||||
ACPI_TABLE_FACS *Facs = (ACPI_TABLE_FACS *) (void *) Header;
|
||||
|
||||
|
||||
/* RSDP has an oddball signature and header */
|
||||
|
||||
if (!strncmp (TableHeader->Signature, "RSD PTR ", 8))
|
||||
{
|
||||
AxCheckAscii ((char *) &Header[9], 6);
|
||||
|
||||
Gbl_TableCount++;
|
||||
printf (" %.2u) %5.4s 0x%8.8X 0x%2.2X \"%6.6s\"\n",
|
||||
Gbl_TableCount, "RSDP", Rsdp->Length, Rsdp->Revision, Rsdp->OemId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AcpiUtValidNameseg (TableHeader->Signature))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Signature and Table length */
|
||||
|
||||
Gbl_TableCount++;
|
||||
printf (" %.2u) %5.4s 0x%8.8X", Gbl_TableCount, TableHeader->Signature,
|
||||
TableHeader->Length);
|
||||
|
||||
/* FACS has only signature and length */
|
||||
|
||||
if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS"))
|
||||
{
|
||||
printf (" 0x%2.2X\n", Facs->Version);
|
||||
return;
|
||||
}
|
||||
|
||||
/* OEM IDs and Compiler IDs */
|
||||
|
||||
AxCheckAscii (TableHeader->OemId, 6);
|
||||
AxCheckAscii (TableHeader->OemTableId, 8);
|
||||
AxCheckAscii (TableHeader->AslCompilerId, 4);
|
||||
|
||||
printf (
|
||||
" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X"
|
||||
" \"%4.4s\" 0x%8.8X\n",
|
||||
TableHeader->Revision, TableHeader->OemId,
|
||||
TableHeader->OemTableId, TableHeader->OemRevision,
|
||||
TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _AX_FUTURE_ENHANCEMENTS
|
||||
|
||||
/* Possible enhancement to validate table lengths */
|
||||
|
||||
void
|
||||
AxCheckTableLengths (
|
||||
UINT32 ByteCount,
|
||||
UINT32 AmlByteCount)
|
||||
{
|
||||
|
||||
if (AmlByteCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ByteCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ByteCount < sizeof (ACPI_TABLE_HEADER)) &&
|
||||
(ByteCount >= ACPI_NAME_SIZE))
|
||||
{
|
||||
printf (" : (Table too short for an ACPI table)");
|
||||
}
|
||||
|
||||
else if (ByteCount != AmlByteCount)
|
||||
{
|
||||
printf (" : (Hex data length mismatch with AML length 0x%X)",
|
||||
AmlByteCount);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user