Merge ACPICA 20120816.

This commit is contained in:
Jung-uk Kim 2012-08-16 20:54:52 +00:00
commit 1df130f1d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239340
51 changed files with 2203 additions and 683 deletions

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 4, 2012
.Dd August 16, 2012
.Dt ACPI 4
.Os
.Sh NAME
@ -219,14 +219,6 @@ Override any automatic quirks completely.
Beep the PC speaker on resume.
This can help diagnose suspend/resume problems.
Default is 0 (disabled).
.It Va debug.acpi.sleep_flags
Execute optional ACPI methods for suspend/resume.
If the bit 0 is set (1), it will try to execute _GTS (Going To Sleep) method
when entering suspend state.
If the bit 1 is set (2), it will try to execute _BFS (Back From Sleep) method
when leaving suspend state.
If both the bits are set (3), both the methods will be tried.
Default is 0 (disabled).
.It Va hint.acpi.0.disabled
Set this to 1 to disable all of ACPI.
If ACPI has been disabled on your system due to a blacklist entry for your

View File

@ -436,6 +436,7 @@ contrib/dev/acpica/components/utilities/utresrc.c optional acpi
contrib/dev/acpica/components/utilities/utstate.c optional acpi
contrib/dev/acpica/components/utilities/utxface.c optional acpi
contrib/dev/acpica/components/utilities/utxferror.c optional acpi
contrib/dev/acpica/components/utilities/utxfinit.c optional acpi
#contrib/dev/acpica/components/utilities/utxfmutex.c optional acpi
contrib/ipfilter/netinet/fil.c optional ipfilter inet \
compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter"

View File

@ -18,18 +18,20 @@ fulldirs="common compiler components include os_specific"
# files to remove
stripdirs="generate libraries tests tools"
stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \
acos2.h accygwin.h acefi.h acwin.h acwin64.h osunixdir.c \
oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"
stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \
aclinux.h acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h \
new_table.txt osunixdir.c oswindir.c oswintbl.c oswinxf.c \
readme.txt utclib.c"
# include files to canonify
src_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h \
acdispat.h acevents.h acexcep.h acglobal.h achware.h acinterp.h \
aclocal.h acmacros.h acnames.h acnamesp.h acobject.h acopcode.h \
acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h \
acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h \
actbl2.h actbl3.h actypes.h acutils.h amlcode.h amlresrc.h \
platform/acenv.h platform/acfreebsd.h platform/acgcc.h"
src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \
acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h achware.h \
acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h acobject.h \
acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h \
acpredef.h acresrc.h acrestyp.h acstruct.h actables.h actbl.h \
actbl1.h actbl2.h actbl3.h actypes.h acutils.h amlcode.h \
amlresrc.h platform/acenv.h platform/acfreebsd.h \
platform/acgcc.h"
comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"
platform_headers="acfreebsd.h acgcc.h"

View File

@ -1,3 +1,96 @@
----------------------------------------
16 August 2012. Summary of changes for version 20120816:
This release is available at https://www.acpica.org/downloads
The ACPI 5.0 specification is available at www.acpi.info
1) ACPICA Kernel-resident Subsystem:
Removed all use of the deprecated _GTS and _BFS predefined methods. The _GTS
(Going To Sleep) and _BFS (Back From Sleep) methods are essentially
deprecated and will probably be removed from the ACPI specification. Windows
does not invoke them, and reportedly never will. The final nail in the coffin
is that the ACPI specification states that these methods must be run with
interrupts off, which is not going to happen in a kernel interpreter. Note:
Linux has removed all use of the methods also. It was discovered that
invoking these functions caused failures on some machines, probably because
they were never tested since Windows does not call them. Affects two external
interfaces, AcpiEnterSleepState and AcpiLeaveSleepStatePrep. Tang Feng.
ACPICA BZ 969.
Implemented support for complex bit-packed buffers returned from the _PLD
(Physical Location of Device) predefined method. Adds a new external
interface, AcpiDecodePldBuffer that parses the buffer into a more usable C
structure. Note: C Bitfields cannot be used for this type of predefined
structure since the memory layout of individual bitfields is not defined by
the C language. In addition, there are endian concerns where a compiler will
change the bitfield ordering based on the machine type. The new ACPICA
interface eliminates these issues, and should be called after _PLD is
executed. ACPICA BZ 954.
Implemented a change to allow a scope change to root (via "Scope (\)") during
execution of module-level ASL code (code that is executed at table load
time.) Lin Ming.
Added the Windows8/Server2012 string for the _OSI method. This change adds a
new _OSI string, "Windows 2012" for both Windows 8 and Windows Server 2012.
Added header support for the new ACPI tables DBG2 (Debug Port Table Type 2)
and CSRT (Core System Resource Table).
Added struct header support for the _FDE, _GRT, _GTM, and _SRT predefined
names. This simplifies access to the buffers returned by these predefined
names. Adds a new file, include/acbuffer.h. ACPICA BZ 956.
GPE support: Removed an extraneous parameter from the various low-level
internal GPE functions. Tang Feng.
Removed the linux makefiles from the unix packages. The generate/linux
makefiles are obsolete and have been removed from the unix tarball release
packages. The replacement makefiles are under generate/unix, and there is a
top-level makefile under the main acpica directory. ACPICA BZ 967, 912.
Updates for Unix makefiles:
1) Add -D_FORTIFY_SOURCE=2 for gcc generation. Arjan van de Ven.
2) Update linker flags (move to end of command line) for AcpiExec utility.
Guan Chao.
Split ACPICA initialization functions to new file, utxfinit.c. Split from
utxface.c to improve modularity and reduce file size.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and has a
much larger code and data size.
Previous Release:
Non-Debug Version: 93.5K Code, 25.3K Data, 118.8K Total
Debug Version: 173.7K Code, 74.0K Data, 247.7K Total
Current Release:
Non-Debug Version: 93.8K Code, 25.3K Data, 119.1K Total
Debug Version: 175.7K Code, 74.8K Data, 250.5K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Fixed a problem with constant folding for fixed-length constant
expressions. The constant-folding code was not being invoked for constant
expressions that allow the use of type 3/4/5 opcodes to generate constants
for expressions such as ByteConstExpr, WordConstExpr, etc. This could result
in the generation of invalid AML bytecode. ACPICA BZ 970.
iASL: Fixed a generation issue on newer versions of Bison. Newer versions
apparently automatically emit some of the necessary externals. This change
handles these versions in order to eliminate generation warnings.
Disassembler: Added support to decode the DBG2 and CSRT ACPI tables.
Disassembler: Add support to decode _PLD buffers. The decoded buffer appears
within comments in the output file.
Debugger: Fixed a regression with the "Threads" command where
AE_BAD_PARAMETER was always returned.
----------------------------------------
11 July 2012. Summary of changes for version 20120711:

View File

@ -60,9 +60,13 @@
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adisasm")
/*
* Older versions of Bison won't emit this external in the generated header.
* Newer versions do emit the external, so we don't need to do it.
*/
#ifndef ASLCOMPILER_ASLCOMPILERPARSE_H
extern int AslCompilerdebug;
#endif
ACPI_STATUS
LsDisplayNamespace (

View File

@ -198,7 +198,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_PIC", "Interrupt Model", "Inform AML of the interrupt model in use"),
AH_PREDEF ("_PIF", "Power Source Information", "Returns a Power Source information block"),
AH_PREDEF ("_PIN", "Pin List", "Pin list, Resource Descriptor field"),
AH_PREDEF ("_PLD", "Physical Device Location", "Returns a device's physical location information"),
AH_PREDEF ("_PLD", "Physical Location of Device", "Returns a device's physical location information"),
AH_PREDEF ("_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"),
AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"),
AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"),

View File

@ -277,22 +277,24 @@ static const char *AcpiDmGasAccessWidth[] =
ACPI_DMTABLE_DATA AcpiDmTableData[] =
{
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
{ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, NULL, NULL, "Core System Resource Table"},
{ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"},
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table"},
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"},
{ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"},
{ACPI_SIG_GTDT, AcpiDmTableInfoGtdt, NULL, NULL, TemplateGtdt, "Generic Timer Description Table"},
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"},
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
{ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},

View File

@ -52,11 +52,79 @@
ACPI_MODULE_NAME ("dmtbdump")
/* Local prototypes */
static void
AcpiDmValidateFadtLength (
UINT32 Revision,
UINT32 Length);
static void
AcpiDmDumpBuffer (
void *Table,
UINT32 BufferOffset,
UINT32 Length,
UINT32 AbsoluteOffset,
char *Header);
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpBuffer
*
* PARAMETERS: Table - ACPI Table or subtable
* BufferOffset - Offset of buffer from Table above
* Length - Length of the buffer
* AbsoluteOffset - Offset of buffer in the main ACPI table
* Header - Name of the buffer field (printed on the
* first line only.)
*
* RETURN: None
*
* DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
* disassembler output format.)
*
******************************************************************************/
static void
AcpiDmDumpBuffer (
void *Table,
UINT32 BufferOffset,
UINT32 Length,
UINT32 AbsoluteOffset,
char *Header)
{
UINT8 *Buffer;
UINT32 i;
if (!Length)
{
return;
}
Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
i = 0;
while (i < Length)
{
if (!(i % 16))
{
AcpiOsPrintf ("\n");
AcpiDmLineHeader (AbsoluteOffset,
((Length - i) > 16) ? 16 : (Length - i), Header);
Header = NULL;
}
AcpiOsPrintf ("%.02X ", *Buffer);
i++;
Buffer++;
AbsoluteOffset++;
}
AcpiOsPrintf ("\n");
}
/*******************************************************************************
*
@ -527,6 +595,208 @@ AcpiDmDumpCpep (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpCsrt
*
* PARAMETERS: Table - A CSRT table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a CSRT. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpCsrt (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_CSRT_GROUP *SubTable;
ACPI_CSRT_DESCRIPTOR *SubSubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
UINT32 SubOffset;
UINT32 SubSubOffset;
UINT32 InfoLength;
/* The main table only contains the ACPI header, thus already handled */
/* Sub-tables (Resource Groups) */
SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoCsrt0);
if (ACPI_FAILURE (Status))
{
return;
}
SubOffset = sizeof (ACPI_CSRT_GROUP);
/* Shared resource group info buffer */
AcpiDmDumpBuffer (SubTable, SubOffset, SubTable->InfoLength,
Offset+SubOffset, "Shared Data");
SubOffset += SubTable->InfoLength;
/* Sub-Sub-tables (Resource Descriptors) */
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
Offset + SubOffset);
while ((SubOffset < SubTable->Length) &&
((Offset + SubOffset) < Table->Length))
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
SubSubTable->Length, AcpiDmTableInfoCsrt1);
if (ACPI_FAILURE (Status))
{
return;
}
SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
/* Resource-specific info buffer */
InfoLength = SubSubTable->Length - SubSubOffset;
AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength,
Offset + SubOffset + SubSubOffset, "ResourceInfo");
SubSubOffset += InfoLength;
/* Point to next sub-sub-table */
SubOffset += SubSubTable->Length;
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
SubSubTable->Length);
}
/* Point to next sub-table */
Offset += SubTable->Length;
SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
SubTable->Length);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpDbg2
*
* PARAMETERS: Table - A DBG2 table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a DBG2. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpDbg2 (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_DBG2_DEVICE *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
UINT32 i;
UINT32 ArrayOffset;
UINT32 AbsoluteOffset;
UINT8 *Array;
/* Main table */
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoDbg2Device);
if (ACPI_FAILURE (Status))
{
return;
}
/* Dump the BaseAddress array */
for (i = 0; i < SubTable->RegisterCount; i++)
{
ArrayOffset = SubTable->BaseAddressOffset +
(sizeof (ACPI_GENERIC_ADDRESS) * i);
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) SubTable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
SubTable->Length, AcpiDmTableInfoDbg2Addr);
if (ACPI_FAILURE (Status))
{
return;
}
}
/* Dump the AddressSize array */
for (i = 0; i < SubTable->RegisterCount; i++)
{
ArrayOffset = SubTable->AddressSizeOffset +
(sizeof (UINT32) * i);
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) SubTable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
SubTable->Length, AcpiDmTableInfoDbg2Size);
if (ACPI_FAILURE (Status))
{
return;
}
}
/* Dump the Namestring (required) */
AcpiOsPrintf ("\n");
ArrayOffset = SubTable->NamepathOffset;
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) SubTable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
SubTable->Length, AcpiDmTableInfoDbg2Name);
if (ACPI_FAILURE (Status))
{
return;
}
/* Dump the OemData (optional) */
AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength,
Offset + SubTable->OemDataOffset, "OEM Data");
/* Point to next sub-table */
Offset += SubTable->Length;
SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
SubTable->Length);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpDmar
@ -540,6 +810,7 @@ AcpiDmDumpCpep (
*
******************************************************************************/
void
AcpiDmDumpDmar (
ACPI_TABLE_HEADER *Table)

View File

@ -86,6 +86,7 @@
#define ACPI_BGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BGRT,f)
#define ACPI_BOOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BOOT,f)
#define ACPI_CPEP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CPEP,f)
#define ACPI_DBG2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBG2,f)
#define ACPI_DBGP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBGP,f)
#define ACPI_DMAR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DMAR,f)
#define ACPI_DRTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DRTM,f)
@ -126,6 +127,9 @@
#define ACPI_ASF3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f)
#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
#define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
#define ACPI_CSRT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f)
#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f)
#define ACPI_DBG20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DBG2_DEVICE,f)
#define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
#define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
#define ACPI_DMAR1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f)
@ -639,6 +643,94 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
};
/*******************************************************************************
*
* CSRT - Core System Resource Table
*
******************************************************************************/
/* Main table consists only of the standard ACPI table header */
/* Resource Group subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] =
{
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (VendorId), "Vendor ID", 0},
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SubvendorId), "Subvendor ID", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (DeviceId), "Device ID", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (SubdeviceId), "Subdevice ID", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Revision), "Revision", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (InfoLength), "InfoLength", 0},
ACPI_DMT_TERMINATOR
};
/* Resource Descriptor subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] =
{
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Type), "Type", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Subtype), "Subtype", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Uid), "UID", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* DBG2 - Debug Port Table 2
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[] =
{
{ACPI_DMT_UINT32, ACPI_DBG2_OFFSET (InfoOffset), "Info Offset", 0},
{ACPI_DMT_UINT32, ACPI_DBG2_OFFSET (InfoCount), "Info Count", 0},
ACPI_DMT_TERMINATOR
};
/* Debug Device Information Subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[] =
{
{ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (Revision), "Revision", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (RegisterCount), "Register Count", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathLength), "Namepath Length", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathOffset), "Namepath Offset", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataLength), "OEM Data Length", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataOffset), "OEM Data Offset", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortType), "Port Type", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortSubtype), "Port Subtype", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (BaseAddressOffset), "Base Address Offset", 0},
{ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (AddressSizeOffset), "Address Size Offset", 0},
ACPI_DMT_TERMINATOR
};
/* Variable-length data for the subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[] =
{
{ACPI_DMT_GAS, 0, "Base Address Register", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[] =
{
{ACPI_DMT_UINT32, 0, "Address Size", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[] =
{
{ACPI_DMT_STRING, 0, "Namepath", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* DBGP - Debug Port

View File

@ -593,6 +593,11 @@ TrSetNodeFlags (
ACPI_PARSE_OBJECT *Op,
UINT32 Flags);
ACPI_PARSE_OBJECT *
TrSetNodeAmlLength (
ACPI_PARSE_OBJECT *Op,
UINT32 Length);
ACPI_PARSE_OBJECT *
TrLinkPeerNodes (
UINT32 NumPeers,

View File

@ -560,7 +560,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> SwitchTerm
%type <n> UnloadTerm
%type <n> WhileTerm
//%type <n> CaseTermList
/* %type <n> CaseTermList */
/* Type 2 opcodes */
@ -2507,30 +2507,38 @@ ConstExprTerm
| PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
;
/*
* The NODE_COMPILE_TIME_CONST flag in the following constant expressions
* enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
* to simple integers. It is an error if these types of expressions cannot be
* reduced, since the AML grammar for ****ConstExpr requires a simple constant.
* Note: The required byte length of the constant is passed through to the
* constant folding code in the node AmlLength field.
*/
ByteConstExpr
: Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
| Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
: Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
| ByteConst {}
;
WordConstExpr
: Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
| Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
: Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
| WordConst {}
;
DWordConstExpr
: Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
| Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
: Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
| DWordConst {}
;
QWordConstExpr
: Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
| Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
: Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
| QWordConst {}
;
@ -2839,10 +2847,10 @@ ExtendedSpaceTerm
FixedDmaTerm
: PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);}
WordConstExpr // 04: DMA RequestLines
',' WordConstExpr // 06: DMA Channels
OptionalXferSize // 07: DMA TransferSize
OptionalNameString // 08: DescriptorName
WordConstExpr /* 04: DMA RequestLines */
',' WordConstExpr /* 06: DMA Channels */
OptionalXferSize /* 07: DMA TransferSize */
OptionalNameString /* 08: DescriptorName */
')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);}
| PARSEOP_FIXEDDMA '('
error ')' {$$ = AslDoError(); yyclearin;}
@ -2860,16 +2868,16 @@ FixedIOTerm
GpioIntTerm
: PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);}
InterruptTypeKeyword // 04: InterruptType
',' InterruptLevel // 06: InterruptLevel
OptionalShareType // 07: SharedType
',' PinConfigByte // 09: PinConfig
OptionalWordConstExpr // 10: DebounceTimeout
',' StringData // 12: ResourceSource
OptionalByteConstExpr // 13: ResourceSourceIndex
OptionalResourceType // 14: ResourceType
OptionalNameString // 15: DescriptorName
OptionalBuffer_Last // 16: VendorData
InterruptTypeKeyword /* 04: InterruptType */
',' InterruptLevel /* 06: InterruptLevel */
OptionalShareType /* 07: SharedType */
',' PinConfigByte /* 09: PinConfig */
OptionalWordConstExpr /* 10: DebounceTimeout */
',' StringData /* 12: ResourceSource */
OptionalByteConstExpr /* 13: ResourceSourceIndex */
OptionalResourceType /* 14: ResourceType */
OptionalNameString /* 15: DescriptorName */
OptionalBuffer_Last /* 16: VendorData */
')' '{'
DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);}
| PARSEOP_GPIO_INT '('
@ -2878,16 +2886,16 @@ GpioIntTerm
GpioIoTerm
: PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);}
OptionalShareType_First // 04: SharedType
',' PinConfigByte // 06: PinConfig
OptionalWordConstExpr // 07: DebounceTimeout
OptionalWordConstExpr // 08: DriveStrength
OptionalIoRestriction // 09: IoRestriction
',' StringData // 11: ResourceSource
OptionalByteConstExpr // 12: ResourceSourceIndex
OptionalResourceType // 13: ResourceType
OptionalNameString // 14: DescriptorName
OptionalBuffer_Last // 15: VendorData
OptionalShareType_First /* 04: SharedType */
',' PinConfigByte /* 06: PinConfig */
OptionalWordConstExpr /* 07: DebounceTimeout */
OptionalWordConstExpr /* 08: DriveStrength */
OptionalIoRestriction /* 09: IoRestriction */
',' StringData /* 11: ResourceSource */
OptionalByteConstExpr /* 12: ResourceSourceIndex */
OptionalResourceType /* 13: ResourceType */
OptionalNameString /* 14: DescriptorName */
OptionalBuffer_Last /* 15: VendorData */
')' '{'
DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);}
| PARSEOP_GPIO_IO '('
@ -2896,15 +2904,15 @@ GpioIoTerm
I2cSerialBusTerm
: PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);}
WordConstExpr // 04: SlaveAddress
OptionalSlaveMode // 05: SlaveMode
',' DWordConstExpr // 07: ConnectionSpeed
OptionalAddressingMode // 08: AddressingMode
',' StringData // 10: ResourceSource
OptionalByteConstExpr // 11: ResourceSourceIndex
OptionalResourceType // 12: ResourceType
OptionalNameString // 13: DescriptorName
OptionalBuffer_Last // 14: VendorData
WordConstExpr /* 04: SlaveAddress */
OptionalSlaveMode /* 05: SlaveMode */
',' DWordConstExpr /* 07: ConnectionSpeed */
OptionalAddressingMode /* 08: AddressingMode */
',' StringData /* 10: ResourceSource */
OptionalByteConstExpr /* 11: ResourceSourceIndex */
OptionalResourceType /* 12: ResourceType */
OptionalNameString /* 13: DescriptorName */
OptionalBuffer_Last /* 14: VendorData */
')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);}
| PARSEOP_I2C_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
@ -3077,19 +3085,19 @@ RegisterTerm
SpiSerialBusTerm
: PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);}
WordConstExpr // 04: DeviceSelection
OptionalDevicePolarity // 05: DevicePolarity
OptionalWireMode // 06: WireMode
',' ByteConstExpr // 08: DataBitLength
OptionalSlaveMode // 09: SlaveMode
',' DWordConstExpr // 11: ConnectionSpeed
',' ClockPolarityKeyword // 13: ClockPolarity
',' ClockPhaseKeyword // 15: ClockPhase
',' StringData // 17: ResourceSource
OptionalByteConstExpr // 18: ResourceSourceIndex
OptionalResourceType // 19: ResourceType
OptionalNameString // 20: DescriptorName
OptionalBuffer_Last // 21: VendorData
WordConstExpr /* 04: DeviceSelection */
OptionalDevicePolarity /* 05: DevicePolarity */
OptionalWireMode /* 06: WireMode */
',' ByteConstExpr /* 08: DataBitLength */
OptionalSlaveMode /* 09: SlaveMode */
',' DWordConstExpr /* 11: ConnectionSpeed */
',' ClockPolarityKeyword /* 13: ClockPolarity */
',' ClockPhaseKeyword /* 15: ClockPhase */
',' StringData /* 17: ResourceSource */
OptionalByteConstExpr /* 18: ResourceSourceIndex */
OptionalResourceType /* 19: ResourceType */
OptionalNameString /* 20: DescriptorName */
OptionalBuffer_Last /* 21: VendorData */
')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);}
| PARSEOP_SPI_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
@ -3115,20 +3123,20 @@ StartDependentFnTerm
UartSerialBusTerm
: PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);}
DWordConstExpr // 04: ConnectionSpeed
OptionalBitsPerByte // 05: BitsPerByte
OptionalStopBits // 06: StopBits
',' ByteConstExpr // 08: LinesInUse
OptionalEndian // 09: Endianess
OptionalParityType // 10: Parity
OptionalFlowControl // 11: FlowControl
',' WordConstExpr // 13: Rx BufferSize
',' WordConstExpr // 15: Tx BufferSize
',' StringData // 17: ResourceSource
OptionalByteConstExpr // 18: ResourceSourceIndex
OptionalResourceType // 19: ResourceType
OptionalNameString // 20: DescriptorName
OptionalBuffer_Last // 21: VendorData
DWordConstExpr /* 04: ConnectionSpeed */
OptionalBitsPerByte /* 05: BitsPerByte */
OptionalStopBits /* 06: StopBits */
',' ByteConstExpr /* 08: LinesInUse */
OptionalEndian /* 09: Endianess */
OptionalParityType /* 10: Parity */
OptionalFlowControl /* 11: FlowControl */
',' WordConstExpr /* 13: Rx BufferSize */
',' WordConstExpr /* 15: Tx BufferSize */
',' StringData /* 17: ResourceSource */
OptionalByteConstExpr /* 18: ResourceSourceIndex */
OptionalResourceType /* 19: ResourceType */
OptionalNameString /* 20: DescriptorName */
OptionalBuffer_Last /* 21: VendorData */
')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);}
| PARSEOP_UART_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}

View File

@ -73,6 +73,11 @@ OpcAmlCheckForConstant (
UINT32 Level,
void *Context);
static void
OpcUpdateIntegerNode (
ACPI_PARSE_OBJECT *Op,
UINT64 Value);
/*******************************************************************************
*
@ -214,14 +219,14 @@ OpcAmlCheckForConstant (
{
/*
* We are looking at at normal expression to see if it can be
* reduced. It can't. No error
* reduced. It can't. No error
*/
return (AE_TYPE);
}
/*
* This is an expression that MUST reduce to a constant, and it
* can't be reduced. This is an error
* can't be reduced. This is an error
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
@ -319,17 +324,17 @@ OpcAmlConstantWalk (
return AE_NO_MEMORY;
}
WalkState->NextOp = NULL;
WalkState->Params = NULL;
WalkState->CallerReturnDesc = &ObjDesc;
WalkState->WalkType = WalkType;
WalkState->NextOp = NULL;
WalkState->Params = NULL;
WalkState->WalkType = WalkType;
WalkState->CallerReturnDesc = &ObjDesc;
/*
* Examine the entire subtree -- all nodes must be constants
* or type 3/4/5 opcodes
*/
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
OpcAmlCheckForConstant, NULL, WalkState);
OpcAmlCheckForConstant, NULL, WalkState);
/*
* Did we find an entire subtree that contains all constants and type 3/4/5
@ -369,7 +374,7 @@ OpcAmlConstantWalk (
/* Hand off the subtree to the AML interpreter */
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE,
OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
Op->Common.Parent = OriginalParentOp;
/* TBD: we really *should* release the RootOp node */
@ -382,22 +387,26 @@ OpcAmlConstantWalk (
Status = AcpiDsResultPop (&ObjDesc, WalkState);
}
/* Check for error from the ACPICA core */
if (ACPI_FAILURE (Status))
{
AslCoreSubsystemError (Op, Status,
"Failure during constant evaluation", FALSE);
}
}
if (ACPI_FAILURE (Status))
{
/* We could not resolve the subtree for some reason */
AslCoreSubsystemError (Op, Status,
"Failure during constant evaluation", FALSE);
AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op,
Op->Asl.ParseOpName);
/* Set the subtree value to ZERO anyway. Eliminates further errors */
/* Set the subtree value to ZERO anyway. Eliminates further errors */
Op->Asl.ParseOpcode = PARSEOP_INTEGER;
Op->Common.Value.Integer = 0;
OpcSetOptimalIntegerSize (Op);
OpcUpdateIntegerNode (Op, 0);
}
else
{
@ -412,21 +421,20 @@ OpcAmlConstantWalk (
{
case ACPI_TYPE_INTEGER:
Op->Asl.ParseOpcode = PARSEOP_INTEGER;
Op->Common.Value.Integer = ObjDesc->Integer.Value;
OpcSetOptimalIntegerSize (Op);
OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value);
DbgPrint (ASL_PARSE_OUTPUT,
"Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
"Constant expression reduced to (%s) %8.8X%8.8X\n",
Op->Asl.ParseOpName,
ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
break;
case ACPI_TYPE_STRING:
Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Op->Common.AmlOpcode = AML_STRING_OP;
Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Op->Common.AmlOpcode = AML_STRING_OP;
Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
DbgPrint (ASL_PARSE_OUTPUT,
@ -438,18 +446,18 @@ OpcAmlConstantWalk (
case ACPI_TYPE_BUFFER:
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
Op->Asl.CompileFlags = NODE_AML_PACKAGE;
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
Op->Asl.CompileFlags = NODE_AML_PACKAGE;
UtSetParseOpName (Op);
/* Child node is the buffer length */
RootOp = TrAllocateNode (PARSEOP_INTEGER);
RootOp->Asl.AmlOpcode = AML_DWORD_OP;
RootOp->Asl.AmlOpcode = AML_DWORD_OP;
RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
RootOp->Asl.Parent = Op;
RootOp->Asl.Parent = Op;
(void) OpcSetOptimalIntegerSize (RootOp);
@ -460,10 +468,10 @@ OpcAmlConstantWalk (
/* Peer to the child is the raw buffer data */
RootOp = TrAllocateNode (PARSEOP_RAW_DATA);
RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
RootOp->Asl.Parent = Op->Asl.Parent;
RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
RootOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = RootOp;
Op = RootOp;
@ -476,7 +484,7 @@ OpcAmlConstantWalk (
default:
printf ("Unsupported return type: %s\n",
AcpiUtGetObjectTypeName (ObjDesc));
AcpiUtGetObjectTypeName (ObjDesc));
break;
}
}
@ -485,7 +493,62 @@ OpcAmlConstantWalk (
Op->Asl.Child = NULL;
AcpiDsDeleteWalkState (WalkState);
return (AE_CTRL_DEPTH);
}
/*******************************************************************************
*
* FUNCTION: OpcUpdateIntegerNode
*
* PARAMETERS: Op - Current parse object
*
* RETURN: None
*
* DESCRIPTION: Update node to the correct integer type.
*
******************************************************************************/
static void
OpcUpdateIntegerNode (
ACPI_PARSE_OBJECT *Op,
UINT64 Value)
{
Op->Common.Value.Integer = Value;
/*
* The AmlLength is used by the parser to indicate a constant,
* (if non-zero). Length is either (1/2/4/8)
*/
switch (Op->Asl.AmlLength)
{
case 1:
TrUpdateNode (PARSEOP_BYTECONST, Op);
Op->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
break;
case 2:
TrUpdateNode (PARSEOP_WORDCONST, Op);
Op->Asl.AmlOpcode = AML_RAW_DATA_WORD;
break;
case 4:
TrUpdateNode (PARSEOP_DWORDCONST, Op);
Op->Asl.AmlOpcode = AML_RAW_DATA_DWORD;
break;
case 8:
TrUpdateNode (PARSEOP_QWORDCONST, Op);
Op->Asl.AmlOpcode = AML_RAW_DATA_QWORD;
break;
case 0:
default:
OpcSetOptimalIntegerSize (Op);
TrUpdateNode (PARSEOP_INTEGER, Op);
break;
}
Op->Asl.AmlLength = 0;
}

View File

@ -197,6 +197,7 @@ typedef enum
ASL_MSG_UPPER_CASE,
ASL_MSG_VENDOR_LIST,
ASL_MSG_WRITE,
ASL_MSG_RANGE,
/* These messages are used by the Preprocessor only */
@ -371,6 +372,7 @@ char *AslMessages [] = {
/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case",
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
/* ASL_MSG_WRITE */ "Could not write file",
/* ASL_MSG_RANGE */ "Constant out of range",
/* Preprocessor */

View File

@ -68,9 +68,9 @@ TrGetNodeFlagName (
*
* PARAMETERS: None
*
* RETURN: New parse node. Aborts on allocation failure
* RETURN: New parse node. Aborts on allocation failure
*
* DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
* DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
* dynamic memory manager for performance reasons (This has a
* major impact on the speed of the compiler.)
*
@ -98,7 +98,7 @@ TrGetNextNode (
*
* PARAMETERS: ParseOpcode - Opcode to be assigned to the node
*
* RETURN: New parse node. Aborts on allocation failure
* RETURN: New parse node. Aborts on allocation failure
*
* DESCRIPTION: Allocate and initialize a new parse node for the parse tree
*
@ -133,7 +133,7 @@ TrAllocateNode (
*
* RETURN: None
*
* DESCRIPTION: "release" a node. In truth, nothing is done since the node
* DESCRIPTION: "release" a node. In truth, nothing is done since the node
* is part of a larger buffer
*
******************************************************************************/
@ -156,9 +156,9 @@ TrReleaseNode (
*
* RETURN: The updated node
*
* DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
* DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
* change an opcode to DEFAULT_ARG so that the node is ignored
* during the code generation. Also used to set generic integers
* during the code generation. Also used to set generic integers
* to a specific size (8, 16, 32, or 64 bits)
*
******************************************************************************/
@ -186,19 +186,21 @@ TrUpdateNode (
switch (ParseOpcode)
{
case PARSEOP_BYTECONST:
Op->Asl.Value.Integer = 0xFF;
Op->Asl.Value.Integer = ACPI_UINT8_MAX;
break;
case PARSEOP_WORDCONST:
Op->Asl.Value.Integer = 0xFFFF;
Op->Asl.Value.Integer = ACPI_UINT16_MAX;
break;
case PARSEOP_DWORDCONST:
Op->Asl.Value.Integer = 0xFFFFFFFF;
Op->Asl.Value.Integer = ACPI_UINT32_MAX;
break;
/* Don't need to do the QWORD case */
default:
/* Don't care about others, don't need to check QWORD */
/* Don't care about others */
break;
}
}
@ -213,15 +215,18 @@ TrUpdateNode (
switch (ParseOpcode)
{
case PARSEOP_BYTECONST:
Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
Op->Asl.Value.Integer &= ACPI_UINT8_MAX;
break;
case PARSEOP_WORDCONST:
Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
Op->Asl.Value.Integer &= ACPI_UINT16_MAX;
break;
case PARSEOP_DWORDCONST:
Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
Op->Asl.Value.Integer &= ACPI_UINT32_MAX;
break;
default:
@ -315,7 +320,7 @@ TrGetNodeFlagName (
*
* RETURN: The updated parser op
*
* DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
* DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
*
******************************************************************************/
@ -335,8 +340,41 @@ TrSetNodeFlags (
}
Op->Asl.CompileFlags |= Flags;
return (Op);
}
return Op;
/*******************************************************************************
*
* FUNCTION: TrSetNodeAmlLength
*
* PARAMETERS: Op - An existing parse node
* Length - AML Length
*
* RETURN: The updated parser op
*
* DESCRIPTION: Set the AML Length in a node. Used by the parser to indicate
* the presence of a node that must be reduced to a fixed length
* constant.
*
******************************************************************************/
ACPI_PARSE_OBJECT *
TrSetNodeAmlLength (
ACPI_PARSE_OBJECT *Op,
UINT32 Length)
{
DbgPrint (ASL_PARSE_OUTPUT,
"\nSetNodeAmlLength: Op %p, %8.8X\n", Op, Length);
if (!Op)
{
return NULL;
}
Op->Asl.AmlLength = Length;
return (Op);
}
@ -376,7 +414,7 @@ TrSetEndLineNumber (
*
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
*
* RETURN: Pointer to the new node. Aborts on allocation failure
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a simple leaf node (no children or peers, and no value
* assigned to the node)
@ -406,7 +444,7 @@ TrCreateLeafNode (
*
* PARAMETERS: ParseOpcode - The constant opcode
*
* RETURN: Pointer to the new node. Aborts on allocation failure
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) for one of the
* special constants - __LINE__, __FILE__, and __DATE__.
@ -488,7 +526,7 @@ TrCreateConstantLeafNode (
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
* Value - Value to be assigned to the node
*
* RETURN: Pointer to the new node. Aborts on allocation failure
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) with a value
* assigned to it
@ -553,9 +591,9 @@ TrCreateValuedLeafNode (
* PARAMETERS: ParseOpcode - Opcode to be assigned to the node
* NumChildren - Number of children to follow
* ... - A list of child nodes to link to the new
* node. NumChildren long.
* node. NumChildren long.
*
* RETURN: Pointer to the new node. Aborts on allocation failure
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a new parse node and link together a list of child
* nodes underneath the new node.
@ -621,7 +659,7 @@ TrCreateNode (
/*
* If child is NULL, this means that an optional argument
* was omitted. We must create a placeholder with a special
* was omitted. We must create a placeholder with a special
* opcode (DEFAULT_ARG) so that the code generator will know
* that it must emit the correct default for this argument
*/
@ -675,7 +713,7 @@ TrCreateNode (
* PARAMETERS: Op - An existing parse node
* NumChildren - Number of children to follow
* ... - A list of child nodes to link to the new
* node. NumChildren long.
* node. NumChildren long.
*
* RETURN: The updated (linked) node
*
@ -745,7 +783,7 @@ TrLinkChildren (
/*
* If child is NULL, this means that an optional argument
* was omitted. We must create a placeholder with a special
* was omitted. We must create a placeholder with a special
* opcode (DEFAULT_ARG) so that the code generator will know
* that it must emit the correct default for this argument
*/
@ -800,7 +838,7 @@ TrLinkChildren (
*
* RETURN: Op1 or the non-null node.
*
* DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
* DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
*
******************************************************************************/

View File

@ -105,34 +105,34 @@ UtAttachNameseg (
*
******************************************************************************/
#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n"
void
UtDisplaySupportedTables (
void)
{
ACPI_DMTABLE_DATA *TableData;
UINT32 i = 6;
UINT32 i;
printf ("\nACPI tables supported by iASL subsystems in "
"version %8.8X:\n"
" ASL and Data Table compilers\n"
" AML and Data Table disassemblers\n"
" ACPI table template generator\n\n", ACPI_CA_VERSION);
printf ("\nACPI tables supported by iASL version %8.8X:\n"
" (Compiler, Disassembler, Template Generator)\n\n",
ACPI_CA_VERSION);
/* Special tables */
printf ("%8u) %s %s\n", 1, ACPI_SIG_DSDT, "Differentiated System Description Table");
printf ("%8u) %s %s\n", 2, ACPI_SIG_SSDT, "Secondary System Description Table");
printf ("%8u) %s %s\n", 3, ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)");
printf ("%8u) %s %s\n", 4, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
printf ("%8u) %s %s\n", 5, ACPI_RSDP_NAME, "Root System Description Pointer");
printf (" Special tables and AML tables:\n");
printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer");
printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table");
printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table");
/* All data tables with common table header */
for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
printf ("\n Standard ACPI data tables:\n");
for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++)
{
printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Name);
i++;
printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name);
}
}
@ -591,36 +591,23 @@ UtCheckIntegerRange (
UINT32 LowValue,
UINT32 HighValue)
{
char *ParseError = NULL;
char Buffer[64];
if (!Op)
{
return NULL;
}
if (Op->Asl.Value.Integer < LowValue)
if ((Op->Asl.Value.Integer < LowValue) ||
(Op->Asl.Value.Integer > HighValue))
{
ParseError = "Value below valid range";
Op->Asl.Value.Integer = LowValue;
sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X",
(UINT32) Op->Asl.Value.Integer, LowValue, HighValue);
AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer);
return (NULL);
}
if (Op->Asl.Value.Integer > HighValue)
{
ParseError = "Value above valid range";
Op->Asl.Value.Integer = HighValue;
}
if (ParseError)
{
sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
AslCompilererror (Buffer);
return NULL;
}
return Op;
return (Op);
}

View File

@ -174,14 +174,14 @@ AcpiDbSleep (
}
AcpiOsPrintf ("**** Going to sleep ****\n");
Status = AcpiEnterSleepState (SleepState, ACPI_NO_OPTIONAL_METHODS);
Status = AcpiEnterSleepState (SleepState);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
AcpiOsPrintf ("**** Prepare to return from sleep ****\n");
Status = AcpiLeaveSleepStatePrep (SleepState, ACPI_NO_OPTIONAL_METHODS);
Status = AcpiLeaveSleepStatePrep (SleepState);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;

View File

@ -104,6 +104,15 @@ AcpiDbDeleteObjects (
ACPI_OBJECT *Objects);
static UINT8 *
AcpiDbEncodePldBuffer (
ACPI_PLD_INFO *PldInfo);
static void
AcpiDbDumpPldBuffer (
ACPI_OBJECT *ObjDesc);
/*******************************************************************************
*
* FUNCTION: AcpiDbHexCharToValue
@ -446,7 +455,6 @@ AcpiDbExecuteMethod (
ACPI_STATUS Status;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
ACPI_HANDLE Handle;
ACPI_DEVICE_INFO *ObjInfo;
UINT32 i;
@ -459,17 +467,9 @@ AcpiDbExecuteMethod (
AcpiOsPrintf ("Warning: debug output is not enabled!\n");
}
/* Get the NS node, determines existence also */
Status = AcpiGetHandle (NULL, Info->Pathname, &Handle);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Get the object info for number of method parameters */
Status = AcpiGetObjectInfo (Handle, &ObjInfo);
Status = AcpiGetObjectInfo (Info->Method, &ObjInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -718,6 +718,202 @@ AcpiDbExecutionWalk (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbEncodePldBuffer
*
* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)
*
* RETURN: Encode _PLD buffer suitable for return value from _PLD
*
* DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros
*
******************************************************************************/
static UINT8 *
AcpiDbEncodePldBuffer (
ACPI_PLD_INFO *PldInfo)
{
UINT32 *Buffer;
UINT32 Dword;
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
if (!Buffer)
{
return (NULL);
}
/* First 32 bits */
Dword = 0;
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color);
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
/* Second 32 bits */
Dword = 0;
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
/* Third 32 bits */
Dword = 0;
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
/* Fourth 32 bits */
Dword = 0;
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
if (PldInfo->Revision >= 2)
{
/* Fifth 32 bits */
Dword = 0;
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
}
return (ACPI_CAST_PTR (UINT8, Buffer));
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpPldBuffer
*
* PARAMETERS: ObjDesc - Object returned from _PLD method
*
* RETURN: None.
*
* DESCRIPTION: Dumps formatted contents of a _PLD return buffer.
*
******************************************************************************/
#define ACPI_PLD_OUTPUT "%20s : %-6X\n"
static void
AcpiDbDumpPldBuffer (
ACPI_OBJECT *ObjDesc)
{
ACPI_OBJECT *BufferDesc;
ACPI_PLD_INFO *PldInfo;
UINT8 *NewBuffer;
ACPI_STATUS Status;
/* Object must be of type Package with at least one Buffer element */
if (ObjDesc->Type != ACPI_TYPE_PACKAGE)
{
return;
}
BufferDesc = &ObjDesc->Package.Elements[0];
if (BufferDesc->Type != ACPI_TYPE_BUFFER)
{
return;
}
/* Convert _PLD buffer to local _PLD struct */
Status = AcpiDecodePldBuffer (BufferDesc->Buffer.Pointer,
BufferDesc->Buffer.Length, &PldInfo);
if (ACPI_FAILURE (Status))
{
return;
}
/* Encode local _PLD struct back to a _PLD buffer */
NewBuffer = AcpiDbEncodePldBuffer (PldInfo);
if (!NewBuffer)
{
return;
}
/* The two bit-packed buffers should match */
if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer,
BufferDesc->Buffer.Length))
{
AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n");
AcpiUtDumpBuffer2 (NewBuffer,
BufferDesc->Buffer.Length, DB_BYTE_DISPLAY);
}
/* First 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color);
/* Second 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height);
/* Third 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay);
/* Fourth 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order);
/* Fifth 32-bit dword */
if (BufferDesc->Buffer.Length > 16)
{
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset);
}
ACPI_FREE (PldInfo);
ACPI_FREE (NewBuffer);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbExecute
@ -782,6 +978,16 @@ AcpiDbExecute (
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
/* Get the NS node, determines existence also */
Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
&AcpiGbl_DbMethodInfo.Method);
if (ACPI_FAILURE (Status))
{
return;
}
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
ACPI_FREE (NameString);
}
@ -823,6 +1029,14 @@ AcpiDbExecute (
AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer,
(UINT32) ReturnObj.Length);
AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
/* Dump a _PLD buffer if present */
if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
AcpiGbl_DbMethodInfo.Method)->Name.Ascii), METHOD_NAME__PLD))
{
AcpiDbDumpPldBuffer (ReturnObj.Pointer);
}
}
else
{
@ -1067,6 +1281,17 @@ AcpiDbCreateExecutionThreads (
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
/* Get the NS node, determines existence also */
Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
&AcpiGbl_DbMethodInfo.Method);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s Could not get handle for %s\n",
AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname);
goto CleanupAndExit;
}
/* Create the threads */
AcpiOsPrintf ("Creating %X threads to execute %X times each\n",
@ -1090,6 +1315,8 @@ AcpiDbCreateExecutionThreads (
AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
CleanupAndExit:
/* Cleanup and exit */
(void) AcpiOsDeleteSemaphore (MainThreadGate);

View File

@ -64,6 +64,12 @@ static void
AcpiDmIsEisaIdElement (
ACPI_PARSE_OBJECT *Op);
static void
AcpiDmPldBuffer (
UINT32 Level,
UINT8 *ByteData,
UINT32 ByteCount);
/*******************************************************************************
*
@ -180,6 +186,12 @@ AcpiDmByteList (
AcpiDmUnicode (Op);
break;
case ACPI_DASM_PLD_METHOD:
AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
AcpiDmPldBuffer (Info->Level, ByteData, ByteCount);
break;
case ACPI_DASM_BUFFER:
default:
@ -330,6 +342,161 @@ AcpiDmIsStringBuffer (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmIsPldBuffer
*
* PARAMETERS: Op - Buffer Object to be examined
*
* RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise
*
* DESCRIPTION: Determine if a buffer Op contains a _PLD structure
*
******************************************************************************/
BOOLEAN
AcpiDmIsPldBuffer (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *ParentOp;
ParentOp = Op->Common.Parent;
if (!ParentOp)
{
return (FALSE);
}
/* Check for form: Name(_PLD, Buffer() {}). Not legal, however */
if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
{
Node = ParentOp->Common.Node;
if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
{
return (TRUE);
}
return (FALSE);
}
/* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */
if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP)
{
ParentOp = ParentOp->Common.Parent;
if (!ParentOp)
{
return (FALSE);
}
if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
{
Node = ParentOp->Common.Node;
if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
{
return (TRUE);
}
}
}
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmPldBuffer
*
* PARAMETERS: Level - Current source code indentation level
* ByteData - Pointer to the byte list
* ByteCount - Length of the byte list
*
* RETURN: None
*
* DESCRIPTION: Dump and format the contents of a _PLD buffer object
*
******************************************************************************/
#define ACPI_PLD_OUTPUT "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " "
#define ACPI_PLD_OUTPUT16 "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " "
#define ACPI_PLD_OUTPUT24 "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " "
static void
AcpiDmPldBuffer (
UINT32 Level,
UINT8 *ByteData,
UINT32 ByteCount)
{
ACPI_PLD_INFO *PldInfo;
ACPI_STATUS Status;
/* Check for valid byte count */
if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE)
{
return;
}
/* Convert _PLD buffer to local _PLD struct */
Status = AcpiDecodePldBuffer (ByteData, ByteCount, &PldInfo);
if (ACPI_FAILURE (Status))
{
return;
}
/* First 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor);
AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color);
/* Second 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width);
AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height);
/* Third 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay);
/* Fourth 32-bit dword */
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation);
AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order);
/* Fifth 32-bit dword */
if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE)
{
AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset);
AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset);
}
ACPI_FREE (PldInfo);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmUnicode

View File

@ -665,6 +665,11 @@ AcpiDmDisassembleOneOp (
Op->Common.DisasmOpcode = ACPI_DASM_STRING;
AcpiOsPrintf ("Buffer");
}
else if (AcpiDmIsPldBuffer (Op))
{
Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD;
AcpiOsPrintf ("Buffer");
}
else
{
Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;

View File

@ -241,6 +241,20 @@ AcpiDsLoad1BeginOp (
WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
break;
case ACPI_TYPE_METHOD:
/*
* Allow scope change to root during execution of module-level
* code. Root is typed METHOD during this time.
*/
if ((Node == AcpiGbl_RootNode) &&
(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
{
break;
}
/*lint -fallthrough */
default:
/* All other types are an error */

View File

@ -243,6 +243,20 @@ AcpiDsLoad2BeginOp (
WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
break;
case ACPI_TYPE_METHOD:
/*
* Allow scope change to root during execution of module-level
* code. Root is typed METHOD during this time.
*/
if ((Node == AcpiGbl_RootNode) &&
(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
{
break;
}
/*lint -fallthrough */
default:
/* All other types are an error */

View File

@ -92,7 +92,7 @@ AcpiEvUpdateGpeEnableMask (
return_ACPI_STATUS (AE_NOT_EXIST);
}
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
/* Clear the run bit up front */
@ -431,6 +431,13 @@ AcpiEvGpeDetect (
if (!(GpeRegisterInfo->EnableForRun |
GpeRegisterInfo->EnableForWake))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Ignore disabled registers for GPE%02X-GPE%02X: "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
continue;
}
@ -451,8 +458,13 @@ AcpiEvGpeDetect (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n",
GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg));
"Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
StatusReg, EnableReg,
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
/* Check if there is anything active at all in this register */

View File

@ -480,7 +480,7 @@ AcpiSetGpeWakeMask (
goto UnlockAndExit;
}
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
/* Perform the action */

View File

@ -99,7 +99,6 @@ AcpiHwExecuteSleepMethod (
* FUNCTION: AcpiHwExtendedSleep
*
* PARAMETERS: SleepState - Which sleep state to enter
* Flags - ACPI_EXECUTE_GTS to run optional method
*
* RETURN: Status
*
@ -111,8 +110,7 @@ AcpiHwExecuteSleepMethod (
ACPI_STATUS
AcpiHwExtendedSleep (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;
UINT8 SleepTypeValue;
@ -140,13 +138,6 @@ AcpiHwExtendedSleep (
AcpiGbl_SystemAwakeAndRunning = FALSE;
/* Optionally execute _GTS (Going To Sleep) */
if (Flags & ACPI_EXECUTE_GTS)
{
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState);
}
/* Flush caches, as per ACPI specification */
ACPI_FLUSH_CPU_CACHE ();
@ -191,7 +182,6 @@ AcpiHwExtendedSleep (
* FUNCTION: AcpiHwExtendedWakePrep
*
* PARAMETERS: SleepState - Which sleep state we just exited
* Flags - ACPI_EXECUTE_BFS to run optional method
*
* RETURN: Status
*
@ -202,8 +192,7 @@ AcpiHwExtendedSleep (
ACPI_STATUS
AcpiHwExtendedWakePrep (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;
UINT8 SleepTypeValue;
@ -223,12 +212,6 @@ AcpiHwExtendedWakePrep (
&AcpiGbl_FADT.SleepControl);
}
/* Optionally execute _BFS (Back From Sleep) */
if (Flags & ACPI_EXECUTE_BFS)
{
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState);
}
return_ACPI_STATUS (AE_OK);
}
@ -238,7 +221,6 @@ AcpiHwExtendedWakePrep (
* FUNCTION: AcpiHwExtendedWake
*
* PARAMETERS: SleepState - Which sleep state we just exited
* Flags - Reserved, set to zero
*
* RETURN: Status
*
@ -249,8 +231,7 @@ AcpiHwExtendedWakePrep (
ACPI_STATUS
AcpiHwExtendedWake (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_FUNCTION_TRACE (HwExtendedWake);

View File

@ -65,7 +65,6 @@ AcpiHwEnableWakeupGpeBlock (
* FUNCTION: AcpiHwGetGpeRegisterBit
*
* PARAMETERS: GpeEventInfo - Info block for the GPE
* GpeRegisterInfo - Info block for the GPE register
*
* RETURN: Register mask with a one in the GPE bit position
*
@ -76,12 +75,11 @@ AcpiHwEnableWakeupGpeBlock (
UINT32
AcpiHwGetGpeRegisterBit (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
return ((UINT32) 1 <<
(GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
(GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
}
@ -130,7 +128,7 @@ AcpiHwLowSetGpe (
/* Set or clear just the bit that corresponds to this GPE */
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
switch (Action)
{
case ACPI_GPE_CONDITIONAL_ENABLE:
@ -199,7 +197,7 @@ AcpiHwClearGpe (
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
Status = AcpiHwWrite (RegisterBit,
&GpeRegisterInfo->StatusAddress);
@ -247,7 +245,7 @@ AcpiHwGetGpeStatus (
/* Get the register bitmask for this GPE */
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
/* GPE currently enabled? (enabled for runtime?) */

View File

@ -55,7 +55,6 @@
* FUNCTION: AcpiHwLegacySleep
*
* PARAMETERS: SleepState - Which sleep state to enter
* Flags - ACPI_EXECUTE_GTS to run optional method
*
* RETURN: Status
*
@ -66,8 +65,7 @@
ACPI_STATUS
AcpiHwLegacySleep (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
@ -117,13 +115,6 @@ AcpiHwLegacySleep (
return_ACPI_STATUS (Status);
}
/* Optionally execute _GTS (Going To Sleep) */
if (Flags & ACPI_EXECUTE_GTS)
{
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState);
}
/* Get current value of PM1A control */
Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL,
@ -233,7 +224,6 @@ AcpiHwLegacySleep (
* FUNCTION: AcpiHwLegacyWakePrep
*
* PARAMETERS: SleepState - Which sleep state we just exited
* Flags - ACPI_EXECUTE_BFS to run optional method
*
* RETURN: Status
*
@ -245,8 +235,7 @@ AcpiHwLegacySleep (
ACPI_STATUS
AcpiHwLegacyWakePrep (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
@ -296,12 +285,6 @@ AcpiHwLegacyWakePrep (
}
}
/* Optionally execute _BFS (Back From Sleep) */
if (Flags & ACPI_EXECUTE_BFS)
{
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState);
}
return_ACPI_STATUS (Status);
}
@ -311,7 +294,6 @@ AcpiHwLegacyWakePrep (
* FUNCTION: AcpiHwLegacyWake
*
* PARAMETERS: SleepState - Which sleep state we just exited
* Flags - Reserved, set to zero
*
* RETURN: Status
*
@ -322,8 +304,7 @@ AcpiHwLegacyWakePrep (
ACPI_STATUS
AcpiHwLegacyWake (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;

View File

@ -52,7 +52,6 @@
static ACPI_STATUS
AcpiHwSleepDispatch (
UINT8 SleepState,
UINT8 Flags,
UINT32 FunctionId);
/*
@ -261,7 +260,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
static ACPI_STATUS
AcpiHwSleepDispatch (
UINT8 SleepState,
UINT8 Flags,
UINT32 FunctionId)
{
ACPI_STATUS Status;
@ -277,13 +275,13 @@ AcpiHwSleepDispatch (
if (AcpiGbl_ReducedHardware ||
AcpiGbl_FADT.SleepControl.Address)
{
Status = SleepFunctions->ExtendedFunction (SleepState, Flags);
Status = SleepFunctions->ExtendedFunction (SleepState);
}
else
{
/* Legacy sleep */
Status = SleepFunctions->LegacyFunction (SleepState, Flags);
Status = SleepFunctions->LegacyFunction (SleepState);
}
return (Status);
@ -293,7 +291,7 @@ AcpiHwSleepDispatch (
* For the case where reduced-hardware-only code is being generated,
* we know that only the extended sleep registers are available
*/
Status = SleepFunctions->ExtendedFunction (SleepState, Flags);
Status = SleepFunctions->ExtendedFunction (SleepState);
return (Status);
#endif /* !ACPI_REDUCED_HARDWARE */
@ -387,7 +385,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
* FUNCTION: AcpiEnterSleepState
*
* PARAMETERS: SleepState - Which sleep state to enter
* Flags - ACPI_EXECUTE_GTS to run optional method
*
* RETURN: Status
*
@ -398,8 +395,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
ACPI_STATUS
AcpiEnterSleepState (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;
@ -415,7 +411,7 @@ AcpiEnterSleepState (
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_SLEEP_FUNCTION_ID);
Status = AcpiHwSleepDispatch (SleepState, ACPI_SLEEP_FUNCTION_ID);
return_ACPI_STATUS (Status);
}
@ -427,7 +423,6 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
* FUNCTION: AcpiLeaveSleepStatePrep
*
* PARAMETERS: SleepState - Which sleep state we are exiting
* Flags - ACPI_EXECUTE_BFS to run optional method
*
* RETURN: Status
*
@ -440,8 +435,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
ACPI_STATUS
AcpiLeaveSleepStatePrep (
UINT8 SleepState,
UINT8 Flags)
UINT8 SleepState)
{
ACPI_STATUS Status;
@ -449,7 +443,7 @@ AcpiLeaveSleepStatePrep (
ACPI_FUNCTION_TRACE (AcpiLeaveSleepStatePrep);
Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_WAKE_PREP_FUNCTION_ID);
Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_PREP_FUNCTION_ID);
return_ACPI_STATUS (Status);
}
@ -479,7 +473,7 @@ AcpiLeaveSleepState (
ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
Status = AcpiHwSleepDispatch (SleepState, 0, ACPI_WAKE_FUNCTION_ID);
Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_FUNCTION_ID);
return_ACPI_STATUS (Status);
}

View File

@ -294,7 +294,7 @@ AcpiNsDumpOneObject (
{
case ACPI_TYPE_PROCESSOR:
AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
AcpiOsPrintf ("ID %02X Len %02X Addr %p\n",
ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
break;

View File

@ -77,6 +77,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
{"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
{"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
{"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
{"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
/* Feature Group Strings */

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
* Module Name: utxface - External interfaces, miscellaneous utility functions
*
*****************************************************************************/
@ -46,321 +46,12 @@
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acevents.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/acdebug.h>
#include <contrib/dev/acpica/include/actables.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utxface")
#ifndef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: AcpiInitializeSubsystem
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initializes all global variables. This is the first function
* called, so any early initialization belongs here.
*
******************************************************************************/
ACPI_STATUS
AcpiInitializeSubsystem (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
/* Initialize the OS-Dependent layer */
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
return_ACPI_STATUS (Status);
}
/* Initialize all globals used by the subsystem */
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals"));
return_ACPI_STATUS (Status);
}
/* Create the default mutex objects */
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
return_ACPI_STATUS (Status);
}
/*
* Initialize the namespace manager and
* the root of the namespace tree
*/
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
return_ACPI_STATUS (Status);
}
/* Initialize the global OSI interfaces list with the static names */
Status = AcpiUtInitializeInterfaces ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization"));
return_ACPI_STATUS (Status);
}
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
/*******************************************************************************
*
* FUNCTION: AcpiEnableSubsystem
*
* PARAMETERS: Flags - Init/enable Options
*
* RETURN: Status
*
* DESCRIPTION: Completes the subsystem initialization including hardware.
* Puts system into ACPI mode if it isn't already.
*
******************************************************************************/
ACPI_STATUS
AcpiEnableSubsystem (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
#if (!ACPI_REDUCED_HARDWARE)
/* Enable ACPI mode */
if (!(Flags & ACPI_NO_ACPI_ENABLE))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
AcpiGbl_OriginalMode = AcpiHwGetMode();
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
return_ACPI_STATUS (Status);
}
}
/*
* Obtain a permanent mapping for the FACS. This is required for the
* Global Lock and the Firmware Waking Vector
*/
Status = AcpiTbInitializeFacs ();
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
return_ACPI_STATUS (Status);
}
#endif /* !ACPI_REDUCED_HARDWARE */
/*
* Install the default OpRegion handlers. These are installed unless
* other handlers have already been installed via the
* InstallAddressSpaceHandler interface.
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Installing default address space handlers\n"));
Status = AcpiEvInstallRegionHandlers ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
#if (!ACPI_REDUCED_HARDWARE)
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
*
* Note1: We must have the hardware and events initialized before we can
* execute any control methods safely. Any control method can require
* ACPI hardware support, so the hardware must be fully initialized before
* any method execution!
*
* Note2: Fixed events are initialized and enabled here. GPEs are
* initialized, but cannot be enabled until after the hardware is
* completely initialized (SCI and GlobalLock activated) and the various
* initialization control methods are run (_REG, _STA, _INI) on the
* entire namespace.
*/
if (!(Flags & ACPI_NO_EVENT_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Initializing ACPI events\n"));
Status = AcpiEvInitializeEvents ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Install the SCI handler and Global Lock handler. This completes the
* hardware initialization.
*/
if (!(Flags & ACPI_NO_HANDLER_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Installing SCI/GL handlers\n"));
Status = AcpiEvInstallXruptHandlers ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
#endif /* !ACPI_REDUCED_HARDWARE */
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
/*******************************************************************************
*
* FUNCTION: AcpiInitializeObjects
*
* PARAMETERS: Flags - Init/enable Options
*
* RETURN: Status
*
* DESCRIPTION: Completes namespace initialization by initializing device
* objects and executing AML code for Regions, buffers, etc.
*
******************************************************************************/
ACPI_STATUS
AcpiInitializeObjects (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
/*
* Run all _REG methods
*
* Note: Any objects accessed by the _REG methods will be automatically
* initialized, even if they contain executable AML (see the call to
* AcpiNsInitializeObjects below).
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Executing _REG OpRegion methods\n"));
Status = AcpiEvInitializeOpRegions ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Execute any module-level code that was detected during the table load
* phase. Although illegal since ACPI 2.0, there are many machines that
* contain this type of code. Each block of detected executable AML code
* outside of any control method is wrapped with a temporary control
* method object and placed on a global list. The methods on this list
* are executed below.
*/
AcpiNsExecModuleCodeList ();
/*
* Initialize the objects that remain uninitialized. This runs the
* executable AML that may be part of the declaration of these objects:
* OperationRegions, BufferFields, Buffers, and Packages.
*/
if (!(Flags & ACPI_NO_OBJECT_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Completing Initialization of ACPI Objects\n"));
Status = AcpiNsInitializeObjects ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Initialize all device objects in the namespace. This runs the device
* _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Initializing ACPI Devices\n"));
Status = AcpiNsInitializeDevices ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Empty the caches (delete the cached objects) on the assumption that
* the table load filled them up more than they will be at runtime --
* thus wasting non-paged memory.
*/
Status = AcpiPurgeCachedObjects ();
AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
#endif
/*******************************************************************************
*
* FUNCTION: AcpiTerminate
@ -835,3 +526,98 @@ AcpiCheckAddressRange (
ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange)
#endif /* !ACPI_ASL_COMPILER */
/*******************************************************************************
*
* FUNCTION: AcpiDecodePldBuffer
*
* PARAMETERS: InBuffer - Buffer returned by _PLD method
* Length - Length of the InBuffer
* ReturnBuffer - Where the decode buffer is returned
*
* RETURN: Status and the decoded _PLD buffer. User must deallocate
* the buffer via ACPI_FREE.
*
* DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into
* a local struct that is much more useful to an ACPI driver.
*
******************************************************************************/
ACPI_STATUS
AcpiDecodePldBuffer (
UINT8 *InBuffer,
ACPI_SIZE Length,
ACPI_PLD_INFO **ReturnBuffer)
{
ACPI_PLD_INFO *PldInfo;
UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer);
UINT32 Dword;
/* Parameter validation */
if (!InBuffer || !ReturnBuffer || (Length < 16))
{
return (AE_BAD_PARAMETER);
}
PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO));
if (!PldInfo)
{
return (AE_NO_MEMORY);
}
/* First 32-bit DWord */
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]);
PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword);
PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword);
PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword);
/* Second 32-bit DWord */
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]);
PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword);
PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword);
/* Third 32-bit DWord */
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]);
PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword);
PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword);
PldInfo->Lid = ACPI_PLD_GET_LID (&Dword);
PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword);
PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword);
PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword);
PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword);
PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword);
PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword);
PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword);
PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword);
/* Fourth 32-bit DWord */
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]);
PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword);
PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword);
PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword);
PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword);
PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword);
PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword);
PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword);
if (Length >= ACPI_PLD_BUFFER_SIZE)
{
/* Fifth 32-bit DWord (Revision 2 of _PLD) */
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]);
PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword);
PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword);
}
*ReturnBuffer = PldInfo;
return (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer)

View File

@ -87,8 +87,8 @@ extern FILE *AcpiGbl_OutputFile;
#define ACPI_MSG_WARNING "ACPI Warning: "
#define ACPI_MSG_INFO "ACPI: "
#define ACPI_MSG_BIOS_ERROR "ACPI Firmware Error: "
#define ACPI_MSG_BIOS_WARNING "ACPI Firmware Warning: "
#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: "
#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: "
/*
* Common message suffix

View File

@ -0,0 +1,358 @@
/******************************************************************************
*
* Module Name: utxfinit - External interfaces for ACPICA initialization
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define __UTXFINIT_C__
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acevents.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/acdebug.h>
#include <contrib/dev/acpica/include/actables.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utxfinit")
/*******************************************************************************
*
* FUNCTION: AcpiInitializeSubsystem
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initializes all global variables. This is the first function
* called, so any early initialization belongs here.
*
******************************************************************************/
ACPI_STATUS
AcpiInitializeSubsystem (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
/* Initialize the OS-Dependent layer */
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
return_ACPI_STATUS (Status);
}
/* Initialize all globals used by the subsystem */
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals"));
return_ACPI_STATUS (Status);
}
/* Create the default mutex objects */
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
return_ACPI_STATUS (Status);
}
/*
* Initialize the namespace manager and
* the root of the namespace tree
*/
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
return_ACPI_STATUS (Status);
}
/* Initialize the global OSI interfaces list with the static names */
Status = AcpiUtInitializeInterfaces ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization"));
return_ACPI_STATUS (Status);
}
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
/*******************************************************************************
*
* FUNCTION: AcpiEnableSubsystem
*
* PARAMETERS: Flags - Init/enable Options
*
* RETURN: Status
*
* DESCRIPTION: Completes the subsystem initialization including hardware.
* Puts system into ACPI mode if it isn't already.
*
******************************************************************************/
ACPI_STATUS
AcpiEnableSubsystem (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
#if (!ACPI_REDUCED_HARDWARE)
/* Enable ACPI mode */
if (!(Flags & ACPI_NO_ACPI_ENABLE))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
AcpiGbl_OriginalMode = AcpiHwGetMode();
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
return_ACPI_STATUS (Status);
}
}
/*
* Obtain a permanent mapping for the FACS. This is required for the
* Global Lock and the Firmware Waking Vector
*/
Status = AcpiTbInitializeFacs ();
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
return_ACPI_STATUS (Status);
}
#endif /* !ACPI_REDUCED_HARDWARE */
/*
* Install the default OpRegion handlers. These are installed unless
* other handlers have already been installed via the
* InstallAddressSpaceHandler interface.
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Installing default address space handlers\n"));
Status = AcpiEvInstallRegionHandlers ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
#if (!ACPI_REDUCED_HARDWARE)
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
*
* Note1: We must have the hardware and events initialized before we can
* execute any control methods safely. Any control method can require
* ACPI hardware support, so the hardware must be fully initialized before
* any method execution!
*
* Note2: Fixed events are initialized and enabled here. GPEs are
* initialized, but cannot be enabled until after the hardware is
* completely initialized (SCI and GlobalLock activated) and the various
* initialization control methods are run (_REG, _STA, _INI) on the
* entire namespace.
*/
if (!(Flags & ACPI_NO_EVENT_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Initializing ACPI events\n"));
Status = AcpiEvInitializeEvents ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Install the SCI handler and Global Lock handler. This completes the
* hardware initialization.
*/
if (!(Flags & ACPI_NO_HANDLER_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Installing SCI/GL handlers\n"));
Status = AcpiEvInstallXruptHandlers ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
#endif /* !ACPI_REDUCED_HARDWARE */
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
/*******************************************************************************
*
* FUNCTION: AcpiInitializeObjects
*
* PARAMETERS: Flags - Init/enable Options
*
* RETURN: Status
*
* DESCRIPTION: Completes namespace initialization by initializing device
* objects and executing AML code for Regions, buffers, etc.
*
******************************************************************************/
ACPI_STATUS
AcpiInitializeObjects (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
/*
* Run all _REG methods
*
* Note: Any objects accessed by the _REG methods will be automatically
* initialized, even if they contain executable AML (see the call to
* AcpiNsInitializeObjects below).
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Executing _REG OpRegion methods\n"));
Status = AcpiEvInitializeOpRegions ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Execute any module-level code that was detected during the table load
* phase. Although illegal since ACPI 2.0, there are many machines that
* contain this type of code. Each block of detected executable AML code
* outside of any control method is wrapped with a temporary control
* method object and placed on a global list. The methods on this list
* are executed below.
*/
AcpiNsExecModuleCodeList ();
/*
* Initialize the objects that remain uninitialized. This runs the
* executable AML that may be part of the declaration of these objects:
* OperationRegions, BufferFields, Buffers, and Packages.
*/
if (!(Flags & ACPI_NO_OBJECT_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Completing Initialization of ACPI Objects\n"));
Status = AcpiNsInitializeObjects ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Initialize all device objects in the namespace. This runs the device
* _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[Init] Initializing ACPI Devices\n"));
Status = AcpiNsInitializeDevices ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Empty the caches (delete the cached objects) on the assumption that
* the table load filled them up more than they will be at runtime --
* thus wasting non-paged memory.
*/
Status = AcpiPurgeCachedObjects ();
AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)

View File

@ -0,0 +1,246 @@
/******************************************************************************
*
* Name: acbuffer.h - Support for buffers returned by ACPI predefined names
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACBUFFER_H__
#define __ACBUFFER_H__
/*
* Contains buffer structures for these predefined names:
* _FDE, _GRT, _GTM, _PLD, _SRT
*/
/*
* Note: C bitfields are not used for this reason:
*
* "Bitfields are great and easy to read, but unfortunately the C language
* does not specify the layout of bitfields in memory, which means they are
* essentially useless for dealing with packed data in on-disk formats or
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
* this decision was a design error in C. Ritchie could have picked an order
* and stuck with it." Norman Ramsey.
* See http://stackoverflow.com/a/1053662/41661
*/
/* _FDE return value */
typedef struct acpi_fde_info
{
UINT32 Floppy0;
UINT32 Floppy1;
UINT32 Floppy2;
UINT32 Floppy3;
UINT32 Tape;
} ACPI_FDE_INFO;
/*
* _GRT return value
* _SRT input value
*/
typedef struct acpi_grt_info
{
UINT16 Year;
UINT8 Month;
UINT8 Day;
UINT8 Hour;
UINT8 Minute;
UINT8 Second;
UINT8 Valid;
UINT16 Milliseconds;
UINT16 Timezone;
UINT8 Daylight;
UINT8 Reserved[3];
} ACPI_GRT_INFO;
/* _GTM return value */
typedef struct acpi_gtm_info
{
UINT32 PioSpeed0;
UINT32 DmaSpeed0;
UINT32 PioSpeed1;
UINT32 DmaSpeed1;
UINT32 Flags;
} ACPI_GTM_INFO;
/*
* Formatted _PLD return value. The minimum size is a package containing
* one buffer.
* Revision 1: Buffer is 16 bytes (128 bits)
* Revision 2: Buffer is 20 bytes (160 bits)
*
* Note: This structure is returned from the AcpiDecodePldBuffer
* interface.
*/
typedef struct acpi_pld_info
{
UINT8 Revision;
UINT8 IgnoreColor;
UINT32 Color;
UINT16 Width;
UINT16 Height;
UINT8 UserVisible;
UINT8 Dock;
UINT8 Lid;
UINT8 Panel;
UINT8 VerticalPosition;
UINT8 HorizontalPosition;
UINT8 Shape;
UINT8 GroupOrientation;
UINT8 GroupToken;
UINT8 GroupPosition;
UINT8 Bay;
UINT8 Ejectable;
UINT8 OspmEjectRequired;
UINT8 CabinetNumber;
UINT8 CardCageNumber;
UINT8 Reference;
UINT8 Rotation;
UINT8 Order;
UINT8 Reserved;
UINT16 VerticalOffset;
UINT16 HorizontalOffset;
} ACPI_PLD_INFO;
/*
* Macros to:
* 1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET*
* (Used by AcpiDecodePldBuffer)
* 2) Construct a _PLD buffer - ACPI_PLD_SET*
* (Intended for BIOS use only)
*/
#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */
#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
/* First 32-bit dword, bits 0:32 */
#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */
#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK)
#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */
/* Second 32-bit dword, bits 33:63 */
#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */
#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */
/* Third 32-bit dword, bits 64:95 */
#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */
#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */
#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */
#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */
#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */
#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */
#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */
#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */
#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */
#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */
#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */
/* Fourth 32-bit dword, bits 96:127 */
#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */
#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */
#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */
#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */
#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */
#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */
#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */
/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */
#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
#endif /* ACBUFFER_H */

View File

@ -235,6 +235,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[];
@ -395,6 +402,14 @@ void
AcpiDmDumpCpep (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpCsrt (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpDbg2 (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpDmar (
ACPI_TABLE_HEADER *Table);
@ -613,6 +628,10 @@ BOOLEAN
AcpiDmIsStringBuffer (
ACPI_PARSE_OBJECT *Op);
BOOLEAN
AcpiDmIsPldBuffer (
ACPI_PARSE_OBJECT *Op);
/*
* dmextern

View File

@ -114,18 +114,15 @@ AcpiHwClearAcpiStatus (
*/
ACPI_STATUS
AcpiHwLegacySleep (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_STATUS
AcpiHwLegacyWakePrep (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_STATUS
AcpiHwLegacyWake (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
/*
@ -138,18 +135,15 @@ AcpiHwExecuteSleepMethod (
ACPI_STATUS
AcpiHwExtendedSleep (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_STATUS
AcpiHwExtendedWakePrep (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_STATUS
AcpiHwExtendedWake (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
/*
@ -173,8 +167,7 @@ AcpiHwWritePort (
*/
UINT32
AcpiHwGetGpeRegisterBit (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo);
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiHwLowSetGpe (

View File

@ -857,15 +857,18 @@ typedef union acpi_parse_value
char AmlOpName[16]) /* Op name (debug only) */
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
#define ACPI_DASM_LNOT_PREFIX 0x06
#define ACPI_DASM_LNOT_SUFFIX 0x07
#define ACPI_DASM_IGNORE 0x08
/* Flags for DisasmFlags field above */
#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */
#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */
#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a LNotEqual (etc.) pair of opcodes */
#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a LNotEqual (etc.) pair of opcodes */
#define ACPI_DASM_IGNORE 0x09 /* Not used at this time */
/*
* Generic operation (for example: If, While, Store)
@ -1105,6 +1108,7 @@ typedef struct acpi_bit_register_info
#define ACPI_OSI_WIN_VISTA_SP1 0x09
#define ACPI_OSI_WIN_VISTA_SP2 0x0A
#define ACPI_OSI_WIN_7 0x0B
#define ACPI_OSI_WIN_8 0x0C
#define ACPI_ALWAYS_ILLEGAL 0x00
@ -1237,6 +1241,7 @@ typedef struct acpi_external_file
typedef struct acpi_db_method_info
{
ACPI_HANDLE Method;
ACPI_HANDLE MainThreadGate;
ACPI_HANDLE ThreadCompleteGate;
ACPI_HANDLE InfoGate;

View File

@ -268,10 +268,33 @@
/* Bitfields within ACPI registers */
#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \
((Val << Pos) & Mask)
#define ACPI_INSERT_BITS(Target, Mask, Source) Target = ((Target & (~(Mask))) | (Source & Mask))
#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \
Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
#define ACPI_INSERT_BITS(Target, Mask, Source) \
Target = ((Target & (~(Mask))) | (Source & Mask))
/* Generic bitfield macros and masks */
#define ACPI_GET_BITS(SourcePtr, Position, Mask) \
((*SourcePtr >> Position) & Mask)
#define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \
(*TargetPtr |= ((Value & Mask) << Position))
#define ACPI_1BIT_MASK 0x00000001
#define ACPI_2BIT_MASK 0x00000003
#define ACPI_3BIT_MASK 0x00000007
#define ACPI_4BIT_MASK 0x0000000F
#define ACPI_5BIT_MASK 0x0000001F
#define ACPI_6BIT_MASK 0x0000003F
#define ACPI_7BIT_MASK 0x0000007F
#define ACPI_8BIT_MASK 0x000000FF
#define ACPI_16BIT_MASK 0x0000FFFF
#define ACPI_24BIT_MASK 0x00FFFFFF
/*
* An object of type ACPI_NAMESPACE_NODE can appear in some contexts

View File

@ -62,11 +62,10 @@
#define METHOD_NAME__AEI "_AEI"
#define METHOD_NAME__PRW "_PRW"
#define METHOD_NAME__SRS "_SRS"
#define METHOD_NAME__PLD "_PLD"
/* Method names - these methods must appear at the namespace root */
#define METHOD_PATHNAME__BFS "\\_BFS"
#define METHOD_PATHNAME__GTS "\\_GTS"
#define METHOD_PATHNAME__PTS "\\_PTS"
#define METHOD_PATHNAME__SST "\\_SI._SST"
#define METHOD_PATHNAME__WAK "\\_WAK"

View File

@ -48,11 +48,12 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20120711
#define ACPI_CA_VERSION 0x20120816
#include <contrib/dev/acpica/include/acconfig.h>
#include <contrib/dev/acpica/include/actypes.h>
#include <contrib/dev/acpica/include/actbl.h>
#include <contrib/dev/acpica/include/acbuffer.h>
/*
* Globals that are publically available
@ -183,6 +184,11 @@ AcpiCheckAddressRange (
ACPI_SIZE Length,
BOOLEAN Warn);
ACPI_STATUS
AcpiDecodePldBuffer (
UINT8 *InBuffer,
ACPI_SIZE Length,
ACPI_PLD_INFO **ReturnBuffer);
/*
* ACPI Memory management
@ -686,8 +692,7 @@ AcpiEnterSleepStatePrep (
ACPI_STATUS
AcpiEnterSleepState (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
@ -696,8 +701,7 @@ AcpiEnterSleepStateS4bios (
ACPI_STATUS
AcpiLeaveSleepStatePrep (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
ACPI_STATUS
AcpiLeaveSleepState (

View File

@ -82,9 +82,15 @@
#pragma pack(1)
/*
* Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
* This is the only type that is even remotely portable. Anything else is not
* portable, so do not use any other bitfield types.
* Note: C bitfields are not used for this reason:
*
* "Bitfields are great and easy to read, but unfortunately the C language
* does not specify the layout of bitfields in memory, which means they are
* essentially useless for dealing with packed data in on-disk formats or
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
* this decision was a design error in C. Ritchie could have picked an order
* and stuck with it." Norman Ramsey.
* See http://stackoverflow.com/a/1053662/41661
*/
@ -99,7 +105,7 @@ typedef struct acpi_table_header
{
char Signature[ACPI_NAME_SIZE]; /* ASCII table signature */
UINT32 Length; /* Length of table in bytes, including this header */
UINT8 Revision; /* ACPI Specification minor version # */
UINT8 Revision; /* ACPI Specification minor version number */
UINT8 Checksum; /* To make sum of entire table == 0 */
char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
@ -115,7 +121,7 @@ typedef struct acpi_table_header
* GAS - Generic Address Structure (ACPI 2.0+)
*
* Note: Since this structure is used in the ACPI tables, it is byte aligned.
* If misaliged access is not supported by the hardware, accesses to the
* If misaligned access is not supported by the hardware, accesses to the
* 64-bit Address field must be performed with care.
*
******************************************************************************/
@ -253,18 +259,18 @@ typedef struct acpi_table_fadt
UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */
UINT16 SciInterrupt; /* System vector of SCI interrupt */
UINT32 SmiCommand; /* 32-bit Port address of SMI command port */
UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
UINT8 S4BiosRequest; /* Value to write to SMI CMD to enter S4BIOS state */
UINT8 AcpiEnable; /* Value to write to SMI_CMD to enable ACPI */
UINT8 AcpiDisable; /* Value to write to SMI_CMD to disable ACPI */
UINT8 S4BiosRequest; /* Value to write to SMI_CMD to enter S4BIOS state */
UINT8 PstateControl; /* Processor performance state control*/
UINT32 Pm1aEventBlock; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */
UINT32 Pm1bEventBlock; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */
UINT32 Pm1aControlBlock; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */
UINT32 Pm1bControlBlock; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */
UINT32 Pm2ControlBlock; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */
UINT32 PmTimerBlock; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */
UINT32 Gpe0Block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */
UINT32 Gpe1Block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */
UINT32 Pm1aEventBlock; /* 32-bit port address of Power Mgt 1a Event Reg Blk */
UINT32 Pm1bEventBlock; /* 32-bit port address of Power Mgt 1b Event Reg Blk */
UINT32 Pm1aControlBlock; /* 32-bit port address of Power Mgt 1a Control Reg Blk */
UINT32 Pm1bControlBlock; /* 32-bit port address of Power Mgt 1b Control Reg Blk */
UINT32 Pm2ControlBlock; /* 32-bit port address of Power Mgt 2 Control Reg Blk */
UINT32 PmTimerBlock; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */
UINT32 Gpe0Block; /* 32-bit port address of General Purpose Event 0 Reg Blk */
UINT32 Gpe1Block; /* 32-bit port address of General Purpose Event 1 Reg Blk */
UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */
UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */
UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */
@ -272,12 +278,12 @@ typedef struct acpi_table_fadt
UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */
UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */
UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */
UINT8 CstControl; /* Support for the _CST object and C States change notification */
UINT8 CstControl; /* Support for the _CST object and C-States change notification */
UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */
UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */
UINT16 FlushSize; /* Processor's memory cache line width, in bytes */
UINT16 FlushSize; /* Processor memory cache line width, in bytes */
UINT16 FlushStride; /* Number of flush strides that need to be read */
UINT8 DutyOffset; /* Processor duty cycle index in processor's P_CNT reg */
UINT8 DutyOffset; /* Processor duty cycle index in processor P_CNT reg */
UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register */
UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */
UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */
@ -298,13 +304,13 @@ typedef struct acpi_table_fadt
ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register */
ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register */
ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */
ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */
} ACPI_TABLE_FADT;
/* Masks for FADT Boot Architecture Flags (BootFlags) */
/* Masks for FADT Boot Architecture Flags (BootFlags) [Vx]=Introduced in this FADT revision */
#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@ -315,13 +321,13 @@ typedef struct acpi_table_fadt
/* Masks for FADT flags */
#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */
#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */
#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */
#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */
#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */
#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */
#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */
#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */
#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */
#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */
#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */
#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */
@ -339,9 +345,9 @@ typedef struct acpi_table_fadt
#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
/* Values for PreferredProfile (Prefered Power Management Profiles) */
/* Values for PreferredProfile (Preferred Power Management Profiles) */
enum AcpiPreferedPmProfiles
enum AcpiPreferredPmProfiles
{
PM_UNSPECIFIED = 0,
PM_DESKTOP = 1,
@ -384,7 +390,7 @@ typedef struct acpi_table_desc
{
ACPI_PHYSICAL_ADDRESS Address;
ACPI_TABLE_HEADER *Pointer;
UINT32 Length; /* Length fixed at 32 bits */
UINT32 Length; /* Length fixed at 32 bits (fixed in table header) */
ACPI_NAME_UNION Signature;
ACPI_OWNER_ID OwnerId;
UINT8 Flags;

View File

@ -82,9 +82,15 @@
#pragma pack(1)
/*
* Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
* This is the only type that is even remotely portable. Anything else is not
* portable, so do not use any other bitfield types.
* Note: C bitfields are not used for this reason:
*
* "Bitfields are great and easy to read, but unfortunately the C language
* does not specify the layout of bitfields in memory, which means they are
* essentially useless for dealing with packed data in on-disk formats or
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
* this decision was a design error in C. Ritchie could have picked an order
* and stuck with it." Norman Ramsey.
* See http://stackoverflow.com/a/1053662/41661
*/

View File

@ -65,6 +65,8 @@
*/
#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */
#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */
#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
@ -98,9 +100,15 @@
#pragma pack(1)
/*
* Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
* This is the only type that is even remotely portable. Anything else is not
* portable, so do not use any other bitfield types.
* Note: C bitfields are not used for this reason:
*
* "Bitfields are great and easy to read, but unfortunately the C language
* does not specify the layout of bitfields in memory, which means they are
* essentially useless for dealing with packed data in on-disk formats or
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
* this decision was a design error in C. Ritchie could have picked an order
* and stuck with it." Norman Ramsey.
* See http://stackoverflow.com/a/1053662/41661
*/
@ -262,6 +270,128 @@ typedef struct acpi_table_boot
} ACPI_TABLE_BOOT;
/*******************************************************************************
*
* CSRT - Core System Resource Table
* Version 0
*
* Conforms to the "Core System Resource Table (CSRT)", November 14, 2011
*
******************************************************************************/
typedef struct acpi_table_csrt
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
} ACPI_TABLE_CSRT;
/* Resource Group subtable */
typedef struct acpi_csrt_group
{
UINT32 Length;
UINT32 VendorId;
UINT32 SubvendorId;
UINT16 DeviceId;
UINT16 SubdeviceId;
UINT16 Revision;
UINT16 Reserved;
UINT32 InfoLength;
/* Shared data (length = InfoLength) immediately follows */
} ACPI_CSRT_GROUP;
/* Resource Descriptor subtable */
typedef struct acpi_csrt_descriptor
{
UINT32 Length;
UINT16 Type;
UINT16 Subtype;
UINT32 Uid;
/* Resource-specific information immediately follows */
} ACPI_CSRT_DESCRIPTOR;
/* Resource Types */
#define ACPI_CSRT_TYPE_INTERRUPT 0x0001
#define ACPI_CSRT_TYPE_TIMER 0x0002
#define ACPI_CSRT_TYPE_DMA 0x0003
/* Resource Subtypes */
#define ACPI_CSRT_XRUPT_LINE 0x0000
#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001
#define ACPI_CSRT_TIMER 0x0000
#define ACPI_CSRT_DMA_CHANNEL 0x0000
#define ACPI_CSRT_DMA_CONTROLLER 0x0001
/*******************************************************************************
*
* DBG2 - Debug Port Table 2
* Version 0 (Both main table and subtables)
*
* Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
*
******************************************************************************/
typedef struct acpi_table_dbg2
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT32 InfoOffset;
UINT32 InfoCount;
} ACPI_TABLE_DBG2;
/* Debug Device Information Subtable */
typedef struct acpi_dbg2_device
{
UINT8 Revision;
UINT16 Length;
UINT8 RegisterCount; /* Number of BaseAddress registers */
UINT16 NamepathLength;
UINT16 NamepathOffset;
UINT16 OemDataLength;
UINT16 OemDataOffset;
UINT16 PortType;
UINT16 PortSubtype;
UINT16 Reserved;
UINT16 BaseAddressOffset;
UINT16 AddressSizeOffset;
/*
* Data that follows:
* BaseAddress (required) - Each in 12-byte Generic Address Structure format.
* AddressSize (required) - Array of UINT32 sizes corresponding to each BaseAddress register.
* Namepath (required) - Null terminated string. Single dot if not supported.
* OemData (optional) - Length is OemDataLength.
*/
} ACPI_DBG2_DEVICE;
/* Types for PortType field above */
#define ACPI_DBG2_SERIAL_PORT 0x8000
#define ACPI_DBG2_1394_PORT 0x8001
#define ACPI_DBG2_USB_PORT 0x8002
#define ACPI_DBG2_NET_PORT 0x8003
/* Subtypes for PortSubtype field above */
#define ACPI_DBG2_16550_COMPATIBLE 0x0000
#define ACPI_DBG2_16550_SUBSET 0x0001
#define ACPI_DBG2_1394_STANDARD 0x0000
#define ACPI_DBG2_USB_XHCI 0x0000
#define ACPI_DBG2_USB_EHCI 0x0001
/*******************************************************************************
*
* DBGP - Debug Port table

View File

@ -77,7 +77,6 @@
/* Reserved table signatures */
#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
@ -89,9 +88,15 @@
#pragma pack(1)
/*
* Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
* This is the only type that is even remotely portable. Anything else is not
* portable, so do not use any other bitfield types.
* Note: C bitfields are not used for this reason:
*
* "Bitfields are great and easy to read, but unfortunately the C language
* does not specify the layout of bitfields in memory, which means they are
* essentially useless for dealing with packed data in on-disk formats or
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
* this decision was a design error in C. Ritchie could have picked an order
* and stuck with it." Norman Ramsey.
* See http://stackoverflow.com/a/1053662/41661
*/

View File

@ -519,13 +519,6 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_SLEEP_TYPE_MAX 0x7
#define ACPI_SLEEP_TYPE_INVALID 0xFF
/*
* Sleep/Wake flags
*/
#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */
#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */
#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */
/*
* Standard notify values
*/
@ -809,8 +802,7 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
/* Sleep function dispatch */
typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) (
UINT8 SleepState,
UINT8 Flags);
UINT8 SleepState);
typedef struct acpi_sleep_functions
{

View File

@ -180,6 +180,9 @@
#elif defined(_AED_EFI)
#include "acefi.h"
#elif defined(__HAIKU__)
#include "achaiku.h"
#else
/* Unknown environment */

View File

@ -353,7 +353,7 @@ AcpiOsGetLine (
UINT32 BufferLength,
UINT32 *BytesRead)
{
UINT8 Temp;
int Temp;
UINT32 i;
@ -364,13 +364,17 @@ AcpiOsGetLine (
return (AE_BUFFER_OVERFLOW);
}
scanf ("%1c", &Temp);
if ((Temp = getchar ()) == EOF)
{
return (AE_ERROR);
}
if (!Temp || Temp == '\n')
{
break;
}
Buffer [i] = Temp;
Buffer [i] = (char) Temp;
}
/* Null terminate the buffer */

View File

@ -97,9 +97,6 @@ struct mtx acpi_mutex;
/* Bitmap of device quirks. */
int acpi_quirks;
/* Optional ACPI methods for suspend and resume, e.g., _GTS and _BFS. */
int acpi_sleep_flags;
/* Supported sleep states. */
static BOOLEAN acpi_sleep_states[ACPI_S_STATE_COUNT];
@ -292,11 +289,6 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG_RW,
/* Allow users to override quirks. */
TUNABLE_INT("debug.acpi.quirks", &acpi_quirks);
/* Execute optional ACPI methods for suspend and resume. */
TUNABLE_INT("debug.acpi.sleep_flags", &acpi_sleep_flags);
SYSCTL_INT(_debug_acpi, OID_AUTO, sleep_flags, CTLFLAG_RW | CTLFLAG_TUN,
&acpi_sleep_flags, 0, "Execute optional ACPI methods for suspend/resume.");
static int acpi_susp_bounce;
SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW,
&acpi_susp_bounce, 0, "Don't actually suspend, just test devices.");
@ -1985,7 +1977,7 @@ acpi_shutdown_final(void *arg, int howto)
}
device_printf(sc->acpi_dev, "Powering system off\n");
intr = intr_disable();
status = AcpiEnterSleepState(ACPI_STATE_S5, acpi_sleep_flags);
status = AcpiEnterSleepState(ACPI_STATE_S5);
if (ACPI_FAILURE(status)) {
intr_restore(intr);
device_printf(sc->acpi_dev, "power-off failed - %s\n",
@ -2750,7 +2742,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
if (state != ACPI_STATE_S1) {
sleep_result = acpi_sleep_machdep(sc, state);
acpi_wakeup_machdep(sc, state, sleep_result, 0);
AcpiLeaveSleepStatePrep(state, acpi_sleep_flags);
AcpiLeaveSleepStatePrep(state);
intr_restore(intr);
/* call acpi_wakeup_machdep() again with interrupt enabled */
@ -2763,8 +2755,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
if (state == ACPI_STATE_S4)
AcpiEnable();
} else {
status = AcpiEnterSleepState(state, acpi_sleep_flags);
AcpiLeaveSleepStatePrep(state, acpi_sleep_flags);
status = AcpiEnterSleepState(state);
AcpiLeaveSleepStatePrep(state);
intr_restore(intr);
if (ACPI_FAILURE(status)) {
device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n",

View File

@ -214,11 +214,6 @@ extern int acpi_quirks;
#define ACPI_Q_TIMER (1 << 1)
#define ACPI_Q_MADT_IRQ0 (1 << 2)
/*
* Sleep flags. See actypes.h for available flags.
*/
extern int acpi_sleep_flags;
/*
* Note that the low ivar values are reserved to provide
* interface compatibility with ISA drivers which can also

View File

@ -58,7 +58,7 @@ SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c tbxfload.c tbxfroot.c
SRCS+= utaddress.c utalloc.c utcache.c utcopy.c utdebug.c utdecode.c
SRCS+= utdelete.c uteval.c utexcep.c utglobal.c utids.c utinit.c utlock.c
SRCS+= utmath.c utmisc.c utmutex.c utobject.c utosi.c utresrc.c utstate.c
SRCS+= utxface.c utxferror.c
SRCS+= utxface.c utxferror.c utxfinit.c
#SRCS+= utxfmutex.c
# OSPM layer and core hardware drivers

View File

@ -225,7 +225,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
status = AcpiEnterSleepStateS4bios();
else
status = AcpiEnterSleepState(state, acpi_sleep_flags);
status = AcpiEnterSleepState(state);
if (ACPI_FAILURE(status)) {
device_printf(sc->acpi_dev,
"AcpiEnterSleepState failed - %s\n",

View File

@ -60,7 +60,7 @@ SRCS+= utaddress.c utalloc.c utcache.c utcopy.c utdebug.c \
utdecode.c utdelete.c uteval.c utexcep.c utglobal.c \
utids.c utinit.c utlock.c utmath.c utmisc.c utmutex.c \
utobject.c utosi.c utresrc.c utstate.c uttrack.c \
utxface.c utxferror.c
utxface.c utxferror.c utxfinit.c
MAN= acpidb.8
WARNS?= 2