DynamicTablesPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the DynamicTablesPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:53:55 -08:00
committed by mergify[bot]
parent 7c34237831
commit 731c67e1d7
85 changed files with 5347 additions and 4795 deletions

View File

@ -69,6 +69,7 @@ GetAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->StdAcpiTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdAcpiTableGeneratorList[TableId];
} else {
@ -79,12 +80,14 @@ GetAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->CustomAcpiTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomAcpiTableGeneratorList[TableId];
} else {
return EFI_NOT_FOUND;
}
}
return EFI_SUCCESS;
}
@ -132,6 +135,7 @@ RegisterAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = Generator;
} else {
@ -142,12 +146,14 @@ RegisterAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = Generator;
} else {
return EFI_ALREADY_STARTED;
}
}
return EFI_SUCCESS;
}
@ -191,10 +197,12 @@ DeregisterAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdAcpiTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;
@ -204,11 +212,14 @@ DeregisterAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] != NULL) {
if (Generator !=
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId]) {
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;

View File

@ -68,6 +68,7 @@ GetDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->StdDtTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdDtTableGeneratorList[TableId];
} else {
@ -78,12 +79,14 @@ GetDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->CustomDtTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomDtTableGeneratorList[TableId];
} else {
return EFI_NOT_FOUND;
}
}
return EFI_SUCCESS;
}
@ -131,6 +134,7 @@ RegisterDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdDtTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdDtTableGeneratorList[TableId] = Generator;
} else {
@ -141,12 +145,14 @@ RegisterDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomDtTableGeneratorList[TableId] = Generator;
} else {
return EFI_ALREADY_STARTED;
}
}
return EFI_SUCCESS;
}
@ -190,10 +196,12 @@ DeregisterDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdDtTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdDtTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.StdDtTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;
@ -203,11 +211,14 @@ DeregisterDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] != NULL) {
if (Generator !=
TableFactoryInfo.CustomDtTableGeneratorList[TableId]) {
TableFactoryInfo.CustomDtTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.CustomDtTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;

View File

@ -80,5 +80,6 @@ DynamicTableFactoryDxeInitialize (
Status
));
}
return Status;
}

View File

@ -69,6 +69,7 @@ GetSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->StdSmbiosTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdSmbiosTableGeneratorList[TableId];
} else {
@ -79,12 +80,14 @@ GetSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER;
}
if (FactoryInfo->CustomSmbiosTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomSmbiosTableGeneratorList[TableId];
} else {
return EFI_NOT_FOUND;
}
}
return EFI_SUCCESS;
}
@ -132,6 +135,7 @@ RegisterSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = Generator;
} else {
@ -142,12 +146,14 @@ RegisterSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = Generator;
} else {
return EFI_ALREADY_STARTED;
}
}
return EFI_SUCCESS;
}
@ -191,10 +197,12 @@ DeregisterSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdSmbiosTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;
@ -204,11 +212,14 @@ DeregisterSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER;
}
if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] != NULL) {
if (Generator !=
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId]) {
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER;
}
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = NULL;
} else {
return EFI_NOT_FOUND;

View File

@ -142,6 +142,7 @@ exit_handler:
Status = Status1;
}
}
return Status;
}
@ -262,6 +263,7 @@ exit_handler:
Status = Status1;
}
}
return Status;
}
@ -449,24 +451,30 @@ VerifyMandatoryTablesArePresent (
DEBUG ((DEBUG_ERROR, "ERROR: FADT Table not found\n"));
Status = EFI_NOT_FOUND;
}
if (!MadtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: MADT Table not found.\n"));
Status = EFI_NOT_FOUND;
}
if (!GtdtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: GTDT Table not found.\n"));
Status = EFI_NOT_FOUND;
}
if (!DsdtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: DSDT Table not found.\n"));
Status = EFI_NOT_FOUND;
}
if (!Dbg2Found) {
DEBUG ((DEBUG_WARN, "WARNING: DBG2 Table not found.\n"));
}
if (!SpcrFound) {
DEBUG ((DEBUG_WARN, "WARNING: SPCR Table not found.\n"));
}
return Status;
}
@ -564,7 +572,8 @@ ProcessAcpiTables (
// Add the FADT Table first.
for (Idx = 0; Idx < AcpiTableCount; Idx++) {
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
AcpiTableInfo[Idx].TableGeneratorId) {
AcpiTableInfo[Idx].TableGeneratorId)
{
Status = BuildAndInstallAcpiTable (
TableFactoryProtocol,
CfgMgrProtocol,
@ -580,6 +589,7 @@ ProcessAcpiTables (
));
return Status;
}
break;
}
} // for
@ -595,7 +605,8 @@ ProcessAcpiTables (
// Skip FADT Table since we have already added
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
AcpiTableInfo[Idx].TableGeneratorId) {
AcpiTableInfo[Idx].TableGeneratorId)
{
continue;
}
@ -604,7 +615,8 @@ ProcessAcpiTables (
((CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdReserved) >=
AcpiTableInfo[Idx].TableGeneratorId) ||
(CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMax) <=
AcpiTableInfo[Idx].TableGeneratorId))) {
AcpiTableInfo[Idx].TableGeneratorId)))
{
DEBUG ((
DEBUG_WARN,
"WARNING: Invalid ACPI Generator table ID = 0x%x, Skipping...\n",
@ -725,5 +737,6 @@ DynamicTableManagerDxeInitialize (
Status
));
}
return Status;
}

View File

@ -372,4 +372,3 @@ DeregisterAcpiTableGenerator (
#pragma pack()
#endif // ACPI_TABLE_GENERATOR_H_

View File

@ -494,6 +494,7 @@ typedef struct CmArmNamedComponentNode {
/// Memory access properties : Address size limit
UINT8 AddressSizeLimit;
/** ASCII Null terminated string with the full path to
the entry in the namespace for this object.
*/

View File

@ -173,4 +173,3 @@ DeregisterDtTableGenerator (
#pragma pack()
#endif // DEVICETREE_TABLE_GENERATOR_H_

View File

@ -228,7 +228,7 @@ EFIAPI
DeregisterSmbiosTableGenerator (
IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
);
#pragma pack()
#endif // SMBIOS_TABLE_GENERATOR_H_

View File

@ -244,4 +244,3 @@ typedef enum TableGeneratorNameSpace {
#define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)
#endif // TABLE_GENERATOR_H_

View File

@ -263,7 +263,8 @@ FreeDbg2TableEx (
if ((Table == NULL) ||
(*Table == NULL) ||
(TableCount != 2)) {
(TableCount != 2))
{
DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER;
}
@ -272,7 +273,8 @@ FreeDbg2TableEx (
if ((TableList[1] == NULL) ||
(TableList[1]->Signature !=
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
{
DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid SSDT table pointer.\n"));
return EFI_INVALID_PARAMETER;
}
@ -337,7 +339,8 @@ BuildDbg2TableEx (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: DBG2: Requested table revision = %d, is not supported."
@ -451,7 +454,8 @@ BuildDbg2TableEx (
(SerialPortInfo->PortSubtype ==
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||
(SerialPortInfo->PortSubtype ==
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART)) {
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART))
{
// Initialize the serial port
Status = SetupDebugUart (SerialPortInfo);
if (EFI_ERROR (Status)) {
@ -547,6 +551,7 @@ AcpiDbg2LibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&Dbg2Generator);
DEBUG ((DEBUG_INFO, "DBG2: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -570,6 +575,7 @@ AcpiDbg2LibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&Dbg2Generator);
DEBUG ((DEBUG_INFO, "DBG2: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -385,6 +385,7 @@ FadtAddHypervisorVendorId (
Status
));
}
goto error_handler;
}
@ -446,6 +447,7 @@ FadtAddFixedFeatureFlags (
Status
));
}
goto error_handler;
}
@ -513,7 +515,8 @@ BuildFadtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: FADT: Requested table revision = %d, is not supported."
@ -653,6 +656,7 @@ AcpiFadtLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&FadtGenerator);
DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -676,6 +680,7 @@ AcpiFadtLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&FadtGenerator);
DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -308,6 +308,7 @@ AddGTBlockTimerFrames (
GtBlockFrame++;
GTBlockTimerFrameList++;
} // for
return EFI_SUCCESS;
}
@ -358,7 +359,8 @@ AddGTBlockList (
&GTBlockTimerFrameCount
);
if (EFI_ERROR (Status) ||
(GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount)) {
(GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: GTDT: Failed to get Generic Timer Frames. Status = %r\n",
@ -417,6 +419,7 @@ AddGTBlockList (
GTBlock->Length);
GTBlockInfo++;
}// for
return EFI_SUCCESS;
}
@ -473,7 +476,8 @@ BuildGtdtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: GTDT: Requested table revision = %d, is not supported."
@ -546,6 +550,7 @@ BuildGtdtTable (
));
goto error_handler;
}
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
GTBlockInfo[Idx].GTBlockTimerFrameCount);
}
@ -658,6 +663,7 @@ error_handler:
FreePool (*Table);
*Table = NULL;
}
return Status;
}
@ -750,6 +756,7 @@ AcpiGtdtLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&GtdtGenerator);
DEBUG ((DEBUG_INFO, "GTDT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -773,6 +780,7 @@ AcpiGtdtLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&GtdtGenerator);
DEBUG ((DEBUG_INFO, "GTDT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -190,6 +190,7 @@ GetSizeofItsGroupNodes (
(*NodeIndexer)++;
NodeList++;
}
return Size;
}
@ -413,6 +414,7 @@ GetSizeofSmmuV1V2Nodes (
(*NodeIndexer)++;
NodeList++;
}
return Size;
}
@ -484,6 +486,7 @@ GetSizeofSmmuV3Nodes (
(*NodeIndexer)++;
NodeList++;
}
return Size;
}
@ -555,6 +558,7 @@ GetSizeofPmcgNodes (
(*NodeIndexer)++;
NodeList++;
}
return Size;
}
@ -600,8 +604,10 @@ GetNodeOffsetReferencedByToken (
));
return EFI_SUCCESS;
}
NodeIndexer++;
}
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer: Token = %p, Not Found\n",
@ -900,7 +906,8 @@ AddNamedComponentNodes (
}
if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) {
(NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for Named Component
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)NcNode +
NcNode->Node.IdReference);
@ -1005,7 +1012,8 @@ AddRootComplexNodes (
RcNode->Reserved1[2] = EFI_ACPI_RESERVED_BYTE;
if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) {
(NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for Root Complex
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)RcNode +
RcNode->Node.IdReference);
@ -1216,7 +1224,8 @@ AddSmmuV1V2Nodes (
// Add PMU Interrupt Array
if ((SmmuNode->NumPmuInterrupts > 0) &&
(NodeList->PmuInterruptToken != CM_NULL_TOKEN)) {
(NodeList->PmuInterruptToken != CM_NULL_TOKEN))
{
Status = AddSmmuInterruptArray (
CfgMgrProtocol,
PmuInterruptArray,
@ -1234,7 +1243,8 @@ AddSmmuV1V2Nodes (
}
if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) {
(NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for SMMU v1/v2 Node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuNode +
SmmuNode->Node.IdReference);
@ -1254,6 +1264,7 @@ AddSmmuV1V2Nodes (
return Status;
}
}
// Next SMMU v1/v2 Node
SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE *)((UINT8 *)SmmuNode +
SmmuNode->Node.Length);
@ -1341,7 +1352,8 @@ AddSmmuV3Nodes (
}
if ((SmmuV3Node->Event != 0) && (SmmuV3Node->Pri != 0) &&
(SmmuV3Node->Gerr != 0) && (SmmuV3Node->Sync != 0)) {
(SmmuV3Node->Gerr != 0) && (SmmuV3Node->Sync != 0))
{
// If all the SMMU control interrupts are GSIV based,
// the DeviceID mapping index field is ignored.
SmmuV3Node->DeviceIdMappingIndex = 0;
@ -1350,7 +1362,8 @@ AddSmmuV3Nodes (
}
if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) {
(NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for SMMUv3 node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuV3Node +
SmmuV3Node->Node.IdReference);
@ -1464,7 +1477,8 @@ AddPmcgNodes (
}
if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) {
(NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for PMCG node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)PmcgNode +
PmcgNode->Node.IdReference);
@ -1566,7 +1580,8 @@ BuildIortTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: IORT: Requested table revision = %d, is not supported."
@ -1737,6 +1752,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -1767,6 +1783,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -1797,6 +1814,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -1827,6 +1845,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -1857,6 +1876,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -1887,6 +1907,7 @@ BuildIortTable (
));
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
@ -2089,6 +2110,7 @@ error_handler:
FreePool (*Table);
*Table = NULL;
}
return Status;
}
@ -2113,6 +2135,7 @@ FreeIortTableResources (
)
{
ACPI_IORT_GENERATOR *Generator;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
ASSERT (CfgMgrProtocol != NULL);
@ -2199,6 +2222,7 @@ AcpiIortLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&IortGenerator.Header);
DEBUG ((DEBUG_INFO, "IORT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -2222,6 +2246,7 @@ AcpiIortLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&IortGenerator.Header);
DEBUG ((DEBUG_INFO, "Iort: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -480,7 +480,8 @@ BuildMadtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: MADT: Requested table revision = %d, is not supported."
@ -708,6 +709,7 @@ error_handler:
FreePool (*Table);
*Table = NULL;
}
return Status;
}
@ -800,6 +802,7 @@ AcpiMadtLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&MadtGenerator);
DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -823,6 +826,7 @@ AcpiMadtLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&MadtGenerator);
DEBUG ((DEBUG_INFO, "MADT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -140,7 +140,8 @@ BuildMcfgTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: MCFG: Requested table revision = %d, is not supported."
@ -160,7 +161,8 @@ BuildMcfgTable (
&ConfigurationSpaceCount
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR,
DEBUG ((
DEBUG_ERROR,
"ERROR: MCFG: Failed to get PCI Configuration Space Information." \
" Status = %r\n",
Status
@ -242,6 +244,7 @@ error_handler:
FreePool (*Table);
*Table = NULL;
}
return Status;
}
@ -334,6 +337,7 @@ AcpiMcfgLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&McfgGenerator);
DEBUG ((DEBUG_INFO, "MCFG: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -357,6 +361,7 @@ AcpiMcfgLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&McfgGenerator);
DEBUG ((DEBUG_INFO, "MCFG: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -192,6 +192,7 @@ GetPpttNodeReferencedByToken (
));
return Status;
}
NodeIndexer++;
}
@ -447,7 +448,8 @@ IsGicCTokenEqual (
IS_ACPI_PROC_ID_VALID (ProcNode2) &&
(ProcNode1->GicCToken != CM_NULL_TOKEN) &&
(ProcNode2->GicCToken != CM_NULL_TOKEN) &&
(ProcNode1->GicCToken == ProcNode2->GicCToken)) {
(ProcNode1->GicCToken == ProcNode2->GicCToken))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: PPTT: Two Processor Hierarchy Info objects (%d and %d) map to " \
@ -594,7 +596,9 @@ AddProcHierarchyNodes (
// Test if the reference is to a 'leaf' node
if (IS_PROC_NODE_LEAF (
((CM_ARM_PROC_HIERARCHY_INFO*)PpttNodeFound->Object))) {
((CM_ARM_PROC_HIERARCHY_INFO *)PpttNodeFound->Object)
))
{
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
@ -909,6 +913,7 @@ AddCacheTypeStructures (
CacheInfoNode->Associativity
));
}
#endif
// Note a typecast is needed as the maximum associativity
@ -926,8 +931,8 @@ AddCacheTypeStructures (
// Validate and populate cache line size
if ((CacheInfoNode->LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
(CacheInfoNode->LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
(CacheInfoNode->LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
{
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
@ -995,7 +1000,6 @@ AddIdTypeStructures (
PPTT_NODE_INDEXER *IdStructIterator;
UINT32 NodeCount;
ASSERT (
(Generator != NULL) &&
(CfgMgrProtocol != NULL) &&
@ -1095,7 +1099,8 @@ BuildPpttTable (
);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: PPTT: Requested table revision = %d is not supported. "
@ -1213,7 +1218,6 @@ BuildPpttTable (
ProcHierarchyNodeOffset,
Generator->ProcHierarchyNodeIndexedList
));
}
// Include the size of Cache Type Structures and index them
@ -1509,6 +1513,7 @@ AcpiPpttLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&PpttGenerator.Header);
DEBUG ((DEBUG_INFO, "PPTT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -1533,6 +1538,7 @@ AcpiPpttLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&PpttGenerator.Header);
DEBUG ((DEBUG_INFO, "PPTT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -114,6 +114,7 @@ AcpiRawLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&RawGenerator);
DEBUG ((DEBUG_INFO, "RAW: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -137,6 +138,7 @@ AcpiRawLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&RawGenerator);
DEBUG ((DEBUG_INFO, "RAW: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -138,7 +138,8 @@ FreeSpcrTableEx (
if ((Table == NULL) ||
(*Table == NULL) ||
(TableCount != 2)) {
(TableCount != 2))
{
DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER;
}
@ -147,7 +148,8 @@ FreeSpcrTableEx (
if ((TableList[1] == NULL) ||
(TableList[1]->Signature !=
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
{
DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid SSDT table pointer.\n"));
return EFI_INVALID_PARAMETER;
}
@ -212,7 +214,8 @@ BuildSpcrTableEx (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SPCR: Requested table revision = %d, is not supported."
@ -447,6 +450,7 @@ AcpiSpcrLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SpcrGenerator);
DEBUG ((DEBUG_INFO, "SPCR: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -470,6 +474,7 @@ AcpiSpcrLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SpcrGenerator);
DEBUG ((DEBUG_INFO, "SPCR: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -97,7 +97,6 @@ GET_OBJECT_LIST (
CM_ARM_DEVICE_HANDLE_PCI
);
/** Return the PCI Device information in BDF format
PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
@ -115,6 +114,7 @@ GetBdf (
)
{
UINT16 Bdf;
Bdf = (UINT16)DeviceHandlePci->BusNumber << 8;
Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3;
Bdf |= DeviceHandlePci->FunctionNumber & 0x7;
@ -165,6 +165,7 @@ AddGICCAffinity (
GicCAff++;
GicCInfo++;
}// while
return EFI_SUCCESS;
}
@ -212,6 +213,7 @@ AddGICItsAffinity (
GicItsAff++;
GicItsInfo++;
}// while
return EFI_SUCCESS;
}
@ -264,10 +266,10 @@ AddMemoryAffinity (
MemAff++;
MemAffInfo++;
}// while
return EFI_SUCCESS;
}
/** Add the Generic Initiator Affinity Structures in the SRAT Table.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
@ -358,7 +360,8 @@ AddGenericInitiatorAffinity (
GenInitAff->DeviceHandle.Acpi.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Acpi.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
} else if (GenInitAffInfo->DeviceHandleType ==
EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {
EFI_ACPI_6_3_PCI_DEVICE_HANDLE)
{
Status = GetEArmObjDeviceHandlePci (
CfgMgrProtocol,
GenInitAffInfo->DeviceHandleToken,
@ -413,6 +416,7 @@ AddGenericInitiatorAffinity (
GenInitAff++;
GenInitAffInfo++;
}// while
return EFI_SUCCESS;
}
@ -478,7 +482,8 @@ BuildSratTable (
);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SRAT: Requested table revision = %d is not supported. "
@ -805,6 +810,7 @@ AcpiSratLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SratGenerator);
DEBUG ((DEBUG_INFO, "SRAT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);
@ -828,6 +834,7 @@ AcpiSratLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SratGenerator);
DEBUG ((DEBUG_INFO, "SRAT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status);

View File

@ -71,7 +71,8 @@ ValidateCmn600Info (
CONST CM_ARM_GENERIC_INTERRUPT *DtcInterrupt;
if ((Cmn600InfoList == NULL) ||
(Cmn600Count == 0)) {
(Cmn600Count == 0))
{
return EFI_INVALID_PARAMETER;
}
@ -81,7 +82,8 @@ ValidateCmn600Info (
// At least one DTC is required.
if ((Cmn600Info->DtcCount == 0) ||
(Cmn600Info->DtcCount > MAX_DTC_COUNT)) {
(Cmn600Info->DtcCount > MAX_DTC_COUNT))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Invalid DTC configuration:\n"
@ -91,7 +93,8 @@ ValidateCmn600Info (
// Check PERIPHBASE and ROOTNODEBASE address spaces are initialized.
if ((Cmn600Info->PeriphBaseAddress == 0) ||
(Cmn600Info->RootNodeBaseAddress == 0)) {
(Cmn600Info->RootNodeBaseAddress == 0))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Invalid PERIPHBASE or ROOTNODEBASE.\n"
@ -103,7 +106,8 @@ ValidateCmn600Info (
// dimension mesh, and 256MB aligned otherwise.
// Check it is a least 64MB aligned.
if ((Cmn600Info->PeriphBaseAddress &
(PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0) {
(PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0)
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600: PERIPHBASE address must be 64MB aligned.\n"
@ -123,7 +127,8 @@ ValidateCmn600Info (
// Check the 16 KB alignment of the ROOTNODEBASE address.
if ((Cmn600Info->PeriphBaseAddress &
(ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0) {
(ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0)
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Root base address must be 16KB aligned.\n"
@ -135,7 +140,8 @@ ValidateCmn600Info (
// address space.
if ((Cmn600Info->PeriphBaseAddress > Cmn600Info->RootNodeBaseAddress) ||
((Cmn600Info->PeriphBaseAddress + Cmn600Info->PeriphBaseAddressLength) <
(Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH))) {
(Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH)))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600:"
@ -147,7 +153,8 @@ ValidateCmn600Info (
for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
if (((DtcInterrupt->Flags &
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0)) {
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n"
@ -155,7 +162,6 @@ ValidateCmn600Info (
goto error_handler;
}
} // for DTC Interrupt
} // for Cmn600InfoList
return EFI_SUCCESS;
@ -193,6 +199,7 @@ error_handler:
DtcInterrupt->Flags
));
} // for
DEBUG_CODE_END ();
return EFI_INVALID_PARAMETER;
@ -441,7 +448,8 @@ FreeSsdtCmn600TableResourcesEx (
if ((Table == NULL) ||
(*Table == NULL) ||
(TableCount == 0)) {
(TableCount == 0))
{
DEBUG ((DEBUG_ERROR, "ERROR: SSDT-CMN-600: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER;
}
@ -451,7 +459,8 @@ FreeSsdtCmn600TableResourcesEx (
for (Index = 0; Index < TableCount; Index++) {
if ((TableList[Index] != NULL) &&
(TableList[Index]->Signature ==
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
{
FreePool (TableList[Index]);
} else {
DEBUG ((

View File

@ -104,7 +104,8 @@ TokenTableInitialize (
if ((Generator == NULL) ||
(Count == 0) ||
(Count >= MAX_NODE_COUNT)) {
(Count >= MAX_NODE_COUNT))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -211,7 +212,8 @@ WriteAslName (
UINT8 Index;
if ((Value >= MAX_NODE_COUNT) ||
(AslName == NULL)) {
(AslName == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -739,12 +741,12 @@ CreateAmlCpuTopologyTree (
// Find the children of the CM_ARM_PROC_HIERARCHY_INFO
// currently being handled (i.e. ParentToken == NodeToken).
if (Generator->ProcNodeList[Index].ParentToken == NodeToken) {
// Only Cpus (leaf nodes in this tree) have a GicCToken.
// Create a Cpu node.
if (Generator->ProcNodeList[Index].GicCToken != CM_NULL_TOKEN) {
if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
PPTT_CPU_PROCESSOR_MASK) {
PPTT_CPU_PROCESSOR_MASK)
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cpu: 0x%x.\n",
@ -767,13 +769,13 @@ CreateAmlCpuTopologyTree (
}
CpuIndex++;
} else {
// If this is not a Cpu, then this is a cluster.
// Acpi processor Id for clusters is not handled.
if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
PPTT_CLUSTER_PROCESSOR_MASK) {
PPTT_CLUSTER_PROCESSOR_MASK)
{
DEBUG ((
DEBUG_ERROR,
"ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cluster: 0x%x.\n",
@ -865,7 +867,8 @@ CreateTopologyFromProcHierarchy (
for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
if ((Generator->ProcNodeList[Index].ParentToken == CM_NULL_TOKEN) &&
(Generator->ProcNodeList[Index].Flags &
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL)) {
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL))
{
if (TopLevelProcNodeIndex != MAX_UINT32) {
DEBUG ((
DEBUG_ERROR,
@ -875,6 +878,7 @@ CreateTopologyFromProcHierarchy (
ASSERT (0);
goto exit_handler;
}
TopLevelProcNodeIndex = Index;
}
} // for
@ -1034,7 +1038,8 @@ BuildSsdtCpuTopologyTable (
&ProcHierarchyNodeCount
);
if (EFI_ERROR (Status) &&
(Status != EFI_NOT_FOUND)) {
(Status != EFI_NOT_FOUND))
{
goto exit_handler;
}
@ -1189,6 +1194,7 @@ AcpiSsdtCpuTopologyLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
DEBUG ((
DEBUG_INFO,
@ -1217,6 +1223,7 @@ AcpiSsdtCpuTopologyLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
DEBUG ((
DEBUG_INFO,

View File

@ -95,7 +95,8 @@ FreeSsdtSerialPortTableEx (
if ((Table == NULL) ||
(*Table == NULL) ||
(TableCount == 0)) {
(TableCount == 0))
{
DEBUG ((DEBUG_ERROR, "ERROR: SSDT-SERIAL-PORT: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER;
}
@ -105,7 +106,8 @@ FreeSsdtSerialPortTableEx (
for (Index = 0; Index < TableCount; Index++) {
if ((TableList[Index] != NULL) &&
(TableList[Index]->Signature ==
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
{
Status = FreeSsdtSerialPortTable (TableList[Index]);
} else {
Status = EFI_INVALID_PARAMETER;
@ -330,6 +332,7 @@ AcpiSsdtSerialPortLibConstructor (
)
{
EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SsdtSerialPortGenerator);
DEBUG ((
DEBUG_INFO,
@ -358,6 +361,7 @@ AcpiSsdtSerialPortLibDestructor (
)
{
EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SsdtSerialPortGenerator);
DEBUG ((
DEBUG_INFO,

View File

@ -159,7 +159,8 @@ AmlGetEisaIdFromString (
{
if ((EisaIdStr == NULL) ||
(!IsValidPnpId (EisaIdStr)) ||
(EisaIdInt == NULL)) {
(EisaIdInt == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -90,18 +90,23 @@ AmlDbgPrintNameSeg (
DEBUG ((DEBUG_INFO, "%c", Buffer[0]));
if ((Buffer[1] == AML_NAME_CHAR__) &&
(Buffer[2] == AML_NAME_CHAR__) &&
(Buffer[3] == AML_NAME_CHAR__)) {
(Buffer[3] == AML_NAME_CHAR__))
{
return;
}
DEBUG ((DEBUG_INFO, "%c", Buffer[1]));
if ((Buffer[2] == AML_NAME_CHAR__) &&
(Buffer[3] == AML_NAME_CHAR__)) {
(Buffer[3] == AML_NAME_CHAR__))
{
return;
}
DEBUG ((DEBUG_INFO, "%c", Buffer[2]));
if (Buffer[3] == AML_NAME_CHAR__) {
return;
}
DEBUG ((DEBUG_INFO, "%c", Buffer[3]));
return;
}
@ -153,6 +158,7 @@ AmlDbgPrintNameString (
ASSERT (0);
return;
}
SegCount = 1;
} else if (*Buffer == AML_ZERO_OP) {
SegCount = 0;
@ -231,7 +237,8 @@ AmlDbgPrintDataNode (
DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
(DataNode->DataType == EAmlNodeDataTypeString)) {
(DataNode->DataType == EAmlNodeDataTypeString))
{
AMLDBG_PRINT_CHARS (
DEBUG_INFO,
(CONST CHAR8 *)DataNode->Buffer,
@ -300,15 +307,23 @@ AmlDbgPrintObjectNode (
// Print a string corresponding to the field object OpCode/SubOpCode.
if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
DEBUG ((
DEBUG_INFO,
"%-15a ",
AmlGetFieldOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
0
)));
)
));
} else {
// Print a string corresponding to the object OpCode/SubOpCode.
DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
DEBUG ((
DEBUG_INFO,
"%-15a | ",
AmlGetOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
ObjectNode->AmlByteEncoding->SubOpCode)
ObjectNode->AmlByteEncoding->SubOpCode
)
));
}
@ -532,6 +547,7 @@ AmlDbgDumpRaw (
if ((Length & 0x0F) <= 8) {
PartLineChars += 2;
}
while (PartLineChars > 0) {
DEBUG ((DEBUG_VERBOSE, " "));
PartLineChars--;

View File

@ -311,16 +311,20 @@ AmlGetByteEncoding (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) {
Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
(mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
AML_IS_PSEUDO_OPCODE) {
AML_IS_PSEUDO_OPCODE)
{
// A pseudo OpCode cannot be parsed as it is internal to this library.
// The MethodInvocation encoding can be detected by NameSpace lookup.
ASSERT (0);
return NULL;
}
return &mAmlByteEncoding[Index];
}
}
@ -350,12 +354,15 @@ AmlGetByteEncodingByOpCode (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) {
Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
(mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return &mAmlByteEncoding[Index];
}
}
return NULL;
}
@ -391,16 +398,19 @@ AmlGetFieldEncoding (
// Search in the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) {
Index++)
{
if (mAmlFieldEncoding[Index].OpCode == OpCode) {
if ((mAmlFieldEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
AML_IS_PSEUDO_OPCODE) {
AML_IS_PSEUDO_OPCODE)
{
// A pseudo OpCode cannot be parsed as it is internal to this library.
// The NamedField encoding can be detected because it begins with a
// char.
ASSERT (0);
return NULL;
}
return &mAmlFieldEncoding[Index];
}
}
@ -431,17 +441,21 @@ AmlGetFieldEncodingByOpCode (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) {
Index++)
{
if ((mAmlFieldEncoding[Index].OpCode == OpCode) &&
(mAmlFieldEncoding[Index].SubOpCode == SubOpCode)) {
(mAmlFieldEncoding[Index].SubOpCode == SubOpCode))
{
return &mAmlFieldEncoding[Index];
}
}
return NULL;
}
// Enable this function for debug.
#if !defined (MDEPKG_NDEBUG)
/** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string.
@ -463,9 +477,11 @@ AmlGetOpCodeStr (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) {
Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
(mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return mAmlByteEncoding[Index].Str;
}
}
@ -500,7 +516,8 @@ AmlGetFieldOpCodeStr (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) {
Index++)
{
if ((mAmlFieldEncoding[Index].OpCode == OpCode)) {
return mAmlFieldEncoding[Index].Str;
}
@ -509,6 +526,7 @@ AmlGetFieldOpCodeStr (
ASSERT (0);
return NULL;
}
#endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry
@ -532,12 +550,15 @@ AmlIsOpCodeValid (
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) {
Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
(mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return TRUE;
}
}
return FALSE;
}
@ -577,7 +598,8 @@ AmlTypeToNodeDataType (
)
{
if (AmlType >=
(sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0]))) {
(sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0])))
{
ASSERT (0);
return EAmlNodeDataTypeNone;
}
@ -607,7 +629,8 @@ AmlGetPkgLength (
UINT32 Offset;
if ((Buffer == NULL) ||
(PkgLength == NULL)) {
(PkgLength == NULL))
{
ASSERT (0);
return 0;
}
@ -720,7 +743,6 @@ AmlSetPkgLength (
if ((Length < (1 << 6))) {
// Length < 2^6, only need one byte to encode it.
LeadByte = (UINT8)Length;
} else {
// Need more than one byte to encode it.
// Test Length to find how many bytes are needed.
@ -729,19 +751,15 @@ AmlSetPkgLength (
// Length >= 2^28, should not be possible.
ASSERT (0);
return 0;
} else if (Length >= (1 << 20)) {
// Length >= 2^20
Offset = 3;
} else if (Length >= (1 << 12)) {
// Length >= 2^12
Offset = 2;
} else if (Length >= (1 << 6)) {
// Length >= 2^6
Offset = 1;
} else {
// Should not be possible.
ASSERT (0);
@ -786,15 +804,12 @@ AmlComputePkgLengthWidth (
if (Length >= (1 << 28)) {
ASSERT (0);
return 0;
} else if (Length >= (1 << 20)) {
// Length >= 2^20
return 4;
} else if (Length >= (1 << 12)) {
// Length >= 2^12
return 3;
} else if (Length >= (1 << 6)) {
// Length >= 2^6
return 2;
@ -874,7 +889,8 @@ AmlComputePkgLength (
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
if (ReComputedPkgLenWidth != PkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4)) {
(ReComputedPkgLenWidth < 4))
{
// No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one.
Length += 1;

View File

@ -218,6 +218,7 @@ AmlGetFieldEncodingByOpCode (
// Enable this function for debug.
#if !defined (MDEPKG_NDEBUG)
/** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string.
@ -249,6 +250,7 @@ AmlGetFieldOpCodeStr (
IN UINT8 OpCode,
IN UINT8 SubOpCode
);
#endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry
@ -372,4 +374,3 @@ AmlComputePkgLength (
);
#endif // AML_H_

View File

@ -53,7 +53,8 @@ AmlDeviceOpUpdateName (
if ((DeviceOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (DeviceOpNode, AML_EXT_OP, AML_EXT_DEVICE_OP)) ||
(NewNameString == NULL)) {
(NewNameString == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -66,7 +67,8 @@ AmlDeviceOpUpdateName (
);
if ((DeviceNameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceNameDataNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString))) {
(!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -124,7 +126,8 @@ AmlNameOpUpdateInteger (
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -138,7 +141,8 @@ AmlNameOpUpdateInteger (
EAmlParseIndexTerm1
);
if ((IntegerOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject)) {
(AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -180,7 +184,8 @@ AmlNameOpUpdateString (
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -193,7 +198,8 @@ AmlNameOpUpdateString (
EAmlParseIndexTerm1
);
if ((StringOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject)) {
(AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -205,7 +211,8 @@ AmlNameOpUpdateString (
EAmlParseIndexTerm0
);
if ((StringDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData)) {
(AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -260,7 +267,8 @@ AmlNameOpGetFirstRdNode (
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(OutRdNode == NULL)) {
(OutRdNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -275,7 +283,8 @@ AmlNameOpGetFirstRdNode (
);
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -288,7 +297,8 @@ AmlNameOpGetFirstRdNode (
);
if ((FirstRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)FirstRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData))) {
(!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -337,7 +347,8 @@ AmlNameOpGetNextRdNode (
if ((CurrRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)CurrRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (CurrRdNode, EAmlNodeDataTypeResourceData)) ||
(OutRdNode == NULL)) {
(OutRdNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -349,7 +360,8 @@ AmlNameOpGetNextRdNode (
(AML_NODE_HANDLE)CurrRdNode
);
if ((BufferOpNode == NULL) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -359,7 +371,8 @@ AmlNameOpGetNextRdNode (
(AML_NODE_HANDLE)BufferOpNode
);
if ((NameOpNode == NULL) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -372,7 +385,9 @@ AmlNameOpGetNextRdNode (
// If the Resource Data is an End Tag, return NULL.
if (AmlNodeHasRdDataType (
*OutRdNode,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
*OutRdNode = NULL;
}

View File

@ -59,7 +59,8 @@ AmlNameOpCompareName (
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(AslName == NULL)) {
(AslName == NULL))
{
ASSERT (0);
return FALSE;
}
@ -72,7 +73,8 @@ AmlNameOpCompareName (
);
if ((NameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameDataNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString))) {
(!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString)))
{
ASSERT (0);
return FALSE;
}
@ -144,7 +146,8 @@ AmlNodeHasOpCode (
// Check the OpCode and SubOpCode.
if ((OpCode != NodeOpCode) ||
(SubOpCode != NodeSubOpCode)) {
(SubOpCode != NodeSubOpCode))
{
return FALSE;
}

View File

@ -54,11 +54,15 @@ AmlUpdateRdInterrupt (
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (
InterruptRdNode,
EAmlNodeDataTypeResourceData)) ||
EAmlNodeDataTypeResourceData
)) ||
(!AmlNodeHasRdDataType (
InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME)))) {
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
)
)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -121,6 +125,7 @@ error_handler:
if (QueryBuffer != NULL) {
FreePool (QueryBuffer);
}
return Status;
}
@ -171,13 +176,17 @@ AmlUpdateRdInterruptEx (
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (
InterruptRdNode,
EAmlNodeDataTypeResourceData)) ||
EAmlNodeDataTypeResourceData
)) ||
(!AmlNodeHasRdDataType (
InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME))) ||
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
)
)) ||
(IrqList == NULL) ||
(IrqCount == 0)) {
(IrqCount == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -260,7 +269,10 @@ AmlUpdateRdQWord (
(!AmlNodeHasRdDataType (
QWordRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME)))) {
ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME
)
)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -316,5 +328,6 @@ error_handler:
if (QueryBuffer != NULL) {
FreePool (QueryBuffer);
}
return Status;
}

View File

@ -102,7 +102,8 @@ AmlCodeGenDefinitionBlock (
if ((TableSignature == NULL) ||
(OemId == NULL) ||
(OemTableId == NULL) ||
(NewRootNode == NULL)) {
(NewRootNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -145,7 +146,8 @@ AmlCodeGenString (
AML_DATA_NODE *DataNode;
if ((String == NULL) ||
(NewObjectNode == NULL)) {
(NewObjectNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -315,6 +317,7 @@ error_handler:
if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
return Status;
}
@ -355,7 +358,8 @@ AmlCodeGenBuffer (
// Buffer and BufferSize must be either both set, or both clear.
if ((NewObjectNode == NULL) ||
((Buffer == NULL) != (BufferSize == 0))) {
((Buffer == NULL) != (BufferSize == 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -446,12 +450,15 @@ error_handler:
if (BufferSizeNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)BufferSizeNode);
}
if (BufferNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)BufferNode);
}
if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
return Status;
}
@ -540,7 +547,8 @@ AmlCodeGenName (
if ((NameString == NULL) ||
(Object == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -664,7 +672,8 @@ AmlCodeGenNameString (
if ((NameString == NULL) ||
(String == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -721,7 +730,8 @@ AmlCodeGenNameInteger (
AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -779,7 +789,8 @@ AmlCodeGenDevice (
UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -892,7 +903,8 @@ AmlCodeGenScope (
UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1028,7 +1040,8 @@ AmlCodeGenMethod (
if ((NameString == NULL) ||
(NumArgs > 6) ||
(SyncLevel > 15) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1145,6 +1158,7 @@ error_handler2:
if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
@ -1153,6 +1167,7 @@ error_handler1:
if (AmlNameString != NULL) {
FreePool (AmlNameString);
}
return Status;
}
@ -1201,7 +1216,11 @@ AmlCodeGenReturn (
((ParentNode == NULL) && (NewObjectNode == NULL)) ||
((ParentNode != NULL) &&
!AmlNodeCompareOpCode (
(AML_OBJECT_NODE*)ParentNode, AML_METHOD_OP, 0))) {
(AML_OBJECT_NODE *)ParentNode,
AML_METHOD_OP,
0
)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1244,9 +1263,11 @@ error_handler:
if (ReturnNode != NULL) {
AmlDeleteTree (ReturnNode);
}
if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
return Status;
}
@ -1334,6 +1355,7 @@ exit_handler:
if (AmlNameString != NULL) {
FreePool (AmlNameString);
}
return Status;
}
@ -1392,7 +1414,8 @@ AmlCodeGenMethodRetNameString (
AML_OBJECT_NODE_HANDLE MethodNode;
if ((MethodNameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) {
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1440,6 +1463,7 @@ error_handler:
if (MethodNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)MethodNode);
}
return Status;
}
@ -1490,7 +1514,8 @@ AmlCreateLpiNode (
AML_OBJECT_NODE_HANDLE IntegerNode;
if ((LpiNameString == NULL) ||
((ParentNode == NULL) && (NewLpiNode == NULL))) {
((ParentNode == NULL) && (NewLpiNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1573,6 +1598,7 @@ error_handler:
if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
}
return Status;
}
@ -1659,7 +1685,8 @@ AmlAddLpiState (
if ((LpiNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)LpiNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0))) {
(!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1683,7 +1710,8 @@ AmlAddLpiState (
);
if ((PackageNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) {
(!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1706,6 +1734,7 @@ AmlAddLpiState (
ASSERT (0);
return Status;
}
Status = AmlUpdateInteger (CountNode, Count + 1);
if (EFI_ERROR (Status)) {
ASSERT (0);
@ -1725,6 +1754,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1733,6 +1763,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// WorstCaseWakeLatency
@ -1742,6 +1773,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1750,6 +1782,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// Flags
@ -1759,6 +1792,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1767,6 +1801,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// ArchFlags
@ -1776,6 +1811,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1784,6 +1820,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// ResCntFreq
@ -1793,6 +1830,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1801,6 +1839,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// EnableParentState
@ -1810,6 +1849,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1818,6 +1858,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
// Entry Method
@ -1829,6 +1870,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL;
goto error_handler;
}
Status = AmlCodeGenRdRegister (
GenericRegisterDescriptor->AddressSpaceId,
GenericRegisterDescriptor->RegisterBitWidth,
@ -1849,6 +1891,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
RdNode = NULL;
Status = AmlVarListAddTail (
@ -1859,6 +1902,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
ResourceTemplateNode = NULL;
} else {
// Entry Method: As an integer
@ -1868,6 +1912,7 @@ AmlAddLpiState (
IntegerNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@ -1876,6 +1921,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
IntegerNode = NULL;
}
@ -1886,6 +1932,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL;
goto error_handler;
}
if (ResidencyCounterRegister != NULL) {
Status = AmlCodeGenRdRegister (
ResidencyCounterRegister->AddressSpaceId,
@ -1907,6 +1954,7 @@ AmlAddLpiState (
&RdNode
);
}
if (EFI_ERROR (Status)) {
ASSERT (0);
RdNode = NULL;
@ -1918,6 +1966,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
RdNode = NULL;
Status = AmlVarListAddTail (
@ -1928,6 +1977,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
ResourceTemplateNode = NULL;
// Usage Counter Register.
@ -1937,6 +1987,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL;
goto error_handler;
}
if (UsageCounterRegister != NULL) {
Status = AmlCodeGenRdRegister (
UsageCounterRegister->AddressSpaceId,
@ -1958,6 +2009,7 @@ AmlAddLpiState (
&RdNode
);
}
if (EFI_ERROR (Status)) {
ASSERT (0);
RdNode = NULL;
@ -1969,6 +2021,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
RdNode = NULL;
Status = AmlVarListAddTail (
@ -1979,6 +2032,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
ResourceTemplateNode = NULL;
// State name.
@ -1987,11 +2041,13 @@ AmlAddLpiState (
} else {
Status = AmlCodeGenString ("", &StringNode);
}
if (EFI_ERROR (Status)) {
ASSERT (0);
StringNode = NULL;
goto error_handler;
}
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)StringNode
@ -2000,6 +2056,7 @@ AmlAddLpiState (
ASSERT (0);
goto error_handler;
}
StringNode = NULL;
// Add the new LPI state to the LpiNode.
@ -2018,15 +2075,19 @@ error_handler:
if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)RdNode);
}
if (NewLpiPackageNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)NewLpiPackageNode);
}
if (StringNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)StringNode);
}
if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
}
if (ResourceTemplateNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode);
}

View File

@ -73,7 +73,8 @@ LinkRdNode (
);
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
@ -154,7 +155,8 @@ AmlCodeGenRdInterrupt (
if ((IrqList == NULL) ||
(IrqCount == 0) ||
((NameOpNode == NULL) && (NewRdNode == NULL))) {
((NameOpNode == NULL) && (NewRdNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -247,7 +249,8 @@ AmlCodeGenRdRegister (
EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
((NameOpNode == NULL) && (NewRdNode == NULL))) {
((NameOpNode == NULL) && (NewRdNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -366,7 +369,8 @@ AmlCodeGenEndTag (
// already has resource data elements attached. Indeed, the EndTag should
// have already been added.
if (AmlGetNextVariableArgument ((AML_NODE_HEADER *)ParentNode, NULL) !=
NULL) {
NULL)
{
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
@ -390,6 +394,7 @@ error_handler:
if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
}
return Status;
}

View File

@ -145,7 +145,8 @@ AmlGetFirstAncestorNameSpaceNode (
)
{
if (!IS_AML_NODE_VALID (Node) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -170,7 +171,8 @@ AmlGetFirstAncestorNameSpaceNode (
} else if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE
)) {
))
{
break;
} else {
Node = AmlGetParent ((AML_NODE_HEADER *)Node);
@ -253,7 +255,8 @@ AmlGetAncestorNameSpaceNode (
if (!IS_AML_OBJECT_NODE (Node) ||
(Levels == NULL) ||
(HasRoot == NULL) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -281,6 +284,7 @@ AmlGetAncestorNameSpaceNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
*HasRoot = 1;
break;
}
@ -357,6 +361,7 @@ AmlGetAncestorNameSpaceNode (
ASSERT (0);
return Status;
}
Node = (CONST AML_OBJECT_NODE *)NameSpaceNode;
ParentCnt = 0;
break;
@ -433,11 +438,13 @@ AmlGetRawNameSpacePath (
if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) ||
AML_IN_NAMESPACE
)) ||
!IS_STREAM (RawAbsPathBStream) ||
IS_END_OF_STREAM (RawAbsPathBStream) ||
!IS_STREAM_BACKWARD (RawAbsPathBStream) ||
(InputParent > MAX_UINT8)) {
(InputParent > MAX_UINT8))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -477,6 +484,7 @@ AmlGetRawNameSpacePath (
ASSERT (0);
return Status;
}
InputParent = 0;
} else {
// (SegCount <= InputParent)
@ -494,6 +502,7 @@ AmlGetRawNameSpacePath (
ASSERT (0);
return EFI_NOT_FOUND;
}
break;
}
@ -504,7 +513,8 @@ AmlGetRawNameSpacePath (
(CONST AML_NODE_HEADER **)&ParentNode
);
if (EFI_ERROR (Status) ||
(!IS_AML_NODE_VALID (ParentNode))) {
(!IS_AML_NODE_VALID (ParentNode)))
{
ASSERT (0);
return Status;
}
@ -557,7 +567,6 @@ AmlGetRawNameSpacePath (
break;
} // (InputParent != 0)
}
} // while
@ -598,7 +607,8 @@ AmlAddPrefix (
// The Stream contains concatenated NameSegs.
if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) ||
!IS_STREAM_BACKWARD (AmlPathBStream)) {
!IS_STREAM_BACKWARD (AmlPathBStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -693,7 +703,8 @@ AmlRemovePrefix (
if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) ||
!IS_STREAM_BACKWARD (AmlPathBStream)) {
!IS_STREAM_BACKWARD (AmlPathBStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -778,8 +789,10 @@ AmlGetAslPathName (
if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) ||
(BufferSize == NULL)) {
AML_IN_NAMESPACE
)) ||
(BufferSize == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -906,7 +919,8 @@ AmlDbgPrintNameSpaceCallback (
Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) {
(Context == NULL))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
@ -916,7 +930,9 @@ AmlDbgPrintNameSpaceCallback (
if (!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) {
AML_IN_NAMESPACE
))
{
// Skip this node and continue enumeration.
goto exit_handler;
}
@ -925,14 +941,16 @@ AmlDbgPrintNameSpaceCallback (
DEBUG ((DEBUG_INFO, "\\\n"));
} else if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) {
AML_IN_NAMESPACE
))
{
CurrNodePathFStream = (AML_STREAM *)Context;
// Check the Context's content.
if (!IS_STREAM (CurrNodePathFStream) ||
IS_END_OF_STREAM (CurrNodePathFStream) ||
!IS_STREAM_FORWARD (CurrNodePathFStream)) {
!IS_STREAM_FORWARD (CurrNodePathFStream))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
@ -954,7 +972,6 @@ AmlDbgPrintNameSpaceCallback (
}
DEBUG ((DEBUG_INFO, "%a\n", CurrNodePathBuffer));
} else {
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
@ -1083,7 +1100,8 @@ AmlEnumeratePathCallback (
Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) {
(Context == NULL))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
@ -1092,7 +1110,9 @@ AmlEnumeratePathCallback (
if (!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) {
AML_IN_NAMESPACE
))
{
goto exit_handler;
}
@ -1106,7 +1126,8 @@ AmlEnumeratePathCallback (
!IS_STREAM_BACKWARD (SearchPathBStream) ||
!IS_STREAM (CurrNodePathBStream) ||
IS_END_OF_STREAM (CurrNodePathBStream) ||
!IS_STREAM_BACKWARD (CurrNodePathBStream)) {
!IS_STREAM_BACKWARD (CurrNodePathBStream))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
@ -1154,7 +1175,9 @@ AmlEnumeratePathCallback (
(CompareMem (
AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream)) == 0)) {
AmlStreamGetIndex (SearchPathBStream)
) == 0))
{
Status1 = EFI_SUCCESS;
ContinueEnum = FALSE;
PathSearchContext->OutNode = Node;
@ -1226,11 +1249,13 @@ AmlBuildAbsoluteAmlPath (
if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)ReferenceNode,
AML_IN_NAMESPACE)) ||
AML_IN_NAMESPACE
)) ||
(AslPath == NULL) ||
!IS_STREAM (RawAmlAbsSearchPathBStream) ||
IS_END_OF_STREAM (RawAmlAbsSearchPathBStream) ||
!IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream)) {
!IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1373,9 +1398,11 @@ AmlFindNode (
if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)ReferenceNode,
AML_IN_NAMESPACE)) ||
AML_IN_NAMESPACE
)) ||
(AslPath == NULL) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -70,7 +70,8 @@ AmlParseFieldElement (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -98,7 +99,8 @@ AmlParseFieldElement (
// Parse the PkgLen if available.
PkgLenSize = 0;
if ((FieldByteEncoding->Attribute & AML_HAS_PKG_LENGTH) ==
AML_HAS_PKG_LENGTH) {
AML_HAS_PKG_LENGTH)
{
PkgLenOffset = AmlGetPkgLength (CurrPos, &PkgLenSize);
if (PkgLenOffset == 0) {
ASSERT (0);
@ -199,7 +201,8 @@ AmlParseNamedFieldElement (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -322,7 +325,8 @@ AmlParseFieldList (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -351,7 +355,8 @@ AmlParseFieldList (
// call AmlGetByteEncoding() to check that the encoding is NameChar.
NamedFieldByteEncoding = AmlGetByteEncoding (CurrPos);
if ((NamedFieldByteEncoding != NULL) &&
(NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR)) {
(NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR))
{
// This is a NamedField field element since it is starting with a char.
Status = AmlParseNamedFieldElement (
NamedFieldByteEncoding,

View File

@ -117,7 +117,8 @@ AmlCreateMethodRefNode (
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(RawAbsolutePath == NULL) ||
(RawAbsolutePathSize == 0) ||
(NameSpaceRefNodePtr == NULL)) {
(NameSpaceRefNodePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -231,7 +232,8 @@ AmlInitRawPathBStream (
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(RawPathNameBStream == NULL)) {
(RawPathNameBStream == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -322,7 +324,8 @@ AmlGetFirstNamedAncestorNode (
if ((!IS_AML_OBJECT_NODE (Node) &&
!IS_AML_ROOT_NODE (Node)) ||
(OutNamedNode == NULL)) {
(OutNamedNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -332,8 +335,10 @@ AmlGetFirstNamedAncestorNode (
while (!IS_AML_ROOT_NODE (Node) &&
!(AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE) &&
AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node) != NULL)) {
AML_IN_NAMESPACE
) &&
AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node) != NULL))
{
Status = AmlGetFirstAncestorNameSpaceNode (
Node,
(AML_NODE_HEADER **)&NameSpaceNode
@ -342,6 +347,7 @@ AmlGetFirstNamedAncestorNode (
ASSERT (0);
return Status;
}
// The NameSpaceNode may not have its name defined as yet. In this
// case get the next ancestor node.
Node = NameSpaceNode;
@ -402,7 +408,8 @@ AmlBuildRawMethodAbsolutePath (
!IS_STREAM_FORWARD (PathnameFStream) ||
!IS_STREAM (AbsolutePathBStream) ||
IS_END_OF_STREAM (AbsolutePathBStream) ||
!IS_STREAM_BACKWARD (AbsolutePathBStream)) {
!IS_STREAM_BACKWARD (AbsolutePathBStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -507,7 +514,8 @@ AmlCompareRawNameString (
!IS_STREAM_FORWARD (RawFStream1) ||
!IS_STREAM (RawFStream2) ||
IS_END_OF_STREAM (RawFStream2) ||
(CompareCount == NULL)) {
(CompareCount == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -543,8 +551,10 @@ AmlCompareRawNameString (
if (!AmlStreamCmp (
&RawFStream1Clone,
&RawFStream2Clone,
AML_NAME_SEG_SIZE)
) {
AML_NAME_SEG_SIZE
)
)
{
// NameSegs are different. Break.
break;
}
@ -554,6 +564,7 @@ AmlCompareRawNameString (
ASSERT (0);
return Status;
}
Status = AmlStreamProgress (&RawFStream2Clone, AML_NAME_SEG_SIZE);
if (EFI_ERROR (Status)) {
ASSERT (0);
@ -610,7 +621,8 @@ AmlResolveAliasMethod (
if (!AmlNodeCompareOpCode (AliasNode, AML_ALIAS_OP, 0) ||
(NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) {
(OutNameSpaceRefNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -743,7 +755,8 @@ AmlFindMethodDefinition (
((AmlStreamGetIndex (RawPathNameBStream) &
(AML_NAME_SEG_SIZE - 1)) != 0) ||
(NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) {
(OutNameSpaceRefNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -803,7 +816,9 @@ AmlFindMethodDefinition (
if (!AmlStreamCmp (
RawPathNameBStream,
&ProbedRawAbsoluteBStream,
AmlStreamGetMaxBufferSize (RawPathNameBStream))) {
AmlStreamGetMaxBufferSize (RawPathNameBStream)
))
{
NextLink = NextLink->ForwardLink;
continue;
}
@ -871,11 +886,13 @@ AmlFindMethodDefinition (
// didn't because it is out of scope.
// Thus, the best match is \AAAA.MET0.
if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) <
BestNameSpaceRefNode->RawAbsolutePathSize) {
BestNameSpaceRefNode->RawAbsolutePathSize)
{
BestScopeCount = ProbedScopeCount;
BestNameSpaceRefNode = ProbedNameSpaceRefNode;
} else if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) ==
BestNameSpaceRefNode->RawAbsolutePathSize) {
BestNameSpaceRefNode->RawAbsolutePathSize)
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -893,7 +910,10 @@ AmlFindMethodDefinition (
*OutNameSpaceRefNode = BestNameSpaceRefNode;
} else if (AmlNodeCompareOpCode (
BestNameSpaceRefNode->NodeRef,
AML_ALIAS_OP, 0)) {
AML_ALIAS_OP,
0
))
{
// The path matches an alias. Resolve the alias and check whether
// this is a method defintion.
Status = AmlResolveAliasMethod (
@ -966,7 +986,8 @@ AmlIsMethodInvocation (
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) {
(OutNameSpaceRefNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -974,7 +995,9 @@ AmlIsMethodInvocation (
// There cannot be a method invocation in a field list. Return.
if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) {
AML_HAS_FIELD_LIST
))
{
*OutNameSpaceRefNode = NULL;
return EFI_SUCCESS;
}
@ -1073,10 +1096,10 @@ AmlIsMethodInvocation (
NameSpaceRefNode->RawAbsolutePathSize
);
DEBUG ((DEBUG_VERBOSE, ".\n"));
} else {
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: No method definition found.\n"));
}
#endif // MDEPKG_NDEBUG
*OutNameSpaceRefNode = NameSpaceRefNode;
@ -1125,7 +1148,8 @@ AmlAddNameSpaceReference (
CONST AML_NODE_HEADER *ParentNode;
if (!AmlNodeHasAttribute (Node, AML_IN_NAMESPACE) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1166,7 +1190,8 @@ AmlAddNameSpaceReference (
NameIndex
);
if (!IS_AML_DATA_NODE (NameNode) ||
(NameNode->DataType != EAmlNodeDataTypeNameString)) {
(NameNode->DataType != EAmlNodeDataTypeNameString))
{
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto exit_handler;
@ -1292,7 +1317,8 @@ AmlCreateMethodInvocationNode (
!AmlIsMethodDefinitionNode (NameSpaceRefNode->NodeRef) ||
!IS_AML_DATA_NODE (MethodInvocationName) ||
(MethodInvocationName->DataType != EAmlNodeDataTypeNameString) ||
(MethodInvocationNodePtr == NULL)) {
(MethodInvocationNodePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1424,7 +1450,8 @@ AmlGetMethodInvocationArgCount (
if (!IS_AML_NODE_VALID (MethodInvocationNode) ||
(IsMethodInvocation == NULL) ||
(ArgCount == NULL)) {
(ArgCount == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1447,10 +1474,12 @@ AmlGetMethodInvocationArgCount (
if (!IS_AML_NODE_VALID (NumArgsNode) ||
(NumArgsNode->Buffer == NULL) ||
(NumArgsNode->DataType != EAmlNodeDataTypeUInt) ||
(NumArgsNode->Size != 1)) {
(NumArgsNode->Size != 1))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
*ArgCount = *NumArgsNode->Buffer;
*IsMethodInvocation = TRUE;

View File

@ -52,8 +52,8 @@ AmlDeleteNameSpaceRefList (
IN LIST_ENTRY *NameSpaceRefList
);
#if !defined (MDEPKG_NDEBUG)
/** Print the list of raw absolute paths of the NameSpace reference list.
@param [in] NameSpaceRefList List of NameSpace reference nodes.

View File

@ -148,7 +148,8 @@ AmlParseUIntX (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -234,7 +235,8 @@ AmlParseNameString (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -242,7 +244,8 @@ AmlParseNameString (
Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
ByteEncoding = AmlGetByteEncoding (Buffer);
if ((ByteEncoding == NULL) ||
((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0)) {
((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -250,7 +253,8 @@ AmlParseNameString (
// Parse the NameString.
Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &StrSize);
if ((EFI_ERROR (Status)) ||
(StrSize > AmlStreamGetFreeSpace (FStream))) {
(StrSize > AmlStreamGetFreeSpace (FStream)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -317,7 +321,8 @@ AmlParseString (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -332,6 +337,7 @@ AmlParseString (
ASSERT (0);
return Status;
}
StrSize++;
} while (Byte != '\0');
@ -394,7 +400,8 @@ AmlParseObject (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -424,6 +431,7 @@ AmlParseObject (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
return Status;
}
@ -434,6 +442,7 @@ AmlParseObject (
} else {
OpCodeSize = 1;
}
Status = AmlStreamProgress (FStream, OpCodeSize);
if (EFI_ERROR (Status)) {
ASSERT (0);
@ -533,7 +542,8 @@ AmlParseFieldPkgLen (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -627,7 +637,8 @@ AmlCheckAndParseMethodInvoc (
!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeNameString) ||
(NameSpaceRefList == NULL) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -720,7 +731,8 @@ AmlParseArgument (
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) ||
(OutNode == NULL)) {
(OutNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -749,12 +761,14 @@ AmlParseArgument (
DataNode = (AML_DATA_NODE *)*OutNode;
if (IS_AML_DATA_NODE (DataNode) &&
(DataNode->DataType == EAmlNodeDataTypeNameString) &&
(ExpectedFormat == EAmlObject)) {
(ExpectedFormat == EAmlObject))
{
Status = AmlCheckAndParseMethodInvoc (
ParentNode,
(AML_DATA_NODE *)*OutNode,
NameSpaceRefList,
&MethodInvocationNode);
&MethodInvocationNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@ -802,7 +816,8 @@ AmlParseByteList (
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) {
!IS_STREAM_FORWARD (FStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -897,7 +912,8 @@ AmlParseFixedArguments (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -907,7 +923,8 @@ AmlParseFixedArguments (
(AML_OBJECT_NODE *)ObjectNode
);
if ((ObjectNode->AmlByteEncoding != NULL) &&
(ObjectNode->AmlByteEncoding->Format != NULL)) {
(ObjectNode->AmlByteEncoding->Format != NULL))
{
Format = ObjectNode->AmlByteEncoding->Format;
} else {
ASSERT (0);
@ -917,7 +934,8 @@ AmlParseFixedArguments (
// Parse all the FixedArgs.
while ((TermIndex < MaxIndex) &&
!IS_END_OF_STREAM (FStream) &&
(Format[TermIndex] != EAmlNone)) {
(Format[TermIndex] != EAmlNone))
{
// Initialize a FixedArgStream to parse the current fixed argument.
Status = AmlStreamInitSubStream (FStream, &FixedArgFStream);
if (EFI_ERROR (Status)) {
@ -957,7 +975,8 @@ AmlParseFixedArguments (
// Parse the AML bytecode of the FixedArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (FixedArgNode) &&
!IS_END_OF_STREAM (&FixedArgFStream)) {
!IS_END_OF_STREAM (&FixedArgFStream))
{
Status = AmlParseStream (
FixedArgNode,
&FixedArgFStream,
@ -1032,7 +1051,8 @@ AmlParseVariableArguments (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1092,7 +1112,8 @@ AmlParseVariableArguments (
// Parse the AML bytecode of the VarArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (VarArgNode) &&
(!IS_END_OF_STREAM (&VarArgFStream))) {
(!IS_END_OF_STREAM (&VarArgFStream)))
{
Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList);
if (EFI_ERROR (Status)) {
ASSERT (0);
@ -1150,7 +1171,8 @@ AmlPopulateRootNode (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1195,7 +1217,8 @@ AmlPopulateObjectNode (
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) {
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1231,7 +1254,9 @@ AmlPopulateObjectNode (
// paths. Method invocation need to be parsed differently.
if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)ObjectNode,
AML_IN_NAMESPACE)) {
AML_IN_NAMESPACE
))
{
Status = AmlAddNameSpaceReference (
(CONST AML_OBJECT_NODE *)ObjectNode,
NameSpaceRefList
@ -1308,7 +1333,6 @@ AmlParseStream (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
} else if (IS_AML_OBJECT_NODE (Node)) {
Status = AmlPopulateObjectNode (
(AML_OBJECT_NODE *)Node,
@ -1318,7 +1342,6 @@ AmlParseStream (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
} else {
// Data node or other.
ASSERT (0);
@ -1361,7 +1384,8 @@ AmlParseDefinitionBlock (
UINT32 MaxBufferSize;
if ((DefinitionBlock == NULL) ||
(RootPtr == NULL)) {
(RootPtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -1371,6 +1395,7 @@ AmlParseDefinitionBlock (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
MaxBufferSize = DefinitionBlock->Length -
(UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);

View File

@ -43,7 +43,8 @@ AmlRdStreamGetRdSize (
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) {
!IS_STREAM_FORWARD (FStream))
{
ASSERT (0);
return 0;
}
@ -57,7 +58,8 @@ AmlRdStreamGetRdSize (
// If the resource data element is of the large type, check for overflow.
if (AML_RD_IS_LARGE (CurrRdElement) &&
(AmlStreamGetFreeSpace (FStream) <
sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
sizeof (ACPI_LARGE_RESOURCE_HEADER)))
{
return 0;
}
@ -94,7 +96,8 @@ AmlRdCheckFunctionDescNesting (
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
(InFunctionDesc == NULL)) {
(InFunctionDesc == NULL))
{
ASSERT (0);
return FALSE;
}
@ -110,7 +113,10 @@ AmlRdCheckFunctionDescNesting (
if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (
ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME))) {
ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME
)
))
{
*InFunctionDesc = TRUE;
return TRUE;
}
@ -119,7 +125,10 @@ AmlRdCheckFunctionDescNesting (
if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (
ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME))) {
ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME
)
))
{
if (*InFunctionDesc) {
*InFunctionDesc = FALSE;
return TRUE;
@ -167,7 +176,8 @@ AmlRdIsResourceDataBuffer (
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) {
!IS_STREAM_FORWARD (FStream))
{
ASSERT (0);
return FALSE;
}
@ -188,7 +198,9 @@ AmlRdIsResourceDataBuffer (
// The first element cannot be an end tag.
if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
return FALSE;
}
@ -199,7 +211,8 @@ AmlRdIsResourceDataBuffer (
CurrRdElementSize = AmlRdStreamGetRdSize (&SubStream);
if ((FreeSpace == 0) ||
(CurrRdElement == NULL) ||
(CurrRdElementSize == 0)) {
(CurrRdElementSize == 0))
{
return FALSE;
}
@ -218,7 +231,9 @@ AmlRdIsResourceDataBuffer (
// Thus the function should have already returned.
if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
return FALSE;
}
@ -266,7 +281,8 @@ AmlParseResourceData (
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) {
!IS_STREAM_FORWARD (FStream))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -315,11 +331,14 @@ AmlParseResourceData (
// Exit the loop when finding the resource data end tag.
if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
if (FreeSpace != CurrRdElementSize) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
break;
}
} // while

View File

@ -68,4 +68,3 @@ AmlParseResourceData (
);
#endif // AML_RESOURCE_DATA_PARSER_H_

View File

@ -126,7 +126,9 @@ AmlRdSetEndTagChecksum (
if ((Header == NULL) ||
!AmlRdCompareDescId (
Header,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -58,7 +58,8 @@ AmlSerializeNodeCallback (
EAML_PARSE_INDEX IndexPtr;
if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) {
(Context == NULL))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
@ -71,11 +72,13 @@ AmlSerializeNodeCallback (
ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)Node);
if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
AmlIsNodeFixedArgument (Node, &IndexPtr)) {
AmlIsNodeFixedArgument (Node, &IndexPtr))
{
if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) {
*Status = EFI_SUCCESS;
}
return TRUE;
}
}
@ -97,11 +100,12 @@ AmlSerializeNodeCallback (
ContinueEnum = FALSE;
goto error_handler;
}
} else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IS_PSEUDO_OPCODE)) {
AML_IS_PSEUDO_OPCODE
))
{
// Ignore pseudo-opcodes as they are not part of the
// ACPI specification.
@ -138,6 +142,7 @@ error_handler:
if (Status != NULL) {
*Status = Status1;
}
return ContinueEnum;
}
@ -179,7 +184,8 @@ AmlSerializeTree (
UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) ||
(BufferSize == NULL)) {
(BufferSize == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -276,7 +282,8 @@ AmlSerializeDefinitionBlock (
UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) ||
(Table == NULL)) {
(Table == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -33,7 +33,8 @@ AmlStreamInit (
(Buffer == NULL) ||
(MaxBufferSize == 0) ||
((Direction != EAmlStreamDirectionForward) &&
(Direction != EAmlStreamDirectionBackward))) {
(Direction != EAmlStreamDirectionBackward)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -65,7 +66,8 @@ AmlStreamClone (
)
{
if (!IS_STREAM (Stream) ||
(ClonedStream == NULL)) {
(ClonedStream == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -110,7 +112,8 @@ AmlStreamInitSubStream (
)
{
if (!IS_STREAM (Stream) ||
(SubStream == NULL)) {
(SubStream == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -148,6 +151,7 @@ AmlStreamGetBuffer (
ASSERT (0);
return NULL;
}
return Stream->Buffer;
}
@ -168,6 +172,7 @@ AmlStreamGetMaxBufferSize (
ASSERT (0);
return 0;
}
return Stream->MaxBufferSize;
}
@ -189,7 +194,8 @@ AmlStreamReduceMaxBufferSize (
{
if (!IS_STREAM (Stream) ||
(Diff == 0) ||
((Stream->MaxBufferSize - Diff) <= Stream->Index)) {
((Stream->MaxBufferSize - Diff) <= Stream->Index))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -221,6 +227,7 @@ AmlStreamGetIndex (
ASSERT (0);
return 0;
}
return Stream->Index;
}
@ -241,6 +248,7 @@ AmlStreamGetDirection (
ASSERT (0);
return EAmlStreamDirectionInvalid;
}
return Stream->Direction;
}
@ -320,7 +328,8 @@ AmlStreamProgress (
{
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(Offset == 0)) {
(Offset == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -355,7 +364,8 @@ AmlStreamRewind (
)
{
if (!IS_STREAM (Stream) ||
(Offset == 0)) {
(Offset == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -417,7 +427,8 @@ AmlStreamPeekByte (
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(OutByte == NULL)) {
(OutByte == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -456,7 +467,8 @@ AmlStreamReadByte (
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(OutByte == NULL)) {
(OutByte == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -508,7 +520,8 @@ AmlStreamWrite (
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(Buffer == NULL) ||
(Size == 0)) {
(Size == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -568,7 +581,8 @@ AmlStreamCmp (
!IS_STREAM (Stream2) ||
IS_END_OF_STREAM (Stream2) ||
(Stream1->Direction != Stream2->Direction) ||
(Size == 0)) {
(Size == 0))
{
ASSERT (0);
return FALSE;
}
@ -589,6 +603,7 @@ AmlStreamCmp (
ASSERT (0);
return FALSE;
}
CurrPosStream2 = AmlStreamGetCurrPos (Stream2);
if (CurrPosStream2 == NULL) {
ASSERT (0);
@ -645,7 +660,8 @@ AmlStreamCpyS (
if ((DstBuffer == NULL) ||
(MaxDstBufferSize == 0) ||
(Size > MaxDstBufferSize) ||
(Size > AmlStreamGetMaxBufferSize (Stream))) {
(Size > AmlStreamGetMaxBufferSize (Stream)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -39,9 +39,11 @@ AmlIsNameString (
(ParentPrefix <= MAX_UINT8) &&
(!((ParentPrefix != 0) && (Root != 0))) &&
(SegCount <= MAX_UINT8) &&
((SegCount + Root + ParentPrefix) != 0)) {
((SegCount + Root + ParentPrefix) != 0))
{
return TRUE;
}
return FALSE;
}
@ -70,7 +72,8 @@ AmlUpperCaseMemCpyS (
UINT32 Index;
if ((DstBuffer == NULL) ||
(SrcBuffer == NULL)) {
(SrcBuffer == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -142,7 +145,7 @@ AmlIsLeadNameChar (
IN CHAR8 Ch
)
{
if ((Ch == '_') || (Ch >= 'A' && Ch <= 'Z') || (Ch >= 'a' && Ch <= 'z')) {
if ((Ch == '_') || ((Ch >= 'A') && (Ch <= 'Z')) || ((Ch >= 'a') && (Ch <= 'z'))) {
return TRUE;
} else {
return FALSE;
@ -174,7 +177,7 @@ AmlIsNameChar (
IN CHAR8 Ch
)
{
if (AmlIsLeadNameChar (Ch) || (Ch >= '0' && Ch <= '9')) {
if (AmlIsLeadNameChar (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@ -202,7 +205,8 @@ AslIsNameSeg (
UINT32 Index;
if ((AslBuffer == NULL) ||
(Size == NULL)) {
(Size == NULL))
{
return FALSE;
}
@ -212,7 +216,8 @@ AslIsNameSeg (
for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
if ((AslBuffer[Index] == '.') ||
(AslBuffer[Index] == '\0')) {
(AslBuffer[Index] == '\0'))
{
*Size = Index;
return TRUE;
} else if (!AmlIsNameChar (AslBuffer[Index])) {
@ -290,7 +295,8 @@ AslParseNameStringInfo (
if ((Buffer == NULL) ||
(Root == NULL) ||
(ParentPrefix == NULL) ||
(SegCount == NULL)) {
(SegCount == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -372,7 +378,8 @@ AmlParseNameStringInfo (
if ((Buffer == NULL) ||
(Root == NULL) ||
(ParentPrefix == NULL) ||
(SegCount == NULL)) {
(SegCount == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -512,7 +519,8 @@ AslGetNameStringSize (
)
{
if ((AslPath == NULL) ||
(AslPathSizePtr == NULL)) {
(AslPathSizePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -548,7 +556,8 @@ AmlGetNameStringSize (
UINT32 SegCount;
if ((AmlPath == NULL) ||
(AmlPathSizePtr == NULL)) {
(AmlPathSizePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -604,7 +613,8 @@ ConvertAslNameToAmlName (
CHAR8 *AmlPath;
if ((AslPath == NULL) ||
(OutAmlPath == NULL)) {
(OutAmlPath == NULL))
{
return EFI_INVALID_PARAMETER;
}
@ -709,7 +719,6 @@ ConvertAslNameToAmlName (
}
}
} // while
} else {
// (SegCount == 0)
// '\0' needs to end the AML NameString/path.
@ -721,7 +730,8 @@ ConvertAslNameToAmlName (
// Check that AmlPath has been filled with TotalSize bytes.
if ((SegCount != 0) ||
(*AslBuffer != AML_ZERO_OP) ||
(((UINT32)(AmlBuffer - AmlPath)) != TotalSize)) {
(((UINT32)(AmlBuffer - AmlPath)) != TotalSize))
{
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
@ -765,7 +775,8 @@ ConvertAmlNameToAslName (
CHAR8 *AslPath;
if ((AmlPath == NULL) ||
(OutAslPath == NULL)) {
(OutAslPath == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -869,7 +880,8 @@ AslCompareNameString (
UINT32 AslName2Len;
if ((AslName1 == NULL) ||
(AslName2 == NULL)) {
(AslName2 == NULL))
{
ASSERT (0);
return FALSE;
}
@ -914,7 +926,8 @@ AmlCompareNameString (
UINT32 AmlName2Len;
if ((AmlName1 == NULL) ||
(AmlName2 == NULL)) {
(AmlName2 == NULL))
{
ASSERT (0);
return FALSE;
}
@ -966,7 +979,8 @@ CompareAmlWithAslNameString (
BOOLEAN RetVal;
if ((AmlName1 == NULL) ||
(AslName2 == NULL)) {
(AslName2 == NULL))
{
ASSERT (0);
return FALSE;
}
@ -986,6 +1000,7 @@ CompareAmlWithAslNameString (
return RetVal;
}
/** Given an AmlPath, return the address of the first NameSeg.
It is possible to determine the size of an AML NameString/path just

View File

@ -38,7 +38,8 @@ AmlCloneNode (
AML_ROOT_NODE *RootNode;
if (!IS_AML_NODE_VALID (Node) ||
(ClonedNode == NULL)) {
(ClonedNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -116,7 +117,8 @@ AmlCloneTree (
LIST_ENTRY *CurrentLink;
if (!IS_AML_NODE_VALID (Node) ||
(ClonedNode == NULL)) {
(ClonedNode == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -98,7 +98,8 @@ AmlCreateRootNode (
AML_ROOT_NODE *RootNode;
if ((SdtHeader == NULL) ||
(NewRootNodePtr == NULL)) {
(NewRootNodePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -187,7 +188,8 @@ AmlCreateObjectNode (
AML_OBJECT_NODE *ObjectNode;
if ((AmlByteEncoding == NULL) ||
(NewObjectNodePtr == NULL)) {
(NewObjectNodePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -289,7 +291,8 @@ AmlCreateDataNode (
(DataType == EAmlNodeDataTypeReserved5) ||
(Data == NULL) ||
(DataSize == 0) ||
(NewDataNodePtr == NULL)) {
(NewDataNodePtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -344,7 +347,8 @@ AmlDeleteNode (
// When removing the node, its parent and list are reset
// with InitializeListHead. Thus it must be empty.
if (!IS_AML_NODE_VALID (Node) ||
!AML_NODE_IS_DETACHED (Node)) {
!AML_NODE_IS_DETACHED (Node))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -362,6 +366,7 @@ AmlDeleteNode (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
break;
}
@ -385,6 +390,7 @@ AmlDeleteNode (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
break;
}
@ -394,6 +400,7 @@ AmlDeleteNode (
if (EFI_ERROR (Status)) {
ASSERT (0);
}
break;
}
@ -426,7 +433,8 @@ AmlNodeHasAttribute (
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(ObjectNode->AmlByteEncoding == NULL)) {
(ObjectNode->AmlByteEncoding == NULL))
{
return FALSE;
}
@ -453,7 +461,8 @@ AmlNodeCompareOpCode (
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(ObjectNode->AmlByteEncoding == NULL)) {
(ObjectNode->AmlByteEncoding == NULL))
{
return FALSE;
}
@ -486,7 +495,8 @@ IsIntegerNode (
UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) ||
(Node->AmlByteEncoding == NULL)) {
(Node->AmlByteEncoding == NULL))
{
return FALSE;
}
@ -495,7 +505,8 @@ IsIntegerNode (
if ((OpCode != AML_BYTE_PREFIX) &&
(OpCode != AML_WORD_PREFIX) &&
(OpCode != AML_DWORD_PREFIX) &&
(OpCode != AML_QWORD_PREFIX)) {
(OpCode != AML_QWORD_PREFIX))
{
return FALSE;
}
@ -521,7 +532,8 @@ IsSpecialIntegerNode (
UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) ||
(Node->AmlByteEncoding == NULL)) {
(Node->AmlByteEncoding == NULL))
{
return FALSE;
}
@ -529,7 +541,8 @@ IsSpecialIntegerNode (
if ((OpCode != AML_ZERO_OP) &&
(OpCode != AML_ONE_OP) &&
(OpCode != AML_ONES_OP)) {
(OpCode != AML_ONES_OP))
{
return FALSE;
}
@ -575,7 +588,8 @@ AmlIsMethodDefinitionNode (
);
if (IS_AML_DATA_NODE (ObjectType) &&
(ObjectType->DataType == EAmlNodeDataTypeUInt) &&
((ObjectType->Size == 1))) {
((ObjectType->Size == 1)))
{
if (*((UINT8 *)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
// The external definition is a method.
return TRUE;
@ -613,7 +627,8 @@ AmlNodeGetNameIndex (
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(ObjectNode->AmlByteEncoding == NULL) ||
(Index == NULL)) {
(Index == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -621,7 +636,8 @@ AmlNodeGetNameIndex (
NameIndex = ObjectNode->AmlByteEncoding->NameIndex;
if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex) ||
(ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName)) {
(ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -667,7 +683,8 @@ AmlNodeGetName (
// The name is stored in a Data node.
DataNode = (AML_DATA_NODE *)ObjectNode->FixedArgs[NameIndex];
if (IS_AML_DATA_NODE (DataNode) &&
(DataNode->DataType == EAmlNodeDataTypeNameString)) {
(DataNode->DataType == EAmlNodeDataTypeNameString))
{
return (CHAR8 *)DataNode->Buffer;
}

View File

@ -53,7 +53,8 @@ AmlGetRootNodeInfo (
)
{
if (!IS_AML_ROOT_NODE (RootNode) ||
(SdtHeaderBuffer == NULL)) {
(SdtHeaderBuffer == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -109,12 +110,15 @@ AmlGetObjectNodeInfo (
if (OpCode != NULL) {
*OpCode = ObjectNode->AmlByteEncoding->OpCode;
}
if (SubOpCode != NULL) {
*SubOpCode = ObjectNode->AmlByteEncoding->SubOpCode;
}
if (PkgLen != NULL) {
*PkgLen = ObjectNode->PkgLen;
}
if (IsNameSpaceNode != NULL) {
*IsNameSpaceNode = AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE);
}
@ -135,7 +139,8 @@ AmlGetFixedArgumentCount (
)
{
if (IS_AML_OBJECT_NODE (Node) &&
(Node->AmlByteEncoding != NULL)) {
(Node->AmlByteEncoding != NULL))
{
return (UINT8)Node->AmlByteEncoding->MaxIndex;
}
@ -159,7 +164,8 @@ AmlGetNodeDataType (
)
{
if (!IS_AML_DATA_NODE (DataNode) ||
(DataType == NULL)) {
(DataType == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -193,7 +199,8 @@ AmlGetResourceDataType (
{
if (!IS_AML_DATA_NODE (DataNode) ||
(ResourceDataType == NULL) ||
(DataNode->DataType != EAmlNodeDataTypeResourceData)) {
(DataNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -233,13 +240,15 @@ AmlGetDataNodeBuffer (
)
{
if (!IS_AML_DATA_NODE (DataNode) ||
(BufferSize == NULL)) {
(BufferSize == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
if ((*BufferSize >= DataNode->Size) &&
(Buffer != NULL)) {
(Buffer != NULL))
{
CopyMem (Buffer, DataNode->Buffer, DataNode->Size);
}
@ -275,7 +284,8 @@ AmlUpdateRootNode (
((SdtHeader->Signature !=
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) &&
(SdtHeader->Signature !=
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))) {
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -334,7 +344,8 @@ AmlUpdateInteger (
if (!IS_AML_OBJECT_NODE (IntegerOpNode) ||
(!IsIntegerNode (IntegerOpNode) &&
!IsSpecialIntegerNode (IntegerOpNode)) ||
AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0)) {
AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -396,7 +407,8 @@ AmlUpdateDataNode (
if (!IS_AML_DATA_NODE (DataNode) ||
(DataType > EAmlNodeDataTypeMax) ||
(Buffer == NULL) ||
(Size == 0)) {
(Size == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -419,7 +431,8 @@ AmlUpdateDataNode (
(((ExpectedArgType != EAmlNodeDataTypeRaw) &&
(ExpectedArgType != EAmlNodeDataTypeResourceData)) ||
((DataType != EAmlNodeDataTypeRaw) &&
(DataType != EAmlNodeDataTypeResourceData)))) {
(DataType != EAmlNodeDataTypeResourceData))))
{
ASSERT (0);
return EFI_UNSUPPORTED;
}
@ -432,10 +445,12 @@ AmlUpdateDataNode (
// with the right size.
Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &ExpectedSize);
if (EFI_ERROR (Status) ||
(Size != ExpectedSize)) {
(Size != ExpectedSize))
{
ASSERT (0);
return Status;
}
break;
}
case EAmlNodeDataTypeString:
@ -450,6 +465,7 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ExpectedSize++;
}
@ -457,13 +473,15 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
break;
}
case EAmlNodeDataTypeUInt:
{
if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER *)DataNode, &Index)) {
if ((ParentNode->AmlByteEncoding == NULL) ||
(ParentNode->AmlByteEncoding->Format == NULL)) {
(ParentNode->AmlByteEncoding->Format == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -472,11 +490,13 @@ AmlUpdateDataNode (
// E.g. for PackageOp the first fixed argument is of type EAmlUInt8
// and represents the count of elements. This type cannot be changed.
if ((ParentNode->AmlByteEncoding->Format[Index] != EAmlObject) &&
(DataNode->Size != Size)) {
(DataNode->Size != Size))
{
ASSERT (0);
return EFI_UNSUPPORTED;
}
}
break;
}
case EAmlNodeDataTypeRaw:
@ -486,6 +506,7 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
break;
}
case EAmlNodeDataTypeResourceData:
@ -495,7 +516,8 @@ AmlUpdateDataNode (
// Large resource data must be at least as long as the header
// of a large resource data.
if (AML_RD_IS_LARGE (Buffer) &&
(Size < sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
(Size < sizeof (ACPI_LARGE_RESOURCE_HEADER)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -529,6 +551,7 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
break;
}
// None and reserved types.
@ -564,6 +587,7 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
}
DataNode->Size = Size;
}

View File

@ -27,7 +27,8 @@ AmlGetParent (
)
{
if (IS_AML_DATA_NODE (Node) ||
IS_AML_OBJECT_NODE (Node)) {
IS_AML_OBJECT_NODE (Node))
{
return Node->Parent;
}
@ -60,6 +61,7 @@ AmlGetRootNode (
return NULL;
}
}
return (AML_ROOT_NODE *)Node;
}
@ -117,7 +119,8 @@ AmlIsNodeFixedArgument (
if ((IndexPtr == NULL) ||
(!IS_AML_DATA_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node))) {
!IS_AML_OBJECT_NODE (Node)))
{
ASSERT (0);
return FALSE;
}
@ -172,7 +175,8 @@ AmlSetFixedArgument (
(Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) &&
((NewNode == NULL) ||
IS_AML_OBJECT_NODE (NewNode) ||
IS_AML_DATA_NODE (NewNode))) {
IS_AML_DATA_NODE (NewNode)))
{
ObjectNode->FixedArgs[Index] = NewNode;
// If NewNode is a data node or an object node, set its parent.
@ -207,6 +211,7 @@ AmlNodeGetVariableArgList (
} else if (IS_AML_OBJECT_NODE (Node)) {
return &(((AML_OBJECT_NODE *)Node)->VariableArgs);
}
return NULL;
}
@ -234,14 +239,16 @@ AmlRemoveNodeFromVarArgList (
UINT32 Size;
if ((!IS_AML_DATA_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node))) {
!IS_AML_OBJECT_NODE (Node)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) {
!IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -249,7 +256,9 @@ AmlRemoveNodeFromVarArgList (
// Check the node is in its parent variable list of arguments.
if (!IsNodeInList (
AmlNodeGetVariableArgList (ParentNode),
&Node->Link)) {
&Node->Link
))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -322,7 +331,8 @@ AmlVarListAddHead (
!IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -379,7 +389,8 @@ AmlVarListAddTailInternal (
!IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -462,14 +473,16 @@ AmlVarListAddBefore (
// Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) {
!IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -516,14 +529,16 @@ AmlVarListAddAfter (
// Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) {
!IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -570,7 +585,8 @@ AmlAppendRdNode (
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) ||
!IS_AML_DATA_NODE (NewRdNode) ||
(NewRdNode->DataType != EAmlNodeDataTypeResourceData)) {
(NewRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -596,7 +612,8 @@ AmlAppendRdNode (
);
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
(LastRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -604,7 +621,8 @@ AmlAppendRdNode (
// Add NewRdNode before the EndTag.
Status = AmlVarListAddBefore (
(AML_NODE_HEADER *)LastRdNode,
(AML_NODE_HEADER*)NewRdNode)
(AML_NODE_HEADER *)NewRdNode
)
;
ASSERT_EFI_ERROR (Status);
return Status;
@ -644,7 +662,8 @@ AmlReplaceFixedArgument (
if (!IS_AML_OBJECT_NODE (ParentNode) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -658,10 +677,13 @@ AmlReplaceFixedArgument (
// AML_IS_FIELD_ELEMENT flag.
if (!AmlNodeHasAttribute (
(AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) {
AML_HAS_FIELD_LIST
))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Fall through.
}
@ -677,10 +699,12 @@ AmlReplaceFixedArgument (
// Note: This condition might be too strict, but safer.
if (!IS_AML_DATA_NODE (NewNode) ||
(((AML_DATA_NODE *)NewNode)->DataType !=
AmlTypeToNodeDataType (FixedArgType))) {
AmlTypeToNodeDataType (FixedArgType)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
break;
}
@ -781,14 +805,16 @@ AmlReplaceVariableArgument (
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode) ||
AML_NODE_IS_DETACHED (OldNode) ||
AmlIsNodeFixedArgument (OldNode, &Index)) {
AmlIsNodeFixedArgument (OldNode, &Index))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (OldNode);
if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) {
!IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -804,7 +830,8 @@ AmlReplaceVariableArgument (
if (AmlNodeHasAttribute ((AML_OBJECT_NODE *)ParentNode, AML_HAS_BYTE_LIST)) {
if (!IS_AML_DATA_NODE (NewNode) ||
((NewDataNode->DataType != EAmlNodeDataTypeRaw) &&
(NewDataNode->DataType != EAmlNodeDataTypeResourceData))) {
(NewDataNode->DataType != EAmlNodeDataTypeResourceData)))
{
// A child node of a node with the BYTE_LIST flag must be a data node,
// containing raw data or a resource data.
ASSERT (0);
@ -812,10 +839,14 @@ AmlReplaceVariableArgument (
}
} else if (AmlNodeHasAttribute (
(AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) {
AML_HAS_FIELD_LIST
))
{
if (!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)NewNode,
AML_IS_FIELD_ELEMENT)) {
AML_IS_FIELD_ELEMENT
))
{
// A child node of a node with the FIELD_LIST flag must be an object
// node with AML_IS_FIELD_ELEMENT flag.
ASSERT (0);
@ -895,7 +926,8 @@ AmlReplaceArgument (
!IS_AML_OBJECT_NODE (OldNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) {
!AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -903,7 +935,8 @@ AmlReplaceArgument (
// ParentNode can be a root node or an object node.
ParentNode = AmlGetParent (OldNode);
if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) {
!IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -961,7 +994,8 @@ AmlDeleteTree (
// InitializeListHead. Thus it must be detached
// from the tree to avoid memory leaks.
if (!IS_AML_NODE_VALID (Node) ||
!AML_NODE_IS_DETACHED (Node)) {
!AML_NODE_IS_DETACHED (Node))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -124,4 +124,3 @@ AmlReplaceArgument (
);
#endif // AML_TREE_H_

View File

@ -52,6 +52,7 @@ AmlEnumTree (
if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER;
}
return FALSE;
}
@ -90,6 +91,7 @@ AmlEnumTree (
if (ContinueEnum == FALSE) {
return ContinueEnum;
}
CurrentLink = CurrentLink->ForwardLink;
} // while
}

View File

@ -62,7 +62,8 @@ AmlIteratorGetNode (
(InternalIterator->Mode >= EAmlIteratorModeMax) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
((InternalIterator->CurrentNode != NULL) &&
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))) {
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -99,7 +100,8 @@ AmlIteratorGetNextLinear (
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -112,6 +114,7 @@ AmlIteratorGetNextLinear (
if (NextNode != NULL) {
*NextNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
}
return EFI_SUCCESS;
}
@ -142,7 +145,8 @@ AmlIteratorGetPreviousLinear (
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -154,6 +158,7 @@ AmlIteratorGetPreviousLinear (
if (PrevNode != NULL) {
*PrevNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
}
return EFI_SUCCESS;
}
@ -185,7 +190,8 @@ AmlIteratorGetNextBranch (
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -193,7 +199,8 @@ AmlIteratorGetNextBranch (
Node = AmlGetNextNode (InternalIterator->CurrentNode);
// Check whether NextNode is a sibling of InitialNode.
if (AmlGetParent (Node) ==
AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
{
Node = NULL;
}
@ -202,6 +209,7 @@ AmlIteratorGetNextBranch (
if (NextNode != NULL) {
*NextNode = Node;
}
return EFI_SUCCESS;
}
@ -233,7 +241,8 @@ AmlIteratorGetPreviousBranch (
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -241,7 +250,8 @@ AmlIteratorGetPreviousBranch (
Node = AmlGetPreviousNode (InternalIterator->CurrentNode);
// Check whether PreviousNode is a sibling of InitialNode.
if (AmlGetParent (Node) ==
AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
{
Node = NULL;
}
@ -250,6 +260,7 @@ AmlIteratorGetPreviousBranch (
if (PrevNode != NULL) {
*PrevNode = Node;
}
return EFI_SUCCESS;
}
@ -279,7 +290,8 @@ AmlInitializeIterator (
if (!IS_AML_NODE_VALID (Node) ||
(IteratorMode <= EAmlIteratorUnknown) ||
(IteratorMode >= EAmlIteratorModeMax) ||
(IteratorPtr == NULL)) {
(IteratorPtr == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}

View File

@ -175,7 +175,6 @@ typedef struct AmlTreeIterator {
EDKII_AML_TREE_ITERATOR_GET_PREVIOUS GetPrevious;
} AML_TREE_ITERATOR;
/** Initialize an iterator.
Note: The caller must call AmlDeleteIterator () to free the memory

View File

@ -47,7 +47,8 @@ AmlGetSiblingVariableArgument (
// and be in a variable list of arguments.
if ((!IS_AML_OBJECT_NODE (VarArgNode) &&
!IS_AML_DATA_NODE (VarArgNode)) ||
AmlIsNodeFixedArgument (VarArgNode, &Index)) {
AmlIsNodeFixedArgument (VarArgNode, &Index))
{
ASSERT (0);
return NULL;
}
@ -98,7 +99,8 @@ AmlGetNextVariableArgument (
!IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) &&
!IS_AML_DATA_NODE (CurrVarArg)))) {
!IS_AML_DATA_NODE (CurrVarArg))))
{
ASSERT (0);
return NULL;
}
@ -114,6 +116,7 @@ AmlGetNextVariableArgument (
if (NextLink != StartLink) {
return (AML_NODE_HEADER *)NextLink;
}
// List is empty.
return NULL;
}
@ -172,7 +175,8 @@ AmlGetPreviousVariableArgument (
!IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) &&
!IS_AML_DATA_NODE (CurrVarArg)))) {
!IS_AML_DATA_NODE (CurrVarArg))))
{
ASSERT (0);
return NULL;
}
@ -188,6 +192,7 @@ AmlGetPreviousVariableArgument (
if (PreviousLink != StartLink) {
return (AML_NODE_HEADER *)PreviousLink;
}
// List is empty.
return NULL;
}
@ -253,7 +258,8 @@ AmlGetNextSibling (
!IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) &&
!IS_AML_DATA_NODE (ChildNode)))) {
!IS_AML_DATA_NODE (ChildNode))))
{
ASSERT (0);
return NULL;
}
@ -275,8 +281,10 @@ AmlGetNextSibling (
Index++;
// The node is part of the list of fixed arguments.
if (Index == (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)Node)
) {
(AML_OBJECT_NODE *)Node
)
)
{
// It is at the last argument of the fixed argument list.
// Get the first argument of the variable list of arguments.
ChildNode = NULL;
@ -340,7 +348,8 @@ AmlGetPreviousSibling (
!IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) &&
!IS_AML_DATA_NODE (ChildNode)))) {
!IS_AML_DATA_NODE (ChildNode))))
{
ASSERT (0);
return NULL;
}
@ -353,7 +362,8 @@ AmlGetPreviousSibling (
// Otherwise the fixed argument list is checked first.
if ((ChildNode != NULL) &&
IS_AML_OBJECT_NODE (Node) &&
(MaxIndex != EAmlParseIndexTerm0)) {
(MaxIndex != EAmlParseIndexTerm0))
{
if (AmlIsNodeFixedArgument (ChildNode, &Index)) {
// The node is part of the list of fixed arguments.
if (Index == EAmlParseIndexTerm0) {
@ -379,6 +389,7 @@ AmlGetPreviousSibling (
ASSERT (0);
return NULL;
}
// A Node has been found
return CandidateNode;
} else if (MaxIndex != EAmlParseIndexTerm0) {
@ -435,6 +446,7 @@ AmlGetNextNode (
ASSERT (0);
return NULL;
}
// A Node has been found
return CandidateNode;
} else if (IS_AML_ROOT_NODE (Node)) {
@ -464,6 +476,7 @@ AmlGetNextNode (
ASSERT (0);
return NULL;
}
// A Node has been found
return CandidateNode;
}
@ -511,7 +524,6 @@ AmlGetPreviousNode (
}
while (1) {
if (IS_AML_ROOT_NODE (Node)) {
// This is the root node.
return NULL;
@ -539,7 +551,6 @@ AmlGetPreviousNode (
return CandidateNode;
}
} // while
} else {
ASSERT (0);
return NULL;

View File

@ -135,4 +135,3 @@ AmlGetPreviousNode (
);
#endif // AML_TREE_TRAVERSAL_H_

View File

@ -86,11 +86,13 @@ AmlComputeSizeCallback (
CONST AML_OBJECT_NODE *ParentNode;
if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) {
(Context == NULL))
{
ASSERT (0);
if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER;
}
return FALSE;
}
@ -100,11 +102,13 @@ AmlComputeSizeCallback (
ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent (Node);
if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
AmlIsNodeFixedArgument (Node, &IndexPtr)) {
AmlIsNodeFixedArgument (Node, &IndexPtr))
{
if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) {
*Status = EFI_SUCCESS;
}
return TRUE;
}
}
@ -116,7 +120,9 @@ AmlComputeSizeCallback (
} else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE *)Node,
AML_IS_PSEUDO_OPCODE)) {
AML_IS_PSEUDO_OPCODE
))
{
// Ignore pseudo-opcodes as they are not part of the
// ACPI specification.
@ -126,7 +132,9 @@ AmlComputeSizeCallback (
// Add the size of the PkgLen.
if (AmlNodeHasAttribute (
(AML_OBJECT_NODE *)Node,
AML_HAS_PKG_LENGTH)) {
AML_HAS_PKG_LENGTH
))
{
Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE *)Node)->PkgLen);
}
}
@ -166,7 +174,8 @@ AmlComputeSize (
EFI_STATUS Status;
if (!IS_AML_NODE_VALID (Node) ||
(Size == NULL)) {
(Size == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -203,7 +212,8 @@ AmlNodeGetIntegerValue (
if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) ||
(Value == NULL)) {
(Value == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -219,13 +229,15 @@ AmlNodeGetIntegerValue (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
// For integer nodes, the value is in the first fixed argument.
DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeUInt)) {
(DataNode->DataType != EAmlNodeDataTypeUInt))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -373,7 +385,8 @@ AmlNodeSetIntegerValue (
if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) ||
(ValueWidthDiff == NULL)) {
(ValueWidthDiff == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -396,6 +409,7 @@ AmlNodeSetIntegerValue (
ASSERT (0);
return Status;
}
// The AmlUnwindSpecialInteger functions converts a special integer
// node to a UInt8/Byte data node. Thus, the size increments by one:
// special integer are encoded as one byte (the opcode only) while byte
@ -408,7 +422,8 @@ AmlNodeSetIntegerValue (
// For integer nodes, the value is in the first fixed argument.
DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeUInt)) {
(DataNode->DataType != EAmlNodeDataTypeUInt))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -473,6 +488,7 @@ AmlNodeSetIntegerValue (
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
}
DataNode->Size = NumberOfBytes;
}
@ -528,7 +544,8 @@ AmlNodeUpdateIntegerValue (
// Check for UINT64 over/underflow.
if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) ||
(!IsIncrement && (Value < Diff))) {
(!IsIncrement && (Value < Diff)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -586,7 +603,8 @@ AmlPropagateSize (
INT8 FieldWidthChange;
if (!IS_AML_OBJECT_NODE (Node) &&
!IS_AML_ROOT_NODE (Node)) {
!IS_AML_ROOT_NODE (Node))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -624,7 +642,8 @@ AmlPropagateSize (
if ((IsIncrement &&
(FieldWidthChange < 0)) ||
(!IsIncrement &&
(FieldWidthChange > 0))) {
(FieldWidthChange > 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -653,7 +672,8 @@ AmlPropagateSize (
// PkgLen is a 28 bit value, cf 20.2.4 Package Length Encoding
// i.e. the maximum value is (2^28 - 1) = ((BIT0 << 28) - 1).
if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff)) ||
(!IsIncrement && (Value < *Diff))) {
(!IsIncrement && (Value < *Diff)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -682,7 +702,8 @@ AmlPropagateSize (
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Value);
if (ReComputedPkgLenWidth != NewPkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4)) {
(ReComputedPkgLenWidth < 4))
{
// No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one.
Value += 1;
@ -715,14 +736,14 @@ AmlPropagateSize (
return Status;
}
}
} else if (IS_AML_ROOT_NODE (Node)) {
// Update the length field in the SDT header.
Value = ((AML_ROOT_NODE *)Node)->SdtHeader->Length;
// Check for an over/underflows.
if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) ||
(!IsIncrement && (Value < *Diff))) {
(!IsIncrement && (Value < *Diff)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -776,7 +797,8 @@ AmlPropagateNodeCount (
// Currently there is no use case where (NodeCount > 1).
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(FieldWidthChange == NULL) ||
(NodeCount > 1)) {
(NodeCount > 1))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -799,7 +821,8 @@ AmlPropagateNodeCount (
// Check for over/underflow.
CurrNodeCount = *(((AML_DATA_NODE *)NodeCountArg)->Buffer);
if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) ||
(!IsIncrement && (CurrNodeCount == 0))) {
(!IsIncrement && (CurrNodeCount == 0)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -857,7 +880,8 @@ AmlPropagateInformation (
// Currently there is no use case where (NodeCount > 1).
if ((!IS_AML_ROOT_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node)) ||
(NodeCount > 1)) {
(NodeCount > 1))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -865,7 +889,8 @@ AmlPropagateInformation (
// Propagate the node count first as it may change the number of bytes
// needed to store the node count, and then impact FieldWidthChange.
if ((NodeCount != 0) &&
IS_AML_OBJECT_NODE (Node)) {
IS_AML_OBJECT_NODE (Node))
{
Status = AmlPropagateNodeCount (
(AML_OBJECT_NODE *)Node,
IsIncrement,
@ -885,10 +910,12 @@ AmlPropagateInformation (
((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) ||
(!IsIncrement &&
((FieldWidthChange > 0) ||
(Diff < (UINT32)ABS (FieldWidthChange))))) {
(Diff < (UINT32)ABS (FieldWidthChange)))))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Diff = (UINT32)(Diff + (UINT8)ABS (FieldWidthChange));
}
@ -953,7 +980,8 @@ AmlSetRdListCheckSum (
);
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
(LastRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -969,7 +997,9 @@ AmlSetRdListCheckSum (
// no EndTag. Return EFI_NOT_FOUND is such case.
if (!AmlRdCompareDescId (
&RdDataType,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
))
{
ASSERT (0);
return EFI_NOT_FOUND;
}

View File

@ -140,4 +140,3 @@ AmlSetRdListCheckSum (
);
#endif // AML_UTILITY_H_

View File

@ -55,7 +55,8 @@ ValidateSerialPortInfo (
CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
if ((SerialPortInfoTable == NULL) ||
(SerialPortCount == 0)) {
(SerialPortCount == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -65,7 +66,8 @@ ValidateSerialPortInfo (
ASSERT (SerialPortInfo != NULL);
if ((SerialPortInfo == NULL) ||
(SerialPortInfo->BaseAddress == 0)) {
(SerialPortInfo->BaseAddress == 0))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: UART port base address is invalid. BaseAddress = 0x%llx\n",
@ -83,7 +85,8 @@ ValidateSerialPortInfo (
(SerialPortInfo->PortSubtype !=
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC) &&
(SerialPortInfo->PortSubtype !=
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550)) {
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: UART port subtype is invalid."
@ -97,7 +100,8 @@ ValidateSerialPortInfo (
DEBUG ((DEBUG_INFO, "UART Configuration:\n"));
DEBUG ((
DEBUG_INFO,
" UART Base = 0x%llx\n", SerialPortInfo->BaseAddress
" UART Base = 0x%llx\n",
SerialPortInfo->BaseAddress
));
DEBUG ((
DEBUG_INFO,
@ -157,6 +161,7 @@ FixupIds (
HidString = "PNP0501";
CidString = "PNP0500";
}
break;
}
case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:

View File

@ -566,7 +566,8 @@ PrintCmObjDesc (
if ((Data == NULL) ||
(Parser == NULL) ||
(ItemCount == 0) ||
(RemainingSize == NULL)) {
(RemainingSize == NULL))
{
ASSERT (0);
return;
}
@ -640,6 +641,7 @@ PrintCmObjDesc (
Parser[Index].Length
));
}
DEBUG ((DEBUG_ERROR, "\n"));
Data = (UINT8 *)Data + Parser[Index].Length;
} // for
@ -675,6 +677,7 @@ ParseCmObjDesc (
ASSERT (0);
return;
}
ParserArray = &StdNamespaceObjectParser[ObjId];
break;
case EObjNameSpaceArm:
@ -682,6 +685,7 @@ ParseCmObjDesc (
ASSERT (0);
return;
}
ParserArray = &ArmNamespaceObjectParser[ObjId];
break;
default:

View File

@ -28,7 +28,6 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
*/
typedef struct CmObjParser CM_OBJ_PARSER;
struct CmObjParser {
/// String describing the Cm Object
CONST CHAR8 *NameStr;
@ -59,7 +58,6 @@ struct CmObjParser {
with their object names.
*/
typedef struct CmObjParserArray {
/// Object name
CONST CHAR8 *ObjectName;

View File

@ -72,7 +72,8 @@ GetCgfMgrInfo (
}
if (CmObjectDesc.Size <
(sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count)) {
(sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: EStdObjCfgMgrInfo: Buffer too small, size = 0x%x\n",
@ -130,7 +131,8 @@ AddAcpiHeader (
(AcpiHeader == NULL) ||
(AcpiTableInfo == NULL) ||
(Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
) {
)
{
return EFI_INVALID_PARAMETER;
}
@ -229,7 +231,8 @@ AddSsdtAcpiHeader (
if ((CfgMgrProtocol == NULL) ||
(Generator == NULL) ||
(AcpiTableInfo == NULL)) {
(AcpiTableInfo == NULL))
{
return EFI_INVALID_PARAMETER;
}
@ -332,5 +335,6 @@ FindDuplicateValue (
}
}
}
return FALSE;
}