Merge acpi from acpica vendor branch 20100428:
* AcpiSetGpeType no longer exists, replaced with AcpiSetGpe. Since acpi changed gpe handling embedded controller might need improvements. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36867 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c88bc5e973
commit
ffb873afec
@ -170,8 +170,8 @@ struct acpi_module_info {
|
||||
|
||||
status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint32 flags);
|
||||
status_t (*set_gpe_type)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint8 type);
|
||||
status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint8 action);
|
||||
status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint32 type, acpi_event_handler handler, void *data);
|
||||
status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber,
|
||||
|
@ -10,6 +10,8 @@ local events_src =
|
||||
evevent.c
|
||||
evgpe.c
|
||||
evgpeblk.c
|
||||
evgpeinit.c
|
||||
evgpeutil.c
|
||||
evmisc.c
|
||||
evregion.c
|
||||
evrgnini.c
|
||||
@ -56,6 +58,7 @@ local executer_src =
|
||||
exconfig.c
|
||||
exconvrt.c
|
||||
excreate.c
|
||||
exdebug.c
|
||||
exdump.c
|
||||
exfield.c
|
||||
exfldio.c
|
||||
|
@ -267,9 +267,9 @@ enable_gpe(acpi_handle handle, uint32 gpeNumber, uint32 flags)
|
||||
|
||||
|
||||
status_t
|
||||
set_gpe_type(acpi_handle handle, uint32 gpeNumber, uint8 type)
|
||||
set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action)
|
||||
{
|
||||
return AcpiSetGpeType(handle, gpeNumber, type) == AE_OK ? B_OK : B_ERROR;
|
||||
return AcpiSetGpe(handle, gpeNumber, action) == AE_OK ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -651,7 +651,7 @@ struct acpi_module_info gACPIModule = {
|
||||
install_notify_handler,
|
||||
remove_notify_handler,
|
||||
enable_gpe,
|
||||
set_gpe_type,
|
||||
set_gpe,
|
||||
install_gpe_handler,
|
||||
remove_gpe_handler,
|
||||
install_address_space_handler,
|
||||
|
@ -374,8 +374,8 @@ embedded_controller_init_driver(device_node* dev, void** _driverCookie)
|
||||
}
|
||||
|
||||
// Enable runtime GPEs for the handler.
|
||||
status = sc->ec_acpi_module->set_gpe_type(sc->ec_gpehandle, sc->ec_gpebit,
|
||||
ACPI_GPE_TYPE_RUNTIME);
|
||||
status = sc->ec_acpi_module->set_gpe(sc->ec_gpehandle, sc->ec_gpebit,
|
||||
ACPI_GPE_ENABLE);
|
||||
if (status != B_OK) {
|
||||
TRACE("AcpiSetGpeType failed.\n");
|
||||
goto error;
|
||||
|
@ -197,7 +197,7 @@ static struct acpi_root_info sACPIRootModule = {
|
||||
install_notify_handler,
|
||||
remove_notify_handler,
|
||||
enable_gpe,
|
||||
set_gpe_type,
|
||||
set_gpe,
|
||||
install_gpe_handler,
|
||||
remove_gpe_handler,
|
||||
install_address_space_handler,
|
||||
|
@ -62,8 +62,8 @@ typedef struct acpi_root_info {
|
||||
|
||||
status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint32 flags);
|
||||
status_t (*set_gpe_type)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint8 type);
|
||||
status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint8 action);
|
||||
status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber,
|
||||
uint32 type, acpi_event_handler handler, void* data);
|
||||
status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber,
|
||||
@ -143,7 +143,7 @@ status_t remove_notify_handler(acpi_handle device, uint32 handlerType,
|
||||
acpi_notify_handler handler);
|
||||
|
||||
status_t enable_gpe(acpi_handle handle, uint32 gpeNumber, uint32 flags);
|
||||
status_t set_gpe_type(acpi_handle handle, uint32 gpeNumber, uint8 type);
|
||||
status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action);
|
||||
status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type,
|
||||
acpi_event_handler handler, void* data);
|
||||
status_t remove_gpe_handler(acpi_handle handle, uint32 gpeNumber,
|
||||
|
@ -282,8 +282,8 @@ AdInitialize (
|
||||
|
||||
/* Setup the Table Manager (cheat - there is no RSDT) */
|
||||
|
||||
AcpiGbl_RootTableList.Size = 1;
|
||||
AcpiGbl_RootTableList.Count = 0;
|
||||
AcpiGbl_RootTableList.MaxTableCount = 1;
|
||||
AcpiGbl_RootTableList.CurrentTableCount = 0;
|
||||
AcpiGbl_RootTableList.Tables = LocalTables;
|
||||
|
||||
return (Status);
|
||||
@ -1156,7 +1156,7 @@ AdParseTable (
|
||||
|
||||
/* If LoadTable is FALSE, we are parsing the last loaded table */
|
||||
|
||||
TableIndex = AcpiGbl_RootTableList.Count - 1;
|
||||
TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
|
||||
|
||||
/* Pass 2 */
|
||||
|
||||
|
@ -270,6 +270,15 @@ AcpiDmNormalizeParentPrefix (
|
||||
}
|
||||
|
||||
Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1);
|
||||
if (ParentPath[1])
|
||||
{
|
||||
/*
|
||||
* If ParentPath is not just a simple '\', increment the length
|
||||
* for the required dot separator (ParentPath.Path)
|
||||
*/
|
||||
Length++;
|
||||
}
|
||||
|
||||
Fullpath = ACPI_ALLOCATE_ZEROED (Length);
|
||||
if (!Fullpath)
|
||||
{
|
||||
@ -374,7 +383,7 @@ AcpiDmAddToExternalList (
|
||||
(NextExternal->Value != Value))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Argument count mismatch for method %s %d %d",
|
||||
"Argument count mismatch for method %s %u %u",
|
||||
NextExternal->Path, NextExternal->Value, Value));
|
||||
}
|
||||
|
||||
|
@ -262,6 +262,7 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
|
||||
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
|
||||
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
|
||||
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"},
|
||||
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"},
|
||||
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
|
||||
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
|
||||
@ -911,7 +912,7 @@ AcpiDmDumpTable (
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"**** Invalid table opcode [%X] ****\n", Info->Opcode));
|
||||
"**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
|
||||
return (AE_SUPPORT);
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ AcpiDmDumpAsf (
|
||||
break;
|
||||
|
||||
default:
|
||||
AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
|
||||
AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -561,7 +561,7 @@ AcpiDmDumpDmar (
|
||||
ScopeOffset = sizeof (ACPI_DMAR_RHSA);
|
||||
break;
|
||||
default:
|
||||
AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
|
||||
AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -809,7 +809,7 @@ AcpiDmDumpHest (
|
||||
default:
|
||||
/* Cannot continue on unknown type - no length */
|
||||
|
||||
AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type);
|
||||
AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -916,7 +916,7 @@ AcpiDmDumpIvrs (
|
||||
InfoTable = AcpiDmTableInfoIvrs1;
|
||||
break;
|
||||
default:
|
||||
AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n",
|
||||
AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n",
|
||||
SubTable->Type);
|
||||
|
||||
/* Attempt to continue */
|
||||
@ -1002,7 +1002,7 @@ AcpiDmDumpIvrs (
|
||||
InfoTable = AcpiDmTableInfoIvrs4;
|
||||
AcpiOsPrintf (
|
||||
"\n**** Unknown IVRS device entry type/length: "
|
||||
"%.2X/%X at offset %.4X: (header below)\n",
|
||||
"0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
|
||||
EntryType, EntryLength, EntryOffset);
|
||||
break;
|
||||
}
|
||||
@ -1110,7 +1110,7 @@ AcpiDmDumpMadt (
|
||||
InfoTable = AcpiDmTableInfoMadt10;
|
||||
break;
|
||||
default:
|
||||
AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
|
||||
AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type);
|
||||
|
||||
/* Attempt to continue */
|
||||
|
||||
@ -1378,7 +1378,7 @@ AcpiDmDumpSrat (
|
||||
InfoTable = AcpiDmTableInfoSrat2;
|
||||
break;
|
||||
default:
|
||||
AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
|
||||
AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type);
|
||||
|
||||
/* Attempt to continue */
|
||||
|
||||
|
@ -142,6 +142,7 @@
|
||||
#define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f)
|
||||
#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f)
|
||||
#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f)
|
||||
#define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f)
|
||||
#define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f)
|
||||
#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f)
|
||||
#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
|
||||
@ -1224,6 +1225,30 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] =
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* MCHI - Management Controller Host Interface table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] =
|
||||
{
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol"},
|
||||
{ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag"},
|
||||
{ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt"},
|
||||
{ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device"},
|
||||
{ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function"},
|
||||
{ACPI_DMT_EXIT, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* MSCT - Maximum System Characteristics Table (ACPI 4.0)
|
||||
|
@ -1,11 +1,37 @@
|
||||
|
||||
|
||||
PROG= iasl
|
||||
SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
|
||||
aslcompile.c aslerror.c aslfiles.c asllength.c \
|
||||
asllisting.c aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \
|
||||
asloperands.c aslresource.c aslrestype1.c aslrestype2.c aslstartup.c \
|
||||
asltree.c aslutils.c asltransform.c aslfold.c aslstubs.c aslopt.c \
|
||||
SRCS= \
|
||||
aslcompilerparse.c \
|
||||
aslcompilerlex.c \
|
||||
aslanalyze.c \
|
||||
aslcodegen.c \
|
||||
aslcompile.c \
|
||||
aslerror.c \
|
||||
aslfiles.c \
|
||||
aslfold.c \
|
||||
asllength.c \
|
||||
asllisting.c \
|
||||
aslload.c \
|
||||
asllookup.c \
|
||||
aslmain.c \
|
||||
aslmap.c \
|
||||
aslopcodes.c \
|
||||
asloperands.c \
|
||||
aslopt.c \
|
||||
aslpredef.c \
|
||||
aslresource.c \
|
||||
aslrestype1.c \
|
||||
aslrestype1i.c \
|
||||
aslrestype2.c \
|
||||
aslrestype2d.c \
|
||||
aslrestype2e.c \
|
||||
aslrestype2q.c \
|
||||
aslrestype2w.c \
|
||||
aslstartup.c \
|
||||
aslstubs.c \
|
||||
asltransform.c \
|
||||
asltree.c \
|
||||
aslutils.c \
|
||||
../common/getopt.c \
|
||||
../utilities/utalloc.c \
|
||||
../utilities/utcache.c \
|
||||
|
@ -142,16 +142,6 @@ static UINT32
|
||||
AnGetBtype (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
static UINT32
|
||||
AnCheckForReservedName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name);
|
||||
|
||||
static void
|
||||
AnCheckForReservedMethod (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo);
|
||||
|
||||
static UINT32
|
||||
AnMapObjTypeToBtype (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
@ -596,219 +586,6 @@ AnGetBtype (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AnCheckForReservedName
|
||||
*
|
||||
* PARAMETERS: Op - A parse node
|
||||
* Name - NameSeg to check
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check a NameSeg against the reserved list.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static UINT32
|
||||
AnCheckForReservedName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
if (Name[0] == 0)
|
||||
{
|
||||
AcpiOsPrintf ("Found a null name, external = %s\n",
|
||||
Op->Asl.ExternalName);
|
||||
}
|
||||
|
||||
/* All reserved names are prefixed with a single underscore */
|
||||
|
||||
if (Name[0] != '_')
|
||||
{
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/* Check for a standard reserved method name */
|
||||
|
||||
for (i = 0; ReservedMethods[i].Name; i++)
|
||||
{
|
||||
if (ACPI_COMPARE_NAME (Name, ReservedMethods[i].Name))
|
||||
{
|
||||
if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op,
|
||||
Op->Asl.ExternalName);
|
||||
return (ACPI_PREDEFINED_NAME);
|
||||
}
|
||||
else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op,
|
||||
Op->Asl.ExternalName);
|
||||
return (ACPI_PREDEFINED_NAME);
|
||||
}
|
||||
|
||||
/* Return index into reserved array */
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now check for the "special" reserved names --
|
||||
* GPE: _Lxx
|
||||
* GPE: _Exx
|
||||
* EC: _Qxx
|
||||
*/
|
||||
if ((Name[1] == 'L') ||
|
||||
(Name[1] == 'E') ||
|
||||
(Name[1] == 'Q'))
|
||||
{
|
||||
/* The next two characters must be hex digits */
|
||||
|
||||
if ((isxdigit ((int) Name[2])) &&
|
||||
(isxdigit ((int) Name[3])))
|
||||
{
|
||||
return (ACPI_EVENT_RESERVED_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check for the names reserved for the compiler itself: _T_x */
|
||||
|
||||
else if ((Op->Asl.ExternalName[1] == 'T') &&
|
||||
(Op->Asl.ExternalName[2] == '_'))
|
||||
{
|
||||
/* Ignore if actually emitted by the compiler */
|
||||
|
||||
if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED)
|
||||
{
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* Was not actually emitted by the compiler. This is a special case,
|
||||
* however. If the ASL code being compiled was the result of a
|
||||
* dissasembly, it may possibly contain valid compiler-emitted names
|
||||
* of the form "_T_x". We don't want to issue an error or even a
|
||||
* warning and force the user to manually change the names. So, we
|
||||
* will issue a remark instead.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
|
||||
return (ACPI_COMPILER_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* The name didn't match any of the known reserved names. Flag it as a
|
||||
* warning, since the entire namespace starting with an underscore is
|
||||
* reserved by the ACPI spec.
|
||||
*/
|
||||
AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
|
||||
Op->Asl.ExternalName);
|
||||
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AnCheckForReservedMethod
|
||||
*
|
||||
* PARAMETERS: Op - A parse node of type "METHOD".
|
||||
* MethodInfo - Saved info about this method
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: If method is a reserved name, check that the number of arguments
|
||||
* and the return type (returns a value or not) is correct.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
AnCheckForReservedMethod (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 RequiredArgsCurrent;
|
||||
UINT32 RequiredArgsOld;
|
||||
|
||||
|
||||
/* Check for a match against the reserved name list */
|
||||
|
||||
Index = AnCheckForReservedName (Op, Op->Asl.NameSeg);
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case ACPI_NOT_RESERVED_NAME:
|
||||
case ACPI_PREDEFINED_NAME:
|
||||
case ACPI_COMPILER_RESERVED_NAME:
|
||||
|
||||
/* Just return, nothing to do */
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_EVENT_RESERVED_NAME:
|
||||
|
||||
Gbl_ReservedMethods++;
|
||||
|
||||
/* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */
|
||||
|
||||
if (MethodInfo->NumArguments != 0)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %d",
|
||||
Op->Asl.ExternalName, 0);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
Gbl_ReservedMethods++;
|
||||
|
||||
/*
|
||||
* Matched a reserved method name
|
||||
*
|
||||
* Validate the ASL-defined argument count. Allow two different legal
|
||||
* arg counts.
|
||||
*/
|
||||
RequiredArgsCurrent = ReservedMethods[Index].NumArguments & 0x0F;
|
||||
RequiredArgsOld = ReservedMethods[Index].NumArguments >> 4;
|
||||
|
||||
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
|
||||
(MethodInfo->NumArguments != RequiredArgsOld))
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %d",
|
||||
ReservedMethods[Index].Name,
|
||||
RequiredArgsCurrent);
|
||||
|
||||
if (MethodInfo->NumArguments > RequiredArgsCurrent)
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (MethodInfo->NumReturnNoValue &&
|
||||
ReservedMethods[Index].Flags & ASL_RSVD_RETURN_VALUE)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s", ReservedMethods[Index].Name);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, MsgBuffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AnMapObjTypeToBtype
|
||||
@ -1187,7 +964,7 @@ AnMethodAnalysisWalkBegin (
|
||||
* The first operand is a name to be created in the namespace.
|
||||
* Check against the reserved list.
|
||||
*/
|
||||
i = AnCheckForReservedName (Op, Op->Asl.NameSeg);
|
||||
i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
|
||||
if (i < ACPI_VALID_RESERVED_NAME_MAX)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
|
||||
@ -1197,51 +974,29 @@ AnMethodAnalysisWalkBegin (
|
||||
|
||||
case PARSEOP_NAME:
|
||||
|
||||
i = AnCheckForReservedName (Op, Op->Asl.NameSeg);
|
||||
if (i < ACPI_VALID_RESERVED_NAME_MAX)
|
||||
/* Typecheck any predefined names statically defined with Name() */
|
||||
|
||||
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
|
||||
|
||||
/* Special typechecking for _HID */
|
||||
|
||||
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
|
||||
{
|
||||
if (ReservedMethods[i].NumArguments > 0)
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
|
||||
{
|
||||
/*
|
||||
* This reserved name must be a control method because
|
||||
* it must have arguments
|
||||
* _HID is a string, all characters must be alphanumeric.
|
||||
* One of the things we want to catch here is the use of
|
||||
* a leading asterisk in the string.
|
||||
*/
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with arguments");
|
||||
}
|
||||
|
||||
/* Typechecking for _HID */
|
||||
|
||||
else if (!ACPI_STRCMP (METHOD_NAME__HID, ReservedMethods[i].Name))
|
||||
{
|
||||
/* Examine the second operand to typecheck it */
|
||||
|
||||
Next = Op->Asl.Child->Asl.Next;
|
||||
|
||||
if ((Next->Asl.ParseOpcode != PARSEOP_INTEGER) &&
|
||||
(Next->Asl.ParseOpcode != PARSEOP_STRING_LITERAL))
|
||||
for (i = 0; Next->Asl.Value.String[i]; i++)
|
||||
{
|
||||
/* _HID must be a string or an integer */
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next,
|
||||
"String or Integer");
|
||||
}
|
||||
|
||||
if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
|
||||
{
|
||||
/*
|
||||
* _HID is a string, all characters must be alphanumeric.
|
||||
* One of the things we want to catch here is the use of
|
||||
* a leading asterisk in the string.
|
||||
*/
|
||||
for (i = 0; Next->Asl.Value.String[i]; i++)
|
||||
if (!isalnum ((int) Next->Asl.Value.String[i]))
|
||||
{
|
||||
if (!isalnum ((int) Next->Asl.Value.String[i]))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
|
||||
Next, Next->Asl.Value.String);
|
||||
break;
|
||||
}
|
||||
AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
|
||||
Next, Next->Asl.Value.String);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1394,13 +1149,19 @@ AnMethodAnalysisWalkEnd (
|
||||
* Check predefined method names for correct return behavior
|
||||
* and correct number of arguments
|
||||
*/
|
||||
AnCheckForReservedMethod (Op, MethodInfo);
|
||||
ApCheckForPredefinedMethod (Op, MethodInfo);
|
||||
ACPI_FREE (MethodInfo);
|
||||
break;
|
||||
|
||||
|
||||
case PARSEOP_RETURN:
|
||||
|
||||
/*
|
||||
* If the parent is a predefined method name, attempt to typecheck
|
||||
* the return value. Only static types can be validated.
|
||||
*/
|
||||
ApCheckPredefinedReturnValue (Op, MethodInfo);
|
||||
|
||||
/*
|
||||
* The parent block does not "exit" and continue execution -- the
|
||||
* method is terminated here with the Return() statement.
|
||||
|
@ -177,7 +177,8 @@ AslCompilerSignon (
|
||||
{
|
||||
Prefix = "; ";
|
||||
}
|
||||
else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
|
||||
else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
|
||||
(Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
|
||||
Prefix = " * ";
|
||||
@ -265,7 +266,8 @@ AslCompilerFileHeader (
|
||||
{
|
||||
Prefix = "; ";
|
||||
}
|
||||
else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
|
||||
else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
|
||||
(Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
|
||||
{
|
||||
Prefix = " * ";
|
||||
}
|
||||
|
@ -452,8 +452,32 @@ ACPI_OBJECT_TYPE
|
||||
AslMapNamedOpcodeToDataType (
|
||||
UINT16 Opcode);
|
||||
|
||||
|
||||
/*
|
||||
* aslpredef - ACPI predefined names support
|
||||
*/
|
||||
void
|
||||
MpDisplayReservedNames (
|
||||
ApCheckForPredefinedMethod (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo);
|
||||
|
||||
void
|
||||
ApCheckPredefinedReturnValue (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo);
|
||||
|
||||
UINT32
|
||||
ApCheckForPredefinedName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name);
|
||||
|
||||
void
|
||||
ApCheckForPredefinedObject (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name);
|
||||
|
||||
void
|
||||
ApDisplayReservedNames (
|
||||
void);
|
||||
|
||||
|
||||
@ -568,6 +592,10 @@ FlFileError (
|
||||
UINT32 FileId,
|
||||
UINT8 ErrorId);
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId);
|
||||
|
||||
ACPI_STATUS
|
||||
FlReadFile (
|
||||
UINT32 FileId,
|
||||
@ -726,6 +754,34 @@ UtDoConstant (
|
||||
/*
|
||||
* aslresource - Resource template generation utilities
|
||||
*/
|
||||
void
|
||||
RsSmallAddressCheck (
|
||||
UINT8 Type,
|
||||
UINT32 Minimum,
|
||||
UINT32 Maximum,
|
||||
UINT32 Length,
|
||||
UINT32 Alignment,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *AlignOp);
|
||||
|
||||
void
|
||||
RsLargeAddressCheck (
|
||||
UINT64 Minimum,
|
||||
UINT64 Maximum,
|
||||
UINT64 Length,
|
||||
UINT64 Granularity,
|
||||
UINT8 Flags,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *GranOp);
|
||||
|
||||
UINT16
|
||||
RsGetStringDataLength (
|
||||
ACPI_PARSE_OBJECT *InitializerOp);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsAllocateResourceNode (
|
||||
UINT32 Size);
|
||||
@ -781,43 +837,18 @@ RsDoResourceTemplate (
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype1 - generate Small descriptors
|
||||
* aslrestype1 - Miscellaneous Small descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoEndTagDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoEndDependentDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoMemory24Descriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -850,7 +881,36 @@ RsDoVendorSmallDescriptor (
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2 - generate Large descriptors
|
||||
* aslrestype1i - I/O-related Small descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2 - Large resource descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoInterruptDescriptor (
|
||||
@ -858,6 +918,20 @@ RsDoInterruptDescriptor (
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorLargeDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoGeneralRegisterDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2d - DWord address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
@ -872,6 +946,10 @@ RsDoDwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2e - Extended address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -887,6 +965,10 @@ RsDoExtendedSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2q - QWord address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -902,6 +984,10 @@ RsDoQwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2w - Word address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -917,15 +1003,5 @@ RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorLargeDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoGeneralRegisterDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
#endif /* __ASLCOMPILER_H */
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
#define CompilerId "ASL Optimizing Compiler"
|
||||
#define DisassemblerId "AML Disassembler"
|
||||
#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation"
|
||||
#define CompilerCompliance "Supports ACPI Specification Revision 4.0"
|
||||
#define CompilerCompliance "Supports ACPI Specification Revision 4.0a"
|
||||
#define CompilerName "iasl"
|
||||
#define CompilerCreatorId "INTL"
|
||||
|
||||
|
@ -234,6 +234,36 @@ FlOpenFile (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlGetFileSize
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: File Size
|
||||
*
|
||||
* DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId)
|
||||
{
|
||||
FILE *fp;
|
||||
UINT32 FileSize;
|
||||
|
||||
|
||||
fp = Gbl_Files[FileId].Handle;
|
||||
|
||||
fseek (fp, 0, SEEK_END);
|
||||
FileSize = (UINT32) ftell (fp);
|
||||
fseek (fp, 0, SEEK_SET);
|
||||
|
||||
return (FileSize);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlReadFile
|
||||
|
@ -188,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
|
||||
@ -200,6 +201,8 @@ ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNI
|
||||
#define HEX_OUTPUT_NONE 0
|
||||
#define HEX_OUTPUT_C 1
|
||||
#define HEX_OUTPUT_ASM 2
|
||||
#define HEX_OUTPUT_ASL 3
|
||||
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
|
||||
|
||||
|
||||
@ -261,7 +264,6 @@ ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswin
|
||||
|
||||
ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo;
|
||||
ASL_EXTERN ACPI_TABLE_HEADER TableHeader;
|
||||
extern const ASL_RESERVED_INFO ReservedMethods[];
|
||||
|
||||
/* Event timing */
|
||||
|
||||
|
@ -198,6 +198,10 @@ static void
|
||||
LsDoHexOutputAsm (
|
||||
void);
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
LsTreeWriteWalk (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -1337,6 +1341,11 @@ LsDoHexOutput (
|
||||
LsDoHexOutputAsm ();
|
||||
break;
|
||||
|
||||
case HEX_OUTPUT_ASL:
|
||||
|
||||
LsDoHexOutputAsl ();
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No other output types supported */
|
||||
break;
|
||||
@ -1362,60 +1371,160 @@ static void
|
||||
LsDoHexOutputC (
|
||||
void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_TABLE_LINE_SIZE];
|
||||
UINT8 Buffer[4];
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
|
||||
|
||||
/* Start at the beginning of the AML file */
|
||||
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
/* Process all AML bytes in the AML file */
|
||||
|
||||
j = 0;
|
||||
while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
if (j == 0)
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert each AML byte to hex */
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
UtConvertByteToHex (FileByte[j], Buffer);
|
||||
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
|
||||
/* An occasional linefeed improves readability */
|
||||
|
||||
Offset++;
|
||||
j++;
|
||||
|
||||
if (j >= HEX_TABLE_LINE_SIZE)
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/* End of line, emit the ascii dump of the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT,
|
||||
" /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
|
||||
|
||||
/* Write the ASCII character associated with each of the bytes */
|
||||
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT,
|
||||
HEX_TABLE_LINE_SIZE, FileByte);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n");
|
||||
|
||||
/* Start new line */
|
||||
|
||||
j = 0;
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
|
||||
FlCloseFile (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoHexOutputAsl
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file. This is the same data as the AML
|
||||
* output file, but formatted into hex/ascii bytes suitable for
|
||||
* inclusion into a C source file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
|
||||
FlCloseFile (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
||||
@ -1438,58 +1547,64 @@ static void
|
||||
LsDoHexOutputAsm (
|
||||
void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_TABLE_LINE_SIZE];
|
||||
UINT8 Buffer[4];
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
BOOLEAN DoComma = FALSE;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n");
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
/* Start at the beginning of the AML file */
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
|
||||
AmlFileSize);
|
||||
|
||||
/* Process all AML bytes in the AML file */
|
||||
|
||||
j = 0;
|
||||
while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
if (j == 0)
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
}
|
||||
else if (DoComma)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
DoComma = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert each AML byte to hex */
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
|
||||
UtConvertByteToAsmHex (FileByte[j], Buffer);
|
||||
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
|
||||
|
||||
/* An occasional linefeed improves readability */
|
||||
|
||||
Offset++;
|
||||
j++;
|
||||
if (j >= HEX_TABLE_LINE_SIZE)
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT,
|
||||
" ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
|
||||
|
||||
/* Write the ASCII character associated with each of the bytes */
|
||||
|
||||
LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
j = 0;
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the last byte of the line
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
|
||||
if ((i + 1) < LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
DoComma = TRUE;
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
@ -167,7 +167,7 @@ AslDoResponseFile (
|
||||
|
||||
|
||||
#define ASL_TOKEN_SEPARATORS " \t\n"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -203,13 +203,14 @@ Options (
|
||||
printf ("\nAML Output Files:\n");
|
||||
printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
|
||||
printf (" -i<a|c> Create assembler or C include file (*.inc or *.h)\n");
|
||||
printf (" -t<a|c> Create AML in assembler or C hex table (*.hex)\n");
|
||||
printf (" -t<a|c|s> Create AML in assembler, C, or ASL hex table (*.hex)\n");
|
||||
|
||||
printf ("\nAML Code Generation:\n");
|
||||
printf (" -oa Disable all optimizations (compatibility mode)\n");
|
||||
printf (" -of Disable constant folding\n");
|
||||
printf (" -oi Disable integer optimization to Zero/One/Ones\n");
|
||||
printf (" -on Disable named reference string optimization\n");
|
||||
printf (" -cr Disable Resource Descriptor error checking\n");
|
||||
printf (" -r<Revision> Override table header Revision (1-255)\n");
|
||||
|
||||
printf ("\nListings:\n");
|
||||
@ -264,7 +265,7 @@ HelpMessage (
|
||||
printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
|
||||
printf (" Types: Parse/Tree/Both\n");
|
||||
printf (" -f Ignore errors, force creation of AML output file(s)\n");
|
||||
printf (" -c Parse only, no output generation\n");
|
||||
printf (" -n Parse only, no output generation\n");
|
||||
printf (" -ot Display compile times\n");
|
||||
printf (" -x<level> Set debug level for trace output\n");
|
||||
}
|
||||
@ -507,10 +508,16 @@ AslDoOptions (
|
||||
|
||||
|
||||
case 'c':
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case 'r':
|
||||
Gbl_NoResourceChecking = TRUE;
|
||||
break;
|
||||
|
||||
/* Parse only */
|
||||
|
||||
Gbl_ParseOnlyFlag = TRUE;
|
||||
default:
|
||||
printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -570,7 +577,7 @@ AslDoOptions (
|
||||
case 'r':
|
||||
/* reserved names */
|
||||
|
||||
MpDisplayReservedNames ();
|
||||
ApDisplayReservedNames ();
|
||||
exit (0);
|
||||
|
||||
default:
|
||||
@ -688,6 +695,14 @@ AslDoOptions (
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
|
||||
/* Parse only */
|
||||
|
||||
Gbl_ParseOnlyFlag = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case 'p':
|
||||
|
||||
/* Override default AML output filename */
|
||||
@ -741,6 +756,10 @@ AslDoOptions (
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_C;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_ASL;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
|
@ -114,7 +114,6 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "amlcode.h"
|
||||
#include "acparser.h"
|
||||
@ -169,322 +168,6 @@ AslMapNamedOpcodeToDataType (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: MpDisplayReservedNames
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Print the table above
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
MpDisplayReservedNames (
|
||||
void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
printf ("Reserved name information\n\n");
|
||||
|
||||
for (i = 0; ReservedMethods[i].Name; i++)
|
||||
{
|
||||
printf ("%s ", ReservedMethods[i].Name);
|
||||
|
||||
if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
|
||||
{
|
||||
printf ("Reserved scope name\n");
|
||||
}
|
||||
else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
|
||||
{
|
||||
printf ("Resource data type reserved field name\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("Method with %d arguments, ",
|
||||
ReservedMethods[i].NumArguments & 0x0F);
|
||||
|
||||
if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
|
||||
{
|
||||
printf ("must return a value\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("no return value\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* DATA STRUCTURE: ReservedMethods
|
||||
*
|
||||
* DESCRIPTION: Contains all reserved methods and names as defined in the
|
||||
* ACPI specification. Used during the analysis phase to
|
||||
* ensure that reserved methods have the required number of
|
||||
* arguments and the proper return type.
|
||||
*
|
||||
* Each entry in the table contains the following items:
|
||||
*
|
||||
* Name - The ACPI reserved name
|
||||
* Args - Number of arguments to the method
|
||||
* Flags - Whether this method must return a value or not. Or if the
|
||||
* name is a resource descriptor label.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const ASL_RESERVED_INFO ReservedMethods[] = {
|
||||
{"_AC0", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC1", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC2", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC3", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC4", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC5", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC6", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC7", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC8", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AC9", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_ADR", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL0", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL1", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL2", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL3", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL4", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL5", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL6", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL7", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL8", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_AL9", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_ALC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_ALI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_ALN", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_ALP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_ART", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_ASI", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_ASZ", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_BAS", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_BBN", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_BCL", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_BCM", 1, 0},
|
||||
{"_BCT", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_BDN", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_BFS", 1, 0},
|
||||
{"_BIF", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_BIX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_BLT", 3, 0}, /* Acpi 3.0 */
|
||||
{"_BM_", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_BMA", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_BMC", 1, 0}, /* Acpi 3.0 */
|
||||
{"_BMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_BMS", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_BQC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_BST", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_BTM", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_BTP", 1, 0},
|
||||
{"_CBA", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_CDM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_CID", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_CRS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_CRT", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_CSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_CST", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DCK", 1, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DCS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DDC", 1, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DDN", 0, 0},
|
||||
{"_DEC", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_DGS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DIS", 0, 0},
|
||||
{"_DMA", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DOD", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_DOS", 1, 0},
|
||||
{"_DSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_DSS", 1, 0},
|
||||
{"_DSW", 3, 0}, /* Acpi 3.0 */
|
||||
{"_DTI", 1, 0}, /* Acpi 4.0 */
|
||||
{"_EC_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_EDL", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_EJ0", 1, 0},
|
||||
{"_EJ1", 1, 0},
|
||||
{"_EJ2", 1, 0},
|
||||
{"_EJ3", 1, 0},
|
||||
{"_EJ4", 1, 0},
|
||||
{"_EJD", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_ERR", 3, ASL_RSVD_RETURN_VALUE},
|
||||
{"_FDE", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_FDI", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_FDM", 1, 0},
|
||||
{"_FIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_FIX", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_FPS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_FSL", 1, 0}, /* Acpi 4.0 */
|
||||
{"_FST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_GAI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_GHL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_GL_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GLK", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GPD", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GPE", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GRA", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_GSB", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_GTF", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GTM", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_GTS", 1, 0},
|
||||
{"_HE_", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_HID", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_HOT", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_HPP", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_HPX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_IFT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_INI", 0, 0},
|
||||
{"_INT", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_IRC", 0, 0},
|
||||
{"_LCK", 1, 0},
|
||||
{"_LEN", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_LID", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_LL_", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MAF", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MAT", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_MAX", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MBM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_MEM", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MIF", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MIN", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_MSG", 1, 0},
|
||||
{"_MSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_MTP", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_NTT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_OFF", 0, 0},
|
||||
{"_ON_", 0, 0},
|
||||
{"_OS_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_OSC", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_OSI", 1, ASL_RSVD_RETURN_VALUE},
|
||||
{"_OST", 3, 0}, /* Acpi 3.0 */
|
||||
{"_PAI", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PCL", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PCT", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PDC", 1, 0},
|
||||
{"_PDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PIC", 1, 0},
|
||||
{"_PIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PLD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_PMC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PMM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PPC", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PPE", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_PR0", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PR1", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PR2", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PR3", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PRL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PRS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PRT", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PRW", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PS0", 0, 0},
|
||||
{"_PS1", 0, 0},
|
||||
{"_PS2", 0, 0},
|
||||
{"_PS3", 0, 0},
|
||||
{"_PSC", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_PSL", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PSR", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PSS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PSV", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PSW", 1, 0},
|
||||
{"_PTC", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_PTP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PTS", 1, 0},
|
||||
{"_PUR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_PXM", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_RBO", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_RBW", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_REG", 2, 0},
|
||||
{"_REV", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_RMV", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_RNG", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_ROM", 2, ASL_RSVD_RETURN_VALUE},
|
||||
{"_RT_", 0, ASL_RSVD_RESOURCE_NAME}, /* Acpi 3.0 */
|
||||
{"_RTV", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_RW_", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_S0_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S1_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S2_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S3_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S4_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S5_", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S1D", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S2D", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S3D", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S4D", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_S0W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_S1W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_S2W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_S3W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_S4W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_SB_", 0, ASL_RSVD_SCOPE},
|
||||
{"_SBS", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */
|
||||
{"_SDD", 1, 0}, /* Acpi 3.0 */
|
||||
{"_SEG", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_SHL", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_SHR", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_SI_", 0, ASL_RSVD_SCOPE},
|
||||
{"_SIZ", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_SLI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_SPD", 1, ASL_RSVD_RETURN_VALUE},
|
||||
{"_SRS", 1, 0},
|
||||
{"_SRV", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_SST", 1, 0},
|
||||
{"_STA", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_STM", 3, 0},
|
||||
{"_STP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_STR", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_STV", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_SUN", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TC1", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_TC2", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */
|
||||
{"_TIP", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_TIV", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
|
||||
{"_TMP", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TPT", 1, 0}, /* Acpi 3.0 */
|
||||
{"_TRA", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_TRS", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_TRT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TSF", 0, ASL_RSVD_RESOURCE_NAME}, /* Acpi 3.0 */
|
||||
{"_TSP", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_TSS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TTP", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_TTS", 1, 0}, /* Acpi 3.0 */
|
||||
{"_TYP", 0, ASL_RSVD_RESOURCE_NAME},
|
||||
{"_TZ_", 0, ASL_RSVD_SCOPE},
|
||||
{"_TZD", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_TZM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_TZP", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_UID", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_UPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_UPD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_UPP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
|
||||
{"_VPO", 0, ASL_RSVD_RETURN_VALUE},
|
||||
{"_WAK", 1, ASL_RSVD_RETURN_VALUE},
|
||||
{"_WDG", 0, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
|
||||
{"_WED", 1, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
|
||||
{NULL, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* DATA STRUCTURE: AslKeywordMapping
|
||||
|
831
src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c
Normal file
831
src/add-ons/kernel/bus_managers/acpi/compiler/aslpredef.c
Normal file
@ -0,0 +1,831 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslpredef - support for ACPI predefined names
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define ACPI_CREATE_PREDEFINED_TABLE
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
#include "amlcode.h"
|
||||
#include "acparser.h"
|
||||
#include "acpredef.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslpredef")
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static UINT32
|
||||
ApCheckForSpecialName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name);
|
||||
|
||||
static void
|
||||
ApCheckObjectType (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 ExpectedBtypes);
|
||||
|
||||
static void
|
||||
ApGetExpectedTypes (
|
||||
char *Buffer,
|
||||
UINT32 ExpectedBtypes);
|
||||
|
||||
|
||||
/*
|
||||
* Names for the types that can be returned by the predefined objects.
|
||||
* Used for warning messages. Must be in the same order as the ACPI_RTYPEs
|
||||
*/
|
||||
static const char *AcpiRtypeNames[] =
|
||||
{
|
||||
"/Integer",
|
||||
"/String",
|
||||
"/Buffer",
|
||||
"/Package",
|
||||
"/Reference",
|
||||
};
|
||||
|
||||
/*
|
||||
* Predefined names for use in Resource Descriptors. These names do not
|
||||
* appear in the global Predefined Name table (since these names never
|
||||
* appear in actual AML byte code, only in the original ASL)
|
||||
*/
|
||||
static const ACPI_PREDEFINED_INFO ResourceNames[] = {
|
||||
{{"_ALN", 0, 0}},
|
||||
{{"_ASI", 0, 0}},
|
||||
{{"_ASZ", 0, 0}},
|
||||
{{"_ATT", 0, 0}},
|
||||
{{"_BAS", 0, 0}},
|
||||
{{"_BM_", 0, 0}},
|
||||
{{"_DEC", 0, 0}},
|
||||
{{"_GRA", 0, 0}},
|
||||
{{"_HE_", 0, 0}},
|
||||
{{"_INT", 0, 0}},
|
||||
{{"_LEN", 0, 0}},
|
||||
{{"_LL_", 0, 0}},
|
||||
{{"_MAF", 0, 0}},
|
||||
{{"_MAX", 0, 0}},
|
||||
{{"_MEM", 0, 0}},
|
||||
{{"_MIF", 0, 0}},
|
||||
{{"_MIN", 0, 0}},
|
||||
{{"_MTP", 0, 0}},
|
||||
{{"_RBO", 0, 0}},
|
||||
{{"_RBW", 0, 0}},
|
||||
{{"_RNG", 0, 0}},
|
||||
{{"_RT_", 0, 0}}, /* Acpi 3.0 */
|
||||
{{"_RW_", 0, 0}},
|
||||
{{"_SHR", 0, 0}},
|
||||
{{"_SIZ", 0, 0}},
|
||||
{{"_TRA", 0, 0}},
|
||||
{{"_TRS", 0, 0}},
|
||||
{{"_TSF", 0, 0}}, /* Acpi 3.0 */
|
||||
{{"_TTP", 0, 0}},
|
||||
{{"_TYP", 0, 0}},
|
||||
{{{0,0,0,0}, 0, 0}} /* Table terminator */
|
||||
};
|
||||
|
||||
static const ACPI_PREDEFINED_INFO ScopeNames[] = {
|
||||
{{"_SB_", 0, 0}},
|
||||
{{"_SI_", 0, 0}},
|
||||
{{"_TZ_", 0, 0}},
|
||||
{{{0,0,0,0}, 0, 0}} /* Table terminator */
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckForPredefinedMethod
|
||||
*
|
||||
* PARAMETERS: Op - A parse node of type "METHOD".
|
||||
* MethodInfo - Saved info about this method
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: If method is a predefined name, check that the number of
|
||||
* arguments and the return type (returns a value or not)
|
||||
* is correct.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ApCheckForPredefinedMethod (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 RequiredArgsCurrent;
|
||||
UINT32 RequiredArgsOld;
|
||||
|
||||
|
||||
/* Check for a match against the predefined name list */
|
||||
|
||||
Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
|
||||
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
|
||||
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
|
||||
|
||||
/* Just return, nothing to do */
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
Gbl_ReservedMethods++;
|
||||
|
||||
/* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
if (MethodInfo->NumArguments != 0)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/*
|
||||
* Matched a predefined method name
|
||||
*
|
||||
* Validate the ASL-defined argument count. Allow two different legal
|
||||
* arg counts.
|
||||
*/
|
||||
Gbl_ReservedMethods++;
|
||||
|
||||
RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F;
|
||||
RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4;
|
||||
|
||||
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
|
||||
(MethodInfo->NumArguments != RequiredArgsOld))
|
||||
{
|
||||
sprintf (MsgBuffer, "%4.4s requires %d",
|
||||
PredefinedNames[Index].Info.Name, RequiredArgsCurrent);
|
||||
|
||||
if (MethodInfo->NumArguments > RequiredArgsCurrent)
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if method returns no value, but the predefined name is
|
||||
* required to return a value
|
||||
*/
|
||||
if (MethodInfo->NumReturnNoValue &&
|
||||
PredefinedNames[Index].Info.ExpectedBtypes)
|
||||
{
|
||||
ApGetExpectedTypes (StringBuffer,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
|
||||
sprintf (MsgBuffer, "%s required for %4.4s",
|
||||
StringBuffer, PredefinedNames[Index].Info.Name);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckPredefinedReturnValue
|
||||
*
|
||||
* PARAMETERS: Op - A parse node of type "RETURN".
|
||||
* MethodInfo - Saved info about this method
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: If method is a predefined name, attempt to validate the return
|
||||
* value. Only "static" types can be validated - a simple return
|
||||
* of an integer/string/buffer/package or a named reference to
|
||||
* a static object. Values such as a Localx or Argx or a control
|
||||
* method invocation are not checked.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ApCheckPredefinedReturnValue (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_METHOD_INFO *MethodInfo)
|
||||
{
|
||||
UINT32 Index;
|
||||
ACPI_PARSE_OBJECT *ReturnValueOp;
|
||||
|
||||
|
||||
/* Check parent method for a match against the predefined name list */
|
||||
|
||||
Index = ApCheckForPredefinedName (MethodInfo->Op,
|
||||
MethodInfo->Op->Asl.NameSeg);
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
|
||||
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
|
||||
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
/* Just return, nothing to do */
|
||||
return;
|
||||
|
||||
default: /* A standard predefined ACPI name */
|
||||
|
||||
/* Exit if no return value expected */
|
||||
|
||||
if (!PredefinedNames[Index].Info.ExpectedBtypes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the object returned, it is the next argument */
|
||||
|
||||
ReturnValueOp = Op->Asl.Child;
|
||||
switch (ReturnValueOp->Asl.ParseOpcode)
|
||||
{
|
||||
case PARSEOP_ZERO:
|
||||
case PARSEOP_ONE:
|
||||
case PARSEOP_ONES:
|
||||
case PARSEOP_INTEGER:
|
||||
case PARSEOP_STRING_LITERAL:
|
||||
case PARSEOP_BUFFER:
|
||||
case PARSEOP_PACKAGE:
|
||||
|
||||
/* Static data return object - check against expected type */
|
||||
|
||||
ApCheckObjectType (ReturnValueOp,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/*
|
||||
* All other ops are very difficult or impossible to typecheck at
|
||||
* compile time. These include all Localx, Argx, and method
|
||||
* invocations. Also, NAMESEG and NAMESTRING because the type of
|
||||
* any named object can be changed at runtime (for example,
|
||||
* CopyObject will change the type of the target object.)
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckForPredefinedObject
|
||||
*
|
||||
* PARAMETERS: Op - A parse node
|
||||
* Name - The ACPI name to be checked
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check for a predefined name for a static object (created via
|
||||
* the ASL Name operator). If it is a predefined ACPI name, ensure
|
||||
* that the name does not require any arguments (which would
|
||||
* require a control method implemenation of the name), and that
|
||||
* the type of the object is one of the expected types for the
|
||||
* predefined name.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ApCheckForPredefinedObject (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name)
|
||||
{
|
||||
UINT32 Index;
|
||||
|
||||
|
||||
/*
|
||||
* Check for a real predefined name -- not a resource descriptor name
|
||||
* or a predefined scope name
|
||||
*/
|
||||
Index = ApCheckForPredefinedName (Op, Name);
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
|
||||
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
|
||||
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
|
||||
|
||||
/* Nothing to do */
|
||||
return;
|
||||
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
/*
|
||||
* These names must be control methods, by definition in ACPI spec.
|
||||
* Also because they are defined to return no value. None of them
|
||||
* require any arguments.
|
||||
*/
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with zero arguments");
|
||||
return;
|
||||
|
||||
default: /* A standard predefined ACPI name */
|
||||
|
||||
/*
|
||||
* If this predefined name requires input arguments, then
|
||||
* it must be implemented as a control method
|
||||
*/
|
||||
if (PredefinedNames[Index].Info.ParamCount > 0)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If no return value is expected from this predefined name, then
|
||||
* it follows that it must be implemented as a control method
|
||||
* (with zero args, because the args > 0 case was handled above)
|
||||
* Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
|
||||
*/
|
||||
if (!PredefinedNames[Index].Info.ExpectedBtypes)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with zero arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Typecheck the actual object, it is the next argument */
|
||||
|
||||
ApCheckObjectType (Op->Asl.Child->Asl.Next,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckForPredefinedName
|
||||
*
|
||||
* PARAMETERS: Op - A parse node
|
||||
* Name - NameSeg to check
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check a NameSeg against the reserved list.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
ApCheckForPredefinedName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
if (Name[0] == 0)
|
||||
{
|
||||
AcpiOsPrintf ("Found a null name, external = %s\n",
|
||||
Op->Asl.ExternalName);
|
||||
}
|
||||
|
||||
/* All reserved names are prefixed with a single underscore */
|
||||
|
||||
if (Name[0] != '_')
|
||||
{
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/* Check for a standard predefined method name */
|
||||
|
||||
for (i = 0; PredefinedNames[i].Info.Name[0]; i++)
|
||||
{
|
||||
if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name))
|
||||
{
|
||||
/* Return index into predefined array */
|
||||
return (i);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for resource names and predefined scope names */
|
||||
|
||||
for (i = 0; ResourceNames[i].Info.Name[0]; i++)
|
||||
{
|
||||
if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name))
|
||||
{
|
||||
return (ACPI_PREDEFINED_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; ScopeNames[i].Info.Name[0]; i++)
|
||||
{
|
||||
if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name))
|
||||
{
|
||||
return (ACPI_PREDEFINED_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
|
||||
|
||||
return (ApCheckForSpecialName (Op, Name));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckForSpecialName
|
||||
*
|
||||
* PARAMETERS: Op - A parse node
|
||||
* Name - NameSeg to check
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check for the "special" predefined names -
|
||||
* _Lxx, _Exx, _Qxx, _Wxx, and _T_x
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static UINT32
|
||||
ApCheckForSpecialName (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check for the "special" predefined names. We already know that the
|
||||
* first character is an underscore.
|
||||
* GPE: _Lxx
|
||||
* GPE: _Exx
|
||||
* GPE: _Wxx
|
||||
* EC: _Qxx
|
||||
*/
|
||||
if ((Name[1] == 'L') ||
|
||||
(Name[1] == 'E') ||
|
||||
(Name[1] == 'W') ||
|
||||
(Name[1] == 'Q'))
|
||||
{
|
||||
/* The next two characters must be hex digits */
|
||||
|
||||
if ((isxdigit ((int) Name[2])) &&
|
||||
(isxdigit ((int) Name[3])))
|
||||
{
|
||||
return (ACPI_EVENT_RESERVED_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for the names reserved for the compiler itself: _T_x */
|
||||
|
||||
else if ((Op->Asl.ExternalName[1] == 'T') &&
|
||||
(Op->Asl.ExternalName[2] == '_'))
|
||||
{
|
||||
/* Ignore if actually emitted by the compiler */
|
||||
|
||||
if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED)
|
||||
{
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* Was not actually emitted by the compiler. This is a special case,
|
||||
* however. If the ASL code being compiled was the result of a
|
||||
* dissasembly, it may possibly contain valid compiler-emitted names
|
||||
* of the form "_T_x". We don't want to issue an error or even a
|
||||
* warning and force the user to manually change the names. So, we
|
||||
* will issue a remark instead.
|
||||
*/
|
||||
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
|
||||
return (ACPI_COMPILER_RESERVED_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* The name didn't match any of the known predefined names. Flag it as a
|
||||
* warning, since the entire namespace starting with an underscore is
|
||||
* reserved by the ACPI spec.
|
||||
*/
|
||||
AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
|
||||
Op->Asl.ExternalName);
|
||||
|
||||
return (ACPI_NOT_RESERVED_NAME);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApCheckObjectType
|
||||
*
|
||||
* PARAMETERS: Op - Current parse node
|
||||
* ExpectedBtypes - Bitmap of expected return type(s)
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check if the object type is one of the types that is expected
|
||||
* by the predefined name. Only a limited number of object types
|
||||
* can be returned by the predefined names.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
ApCheckObjectType (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 ExpectedBtypes)
|
||||
{
|
||||
UINT32 ReturnBtype;
|
||||
|
||||
|
||||
switch (Op->Asl.ParseOpcode)
|
||||
{
|
||||
case PARSEOP_ZERO:
|
||||
case PARSEOP_ONE:
|
||||
case PARSEOP_ONES:
|
||||
case PARSEOP_INTEGER:
|
||||
ReturnBtype = ACPI_RTYPE_INTEGER;
|
||||
break;
|
||||
|
||||
case PARSEOP_BUFFER:
|
||||
ReturnBtype = ACPI_RTYPE_BUFFER;
|
||||
break;
|
||||
|
||||
case PARSEOP_STRING_LITERAL:
|
||||
ReturnBtype = ACPI_RTYPE_STRING;
|
||||
break;
|
||||
|
||||
case PARSEOP_PACKAGE:
|
||||
ReturnBtype = ACPI_RTYPE_PACKAGE;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Not one of the supported object types */
|
||||
|
||||
goto TypeErrorExit;
|
||||
}
|
||||
|
||||
/* Exit if the object is one of the expected types */
|
||||
|
||||
if (ReturnBtype & ExpectedBtypes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TypeErrorExit:
|
||||
|
||||
/* Format the expected types and emit an error message */
|
||||
|
||||
ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
|
||||
|
||||
sprintf (MsgBuffer, "found %s, requires %s",
|
||||
UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
|
||||
MsgBuffer);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApDisplayReservedNames
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump information about the ACPI predefined names and predefined
|
||||
* resource descriptor names.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ApDisplayReservedNames (
|
||||
void)
|
||||
{
|
||||
const ACPI_PREDEFINED_INFO *ThisName;
|
||||
char TypeBuffer[48]; /* Room for 5 types */
|
||||
UINT32 Count;
|
||||
|
||||
|
||||
/*
|
||||
* Predefined names/methods
|
||||
*/
|
||||
printf ("\nPredefined Name Information\n\n");
|
||||
|
||||
Count = 0;
|
||||
ThisName = PredefinedNames;
|
||||
while (ThisName->Info.Name[0])
|
||||
{
|
||||
printf ("%4.4s Requires %d arguments, ",
|
||||
ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F);
|
||||
|
||||
if (ThisName->Info.ExpectedBtypes)
|
||||
{
|
||||
ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes);
|
||||
printf ("Must return: %s\n", TypeBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("No return value\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip next entry in the table if this name returns a Package
|
||||
* (next entry contains the package info)
|
||||
*/
|
||||
if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
|
||||
{
|
||||
ThisName++;
|
||||
}
|
||||
|
||||
Count++;
|
||||
ThisName++;
|
||||
}
|
||||
|
||||
printf ("%u Predefined Names are recognized\n", Count);
|
||||
|
||||
/*
|
||||
* Resource Descriptor names
|
||||
*/
|
||||
printf ("\nResource Descriptor Predefined Names\n\n");
|
||||
|
||||
Count = 0;
|
||||
ThisName = ResourceNames;
|
||||
while (ThisName->Info.Name[0])
|
||||
{
|
||||
printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name);
|
||||
Count++;
|
||||
ThisName++;
|
||||
}
|
||||
|
||||
printf ("%u Resource Descriptor Names are recognized\n", Count);
|
||||
|
||||
/*
|
||||
* Predefined scope names
|
||||
*/
|
||||
printf ("\nPredefined Scope Names\n\n");
|
||||
|
||||
ThisName = ScopeNames;
|
||||
while (ThisName->Info.Name[0])
|
||||
{
|
||||
printf ("%4.4s Scope\n", ThisName->Info.Name);
|
||||
ThisName++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: ApGetExpectedTypes
|
||||
*
|
||||
* PARAMETERS: Buffer - Where the formatted string is returned
|
||||
* ExpectedBTypes - Bitfield of expected data types
|
||||
*
|
||||
* RETURN: None, formatted string
|
||||
*
|
||||
* DESCRIPTION: Format the expected object types into a printable string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
ApGetExpectedTypes (
|
||||
char *Buffer,
|
||||
UINT32 ExpectedBtypes)
|
||||
{
|
||||
UINT32 ThisRtype;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
|
||||
|
||||
j = 1;
|
||||
Buffer[0] = 0;
|
||||
ThisRtype = ACPI_RTYPE_INTEGER;
|
||||
|
||||
for (i = 0; i < ACPI_NUM_RTYPES; i++)
|
||||
{
|
||||
/* If one of the expected types, concatenate the name of this type */
|
||||
|
||||
if (ExpectedBtypes & ThisRtype)
|
||||
{
|
||||
ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]);
|
||||
j = 0; /* Use name separator from now on */
|
||||
}
|
||||
ThisRtype <<= 1; /* Next Rtype */
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslresource - Resource templates and descriptors
|
||||
* Module Name: aslresource - Resource template/descriptor utilities
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -124,6 +124,298 @@
|
||||
ACPI_MODULE_NAME ("aslresource")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsSmallAddressCheck
|
||||
*
|
||||
* PARAMETERS: Minimum - Address Min value
|
||||
* Maximum - Address Max value
|
||||
* Length - Address range value
|
||||
* Alignment - Address alignment value
|
||||
* MinOp - Original Op for Address Min
|
||||
* MaxOp - Original Op for Address Max
|
||||
* LengthOp - Original Op for address range
|
||||
* AlignOp - Original Op for address alignment. If
|
||||
* NULL, means "zero value for alignment is
|
||||
* OK, and means 64K alignment" (for
|
||||
* Memory24 descriptor)
|
||||
*
|
||||
* RETURN: None. Adds error messages to error log if necessary
|
||||
*
|
||||
* DESCRIPTION: Perform common value checks for "small" address descriptors.
|
||||
* Currently:
|
||||
* Io, Memory24, Memory32
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
RsSmallAddressCheck (
|
||||
UINT8 Type,
|
||||
UINT32 Minimum,
|
||||
UINT32 Maximum,
|
||||
UINT32 Length,
|
||||
UINT32 Alignment,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *AlignOp)
|
||||
{
|
||||
|
||||
if (Gbl_NoResourceChecking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Special case for Memory24, values are compressed */
|
||||
|
||||
if (Type == ACPI_RESOURCE_NAME_MEMORY24)
|
||||
{
|
||||
if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */
|
||||
{
|
||||
Alignment = ACPI_UINT16_MAX + 1;
|
||||
}
|
||||
|
||||
Minimum <<= 8;
|
||||
Maximum <<= 8;
|
||||
Length *= 256;
|
||||
}
|
||||
|
||||
/* IO descriptor has different definition of min/max, don't check */
|
||||
|
||||
if (Type != ACPI_RESOURCE_NAME_IO)
|
||||
{
|
||||
/* Basic checks on Min/Max/Length */
|
||||
|
||||
if (Minimum > Maximum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
|
||||
}
|
||||
else if (Length > (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Alignment of zero is not in ACPI spec, but is used to mean byte acc */
|
||||
|
||||
if (!Alignment)
|
||||
{
|
||||
Alignment = 1;
|
||||
}
|
||||
|
||||
/* Addresses must be an exact multiple of the alignment value */
|
||||
|
||||
if (Minimum % Alignment)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
|
||||
}
|
||||
if (Maximum % Alignment)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsLargeAddressCheck
|
||||
*
|
||||
* PARAMETERS: Minimum - Address Min value
|
||||
* Maximum - Address Max value
|
||||
* Length - Address range value
|
||||
* Granularity - Address granularity value
|
||||
* Flags - General flags for address descriptors:
|
||||
* _MIF, _MAF, _DEC
|
||||
* MinOp - Original Op for Address Min
|
||||
* MaxOp - Original Op for Address Max
|
||||
* LengthOp - Original Op for address range
|
||||
* GranOp - Original Op for address granularity
|
||||
*
|
||||
* RETURN: None. Adds error messages to error log if necessary
|
||||
*
|
||||
* DESCRIPTION: Perform common value checks for "large" address descriptors.
|
||||
* Currently:
|
||||
* WordIo, WordBusNumber, WordSpace
|
||||
* DWordIo, DWordMemory, DWordSpace
|
||||
* QWordIo, QWordMemory, QWordSpace
|
||||
* ExtendedIo, ExtendedMemory, ExtendedSpace
|
||||
*
|
||||
* _MIF flag set means that the minimum address is fixed and is not relocatable
|
||||
* _MAF flag set means that the maximum address is fixed and is not relocatable
|
||||
* Length of zero means that the record size is variable
|
||||
*
|
||||
* This function implements the LEN/MIF/MAF/MIN/MAX/GRA rules within Table 6-40
|
||||
* of the ACPI 4.0a specification. Added 04/2010.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
RsLargeAddressCheck (
|
||||
UINT64 Minimum,
|
||||
UINT64 Maximum,
|
||||
UINT64 Length,
|
||||
UINT64 Granularity,
|
||||
UINT8 Flags,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *GranOp)
|
||||
{
|
||||
|
||||
if (Gbl_NoResourceChecking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Basic checks on Min/Max/Length */
|
||||
|
||||
if (Minimum > Maximum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
|
||||
return;
|
||||
}
|
||||
else if (Length > (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If specified (non-zero), ensure granularity is a power-of-two minus one */
|
||||
|
||||
if (Granularity)
|
||||
{
|
||||
if ((Granularity + 1) &
|
||||
Granularity)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_GRANULARITY, GranOp, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the various combinations of Length, MinFixed, and MaxFixed
|
||||
*/
|
||||
if (Length)
|
||||
{
|
||||
/* Fixed non-zero length */
|
||||
|
||||
switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
|
||||
{
|
||||
case 0:
|
||||
/*
|
||||
* Fixed length, variable locations (both _MIN and _MAX).
|
||||
* Length must be a multiple of granularity
|
||||
*/
|
||||
if (Granularity & Length)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, LengthOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
|
||||
|
||||
/* Fixed length, fixed location. Granularity must be zero */
|
||||
|
||||
if (Granularity != 0)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_GRAN_FIXED, GranOp, NULL);
|
||||
}
|
||||
|
||||
/* Length must be exactly the size of the min/max window */
|
||||
|
||||
if (Length != (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH_FIXED, LengthOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
/* All other combinations are invalid */
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MIF:
|
||||
case ACPI_RESOURCE_FLAG_MAF:
|
||||
default:
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Variable length (length==0) */
|
||||
|
||||
switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
|
||||
{
|
||||
case 0:
|
||||
/*
|
||||
* Both _MIN and _MAX are variable.
|
||||
* No additional requirements, just exit
|
||||
*/
|
||||
break;
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MIF:
|
||||
|
||||
/* _MIN is fixed. _MIN must be multiple of _GRA */
|
||||
|
||||
/*
|
||||
* The granularity is defined by the ACPI specification to be a
|
||||
* power-of-two minus one, therefore the granularity is a
|
||||
* bitmask which can be used to easily validate the addresses.
|
||||
*/
|
||||
if (Granularity & Minimum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MAF:
|
||||
|
||||
/* _MAX is fixed. (_MAX + 1) must be multiple of _GRA */
|
||||
|
||||
if (Granularity & (Maximum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, "-1");
|
||||
}
|
||||
break;
|
||||
|
||||
/* Both MIF/MAF set is invalid if length is zero */
|
||||
|
||||
case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
|
||||
default:
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsGetStringDataLength
|
||||
*
|
||||
* PARAMETERS: InitializerOp - Start of a subtree of init nodes
|
||||
*
|
||||
* RETURN: Valid string length if a string node is found (otherwise 0)
|
||||
*
|
||||
* DESCRIPTION: In a list of peer nodes, find the first one that contains a
|
||||
* string and return the length of the string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT16
|
||||
RsGetStringDataLength (
|
||||
ACPI_PARSE_OBJECT *InitializerOp)
|
||||
{
|
||||
|
||||
while (InitializerOp)
|
||||
{
|
||||
if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
|
||||
{
|
||||
return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
|
||||
}
|
||||
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsAllocateResourceNode
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
|
||||
* Module Name: aslrestype1 - Miscellaneous small resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -121,6 +121,18 @@
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype1")
|
||||
|
||||
/*
|
||||
* This module contains miscellaneous small resource descriptors:
|
||||
*
|
||||
* EndTag
|
||||
* EndDependentFn
|
||||
* Memory24
|
||||
* Memory32
|
||||
* Memory32Fixed
|
||||
* StartDependentFn
|
||||
* StartDependentFnNoPri
|
||||
* VendorShort
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -156,127 +168,6 @@ RsDoEndTagDescriptor (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDmaDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "DMA" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
UINT8 DmaChannelMask = 0;
|
||||
UINT8 DmaChannels = 0;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
|
||||
ASL_RDESC_DMA_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* DMA type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
|
||||
break;
|
||||
|
||||
case 1: /* Bus Master */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* Xfer Type (transfer width) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All DMA channel bytes are handled here, after flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 8 channels can be specified in the list */
|
||||
|
||||
DmaChannels++;
|
||||
if (DmaChannels > 8)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only DMA channels 0-7 are allowed (mask is 8 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 7)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
|
||||
/* Build the mask */
|
||||
|
||||
DmaChannelMask |=
|
||||
(1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
|
||||
if (i == 4) /* case 4: First DMA byte */
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
|
||||
CurrentByteOffset +
|
||||
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Dma.DmaChannelMask = DmaChannelMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoEndDependentDescriptor
|
||||
@ -309,396 +200,6 @@ RsDoEndDependentDescriptor (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoFixedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "FixedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
|
||||
ASL_RDESC_FIXED_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Base Address */
|
||||
|
||||
Descriptor->FixedIo.Address =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
|
||||
break;
|
||||
|
||||
case 1: /* Length */
|
||||
|
||||
Descriptor->FixedIo.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
|
||||
break;
|
||||
|
||||
case 2: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
|
||||
ASL_RDESC_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Decode size */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Min Address */
|
||||
|
||||
Descriptor->Io.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
|
||||
Descriptor->Io.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
|
||||
Descriptor->Io.Alignment =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
|
||||
Descriptor->Io.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQ" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
|
||||
|
||||
/* Length = 3 (with flag byte) */
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
(ASL_RDESC_IRQ_SIZE + 0x01);
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Interrupt Type (or Mode - edge/level) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Interrupt Level (or Polarity - Active high/low) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
|
||||
break;
|
||||
|
||||
case 2: /* Share Type - Default: exclusive (0) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 4: First IRQ value in list */
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqNoFlagsDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQNoFlags" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
ASL_RDESC_IRQ_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 1: First IRQ value in list */
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the interrupt mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoMemory24Descriptor
|
||||
@ -720,6 +221,10 @@ RsDoMemory24Descriptor (
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
@ -749,6 +254,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
@ -756,6 +262,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
@ -763,6 +270,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
@ -770,6 +278,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
@ -786,6 +295,15 @@ RsDoMemory24Descriptor (
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
|
||||
Descriptor->Memory24.Minimum,
|
||||
Descriptor->Memory24.Maximum,
|
||||
Descriptor->Memory24.AddressLength,
|
||||
Descriptor->Memory24.Alignment,
|
||||
MinOp, MaxOp, LengthOp, NULL);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
@ -811,6 +329,10 @@ RsDoMemory32Descriptor (
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
@ -840,6 +362,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
@ -847,6 +370,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
@ -854,6 +378,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
@ -861,6 +386,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
@ -877,6 +403,15 @@ RsDoMemory32Descriptor (
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
|
||||
Descriptor->Memory32.Minimum,
|
||||
Descriptor->Memory32.Maximum,
|
||||
Descriptor->Memory32.AddressLength,
|
||||
Descriptor->Memory32.Alignment,
|
||||
MinOp, MaxOp, LengthOp, AlignOp);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
@ -1027,6 +562,7 @@ RsDoStartDependentDescriptor (
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
NextRnode = RsDoOneResourceDescriptor (InitializerOp,
|
||||
CurrentByteOffset, &State);
|
||||
|
||||
@ -1036,7 +572,6 @@ RsDoStartDependentDescriptor (
|
||||
* must keep track of the offset of not only each descriptor, but each
|
||||
* element (field) within each descriptor as well.
|
||||
*/
|
||||
|
||||
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
|
||||
NextRnode);
|
||||
break;
|
||||
@ -1182,4 +717,3 @@ RsDoVendorSmallDescriptor (
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
|
668
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c
Normal file
668
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1i.c
Normal file
@ -0,0 +1,668 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype1i - Small I/O-related resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype1i")
|
||||
|
||||
/*
|
||||
* This module contains the I/O-related small resource descriptors:
|
||||
*
|
||||
* DMA
|
||||
* FixedIO
|
||||
* IO
|
||||
* IRQ
|
||||
* IRQNoFlags
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDmaDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "DMA" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
UINT8 DmaChannelMask = 0;
|
||||
UINT8 DmaChannels = 0;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
|
||||
ASL_RDESC_DMA_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* DMA type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
|
||||
break;
|
||||
|
||||
case 1: /* Bus Master */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* Xfer Type (transfer width) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All DMA channel bytes are handled here, after flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 8 channels can be specified in the list */
|
||||
|
||||
DmaChannels++;
|
||||
if (DmaChannels > 8)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only DMA channels 0-7 are allowed (mask is 8 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 7)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
|
||||
/* Build the mask */
|
||||
|
||||
DmaChannelMask |=
|
||||
(1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
|
||||
if (i == 4) /* case 4: First DMA byte */
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
|
||||
CurrentByteOffset +
|
||||
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Dma.DmaChannelMask = DmaChannelMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoFixedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "FixedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *AddressOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
|
||||
ASL_RDESC_FIXED_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Base Address */
|
||||
|
||||
Descriptor->FixedIo.Address =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
|
||||
AddressOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 1: /* Length */
|
||||
|
||||
Descriptor->FixedIo.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
|
||||
break;
|
||||
|
||||
case 2: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Error checks */
|
||||
|
||||
if (Descriptor->FixedIo.Address > 0x03FF)
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
|
||||
ASL_RDESC_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Decode size */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Min Address */
|
||||
|
||||
Descriptor->Io.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
|
||||
Descriptor->Io.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
|
||||
Descriptor->Io.Alignment =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
|
||||
Descriptor->Io.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
|
||||
Descriptor->Io.Minimum,
|
||||
Descriptor->Io.Maximum,
|
||||
Descriptor->Io.AddressLength,
|
||||
Descriptor->Io.Alignment,
|
||||
MinOp, MaxOp, LengthOp, AlignOp);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQ" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
|
||||
|
||||
/* Length = 3 (with flag byte) */
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
(ASL_RDESC_IRQ_SIZE + 0x01);
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Interrupt Type (or Mode - edge/level) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Interrupt Level (or Polarity - Active high/low) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
|
||||
break;
|
||||
|
||||
case 2: /* Share Type - Default: exclusive (0) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 4: First IRQ value in list */
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqNoFlagsDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQNoFlags" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
ASL_RDESC_IRQ_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 1: First IRQ value in list */
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the interrupt mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
814
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c
Normal file
814
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2d.c
Normal file
@ -0,0 +1,814 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2d - Large DWord address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2d")
|
||||
|
||||
/*
|
||||
* This module contains the Dword (32-bit) address space descriptors:
|
||||
*
|
||||
* DwordIO
|
||||
* DwordMemory
|
||||
* DwordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT8 *OptionalFields;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Found a valid ResourceSourceIndex */
|
||||
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
/* Found a valid ResourceSource */
|
||||
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 14: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 15: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address32.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address32.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
|
||||
InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
646
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c
Normal file
646
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2e.c
Normal file
@ -0,0 +1,646 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2e - Large Extended address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2e")
|
||||
|
||||
/*
|
||||
* This module contains the Extended (64-bit) address space descriptors:
|
||||
*
|
||||
* ExtendedIO
|
||||
* ExtendedMemory
|
||||
* ExtendedSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 11: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 12: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 13: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 13: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 14: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->ExtAddress64.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->ExtAddress64.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
793
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c
Normal file
793
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2q.c
Normal file
@ -0,0 +1,793 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2q - Large QWord address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2q")
|
||||
|
||||
/*
|
||||
* This module contains the QWord (64-bit) address space descriptors:
|
||||
*
|
||||
* QWordIO
|
||||
* QWordMemory
|
||||
* QWordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 14: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 15: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address64.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address64.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
774
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c
Normal file
774
src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2w.c
Normal file
@ -0,0 +1,774 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2w - Large Word address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2w")
|
||||
|
||||
/*
|
||||
* This module contains the Word (16-bit) address space descriptors:
|
||||
*
|
||||
* WordIO
|
||||
* WordMemory
|
||||
* WordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordBusNumberDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordBusNumber" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Min Address */
|
||||
|
||||
Descriptor->Address16.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Max Address */
|
||||
|
||||
Descriptor->Address16.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 8: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 11: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address16.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address16.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address16.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address16.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
@ -243,11 +243,13 @@ AcpiEvInitializeRegion (
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvCheckForWakeOnlyGpe (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo)
|
||||
void
|
||||
AcpiExDoDebugObject (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
UINT32 Level,
|
||||
UINT32 Index)
|
||||
{
|
||||
return (AE_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
@ -276,7 +278,6 @@ AcpiExLoadTableOp (
|
||||
return (AE_SUPPORT);
|
||||
}
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExUnloadTable (
|
||||
ACPI_OPERAND_OBJECT *DdbHandle)
|
||||
|
@ -188,21 +188,6 @@ typedef struct asl_mapping_entry
|
||||
} ASL_MAPPING_ENTRY;
|
||||
|
||||
|
||||
/* An entry in the Reserved Name information table */
|
||||
|
||||
#define ASL_RSVD_RETURN_VALUE 0x01
|
||||
#define ASL_RSVD_RESOURCE_NAME 0x02
|
||||
#define ASL_RSVD_SCOPE 0x04
|
||||
|
||||
typedef struct asl_reserved_info
|
||||
{
|
||||
char *Name;
|
||||
UINT8 NumArguments;
|
||||
UINT8 Flags;
|
||||
|
||||
} ASL_RESERVED_INFO;
|
||||
|
||||
|
||||
/* Parse tree walk info structure */
|
||||
|
||||
typedef struct asl_walk_info
|
||||
@ -435,7 +420,16 @@ typedef enum
|
||||
ASL_MSG_SERIALIZED,
|
||||
ASL_MSG_COMPILER_RESERVED,
|
||||
ASL_MSG_NAMED_OBJECT_IN_WHILE,
|
||||
ASL_MSG_LOCAL_OUTSIDE_METHOD
|
||||
ASL_MSG_LOCAL_OUTSIDE_METHOD,
|
||||
ASL_MSG_ALIGNMENT,
|
||||
ASL_MSG_ISA_ADDRESS,
|
||||
ASL_MSG_INVALID_MIN_MAX,
|
||||
ASL_MSG_INVALID_LENGTH,
|
||||
ASL_MSG_INVALID_LENGTH_FIXED,
|
||||
ASL_MSG_INVALID_GRANULARITY,
|
||||
ASL_MSG_INVALID_GRAN_FIXED,
|
||||
ASL_MSG_INVALID_ACCESS_SIZE,
|
||||
ASL_MSG_INVALID_ADDR_FLAGS
|
||||
|
||||
} ASL_MESSAGE_IDS;
|
||||
|
||||
@ -522,7 +516,7 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments",
|
||||
/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments",
|
||||
/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
|
||||
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be",
|
||||
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name",
|
||||
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
|
||||
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
|
||||
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
|
||||
@ -555,7 +549,16 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
|
||||
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
|
||||
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
|
||||
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method"
|
||||
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
|
||||
/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
|
||||
/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
|
||||
/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
|
||||
/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
|
||||
/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
|
||||
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
|
||||
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
|
||||
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
|
||||
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
|
||||
|
||||
};
|
||||
|
||||
|
@ -675,7 +675,7 @@ AcpiDbDisplayTableInfo (
|
||||
|
||||
/* Walk the entire root table list */
|
||||
|
||||
for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
|
||||
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
|
||||
{
|
||||
TableDesc = &AcpiGbl_RootTableList.Tables[i];
|
||||
AcpiOsPrintf ("%d ", i);
|
||||
|
@ -816,6 +816,7 @@ AcpiDbDisplayGpes (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
|
||||
char *GpeType;
|
||||
UINT32 GpeIndex;
|
||||
UINT32 Block = 0;
|
||||
UINT32 i;
|
||||
@ -844,17 +845,25 @@ AcpiDbDisplayGpes (
|
||||
AcpiOsPrintf ("Could not convert name to pathname\n");
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
|
||||
Block, GpeBlock, GpeBlock->Node, Buffer);
|
||||
if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
|
||||
{
|
||||
GpeType = "FADT-defined GPE block";
|
||||
}
|
||||
else
|
||||
{
|
||||
GpeType = "GPE Block Device";
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s] - %s\n",
|
||||
Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
|
||||
|
||||
AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
|
||||
GpeBlock->RegisterCount,
|
||||
ACPI_MUL_8 (GpeBlock->RegisterCount));
|
||||
GpeBlock->RegisterCount, GpeBlock->GpeCount);
|
||||
|
||||
AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n",
|
||||
AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n",
|
||||
GpeBlock->BlockBaseNumber,
|
||||
GpeBlock->BlockBaseNumber +
|
||||
(GpeBlock->RegisterCount * 8) -1);
|
||||
GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1),
|
||||
GpeXruptInfo->InterruptNumber);
|
||||
|
||||
AcpiOsPrintf (
|
||||
" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
|
||||
@ -871,9 +880,12 @@ AcpiDbDisplayGpes (
|
||||
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
|
||||
|
||||
AcpiOsPrintf (
|
||||
" Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
|
||||
i, GpeRegisterInfo->EnableForWake,
|
||||
" Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X"
|
||||
" Status %8.8X%8.8X Enable %8.8X%8.8X\n",
|
||||
i, GpeRegisterInfo->BaseGpeNumber,
|
||||
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
|
||||
GpeRegisterInfo->EnableForRun,
|
||||
GpeRegisterInfo->EnableForWake,
|
||||
ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
|
||||
ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
|
||||
|
||||
@ -886,17 +898,19 @@ AcpiDbDisplayGpes (
|
||||
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
|
||||
{
|
||||
/* This GPE is not used (no method or handler) */
|
||||
/* This GPE is not used (no method or handler), ignore it */
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (
|
||||
" GPE %.3X: %p Flags %2.2X: ",
|
||||
GpeBlock->BlockBaseNumber + GpeIndex,
|
||||
GpeEventInfo,
|
||||
" GPE %.2X: %p RunRefs %2.2X WakeRefs %2.2X Flags %2.2X (",
|
||||
GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo,
|
||||
GpeEventInfo->RuntimeCount, GpeEventInfo->WakeupCount,
|
||||
GpeEventInfo->Flags);
|
||||
|
||||
/* Decode the flags byte */
|
||||
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
|
||||
{
|
||||
AcpiOsPrintf ("Level, ");
|
||||
@ -906,38 +920,13 @@ AcpiDbDisplayGpes (
|
||||
AcpiOsPrintf ("Edge, ");
|
||||
}
|
||||
|
||||
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
|
||||
{
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
AcpiOsPrintf ("WakeOnly: ");
|
||||
break;
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
AcpiOsPrintf (" RunOnly: ");
|
||||
break;
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
AcpiOsPrintf (" WakeRun: ");
|
||||
break;
|
||||
default:
|
||||
AcpiOsPrintf (" NotUsed: ");
|
||||
break;
|
||||
}
|
||||
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED)
|
||||
{
|
||||
AcpiOsPrintf ("[Wake 1 ");
|
||||
AcpiOsPrintf ("CanWake, ");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("[Wake 0 ");
|
||||
}
|
||||
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED)
|
||||
{
|
||||
AcpiOsPrintf ("Run 1], ");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("Run 0], ");
|
||||
AcpiOsPrintf ("RunOnly, ");
|
||||
}
|
||||
|
||||
switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
|
||||
@ -957,7 +946,7 @@ AcpiDbDisplayGpes (
|
||||
break;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiOsPrintf (")\n");
|
||||
}
|
||||
}
|
||||
Block++;
|
||||
|
@ -424,7 +424,7 @@ AcpiDsGetFieldNames (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Invalid opcode in field list: %X", Arg->Common.AmlOpcode));
|
||||
"Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode));
|
||||
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ AcpiDsBeginMethodExecution (
|
||||
(WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)",
|
||||
"Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)",
|
||||
AcpiUtGetNodeName (MethodNode),
|
||||
WalkState->Thread->CurrentSyncLevel));
|
||||
|
||||
|
@ -363,7 +363,7 @@ AcpiDsMethodDataGetNode (
|
||||
if (Index > ACPI_METHOD_MAX_LOCAL)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Local index %d is invalid (max %d)",
|
||||
"Local index %u is invalid (max %u)",
|
||||
Index, ACPI_METHOD_MAX_LOCAL));
|
||||
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
|
||||
}
|
||||
@ -378,7 +378,7 @@ AcpiDsMethodDataGetNode (
|
||||
if (Index > ACPI_METHOD_MAX_ARG)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Arg index %d is invalid (max %d)",
|
||||
"Arg index %u is invalid (max %u)",
|
||||
Index, ACPI_METHOD_MAX_ARG));
|
||||
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
|
||||
}
|
||||
@ -389,7 +389,7 @@ AcpiDsMethodDataGetNode (
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type));
|
||||
ACPI_ERROR ((AE_INFO, "Type %u is invalid", Type));
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
@ -540,7 +540,7 @@ AcpiDsMethodDataGetValue (
|
||||
case ACPI_REFCLASS_ARG:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Uninitialized Arg[%d] at node %p",
|
||||
"Uninitialized Arg[%u] at node %p",
|
||||
Index, Node));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
|
||||
@ -555,7 +555,7 @@ AcpiDsMethodDataGetValue (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type));
|
||||
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: 0x%X", Type));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ AcpiDsBuildInternalBufferObj (
|
||||
if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Expecting bytelist, got AML opcode %X in op %p",
|
||||
"Expecting bytelist, found AML opcode 0x%X in op %p",
|
||||
ByteList->Common.AmlOpcode, ByteList));
|
||||
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
@ -599,7 +599,7 @@ AcpiDsBuildInternalPackageObj (
|
||||
}
|
||||
|
||||
ACPI_INFO ((AE_INFO,
|
||||
"Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
|
||||
"Actual Package length (%u) is larger than NumElements field (%u), truncated\n",
|
||||
i, ElementCount));
|
||||
}
|
||||
else if (i < ElementCount)
|
||||
@ -609,7 +609,7 @@ AcpiDsBuildInternalPackageObj (
|
||||
* Note: this is not an error, the package is padded out with NULLs.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n",
|
||||
"Package List length (%u) smaller than NumElements count (%u), padded with null elements\n",
|
||||
i, ElementCount));
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ AcpiDsInitObjectFromOp (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown constant opcode %X", Opcode));
|
||||
"Unknown constant opcode 0x%X", Opcode));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
@ -821,7 +821,7 @@ AcpiDsInitObjectFromOp (
|
||||
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Integer type %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
|
||||
OpInfo->Type));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
@ -902,7 +902,7 @@ AcpiDsInitObjectFromOp (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unimplemented reference type for AML opcode: %4.4X", Opcode));
|
||||
"Unimplemented reference type for AML opcode: 0x%4.4X", Opcode));
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
break;
|
||||
@ -912,7 +912,7 @@ AcpiDsInitObjectFromOp (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",
|
||||
ObjDesc->Common.Type));
|
||||
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
|
@ -395,7 +395,7 @@ AcpiDsGetBufferArguments (
|
||||
if (!Node)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"No pointer back to NS node in buffer obj %p", ObjDesc));
|
||||
"No pointer back to namespace node in buffer object %p", ObjDesc));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ AcpiDsGetPackageArguments (
|
||||
if (!Node)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"No pointer back to NS node in package %p", ObjDesc));
|
||||
"No pointer back to namespace node in package %p", ObjDesc));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
@ -678,7 +678,7 @@ AcpiDsInitBufferField (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown field creation opcode %02x",
|
||||
"Unknown field creation opcode 0x%02X",
|
||||
AmlOpcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
@ -690,7 +690,7 @@ AcpiDsInitBufferField (
|
||||
(8 * (UINT32) BufferDesc->Buffer.Length))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
|
||||
"Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)",
|
||||
AcpiUtGetNodeName (ResultDesc),
|
||||
BitOffset + BitCount,
|
||||
AcpiUtGetNodeName (BufferDesc->Buffer.Node),
|
||||
@ -806,7 +806,7 @@ AcpiDsEvalBufferFieldOperands (
|
||||
ACPI_WALK_OPERANDS, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)",
|
||||
ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
|
||||
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -1607,7 +1607,7 @@ AcpiDsExecEndControlOp (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown control opcode=%X Op=%p",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
|
||||
Op->Common.AmlOpcode, Op));
|
||||
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
|
@ -227,7 +227,7 @@ AcpiDsGetPredicateValue (
|
||||
if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
|
||||
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
|
||||
ObjDesc, WalkState, ObjDesc->Common.Type));
|
||||
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
@ -463,7 +463,7 @@ AcpiDsExecEndOp (
|
||||
|
||||
if (OpClass == AML_CLASS_UNKNOWN)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Unknown opcode %X", Op->Common.AmlOpcode));
|
||||
ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
@ -783,7 +783,7 @@ AcpiDsExecEndOp (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
|
||||
"Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
|
||||
OpClass, OpType, Op->Common.AmlOpcode, Op));
|
||||
|
||||
Status = AE_NOT_IMPLEMENTED;
|
||||
|
@ -277,7 +277,7 @@ AcpiDsResultPush (
|
||||
if (!Object)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Null Object! Obj=%p State=%p Num=%X",
|
||||
"Null Object! Obj=%p State=%p Num=%u",
|
||||
Object, WalkState, WalkState->ResultCount));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
@ -323,7 +323,7 @@ AcpiDsResultStackPush (
|
||||
if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
|
||||
ACPI_RESULTS_OBJ_NUM_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
|
||||
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%u",
|
||||
WalkState, WalkState->ResultSize));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
@ -426,7 +426,7 @@ AcpiDsObjStackPush (
|
||||
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Object stack overflow! Obj=%p State=%p #Ops=%X",
|
||||
"Object stack overflow! Obj=%p State=%p #Ops=%u",
|
||||
Object, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
@ -480,7 +480,7 @@ AcpiDsObjStackPop (
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Object stack underflow! Count=%X State=%p #Ops=%X",
|
||||
"Object stack underflow! Count=%X State=%p #Ops=%u",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
@ -491,7 +491,7 @@ AcpiDsObjStackPop (
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
|
@ -415,7 +415,7 @@ AcpiEvFixedEventDispatch (
|
||||
ACPI_DISABLE_EVENT);
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"No installed handler for fixed event [%08X]",
|
||||
"No installed handler for fixed event [0x%08X]",
|
||||
Event));
|
||||
|
||||
return (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
|
@ -132,73 +132,22 @@ AcpiEvAsynchEnableGpe (
|
||||
void *Context);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvSetGpeType
|
||||
*
|
||||
* PARAMETERS: GpeEventInfo - GPE to set
|
||||
* Type - New type
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvSetGpeType (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
UINT8 Type)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvSetGpeType);
|
||||
|
||||
|
||||
/* Validate type and update register enable masks */
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Disable the GPE if currently enabled */
|
||||
|
||||
Status = AcpiEvDisableGpe (GpeEventInfo);
|
||||
|
||||
/* Clear the type bits and insert the new Type */
|
||||
|
||||
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
|
||||
GpeEventInfo->Flags |= Type;
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvUpdateGpeEnableMasks
|
||||
*
|
||||
* PARAMETERS: GpeEventInfo - GPE to update
|
||||
* Type - What to do: ACPI_GPE_DISABLE or
|
||||
* ACPI_GPE_ENABLE
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Updates GPE register enable masks based on the GPE type
|
||||
* DESCRIPTION: Updates GPE register enable masks based upon whether there are
|
||||
* references (either wake or run) to this GPE
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvUpdateGpeEnableMasks (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
UINT8 Type)
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo)
|
||||
{
|
||||
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
|
||||
UINT8 RegisterBit;
|
||||
@ -216,36 +165,21 @@ AcpiEvUpdateGpeEnableMasks (
|
||||
RegisterBit = (UINT8)
|
||||
(1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
|
||||
|
||||
/* 1) Disable case. Simply clear all enable bits */
|
||||
/* Clear the wake/run bits up front */
|
||||
|
||||
if (Type == ACPI_GPE_DISABLE)
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
|
||||
/* Set the mask bits only if there are references to this GPE */
|
||||
|
||||
if (GpeEventInfo->RuntimeCount)
|
||||
{
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
}
|
||||
|
||||
/* 2) Enable case. Set/Clear the appropriate enable bits */
|
||||
|
||||
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
|
||||
if (GpeEventInfo->WakeupCount)
|
||||
{
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
@ -257,19 +191,19 @@ AcpiEvUpdateGpeEnableMasks (
|
||||
* FUNCTION: AcpiEvEnableGpe
|
||||
*
|
||||
* PARAMETERS: GpeEventInfo - GPE to enable
|
||||
* WriteToHardware - Enable now, or just mark data structs
|
||||
* (WAKE GPEs should be deferred)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Enable a GPE based on the GPE type
|
||||
* DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless
|
||||
* of type or number of references.
|
||||
*
|
||||
* Note: The GPE lock should be already acquired when this function is called.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvEnableGpe (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
BOOLEAN WriteToHardware)
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
@ -277,54 +211,37 @@ AcpiEvEnableGpe (
|
||||
ACPI_FUNCTION_TRACE (EvEnableGpe);
|
||||
|
||||
|
||||
/* Make sure HW enable masks are updated */
|
||||
/*
|
||||
* We will only allow a GPE to be enabled if it has either an
|
||||
* associated method (_Lxx/_Exx) or a handler. Otherwise, the
|
||||
* GPE will be immediately disabled by AcpiEvGpeDispatch the
|
||||
* first time it fires.
|
||||
*/
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_HANDLER);
|
||||
}
|
||||
|
||||
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_ENABLE);
|
||||
/* Ensure the HW enable masks are current */
|
||||
|
||||
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Mark wake-enabled or HW enable, or both */
|
||||
/* Clear the GPE (of stale events) */
|
||||
|
||||
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
|
||||
Status = AcpiHwClearGpe (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
|
||||
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
|
||||
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
|
||||
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
|
||||
|
||||
if (WriteToHardware)
|
||||
{
|
||||
/* Clear the GPE (of stale events), then enable it */
|
||||
|
||||
Status = AcpiHwClearGpe (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Enable the requested runtime GPE */
|
||||
|
||||
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
/* Enable the requested GPE */
|
||||
|
||||
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
@ -336,7 +253,10 @@ AcpiEvEnableGpe (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Disable a GPE based on the GPE type
|
||||
* DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE,
|
||||
* regardless of the type or number of references.
|
||||
*
|
||||
* Note: The GPE lock should be already acquired when this function is called.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -356,40 +276,14 @@ AcpiEvDisableGpe (
|
||||
* the GPE behind our back.
|
||||
*/
|
||||
|
||||
/* Make sure HW enable masks are updated */
|
||||
/* Ensure the HW enable masks are current */
|
||||
|
||||
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
|
||||
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Clear the appropriate enabled flags for this GPE */
|
||||
|
||||
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
|
||||
{
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
|
||||
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
|
||||
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
|
||||
/* Disable the requested runtime GPE */
|
||||
|
||||
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Always H/W disable this GPE, even if we don't know the GPE type.
|
||||
* Simply clear the enable bit for this particular GPE, but do not
|
||||
@ -403,6 +297,49 @@ AcpiEvDisableGpe (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvLowGetGpeInfo
|
||||
*
|
||||
* PARAMETERS: GpeNumber - Raw GPE number
|
||||
* GpeBlock - A GPE info block
|
||||
*
|
||||
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE (The GpeNumber
|
||||
* is not within the specified GPE block)
|
||||
*
|
||||
* DESCRIPTION: Returns the EventInfo struct associated with this GPE. This is
|
||||
* the low-level implementation of EvGetGpeEventInfo.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_GPE_EVENT_INFO *
|
||||
AcpiEvLowGetGpeInfo (
|
||||
UINT32 GpeNumber,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock)
|
||||
{
|
||||
UINT32 GpeIndex;
|
||||
|
||||
|
||||
/*
|
||||
* Validate that the GpeNumber is within the specified GpeBlock.
|
||||
* (Two steps)
|
||||
*/
|
||||
if (!GpeBlock ||
|
||||
(GpeNumber < GpeBlock->BlockBaseNumber))
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
GpeIndex = GpeNumber - GpeBlock->BlockBaseNumber;
|
||||
if (GpeIndex >= GpeBlock->GpeCount)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (&GpeBlock->EventInfo[GpeIndex]);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvGetGpeEventInfo
|
||||
@ -426,14 +363,14 @@ AcpiEvGetGpeEventInfo (
|
||||
UINT32 GpeNumber)
|
||||
{
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_GPE_EVENT_INFO *GpeInfo;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* A NULL GpeBlock means use the FADT-defined GPE block(s) */
|
||||
/* A NULL GpeDevice means use the FADT-defined GPE block(s) */
|
||||
|
||||
if (!GpeDevice)
|
||||
{
|
||||
@ -441,16 +378,11 @@ AcpiEvGetGpeEventInfo (
|
||||
|
||||
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
|
||||
{
|
||||
GpeBlock = AcpiGbl_GpeFadtBlocks[i];
|
||||
if (GpeBlock)
|
||||
GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber,
|
||||
AcpiGbl_GpeFadtBlocks[i]);
|
||||
if (GpeInfo)
|
||||
{
|
||||
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
|
||||
(GpeNumber < GpeBlock->BlockBaseNumber +
|
||||
(GpeBlock->RegisterCount * 8)))
|
||||
{
|
||||
return (&GpeBlock->EventInfo[GpeNumber -
|
||||
GpeBlock->BlockBaseNumber]);
|
||||
}
|
||||
return (GpeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,15 +400,7 @@ AcpiEvGetGpeEventInfo (
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
GpeBlock = ObjDesc->Device.GpeBlock;
|
||||
|
||||
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
|
||||
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
|
||||
{
|
||||
return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
return (AcpiEvLowGetGpeInfo (GpeNumber, ObjDesc->Device.GpeBlock));
|
||||
}
|
||||
|
||||
|
||||
@ -654,9 +578,9 @@ AcpiEvAsynchExecuteGpeMethod (
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Set the GPE flags for return to enabled state */
|
||||
/* Update the GPE register masks for return to enabled state */
|
||||
|
||||
(void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
|
||||
(void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
|
||||
|
||||
/*
|
||||
* Take a snapshot of the GPE info for this level - we copy the info to
|
||||
@ -803,7 +727,7 @@ AcpiEvGpeDispatch (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Unable to clear GPE[%2X]", GpeNumber));
|
||||
"Unable to clear GPE[0x%2X]", GpeNumber));
|
||||
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
}
|
||||
@ -836,7 +760,7 @@ AcpiEvGpeDispatch (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Unable to clear GPE[%2X]", GpeNumber));
|
||||
"Unable to clear GPE[0x%2X]", GpeNumber));
|
||||
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
}
|
||||
@ -852,7 +776,7 @@ AcpiEvGpeDispatch (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Unable to disable GPE[%2X]", GpeNumber));
|
||||
"Unable to disable GPE[0x%2X]", GpeNumber));
|
||||
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
|
||||
@ -865,28 +789,31 @@ AcpiEvGpeDispatch (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Unable to queue handler for GPE[%2X] - event disabled",
|
||||
"Unable to queue handler for GPE[0x%2X] - event disabled",
|
||||
GpeNumber));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* No handler or method to run! */
|
||||
|
||||
/*
|
||||
* No handler or method to run!
|
||||
* 03/2010: This case should no longer be possible. We will not allow
|
||||
* a GPE to be enabled if it has no handler or method.
|
||||
*/
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"No handler or method for GPE[%2X], disabling event",
|
||||
"No handler or method for GPE[0x%2X], disabling event",
|
||||
GpeNumber));
|
||||
|
||||
/*
|
||||
* Disable the GPE. The GPE will remain disabled until the ACPICA
|
||||
* Core Subsystem is restarted, or a handler is installed.
|
||||
* Disable the GPE. The GPE will remain disabled a handler
|
||||
* is installed or ACPICA is restarted.
|
||||
*/
|
||||
Status = AcpiEvDisableGpe (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Unable to disable GPE[%2X]", GpeNumber));
|
||||
"Unable to disable GPE[0x%2X]", GpeNumber));
|
||||
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
break;
|
||||
|
@ -123,28 +123,6 @@
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvSaveMethodInfo (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *ObjDesc,
|
||||
void **ReturnValue);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvMatchPrwAndGpe (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Info,
|
||||
void **ReturnValue);
|
||||
|
||||
static ACPI_GPE_XRUPT_INFO *
|
||||
AcpiEvGetGpeXruptBlock (
|
||||
UINT32 InterruptNumber);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvDeleteGpeXrupt (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvInstallGpeBlock (
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock,
|
||||
@ -155,597 +133,6 @@ AcpiEvCreateGpeInfoBlocks (
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvValidGpeEvent
|
||||
*
|
||||
* PARAMETERS: GpeEventInfo - Info for this GPE
|
||||
*
|
||||
* RETURN: TRUE if the GpeEvent is valid
|
||||
*
|
||||
* DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
|
||||
* Should be called only when the GPE lists are semaphore locked
|
||||
* and not subject to change.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiEvValidGpeEvent (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo)
|
||||
{
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* No need for spin lock since we are not changing any list elements */
|
||||
|
||||
/* Walk the GPE interrupt levels */
|
||||
|
||||
GpeXruptBlock = AcpiGbl_GpeXruptListHead;
|
||||
while (GpeXruptBlock)
|
||||
{
|
||||
GpeBlock = GpeXruptBlock->GpeBlockListHead;
|
||||
|
||||
/* Walk the GPE blocks on this interrupt level */
|
||||
|
||||
while (GpeBlock)
|
||||
{
|
||||
if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
|
||||
(&GpeBlock->EventInfo[((ACPI_SIZE)
|
||||
GpeBlock->RegisterCount) * 8] > GpeEventInfo))
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
GpeBlock = GpeBlock->Next;
|
||||
}
|
||||
|
||||
GpeXruptBlock = GpeXruptBlock->Next;
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvWalkGpeList
|
||||
*
|
||||
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
|
||||
* Context - Value passed to callback
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Walk the GPE lists.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvWalkGpeList (
|
||||
ACPI_GPE_CALLBACK GpeWalkCallback,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvWalkGpeList);
|
||||
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Walk the interrupt level descriptor list */
|
||||
|
||||
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
|
||||
while (GpeXruptInfo)
|
||||
{
|
||||
/* Walk all Gpe Blocks attached to this interrupt level */
|
||||
|
||||
GpeBlock = GpeXruptInfo->GpeBlockListHead;
|
||||
while (GpeBlock)
|
||||
{
|
||||
/* One callback per GPE block */
|
||||
|
||||
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status == AE_CTRL_END) /* Callback abort */
|
||||
{
|
||||
Status = AE_OK;
|
||||
}
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
GpeBlock = GpeBlock->Next;
|
||||
}
|
||||
|
||||
GpeXruptInfo = GpeXruptInfo->Next;
|
||||
}
|
||||
|
||||
UnlockAndExit:
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvDeleteGpeHandlers
|
||||
*
|
||||
* PARAMETERS: GpeXruptInfo - GPE Interrupt info
|
||||
* GpeBlock - Gpe Block info
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Delete all Handler objects found in the GPE data structs.
|
||||
* Used only prior to termination.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeHandlers (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
|
||||
|
||||
|
||||
/* Examine each GPE Register within the block */
|
||||
|
||||
for (i = 0; i < GpeBlock->RegisterCount; i++)
|
||||
{
|
||||
/* Now look at the individual GPEs in this byte register */
|
||||
|
||||
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
|
||||
{
|
||||
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
|
||||
ACPI_GPE_REGISTER_WIDTH) + j];
|
||||
|
||||
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER)
|
||||
{
|
||||
ACPI_FREE (GpeEventInfo->Dispatch.Handler);
|
||||
GpeEventInfo->Dispatch.Handler = NULL;
|
||||
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvSaveMethodInfo
|
||||
*
|
||||
* PARAMETERS: Callback from WalkNamespace
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
|
||||
* control method under the _GPE portion of the namespace.
|
||||
* Extract the name and GPE type from the object, saving this
|
||||
* information for quick lookup during GPE dispatch
|
||||
*
|
||||
* The name of each GPE control method is of the form:
|
||||
* "_Lxx" or "_Exx"
|
||||
* Where:
|
||||
* L - means that the GPE is level triggered
|
||||
* E - means that the GPE is edge triggered
|
||||
* xx - is the GPE number [in HEX]
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvSaveMethodInfo (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *ObjDesc,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock = (void *) ObjDesc;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
UINT32 GpeNumber;
|
||||
char Name[ACPI_NAME_SIZE + 1];
|
||||
UINT8 Type;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvSaveMethodInfo);
|
||||
|
||||
|
||||
/*
|
||||
* _Lxx and _Exx GPE method support
|
||||
*
|
||||
* 1) Extract the name from the object and convert to a string
|
||||
*/
|
||||
ACPI_MOVE_32_TO_32 (
|
||||
Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
|
||||
Name[ACPI_NAME_SIZE] = 0;
|
||||
|
||||
/*
|
||||
* 2) Edge/Level determination is based on the 2nd character
|
||||
* of the method name
|
||||
*
|
||||
* NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
|
||||
* if a _PRW object is found that points to this GPE.
|
||||
*/
|
||||
switch (Name[1])
|
||||
{
|
||||
case 'L':
|
||||
Type = ACPI_GPE_LEVEL_TRIGGERED;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
Type = ACPI_GPE_EDGE_TRIGGERED;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Unknown method type, just ignore it! */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Ignoring unknown GPE method type: %s "
|
||||
"(name not of form _Lxx or _Exx)",
|
||||
Name));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Convert the last two characters of the name to the GPE Number */
|
||||
|
||||
GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
|
||||
if (GpeNumber == ACPI_UINT32_MAX)
|
||||
{
|
||||
/* Conversion failed; invalid method, just ignore it */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Could not extract GPE number from name: %s "
|
||||
"(name is not of form _Lxx or _Exx)",
|
||||
Name));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number for this GPE block */
|
||||
|
||||
if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
|
||||
(GpeNumber >= (GpeBlock->BlockBaseNumber +
|
||||
(GpeBlock->RegisterCount * 8))))
|
||||
{
|
||||
/*
|
||||
* Not valid for this GPE block, just ignore it. However, it may be
|
||||
* valid for a different GPE block, since GPE0 and GPE1 methods both
|
||||
* appear under \_GPE.
|
||||
*/
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we can add this information to the GpeEventInfo block for use
|
||||
* during dispatch of this GPE. Default type is RUNTIME, although this may
|
||||
* change when the _PRW methods are executed later.
|
||||
*/
|
||||
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
|
||||
|
||||
GpeEventInfo->Flags = (UINT8)
|
||||
(Type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
|
||||
|
||||
GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
|
||||
|
||||
/* Update enable mask, but don't enable the HW GPE as of yet */
|
||||
|
||||
Status = AcpiEvEnableGpe (GpeEventInfo, FALSE);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Registered GPE method %s as GPE number 0x%.2X\n",
|
||||
Name, GpeNumber));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvMatchPrwAndGpe
|
||||
*
|
||||
* PARAMETERS: Callback from WalkNamespace
|
||||
*
|
||||
* RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
|
||||
* not aborted on a single _PRW failure.
|
||||
*
|
||||
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
|
||||
* Device. Run the _PRW method. If present, extract the GPE
|
||||
* number and mark the GPE as a WAKE GPE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvMatchPrwAndGpe (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Info,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_GPE_WALK_INFO *GpeInfo = (void *) Info;
|
||||
ACPI_NAMESPACE_NODE *GpeDevice;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_NAMESPACE_NODE *TargetGpeDevice;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_OPERAND_OBJECT *PkgDesc;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
UINT32 GpeNumber;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
|
||||
|
||||
|
||||
/* Check for a _PRW method under this device */
|
||||
|
||||
Status = AcpiUtEvaluateObject (ObjHandle, METHOD_NAME__PRW,
|
||||
ACPI_BTYPE_PACKAGE, &PkgDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Ignore all errors from _PRW, we don't want to abort the subsystem */
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* The returned _PRW package must have at least two elements */
|
||||
|
||||
if (PkgDesc->Package.Count < 2)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Extract pointers from the input context */
|
||||
|
||||
GpeDevice = GpeInfo->GpeDevice;
|
||||
GpeBlock = GpeInfo->GpeBlock;
|
||||
|
||||
/*
|
||||
* The _PRW object must return a package, we are only interested in the
|
||||
* first element
|
||||
*/
|
||||
ObjDesc = PkgDesc->Package.Elements[0];
|
||||
|
||||
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
|
||||
{
|
||||
/* Use FADT-defined GPE device (from definition of _PRW) */
|
||||
|
||||
TargetGpeDevice = AcpiGbl_FadtGpeDevice;
|
||||
|
||||
/* Integer is the GPE number in the FADT described GPE blocks */
|
||||
|
||||
GpeNumber = (UINT32) ObjDesc->Integer.Value;
|
||||
}
|
||||
else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
/* Package contains a GPE reference and GPE number within a GPE block */
|
||||
|
||||
if ((ObjDesc->Package.Count < 2) ||
|
||||
((ObjDesc->Package.Elements[0])->Common.Type !=
|
||||
ACPI_TYPE_LOCAL_REFERENCE) ||
|
||||
((ObjDesc->Package.Elements[1])->Common.Type !=
|
||||
ACPI_TYPE_INTEGER))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get GPE block reference and decode */
|
||||
|
||||
TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node;
|
||||
GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unknown type, just ignore it */
|
||||
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is this GPE within this block?
|
||||
*
|
||||
* TRUE if and only if these conditions are true:
|
||||
* 1) The GPE devices match.
|
||||
* 2) The GPE index(number) is within the range of the Gpe Block
|
||||
* associated with the GPE device.
|
||||
*/
|
||||
if ((GpeDevice == TargetGpeDevice) &&
|
||||
(GpeNumber >= GpeBlock->BlockBaseNumber) &&
|
||||
(GpeNumber < GpeBlock->BlockBaseNumber +
|
||||
(GpeBlock->RegisterCount * 8)))
|
||||
{
|
||||
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber -
|
||||
GpeBlock->BlockBaseNumber];
|
||||
|
||||
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
|
||||
|
||||
GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
|
||||
|
||||
Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
AcpiUtRemoveReference (PkgDesc);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvGetGpeXruptBlock
|
||||
*
|
||||
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
|
||||
*
|
||||
* RETURN: A GPE interrupt block
|
||||
*
|
||||
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
|
||||
* block per unique interrupt level used for GPEs. Should be
|
||||
* called only when the GPE lists are semaphore locked and not
|
||||
* subject to change.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_GPE_XRUPT_INFO *
|
||||
AcpiEvGetGpeXruptBlock (
|
||||
UINT32 InterruptNumber)
|
||||
{
|
||||
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
|
||||
|
||||
|
||||
/* No need for lock since we are not changing any list elements here */
|
||||
|
||||
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
|
||||
while (NextGpeXrupt)
|
||||
{
|
||||
if (NextGpeXrupt->InterruptNumber == InterruptNumber)
|
||||
{
|
||||
return_PTR (NextGpeXrupt);
|
||||
}
|
||||
|
||||
NextGpeXrupt = NextGpeXrupt->Next;
|
||||
}
|
||||
|
||||
/* Not found, must allocate a new xrupt descriptor */
|
||||
|
||||
GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
|
||||
if (!GpeXrupt)
|
||||
{
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
GpeXrupt->InterruptNumber = InterruptNumber;
|
||||
|
||||
/* Install new interrupt descriptor with spin lock */
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
if (AcpiGbl_GpeXruptListHead)
|
||||
{
|
||||
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
|
||||
while (NextGpeXrupt->Next)
|
||||
{
|
||||
NextGpeXrupt = NextGpeXrupt->Next;
|
||||
}
|
||||
|
||||
NextGpeXrupt->Next = GpeXrupt;
|
||||
GpeXrupt->Previous = NextGpeXrupt;
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiGbl_GpeXruptListHead = GpeXrupt;
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
|
||||
/* Install new interrupt handler if not SCI_INT */
|
||||
|
||||
if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
|
||||
{
|
||||
Status = AcpiOsInstallInterruptHandler (InterruptNumber,
|
||||
AcpiEvGpeXruptHandler, GpeXrupt);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not install GPE interrupt handler at level 0x%X",
|
||||
InterruptNumber));
|
||||
return_PTR (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return_PTR (GpeXrupt);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvDeleteGpeXrupt
|
||||
*
|
||||
* PARAMETERS: GpeXrupt - A GPE interrupt info block
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
|
||||
* interrupt handler if not the SCI interrupt.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiEvDeleteGpeXrupt (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
|
||||
|
||||
|
||||
/* We never want to remove the SCI interrupt handler */
|
||||
|
||||
if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
|
||||
{
|
||||
GpeXrupt->GpeBlockListHead = NULL;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Disable this interrupt */
|
||||
|
||||
Status = AcpiOsRemoveInterruptHandler (
|
||||
GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Unlink the interrupt block with lock */
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
if (GpeXrupt->Previous)
|
||||
{
|
||||
GpeXrupt->Previous->Next = GpeXrupt->Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No previous, update list head */
|
||||
|
||||
AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
|
||||
}
|
||||
|
||||
if (GpeXrupt->Next)
|
||||
{
|
||||
GpeXrupt->Next->Previous = GpeXrupt->Previous;
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
|
||||
/* Free the block */
|
||||
|
||||
ACPI_FREE (GpeXrupt);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvInstallGpeBlock
|
||||
@ -880,7 +267,7 @@ AcpiEvDeleteGpeBlock (
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
}
|
||||
|
||||
AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH;
|
||||
AcpiCurrentGpeCount -= GpeBlock->GpeCount;
|
||||
|
||||
/* Free the GpeBlock */
|
||||
|
||||
@ -925,8 +312,8 @@ AcpiEvCreateGpeInfoBlocks (
|
||||
/* Allocate the GPE register information block */
|
||||
|
||||
GpeRegisterInfo = ACPI_ALLOCATE_ZEROED (
|
||||
(ACPI_SIZE) GpeBlock->RegisterCount *
|
||||
sizeof (ACPI_GPE_REGISTER_INFO));
|
||||
(ACPI_SIZE) GpeBlock->RegisterCount *
|
||||
sizeof (ACPI_GPE_REGISTER_INFO));
|
||||
if (!GpeRegisterInfo)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
@ -938,10 +325,8 @@ AcpiEvCreateGpeInfoBlocks (
|
||||
* Allocate the GPE EventInfo block. There are eight distinct GPEs
|
||||
* per register. Initialization to zeros is sufficient.
|
||||
*/
|
||||
GpeEventInfo = ACPI_ALLOCATE_ZEROED (
|
||||
((ACPI_SIZE) GpeBlock->RegisterCount *
|
||||
ACPI_GPE_REGISTER_WIDTH) *
|
||||
sizeof (ACPI_GPE_EVENT_INFO));
|
||||
GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount *
|
||||
sizeof (ACPI_GPE_EVENT_INFO));
|
||||
if (!GpeEventInfo)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
@ -1059,6 +444,7 @@ AcpiEvCreateGpeBlock (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_GPE_WALK_INFO WalkInfo;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
|
||||
@ -1080,6 +466,7 @@ AcpiEvCreateGpeBlock (
|
||||
/* Initialize the new GPE block */
|
||||
|
||||
GpeBlock->Node = GpeDevice;
|
||||
GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
|
||||
GpeBlock->RegisterCount = RegisterCount;
|
||||
GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
|
||||
|
||||
@ -1106,11 +493,16 @@ AcpiEvCreateGpeBlock (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Find all GPE methods (_Lxx, _Exx) for this block */
|
||||
/* Find all GPE methods (_Lxx or_Exx) for this block */
|
||||
|
||||
WalkInfo.GpeBlock = GpeBlock;
|
||||
WalkInfo.GpeDevice = GpeDevice;
|
||||
WalkInfo.EnableThisGpe = FALSE;
|
||||
WalkInfo.ExecuteByOwnerId = FALSE;
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiEvSaveMethodInfo, NULL, GpeBlock, NULL);
|
||||
AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL);
|
||||
|
||||
/* Return the new block */
|
||||
|
||||
@ -1122,15 +514,13 @@ AcpiEvCreateGpeBlock (
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
|
||||
(UINT32) GpeBlock->BlockBaseNumber,
|
||||
(UINT32) (GpeBlock->BlockBaseNumber +
|
||||
((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
|
||||
GpeDevice->Name.Ascii,
|
||||
GpeBlock->RegisterCount,
|
||||
(UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
|
||||
GpeDevice->Name.Ascii, GpeBlock->RegisterCount,
|
||||
InterruptNumber));
|
||||
|
||||
/* Update global count of currently available GPEs */
|
||||
|
||||
AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH;
|
||||
AcpiCurrentGpeCount += GpeBlock->GpeCount;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -1158,9 +548,11 @@ AcpiEvInitializeGpeBlock (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_GPE_WALK_INFO GpeInfo;
|
||||
ACPI_GPE_WALK_INFO WalkInfo;
|
||||
UINT32 WakeGpeCount;
|
||||
UINT32 GpeEnabledCount;
|
||||
UINT32 GpeIndex;
|
||||
UINT32 GpeNumber;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
|
||||
@ -1187,216 +579,82 @@ AcpiEvInitializeGpeBlock (
|
||||
* definition a wake GPE and will not be enabled while the machine
|
||||
* is running.
|
||||
*/
|
||||
GpeInfo.GpeBlock = GpeBlock;
|
||||
GpeInfo.GpeDevice = GpeDevice;
|
||||
WalkInfo.GpeBlock = GpeBlock;
|
||||
WalkInfo.GpeDevice = GpeDevice;
|
||||
WalkInfo.ExecuteByOwnerId = FALSE;
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
|
||||
AcpiEvMatchPrwAndGpe, NULL, &GpeInfo, NULL);
|
||||
AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable all GPEs in this block that have these attributes:
|
||||
* 1) are "runtime" or "run/wake" GPEs, and
|
||||
* 2) have a corresponding _Lxx or _Exx method
|
||||
*
|
||||
* Any other GPEs within this block must be enabled via the
|
||||
* AcpiEnableGpe() external interface.
|
||||
* Enable all GPEs that have a corresponding method and are not
|
||||
* capable of generating wakeups. Any other GPEs within this block
|
||||
* must be enabled via the AcpiEnableGpe interface.
|
||||
*/
|
||||
WakeGpeCount = 0;
|
||||
GpeEnabledCount = 0;
|
||||
|
||||
if (GpeDevice == AcpiGbl_FadtGpeDevice)
|
||||
{
|
||||
GpeDevice = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < GpeBlock->RegisterCount; i++)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
|
||||
{
|
||||
/* Get the info block for this particular GPE */
|
||||
|
||||
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
|
||||
ACPI_GPE_REGISTER_WIDTH) + j];
|
||||
GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
|
||||
GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
|
||||
|
||||
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_METHOD) &&
|
||||
(GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
|
||||
{
|
||||
GpeEnabledCount++;
|
||||
}
|
||||
/* Ignore GPEs that can wake the system */
|
||||
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_TYPE_WAKE)
|
||||
if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
|
||||
{
|
||||
WakeGpeCount++;
|
||||
if (AcpiGbl_LeaveWakeGpesDisabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"Found %u Wake, Enabled %u Runtime GPEs in this block\n",
|
||||
WakeGpeCount, GpeEnabledCount));
|
||||
/* Ignore GPEs that have no corresponding _Lxx/_Exx method */
|
||||
|
||||
/* Enable all valid runtime GPEs found above */
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_METHOD))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
|
||||
GpeBlock));
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvGpeInitialize
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize the GPE data structures
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvGpeInitialize (
|
||||
void)
|
||||
{
|
||||
UINT32 RegisterCount0 = 0;
|
||||
UINT32 RegisterCount1 = 0;
|
||||
UINT32 GpeNumberMax = 0;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvGpeInitialize);
|
||||
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the GPE Block(s) defined in the FADT
|
||||
*
|
||||
* Why the GPE register block lengths are divided by 2: From the ACPI
|
||||
* Spec, section "General-Purpose Event Registers", we have:
|
||||
*
|
||||
* "Each register block contains two registers of equal length
|
||||
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
|
||||
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
|
||||
* The length of the GPE1_STS and GPE1_EN registers is equal to
|
||||
* half the GPE1_LEN. If a generic register block is not supported
|
||||
* then its respective block pointer and block length values in the
|
||||
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
|
||||
* to be the same size."
|
||||
*/
|
||||
|
||||
/*
|
||||
* Determine the maximum GPE number for this machine.
|
||||
*
|
||||
* Note: both GPE0 and GPE1 are optional, and either can exist without
|
||||
* the other.
|
||||
*
|
||||
* If EITHER the register length OR the block address are zero, then that
|
||||
* particular block is not supported.
|
||||
*/
|
||||
if (AcpiGbl_FADT.Gpe0BlockLength &&
|
||||
AcpiGbl_FADT.XGpe0Block.Address)
|
||||
{
|
||||
/* GPE block 0 exists (has both length and address > 0) */
|
||||
|
||||
RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
|
||||
|
||||
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
|
||||
|
||||
/* Install GPE Block 0 */
|
||||
|
||||
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
|
||||
&AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
|
||||
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not create GPE Block 0"));
|
||||
}
|
||||
}
|
||||
|
||||
if (AcpiGbl_FADT.Gpe1BlockLength &&
|
||||
AcpiGbl_FADT.XGpe1Block.Address)
|
||||
{
|
||||
/* GPE block 1 exists (has both length and address > 0) */
|
||||
|
||||
RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
|
||||
|
||||
/* Check for GPE0/GPE1 overlap (if both banks exist) */
|
||||
|
||||
if ((RegisterCount0) &&
|
||||
(GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
|
||||
"(GPE %d to %d) - Ignoring GPE1",
|
||||
GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
|
||||
AcpiGbl_FADT.Gpe1Base +
|
||||
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
|
||||
|
||||
/* Ignore GPE1 block by setting the register count to zero */
|
||||
|
||||
RegisterCount1 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Install GPE Block 1 */
|
||||
|
||||
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
|
||||
&AcpiGbl_FADT.XGpe1Block, RegisterCount1,
|
||||
AcpiGbl_FADT.Gpe1Base,
|
||||
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
|
||||
/* Enable this GPE */
|
||||
|
||||
GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber;
|
||||
Status = AcpiEnableGpe (GpeDevice, GpeNumber,
|
||||
ACPI_GPE_TYPE_RUNTIME);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not create GPE Block 1"));
|
||||
"Could not enable GPE 0x%02X", GpeNumber));
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* GPE0 and GPE1 do not have to be contiguous in the GPE number
|
||||
* space. However, GPE0 always starts at GPE number zero.
|
||||
*/
|
||||
GpeNumberMax = AcpiGbl_FADT.Gpe1Base +
|
||||
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
|
||||
GpeEnabledCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Exit if there are no GPE registers */
|
||||
|
||||
if ((RegisterCount0 + RegisterCount1) == 0)
|
||||
if (GpeEnabledCount || WakeGpeCount)
|
||||
{
|
||||
/* GPEs are not required by ACPI, this is OK */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"There are no GPE blocks defined in the FADT\n"));
|
||||
Status = AE_OK;
|
||||
goto Cleanup;
|
||||
"Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n",
|
||||
GpeEnabledCount, WakeGpeCount));
|
||||
}
|
||||
|
||||
/* Check for Max GPE number out-of-range */
|
||||
|
||||
if (GpeNumberMax > ACPI_GPE_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Maximum GPE number from FADT is too large: 0x%X",
|
||||
GpeNumberMax));
|
||||
Status = AE_BAD_VALUE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
763
src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c
Normal file
763
src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c
Normal file
@ -0,0 +1,763 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: evgpeinit - System GPE initialization and update
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "accommon.h"
|
||||
#include "acevents.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evgpeinit")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvGpeInitialize
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvGpeInitialize (
|
||||
void)
|
||||
{
|
||||
UINT32 RegisterCount0 = 0;
|
||||
UINT32 RegisterCount1 = 0;
|
||||
UINT32 GpeNumberMax = 0;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvGpeInitialize);
|
||||
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the GPE Block(s) defined in the FADT
|
||||
*
|
||||
* Why the GPE register block lengths are divided by 2: From the ACPI
|
||||
* Spec, section "General-Purpose Event Registers", we have:
|
||||
*
|
||||
* "Each register block contains two registers of equal length
|
||||
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
|
||||
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
|
||||
* The length of the GPE1_STS and GPE1_EN registers is equal to
|
||||
* half the GPE1_LEN. If a generic register block is not supported
|
||||
* then its respective block pointer and block length values in the
|
||||
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
|
||||
* to be the same size."
|
||||
*/
|
||||
|
||||
/*
|
||||
* Determine the maximum GPE number for this machine.
|
||||
*
|
||||
* Note: both GPE0 and GPE1 are optional, and either can exist without
|
||||
* the other.
|
||||
*
|
||||
* If EITHER the register length OR the block address are zero, then that
|
||||
* particular block is not supported.
|
||||
*/
|
||||
if (AcpiGbl_FADT.Gpe0BlockLength &&
|
||||
AcpiGbl_FADT.XGpe0Block.Address)
|
||||
{
|
||||
/* GPE block 0 exists (has both length and address > 0) */
|
||||
|
||||
RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
|
||||
|
||||
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
|
||||
|
||||
/* Install GPE Block 0 */
|
||||
|
||||
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
|
||||
&AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
|
||||
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not create GPE Block 0"));
|
||||
}
|
||||
}
|
||||
|
||||
if (AcpiGbl_FADT.Gpe1BlockLength &&
|
||||
AcpiGbl_FADT.XGpe1Block.Address)
|
||||
{
|
||||
/* GPE block 1 exists (has both length and address > 0) */
|
||||
|
||||
RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
|
||||
|
||||
/* Check for GPE0/GPE1 overlap (if both banks exist) */
|
||||
|
||||
if ((RegisterCount0) &&
|
||||
(GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
|
||||
"(GPE %u to %u) - Ignoring GPE1",
|
||||
GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
|
||||
AcpiGbl_FADT.Gpe1Base +
|
||||
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
|
||||
|
||||
/* Ignore GPE1 block by setting the register count to zero */
|
||||
|
||||
RegisterCount1 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Install GPE Block 1 */
|
||||
|
||||
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
|
||||
&AcpiGbl_FADT.XGpe1Block, RegisterCount1,
|
||||
AcpiGbl_FADT.Gpe1Base,
|
||||
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not create GPE Block 1"));
|
||||
}
|
||||
|
||||
/*
|
||||
* GPE0 and GPE1 do not have to be contiguous in the GPE number
|
||||
* space. However, GPE0 always starts at GPE number zero.
|
||||
*/
|
||||
GpeNumberMax = AcpiGbl_FADT.Gpe1Base +
|
||||
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Exit if there are no GPE registers */
|
||||
|
||||
if ((RegisterCount0 + RegisterCount1) == 0)
|
||||
{
|
||||
/* GPEs are not required by ACPI, this is OK */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"There are no GPE blocks defined in the FADT\n"));
|
||||
Status = AE_OK;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Check for Max GPE number out-of-range */
|
||||
|
||||
if (GpeNumberMax > ACPI_GPE_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Maximum GPE number from FADT is too large: 0x%X",
|
||||
GpeNumberMax));
|
||||
Status = AE_BAD_VALUE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvUpdateGpes
|
||||
*
|
||||
* PARAMETERS: TableOwnerId - ID of the newly-loaded ACPI table
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a
|
||||
* result of a Load() or LoadTable() operation. If new GPE
|
||||
* methods have been installed, register the new methods and
|
||||
* enable and runtime GPEs that are associated with them. Also,
|
||||
* run any newly loaded _PRW methods in order to discover any
|
||||
* new CAN_WAKE GPEs.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiEvUpdateGpes (
|
||||
ACPI_OWNER_ID TableOwnerId)
|
||||
{
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_GPE_WALK_INFO WalkInfo;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 NewWakeGpeCount = 0;
|
||||
|
||||
|
||||
/* We will examine only _PRW/_Lxx/_Exx methods owned by this table */
|
||||
|
||||
WalkInfo.OwnerId = TableOwnerId;
|
||||
WalkInfo.ExecuteByOwnerId = TRUE;
|
||||
WalkInfo.Count = 0;
|
||||
|
||||
if (AcpiGbl_LeaveWakeGpesDisabled)
|
||||
{
|
||||
/*
|
||||
* 1) Run any newly-loaded _PRW methods to find any GPEs that
|
||||
* can now be marked as CAN_WAKE GPEs. Note: We must run the
|
||||
* _PRW methods before we process the _Lxx/_Exx methods because
|
||||
* we will enable all runtime GPEs associated with the new
|
||||
* _Lxx/_Exx methods at the time we process those methods.
|
||||
*
|
||||
* Unlock interpreter so that we can run the _PRW methods.
|
||||
*/
|
||||
WalkInfo.GpeBlock = NULL;
|
||||
WalkInfo.GpeDevice = NULL;
|
||||
|
||||
AcpiExExitInterpreter ();
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"While executing _PRW methods"));
|
||||
}
|
||||
|
||||
AcpiExEnterInterpreter ();
|
||||
NewWakeGpeCount = WalkInfo.Count;
|
||||
}
|
||||
|
||||
/*
|
||||
* 2) Find any _Lxx/_Exx GPE methods that have just been loaded.
|
||||
*
|
||||
* Any GPEs that correspond to new _Lxx/_Exx methods and are not
|
||||
* marked as CAN_WAKE are immediately enabled.
|
||||
*
|
||||
* Examine the namespace underneath each GpeDevice within the
|
||||
* GpeBlock lists.
|
||||
*/
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WalkInfo.Count = 0;
|
||||
WalkInfo.EnableThisGpe = TRUE;
|
||||
|
||||
/* Walk the interrupt level descriptor list */
|
||||
|
||||
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
|
||||
while (GpeXruptInfo)
|
||||
{
|
||||
/* Walk all Gpe Blocks attached to this interrupt level */
|
||||
|
||||
GpeBlock = GpeXruptInfo->GpeBlockListHead;
|
||||
while (GpeBlock)
|
||||
{
|
||||
WalkInfo.GpeBlock = GpeBlock;
|
||||
WalkInfo.GpeDevice = GpeBlock->Node;
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD,
|
||||
WalkInfo.GpeDevice, ACPI_UINT32_MAX,
|
||||
ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod,
|
||||
NULL, &WalkInfo, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"While decoding _Lxx/_Exx methods"));
|
||||
}
|
||||
|
||||
GpeBlock = GpeBlock->Next;
|
||||
}
|
||||
|
||||
GpeXruptInfo = GpeXruptInfo->Next;
|
||||
}
|
||||
|
||||
if (WalkInfo.Count || NewWakeGpeCount)
|
||||
{
|
||||
ACPI_INFO ((AE_INFO,
|
||||
"Enabled %u new runtime GPEs, added %u new wakeup GPEs",
|
||||
WalkInfo.Count, NewWakeGpeCount));
|
||||
}
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvMatchGpeMethod
|
||||
*
|
||||
* PARAMETERS: Callback from WalkNamespace
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
|
||||
* control method under the _GPE portion of the namespace.
|
||||
* Extract the name and GPE type from the object, saving this
|
||||
* information for quick lookup during GPE dispatch. Allows a
|
||||
* per-OwnerId evaluation if ExecuteByOwnerId is TRUE in the
|
||||
* WalkInfo parameter block.
|
||||
*
|
||||
* The name of each GPE control method is of the form:
|
||||
* "_Lxx" or "_Exx", where:
|
||||
* L - means that the GPE is level triggered
|
||||
* E - means that the GPE is edge triggered
|
||||
* xx - is the GPE number [in HEX]
|
||||
*
|
||||
* If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods
|
||||
* with that owner.
|
||||
* If WalkInfo->EnableThisGpe is TRUE, the GPE that is referred to by a GPE
|
||||
* method is immediately enabled (Used for Load/LoadTable operators)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvMatchGpeMethod (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
|
||||
ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_NAMESPACE_NODE *GpeDevice;
|
||||
ACPI_STATUS Status;
|
||||
UINT32 GpeNumber;
|
||||
char Name[ACPI_NAME_SIZE + 1];
|
||||
UINT8 Type;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvMatchGpeMethod);
|
||||
|
||||
|
||||
/* Check if requested OwnerId matches this OwnerId */
|
||||
|
||||
if ((WalkInfo->ExecuteByOwnerId) &&
|
||||
(MethodNode->OwnerId != WalkInfo->OwnerId))
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Match and decode the _Lxx and _Exx GPE method names
|
||||
*
|
||||
* 1) Extract the method name and null terminate it
|
||||
*/
|
||||
ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);
|
||||
Name[ACPI_NAME_SIZE] = 0;
|
||||
|
||||
/* 2) Name must begin with an underscore */
|
||||
|
||||
if (Name[0] != '_')
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK); /* Ignore this method */
|
||||
}
|
||||
|
||||
/*
|
||||
* 3) Edge/Level determination is based on the 2nd character
|
||||
* of the method name
|
||||
*
|
||||
* NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is
|
||||
* found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set.
|
||||
*/
|
||||
switch (Name[1])
|
||||
{
|
||||
case 'L':
|
||||
Type = ACPI_GPE_LEVEL_TRIGGERED;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
Type = ACPI_GPE_EDGE_TRIGGERED;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Unknown method type, just ignore it */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Ignoring unknown GPE method type: %s "
|
||||
"(name not of form _Lxx or _Exx)", Name));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* 4) The last two characters of the name are the hex GPE Number */
|
||||
|
||||
GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
|
||||
if (GpeNumber == ACPI_UINT32_MAX)
|
||||
{
|
||||
/* Conversion failed; invalid method, just ignore it */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Could not extract GPE number from name: %s "
|
||||
"(name is not of form _Lxx or _Exx)", Name));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number for this GPE block */
|
||||
|
||||
GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
|
||||
if (!GpeEventInfo)
|
||||
{
|
||||
/*
|
||||
* This GpeNumber is not valid for this GPE block, just ignore it.
|
||||
* However, it may be valid for a different GPE block, since GPE0
|
||||
* and GPE1 methods both appear under \_GPE.
|
||||
*/
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER)
|
||||
{
|
||||
/* If there is already a handler, ignore this GPE method */
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_METHOD)
|
||||
{
|
||||
/*
|
||||
* If there is already a method, ignore this method. But check
|
||||
* for a type mismatch (if both the _Lxx AND _Exx exist)
|
||||
*/
|
||||
if (Type != (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"For GPE 0x%.2X, found both _L%2.2X and _E%2.2X methods",
|
||||
GpeNumber, GpeNumber, GpeNumber));
|
||||
}
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the GPE information from above to the GpeEventInfo block for
|
||||
* use during dispatch of this GPE.
|
||||
*/
|
||||
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD);
|
||||
GpeEventInfo->Dispatch.MethodNode = MethodNode;
|
||||
|
||||
/*
|
||||
* Enable this GPE if requested. This only happens when during the
|
||||
* execution of a Load or LoadTable operator. We have found a new
|
||||
* GPE method and want to immediately enable the GPE if it is a
|
||||
* runtime GPE.
|
||||
*/
|
||||
if (WalkInfo->EnableThisGpe)
|
||||
{
|
||||
/* Ignore GPEs that can wake the system */
|
||||
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) ||
|
||||
!AcpiGbl_LeaveWakeGpesDisabled)
|
||||
{
|
||||
WalkInfo->Count++;
|
||||
GpeDevice = WalkInfo->GpeDevice;
|
||||
|
||||
if (GpeDevice == AcpiGbl_FadtGpeDevice)
|
||||
{
|
||||
GpeDevice = NULL;
|
||||
}
|
||||
|
||||
Status = AcpiEnableGpe (GpeDevice, GpeNumber,
|
||||
ACPI_GPE_TYPE_RUNTIME);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not enable GPE 0x%02X", GpeNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
|
||||
"Registered GPE method %s as GPE number 0x%.2X\n",
|
||||
Name, GpeNumber));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvMatchPrwAndGpe
|
||||
*
|
||||
* PARAMETERS: Callback from WalkNamespace
|
||||
*
|
||||
* RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
|
||||
* not aborted on a single _PRW failure.
|
||||
*
|
||||
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
|
||||
* Device. Run the _PRW method. If present, extract the GPE
|
||||
* number and mark the GPE as a CAN_WAKE GPE. Allows a
|
||||
* per-OwnerId execution if ExecuteByOwnerId is TRUE in the
|
||||
* WalkInfo parameter block.
|
||||
*
|
||||
* If WalkInfo->ExecuteByOwnerId is TRUE, we only execute _PRWs with that
|
||||
* owner.
|
||||
* If WalkInfo->GpeDevice is NULL, we execute every _PRW found. Otherwise,
|
||||
* we only execute _PRWs that refer to the input GpeDevice.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvMatchPrwAndGpe (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
|
||||
ACPI_NAMESPACE_NODE *GpeDevice;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_NAMESPACE_NODE *TargetGpeDevice;
|
||||
ACPI_NAMESPACE_NODE *PrwNode;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_OPERAND_OBJECT *PkgDesc;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
UINT32 GpeNumber;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
|
||||
|
||||
|
||||
/* Check for a _PRW method under this device */
|
||||
|
||||
Status = AcpiNsGetNode (ObjHandle, METHOD_NAME__PRW,
|
||||
ACPI_NS_NO_UPSEARCH, &PrwNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Check if requested OwnerId matches this OwnerId */
|
||||
|
||||
if ((WalkInfo->ExecuteByOwnerId) &&
|
||||
(PrwNode->OwnerId != WalkInfo->OwnerId))
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Execute the _PRW */
|
||||
|
||||
Status = AcpiUtEvaluateObject (PrwNode, NULL,
|
||||
ACPI_BTYPE_PACKAGE, &PkgDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* The returned _PRW package must have at least two elements */
|
||||
|
||||
if (PkgDesc->Package.Count < 2)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Extract pointers from the input context */
|
||||
|
||||
GpeDevice = WalkInfo->GpeDevice;
|
||||
GpeBlock = WalkInfo->GpeBlock;
|
||||
|
||||
/*
|
||||
* The _PRW object must return a package, we are only interested
|
||||
* in the first element
|
||||
*/
|
||||
ObjDesc = PkgDesc->Package.Elements[0];
|
||||
|
||||
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
|
||||
{
|
||||
/* Use FADT-defined GPE device (from definition of _PRW) */
|
||||
|
||||
TargetGpeDevice = NULL;
|
||||
if (GpeDevice)
|
||||
{
|
||||
TargetGpeDevice = AcpiGbl_FadtGpeDevice;
|
||||
}
|
||||
|
||||
/* Integer is the GPE number in the FADT described GPE blocks */
|
||||
|
||||
GpeNumber = (UINT32) ObjDesc->Integer.Value;
|
||||
}
|
||||
else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
/* Package contains a GPE reference and GPE number within a GPE block */
|
||||
|
||||
if ((ObjDesc->Package.Count < 2) ||
|
||||
((ObjDesc->Package.Elements[0])->Common.Type !=
|
||||
ACPI_TYPE_LOCAL_REFERENCE) ||
|
||||
((ObjDesc->Package.Elements[1])->Common.Type !=
|
||||
ACPI_TYPE_INTEGER))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get GPE block reference and decode */
|
||||
|
||||
TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node;
|
||||
GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unknown type, just ignore it */
|
||||
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get the GpeEventInfo for this GPE */
|
||||
|
||||
if (GpeDevice)
|
||||
{
|
||||
/*
|
||||
* Is this GPE within this block?
|
||||
*
|
||||
* TRUE if and only if these conditions are true:
|
||||
* 1) The GPE devices match.
|
||||
* 2) The GPE index(number) is within the range of the Gpe Block
|
||||
* associated with the GPE device.
|
||||
*/
|
||||
if (GpeDevice != TargetGpeDevice)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GpeDevice is NULL, just match the TargetDevice and GpeNumber */
|
||||
|
||||
GpeEventInfo = AcpiEvGetGpeEventInfo (TargetGpeDevice, GpeNumber);
|
||||
}
|
||||
|
||||
if (GpeEventInfo)
|
||||
{
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
|
||||
{
|
||||
/* This GPE can wake the system */
|
||||
|
||||
GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
|
||||
WalkInfo->Count++;
|
||||
}
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
AcpiUtRemoveReference (PkgDesc);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
452
src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c
Normal file
452
src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c
Normal file
@ -0,0 +1,452 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: evgpeutil - GPE utilities
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "accommon.h"
|
||||
#include "acevents.h"
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evgpeutil")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvWalkGpeList
|
||||
*
|
||||
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
|
||||
* Context - Value passed to callback
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Walk the GPE lists.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvWalkGpeList (
|
||||
ACPI_GPE_CALLBACK GpeWalkCallback,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvWalkGpeList);
|
||||
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Walk the interrupt level descriptor list */
|
||||
|
||||
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
|
||||
while (GpeXruptInfo)
|
||||
{
|
||||
/* Walk all Gpe Blocks attached to this interrupt level */
|
||||
|
||||
GpeBlock = GpeXruptInfo->GpeBlockListHead;
|
||||
while (GpeBlock)
|
||||
{
|
||||
/* One callback per GPE block */
|
||||
|
||||
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status == AE_CTRL_END) /* Callback abort */
|
||||
{
|
||||
Status = AE_OK;
|
||||
}
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
GpeBlock = GpeBlock->Next;
|
||||
}
|
||||
|
||||
GpeXruptInfo = GpeXruptInfo->Next;
|
||||
}
|
||||
|
||||
UnlockAndExit:
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvValidGpeEvent
|
||||
*
|
||||
* PARAMETERS: GpeEventInfo - Info for this GPE
|
||||
*
|
||||
* RETURN: TRUE if the GpeEvent is valid
|
||||
*
|
||||
* DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
|
||||
* Should be called only when the GPE lists are semaphore locked
|
||||
* and not subject to change.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiEvValidGpeEvent (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo)
|
||||
{
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* No need for spin lock since we are not changing any list elements */
|
||||
|
||||
/* Walk the GPE interrupt levels */
|
||||
|
||||
GpeXruptBlock = AcpiGbl_GpeXruptListHead;
|
||||
while (GpeXruptBlock)
|
||||
{
|
||||
GpeBlock = GpeXruptBlock->GpeBlockListHead;
|
||||
|
||||
/* Walk the GPE blocks on this interrupt level */
|
||||
|
||||
while (GpeBlock)
|
||||
{
|
||||
if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
|
||||
(&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo))
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
GpeBlock = GpeBlock->Next;
|
||||
}
|
||||
|
||||
GpeXruptBlock = GpeXruptBlock->Next;
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvGetGpeXruptBlock
|
||||
*
|
||||
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
|
||||
*
|
||||
* RETURN: A GPE interrupt block
|
||||
*
|
||||
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
|
||||
* block per unique interrupt level used for GPEs. Should be
|
||||
* called only when the GPE lists are semaphore locked and not
|
||||
* subject to change.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_GPE_XRUPT_INFO *
|
||||
AcpiEvGetGpeXruptBlock (
|
||||
UINT32 InterruptNumber)
|
||||
{
|
||||
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
|
||||
|
||||
|
||||
/* No need for lock since we are not changing any list elements here */
|
||||
|
||||
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
|
||||
while (NextGpeXrupt)
|
||||
{
|
||||
if (NextGpeXrupt->InterruptNumber == InterruptNumber)
|
||||
{
|
||||
return_PTR (NextGpeXrupt);
|
||||
}
|
||||
|
||||
NextGpeXrupt = NextGpeXrupt->Next;
|
||||
}
|
||||
|
||||
/* Not found, must allocate a new xrupt descriptor */
|
||||
|
||||
GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
|
||||
if (!GpeXrupt)
|
||||
{
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
GpeXrupt->InterruptNumber = InterruptNumber;
|
||||
|
||||
/* Install new interrupt descriptor with spin lock */
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
if (AcpiGbl_GpeXruptListHead)
|
||||
{
|
||||
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
|
||||
while (NextGpeXrupt->Next)
|
||||
{
|
||||
NextGpeXrupt = NextGpeXrupt->Next;
|
||||
}
|
||||
|
||||
NextGpeXrupt->Next = GpeXrupt;
|
||||
GpeXrupt->Previous = NextGpeXrupt;
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiGbl_GpeXruptListHead = GpeXrupt;
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
|
||||
/* Install new interrupt handler if not SCI_INT */
|
||||
|
||||
if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
|
||||
{
|
||||
Status = AcpiOsInstallInterruptHandler (InterruptNumber,
|
||||
AcpiEvGpeXruptHandler, GpeXrupt);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not install GPE interrupt handler at level 0x%X",
|
||||
InterruptNumber));
|
||||
return_PTR (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return_PTR (GpeXrupt);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvDeleteGpeXrupt
|
||||
*
|
||||
* PARAMETERS: GpeXrupt - A GPE interrupt info block
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
|
||||
* interrupt handler if not the SCI interrupt.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeXrupt (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
|
||||
|
||||
|
||||
/* We never want to remove the SCI interrupt handler */
|
||||
|
||||
if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
|
||||
{
|
||||
GpeXrupt->GpeBlockListHead = NULL;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Disable this interrupt */
|
||||
|
||||
Status = AcpiOsRemoveInterruptHandler (
|
||||
GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Unlink the interrupt block with lock */
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
if (GpeXrupt->Previous)
|
||||
{
|
||||
GpeXrupt->Previous->Next = GpeXrupt->Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No previous, update list head */
|
||||
|
||||
AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
|
||||
}
|
||||
|
||||
if (GpeXrupt->Next)
|
||||
{
|
||||
GpeXrupt->Next->Previous = GpeXrupt->Previous;
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
|
||||
/* Free the block */
|
||||
|
||||
ACPI_FREE (GpeXrupt);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvDeleteGpeHandlers
|
||||
*
|
||||
* PARAMETERS: GpeXruptInfo - GPE Interrupt info
|
||||
* GpeBlock - Gpe Block info
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Delete all Handler objects found in the GPE data structs.
|
||||
* Used only prior to termination.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeHandlers (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
|
||||
|
||||
|
||||
/* Examine each GPE Register within the block */
|
||||
|
||||
for (i = 0; i < GpeBlock->RegisterCount; i++)
|
||||
{
|
||||
/* Now look at the individual GPEs in this byte register */
|
||||
|
||||
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
|
||||
{
|
||||
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
|
||||
ACPI_GPE_REGISTER_WIDTH) + j];
|
||||
|
||||
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER)
|
||||
{
|
||||
ACPI_FREE (GpeEventInfo->Dispatch.Handler);
|
||||
GpeEventInfo->Dispatch.Handler = NULL;
|
||||
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ AcpiEvTerminate (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not disable fixed event %d", (UINT32) i));
|
||||
"Could not disable fixed event %u", (UINT32) i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ AcpiInstallFixedEventHandler (
|
||||
Status = AcpiEnableEvent (Event, 0);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO, "Could not enable fixed event %X", Event));
|
||||
ACPI_WARNING ((AE_INFO, "Could not enable fixed event 0x%X", Event));
|
||||
|
||||
/* Remove the handler */
|
||||
|
||||
@ -303,7 +303,7 @@ AcpiRemoveFixedEventHandler (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"Could not write to fixed event enable register %X", Event));
|
||||
"Could not write to fixed event enable register 0x%X", Event));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -705,7 +705,7 @@ AcpiInstallGpeHandler (
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!Address) || (Type > ACPI_GPE_XRUPT_TYPE_MASK))
|
||||
if ((!Address) || (Type & ~ACPI_GPE_XRUPT_TYPE_MASK))
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -305,70 +305,20 @@ AcpiEnableEvent (
|
||||
ACPI_EXPORT_SYMBOL (AcpiEnableEvent)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiSetGpeType
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Type - New GPE type
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Set the type of an individual GPE
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiSetGpeType (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT8 Type)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiSetGpeType);
|
||||
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
|
||||
if (!GpeEventInfo)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == Type)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Set the new type (will disable GPE if currently enabled) */
|
||||
|
||||
Status = AcpiEvSetGpeType (GpeEventInfo, Type);
|
||||
|
||||
UnlockAndExit:
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiSetGpeType)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEnableGpe
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Flags - Just enable, or also wake enable?
|
||||
* Called from ISR or not
|
||||
* GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
|
||||
* or both
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Enable an ACPI event (general purpose)
|
||||
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
|
||||
* hardware-enabled (for runtime GPEs), or the GPE register mask
|
||||
* is updated (for wake GPEs).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -376,26 +326,25 @@ ACPI_STATUS
|
||||
AcpiEnableGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags)
|
||||
UINT8 GpeType)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiEnableGpe);
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
/* Parameter validation */
|
||||
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN))
|
||||
{
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
|
||||
@ -405,15 +354,55 @@ AcpiEnableGpe (
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/* Perform the enable */
|
||||
if (GpeType & ACPI_GPE_TYPE_RUNTIME)
|
||||
{
|
||||
if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX)
|
||||
{
|
||||
Status = AE_LIMIT; /* Too many references */
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiEvEnableGpe (GpeEventInfo, TRUE);
|
||||
GpeEventInfo->RuntimeCount++;
|
||||
if (GpeEventInfo->RuntimeCount == 1)
|
||||
{
|
||||
Status = AcpiEvEnableGpe (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
GpeEventInfo->RuntimeCount--;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GpeType & ACPI_GPE_TYPE_WAKE)
|
||||
{
|
||||
/* The GPE must have the ability to wake the system */
|
||||
|
||||
if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
|
||||
{
|
||||
Status = AE_TYPE;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
if (GpeEventInfo->WakeupCount == ACPI_UINT8_MAX)
|
||||
{
|
||||
Status = AE_LIMIT; /* Too many references */
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the enable mask on the first wakeup reference. Wake GPEs
|
||||
* are only hardware-enabled just before sleeping.
|
||||
*/
|
||||
GpeEventInfo->WakeupCount++;
|
||||
if (GpeEventInfo->WakeupCount == 1)
|
||||
{
|
||||
(void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
|
||||
}
|
||||
}
|
||||
|
||||
UnlockAndExit:
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -424,14 +413,16 @@ ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
|
||||
*
|
||||
* FUNCTION: AcpiDisableGpe
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Flags - Just disable, or also wake disable?
|
||||
* Called from ISR or not
|
||||
* GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
|
||||
* or both
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Disable an ACPI event (general purpose)
|
||||
* DESCRIPTION: Remove a reference to a GPE. When the last reference is
|
||||
* removed, only then is the GPE disabled (for runtime GPEs), or
|
||||
* the GPE mask bit disabled (for wake GPEs)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -439,26 +430,25 @@ ACPI_STATUS
|
||||
AcpiDisableGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags)
|
||||
UINT8 GpeType)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiDisableGpe);
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
/* Parameter validation */
|
||||
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN))
|
||||
{
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
|
||||
@ -468,19 +458,127 @@ AcpiDisableGpe (
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiEvDisableGpe (GpeEventInfo);
|
||||
/* Hardware-disable a runtime GPE on removal of the last reference */
|
||||
|
||||
if (GpeType & ACPI_GPE_TYPE_RUNTIME)
|
||||
{
|
||||
if (!GpeEventInfo->RuntimeCount)
|
||||
{
|
||||
Status = AE_LIMIT; /* There are no references to remove */
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
GpeEventInfo->RuntimeCount--;
|
||||
if (!GpeEventInfo->RuntimeCount)
|
||||
{
|
||||
Status = AcpiEvDisableGpe (GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
GpeEventInfo->RuntimeCount++;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Update masks for wake GPE on removal of the last reference.
|
||||
* No need to hardware-disable wake GPEs here, they are not currently
|
||||
* enabled.
|
||||
*/
|
||||
if (GpeType & ACPI_GPE_TYPE_WAKE)
|
||||
{
|
||||
if (!GpeEventInfo->WakeupCount)
|
||||
{
|
||||
Status = AE_LIMIT; /* There are no references to remove */
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
GpeEventInfo->WakeupCount--;
|
||||
if (!GpeEventInfo->WakeupCount)
|
||||
{
|
||||
(void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UnlockAndExit:
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiSetGpe
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Enable or disable an individual GPE. This function bypasses
|
||||
* the reference count mechanism used in the AcpiEnableGpe and
|
||||
* AcpiDisableGpe interfaces -- and should be used with care.
|
||||
*
|
||||
* Note: Typically used to disable a runtime GPE for short period of time,
|
||||
* then re-enable it, without disturbing the existing reference counts. This
|
||||
* is useful, for example, in the Embedded Controller (EC) driver.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiSetGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT8 Action)
|
||||
{
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiSetGpe);
|
||||
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
|
||||
if (!GpeEventInfo)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/* Perform the action */
|
||||
|
||||
switch (Action)
|
||||
{
|
||||
case ACPI_GPE_ENABLE:
|
||||
Status = AcpiEvEnableGpe (GpeEventInfo);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_DISABLE:
|
||||
Status = AcpiEvDisableGpe (GpeEventInfo);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = AE_BAD_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
UnlockAndExit:
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiSetGpe)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDisableEvent
|
||||
@ -592,9 +690,8 @@ ACPI_EXPORT_SYMBOL (AcpiClearEvent)
|
||||
*
|
||||
* FUNCTION: AcpiClearGpe
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Flags - Called from an ISR or not
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -605,26 +702,17 @@ ACPI_EXPORT_SYMBOL (AcpiClearEvent)
|
||||
ACPI_STATUS
|
||||
AcpiClearGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags)
|
||||
UINT32 GpeNumber)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiClearGpe);
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
@ -638,10 +726,7 @@ AcpiClearGpe (
|
||||
Status = AcpiHwClearGpe (GpeEventInfo);
|
||||
|
||||
UnlockAndExit:
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -700,9 +785,8 @@ ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
|
||||
*
|
||||
* FUNCTION: AcpiGetGpeStatus
|
||||
*
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device
|
||||
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
|
||||
* GpeNumber - GPE level within the GPE block
|
||||
* Flags - Called from an ISR or not
|
||||
* EventStatus - Where the current status of the event will
|
||||
* be returned
|
||||
*
|
||||
@ -716,26 +800,17 @@ ACPI_STATUS
|
||||
AcpiGetGpeStatus (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags,
|
||||
ACPI_EVENT_STATUS *EventStatus)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
@ -751,10 +826,7 @@ AcpiGetGpeStatus (
|
||||
Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
|
||||
|
||||
UnlockAndExit:
|
||||
if (Flags & ACPI_NOT_ISR)
|
||||
{
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
|
||||
}
|
||||
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -823,21 +895,15 @@ AcpiInstallGpeBlock (
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/* Run the _PRW methods and enable the GPEs */
|
||||
|
||||
Status = AcpiEvInitializeGpeBlock (Node, GpeBlock);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/* Get the DeviceObject attached to the node */
|
||||
/* Install block in the DeviceObject attached to the node */
|
||||
|
||||
ObjDesc = AcpiNsGetAttachedObject (Node);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
/* No object, create a new one */
|
||||
|
||||
/*
|
||||
* No object, create a new one (Device nodes do not always have
|
||||
* an attached object)
|
||||
*/
|
||||
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
@ -850,17 +916,20 @@ AcpiInstallGpeBlock (
|
||||
/* Remove local reference to the object */
|
||||
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Install the GPE block in the DeviceObject */
|
||||
/* Now install the GPE block in the DeviceObject */
|
||||
|
||||
ObjDesc->Device.GpeBlock = GpeBlock;
|
||||
|
||||
/* Run the _PRW methods and enable the runtime GPEs in the new block */
|
||||
|
||||
Status = AcpiEvInitializeGpeBlock (Node, GpeBlock);
|
||||
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
@ -1018,8 +1087,7 @@ AcpiEvGetGpeDevice (
|
||||
|
||||
/* Increment Index by the number of GPEs in this block */
|
||||
|
||||
Info->NextBlockBaseIndex +=
|
||||
(GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH);
|
||||
Info->NextBlockBaseIndex += GpeBlock->GpeCount;
|
||||
|
||||
if (Info->Index < Info->NextBlockBaseIndex)
|
||||
{
|
||||
|
@ -164,8 +164,9 @@ AcpiExAddTable (
|
||||
ACPI_NAMESPACE_NODE *ParentNode,
|
||||
ACPI_OPERAND_OBJECT **DdbHandle)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OWNER_ID OwnerId;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (ExAddTable);
|
||||
@ -205,7 +206,15 @@ AcpiExAddTable (
|
||||
AcpiNsExecModuleCodeList ();
|
||||
AcpiExEnterInterpreter ();
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
/* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */
|
||||
|
||||
Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
AcpiEvUpdateGpes (OwnerId);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
@ -347,9 +356,8 @@ AcpiExLoadTableOp (
|
||||
Status = AcpiGetTableByIndex (TableIndex, &Table);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
ACPI_INFO ((AE_INFO,
|
||||
"Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]",
|
||||
Table->Signature, Table->OemId, Table->OemTableId));
|
||||
ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
|
||||
AcpiTbPrintTableHeader (0, Table);
|
||||
}
|
||||
|
||||
/* Invoke table handler if present */
|
||||
@ -644,6 +652,9 @@ AcpiExLoadOp (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
|
||||
AcpiTbPrintTableHeader (0, TableDesc.Pointer);
|
||||
|
||||
/* Remove the reference by added by AcpiExStore above */
|
||||
|
||||
AcpiUtRemoveReference (DdbHandle);
|
||||
|
@ -786,7 +786,7 @@ AcpiExConvertToTargetType (
|
||||
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X",
|
||||
DestinationType));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
@ -803,7 +803,7 @@ AcpiExConvertToTargetType (
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
|
||||
"Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
|
||||
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
|
||||
WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
|
||||
Status = AE_AML_INTERNAL;
|
||||
|
@ -402,11 +402,11 @@ AcpiExCreateRegion (
|
||||
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
|
||||
(RegionSpace < ACPI_USER_REGION_BEGIN))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type %X", RegionSpace));
|
||||
ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
|
||||
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
|
||||
AcpiUtGetRegionName (RegionSpace), RegionSpace));
|
||||
|
||||
/* Create the region descriptor */
|
||||
|
350
src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c
Normal file
350
src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c
Normal file
@ -0,0 +1,350 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exdebug - Support for stores to the AML Debug Object
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __EXDEBUG_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "accommon.h"
|
||||
#include "acinterp.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exdebug")
|
||||
|
||||
|
||||
#ifndef ACPI_NO_ERROR_MESSAGES
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExDoDebugObject
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Object to be output to "Debug Object"
|
||||
* Level - Indentation level (used for packages)
|
||||
* Index - Current package element, zero if not pkg
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Handles stores to the AML Debug Object. For example:
|
||||
* Store(INT1, Debug)
|
||||
*
|
||||
* This function is not compiled if ACPI_NO_ERROR_MESSAGES is set.
|
||||
*
|
||||
* This function is only enabled if AcpiGbl_EnableAmlDebugObject is set, or
|
||||
* if ACPI_LV_DEBUG_OBJECT is set in the AcpiDbgLevel. Thus, in the normal
|
||||
* operational case, stores to the debug object are ignored but can be easily
|
||||
* enabled if necessary.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiExDoDebugObject (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
UINT32 Level,
|
||||
UINT32 Index)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
|
||||
|
||||
|
||||
/* Output must be enabled via the DebugObject global or the DbgLevel */
|
||||
|
||||
if (!AcpiGbl_EnableAmlDebugObject &&
|
||||
!(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT))
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print line header as long as we are not in the middle of an
|
||||
* object display
|
||||
*/
|
||||
if (!((Level > 0) && Index == 0))
|
||||
{
|
||||
AcpiOsPrintf ("[ACPI Debug] %*s", Level, " ");
|
||||
}
|
||||
|
||||
/* Display the index for package output only */
|
||||
|
||||
if (Index > 0)
|
||||
{
|
||||
AcpiOsPrintf ("(%.2u) ", Index-1);
|
||||
}
|
||||
|
||||
if (!SourceDesc)
|
||||
{
|
||||
AcpiOsPrintf ("[Null Object]\n");
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
|
||||
{
|
||||
AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
|
||||
|
||||
if (!AcpiUtValidInternalObject (SourceDesc))
|
||||
{
|
||||
AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc);
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
AcpiOsPrintf ("%s: %p\n",
|
||||
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
|
||||
SourceDesc);
|
||||
return_VOID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
|
||||
|
||||
switch (SourceDesc->Common.Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/* Output correct integer width */
|
||||
|
||||
if (AcpiGbl_IntegerByteWidth == 4)
|
||||
{
|
||||
AcpiOsPrintf ("0x%8.8X\n",
|
||||
(UINT32) SourceDesc->Integer.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length);
|
||||
AcpiUtDumpBuffer2 (SourceDesc->Buffer.Pointer,
|
||||
(SourceDesc->Buffer.Length < 256) ?
|
||||
SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
AcpiOsPrintf ("[0x%.2X] \"%s\"\n",
|
||||
SourceDesc->String.Length, SourceDesc->String.Pointer);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
AcpiOsPrintf ("[Contains 0x%.2X Elements]\n",
|
||||
SourceDesc->Package.Count);
|
||||
|
||||
/* Output the entire contents of the package */
|
||||
|
||||
for (i = 0; i < SourceDesc->Package.Count; i++)
|
||||
{
|
||||
AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
|
||||
Level+4, i+1);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||
|
||||
AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc));
|
||||
|
||||
/* Decode the reference */
|
||||
|
||||
switch (SourceDesc->Reference.Class)
|
||||
{
|
||||
case ACPI_REFCLASS_INDEX:
|
||||
|
||||
AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value);
|
||||
break;
|
||||
|
||||
case ACPI_REFCLASS_TABLE:
|
||||
|
||||
/* Case for DdbHandle */
|
||||
|
||||
AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (" ");
|
||||
|
||||
/* Check for valid node first, then valid object */
|
||||
|
||||
if (SourceDesc->Reference.Node)
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
|
||||
ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
AcpiOsPrintf (" %p - Not a valid namespace node\n",
|
||||
SourceDesc->Reference.Node);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node,
|
||||
(SourceDesc->Reference.Node)->Name.Ascii);
|
||||
|
||||
switch ((SourceDesc->Reference.Node)->Type)
|
||||
{
|
||||
/* These types have no attached object */
|
||||
|
||||
case ACPI_TYPE_DEVICE:
|
||||
AcpiOsPrintf ("Device\n");
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_THERMAL:
|
||||
AcpiOsPrintf ("Thermal Zone\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
|
||||
Level+4, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SourceDesc->Reference.Object)
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
|
||||
ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
|
||||
SourceDesc->Reference.Object)->Object,
|
||||
Level+4, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiExDoDebugObject (SourceDesc->Reference.Object,
|
||||
Level+4, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AcpiOsPrintf ("%p\n", SourceDesc);
|
||||
break;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
|
||||
return_VOID;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -382,7 +382,7 @@ AcpiExWriteDataToField (
|
||||
if (SourceDesc->Buffer.Length < Length)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"SMBus or IPMI write requires Buffer of length %X, found length %X",
|
||||
"SMBus or IPMI write requires Buffer of length %u, found length %u",
|
||||
Length, SourceDesc->Buffer.Length));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
|
||||
|
@ -181,7 +181,7 @@ AcpiExSetupRegion (
|
||||
|
||||
if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
|
||||
ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
|
||||
RgnDesc->Common.Type,
|
||||
AcpiUtGetObjectTypeName (RgnDesc)));
|
||||
|
||||
@ -262,7 +262,7 @@ AcpiExSetupRegion (
|
||||
* byte, and a field with Dword access specified.
|
||||
*/
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)",
|
||||
"Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)",
|
||||
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
|
||||
ObjDesc->CommonField.AccessByteWidth,
|
||||
AcpiUtGetNodeName (RgnDesc->Region.Node),
|
||||
@ -274,7 +274,7 @@ AcpiExSetupRegion (
|
||||
* exceeds region length, indicate an error
|
||||
*/
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
|
||||
"Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)",
|
||||
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
|
||||
ObjDesc->CommonField.BaseByteOffset,
|
||||
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
|
||||
@ -371,14 +371,14 @@ AcpiExAccessRegion (
|
||||
if (Status == AE_NOT_IMPLEMENTED)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Region %s(%X) not implemented",
|
||||
"Region %s(0x%X) not implemented",
|
||||
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
|
||||
RgnDesc->Region.SpaceId));
|
||||
}
|
||||
else if (Status == AE_NOT_EXIST)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Region %s(%X) has no handler",
|
||||
"Region %s(0x%X) has no handler",
|
||||
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
|
||||
RgnDesc->Region.SpaceId));
|
||||
}
|
||||
@ -633,7 +633,7 @@ AcpiExFieldDatumIo (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
|
||||
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %u",
|
||||
ObjDesc->Common.Type));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
@ -743,7 +743,7 @@ AcpiExWriteWithUpdateRule (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown UpdateRule value: %X",
|
||||
"Unknown UpdateRule value: 0x%X",
|
||||
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
||||
}
|
||||
@ -806,7 +806,7 @@ AcpiExExtractFromField (
|
||||
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Field size %X (bits) is too large for buffer (%X)",
|
||||
"Field size %u (bits) is too large for buffer (%u)",
|
||||
ObjDesc->CommonField.BitLength, BufferLength));
|
||||
|
||||
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
|
||||
|
@ -183,7 +183,7 @@ AcpiExGetObjectReference (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
|
||||
ObjDesc->Reference.Class));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
@ -201,7 +201,7 @@ AcpiExGetObjectReference (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Invalid descriptor type %X",
|
||||
ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
|
||||
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
@ -373,7 +373,7 @@ AcpiExDoConcatenate (
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
|
||||
Operand0->Common.Type));
|
||||
Status = AE_AML_INTERNAL;
|
||||
}
|
||||
@ -475,7 +475,7 @@ AcpiExDoConcatenate (
|
||||
|
||||
/* Invalid object type, should not happen here */
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
|
||||
Operand0->Common.Type));
|
||||
Status =AE_AML_INTERNAL;
|
||||
goto Cleanup;
|
||||
|
@ -168,10 +168,10 @@ AcpiExUnlinkMutex (
|
||||
(ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
|
||||
|
||||
/*
|
||||
* Migrate the previous sync level associated with this mutex to the
|
||||
* previous mutex on the list so that it may be preserved. This handles
|
||||
* the case where several mutexes have been acquired at the same level,
|
||||
* but are not released in opposite order.
|
||||
* Migrate the previous sync level associated with this mutex to
|
||||
* the previous mutex on the list so that it may be preserved.
|
||||
* This handles the case where several mutexes have been acquired
|
||||
* at the same level, but are not released in opposite order.
|
||||
*/
|
||||
(ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel =
|
||||
ObjDesc->Mutex.OriginalSyncLevel;
|
||||
@ -187,8 +187,8 @@ AcpiExUnlinkMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExLinkMutex
|
||||
*
|
||||
* PARAMETERS: ObjDesc - The mutex to be linked
|
||||
* Thread - Current executing thread object
|
||||
* PARAMETERS: ObjDesc - The mutex to be linked
|
||||
* Thread - Current executing thread object
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -228,9 +228,9 @@ AcpiExLinkMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExAcquireMutexObject
|
||||
*
|
||||
* PARAMETERS: TimeDesc - Timeout in milliseconds
|
||||
* PARAMETERS: Timeout - Timeout in milliseconds
|
||||
* ObjDesc - Mutex object
|
||||
* Thread - Current thread state
|
||||
* ThreadId - Current thread state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -337,11 +337,12 @@ AcpiExAcquireMutex (
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Must have a valid thread ID */
|
||||
/* Must have a valid thread state struct */
|
||||
|
||||
if (!WalkState->Thread)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info",
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot acquire Mutex [%4.4s], null thread info",
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
@ -353,7 +354,7 @@ AcpiExAcquireMutex (
|
||||
if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)",
|
||||
"Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)",
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
|
||||
WalkState->Thread->CurrentSyncLevel));
|
||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
||||
@ -471,6 +472,7 @@ AcpiExReleaseMutex (
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT8 PreviousSyncLevel;
|
||||
ACPI_THREAD_STATE *OwnerThread;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (ExReleaseMutex);
|
||||
@ -481,11 +483,14 @@ AcpiExReleaseMutex (
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
OwnerThread = ObjDesc->Mutex.OwnerThread;
|
||||
|
||||
/* The mutex must have been previously acquired in order to release it */
|
||||
|
||||
if (!ObjDesc->Mutex.OwnerThread)
|
||||
if (!OwnerThread)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired",
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot release Mutex [%4.4s], not acquired",
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
|
||||
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
|
||||
}
|
||||
@ -494,7 +499,8 @@ AcpiExReleaseMutex (
|
||||
|
||||
if (!WalkState->Thread)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot release Mutex [%4.4s], null thread info",
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
@ -503,14 +509,14 @@ AcpiExReleaseMutex (
|
||||
* The Mutex is owned, but this thread must be the owner.
|
||||
* Special case for Global Lock, any thread can release
|
||||
*/
|
||||
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
|
||||
if ((OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
|
||||
(ObjDesc != AcpiGbl_GlobalLockMutex))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
|
||||
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
|
||||
ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId)));
|
||||
ACPI_CAST_PTR (void, OwnerThread->ThreadId)));
|
||||
return_ACPI_STATUS (AE_AML_NOT_OWNER);
|
||||
}
|
||||
|
||||
@ -521,10 +527,10 @@ AcpiExReleaseMutex (
|
||||
* different level can only mean that the mutex ordering rule is being
|
||||
* violated. This behavior is clarified in ACPI 4.0 specification.
|
||||
*/
|
||||
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
|
||||
if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
|
||||
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u",
|
||||
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
|
||||
ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel));
|
||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
||||
@ -536,7 +542,7 @@ AcpiExReleaseMutex (
|
||||
* acquired, but are not released in reverse order.
|
||||
*/
|
||||
PreviousSyncLevel =
|
||||
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
|
||||
OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel;
|
||||
|
||||
Status = AcpiExReleaseMutexObject (ObjDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -548,8 +554,9 @@ AcpiExReleaseMutex (
|
||||
{
|
||||
/* Restore the previous SyncLevel */
|
||||
|
||||
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
|
||||
OwnerThread->CurrentSyncLevel = PreviousSyncLevel;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -558,7 +565,7 @@ AcpiExReleaseMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExReleaseAllMutexes
|
||||
*
|
||||
* PARAMETERS: Thread - Current executing thread object
|
||||
* PARAMETERS: Thread - Current executing thread object
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -617,5 +624,3 @@ AcpiExReleaseAllMutexes (
|
||||
Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,7 +189,7 @@ AcpiExAllocateNameString (
|
||||
if (!NameString)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not allocate size %d", SizeNeeded));
|
||||
"Could not allocate size %u", SizeNeeded));
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ AcpiExNameSegment (
|
||||
*/
|
||||
Status = AE_AML_BAD_NAME;
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Bad character %02x in name, at %p",
|
||||
"Bad character 0x%02x in name, at %p",
|
||||
*AmlAddress, AmlAddress));
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ AcpiExOpcode_0A_0T_1R (
|
||||
|
||||
default: /* Unknown opcode */
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
break;
|
||||
@ -268,7 +268,7 @@ AcpiExOpcode_1A_0T_0R (
|
||||
|
||||
case AML_SLEEP_OP: /* Sleep (MsecTime) */
|
||||
|
||||
Status = AcpiExSystemDoSuspend (Operand[0]->Integer.Value);
|
||||
Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value);
|
||||
break;
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ AcpiExOpcode_1A_0T_0R (
|
||||
|
||||
default: /* Unknown opcode */
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
break;
|
||||
@ -332,7 +332,7 @@ AcpiExOpcode_1A_1T_0R (
|
||||
|
||||
default: /* Unknown opcode */
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
@ -514,7 +514,7 @@ AcpiExOpcode_1A_1T_1R (
|
||||
if (Digit > 0)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Integer too large to convert to BCD: %8.8X%8.8X",
|
||||
"Integer too large to convert to BCD: 0x%8.8X%8.8X",
|
||||
ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
|
||||
Status = AE_AML_NUMERIC_OVERFLOW;
|
||||
goto Cleanup;
|
||||
@ -664,7 +664,7 @@ AcpiExOpcode_1A_1T_1R (
|
||||
|
||||
default: /* Unknown opcode */
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
@ -1116,7 +1116,7 @@ AcpiExOpcode_1A_0T_1R (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown Index TargetType %X in reference object %p",
|
||||
"Unknown Index TargetType 0x%X in reference object %p",
|
||||
Operand[0]->Reference.TargetType, Operand[0]));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
goto Cleanup;
|
||||
@ -1143,7 +1143,7 @@ AcpiExOpcode_1A_0T_1R (
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown class in reference(%p) - %2.2X",
|
||||
"Unknown class in reference(%p) - 0x%2.2X",
|
||||
Operand[0], Operand[0]->Reference.Class));
|
||||
|
||||
Status = AE_TYPE;
|
||||
@ -1155,7 +1155,7 @@ AcpiExOpcode_1A_0T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
|
@ -206,33 +206,6 @@ AcpiExOpcode_2A_0T_0R (
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||
/*
|
||||
* GPE method wake/notify check. Here, we want to ensure that we
|
||||
* don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
|
||||
* GPE method during system runtime. If we do, the GPE is marked
|
||||
* as "wake-only" and disabled.
|
||||
*
|
||||
* 1) Is the Notify() value == DeviceWake?
|
||||
* 2) Is this a GPE deferred method? (An _Lxx or _Exx method)
|
||||
* 3) Did the original GPE happen at system runtime?
|
||||
* (versus during wake)
|
||||
*
|
||||
* If all three cases are true, this is a wake-only GPE that should
|
||||
* be disabled at runtime.
|
||||
*/
|
||||
if (Value == 2) /* DeviceWake */
|
||||
{
|
||||
Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
|
||||
|
||||
return_ACPI_STATUS (AE_OK)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dispatch the notify to the appropriate handler
|
||||
* NOTE: the request is queued for execution after this method
|
||||
@ -246,7 +219,7 @@ AcpiExOpcode_2A_0T_0R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
}
|
||||
@ -319,7 +292,7 @@ AcpiExOpcode_2A_2T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
@ -555,7 +528,7 @@ AcpiExOpcode_2A_1T_1R (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Index (%X%8.8X) is beyond end of object",
|
||||
"Index (0x%8.8X%8.8X) is beyond end of object",
|
||||
ACPI_FORMAT_UINT64 (Index)));
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -579,7 +552,7 @@ AcpiExOpcode_2A_1T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
break;
|
||||
@ -702,7 +675,7 @@ AcpiExOpcode_2A_0T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
|
@ -206,7 +206,7 @@ AcpiExOpcode_3A_0T_0R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
@ -345,7 +345,7 @@ AcpiExOpcode_3A_1T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
|
@ -337,7 +337,7 @@ AcpiExOpcode_6A_0T_1R (
|
||||
if (Index >= Operand[0]->Package.Count)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Index (%X%8.8X) beyond package end (%X)",
|
||||
"Index (0x%8.8X%8.8X) beyond package end (0x%X)",
|
||||
ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
|
||||
Status = AE_AML_PACKAGE_LIMIT;
|
||||
goto Cleanup;
|
||||
@ -411,7 +411,7 @@ AcpiExOpcode_6A_0T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
|
@ -362,7 +362,7 @@ AcpiExDecodeFieldAccess (
|
||||
/* Invalid field access type */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown field access type %X",
|
||||
"Unknown field access type 0x%X",
|
||||
Access));
|
||||
return_UINT32 (0);
|
||||
}
|
||||
@ -533,7 +533,7 @@ AcpiExPrepFieldValue (
|
||||
if (Type != ACPI_TYPE_REGION)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Needed Region, found type %X (%s)",
|
||||
"Needed Region, found type 0x%X (%s)",
|
||||
Type, AcpiUtGetTypeName (Type)));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
|
@ -188,7 +188,7 @@ AcpiExSystemMemorySpaceHandler (
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %d",
|
||||
ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u",
|
||||
BitWidth));
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
||||
}
|
||||
@ -265,7 +265,7 @@ AcpiExSystemMemorySpaceHandler (
|
||||
if (!MemInfo->MappedLogicalAddress)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not map memory at %8.8X%8.8X, size %X",
|
||||
"Could not map memory at 0x%8.8X%8.8X, size %u",
|
||||
ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
|
||||
MemInfo->MappedLength = 0;
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -608,8 +608,10 @@ AcpiExDataTableSpaceHandler (
|
||||
ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
|
||||
|
||||
|
||||
/* Perform the memory read or write */
|
||||
|
||||
/*
|
||||
* Perform the memory read or write. The BitWidth was already
|
||||
* validated.
|
||||
*/
|
||||
switch (Function)
|
||||
{
|
||||
case ACPI_READ:
|
||||
@ -619,9 +621,14 @@ AcpiExDataTableSpaceHandler (
|
||||
break;
|
||||
|
||||
case ACPI_WRITE:
|
||||
|
||||
ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
|
||||
ACPI_DIV_8 (BitWidth));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
return_ACPI_STATUS (AE_SUPPORT);
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
@ -344,7 +344,7 @@ AcpiExResolveNodeToValue (
|
||||
/* No named references are allowed here */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unsupported Reference type %X",
|
||||
"Unsupported Reference type 0x%X",
|
||||
SourceDesc->Reference.Class));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
@ -357,7 +357,7 @@ AcpiExResolveNodeToValue (
|
||||
/* Default case is for unknown types */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Node %p - Unknown object type %X",
|
||||
"Node %p - Unknown object type 0x%X",
|
||||
Node, EntryType));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
|
@ -326,7 +326,7 @@ AcpiExResolveObjectToValue (
|
||||
/* Invalid reference object */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown TargetType %X in Index/Reference object %p",
|
||||
"Unknown TargetType 0x%X in Index/Reference object %p",
|
||||
StackDesc->Reference.TargetType, StackDesc));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
@ -367,7 +367,7 @@ AcpiExResolveObjectToValue (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown Reference type %X in %p", RefType, StackDesc));
|
||||
"Unknown Reference type 0x%X in %p", RefType, StackDesc));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
}
|
||||
@ -503,7 +503,7 @@ AcpiExResolveMultiple (
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Not a NS node %p [%s]",
|
||||
"Not a namespace node %p [%s]",
|
||||
Node, AcpiUtGetDescriptorName (Node)));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
@ -605,7 +605,7 @@ AcpiExResolveMultiple (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown Reference Class %2.2X", ObjDesc->Reference.Class));
|
||||
"Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ AcpiExResolveOperands (
|
||||
ArgTypes = OpInfo->RuntimeArgs;
|
||||
if (ArgTypes == ARGI_INVALID_OPCODE)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
|
||||
Opcode));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
@ -309,7 +309,7 @@ AcpiExResolveOperands (
|
||||
if (!AcpiUtValidObjectType (ObjectType))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Bad operand object type [%X]", ObjectType));
|
||||
"Bad operand object type [0x%X]", ObjectType));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
@ -342,7 +342,7 @@ AcpiExResolveOperands (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown Reference Class %2.2X in %p",
|
||||
"Unknown Reference Class 0x%2.2X in %p",
|
||||
ObjDesc->Reference.Class, ObjDesc));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
@ -773,7 +773,7 @@ AcpiExResolveOperands (
|
||||
/* Unknown type */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Internal - Unknown ARGI (required operand) type %X",
|
||||
"Internal - Unknown ARGI (required operand) type 0x%X",
|
||||
ThisArgType));
|
||||
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exstore - AML Interpreter object store support
|
||||
@ -129,12 +128,6 @@
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void
|
||||
AcpiExDoDebugObject (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
UINT32 Level,
|
||||
UINT32 Index);
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiExStoreObjectToIndex (
|
||||
ACPI_OPERAND_OBJECT *ValDesc,
|
||||
@ -142,218 +135,6 @@ AcpiExStoreObjectToIndex (
|
||||
ACPI_WALK_STATE *WalkState);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExDoDebugObject
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Value to be stored
|
||||
* Level - Indentation level (used for packages)
|
||||
* Index - Current package element, zero if not pkg
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Handles stores to the Debug Object.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
AcpiExDoDebugObject (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
UINT32 Level,
|
||||
UINT32 Index)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
|
||||
|
||||
|
||||
/* Print line header as long as we are not in the middle of an object display */
|
||||
|
||||
if (!((Level > 0) && Index == 0))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
|
||||
Level, " "));
|
||||
}
|
||||
|
||||
/* Display index for package output only */
|
||||
|
||||
if (Index > 0)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
||||
"(%.2u) ", Index -1));
|
||||
}
|
||||
|
||||
if (!SourceDesc)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n"));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ",
|
||||
AcpiUtGetObjectTypeName (SourceDesc)));
|
||||
|
||||
if (!AcpiUtValidInternalObject (SourceDesc))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
||||
"%p, Invalid Internal Object!\n", SourceDesc));
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
|
||||
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
|
||||
SourceDesc));
|
||||
return_VOID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
|
||||
|
||||
switch (SourceDesc->Common.Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/* Output correct integer width */
|
||||
|
||||
if (AcpiGbl_IntegerByteWidth == 4)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
|
||||
(UINT32) SourceDesc->Integer.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
|
||||
(UINT32) SourceDesc->Buffer.Length));
|
||||
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
|
||||
(SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
|
||||
SourceDesc->String.Length, SourceDesc->String.Pointer));
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n",
|
||||
SourceDesc->Package.Count));
|
||||
|
||||
/* Output the entire contents of the package */
|
||||
|
||||
for (i = 0; i < SourceDesc->Package.Count; i++)
|
||||
{
|
||||
AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
|
||||
Level+4, i+1);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ",
|
||||
AcpiUtGetReferenceName (SourceDesc)));
|
||||
|
||||
/* Decode the reference */
|
||||
|
||||
switch (SourceDesc->Reference.Class)
|
||||
{
|
||||
case ACPI_REFCLASS_INDEX:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
|
||||
SourceDesc->Reference.Value));
|
||||
break;
|
||||
|
||||
case ACPI_REFCLASS_TABLE:
|
||||
|
||||
/* Case for DdbHandle */
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n",
|
||||
SourceDesc->Reference.Value));
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " "));
|
||||
|
||||
/* Check for valid node first, then valid object */
|
||||
|
||||
if (SourceDesc->Reference.Node)
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
|
||||
ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
||||
" %p - Not a valid namespace node\n",
|
||||
SourceDesc->Reference.Node));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ",
|
||||
SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii));
|
||||
|
||||
switch ((SourceDesc->Reference.Node)->Type)
|
||||
{
|
||||
/* These types have no attached object */
|
||||
|
||||
case ACPI_TYPE_DEVICE:
|
||||
AcpiOsPrintf ("Device\n");
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_THERMAL:
|
||||
AcpiOsPrintf ("Thermal Zone\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
|
||||
Level+4, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SourceDesc->Reference.Object)
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
|
||||
ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
|
||||
SourceDesc->Reference.Object)->Object,
|
||||
Level+4, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
|
||||
SourceDesc));
|
||||
break;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExStore
|
||||
@ -487,13 +268,13 @@ AcpiExStore (
|
||||
"**** Write to Debug Object: Object %p %s ****:\n\n",
|
||||
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
|
||||
|
||||
AcpiExDoDebugObject (SourceDesc, 0, 0);
|
||||
ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
|
||||
RefDesc->Reference.Class));
|
||||
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
|
||||
|
||||
|
@ -265,7 +265,7 @@ AcpiExSystemDoStall (
|
||||
* (ACPI specifies 100 usec as max, but this gives some slack in
|
||||
* order to support existing BIOSs)
|
||||
*/
|
||||
ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
|
||||
ACPI_ERROR ((AE_INFO, "Time parameter is too large (%u)",
|
||||
HowLong));
|
||||
Status = AE_AML_OPERAND_VALUE;
|
||||
}
|
||||
@ -280,19 +280,19 @@ AcpiExSystemDoStall (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExSystemDoSuspend
|
||||
* FUNCTION: AcpiExSystemDoSleep
|
||||
*
|
||||
* PARAMETERS: HowLong - The amount of time to suspend,
|
||||
* PARAMETERS: HowLong - The amount of time to sleep,
|
||||
* in milliseconds
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Suspend running thread for specified amount of time.
|
||||
* DESCRIPTION: Sleep the running thread for specified amount of time.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExSystemDoSuspend (
|
||||
AcpiExSystemDoSleep (
|
||||
UINT64 HowLong)
|
||||
{
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
@ -412,7 +412,7 @@ AcpiHwGetBitRegisterInfo (
|
||||
|
||||
if (RegisterId > ACPI_BITREG_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId));
|
||||
ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: 0x%X", RegisterId));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -539,7 +539,7 @@ AcpiHwRegisterRead (
|
||||
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
|
||||
RegisterId));
|
||||
Status = AE_BAD_PARAMETER;
|
||||
break;
|
||||
@ -682,7 +682,7 @@ AcpiHwRegisterWrite (
|
||||
|
||||
|
||||
default:
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
|
||||
RegisterId));
|
||||
Status = AE_BAD_PARAMETER;
|
||||
break;
|
||||
|
@ -319,7 +319,7 @@ AcpiEnterSleepState (
|
||||
if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
|
||||
(AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=%X B=%X",
|
||||
ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X",
|
||||
AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ AcpiHwValidateIoRequest (
|
||||
if (LastAddress > ACPI_UINT16_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Illegal I/O port address/length above 64K: 0x%p/%X",
|
||||
"Illegal I/O port address/length above 64K: %p/0x%X",
|
||||
ACPI_CAST_PTR (void, Address), ByteWidth));
|
||||
return_ACPI_STATUS (AE_LIMIT);
|
||||
}
|
||||
|
@ -286,6 +286,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[];
|
||||
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[];
|
||||
|
@ -167,17 +167,19 @@ AcpiEvQueueNotifyRequest (
|
||||
|
||||
|
||||
/*
|
||||
* evgpe - GPE handling and dispatch
|
||||
* evgpe - Low-level GPE support
|
||||
*/
|
||||
UINT32
|
||||
AcpiEvGpeDetect (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptList);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvUpdateGpeEnableMasks (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
UINT8 Type);
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvEnableGpe (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
BOOLEAN WriteToHardware);
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDisableGpe (
|
||||
@ -188,25 +190,15 @@ AcpiEvGetGpeEventInfo (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber);
|
||||
|
||||
ACPI_GPE_EVENT_INFO *
|
||||
AcpiEvLowGetGpeInfo (
|
||||
UINT32 GpeNumber,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock);
|
||||
|
||||
|
||||
/*
|
||||
* evgpeblk
|
||||
* evgpeblk - Upper-level GPE block support
|
||||
*/
|
||||
BOOLEAN
|
||||
AcpiEvValidGpeEvent (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvWalkGpeList (
|
||||
ACPI_GPE_CALLBACK GpeWalkCallback,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeHandlers (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvCreateGpeBlock (
|
||||
ACPI_NAMESPACE_NODE *GpeDevice,
|
||||
@ -230,23 +222,57 @@ AcpiEvGpeDispatch (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
UINT32 GpeNumber);
|
||||
|
||||
UINT32
|
||||
AcpiEvGpeDetect (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptList);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvSetGpeType (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo,
|
||||
UINT8 Type);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvCheckForWakeOnlyGpe (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo);
|
||||
|
||||
/*
|
||||
* evgpeinit - GPE initialization and update
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiEvGpeInitialize (
|
||||
void);
|
||||
|
||||
void
|
||||
AcpiEvUpdateGpes (
|
||||
ACPI_OWNER_ID TableOwnerId);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvMatchGpeMethod (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvMatchPrwAndGpe (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
||||
/*
|
||||
* evgpeutil - GPE utilities
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiEvWalkGpeList (
|
||||
ACPI_GPE_CALLBACK GpeWalkCallback,
|
||||
void *Context);
|
||||
|
||||
BOOLEAN
|
||||
AcpiEvValidGpeEvent (
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo);
|
||||
|
||||
ACPI_GPE_XRUPT_INFO *
|
||||
AcpiEvGetGpeXruptBlock (
|
||||
UINT32 InterruptNumber);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeXrupt (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXrupt);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvDeleteGpeHandlers (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock,
|
||||
void *Context);
|
||||
|
||||
|
||||
/*
|
||||
* evregion - Address Space handling
|
||||
|
@ -162,7 +162,7 @@
|
||||
#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL)
|
||||
#define AE_ABORT_METHOD (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL)
|
||||
#define AE_SAME_HANDLER (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
|
||||
#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
|
||||
#define AE_NO_HANDLER (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
|
||||
#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
|
||||
|
||||
#define AE_CODE_ENV_MAX 0x001B
|
||||
|
@ -186,6 +186,19 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE);
|
||||
*/
|
||||
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE);
|
||||
|
||||
/*
|
||||
* Optionally enable output from the AML Debug Object.
|
||||
*/
|
||||
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE);
|
||||
|
||||
/*
|
||||
* Optionally copy the entire DSDT to local memory (instead of simply
|
||||
* mapping it.) There are some BIOSs that corrupt or replace the original
|
||||
* DSDT, creating the need for this option. Default is FALSE, do not copy
|
||||
* the DSDT.
|
||||
*/
|
||||
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE);
|
||||
|
||||
|
||||
/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */
|
||||
|
||||
@ -203,11 +216,10 @@ ACPI_NAME AcpiGbl_TraceMethodName;
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* AcpiGbl_RootTableList is the master list of ACPI tables found in the
|
||||
* RSDT/XSDT.
|
||||
*
|
||||
* AcpiGbl_RootTableList is the master list of ACPI tables that were
|
||||
* found in the RSDT/XSDT.
|
||||
*/
|
||||
ACPI_EXTERN ACPI_INTERNAL_RSDT AcpiGbl_RootTableList;
|
||||
ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList;
|
||||
ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS;
|
||||
|
||||
/* These addresses are calculated from the FADT Event Block addresses */
|
||||
@ -218,6 +230,11 @@ ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
|
||||
ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus;
|
||||
ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
|
||||
|
||||
/* DSDT information. Used to check for DSDT corruption */
|
||||
|
||||
ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
|
||||
ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader;
|
||||
|
||||
/*
|
||||
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
|
||||
* determined by the revision of the DSDT: If the DSDT revision is less than
|
||||
|
@ -202,6 +202,16 @@ AcpiExConvertToTargetType (
|
||||
ACPI_WALK_STATE *WalkState);
|
||||
|
||||
|
||||
/*
|
||||
* exdebug - AML debug object
|
||||
*/
|
||||
void
|
||||
AcpiExDoDebugObject (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
UINT32 Level,
|
||||
UINT32 Index);
|
||||
|
||||
|
||||
/*
|
||||
* exfield - ACPI AML (p-code) execution - field manipulation
|
||||
*/
|
||||
@ -424,7 +434,7 @@ AcpiExSystemDoNotifyOp (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExSystemDoSuspend(
|
||||
AcpiExSystemDoSleep(
|
||||
UINT64 Time);
|
||||
|
||||
ACPI_STATUS
|
||||
|
@ -307,16 +307,16 @@ typedef struct acpi_namespace_node
|
||||
#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
|
||||
|
||||
|
||||
/* One internal RSDT for table management */
|
||||
/* Internal ACPI table management - master table list */
|
||||
|
||||
typedef struct acpi_internal_rsdt
|
||||
typedef struct acpi_table_list
|
||||
{
|
||||
ACPI_TABLE_DESC *Tables;
|
||||
UINT32 Count;
|
||||
UINT32 Size;
|
||||
ACPI_TABLE_DESC *Tables; /* Table descriptor array */
|
||||
UINT32 CurrentTableCount; /* Tables currently in the array */
|
||||
UINT32 MaxTableCount; /* Max tables array will hold */
|
||||
UINT8 Flags;
|
||||
|
||||
} ACPI_INTERNAL_RSDT;
|
||||
} ACPI_TABLE_LIST;
|
||||
|
||||
/* Flags for above */
|
||||
|
||||
@ -561,6 +561,8 @@ typedef struct acpi_gpe_event_info
|
||||
struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
|
||||
UINT8 Flags; /* Misc info about this GPE */
|
||||
UINT8 GpeNumber; /* This GPE */
|
||||
UINT8 RuntimeCount; /* References to a run GPE */
|
||||
UINT8 WakeupCount; /* References to a wake GPE */
|
||||
|
||||
} ACPI_GPE_EVENT_INFO;
|
||||
|
||||
@ -590,6 +592,7 @@ typedef struct acpi_gpe_block_info
|
||||
ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
|
||||
ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
|
||||
UINT32 RegisterCount; /* Number of register pairs in block */
|
||||
UINT16 GpeCount; /* Number of individual GPEs in block */
|
||||
UINT8 BlockBaseNumber;/* Base GPE number for this block */
|
||||
|
||||
} ACPI_GPE_BLOCK_INFO;
|
||||
@ -609,6 +612,10 @@ typedef struct acpi_gpe_walk_info
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *GpeDevice;
|
||||
ACPI_GPE_BLOCK_INFO *GpeBlock;
|
||||
UINT16 Count;
|
||||
ACPI_OWNER_ID OwnerId;
|
||||
BOOLEAN EnableThisGpe;
|
||||
BOOLEAN ExecuteByOwnerId;
|
||||
|
||||
} ACPI_GPE_WALK_INFO;
|
||||
|
||||
|
@ -281,6 +281,7 @@
|
||||
#define ACPI_WARNING(plist) AcpiWarning plist
|
||||
#define ACPI_EXCEPTION(plist) AcpiException plist
|
||||
#define ACPI_ERROR(plist) AcpiError plist
|
||||
#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i)
|
||||
|
||||
#else
|
||||
|
||||
@ -290,6 +291,7 @@
|
||||
#define ACPI_WARNING(plist)
|
||||
#define ACPI_EXCEPTION(plist)
|
||||
#define ACPI_ERROR(plist)
|
||||
#define ACPI_DEBUG_OBJECT(obj,l,i)
|
||||
|
||||
#endif /* ACPI_NO_ERROR_MESSAGES */
|
||||
|
||||
|
@ -410,8 +410,8 @@ AcpiOsWritePciConfiguration (
|
||||
*/
|
||||
void
|
||||
AcpiOsDerivePciId(
|
||||
ACPI_HANDLE Rhandle,
|
||||
ACPI_HANDLE Chandle,
|
||||
ACPI_HANDLE Device,
|
||||
ACPI_HANDLE Region,
|
||||
ACPI_PCI_ID **PciId);
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@
|
||||
|
||||
/* Current ACPICA subsystem version in YYYYMMDD format */
|
||||
|
||||
#define ACPI_CA_VERSION 0x20100121
|
||||
#define ACPI_CA_VERSION 0x20100428
|
||||
|
||||
#include "actypes.h"
|
||||
#include "actbl.h"
|
||||
@ -145,6 +145,8 @@ extern UINT8 AcpiGbl_LeaveWakeGpesDisabled;
|
||||
extern UINT8 AcpiGbl_UseDefaultRegisterWidths;
|
||||
extern ACPI_NAME AcpiGbl_TraceMethodName;
|
||||
extern UINT32 AcpiGbl_TraceFlags;
|
||||
extern UINT8 AcpiGbl_EnableAmlDebugObject;
|
||||
extern UINT8 AcpiGbl_CopyDsdtLocally;
|
||||
|
||||
|
||||
/*
|
||||
@ -281,7 +283,7 @@ AcpiGetDevices (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetName (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_HANDLE Object,
|
||||
UINT32 NameType,
|
||||
ACPI_BUFFER *RetPathPtr);
|
||||
|
||||
@ -293,18 +295,18 @@ AcpiGetHandle (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAttachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_HANDLE Object,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void *Data);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDetachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_HANDLE Object,
|
||||
ACPI_OBJECT_HANDLER Handler);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_HANDLE Object,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data);
|
||||
|
||||
@ -336,7 +338,7 @@ AcpiEvaluateObjectTyped (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetObjectInfo (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_HANDLE Object,
|
||||
ACPI_DEVICE_INFO **ReturnBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
@ -462,34 +464,32 @@ AcpiGetEventStatus (
|
||||
* GPE Interfaces
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiSetGpeType (
|
||||
AcpiSetGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT8 Type);
|
||||
UINT8 Action);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEnableGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags);
|
||||
UINT8 GpeType);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDisableGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags);
|
||||
UINT8 GpeType);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiClearGpe (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags);
|
||||
UINT32 GpeNumber);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetGpeStatus (
|
||||
ACPI_HANDLE GpeDevice,
|
||||
UINT32 GpeNumber,
|
||||
UINT32 Flags,
|
||||
ACPI_EVENT_STATUS *EventStatus);
|
||||
|
||||
ACPI_STATUS
|
||||
@ -527,36 +527,36 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetVendorResource (
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
ACPI_HANDLE Device,
|
||||
char *Name,
|
||||
ACPI_VENDOR_UUID *Uuid,
|
||||
ACPI_BUFFER *RetBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetCurrentResources(
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
AcpiGetCurrentResources (
|
||||
ACPI_HANDLE Device,
|
||||
ACPI_BUFFER *RetBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetPossibleResources(
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
AcpiGetPossibleResources (
|
||||
ACPI_HANDLE Device,
|
||||
ACPI_BUFFER *RetBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiWalkResources (
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
ACPI_HANDLE Device,
|
||||
char *Name,
|
||||
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiSetCurrentResources (
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
ACPI_HANDLE Device,
|
||||
ACPI_BUFFER *InBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetIrqRoutingTable (
|
||||
ACPI_HANDLE BusDeviceHandle,
|
||||
AcpiGetIrqRoutingTable (
|
||||
ACPI_HANDLE Device,
|
||||
ACPI_BUFFER *RetBuffer);
|
||||
|
||||
ACPI_STATUS
|
||||
|
@ -230,6 +230,14 @@ AcpiTbVerifyChecksum (
|
||||
ACPI_TABLE_HEADER *Table,
|
||||
UINT32 Length);
|
||||
|
||||
void
|
||||
AcpiTbCheckDsdtHeader (
|
||||
void);
|
||||
|
||||
ACPI_TABLE_HEADER *
|
||||
AcpiTbCopyDsdt (
|
||||
UINT32 TableIndex);
|
||||
|
||||
void
|
||||
AcpiTbInstallTable (
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
|
@ -143,6 +143,7 @@
|
||||
#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */
|
||||
#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
|
||||
#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
|
||||
#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
|
||||
#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
|
||||
#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
|
||||
#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
|
||||
@ -862,6 +863,35 @@ typedef struct acpi_mcfg_allocation
|
||||
} ACPI_MCFG_ALLOCATION;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* MCHI - Management Controller Host Interface Table
|
||||
* Version 1
|
||||
*
|
||||
* Conforms to "Management Component Transport Protocol (MCTP) Host
|
||||
* Interface Specification", Revision 1.0.0a, October 13, 2009
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
typedef struct acpi_table_mchi
|
||||
{
|
||||
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
|
||||
UINT8 InterfaceType;
|
||||
UINT8 Protocol;
|
||||
UINT64 ProtocolData;
|
||||
UINT8 InterruptType;
|
||||
UINT8 Gpe;
|
||||
UINT8 PciDeviceFlag;
|
||||
UINT32 GlobalInterrupt;
|
||||
ACPI_GENERIC_ADDRESS ControlRegister;
|
||||
UINT8 PciSegment;
|
||||
UINT8 PciBus;
|
||||
UINT8 PciDevice;
|
||||
UINT8 PciFunction;
|
||||
|
||||
} ACPI_TABLE_MCHI;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SPCR - Serial Port Console Redirection table
|
||||
|
@ -742,53 +742,42 @@ typedef UINT32 ACPI_EVENT_STATUS;
|
||||
#define ACPI_GPE_MAX 0xFF
|
||||
#define ACPI_NUM_GPE 256
|
||||
|
||||
/* Actions for AcpiSetGpe */
|
||||
|
||||
#define ACPI_GPE_ENABLE 0
|
||||
#define ACPI_GPE_DISABLE 1
|
||||
|
||||
/* GpeTypes for AcpiEnableGpe and AcpiDisableGpe */
|
||||
|
||||
#define ACPI_GPE_TYPE_WAKE (UINT8) 0x01
|
||||
#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x02
|
||||
#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x03
|
||||
|
||||
/*
|
||||
* GPE info flags - Per GPE
|
||||
* +-+-+-+---+---+-+
|
||||
* |7|6|5|4:3|2:1|0|
|
||||
* +-+-+-+---+---+-+
|
||||
* | | | | | |
|
||||
* | | | | | +--- Interrupt type: Edge or Level Triggered
|
||||
* | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
|
||||
* | | | +--- Type of dispatch -- to method, handler, or none
|
||||
* | | +--- Enabled for runtime?
|
||||
* | +--- Enabled for wake?
|
||||
* +--- Unused
|
||||
* +-------+---+-+-+
|
||||
* | 7:4 |3:2|1|0|
|
||||
* +-------+---+-+-+
|
||||
* | | | |
|
||||
* | | | +--- Interrupt type: edge or level triggered
|
||||
* | | +----- GPE can wake the system
|
||||
* | +-------- Type of dispatch:to method, handler, or none
|
||||
* +-------------- <Reserved>
|
||||
*/
|
||||
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
|
||||
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
|
||||
#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00
|
||||
|
||||
#define ACPI_GPE_TYPE_MASK (UINT8) 0x06
|
||||
#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06
|
||||
#define ACPI_GPE_TYPE_WAKE (UINT8) 0x02
|
||||
#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */
|
||||
#define ACPI_GPE_CAN_WAKE (UINT8) 0x02
|
||||
|
||||
#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18
|
||||
#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08
|
||||
#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10
|
||||
#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */
|
||||
|
||||
#define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20
|
||||
#define ACPI_GPE_RUN_ENABLED (UINT8) 0x20
|
||||
#define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */
|
||||
|
||||
#define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40
|
||||
#define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40
|
||||
#define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */
|
||||
|
||||
#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
|
||||
#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x0C
|
||||
#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x04
|
||||
#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x08
|
||||
#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00
|
||||
|
||||
/*
|
||||
* Flags for GPE and Lock interfaces
|
||||
*/
|
||||
#define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */
|
||||
#define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */
|
||||
|
||||
#define ACPI_NOT_ISR 0x1
|
||||
#define ACPI_ISR 0x0
|
||||
|
||||
@ -1110,7 +1099,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
|
||||
|
||||
typedef
|
||||
ACPI_STATUS (*ACPI_WALK_CALLBACK) (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_HANDLE Object,
|
||||
UINT32 NestingLevel,
|
||||
void *Context,
|
||||
void **ReturnValue);
|
||||
|
@ -300,6 +300,12 @@ typedef struct aml_resource_large_header
|
||||
} AML_RESOURCE_LARGE_HEADER;
|
||||
|
||||
|
||||
/* General Flags for address space resource descriptors */
|
||||
|
||||
#define ACPI_RESOURCE_FLAG_DEC 2
|
||||
#define ACPI_RESOURCE_FLAG_MIF 4
|
||||
#define ACPI_RESOURCE_FLAG_MAF 8
|
||||
|
||||
typedef struct aml_resource_memory24
|
||||
{
|
||||
AML_RESOURCE_LARGE_HEADER_COMMON
|
||||
|
@ -114,7 +114,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACFREEBSD_H__
|
||||
#define __ACFREEBSD_H__
|
||||
#define __ACFREEBSD_H__
|
||||
|
||||
|
||||
/* FreeBSD uses GCC */
|
||||
@ -123,12 +123,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <machine/acpica_machdep.h>
|
||||
|
||||
#define ACPI_UINTPTR_T uintptr_t
|
||||
#define ACPI_UINTPTR_T uintptr_t
|
||||
|
||||
#define ACPI_USE_LOCAL_CACHE
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
|
||||
#define __cdecl
|
||||
#define ACPI_USE_DO_WHILE_0
|
||||
#define ACPI_USE_LOCAL_CACHE
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
@ -140,17 +139,18 @@
|
||||
|
||||
#include "opt_acpi.h"
|
||||
|
||||
#define ACPI_THREAD_ID lwpid_t
|
||||
#define ACPI_THREAD_ID lwpid_t
|
||||
#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
|
||||
|
||||
#ifdef ACPI_DEBUG
|
||||
#define ACPI_DEBUG_OUTPUT /* for backward compatibility */
|
||||
#define ACPI_DISASSEMBLER
|
||||
#define ACPI_DEBUG_OUTPUT /* for backward compatibility */
|
||||
#define ACPI_DISASSEMBLER
|
||||
#endif
|
||||
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
#define ACPI_DEBUGGER
|
||||
#define ACPI_DEBUGGER
|
||||
#endif /* DDB */
|
||||
#endif /* ACPI_DEBUG_OUTPUT */
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
#undef DEBUGGER_THREADING
|
||||
#endif /* DEBUGGER_THREADING */
|
||||
|
||||
#define DEBUGGER_THREADING 0 /* integrated with DDB */
|
||||
#define DEBUGGER_THREADING 0 /* integrated with DDB */
|
||||
|
||||
#else /* _KERNEL */
|
||||
|
||||
@ -166,14 +166,12 @@
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#define ACPI_THREAD_ID pthread_t
|
||||
#define ACPI_THREAD_ID pthread_t
|
||||
|
||||
/* Not building kernel code, so use libc */
|
||||
#define ACPI_USE_STANDARD_HEADERS
|
||||
#define ACPI_FLUSH_CPU_CACHE()
|
||||
#define ACPI_USE_STANDARD_HEADERS
|
||||
|
||||
#define __cli()
|
||||
#define __sti()
|
||||
#define ACPI_FLUSH_CPU_CACHE()
|
||||
#define __cdecl
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -306,7 +306,7 @@ AcpiNsRootInitialize (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Unsupported initial type value %X",
|
||||
ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X",
|
||||
InitVal->Type));
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
ObjDesc = NULL;
|
||||
|
@ -314,7 +314,7 @@ AcpiNsDumpOneObject (
|
||||
|
||||
if (Type > ACPI_TYPE_LOCAL_MAX)
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type));
|
||||
ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type));
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
|
||||
|
@ -191,7 +191,7 @@ AcpiNsBuildExternalPath (
|
||||
if (Index != 0)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Could not construct external pathname; index=%X, size=%X, Path=%s",
|
||||
"Could not construct external pathname; index=%u, size=%u, Path=%s",
|
||||
(UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
|
||||
|
||||
return (AE_BAD_PARAMETER);
|
||||
|
@ -397,7 +397,7 @@ AcpiNsSearchAndEnter (
|
||||
if (!Node || !TargetName || !ReturnNode)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Null parameter: Node %p Name %X ReturnNode %p",
|
||||
"Null parameter: Node %p Name 0x%X ReturnNode %p",
|
||||
Node, TargetName, ReturnNode));
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ AcpiNsLocal (
|
||||
{
|
||||
/* Type code out of range */
|
||||
|
||||
ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
|
||||
ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
|
||||
return_UINT32 (ACPI_NS_NORMAL);
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ AcpiNsOpensScope (
|
||||
{
|
||||
/* type code out of range */
|
||||
|
||||
ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
|
||||
ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
|
||||
return_UINT32 (ACPI_NS_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ AcpiPsGetNextSimpleArg (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Invalid ArgType %X", ArgType));
|
||||
ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -883,7 +883,7 @@ AcpiPsGetNextArg (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO, "Invalid ArgType: %X", ArgType));
|
||||
ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ AcpiPsGetAmlOpcode (
|
||||
/* The opcode is unrecognized. Just skip unknown opcodes */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Found unknown opcode %X at AML address %p offset %X, ignoring",
|
||||
"Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring",
|
||||
WalkState->Opcode, WalkState->ParserState.Aml, WalkState->AmlOffset));
|
||||
|
||||
ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128);
|
||||
@ -1149,7 +1149,6 @@ AcpiPsParseLoop (
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Invoked method did not return a value"));
|
||||
|
||||
}
|
||||
|
||||
ACPI_EXCEPTION ((AE_INFO, Status, "GetPredicate Failed"));
|
||||
|
@ -120,6 +120,7 @@
|
||||
#include "acparser.h"
|
||||
#include "acdispat.h"
|
||||
#include "acinterp.h"
|
||||
#include "actables.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
|
||||
@ -334,6 +335,10 @@ AcpiPsExecuteMethod (
|
||||
ACPI_FUNCTION_TRACE (PsExecuteMethod);
|
||||
|
||||
|
||||
/* Quick validation of DSDT header */
|
||||
|
||||
AcpiTbCheckDsdtHeader ();
|
||||
|
||||
/* Validate the Info and method Node */
|
||||
|
||||
if (!Info || !Info->ResolvedNode)
|
||||
|
@ -301,7 +301,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
if ((*TopObjectList)->Common.Type != ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"(PRT[%X]) Need sub-package, found %s",
|
||||
"(PRT[%u]) Need sub-package, found %s",
|
||||
Index, AcpiUtGetObjectTypeName (*TopObjectList)));
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
@ -311,7 +311,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
if ((*TopObjectList)->Package.Count != 4)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"(PRT[%X]) Need package of length 4, found length %d",
|
||||
"(PRT[%u]) Need package of length 4, found length %u",
|
||||
Index, (*TopObjectList)->Package.Count));
|
||||
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
|
||||
}
|
||||
@ -328,7 +328,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
ObjDesc = SubObjectList[0];
|
||||
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "(PRT[%X].Address) Need Integer, found %s",
|
||||
ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s",
|
||||
Index, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
@ -340,7 +340,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
ObjDesc = SubObjectList[1];
|
||||
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "(PRT[%X].Pin) Need Integer, found %s",
|
||||
ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s",
|
||||
Index, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
@ -378,7 +378,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
if (ObjDesc->Reference.Class != ACPI_REFCLASS_NAME)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"(PRT[%X].Source) Need name, found Reference Class %X",
|
||||
"(PRT[%u].Source) Need name, found Reference Class 0x%X",
|
||||
Index, ObjDesc->Reference.Class));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
@ -426,7 +426,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
default:
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"(PRT[%X].Source) Need Ref/String/Integer, found %s",
|
||||
"(PRT[%u].Source) Need Ref/String/Integer, found %s",
|
||||
Index, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
@ -442,7 +442,7 @@ AcpiRsCreatePciRoutingTable (
|
||||
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"(PRT[%X].SourceIndex) Need Integer, found %s",
|
||||
"(PRT[%u].SourceIndex) Need Integer, found %s",
|
||||
Index, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ AcpiRsConvertAmlToResources (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not convert AML resource (Type %X)", *Aml));
|
||||
"Could not convert AML resource (Type 0x%X)", *Aml));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ AcpiRsConvertResourcesToAml (
|
||||
if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Invalid descriptor type (%X) in resource list",
|
||||
"Invalid descriptor type (0x%X) in resource list",
|
||||
Resource->Type));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
@ -245,7 +245,7 @@ AcpiRsConvertResourcesToAml (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not convert resource (type %X) to AML",
|
||||
"Could not convert resource (type 0x%X) to AML",
|
||||
Resource->Type));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ AcpiRsConvertAmlToResource (
|
||||
/* Each internal resource struct is expected to be 32-bit aligned */
|
||||
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"Misaligned resource pointer (get): %p Type %2.2X Len %X",
|
||||
"Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
|
||||
Resource, Resource->Type, Resource->Length));
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ Exit:
|
||||
* "IRQ Format"), so 0x00 and 0x09 are illegal.
|
||||
*/
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Invalid interrupt polarity/trigger in resource list, %X",
|
||||
"Invalid interrupt polarity/trigger in resource list, 0x%X",
|
||||
Aml->Irq.Flags));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ AcpiTbCreateLocalFadt (
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"FADT (revision %u) is longer than ACPI 2.0 version, "
|
||||
"truncating length 0x%X to 0x%X",
|
||||
"truncating length %u to %u",
|
||||
Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ AcpiTbConvertFadt (
|
||||
(Address64->Address != (UINT64) Address32))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32",
|
||||
"32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32",
|
||||
FadtInfoTable[i].Name, Address32,
|
||||
ACPI_FORMAT_UINT64 (Address64->Address)));
|
||||
}
|
||||
@ -582,7 +582,7 @@ AcpiTbValidateFadt (
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"32/64X FACS address mismatch in FADT - "
|
||||
"%8.8X/%8.8X%8.8X, using 32",
|
||||
"0x%8.8X/0x%8.8X%8.8X, using 32",
|
||||
AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs)));
|
||||
|
||||
AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
|
||||
@ -593,7 +593,7 @@ AcpiTbValidateFadt (
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"32/64X DSDT address mismatch in FADT - "
|
||||
"%8.8X/%8.8X%8.8X, using 32",
|
||||
"0x%8.8X/0x%8.8X%8.8X, using 32",
|
||||
AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt)));
|
||||
|
||||
AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
|
||||
@ -621,7 +621,7 @@ AcpiTbValidateFadt (
|
||||
(Address64->BitWidth != ACPI_MUL_8 (Length)))
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"32/64X length mismatch in %s: %d/%d",
|
||||
"32/64X length mismatch in %s: %u/%u",
|
||||
Name, ACPI_MUL_8 (Length), Address64->BitWidth));
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ AcpiTbValidateFadt (
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Required field %s has zero address and/or length:"
|
||||
" %8.8X%8.8X/%X",
|
||||
" 0x%8.8X%8.8X/0x%X",
|
||||
Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
|
||||
}
|
||||
}
|
||||
@ -651,7 +651,7 @@ AcpiTbValidateFadt (
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"Optional field %s has zero address or length: "
|
||||
"%8.8X%8.8X/%X",
|
||||
"0x%8.8X%8.8X/0x%X",
|
||||
Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
|
||||
}
|
||||
}
|
||||
@ -702,7 +702,7 @@ AcpiTbSetupFadtRegisters (
|
||||
(FadtInfoTable[i].DefaultLength != Target64->BitWidth))
|
||||
{
|
||||
ACPI_WARNING ((AE_INFO,
|
||||
"Invalid length for %s: %d, using default %d",
|
||||
"Invalid length for %s: %u, using default %u",
|
||||
FadtInfoTable[i].Name, Target64->BitWidth,
|
||||
FadtInfoTable[i].DefaultLength));
|
||||
|
||||
|
@ -164,7 +164,7 @@ AcpiTbFindTable (
|
||||
|
||||
/* Search for the table */
|
||||
|
||||
for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
|
||||
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
|
||||
{
|
||||
if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
|
||||
Header.Signature, ACPI_NAME_SIZE))
|
||||
|
@ -227,7 +227,7 @@ AcpiTbAddTable (
|
||||
|
||||
/* Check if table is already registered */
|
||||
|
||||
for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
|
||||
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
|
||||
{
|
||||
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
|
||||
{
|
||||
@ -370,7 +370,7 @@ AcpiTbResizeRootTableList (
|
||||
/* Increase the Table Array size */
|
||||
|
||||
Tables = ACPI_ALLOCATE_ZEROED (
|
||||
((ACPI_SIZE) AcpiGbl_RootTableList.Size +
|
||||
((ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount +
|
||||
ACPI_ROOT_TABLE_SIZE_INCREMENT) *
|
||||
sizeof (ACPI_TABLE_DESC));
|
||||
if (!Tables)
|
||||
@ -384,7 +384,7 @@ AcpiTbResizeRootTableList (
|
||||
if (AcpiGbl_RootTableList.Tables)
|
||||
{
|
||||
ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
|
||||
(ACPI_SIZE) AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC));
|
||||
(ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount * sizeof (ACPI_TABLE_DESC));
|
||||
|
||||
if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
|
||||
{
|
||||
@ -393,7 +393,7 @@ AcpiTbResizeRootTableList (
|
||||
}
|
||||
|
||||
AcpiGbl_RootTableList.Tables = Tables;
|
||||
AcpiGbl_RootTableList.Size += ACPI_ROOT_TABLE_SIZE_INCREMENT;
|
||||
AcpiGbl_RootTableList.MaxTableCount += ACPI_ROOT_TABLE_SIZE_INCREMENT;
|
||||
AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
@ -423,12 +423,14 @@ AcpiTbStoreTable (
|
||||
UINT8 Flags,
|
||||
UINT32 *TableIndex)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_TABLE_DESC *NewTable;
|
||||
|
||||
|
||||
/* Ensure that there is room for the table in the Root Table List */
|
||||
|
||||
if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
|
||||
if (AcpiGbl_RootTableList.CurrentTableCount >=
|
||||
AcpiGbl_RootTableList.MaxTableCount)
|
||||
{
|
||||
Status = AcpiTbResizeRootTableList();
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -437,21 +439,21 @@ AcpiTbStoreTable (
|
||||
}
|
||||
}
|
||||
|
||||
NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount];
|
||||
|
||||
/* Initialize added table */
|
||||
|
||||
AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address = Address;
|
||||
AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Pointer = Table;
|
||||
AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Length = Length;
|
||||
AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].OwnerId = 0;
|
||||
AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Flags = Flags;
|
||||
NewTable->Address = Address;
|
||||
NewTable->Pointer = Table;
|
||||
NewTable->Length = Length;
|
||||
NewTable->OwnerId = 0;
|
||||
NewTable->Flags = Flags;
|
||||
|
||||
ACPI_MOVE_32_TO_32 (
|
||||
&(AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Signature),
|
||||
Table->Signature);
|
||||
ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature);
|
||||
|
||||
*TableIndex = AcpiGbl_RootTableList.Count;
|
||||
AcpiGbl_RootTableList.Count++;
|
||||
return (Status);
|
||||
*TableIndex = AcpiGbl_RootTableList.CurrentTableCount;
|
||||
AcpiGbl_RootTableList.CurrentTableCount++;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
@ -523,7 +525,7 @@ AcpiTbTerminate (
|
||||
|
||||
/* Delete the individual tables */
|
||||
|
||||
for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
|
||||
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
|
||||
{
|
||||
AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
|
||||
}
|
||||
@ -539,7 +541,7 @@ AcpiTbTerminate (
|
||||
|
||||
AcpiGbl_RootTableList.Tables = NULL;
|
||||
AcpiGbl_RootTableList.Flags = 0;
|
||||
AcpiGbl_RootTableList.Count = 0;
|
||||
AcpiGbl_RootTableList.CurrentTableCount = 0;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
|
||||
@ -575,7 +577,7 @@ AcpiTbDeleteNamespaceByOwner (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
if (TableIndex >= AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
/* The table index does not exist */
|
||||
|
||||
@ -634,7 +636,7 @@ AcpiTbAllocateOwnerId (
|
||||
|
||||
|
||||
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (TableIndex < AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
Status = AcpiUtAllocateOwnerId
|
||||
(&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
|
||||
@ -668,7 +670,7 @@ AcpiTbReleaseOwnerId (
|
||||
|
||||
|
||||
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (TableIndex < AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
AcpiUtReleaseOwnerId (
|
||||
&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
|
||||
@ -705,7 +707,7 @@ AcpiTbGetOwnerId (
|
||||
|
||||
|
||||
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (TableIndex < AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
*OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
|
||||
Status = AE_OK;
|
||||
@ -734,7 +736,7 @@ AcpiTbIsTableLoaded (
|
||||
|
||||
|
||||
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (TableIndex < AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
IsLoaded = (BOOLEAN)
|
||||
(AcpiGbl_RootTableList.Tables[TableIndex].Flags &
|
||||
@ -766,7 +768,7 @@ AcpiTbSetTableLoadedFlag (
|
||||
{
|
||||
|
||||
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (TableIndex < AcpiGbl_RootTableList.Count)
|
||||
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
|
||||
{
|
||||
if (IsLoaded)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user