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

@ -40,13 +40,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetAcpiTableGenerator ( GetAcpiTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId, IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId,
OUT CONST ACPI_TABLE_GENERATOR ** CONST Generator OUT CONST ACPI_TABLE_GENERATOR **CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo; EDKII_DYNAMIC_TABLE_FACTORY_INFO *FactoryInfo;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -69,6 +69,7 @@ GetAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax); ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->StdAcpiTableGeneratorList[TableId] != NULL) { if (FactoryInfo->StdAcpiTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdAcpiTableGeneratorList[TableId]; *Generator = FactoryInfo->StdAcpiTableGeneratorList[TableId];
} else { } else {
@ -79,12 +80,14 @@ GetAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->CustomAcpiTableGeneratorList[TableId] != NULL) { if (FactoryInfo->CustomAcpiTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomAcpiTableGeneratorList[TableId]; *Generator = FactoryInfo->CustomAcpiTableGeneratorList[TableId];
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -105,7 +108,7 @@ GetAcpiTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterAcpiTableGenerator ( RegisterAcpiTableGenerator (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -132,6 +135,7 @@ RegisterAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax); ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = Generator; TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = Generator;
} else { } else {
@ -142,12 +146,14 @@ RegisterAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = Generator; TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = Generator;
} else { } else {
return EFI_ALREADY_STARTED; return EFI_ALREADY_STARTED;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -166,7 +172,7 @@ RegisterAcpiTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterAcpiTableGenerator ( DeregisterAcpiTableGenerator (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -191,10 +197,12 @@ DeregisterAcpiTableGenerator (
ASSERT (TableId < EStdAcpiTableIdMax); ASSERT (TableId < EStdAcpiTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdAcpiTableGeneratorList[TableId]) { if (Generator != TableFactoryInfo.StdAcpiTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = NULL; TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
@ -204,11 +212,14 @@ DeregisterAcpiTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] != NULL) {
if (Generator != if (Generator !=
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId]) { TableFactoryInfo.CustomAcpiTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = NULL; TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;

View File

@ -39,13 +39,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetDtTableGenerator ( GetDtTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST DT_TABLE_GENERATOR_ID GeneratorId, IN CONST DT_TABLE_GENERATOR_ID GeneratorId,
OUT CONST DT_TABLE_GENERATOR ** CONST Generator OUT CONST DT_TABLE_GENERATOR **CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo; EDKII_DYNAMIC_TABLE_FACTORY_INFO *FactoryInfo;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -68,6 +68,7 @@ GetDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax); ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->StdDtTableGeneratorList[TableId] != NULL) { if (FactoryInfo->StdDtTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdDtTableGeneratorList[TableId]; *Generator = FactoryInfo->StdDtTableGeneratorList[TableId];
} else { } else {
@ -78,12 +79,14 @@ GetDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->CustomDtTableGeneratorList[TableId] != NULL) { if (FactoryInfo->CustomDtTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomDtTableGeneratorList[TableId]; *Generator = FactoryInfo->CustomDtTableGeneratorList[TableId];
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -104,7 +107,7 @@ GetDtTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterDtTableGenerator ( RegisterDtTableGenerator (
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -131,6 +134,7 @@ RegisterDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax); ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdDtTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.StdDtTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdDtTableGeneratorList[TableId] = Generator; TableFactoryInfo.StdDtTableGeneratorList[TableId] = Generator;
} else { } else {
@ -141,12 +145,14 @@ RegisterDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomDtTableGeneratorList[TableId] = Generator; TableFactoryInfo.CustomDtTableGeneratorList[TableId] = Generator;
} else { } else {
return EFI_ALREADY_STARTED; return EFI_ALREADY_STARTED;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -165,7 +171,7 @@ RegisterDtTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterDtTableGenerator ( DeregisterDtTableGenerator (
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -190,10 +196,12 @@ DeregisterDtTableGenerator (
ASSERT (TableId < EStdDtTableIdMax); ASSERT (TableId < EStdDtTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdDtTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.StdDtTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdDtTableGeneratorList[TableId]) { if (Generator != TableFactoryInfo.StdDtTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.StdDtTableGeneratorList[TableId] = NULL; TableFactoryInfo.StdDtTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
@ -203,11 +211,14 @@ DeregisterDtTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] != NULL) {
if (Generator != if (Generator !=
TableFactoryInfo.CustomDtTableGeneratorList[TableId]) { TableFactoryInfo.CustomDtTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.CustomDtTableGeneratorList[TableId] = NULL; TableFactoryInfo.CustomDtTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;

View File

@ -67,9 +67,9 @@ typedef struct DynamicTableFactoryInfo {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetAcpiTableGenerator ( GetAcpiTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId, IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId,
OUT CONST ACPI_TABLE_GENERATOR ** CONST Generator OUT CONST ACPI_TABLE_GENERATOR **CONST Generator
); );
/** Return a pointer to the SMBIOS table generator. /** Return a pointer to the SMBIOS table generator.
@ -88,9 +88,9 @@ GetAcpiTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetSmbiosTableGenerator ( GetSmbiosTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId, IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId,
OUT CONST SMBIOS_TABLE_GENERATOR ** CONST Generator OUT CONST SMBIOS_TABLE_GENERATOR **CONST Generator
); );
/** Return a pointer to the DT table generator. /** Return a pointer to the DT table generator.
@ -109,9 +109,9 @@ GetSmbiosTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetDtTableGenerator ( GetDtTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST DT_TABLE_GENERATOR_ID GeneratorId, IN CONST DT_TABLE_GENERATOR_ID GeneratorId,
OUT CONST DT_TABLE_GENERATOR ** CONST Generator OUT CONST DT_TABLE_GENERATOR **CONST Generator
); );
#pragma pack() #pragma pack()

View File

@ -61,7 +61,7 @@ EFI_STATUS
EFIAPI EFIAPI
DynamicTableFactoryDxeInitialize ( DynamicTableFactoryDxeInitialize (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -70,7 +70,7 @@ DynamicTableFactoryDxeInitialize (
&ImageHandle, &ImageHandle,
&gEdkiiDynamicTableFactoryProtocolGuid, &gEdkiiDynamicTableFactoryProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,
(VOID*)&DynamicTableFactoryProtocol (VOID *)&DynamicTableFactoryProtocol
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
@ -80,5 +80,6 @@ DynamicTableFactoryDxeInitialize (
Status Status
)); ));
} }
return Status; return Status;
} }

View File

@ -40,13 +40,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetSmbiosTableGenerator ( GetSmbiosTableGenerator (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId, IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId,
OUT CONST SMBIOS_TABLE_GENERATOR ** CONST Generator OUT CONST SMBIOS_TABLE_GENERATOR **CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo; EDKII_DYNAMIC_TABLE_FACTORY_INFO *FactoryInfo;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -69,6 +69,7 @@ GetSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax); ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->StdSmbiosTableGeneratorList[TableId] != NULL) { if (FactoryInfo->StdSmbiosTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->StdSmbiosTableGeneratorList[TableId]; *Generator = FactoryInfo->StdSmbiosTableGeneratorList[TableId];
} else { } else {
@ -79,12 +80,14 @@ GetSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (FactoryInfo->CustomSmbiosTableGeneratorList[TableId] != NULL) { if (FactoryInfo->CustomSmbiosTableGeneratorList[TableId] != NULL) {
*Generator = FactoryInfo->CustomSmbiosTableGeneratorList[TableId]; *Generator = FactoryInfo->CustomSmbiosTableGeneratorList[TableId];
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -105,7 +108,7 @@ GetSmbiosTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterSmbiosTableGenerator ( RegisterSmbiosTableGenerator (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -132,6 +135,7 @@ RegisterSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax); ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = Generator; TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = Generator;
} else { } else {
@ -142,12 +146,14 @@ RegisterSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] == NULL) { if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] == NULL) {
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = Generator; TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = Generator;
} else { } else {
return EFI_ALREADY_STARTED; return EFI_ALREADY_STARTED;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -166,7 +172,7 @@ RegisterSmbiosTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterSmbiosTableGenerator ( DeregisterSmbiosTableGenerator (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
) )
{ {
UINT16 TableId; UINT16 TableId;
@ -191,10 +197,12 @@ DeregisterSmbiosTableGenerator (
ASSERT (TableId < EStdSmbiosTableIdMax); ASSERT (TableId < EStdSmbiosTableIdMax);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] != NULL) {
if (Generator != TableFactoryInfo.StdSmbiosTableGeneratorList[TableId]) { if (Generator != TableFactoryInfo.StdSmbiosTableGeneratorList[TableId]) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = NULL; TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
@ -204,11 +212,14 @@ DeregisterSmbiosTableGenerator (
ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators)); ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] != NULL) { if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] != NULL) {
if (Generator != if (Generator !=
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId]) { TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId])
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = NULL; TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = NULL;
} else { } else {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;

View File

@ -56,16 +56,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildAndInstallSingleAcpiTable ( BuildAndInstallSingleAcpiTable (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST TableFactoryProtocol, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN EFI_ACPI_TABLE_PROTOCOL * AcpiTableProtocol, IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS Status1; EFI_STATUS Status1;
EFI_ACPI_DESCRIPTION_HEADER * AcpiTable; EFI_ACPI_DESCRIPTION_HEADER *AcpiTable;
UINTN TableHandle; UINTN TableHandle;
AcpiTable = NULL; AcpiTable = NULL;
@ -142,6 +142,7 @@ exit_handler:
Status = Status1; Status = Status1;
} }
} }
return Status; return Status;
} }
@ -170,16 +171,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildAndInstallMultipleAcpiTable ( BuildAndInstallMultipleAcpiTable (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST TableFactoryProtocol, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN EFI_ACPI_TABLE_PROTOCOL * AcpiTableProtocol, IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS Status1; EFI_STATUS Status1;
EFI_ACPI_DESCRIPTION_HEADER ** AcpiTable; EFI_ACPI_DESCRIPTION_HEADER **AcpiTable;
UINTN TableCount; UINTN TableCount;
UINTN TableHandle; UINTN TableHandle;
UINTN Index; UINTN Index;
@ -262,6 +263,7 @@ exit_handler:
Status = Status1; Status = Status1;
} }
} }
return Status; return Status;
} }
@ -289,14 +291,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildAndInstallAcpiTable ( BuildAndInstallAcpiTable (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST TableFactoryProtocol, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_TABLE_PROTOCOL * AcpiTableProtocol, IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CONST ACPI_TABLE_GENERATOR * Generator; CONST ACPI_TABLE_GENERATOR *Generator;
ASSERT (TableFactoryProtocol != NULL); ASSERT (TableFactoryProtocol != NULL);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -398,7 +400,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
VerifyMandatoryTablesArePresent ( VerifyMandatoryTablesArePresent (
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN UINT32 AcpiTableCount IN UINT32 AcpiTableCount
) )
{ {
@ -446,27 +448,33 @@ VerifyMandatoryTablesArePresent (
// We need at least the FADT, MADT, GTDT and the DSDT tables to boot // We need at least the FADT, MADT, GTDT and the DSDT tables to boot
if (!FadtFound) { if (!FadtFound) {
DEBUG ((DEBUG_ERROR,"ERROR: FADT Table not found\n")); DEBUG ((DEBUG_ERROR, "ERROR: FADT Table not found\n"));
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
} }
if (!MadtFound) { if (!MadtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: MADT Table not found.\n")); DEBUG ((DEBUG_ERROR, "ERROR: MADT Table not found.\n"));
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
} }
if (!GtdtFound) { if (!GtdtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: GTDT Table not found.\n")); DEBUG ((DEBUG_ERROR, "ERROR: GTDT Table not found.\n"));
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
} }
if (!DsdtFound) { if (!DsdtFound) {
DEBUG ((DEBUG_ERROR, "ERROR: DSDT Table not found.\n")); DEBUG ((DEBUG_ERROR, "ERROR: DSDT Table not found.\n"));
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
} }
if (!Dbg2Found) { if (!Dbg2Found) {
DEBUG ((DEBUG_WARN, "WARNING: DBG2 Table not found.\n")); DEBUG ((DEBUG_WARN, "WARNING: DBG2 Table not found.\n"));
} }
if (!SpcrFound) { if (!SpcrFound) {
DEBUG ((DEBUG_WARN, "WARNING: SPCR Table not found.\n")); DEBUG ((DEBUG_WARN, "WARNING: SPCR Table not found.\n"));
} }
return Status; return Status;
} }
@ -488,13 +496,13 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ProcessAcpiTables ( ProcessAcpiTables (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST TableFactoryProtocol, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_TABLE_PROTOCOL * AcpiTableProtocol; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo; CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo;
UINT32 AcpiTableCount; UINT32 AcpiTableCount;
UINT32 Idx; UINT32 Idx;
@ -505,7 +513,7 @@ ProcessAcpiTables (
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEfiAcpiTableProtocolGuid, &gEfiAcpiTableProtocolGuid,
NULL, NULL,
(VOID**)&AcpiTableProtocol (VOID **)&AcpiTableProtocol
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
@ -564,7 +572,8 @@ ProcessAcpiTables (
// Add the FADT Table first. // Add the FADT Table first.
for (Idx = 0; Idx < AcpiTableCount; Idx++) { for (Idx = 0; Idx < AcpiTableCount; Idx++) {
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) == if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
AcpiTableInfo[Idx].TableGeneratorId) { AcpiTableInfo[Idx].TableGeneratorId)
{
Status = BuildAndInstallAcpiTable ( Status = BuildAndInstallAcpiTable (
TableFactoryProtocol, TableFactoryProtocol,
CfgMgrProtocol, CfgMgrProtocol,
@ -580,6 +589,7 @@ ProcessAcpiTables (
)); ));
return Status; return Status;
} }
break; break;
} }
} // for } // for
@ -595,7 +605,8 @@ ProcessAcpiTables (
// Skip FADT Table since we have already added // Skip FADT Table since we have already added
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) == if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
AcpiTableInfo[Idx].TableGeneratorId) { AcpiTableInfo[Idx].TableGeneratorId)
{
continue; continue;
} }
@ -604,7 +615,8 @@ ProcessAcpiTables (
((CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdReserved) >= ((CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdReserved) >=
AcpiTableInfo[Idx].TableGeneratorId) || AcpiTableInfo[Idx].TableGeneratorId) ||
(CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMax) <= (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMax) <=
AcpiTableInfo[Idx].TableGeneratorId))) { AcpiTableInfo[Idx].TableGeneratorId)))
{
DEBUG (( DEBUG ((
DEBUG_WARN, DEBUG_WARN,
"WARNING: Invalid ACPI Generator table ID = 0x%x, Skipping...\n", "WARNING: Invalid ACPI Generator table ID = 0x%x, Skipping...\n",
@ -656,19 +668,19 @@ EFI_STATUS
EFIAPI EFIAPI
DynamicTableManagerDxeInitialize ( DynamicTableManagerDxeInitialize (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EDKII_CONFIGURATION_MANAGER_PROTOCOL * CfgMgrProtocol; EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo;
EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * TableFactoryProtocol; EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *TableFactoryProtocol;
// Locate the Dynamic Table Factory // Locate the Dynamic Table Factory
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEdkiiDynamicTableFactoryProtocolGuid, &gEdkiiDynamicTableFactoryProtocolGuid,
NULL, NULL,
(VOID**)&TableFactoryProtocol (VOID **)&TableFactoryProtocol
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
@ -684,7 +696,7 @@ DynamicTableManagerDxeInitialize (
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEdkiiConfigurationManagerProtocolGuid, &gEdkiiConfigurationManagerProtocolGuid,
NULL, NULL,
(VOID**)&CfgMgrProtocol (VOID **)&CfgMgrProtocol
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
@ -725,5 +737,6 @@ DynamicTableManagerDxeInitialize (
Status Status
)); ));
} }
return Status; return Status;
} }

View File

@ -169,7 +169,7 @@ typedef enum StdAcpiTableId {
0, /* UINT64 OemTableId */ \ 0, /* UINT64 OemTableId */ \
0, /* UINT32 OemRevision */ \ 0, /* UINT32 OemRevision */ \
0, /* UINT32 CreatorId */ \ 0, /* UINT32 CreatorId */ \
0 /* UINT32 CreatorRevision */\ 0 /* UINT32 CreatorRevision */ \
} }
/** A macro to dump the common header part of EFI ACPI tables as /** A macro to dump the common header part of EFI ACPI tables as
@ -209,10 +209,10 @@ typedef struct AcpiTableGenerator ACPI_TABLE_GENERATOR;
failure codes as returned by the generator. failure codes as returned by the generator.
**/ **/
typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) ( typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
); );
/** This function pointer describes the interface used by the /** This function pointer describes the interface used by the
@ -229,10 +229,10 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
as returned by the generator. as returned by the generator.
**/ **/
typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) ( typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
); );
/** This function pointer describes an extended interface to build /** This function pointer describes an extended interface to build
@ -252,11 +252,11 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
failure codes as returned by the generator. failure codes as returned by the generator.
**/ **/
typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) ( typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table,
OUT UINTN * CONST TableCount OUT UINTN *CONST TableCount
); );
/** This function pointer describes an extended interface used by the /** This function pointer describes an extended interface used by the
@ -275,10 +275,10 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
as returned by the generator. as returned by the generator.
**/ **/
typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) ( typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table,
IN CONST UINTN TableCount IN CONST UINTN TableCount
); );
@ -296,7 +296,7 @@ typedef struct AcpiTableGenerator {
ACPI_TABLE_GENERATOR_ID GeneratorID; ACPI_TABLE_GENERATOR_ID GeneratorID;
/// String describing the ACPI table generator. /// String describing the ACPI table generator.
CONST CHAR16 * Description; CONST CHAR16 *Description;
/// The ACPI table signature. /// The ACPI table signature.
UINT32 AcpiTableSignature; UINT32 AcpiTableSignature;
@ -348,7 +348,7 @@ typedef struct AcpiTableGenerator {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterAcpiTableGenerator ( RegisterAcpiTableGenerator (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
); );
/** Deregister ACPI generator. /** Deregister ACPI generator.
@ -366,10 +366,9 @@ RegisterAcpiTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterAcpiTableGenerator ( DeregisterAcpiTableGenerator (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
); );
#pragma pack() #pragma pack()
#endif // ACPI_TABLE_GENERATOR_H_ #endif // ACPI_TABLE_GENERATOR_H_

View File

@ -494,10 +494,11 @@ typedef struct CmArmNamedComponentNode {
/// Memory access properties : Address size limit /// Memory access properties : Address size limit
UINT8 AddressSizeLimit; UINT8 AddressSizeLimit;
/** ASCII Null terminated string with the full path to /** ASCII Null terminated string with the full path to
the entry in the namespace for this object. the entry in the namespace for this object.
*/ */
CHAR8* ObjectName; CHAR8 *ObjectName;
} CM_ARM_NAMED_COMPONENT_NODE; } CM_ARM_NAMED_COMPONENT_NODE;
/** A structure that describes the /** A structure that describes the

View File

@ -119,7 +119,7 @@ typedef struct CmObjDescriptor {
UINT32 Size; UINT32 Size;
/// Pointer to the described Object or Object List /// Pointer to the described Object or Object List
VOID * Data; VOID *Data;
/// Count of objects in the list /// Count of objects in the list
UINT32 Count; UINT32 Count;

View File

@ -89,10 +89,10 @@ typedef struct DtTableGenerator DT_TABLE_GENERATOR;
failure codes as returned by the generator. failure codes as returned by the generator.
**/ **/
typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) ( typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) (
IN CONST DT_TABLE_GENERATOR * Generator, IN CONST DT_TABLE_GENERATOR *Generator,
IN CONST CM_STD_OBJ_DT_TABLE_INFO * CONST DtTableInfo, IN CONST CM_STD_OBJ_DT_TABLE_INFO *CONST DtTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT VOID ** Table OUT VOID **Table
); );
/** This function pointer describes the interface to used by the /** This function pointer describes the interface to used by the
@ -109,10 +109,10 @@ typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) (
as returned by the generator. as returned by the generator.
**/ **/
typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) ( typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) (
IN CONST DT_TABLE_GENERATOR * Generator, IN CONST DT_TABLE_GENERATOR *Generator,
IN CONST CM_STD_OBJ_DT_TABLE_INFO * CONST DtTableInfo, IN CONST CM_STD_OBJ_DT_TABLE_INFO *CONST DtTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN VOID ** Table IN VOID **Table
); );
/** The DT_TABLE_GENERATOR structure provides an interface that the /** The DT_TABLE_GENERATOR structure provides an interface that the
@ -123,7 +123,7 @@ typedef struct DtTableGenerator {
DT_TABLE_GENERATOR_ID GeneratorID; DT_TABLE_GENERATOR_ID GeneratorID;
/// String describing the DT table generator. /// String describing the DT table generator.
CONST CHAR16 * Description; CONST CHAR16 *Description;
/// DT table build function pointer. /// DT table build function pointer.
DT_TABLE_GENERATOR_BUILD_TABLE BuildDtTable; DT_TABLE_GENERATOR_BUILD_TABLE BuildDtTable;
@ -149,7 +149,7 @@ typedef struct DtTableGenerator {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterDtTableGenerator ( RegisterDtTableGenerator (
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
); );
/** Deregister DT generator. /** Deregister DT generator.
@ -167,10 +167,9 @@ RegisterDtTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterDtTableGenerator ( DeregisterDtTableGenerator (
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
); );
#pragma pack() #pragma pack()
#endif // DEVICETREE_TABLE_GENERATOR_H_ #endif // DEVICETREE_TABLE_GENERATOR_H_

View File

@ -58,7 +58,7 @@ HexFromAscii (
**/ **/
BOOLEAN BOOLEAN
IsValidPnpId ( IsValidPnpId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
); );
/** Check if a HID is a valid ACPI ID. /** Check if a HID is a valid ACPI ID.
@ -70,7 +70,7 @@ IsValidPnpId (
**/ **/
BOOLEAN BOOLEAN
IsValidAcpiId ( IsValidAcpiId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
); );
/** Convert a EisaId string to its compressed UINT32 equivalent. /** Convert a EisaId string to its compressed UINT32 equivalent.
@ -86,8 +86,8 @@ IsValidAcpiId (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetEisaIdFromString ( AmlGetEisaIdFromString (
IN CONST CHAR8 * EisaIdStr, IN CONST CHAR8 *EisaIdStr,
OUT UINT32 * EisaIdInt OUT UINT32 *EisaIdInt
); );
#endif // ACPI_HELPER_LIB_H_ #endif // ACPI_HELPER_LIB_H_

View File

@ -42,19 +42,19 @@
/** Node handle. /** Node handle.
*/ */
typedef void* AML_NODE_HANDLE; typedef void *AML_NODE_HANDLE;
/** Root Node handle. /** Root Node handle.
*/ */
typedef void* AML_ROOT_NODE_HANDLE; typedef void *AML_ROOT_NODE_HANDLE;
/** Object Node handle. /** Object Node handle.
*/ */
typedef void* AML_OBJECT_NODE_HANDLE; typedef void *AML_OBJECT_NODE_HANDLE;
/** Data Node handle. /** Data Node handle.
*/ */
typedef void* AML_DATA_NODE_HANDLE; typedef void *AML_DATA_NODE_HANDLE;
#endif // AML_HANDLE #endif // AML_HANDLE
@ -78,8 +78,8 @@ typedef void* AML_DATA_NODE_HANDLE;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseDefinitionBlock ( AmlParseDefinitionBlock (
IN CONST EFI_ACPI_DESCRIPTION_HEADER * DefinitionBlock, IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock,
OUT AML_ROOT_NODE_HANDLE * RootPtr OUT AML_ROOT_NODE_HANDLE *RootPtr
); );
/** Serialize an AML definition block. /** Serialize an AML definition block.
@ -102,7 +102,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlSerializeDefinitionBlock ( AmlSerializeDefinitionBlock (
IN AML_ROOT_NODE_HANDLE RootNode, IN AML_ROOT_NODE_HANDLE RootNode,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
); );
/** Clone a node and its children (clone a tree branch). /** Clone a node and its children (clone a tree branch).
@ -124,7 +124,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCloneTree ( AmlCloneTree (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
OUT AML_NODE_HANDLE * ClonedNode OUT AML_NODE_HANDLE *ClonedNode
); );
/** Delete a Node and its children. /** Delete a Node and its children.
@ -213,8 +213,8 @@ EFI_STATUS
EFIAPI EFIAPI
AmlFindNode ( AmlFindNode (
IN AML_NODE_HANDLE ReferenceNode, IN AML_NODE_HANDLE ReferenceNode,
IN CHAR8 * AslPath, IN CHAR8 *AslPath,
OUT AML_NODE_HANDLE * OutNode OUT AML_NODE_HANDLE *OutNode
); );
/** /**
@ -248,7 +248,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlDeviceOpUpdateName ( AmlDeviceOpUpdateName (
IN AML_OBJECT_NODE_HANDLE DeviceOpNode, IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
IN CHAR8 * NewNameString IN CHAR8 *NewNameString
); );
/** Update an integer value defined by a NameOp object node. /** Update an integer value defined by a NameOp object node.
@ -298,7 +298,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpUpdateString ( AmlNameOpUpdateString (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
IN CONST CHAR8 * NewName IN CONST CHAR8 *NewName
); );
/** Get the first Resource Data element contained in a named object. /** Get the first Resource Data element contained in a named object.
@ -332,7 +332,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpGetFirstRdNode ( AmlNameOpGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
); );
/** Get the Resource Data element following the CurrRdNode Resource Data. /** Get the Resource Data element following the CurrRdNode Resource Data.
@ -368,7 +368,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpGetNextRdNode ( AmlNameOpGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode, IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
); );
/** Update the first interrupt of an Interrupt resource data node. /** Update the first interrupt of an Interrupt resource data node.
@ -495,11 +495,11 @@ AmlCodeGenRdInterrupt (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenDefinitionBlock ( AmlCodeGenDefinitionBlock (
IN CONST CHAR8 * TableSignature, IN CONST CHAR8 *TableSignature,
IN CONST CHAR8 * OemId, IN CONST CHAR8 *OemId,
IN CONST CHAR8 * OemTableId, IN CONST CHAR8 *OemTableId,
IN UINT32 OemRevision, IN UINT32 OemRevision,
OUT AML_ROOT_NODE_HANDLE * NewRootNode OUT AML_ROOT_NODE_HANDLE *NewRootNode
); );
/** AML code generation for a Name object node, containing a String. /** AML code generation for a Name object node, containing a String.
@ -527,10 +527,10 @@ AmlCodeGenDefinitionBlock (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenNameString ( AmlCodeGenNameString (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN CHAR8 * String, IN CHAR8 *String,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
); );
/** AML code generation for a Name object node, containing an Integer. /** AML code generation for a Name object node, containing an Integer.
@ -557,10 +557,10 @@ AmlCodeGenNameString (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenNameInteger ( AmlCodeGenNameInteger (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN UINT64 Integer, IN UINT64 Integer,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
); );
/** AML code generation for a Device object node. /** AML code generation for a Device object node.
@ -586,9 +586,9 @@ AmlCodeGenNameInteger (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenDevice ( AmlCodeGenDevice (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
); );
/** AML code generation for a Scope object node. /** AML code generation for a Scope object node.
@ -614,9 +614,9 @@ AmlCodeGenDevice (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenScope ( AmlCodeGenScope (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
); );
/** AML code generation for a method returning a NameString. /** AML code generation for a method returning a NameString.
@ -663,13 +663,13 @@ AmlCodeGenScope (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenMethodRetNameString ( AmlCodeGenMethodRetNameString (
IN CONST CHAR8 * MethodNameString, IN CONST CHAR8 *MethodNameString,
IN CONST CHAR8 * ReturnedNameString OPTIONAL, IN CONST CHAR8 *ReturnedNameString OPTIONAL,
IN UINT8 NumArgs, IN UINT8 NumArgs,
IN BOOLEAN IsSerialized, IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel, IN UINT8 SyncLevel,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
); );
/** Create a _LPI name. /** Create a _LPI name.
@ -709,11 +709,11 @@ AmlCodeGenMethodRetNameString (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateLpiNode ( AmlCreateLpiNode (
IN CONST CHAR8 * LpiNameString, IN CONST CHAR8 *LpiNameString,
IN UINT16 Revision, IN UINT16 Revision,
IN UINT64 LevelId, IN UINT64 LevelId,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewLpiNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL
); );
/** Add an _LPI state to a LPI node created using AmlCreateLpiNode (). /** Add an _LPI state to a LPI node created using AmlCreateLpiNode ().
@ -779,11 +779,11 @@ AmlAddLpiState (
IN UINT32 ArchFlags, IN UINT32 ArchFlags,
IN UINT32 ResCntFreq, IN UINT32 ResCntFreq,
IN UINT32 EnableParentState, IN UINT32 EnableParentState,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * GenericRegisterDescriptor OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL,
IN UINT64 Integer OPTIONAL, IN UINT64 Integer OPTIONAL,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * ResidencyCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * UsageCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL,
IN CHAR8 * StateName OPTIONAL, IN CHAR8 *StateName OPTIONAL,
IN AML_OBJECT_NODE_HANDLE LpiNode IN AML_OBJECT_NODE_HANDLE LpiNode
); );
@ -824,7 +824,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpCrsGetFirstRdNode ( AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
); );
/** DEPRECATED API /** DEPRECATED API
@ -861,7 +861,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpCrsGetNextRdNode ( AmlNameOpCrsGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode, IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
); );
/** DEPRECATED API /** DEPRECATED API
@ -919,7 +919,7 @@ AmlCodeGenCrsAddRdInterrupt (
IN BOOLEAN EdgeTriggered, IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow, IN BOOLEAN ActiveLow,
IN BOOLEAN Shared, IN BOOLEAN Shared,
IN UINT32 * IrqList, IN UINT32 *IrqList,
IN UINT8 IrqCount IN UINT8 IrqCount
); );

View File

@ -29,11 +29,11 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSsdtSerialPortTable ( BuildSsdtSerialPortTable (
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
IN CONST CHAR8 * Name, IN CONST CHAR8 *Name,
IN CONST UINT64 Uid, IN CONST UINT64 Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
); );
/** Free an SSDT table previously created by /** Free an SSDT table previously created by
@ -47,7 +47,7 @@ BuildSsdtSerialPortTable (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeSsdtSerialPortTable ( FreeSsdtSerialPortTable (
IN EFI_ACPI_DESCRIPTION_HEADER * Table IN EFI_ACPI_DESCRIPTION_HEADER *Table
); );
/** Validate the Serial Port Information. /** Validate the Serial Port Information.
@ -61,7 +61,7 @@ FreeSsdtSerialPortTable (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ValidateSerialPortInfo ( ValidateSerialPortInfo (
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfoTable, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfoTable,
IN UINT32 SerialPortCount IN UINT32 SerialPortCount
); );

View File

@ -31,8 +31,8 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetCgfMgrInfo ( GetCgfMgrInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO **CfgMfrInfo
); );
/** The AddAcpiHeader function updates the ACPI header structure. It uses the /** The AddAcpiHeader function updates the ACPI header structure. It uses the
@ -57,10 +57,10 @@ GetCgfMgrInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AddAcpiHeader ( AddAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST UINT32 Length IN CONST UINT32 Length
); );
@ -91,10 +91,10 @@ AddAcpiHeader (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AddSsdtAcpiHeader ( AddSsdtAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
OUT AML_ROOT_NODE_HANDLE * RootNode OUT AML_ROOT_NODE_HANDLE *RootNode
); );
/** /**
@ -113,8 +113,8 @@ AddSsdtAcpiHeader (
typedef typedef
BOOLEAN BOOLEAN
(EFIAPI *PFN_IS_EQUAL)( (EFIAPI *PFN_IS_EQUAL)(
IN CONST VOID * Object1, IN CONST VOID *Object1,
IN CONST VOID * Object2, IN CONST VOID *Object2,
IN UINTN Index1 OPTIONAL, IN UINTN Index1 OPTIONAL,
IN UINTN Index2 OPTIONAL IN UINTN Index2 OPTIONAL
); );
@ -136,7 +136,7 @@ BOOLEAN
BOOLEAN BOOLEAN
EFIAPI EFIAPI
FindDuplicateValue ( FindDuplicateValue (
IN CONST VOID * Array, IN CONST VOID *Array,
IN CONST UINTN Count, IN CONST UINTN Count,
IN CONST UINTN ElementSize, IN CONST UINTN ElementSize,
IN PFN_IS_EQUAL EqualTestFunction IN PFN_IS_EQUAL EqualTestFunction
@ -149,7 +149,7 @@ FindDuplicateValue (
VOID VOID
EFIAPI EFIAPI
ParseCmObjDesc ( ParseCmObjDesc (
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc
); );
#endif // TABLE_HELPER_LIB_H_ #endif // TABLE_HELPER_LIB_H_

View File

@ -55,11 +55,11 @@ typedef struct PlatformRepositoryInfo EDKII_PLATFORM_REPOSITORY_INFO;
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_CONFIGURATION_MANAGER_GET_OBJECT) ( (EFIAPI *EDKII_CONFIGURATION_MANAGER_GET_OBJECT)(
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This,
IN CONST CM_OBJECT_ID CmObjectId, IN CONST CM_OBJECT_ID CmObjectId,
IN CONST CM_OBJECT_TOKEN Token OPTIONAL, IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject
); );
/** The SetObject function defines the interface implemented by the /** The SetObject function defines the interface implemented by the
@ -83,11 +83,11 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_CONFIGURATION_MANAGER_SET_OBJECT) ( (EFIAPI *EDKII_CONFIGURATION_MANAGER_SET_OBJECT)(
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This,
IN CONST CM_OBJECT_ID CmObjectId, IN CONST CM_OBJECT_ID CmObjectId,
IN CONST CM_OBJECT_TOKEN Token OPTIONAL, IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
IN CM_OBJ_DESCRIPTOR * CONST CmObject IN CM_OBJ_DESCRIPTOR *CONST CmObject
); );
/** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the /** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the
@ -110,7 +110,7 @@ typedef struct ConfigurationManagerProtocol {
/** Pointer to an implementation defined abstract repository /** Pointer to an implementation defined abstract repository
provisioned by the Configuration Manager. provisioned by the Configuration Manager.
*/ */
EDKII_PLATFORM_REPOSITORY_INFO * PlatRepoInfo; EDKII_PLATFORM_REPOSITORY_INFO *PlatRepoInfo;
} EDKII_CONFIGURATION_MANAGER_PROTOCOL; } EDKII_CONFIGURATION_MANAGER_PROTOCOL;
/** The Configuration Manager Protocol GUID. /** The Configuration Manager Protocol GUID.

View File

@ -53,10 +53,10 @@ typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR)(
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId, IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId,
OUT CONST ACPI_TABLE_GENERATOR ** CONST Generator OUT CONST ACPI_TABLE_GENERATOR **CONST Generator
); );
/** Registers an ACPI table generator. /** Registers an ACPI table generator.
@ -72,8 +72,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR)(
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
); );
/** Deregister an ACPI table generator. /** Deregister an ACPI table generator.
@ -87,8 +87,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR)(
IN CONST ACPI_TABLE_GENERATOR * CONST Generator IN CONST ACPI_TABLE_GENERATOR *CONST Generator
); );
/** Return a pointer to the SMBIOS table generator. /** Return a pointer to the SMBIOS table generator.
@ -106,10 +106,10 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR)(
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId, IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId,
OUT CONST SMBIOS_TABLE_GENERATOR ** CONST Generator OUT CONST SMBIOS_TABLE_GENERATOR **CONST Generator
); );
/** Register a SMBIOS table generator. /** Register a SMBIOS table generator.
@ -125,8 +125,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR)(
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
); );
/** Deregister a SMBIOS table generator. /** Deregister a SMBIOS table generator.
@ -140,8 +140,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR)(
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
); );
/** Return a pointer to the Device Tree table generator. /** Return a pointer to the Device Tree table generator.
@ -159,10 +159,10 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR)(
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST This,
IN CONST DT_TABLE_GENERATOR_ID GeneratorId, IN CONST DT_TABLE_GENERATOR_ID GeneratorId,
OUT CONST DT_TABLE_GENERATOR ** CONST Generator OUT CONST DT_TABLE_GENERATOR **CONST Generator
); );
/** Register a DT table generator. /** Register a DT table generator.
@ -178,8 +178,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR)(
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
); );
/** Deregister a DT table generator. /** Deregister a DT table generator.
@ -196,8 +196,8 @@ EFI_STATUS
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR) ( (EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR)(
IN CONST DT_TABLE_GENERATOR * CONST Generator IN CONST DT_TABLE_GENERATOR *CONST Generator
); );
/** A structure describing the Dynamic Table Factory Protocol interface. /** A structure describing the Dynamic Table Factory Protocol interface.
@ -242,7 +242,7 @@ typedef struct DynamicTableFactoryProtocol {
/** Pointer to the data structure that holds the /** Pointer to the data structure that holds the
list of registered table generators list of registered table generators
*/ */
EDKII_DYNAMIC_TABLE_FACTORY_INFO * TableFactoryInfo; EDKII_DYNAMIC_TABLE_FACTORY_INFO *TableFactoryInfo;
} EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL; } EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
/** The Dynamic Table Factory Protocol GUID. /** The Dynamic Table Factory Protocol GUID.

View File

@ -142,10 +142,10 @@ typedef struct SmbiosTableGenerator SMBIOS_TABLE_GENERATOR;
failure codes as returned by the generator. failure codes as returned by the generator.
**/ **/
typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) ( typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) (
IN CONST SMBIOS_TABLE_GENERATOR * Generator, IN CONST SMBIOS_TABLE_GENERATOR *Generator,
IN CM_STD_OBJ_SMBIOS_TABLE_INFO * CONST SmbiosTableInfo, IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT SMBIOS_STRUCTURE ** Table OUT SMBIOS_STRUCTURE **Table
); );
/** This function pointer describes the interface to used by the /** This function pointer describes the interface to used by the
@ -162,10 +162,10 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) (
as returned by the generator. as returned by the generator.
**/ **/
typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) ( typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) (
IN CONST SMBIOS_TABLE_GENERATOR * Generator, IN CONST SMBIOS_TABLE_GENERATOR *Generator,
IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO * CONST SmbiosTableInfo, IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN SMBIOS_STRUCTURE ** Table IN SMBIOS_STRUCTURE **Table
); );
/** The SMBIOS_TABLE_GENERATOR structure provides an interface that the /** The SMBIOS_TABLE_GENERATOR structure provides an interface that the
@ -177,7 +177,7 @@ typedef struct SmbiosTableGenerator {
/// String describing the DT table /// String describing the DT table
/// generator. /// generator.
CONST CHAR16* Description; CONST CHAR16 *Description;
/// The SMBIOS table type. /// The SMBIOS table type.
SMBIOS_TYPE Type; SMBIOS_TYPE Type;
@ -208,7 +208,7 @@ typedef struct SmbiosTableGenerator {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
RegisterSmbiosTableGenerator ( RegisterSmbiosTableGenerator (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
); );
/** Deregister SMBIOS generator. /** Deregister SMBIOS generator.
@ -226,9 +226,9 @@ RegisterSmbiosTableGenerator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
DeregisterSmbiosTableGenerator ( DeregisterSmbiosTableGenerator (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator
); );
#pragma pack() #pragma pack()
#endif // SMBIOS_TABLE_GENERATOR_H_ #endif // SMBIOS_TABLE_GENERATOR_H_

View File

@ -85,7 +85,7 @@ typedef struct CmAStdObjAcpiTableInfo {
ACPI_TABLE_GENERATOR_ID TableGeneratorId; ACPI_TABLE_GENERATOR_ID TableGeneratorId;
/// Optional pointer to the ACPI table data /// Optional pointer to the ACPI table data
EFI_ACPI_DESCRIPTION_HEADER * AcpiTableData; EFI_ACPI_DESCRIPTION_HEADER *AcpiTableData;
/// An OEM-supplied string that the OEM uses to identify the particular /// An OEM-supplied string that the OEM uses to identify the particular
/// data table. This field is particularly useful when defining a definition /// data table. This field is particularly useful when defining a definition
@ -123,7 +123,7 @@ typedef struct CmStdObjSmbiosTableInfo {
SMBIOS_TABLE_GENERATOR_ID TableGeneratorId; SMBIOS_TABLE_GENERATOR_ID TableGeneratorId;
/// Optional pointer to the SMBIOS table data /// Optional pointer to the SMBIOS table data
SMBIOS_STRUCTURE * SmbiosTableData; SMBIOS_STRUCTURE *SmbiosTableData;
} CM_STD_OBJ_SMBIOS_TABLE_INFO; } CM_STD_OBJ_SMBIOS_TABLE_INFO;
#pragma pack() #pragma pack()

View File

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

View File

@ -108,7 +108,7 @@ typedef struct {
UartBase, \ UartBase, \
UartAddrLen, \ UartAddrLen, \
UartNameStr \ UartNameStr \
) { \ ) {\
{ \ { \
/* UINT8 Revision */ \ /* UINT8 Revision */ \
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, \ EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, \
@ -194,7 +194,7 @@ GET_OBJECT_LIST (
STATIC STATIC
EFI_STATUS EFI_STATUS
SetupDebugUart ( SetupDebugUart (
IN CONST CM_ARM_SERIAL_PORT_INFO * CONST SerialPortInfo IN CONST CM_ARM_SERIAL_PORT_INFO *CONST SerialPortInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -245,15 +245,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeDbg2TableEx ( FreeDbg2TableEx (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table,
IN CONST UINTN TableCount IN CONST UINTN TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -263,7 +263,8 @@ FreeDbg2TableEx (
if ((Table == NULL) || if ((Table == NULL) ||
(*Table == NULL) || (*Table == NULL) ||
(TableCount != 2)) { (TableCount != 2))
{
DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid Table Pointer\n")); DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -272,7 +273,8 @@ FreeDbg2TableEx (
if ((TableList[1] == NULL) || if ((TableList[1] == NULL) ||
(TableList[1]->Signature != (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")); DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid SSDT table pointer.\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -316,17 +318,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildDbg2TableEx ( BuildDbg2TableEx (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table,
OUT UINTN * CONST TableCount OUT UINTN *CONST TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo; CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
UINT32 SerialPortCount; UINT32 SerialPortCount;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -337,7 +339,8 @@ BuildDbg2TableEx (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: DBG2: Requested table revision = %d, is not supported." "ERROR: DBG2: Requested table revision = %d, is not supported."
@ -387,8 +390,8 @@ BuildDbg2TableEx (
} }
// Allocate a table to store pointers to the DBG2 and SSDT tables. // Allocate a table to store pointers to the DBG2 and SSDT tables.
TableList = (EFI_ACPI_DESCRIPTION_HEADER**) TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2); AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * 2);
if (TableList == NULL) { if (TableList == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -403,7 +406,7 @@ BuildDbg2TableEx (
Status = AddAcpiHeader ( Status = AddAcpiHeader (
CfgMgrProtocol, CfgMgrProtocol,
This, This,
(EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2, (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2,
AcpiTableInfo, AcpiTableInfo,
sizeof (DBG2_TABLE) sizeof (DBG2_TABLE)
); );
@ -451,7 +454,8 @@ BuildDbg2TableEx (
(SerialPortInfo->PortSubtype == (SerialPortInfo->PortSubtype ==
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) || EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||
(SerialPortInfo->PortSubtype == (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 // Initialize the serial port
Status = SetupDebugUart (SerialPortInfo); Status = SetupDebugUart (SerialPortInfo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -464,7 +468,7 @@ BuildDbg2TableEx (
} }
} }
TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2; TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2;
// Build a SSDT table describing the serial port. // Build a SSDT table describing the serial port.
Status = BuildSsdtSerialPortTable ( Status = BuildSsdtSerialPortTable (
@ -543,10 +547,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiDbg2LibConstructor ( AcpiDbg2LibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&Dbg2Generator); Status = RegisterAcpiTableGenerator (&Dbg2Generator);
DEBUG ((DEBUG_INFO, "DBG2: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "DBG2: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -566,10 +571,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiDbg2LibDestructor ( AcpiDbg2LibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&Dbg2Generator); Status = DeregisterAcpiTableGenerator (&Dbg2Generator);
DEBUG ((DEBUG_INFO, "DBG2: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "DBG2: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -250,11 +250,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FadtAddPmProfileInfo ( FadtAddPmProfileInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_POWER_MANAGEMENT_PROFILE_INFO * PmProfile; CM_ARM_POWER_MANAGEMENT_PROFILE_INFO *PmProfile;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -303,11 +303,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FadtAddBootArchInfo ( FadtAddBootArchInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_BOOT_ARCH_INFO * BootArchInfo; CM_ARM_BOOT_ARCH_INFO *BootArchInfo;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -355,11 +355,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FadtAddHypervisorVendorId ( FadtAddHypervisorVendorId (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_HYPERVISOR_VENDOR_ID * HypervisorVendorInfo; CM_ARM_HYPERVISOR_VENDOR_ID *HypervisorVendorInfo;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -385,6 +385,7 @@ FadtAddHypervisorVendorId (
Status Status
)); ));
} }
goto error_handler; goto error_handler;
} }
@ -416,11 +417,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FadtAddFixedFeatureFlags ( FadtAddFixedFeatureFlags (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_FIXED_FEATURE_FLAGS * FixedFeatureFlags; CM_ARM_FIXED_FEATURE_FLAGS *FixedFeatureFlags;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -446,6 +447,7 @@ FadtAddFixedFeatureFlags (
Status Status
)); ));
} }
goto error_handler; goto error_handler;
} }
@ -497,10 +499,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildFadtTable ( BuildFadtTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -513,7 +515,8 @@ BuildFadtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: FADT: Requested table revision = %d, is not supported." "ERROR: FADT: Requested table revision = %d, is not supported."
@ -530,7 +533,7 @@ BuildFadtTable (
Status = AddAcpiHeader ( Status = AddAcpiHeader (
CfgMgrProtocol, CfgMgrProtocol,
This, This,
(EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt, (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt,
AcpiTableInfo, AcpiTableInfo,
sizeof (EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE) sizeof (EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE)
); );
@ -595,7 +598,7 @@ BuildFadtTable (
} }
} }
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt; *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt;
error_handler: error_handler:
return Status; return Status;
} }
@ -649,10 +652,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiFadtLibConstructor ( AcpiFadtLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&FadtGenerator); Status = RegisterAcpiTableGenerator (&FadtGenerator);
DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -672,10 +676,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiFadtLibDestructor ( AcpiFadtLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&FadtGenerator); Status = DeregisterAcpiTableGenerator (&FadtGenerator);
DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -90,14 +90,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AddGenericTimerInfo ( AddGenericTimerInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt,
IN CONST UINT32 PlatformTimerCount, IN CONST UINT32 PlatformTimerCount,
IN CONST UINT32 AcpiTableRevision IN CONST UINT32 AcpiTableRevision
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_GENERIC_TIMER_INFO * GenericTimerInfo; CM_ARM_GENERIC_TIMER_INFO *GenericTimerInfo;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
ASSERT (Gtdt != NULL); ASSERT (Gtdt != NULL);
@ -154,19 +154,19 @@ AddGenericTimerInfo (
STATIC STATIC
VOID VOID
AddGenericWatchdogList ( AddGenericWatchdogList (
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt,
IN CONST UINT32 WatchdogOffset, IN CONST UINT32 WatchdogOffset,
IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList, IN CONST CM_ARM_GENERIC_WATCHDOG_INFO *WatchdogInfoList,
IN UINT32 WatchdogCount IN UINT32 WatchdogCount
) )
{ {
EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE * Watchdog; EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *Watchdog;
ASSERT (Gtdt != NULL); ASSERT (Gtdt != NULL);
ASSERT (WatchdogInfoList != NULL); ASSERT (WatchdogInfoList != NULL);
Watchdog = (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *) Watchdog = (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *)
((UINT8*)Gtdt + WatchdogOffset); ((UINT8 *)Gtdt + WatchdogOffset);
while (WatchdogCount-- != 0) { while (WatchdogCount-- != 0) {
// Add watchdog entry // Add watchdog entry
@ -206,8 +206,8 @@ AddGenericWatchdogList (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsGtFrameNumberEqual ( IsGtFrameNumberEqual (
IN CONST VOID * Frame1, IN CONST VOID *Frame1,
IN CONST VOID * Frame2, IN CONST VOID *Frame2,
IN UINTN Index1, IN UINTN Index1,
IN UINTN Index2 IN UINTN Index2
) )
@ -217,8 +217,8 @@ IsGtFrameNumberEqual (
ASSERT ((Frame1 != NULL) && (Frame2 != NULL)); ASSERT ((Frame1 != NULL) && (Frame2 != NULL));
FrameNumber1 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame1)->FrameNumber; FrameNumber1 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO *)Frame1)->FrameNumber;
FrameNumber2 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame2)->FrameNumber; FrameNumber2 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO *)Frame2)->FrameNumber;
if (FrameNumber1 == FrameNumber2) { if (FrameNumber1 == FrameNumber2) {
DEBUG (( DEBUG ((
@ -249,10 +249,10 @@ IsGtFrameNumberEqual (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGTBlockTimerFrames ( AddGTBlockTimerFrames (
IN EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame, IN EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *GtBlockFrame,
IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList, IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO *GTBlockTimerFrameList,
IN UINT32 GTBlockFrameCount IN UINT32 GTBlockFrameCount
) )
{ {
BOOLEAN IsFrameNumberDuplicated; BOOLEAN IsFrameNumberDuplicated;
@ -308,6 +308,7 @@ AddGTBlockTimerFrames (
GtBlockFrame++; GtBlockFrame++;
GTBlockTimerFrameList++; GTBlockTimerFrameList++;
} // for } // for
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -328,24 +329,24 @@ AddGTBlockTimerFrames (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGTBlockList ( AddGTBlockList (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt,
IN CONST UINT32 GTBlockOffset, IN CONST UINT32 GTBlockOffset,
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo, IN CONST CM_ARM_GTBLOCK_INFO *GTBlockInfo,
IN UINT32 BlockTimerCount IN UINT32 BlockTimerCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE * GTBlock; EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *GTBlock;
EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame; EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *GtBlockFrame;
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList; CM_ARM_GTBLOCK_TIMER_FRAME_INFO *GTBlockTimerFrameList;
UINT32 GTBlockTimerFrameCount; UINT32 GTBlockTimerFrameCount;
UINTN Length; UINTN Length;
ASSERT (Gtdt != NULL); ASSERT (Gtdt != NULL);
ASSERT (GTBlockInfo != NULL); ASSERT (GTBlockInfo != NULL);
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt + GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8 *)Gtdt +
GTBlockOffset); GTBlockOffset);
while (BlockTimerCount-- != 0) { while (BlockTimerCount-- != 0) {
@ -358,7 +359,8 @@ AddGTBlockList (
&GTBlockTimerFrameCount &GTBlockTimerFrameCount
); );
if (EFI_ERROR (Status) || if (EFI_ERROR (Status) ||
(GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount)) { (GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: GTDT: Failed to get Generic Timer Frames. Status = %r\n", "ERROR: GTDT: Failed to get Generic Timer Frames. Status = %r\n",
@ -394,8 +396,8 @@ AddGTBlockList (
GTBlock->GTBlockTimerOffset = GTBlock->GTBlockTimerOffset =
sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE); sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE);
GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE*) GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *)
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset); ((UINT8 *)GTBlock + GTBlock->GTBlockTimerOffset);
// Add GT Block Timer frames // Add GT Block Timer frames
Status = AddGTBlockTimerFrames ( Status = AddGTBlockTimerFrames (
@ -413,10 +415,11 @@ AddGTBlockList (
} }
// Next GTBlock // Next GTBlock
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock + GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8 *)GTBlock +
GTBlock->Length); GTBlock->Length);
GTBlockInfo++; GTBlockInfo++;
}// for }// for
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -447,10 +450,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildGtdtTable ( BuildGtdtTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -458,9 +461,9 @@ BuildGtdtTable (
UINT32 PlatformTimerCount; UINT32 PlatformTimerCount;
UINT32 WatchdogCount; UINT32 WatchdogCount;
UINT32 BlockTimerCount; UINT32 BlockTimerCount;
CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList; CM_ARM_GENERIC_WATCHDOG_INFO *WatchdogInfoList;
CM_ARM_GTBLOCK_INFO * GTBlockInfo; CM_ARM_GTBLOCK_INFO *GTBlockInfo;
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt; EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *Gtdt;
UINT32 Idx; UINT32 Idx;
UINT32 GTBlockOffset; UINT32 GTBlockOffset;
UINT32 WatchdogOffset; UINT32 WatchdogOffset;
@ -473,7 +476,8 @@ BuildGtdtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: GTDT: Requested table revision = %d, is not supported." "ERROR: GTDT: Requested table revision = %d, is not supported."
@ -546,6 +550,7 @@ BuildGtdtTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
GTBlockInfo[Idx].GTBlockTimerFrameCount); GTBlockInfo[Idx].GTBlockTimerFrameCount);
} }
@ -572,7 +577,7 @@ BuildGtdtTable (
)); ));
} }
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -585,7 +590,7 @@ BuildGtdtTable (
goto error_handler; goto error_handler;
} }
Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table; Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n", "GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
@ -658,6 +663,7 @@ error_handler:
FreePool (*Table); FreePool (*Table);
*Table = NULL; *Table = NULL;
} }
return Status; return Status;
} }
@ -675,11 +681,11 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeGtdtTableResources ( FreeGtdtTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -746,10 +752,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiGtdtLibConstructor ( AcpiGtdtLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&GtdtGenerator); Status = RegisterAcpiTableGenerator (&GtdtGenerator);
DEBUG ((DEBUG_INFO, "GTDT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "GTDT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -769,10 +776,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiGtdtLibDestructor ( AcpiGtdtLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&GtdtGenerator); Status = DeregisterAcpiTableGenerator (&GtdtGenerator);
DEBUG ((DEBUG_INFO, "GTDT: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "GTDT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -132,7 +132,7 @@ GET_OBJECT_LIST (
STATIC STATIC
UINT32 UINT32
GetItsGroupNodeSize ( GetItsGroupNodeSize (
IN CONST CM_ARM_ITS_GROUP_NODE * Node IN CONST CM_ARM_ITS_GROUP_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -163,9 +163,9 @@ STATIC
UINT64 UINT64
GetSizeofItsGroupNodes ( GetSizeofItsGroupNodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_ITS_GROUP_NODE * NodeList, IN CONST CM_ARM_ITS_GROUP_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -175,7 +175,7 @@ GetSizeofItsGroupNodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -190,6 +190,7 @@ GetSizeofItsGroupNodes (
(*NodeIndexer)++; (*NodeIndexer)++;
NodeList++; NodeList++;
} }
return Size; return Size;
} }
@ -202,7 +203,7 @@ GetSizeofItsGroupNodes (
STATIC STATIC
UINT32 UINT32
GetNamedComponentNodeSize ( GetNamedComponentNodeSize (
IN CONST CM_ARM_NAMED_COMPONENT_NODE * Node IN CONST CM_ARM_NAMED_COMPONENT_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -236,9 +237,9 @@ STATIC
UINT64 UINT64
GetSizeofNamedComponentNodes ( GetSizeofNamedComponentNodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_NAMED_COMPONENT_NODE * NodeList, IN CONST CM_ARM_NAMED_COMPONENT_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -248,7 +249,7 @@ GetSizeofNamedComponentNodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -276,7 +277,7 @@ GetSizeofNamedComponentNodes (
STATIC STATIC
UINT32 UINT32
GetRootComplexNodeSize ( GetRootComplexNodeSize (
IN CONST CM_ARM_ROOT_COMPLEX_NODE * Node IN CONST CM_ARM_ROOT_COMPLEX_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -308,9 +309,9 @@ STATIC
UINT64 UINT64
GetSizeofRootComplexNodes ( GetSizeofRootComplexNodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_ROOT_COMPLEX_NODE * NodeList, IN CONST CM_ARM_ROOT_COMPLEX_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -320,7 +321,7 @@ GetSizeofRootComplexNodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -348,7 +349,7 @@ GetSizeofRootComplexNodes (
STATIC STATIC
UINT32 UINT32
GetSmmuV1V2NodeSize ( GetSmmuV1V2NodeSize (
IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * Node IN CONST CM_ARM_SMMUV1_SMMUV2_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -386,9 +387,9 @@ STATIC
UINT64 UINT64
GetSizeofSmmuV1V2Nodes ( GetSizeofSmmuV1V2Nodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * NodeList, IN CONST CM_ARM_SMMUV1_SMMUV2_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -398,7 +399,7 @@ GetSizeofSmmuV1V2Nodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -413,6 +414,7 @@ GetSizeofSmmuV1V2Nodes (
(*NodeIndexer)++; (*NodeIndexer)++;
NodeList++; NodeList++;
} }
return Size; return Size;
} }
@ -425,7 +427,7 @@ GetSizeofSmmuV1V2Nodes (
STATIC STATIC
UINT32 UINT32
GetSmmuV3NodeSize ( GetSmmuV3NodeSize (
IN CONST CM_ARM_SMMUV3_NODE * Node IN CONST CM_ARM_SMMUV3_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -457,9 +459,9 @@ STATIC
UINT64 UINT64
GetSizeofSmmuV3Nodes ( GetSizeofSmmuV3Nodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_SMMUV3_NODE * NodeList, IN CONST CM_ARM_SMMUV3_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -469,7 +471,7 @@ GetSizeofSmmuV3Nodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -484,6 +486,7 @@ GetSizeofSmmuV3Nodes (
(*NodeIndexer)++; (*NodeIndexer)++;
NodeList++; NodeList++;
} }
return Size; return Size;
} }
@ -496,7 +499,7 @@ GetSizeofSmmuV3Nodes (
STATIC STATIC
UINT32 UINT32
GetPmcgNodeSize ( GetPmcgNodeSize (
IN CONST CM_ARM_PMCG_NODE * Node IN CONST CM_ARM_PMCG_NODE *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -528,9 +531,9 @@ STATIC
UINT64 UINT64
GetSizeofPmcgNodes ( GetSizeofPmcgNodes (
IN CONST UINT32 NodeStartOffset, IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_PMCG_NODE * NodeList, IN CONST CM_ARM_PMCG_NODE *NodeList,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer IN OUT IORT_NODE_INDEXER **CONST NodeIndexer
) )
{ {
UINT64 Size; UINT64 Size;
@ -540,7 +543,7 @@ GetSizeofPmcgNodes (
Size = 0; Size = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token; (*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList; (*NodeIndexer)->Object = (VOID *)NodeList;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset); (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -555,6 +558,7 @@ GetSizeofPmcgNodes (
(*NodeIndexer)++; (*NodeIndexer)++;
NodeList++; NodeList++;
} }
return Size; return Size;
} }
@ -573,10 +577,10 @@ GetSizeofPmcgNodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
GetNodeOffsetReferencedByToken ( GetNodeOffsetReferencedByToken (
IN IORT_NODE_INDEXER * NodeIndexer, IN IORT_NODE_INDEXER *NodeIndexer,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN CM_OBJECT_TOKEN Token, IN CM_OBJECT_TOKEN Token,
OUT UINT32 * NodeOffset OUT UINT32 *NodeOffset
) )
{ {
DEBUG (( DEBUG ((
@ -600,8 +604,10 @@ GetNodeOffsetReferencedByToken (
)); ));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
NodeIndexer++; NodeIndexer++;
} }
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"IORT: Node Indexer: Token = %p, Not Found\n", "IORT: Node Indexer: Token = %p, Not Found\n",
@ -630,21 +636,21 @@ GetNodeOffsetReferencedByToken (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddIdMappingArray ( AddIdMappingArray (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray, IN EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray,
IN UINT32 IdCount, IN UINT32 IdCount,
IN CONST CM_OBJECT_TOKEN IdMappingToken IN CONST CM_OBJECT_TOKEN IdMappingToken
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_ID_MAPPING * IdMappings; CM_ARM_ID_MAPPING *IdMappings;
UINT32 IdMappingCount; UINT32 IdMappingCount;
ACPI_IORT_GENERATOR * Generator; ACPI_IORT_GENERATOR *Generator;
ASSERT (IdMapArray != NULL); ASSERT (IdMapArray != NULL);
Generator = (ACPI_IORT_GENERATOR*)This; Generator = (ACPI_IORT_GENERATOR *)This;
// Get the Id Mapping Array // Get the Id Mapping Array
Status = GetEArmObjIdMappingArray ( Status = GetEArmObjIdMappingArray (
@ -721,25 +727,25 @@ AddIdMappingArray (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddItsGroupNodes ( AddItsGroupNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_ITS_GROUP_NODE * NodeList, IN CONST CM_ARM_ITS_GROUP_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE * ItsGroupNode; EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE *ItsGroupNode;
UINT32 * ItsIds; UINT32 *ItsIds;
CM_ARM_ITS_IDENTIFIER * ItsIdentifier; CM_ARM_ITS_IDENTIFIER *ItsIdentifier;
UINT32 ItsIdentifierCount; UINT32 ItsIdentifierCount;
UINT32 IdIndex; UINT32 IdIndex;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
ItsGroupNode = (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE*)((UINT8*)Iort + ItsGroupNode = (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -766,7 +772,7 @@ AddItsGroupNodes (
// IORT specific data // IORT specific data
ItsGroupNode->NumItsIdentifiers = NodeList->ItsIdCount; ItsGroupNode->NumItsIdentifiers = NodeList->ItsIdCount;
ItsIds = (UINT32*)((UINT8*)ItsGroupNode + ItsIds = (UINT32 *)((UINT8 *)ItsGroupNode +
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE)); sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE));
Status = GetEArmObjGicItsIdentifierArray ( Status = GetEArmObjGicItsIdentifierArray (
@ -798,7 +804,7 @@ AddItsGroupNodes (
} // ITS identifier array } // ITS identifier array
// Next IORT Group Node // Next IORT Group Node
ItsGroupNode = (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE*)((UINT8*)ItsGroupNode + ItsGroupNode = (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE *)((UINT8 *)ItsGroupNode +
ItsGroupNode->Node.Length); ItsGroupNode->Node.Length);
NodeList++; NodeList++;
} // IORT Group Node } // IORT Group Node
@ -828,24 +834,24 @@ AddItsGroupNodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddNamedComponentNodes ( AddNamedComponentNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_NAMED_COMPONENT_NODE * NodeList, IN CONST CM_ARM_NAMED_COMPONENT_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE * NcNode; EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE *NcNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray; EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray;
CHAR8 * ObjectName; CHAR8 *ObjectName;
UINTN ObjectNameLength; UINTN ObjectNameLength;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
NcNode = (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE*)((UINT8*)Iort + NcNode = (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -883,7 +889,7 @@ AddNamedComponentNodes (
NcNode->AddressSizeLimit = NodeList->AddressSizeLimit; NcNode->AddressSizeLimit = NodeList->AddressSizeLimit;
// Copy the object name // Copy the object name
ObjectName = (CHAR8*)((UINT8*)NcNode + ObjectName = (CHAR8 *)((UINT8 *)NcNode +
sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE)); sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE));
Status = AsciiStrCpyS ( Status = AsciiStrCpyS (
ObjectName, ObjectName,
@ -900,9 +906,10 @@ AddNamedComponentNodes (
} }
if ((NodeList->IdMappingCount > 0) && if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) { (NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for Named Component // Ids for Named Component
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)NcNode + IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)NcNode +
NcNode->Node.IdReference); NcNode->Node.IdReference);
Status = AddIdMappingArray ( Status = AddIdMappingArray (
@ -923,7 +930,7 @@ AddNamedComponentNodes (
} }
// Next Named Component Node // Next Named Component Node
NcNode = (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE*)((UINT8*)NcNode + NcNode = (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE *)((UINT8 *)NcNode +
NcNode->Node.Length); NcNode->Node.Length);
NodeList++; NodeList++;
} // Named Component Node } // Named Component Node
@ -952,22 +959,22 @@ AddNamedComponentNodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddRootComplexNodes ( AddRootComplexNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_ROOT_COMPLEX_NODE * NodeList, IN CONST CM_ARM_ROOT_COMPLEX_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_RC_NODE * RcNode; EFI_ACPI_6_0_IO_REMAPPING_RC_NODE *RcNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray; EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
RcNode = (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE*)((UINT8*)Iort + RcNode = (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -1005,9 +1012,10 @@ AddRootComplexNodes (
RcNode->Reserved1[2] = EFI_ACPI_RESERVED_BYTE; RcNode->Reserved1[2] = EFI_ACPI_RESERVED_BYTE;
if ((NodeList->IdMappingCount > 0) && if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) { (NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for Root Complex // Ids for Root Complex
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)RcNode + IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)RcNode +
RcNode->Node.IdReference); RcNode->Node.IdReference);
Status = AddIdMappingArray ( Status = AddIdMappingArray (
This, This,
@ -1027,7 +1035,7 @@ AddRootComplexNodes (
} }
// Next Root Complex Node // Next Root Complex Node
RcNode = (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE*)((UINT8*)RcNode + RcNode = (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE *)((UINT8 *)RcNode +
RcNode->Node.Length); RcNode->Node.Length);
NodeList++; NodeList++;
} // Root Complex Node } // Root Complex Node
@ -1054,14 +1062,14 @@ AddRootComplexNodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddSmmuInterruptArray ( AddSmmuInterruptArray (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * InterruptArray, IN OUT EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *InterruptArray,
IN UINT32 InterruptCount, IN UINT32 InterruptCount,
IN CONST CM_OBJECT_TOKEN InterruptToken IN CONST CM_OBJECT_TOKEN InterruptToken
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_SMMU_INTERRUPT * SmmuInterrupt; CM_ARM_SMMU_INTERRUPT *SmmuInterrupt;
UINT32 SmmuInterruptCount; UINT32 SmmuInterruptCount;
ASSERT (InterruptArray != NULL); ASSERT (InterruptArray != NULL);
@ -1120,25 +1128,25 @@ AddSmmuInterruptArray (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddSmmuV1V2Nodes ( AddSmmuV1V2Nodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * NodeList, IN CONST CM_ARM_SMMUV1_SMMUV2_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE * SmmuNode; EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE *SmmuNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray; EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray;
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * ContextInterruptArray; EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *ContextInterruptArray;
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * PmuInterruptArray; EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *PmuInterruptArray;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE*)((UINT8*)Iort + SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -1181,7 +1189,7 @@ AddSmmuV1V2Nodes (
SmmuNode->ContextInterruptArrayRef = SmmuNode->ContextInterruptArrayRef =
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE); sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE);
ContextInterruptArray = ContextInterruptArray =
(EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode +
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE)); sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE));
// PMU Interrupt // PMU Interrupt
@ -1190,7 +1198,7 @@ AddSmmuV1V2Nodes (
(NodeList->ContextInterruptCount * (NodeList->ContextInterruptCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)); sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT));
PmuInterruptArray = PmuInterruptArray =
(EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode +
SmmuNode->PmuInterruptArrayRef); SmmuNode->PmuInterruptArrayRef);
SmmuNode->SMMU_NSgIrpt = NodeList->SMMU_NSgIrpt; SmmuNode->SMMU_NSgIrpt = NodeList->SMMU_NSgIrpt;
@ -1216,7 +1224,8 @@ AddSmmuV1V2Nodes (
// Add PMU Interrupt Array // Add PMU Interrupt Array
if ((SmmuNode->NumPmuInterrupts > 0) && if ((SmmuNode->NumPmuInterrupts > 0) &&
(NodeList->PmuInterruptToken != CM_NULL_TOKEN)) { (NodeList->PmuInterruptToken != CM_NULL_TOKEN))
{
Status = AddSmmuInterruptArray ( Status = AddSmmuInterruptArray (
CfgMgrProtocol, CfgMgrProtocol,
PmuInterruptArray, PmuInterruptArray,
@ -1234,9 +1243,10 @@ AddSmmuV1V2Nodes (
} }
if ((NodeList->IdMappingCount > 0) && if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) { (NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for SMMU v1/v2 Node // Ids for SMMU v1/v2 Node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)SmmuNode + IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuNode +
SmmuNode->Node.IdReference); SmmuNode->Node.IdReference);
Status = AddIdMappingArray ( Status = AddIdMappingArray (
This, This,
@ -1254,8 +1264,9 @@ AddSmmuV1V2Nodes (
return Status; return Status;
} }
} }
// Next SMMU v1/v2 Node // Next SMMU v1/v2 Node
SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE*)((UINT8*)SmmuNode + SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE *)((UINT8 *)SmmuNode +
SmmuNode->Node.Length); SmmuNode->Node.Length);
NodeList++; NodeList++;
} // SMMU v1/v2 Node } // SMMU v1/v2 Node
@ -1282,22 +1293,22 @@ AddSmmuV1V2Nodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddSmmuV3Nodes ( AddSmmuV3Nodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_SMMUV3_NODE * NodeList, IN CONST CM_ARM_SMMUV3_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE * SmmuV3Node; EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE *SmmuV3Node;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray; EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
SmmuV3Node = (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE*)((UINT8*)Iort + SmmuV3Node = (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -1341,7 +1352,8 @@ AddSmmuV3Nodes (
} }
if ((SmmuV3Node->Event != 0) && (SmmuV3Node->Pri != 0) && 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, // If all the SMMU control interrupts are GSIV based,
// the DeviceID mapping index field is ignored. // the DeviceID mapping index field is ignored.
SmmuV3Node->DeviceIdMappingIndex = 0; SmmuV3Node->DeviceIdMappingIndex = 0;
@ -1350,9 +1362,10 @@ AddSmmuV3Nodes (
} }
if ((NodeList->IdMappingCount > 0) && if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) { (NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for SMMUv3 node // Ids for SMMUv3 node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)SmmuV3Node + IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuV3Node +
SmmuV3Node->Node.IdReference); SmmuV3Node->Node.IdReference);
Status = AddIdMappingArray ( Status = AddIdMappingArray (
This, This,
@ -1372,7 +1385,7 @@ AddSmmuV3Nodes (
} }
// Next SMMUv3 Node // Next SMMUv3 Node
SmmuV3Node = (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE*)((UINT8*)SmmuV3Node + SmmuV3Node = (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE *)((UINT8 *)SmmuV3Node +
SmmuV3Node->Node.Length); SmmuV3Node->Node.Length);
NodeList++; NodeList++;
} // SMMUv3 Node } // SMMUv3 Node
@ -1399,24 +1412,24 @@ AddSmmuV3Nodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddPmcgNodes ( AddPmcgNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort, IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort,
IN CONST UINT32 NodesStartOffset, IN CONST UINT32 NodesStartOffset,
IN CONST CM_ARM_PMCG_NODE * NodeList, IN CONST CM_ARM_PMCG_NODE *NodeList,
IN UINT32 NodeCount IN UINT32 NodeCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE * PmcgNode; EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE *PmcgNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray; EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *IdMapArray;
ACPI_IORT_GENERATOR * Generator; ACPI_IORT_GENERATOR *Generator;
UINT64 NodeLength; UINT64 NodeLength;
ASSERT (Iort != NULL); ASSERT (Iort != NULL);
Generator = (ACPI_IORT_GENERATOR*)This; Generator = (ACPI_IORT_GENERATOR *)This;
PmcgNode = (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE*)((UINT8*)Iort + PmcgNode = (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE *)((UINT8 *)Iort +
NodesStartOffset); NodesStartOffset);
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
@ -1464,9 +1477,10 @@ AddPmcgNodes (
} }
if ((NodeList->IdMappingCount > 0) && if ((NodeList->IdMappingCount > 0) &&
(NodeList->IdMappingToken != CM_NULL_TOKEN)) { (NodeList->IdMappingToken != CM_NULL_TOKEN))
{
// Ids for PMCG node // Ids for PMCG node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)PmcgNode + IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)PmcgNode +
PmcgNode->Node.IdReference); PmcgNode->Node.IdReference);
Status = AddIdMappingArray ( Status = AddIdMappingArray (
@ -1487,7 +1501,7 @@ AddPmcgNodes (
} }
// Next PMCG Node // Next PMCG Node
PmcgNode = (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE*)((UINT8*)PmcgNode + PmcgNode = (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE *)((UINT8 *)PmcgNode +
PmcgNode->Node.Length); PmcgNode->Node.Length);
NodeList++; NodeList++;
} // PMCG Node } // PMCG Node
@ -1521,10 +1535,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildIortTable ( BuildIortTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1547,16 +1561,16 @@ BuildIortTable (
UINT32 SmmuV3Offset; UINT32 SmmuV3Offset;
UINT32 PmcgOffset; UINT32 PmcgOffset;
CM_ARM_ITS_GROUP_NODE * ItsGroupNodeList; CM_ARM_ITS_GROUP_NODE *ItsGroupNodeList;
CM_ARM_NAMED_COMPONENT_NODE * NamedComponentNodeList; CM_ARM_NAMED_COMPONENT_NODE *NamedComponentNodeList;
CM_ARM_ROOT_COMPLEX_NODE * RootComplexNodeList; CM_ARM_ROOT_COMPLEX_NODE *RootComplexNodeList;
CM_ARM_SMMUV1_SMMUV2_NODE * SmmuV1V2NodeList; CM_ARM_SMMUV1_SMMUV2_NODE *SmmuV1V2NodeList;
CM_ARM_SMMUV3_NODE * SmmuV3NodeList; CM_ARM_SMMUV3_NODE *SmmuV3NodeList;
CM_ARM_PMCG_NODE * PmcgNodeList; CM_ARM_PMCG_NODE *PmcgNodeList;
EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort; EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort;
IORT_NODE_INDEXER * NodeIndexer; IORT_NODE_INDEXER *NodeIndexer;
ACPI_IORT_GENERATOR * Generator; ACPI_IORT_GENERATOR *Generator;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -1566,7 +1580,8 @@ BuildIortTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: IORT: Requested table revision = %d, is not supported." "ERROR: IORT: Requested table revision = %d, is not supported."
@ -1578,7 +1593,7 @@ BuildIortTable (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Generator = (ACPI_IORT_GENERATOR*)This; Generator = (ACPI_IORT_GENERATOR *)This;
*Table = NULL; *Table = NULL;
// Get the ITS group node info // Get the ITS group node info
@ -1696,7 +1711,7 @@ BuildIortTable (
IortNodeCount += PmcgNodeCount; IortNodeCount += PmcgNodeCount;
// Allocate Node Indexer array // Allocate Node Indexer array
NodeIndexer = (IORT_NODE_INDEXER*)AllocateZeroPool ( NodeIndexer = (IORT_NODE_INDEXER *)AllocateZeroPool (
(sizeof (IORT_NODE_INDEXER) * (sizeof (IORT_NODE_INDEXER) *
IortNodeCount) IortNodeCount)
); );
@ -1737,6 +1752,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1767,6 +1783,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1797,6 +1814,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1827,6 +1845,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1857,6 +1876,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1887,6 +1907,7 @@ BuildIortTable (
)); ));
goto error_handler; goto error_handler;
} }
TableSize += NodeSize; TableSize += NodeSize;
DEBUG (( DEBUG ((
@ -1920,7 +1941,7 @@ BuildIortTable (
} }
// Allocate the Buffer for IORT table // Allocate the Buffer for IORT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -1933,7 +1954,7 @@ BuildIortTable (
goto error_handler; goto error_handler;
} }
Iort = (EFI_ACPI_6_0_IO_REMAPPING_TABLE*)*Table; Iort = (EFI_ACPI_6_0_IO_REMAPPING_TABLE *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -2089,6 +2110,7 @@ error_handler:
FreePool (*Table); FreePool (*Table);
*Table = NULL; *Table = NULL;
} }
return Status; return Status;
} }
@ -2106,20 +2128,21 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeIortTableResources ( FreeIortTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ACPI_IORT_GENERATOR * Generator; ACPI_IORT_GENERATOR *Generator;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID); ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
Generator = (ACPI_IORT_GENERATOR*)This; Generator = (ACPI_IORT_GENERATOR *)This;
// Free any memory allocated by the generator // Free any memory allocated by the generator
if (Generator->NodeIndexer != NULL) { if (Generator->NodeIndexer != NULL) {
@ -2195,10 +2218,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiIortLibConstructor ( AcpiIortLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&IortGenerator.Header); Status = RegisterAcpiTableGenerator (&IortGenerator.Header);
DEBUG ((DEBUG_INFO, "IORT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "IORT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -2218,10 +2242,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiIortLibDestructor ( AcpiIortLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&IortGenerator.Header); Status = DeregisterAcpiTableGenerator (&IortGenerator.Header);
DEBUG ((DEBUG_INFO, "Iort: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "Iort: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -22,7 +22,7 @@ typedef struct IortNodeIndexer {
/// Index token for the Node /// Index token for the Node
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Pointer to the node /// Pointer to the node
VOID * Object; VOID *Object;
/// Node offset from the start of the IORT table /// Node offset from the start of the IORT table
UINT32 Offset; UINT32 Offset;
} IORT_NODE_INDEXER; } IORT_NODE_INDEXER;
@ -36,7 +36,7 @@ typedef struct AcpiIortGenerator {
/// IORT node count /// IORT node count
UINT32 IortNodeCount; UINT32 IortNodeCount;
/// Pointer to the node indexer array /// Pointer to the node indexer array
IORT_NODE_INDEXER * NodeIndexer; IORT_NODE_INDEXER *NodeIndexer;
} ACPI_IORT_GENERATOR; } ACPI_IORT_GENERATOR;
#pragma pack() #pragma pack()

View File

@ -91,8 +91,8 @@ GET_OBJECT_LIST (
STATIC STATIC
VOID VOID
AddGICC ( AddGICC (
IN EFI_ACPI_6_3_GIC_STRUCTURE * CONST Gicc, IN EFI_ACPI_6_3_GIC_STRUCTURE *CONST Gicc,
IN CONST CM_ARM_GICC_INFO * CONST GicCInfo, IN CONST CM_ARM_GICC_INFO *CONST GicCInfo,
IN CONST UINT8 MadtRev IN CONST UINT8 MadtRev
) )
{ {
@ -167,8 +167,8 @@ AddGICC (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsAcpiUidEqual ( IsAcpiUidEqual (
IN CONST VOID * GicCInfo1, IN CONST VOID *GicCInfo1,
IN CONST VOID * GicCInfo2, IN CONST VOID *GicCInfo2,
IN UINTN Index1, IN UINTN Index1,
IN UINTN Index2 IN UINTN Index2
) )
@ -178,8 +178,8 @@ IsAcpiUidEqual (
ASSERT ((GicCInfo1 != NULL) && (GicCInfo2 != NULL)); ASSERT ((GicCInfo1 != NULL) && (GicCInfo2 != NULL));
Uid1 = ((CM_ARM_GICC_INFO*)GicCInfo1)->AcpiProcessorUid; Uid1 = ((CM_ARM_GICC_INFO *)GicCInfo1)->AcpiProcessorUid;
Uid2 = ((CM_ARM_GICC_INFO*)GicCInfo2)->AcpiProcessorUid; Uid2 = ((CM_ARM_GICC_INFO *)GicCInfo2)->AcpiProcessorUid;
if (Uid1 == Uid2) { if (Uid1 == Uid2) {
DEBUG (( DEBUG ((
@ -214,8 +214,8 @@ IsAcpiUidEqual (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGICCList ( AddGICCList (
IN EFI_ACPI_6_3_GIC_STRUCTURE * Gicc, IN EFI_ACPI_6_3_GIC_STRUCTURE *Gicc,
IN CONST CM_ARM_GICC_INFO * GicCInfo, IN CONST CM_ARM_GICC_INFO *GicCInfo,
IN UINT32 GicCCount, IN UINT32 GicCCount,
IN CONST UINT8 MadtRev IN CONST UINT8 MadtRev
) )
@ -252,9 +252,9 @@ AddGICCList (
STATIC STATIC
VOID VOID
AddGICD ( AddGICD (
EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE * CONST Gicd, EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE *CONST Gicd,
CONST CM_ARM_GICD_INFO * CONST GicDInfo CONST CM_ARM_GICD_INFO *CONST GicDInfo
) )
{ {
ASSERT (Gicd != NULL); ASSERT (Gicd != NULL);
ASSERT (GicDInfo != NULL); ASSERT (GicDInfo != NULL);
@ -289,9 +289,9 @@ AddGICD (
STATIC STATIC
VOID VOID
AddGICMsiFrame ( AddGICMsiFrame (
IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE * CONST GicMsiFrame, IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE *CONST GicMsiFrame,
IN CONST CM_ARM_GIC_MSI_FRAME_INFO * CONST GicMsiFrameInfo IN CONST CM_ARM_GIC_MSI_FRAME_INFO *CONST GicMsiFrameInfo
) )
{ {
ASSERT (GicMsiFrame != NULL); ASSERT (GicMsiFrame != NULL);
ASSERT (GicMsiFrameInfo != NULL); ASSERT (GicMsiFrameInfo != NULL);
@ -316,10 +316,10 @@ AddGICMsiFrame (
STATIC STATIC
VOID VOID
AddGICMsiFrameInfoList ( AddGICMsiFrameInfoList (
IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE * GicMsiFrame, IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE *GicMsiFrame,
IN CONST CM_ARM_GIC_MSI_FRAME_INFO * GicMsiFrameInfo, IN CONST CM_ARM_GIC_MSI_FRAME_INFO *GicMsiFrameInfo,
IN UINT32 GicMsiFrameCount IN UINT32 GicMsiFrameCount
) )
{ {
ASSERT (GicMsiFrame != NULL); ASSERT (GicMsiFrame != NULL);
ASSERT (GicMsiFrameInfo != NULL); ASSERT (GicMsiFrameInfo != NULL);
@ -337,8 +337,8 @@ AddGICMsiFrameInfoList (
STATIC STATIC
VOID VOID
AddGICRedistributor ( AddGICRedistributor (
IN EFI_ACPI_6_3_GICR_STRUCTURE * CONST Gicr, IN EFI_ACPI_6_3_GICR_STRUCTURE *CONST Gicr,
IN CONST CM_ARM_GIC_REDIST_INFO * CONST GicRedistributorInfo IN CONST CM_ARM_GIC_REDIST_INFO *CONST GicRedistributorInfo
) )
{ {
ASSERT (Gicr != NULL); ASSERT (Gicr != NULL);
@ -361,10 +361,10 @@ AddGICRedistributor (
STATIC STATIC
VOID VOID
AddGICRedistributorList ( AddGICRedistributorList (
IN EFI_ACPI_6_3_GICR_STRUCTURE * Gicr, IN EFI_ACPI_6_3_GICR_STRUCTURE *Gicr,
IN CONST CM_ARM_GIC_REDIST_INFO * GicRInfo, IN CONST CM_ARM_GIC_REDIST_INFO *GicRInfo,
IN UINT32 GicRCount IN UINT32 GicRCount
) )
{ {
ASSERT (Gicr != NULL); ASSERT (Gicr != NULL);
ASSERT (GicRInfo != NULL); ASSERT (GicRInfo != NULL);
@ -382,9 +382,9 @@ AddGICRedistributorList (
STATIC STATIC
VOID VOID
AddGICInterruptTranslationService ( AddGICInterruptTranslationService (
IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE * CONST GicIts, IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE *CONST GicIts,
IN CONST CM_ARM_GIC_ITS_INFO * CONST GicItsInfo IN CONST CM_ARM_GIC_ITS_INFO *CONST GicItsInfo
) )
{ {
ASSERT (GicIts != NULL); ASSERT (GicIts != NULL);
ASSERT (GicItsInfo != NULL); ASSERT (GicItsInfo != NULL);
@ -407,10 +407,10 @@ AddGICInterruptTranslationService (
STATIC STATIC
VOID VOID
AddGICItsList ( AddGICItsList (
IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE * GicIts, IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE *GicIts,
IN CONST CM_ARM_GIC_ITS_INFO * GicItsInfo, IN CONST CM_ARM_GIC_ITS_INFO *GicItsInfo,
IN UINT32 GicItsCount IN UINT32 GicItsCount
) )
{ {
ASSERT (GicIts != NULL); ASSERT (GicIts != NULL);
ASSERT (GicItsInfo != NULL); ASSERT (GicItsInfo != NULL);
@ -446,10 +446,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildMadtTable ( BuildMadtTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -459,18 +459,18 @@ BuildMadtTable (
UINT32 GicMSICount; UINT32 GicMSICount;
UINT32 GicRedistCount; UINT32 GicRedistCount;
UINT32 GicItsCount; UINT32 GicItsCount;
CM_ARM_GICC_INFO * GicCInfo; CM_ARM_GICC_INFO *GicCInfo;
CM_ARM_GICD_INFO * GicDInfo; CM_ARM_GICD_INFO *GicDInfo;
CM_ARM_GIC_MSI_FRAME_INFO * GicMSIInfo; CM_ARM_GIC_MSI_FRAME_INFO *GicMSIInfo;
CM_ARM_GIC_REDIST_INFO * GicRedistInfo; CM_ARM_GIC_REDIST_INFO *GicRedistInfo;
CM_ARM_GIC_ITS_INFO * GicItsInfo; CM_ARM_GIC_ITS_INFO *GicItsInfo;
UINT32 GicCOffset; UINT32 GicCOffset;
UINT32 GicDOffset; UINT32 GicDOffset;
UINT32 GicMSIOffset; UINT32 GicMSIOffset;
UINT32 GicRedistOffset; UINT32 GicRedistOffset;
UINT32 GicItsOffset; UINT32 GicItsOffset;
EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER * Madt; EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -480,7 +480,8 @@ BuildMadtTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: MADT: Requested table revision = %d, is not supported." "ERROR: MADT: Requested table revision = %d, is not supported."
@ -619,7 +620,7 @@ BuildMadtTable (
TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE) * GicItsCount); TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE) * GicItsCount);
// Allocate the Buffer for MADT table // Allocate the Buffer for MADT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -632,7 +633,7 @@ BuildMadtTable (
goto error_handler; goto error_handler;
} }
Madt = (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER*)*Table; Madt = (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -658,7 +659,7 @@ BuildMadtTable (
} }
Status = AddGICCList ( Status = AddGICCList (
(EFI_ACPI_6_3_GIC_STRUCTURE*)((UINT8*)Madt + GicCOffset), (EFI_ACPI_6_3_GIC_STRUCTURE *)((UINT8 *)Madt + GicCOffset),
GicCInfo, GicCInfo,
GicCCount, GicCCount,
Madt->Header.Revision Madt->Header.Revision
@ -673,13 +674,13 @@ BuildMadtTable (
} }
AddGICD ( AddGICD (
(EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE*)((UINT8*)Madt + GicDOffset), (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE *)((UINT8 *)Madt + GicDOffset),
GicDInfo GicDInfo
); );
if (GicMSICount != 0) { if (GicMSICount != 0) {
AddGICMsiFrameInfoList ( AddGICMsiFrameInfoList (
(EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE*)((UINT8*)Madt + GicMSIOffset), (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE *)((UINT8 *)Madt + GicMSIOffset),
GicMSIInfo, GicMSIInfo,
GicMSICount GicMSICount
); );
@ -687,7 +688,7 @@ BuildMadtTable (
if (GicRedistCount != 0) { if (GicRedistCount != 0) {
AddGICRedistributorList ( AddGICRedistributorList (
(EFI_ACPI_6_3_GICR_STRUCTURE*)((UINT8*)Madt + GicRedistOffset), (EFI_ACPI_6_3_GICR_STRUCTURE *)((UINT8 *)Madt + GicRedistOffset),
GicRedistInfo, GicRedistInfo,
GicRedistCount GicRedistCount
); );
@ -695,7 +696,7 @@ BuildMadtTable (
if (GicItsCount != 0) { if (GicItsCount != 0) {
AddGICItsList ( AddGICItsList (
(EFI_ACPI_6_3_GIC_ITS_STRUCTURE*)((UINT8*)Madt + GicItsOffset), (EFI_ACPI_6_3_GIC_ITS_STRUCTURE *)((UINT8 *)Madt + GicItsOffset),
GicItsInfo, GicItsInfo,
GicItsCount GicItsCount
); );
@ -708,6 +709,7 @@ error_handler:
FreePool (*Table); FreePool (*Table);
*Table = NULL; *Table = NULL;
} }
return Status; return Status;
} }
@ -725,10 +727,10 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeMadtTableResources ( FreeMadtTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT (This != NULL); ASSERT (This != NULL);
@ -796,10 +798,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiMadtLibConstructor ( AcpiMadtLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&MadtGenerator); Status = RegisterAcpiTableGenerator (&MadtGenerator);
DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -819,10 +822,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiMadtLibDestructor ( AcpiMadtLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&MadtGenerator); Status = DeregisterAcpiTableGenerator (&MadtGenerator);
DEBUG ((DEBUG_INFO, "MADT: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "MADT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -68,18 +68,18 @@ GET_OBJECT_LIST (
STATIC STATIC
VOID VOID
AddPciConfigurationSpaceList ( AddPciConfigurationSpaceList (
IN MCFG_TABLE * CONST Mcfg, IN MCFG_TABLE *CONST Mcfg,
IN CONST UINT32 PciCfgSpaceOffset, IN CONST UINT32 PciCfgSpaceOffset,
IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO * PciCfgSpaceInfoList, IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciCfgSpaceInfoList,
IN UINT32 PciCfgSpaceCount IN UINT32 PciCfgSpaceCount
) )
{ {
MCFG_CFG_SPACE_ADDR * PciCfgSpace; MCFG_CFG_SPACE_ADDR *PciCfgSpace;
ASSERT (Mcfg != NULL); ASSERT (Mcfg != NULL);
ASSERT (PciCfgSpaceInfoList != NULL); ASSERT (PciCfgSpaceInfoList != NULL);
PciCfgSpace = (MCFG_CFG_SPACE_ADDR *)((UINT8*)Mcfg + PciCfgSpaceOffset); PciCfgSpace = (MCFG_CFG_SPACE_ADDR *)((UINT8 *)Mcfg + PciCfgSpaceOffset);
while (PciCfgSpaceCount-- != 0) { while (PciCfgSpaceCount-- != 0) {
// Add PCI Configuration Space entry // Add PCI Configuration Space entry
@ -120,17 +120,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildMcfgTable ( BuildMcfgTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 TableSize; UINT32 TableSize;
UINT32 ConfigurationSpaceCount; UINT32 ConfigurationSpaceCount;
CM_ARM_PCI_CONFIG_SPACE_INFO * PciConfigSpaceInfoList; CM_ARM_PCI_CONFIG_SPACE_INFO *PciConfigSpaceInfoList;
MCFG_TABLE * Mcfg; MCFG_TABLE *Mcfg;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -140,7 +140,8 @@ BuildMcfgTable (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: MCFG: Requested table revision = %d, is not supported." "ERROR: MCFG: Requested table revision = %d, is not supported."
@ -160,7 +161,8 @@ BuildMcfgTable (
&ConfigurationSpaceCount &ConfigurationSpaceCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, DEBUG ((
DEBUG_ERROR,
"ERROR: MCFG: Failed to get PCI Configuration Space Information." \ "ERROR: MCFG: Failed to get PCI Configuration Space Information." \
" Status = %r\n", " Status = %r\n",
Status Status
@ -189,7 +191,7 @@ BuildMcfgTable (
TableSize = sizeof (MCFG_TABLE) + TableSize = sizeof (MCFG_TABLE) +
((sizeof (MCFG_CFG_SPACE_ADDR) * ConfigurationSpaceCount)); ((sizeof (MCFG_CFG_SPACE_ADDR) * ConfigurationSpaceCount));
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -202,7 +204,7 @@ BuildMcfgTable (
goto error_handler; goto error_handler;
} }
Mcfg = (MCFG_TABLE*)*Table; Mcfg = (MCFG_TABLE *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"MCFG: Mcfg = 0x%p TableSize = 0x%x\n", "MCFG: Mcfg = 0x%p TableSize = 0x%x\n",
@ -242,6 +244,7 @@ error_handler:
FreePool (*Table); FreePool (*Table);
*Table = NULL; *Table = NULL;
} }
return Status; return Status;
} }
@ -259,10 +262,10 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeMcfgTableResources ( FreeMcfgTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT (This != NULL); ASSERT (This != NULL);
@ -330,10 +333,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiMcfgLibConstructor ( AcpiMcfgLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&McfgGenerator); Status = RegisterAcpiTableGenerator (&McfgGenerator);
DEBUG ((DEBUG_INFO, "MCFG: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "MCFG: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -353,10 +357,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiMcfgLibDestructor ( AcpiMcfgLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&McfgGenerator); Status = DeregisterAcpiTableGenerator (&McfgGenerator);
DEBUG ((DEBUG_INFO, "MCFG: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "MCFG: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -101,7 +101,7 @@ GET_OBJECT_LIST (
STATIC STATIC
UINT32 UINT32
GetProcHierarchyNodeSize ( GetProcHierarchyNodeSize (
IN CONST CM_ARM_PROC_HIERARCHY_INFO * Node IN CONST CM_ARM_PROC_HIERARCHY_INFO *Node
) )
{ {
ASSERT (Node != NULL); ASSERT (Node != NULL);
@ -157,10 +157,10 @@ GET_SIZE_OF_PPTT_STRUCTS (
STATIC STATIC
EFI_STATUS EFI_STATUS
GetPpttNodeReferencedByToken ( GetPpttNodeReferencedByToken (
IN PPTT_NODE_INDEXER * NodeIndexer, IN PPTT_NODE_INDEXER *NodeIndexer,
IN UINT32 NodeCount, IN UINT32 NodeCount,
IN CONST CM_OBJECT_TOKEN SearchToken, IN CONST CM_OBJECT_TOKEN SearchToken,
OUT PPTT_NODE_INDEXER ** IndexedNodeFound OUT PPTT_NODE_INDEXER **IndexedNodeFound
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -192,6 +192,7 @@ GetPpttNodeReferencedByToken (
)); ));
return Status; return Status;
} }
NodeIndexer++; NodeIndexer++;
} }
@ -218,12 +219,12 @@ GetPpttNodeReferencedByToken (
STATIC STATIC
EFI_STATUS EFI_STATUS
DetectCyclesInTopology ( DetectCyclesInTopology (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator IN CONST ACPI_PPTT_GENERATOR *CONST Generator
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PPTT_NODE_INDEXER * Iterator; PPTT_NODE_INDEXER *Iterator;
PPTT_NODE_INDEXER * CycleDetector; PPTT_NODE_INDEXER *CycleDetector;
UINT32 NodesRemaining; UINT32 NodesRemaining;
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -293,17 +294,17 @@ DetectCyclesInTopology (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddPrivateResources ( AddPrivateResources (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator, IN CONST ACPI_PPTT_GENERATOR *CONST Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN UINT32 * PrivResArray, IN UINT32 *PrivResArray,
IN UINT32 PrivResCount, IN UINT32 PrivResCount,
IN CONST CM_OBJECT_TOKEN PrivResArrayToken IN CONST CM_OBJECT_TOKEN PrivResArrayToken
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_OBJ_REF * CmObjRefs; CM_ARM_OBJ_REF *CmObjRefs;
UINT32 CmObjRefCount; UINT32 CmObjRefCount;
PPTT_NODE_INDEXER * PpttNodeFound; PPTT_NODE_INDEXER *PpttNodeFound;
ASSERT ( ASSERT (
(Generator != NULL) && (Generator != NULL) &&
@ -422,32 +423,33 @@ AddPrivateResources (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsGicCTokenEqual ( IsGicCTokenEqual (
IN CONST VOID * Object1, IN CONST VOID *Object1,
IN CONST VOID * Object2, IN CONST VOID *Object2,
IN UINTN Index1, IN UINTN Index1,
IN UINTN Index2 IN UINTN Index2
) )
{ {
PPTT_NODE_INDEXER * IndexedObject1; PPTT_NODE_INDEXER *IndexedObject1;
PPTT_NODE_INDEXER * IndexedObject2; PPTT_NODE_INDEXER *IndexedObject2;
CM_ARM_PROC_HIERARCHY_INFO * ProcNode1; CM_ARM_PROC_HIERARCHY_INFO *ProcNode1;
CM_ARM_PROC_HIERARCHY_INFO * ProcNode2; CM_ARM_PROC_HIERARCHY_INFO *ProcNode2;
ASSERT ( ASSERT (
(Object1 != NULL) && (Object1 != NULL) &&
(Object2 != NULL) (Object2 != NULL)
); );
IndexedObject1 = (PPTT_NODE_INDEXER*)Object1; IndexedObject1 = (PPTT_NODE_INDEXER *)Object1;
IndexedObject2 = (PPTT_NODE_INDEXER*)Object2; IndexedObject2 = (PPTT_NODE_INDEXER *)Object2;
ProcNode1 = (CM_ARM_PROC_HIERARCHY_INFO*)IndexedObject1->Object; ProcNode1 = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject1->Object;
ProcNode2 = (CM_ARM_PROC_HIERARCHY_INFO*)IndexedObject2->Object; ProcNode2 = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject2->Object;
if (IS_ACPI_PROC_ID_VALID (ProcNode1) && if (IS_ACPI_PROC_ID_VALID (ProcNode1) &&
IS_ACPI_PROC_ID_VALID (ProcNode2) && IS_ACPI_PROC_ID_VALID (ProcNode2) &&
(ProcNode1->GicCToken != CM_NULL_TOKEN) && (ProcNode1->GicCToken != CM_NULL_TOKEN) &&
(ProcNode2->GicCToken != CM_NULL_TOKEN) && (ProcNode2->GicCToken != CM_NULL_TOKEN) &&
(ProcNode1->GicCToken == ProcNode2->GicCToken)) { (ProcNode1->GicCToken == ProcNode2->GicCToken))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: PPTT: Two Processor Hierarchy Info objects (%d and %d) map to " \ "ERROR: PPTT: Two Processor Hierarchy Info objects (%d and %d) map to " \
@ -484,25 +486,25 @@ IsGicCTokenEqual (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddProcHierarchyNodes ( AddProcHierarchyNodes (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator, IN CONST ACPI_PPTT_GENERATOR *CONST Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt, IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt,
IN CONST UINT32 NodesStartOffset IN CONST UINT32 NodesStartOffset
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR * ProcStruct; EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *ProcStruct;
UINT32 * PrivateResources; UINT32 *PrivateResources;
BOOLEAN IsGicCTokenDuplicated; BOOLEAN IsGicCTokenDuplicated;
CM_ARM_GICC_INFO * GicCInfoList; CM_ARM_GICC_INFO *GicCInfoList;
UINT32 GicCInfoCount; UINT32 GicCInfoCount;
UINT32 UniqueGicCRefCount; UINT32 UniqueGicCRefCount;
PPTT_NODE_INDEXER * PpttNodeFound; PPTT_NODE_INDEXER *PpttNodeFound;
CM_ARM_PROC_HIERARCHY_INFO * ProcInfoNode; CM_ARM_PROC_HIERARCHY_INFO *ProcInfoNode;
PPTT_NODE_INDEXER * ProcNodeIterator; PPTT_NODE_INDEXER *ProcNodeIterator;
UINT32 NodeCount; UINT32 NodeCount;
UINT32 Length; UINT32 Length;
@ -512,7 +514,7 @@ AddProcHierarchyNodes (
(Pptt != NULL) (Pptt != NULL)
); );
ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR*)((UINT8*)Pptt + ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *)((UINT8 *)Pptt +
NodesStartOffset); NodesStartOffset);
ProcNodeIterator = Generator->ProcHierarchyNodeIndexedList; ProcNodeIterator = Generator->ProcHierarchyNodeIndexedList;
@ -534,7 +536,7 @@ AddProcHierarchyNodes (
UniqueGicCRefCount = 0; UniqueGicCRefCount = 0;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO*)ProcNodeIterator->Object; ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO *)ProcNodeIterator->Object;
// Check if the private resource count is within the size limit // Check if the private resource count is within the size limit
// imposed on the Processor Hierarchy node by the specification. // imposed on the Processor Hierarchy node by the specification.
@ -594,7 +596,9 @@ AddProcHierarchyNodes (
// Test if the reference is to a 'leaf' node // Test if the reference is to a 'leaf' node
if (IS_PROC_NODE_LEAF ( if (IS_PROC_NODE_LEAF (
((CM_ARM_PROC_HIERARCHY_INFO*)PpttNodeFound->Object))) { ((CM_ARM_PROC_HIERARCHY_INFO *)PpttNodeFound->Object)
))
{
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -676,7 +680,7 @@ AddProcHierarchyNodes (
} }
ProcStruct->NumberOfPrivateResources = ProcInfoNode->NoOfPrivateResources; ProcStruct->NumberOfPrivateResources = ProcInfoNode->NoOfPrivateResources;
PrivateResources = (UINT32*)((UINT8*)ProcStruct + PrivateResources = (UINT32 *)((UINT8 *)ProcStruct +
sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR)); sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR));
if (ProcStruct->NumberOfPrivateResources != 0) { if (ProcStruct->NumberOfPrivateResources != 0) {
@ -700,7 +704,7 @@ AddProcHierarchyNodes (
} }
// Next Processor Hierarchy Node // Next Processor Hierarchy Node
ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR*)((UINT8*)ProcStruct + ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *)((UINT8 *)ProcStruct +
ProcStruct->Length); ProcStruct->Length);
ProcNodeIterator++; ProcNodeIterator++;
} // Processor Hierarchy Node } // Processor Hierarchy Node
@ -762,17 +766,17 @@ AddProcHierarchyNodes (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddCacheTypeStructures ( AddCacheTypeStructures (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator, IN CONST ACPI_PPTT_GENERATOR *CONST Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt, IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt,
IN CONST UINT32 NodesStartOffset IN CONST UINT32 NodesStartOffset
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE * CacheStruct; EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *CacheStruct;
PPTT_NODE_INDEXER * PpttNodeFound; PPTT_NODE_INDEXER *PpttNodeFound;
CM_ARM_CACHE_INFO * CacheInfoNode; CM_ARM_CACHE_INFO *CacheInfoNode;
PPTT_NODE_INDEXER * CacheNodeIterator; PPTT_NODE_INDEXER *CacheNodeIterator;
UINT32 NodeCount; UINT32 NodeCount;
ASSERT ( ASSERT (
@ -781,14 +785,14 @@ AddCacheTypeStructures (
(Pptt != NULL) (Pptt != NULL)
); );
CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE*)((UINT8*)Pptt + CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *)((UINT8 *)Pptt +
NodesStartOffset); NodesStartOffset);
CacheNodeIterator = Generator->CacheStructIndexedList; CacheNodeIterator = Generator->CacheStructIndexedList;
NodeCount = Generator->CacheStructCount; NodeCount = Generator->CacheStructCount;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
CacheInfoNode = (CM_ARM_CACHE_INFO*)CacheNodeIterator->Object; CacheInfoNode = (CM_ARM_CACHE_INFO *)CacheNodeIterator->Object;
// Populate the node header // Populate the node header
CacheStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_CACHE; CacheStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_CACHE;
@ -886,7 +890,7 @@ AddCacheTypeStructures (
// current ACPI specification. // current ACPI specification.
// These checks will be needed in the future when the ACPI specification // These checks will be needed in the future when the ACPI specification
// is extended. Disabling this code for now. // is extended. Disabling this code for now.
#if 0 #if 0
if (CacheInfoNode->Associativity > PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX) { if (CacheInfoNode->Associativity > PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX) {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
DEBUG (( DEBUG ((
@ -909,7 +913,8 @@ AddCacheTypeStructures (
CacheInfoNode->Associativity CacheInfoNode->Associativity
)); ));
} }
#endif
#endif
// Note a typecast is needed as the maximum associativity // Note a typecast is needed as the maximum associativity
// supported by ACPI Cache type structure is MAX_UINT8. // supported by ACPI Cache type structure is MAX_UINT8.
@ -926,13 +931,13 @@ AddCacheTypeStructures (
// Validate and populate cache line size // Validate and populate cache line size
if ((CacheInfoNode->LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) || 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; Status = EFI_INVALID_PARAMETER;
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: PPTT: The cache line size must be between %d and %d bytes " \ "ERROR: PPTT: The cache line size must be between %d and %d bytes " \
"on ARM Platforms. LineSize = %d. Status = %r\n" , "on ARM Platforms. LineSize = %d. Status = %r\n",
PPTT_ARM_CACHE_LINE_SIZE_MIN, PPTT_ARM_CACHE_LINE_SIZE_MIN,
PPTT_ARM_CACHE_LINE_SIZE_MAX, PPTT_ARM_CACHE_LINE_SIZE_MAX,
CacheInfoNode->LineSize, CacheInfoNode->LineSize,
@ -946,7 +951,7 @@ AddCacheTypeStructures (
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: PPTT: The cache line size is not a power of 2. " \ "ERROR: PPTT: The cache line size is not a power of 2. " \
"LineSize = %d. Status = %r\n" , "LineSize = %d. Status = %r\n",
CacheInfoNode->LineSize, CacheInfoNode->LineSize,
Status Status
)); ));
@ -956,7 +961,7 @@ AddCacheTypeStructures (
CacheStruct->LineSize = CacheInfoNode->LineSize; CacheStruct->LineSize = CacheInfoNode->LineSize;
// Next Cache Type Structure // Next Cache Type Structure
CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE*)((UINT8*)CacheStruct + CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *)((UINT8 *)CacheStruct +
CacheStruct->Length); CacheStruct->Length);
CacheNodeIterator++; CacheNodeIterator++;
} // Cache Type Structure } // Cache Type Structure
@ -984,30 +989,29 @@ AddCacheTypeStructures (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddIdTypeStructures ( AddIdTypeStructures (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator, IN CONST ACPI_PPTT_GENERATOR *CONST Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt, IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt,
IN CONST UINT32 NodesStartOffset IN CONST UINT32 NodesStartOffset
) )
{ {
EFI_ACPI_6_3_PPTT_STRUCTURE_ID * IdStruct; EFI_ACPI_6_3_PPTT_STRUCTURE_ID *IdStruct;
CM_ARM_PROC_NODE_ID_INFO * ProcIdInfoNode; CM_ARM_PROC_NODE_ID_INFO *ProcIdInfoNode;
PPTT_NODE_INDEXER * IdStructIterator; PPTT_NODE_INDEXER *IdStructIterator;
UINT32 NodeCount; UINT32 NodeCount;
ASSERT ( ASSERT (
(Generator != NULL) && (Generator != NULL) &&
(CfgMgrProtocol != NULL) && (CfgMgrProtocol != NULL) &&
(Pptt != NULL) (Pptt != NULL)
); );
IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID*)((UINT8*)Pptt + NodesStartOffset); IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID *)((UINT8 *)Pptt + NodesStartOffset);
IdStructIterator = Generator->IdStructIndexedList; IdStructIterator = Generator->IdStructIndexedList;
NodeCount = Generator->IdStructCount; NodeCount = Generator->IdStructCount;
while (NodeCount-- != 0) { while (NodeCount-- != 0) {
ProcIdInfoNode = (CM_ARM_PROC_NODE_ID_INFO*)IdStructIterator->Object; ProcIdInfoNode = (CM_ARM_PROC_NODE_ID_INFO *)IdStructIterator->Object;
// Populate the node // Populate the node
IdStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_ID; IdStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_ID;
@ -1022,7 +1026,7 @@ AddIdTypeStructures (
IdStruct->SpinRev = ProcIdInfoNode->SpinRev; IdStruct->SpinRev = ProcIdInfoNode->SpinRev;
// Next ID Type Structure // Next ID Type Structure
IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID*)((UINT8*)IdStruct + IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID *)((UINT8 *)IdStruct +
IdStruct->Length); IdStruct->Length);
IdStructIterator++; IdStructIterator++;
} // ID Type Structure } // ID Type Structure
@ -1057,10 +1061,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildPpttTable ( BuildPpttTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1074,16 +1078,16 @@ BuildPpttTable (
UINT32 CacheStructOffset; UINT32 CacheStructOffset;
UINT32 IdStructOffset; UINT32 IdStructOffset;
CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeList; CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
CM_ARM_CACHE_INFO * CacheStructList; CM_ARM_CACHE_INFO *CacheStructList;
CM_ARM_PROC_NODE_ID_INFO * IdStructList; CM_ARM_PROC_NODE_ID_INFO *IdStructList;
ACPI_PPTT_GENERATOR * Generator; ACPI_PPTT_GENERATOR *Generator;
// Pointer to the Node Indexer array // Pointer to the Node Indexer array
PPTT_NODE_INDEXER * NodeIndexer; PPTT_NODE_INDEXER *NodeIndexer;
EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt; EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt;
ASSERT ( ASSERT (
(This != NULL) && (This != NULL) &&
@ -1095,7 +1099,8 @@ BuildPpttTable (
); );
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: PPTT: Requested table revision = %d is not supported. " "ERROR: PPTT: Requested table revision = %d is not supported. "
@ -1107,7 +1112,7 @@ BuildPpttTable (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Generator = (ACPI_PPTT_GENERATOR*)This; Generator = (ACPI_PPTT_GENERATOR *)This;
*Table = NULL; *Table = NULL;
// Get the processor hierarchy info and update the processor topology // Get the processor hierarchy info and update the processor topology
@ -1172,7 +1177,7 @@ BuildPpttTable (
Generator->IdStructCount = IdStructCount; Generator->IdStructCount = IdStructCount;
// Allocate Node Indexer array // Allocate Node Indexer array
NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool ( NodeIndexer = (PPTT_NODE_INDEXER *)AllocateZeroPool (
sizeof (PPTT_NODE_INDEXER) * sizeof (PPTT_NODE_INDEXER) *
ProcTopologyStructCount ProcTopologyStructCount
); );
@ -1213,7 +1218,6 @@ BuildPpttTable (
ProcHierarchyNodeOffset, ProcHierarchyNodeOffset,
Generator->ProcHierarchyNodeIndexedList Generator->ProcHierarchyNodeIndexedList
)); ));
} }
// Include the size of Cache Type Structures and index them // Include the size of Cache Type Structures and index them
@ -1268,7 +1272,7 @@ BuildPpttTable (
)); ));
// Allocate the Buffer for the PPTT table // Allocate the Buffer for the PPTT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -1281,7 +1285,7 @@ BuildPpttTable (
goto error_handler; goto error_handler;
} }
Pptt = (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER*)*Table; Pptt = (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -1403,13 +1407,13 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreePpttTableResources ( FreePpttTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ACPI_PPTT_GENERATOR * Generator; ACPI_PPTT_GENERATOR *Generator;
ASSERT ( ASSERT (
(This != NULL) && (This != NULL) &&
@ -1419,7 +1423,7 @@ FreePpttTableResources (
(AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature) (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
); );
Generator = (ACPI_PPTT_GENERATOR*)This; Generator = (ACPI_PPTT_GENERATOR *)This;
// Free any memory allocated by the generator // Free any memory allocated by the generator
if (Generator->NodeIndexer != NULL) { if (Generator->NodeIndexer != NULL) {
@ -1505,10 +1509,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiPpttLibConstructor ( AcpiPpttLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&PpttGenerator.Header); Status = RegisterAcpiTableGenerator (&PpttGenerator.Header);
DEBUG ((DEBUG_INFO, "PPTT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "PPTT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -1529,10 +1534,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiPpttLibDestructor ( AcpiPpttLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&PpttGenerator.Header); Status = DeregisterAcpiTableGenerator (&PpttGenerator.Header);
DEBUG ((DEBUG_INFO, "PPTT: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "PPTT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -93,7 +93,7 @@
PpttObjName, \ PpttObjName, \
PpttObjSize, \ PpttObjSize, \
CmObjectType \ CmObjectType \
) \ ) \
STATIC \ STATIC \
UINT32 \ UINT32 \
GetSizeof##PpttObjName ( \ GetSizeof##PpttObjName ( \
@ -148,7 +148,7 @@ typedef struct PpttNodeIndexer {
/// Unique identifier for the node /// Unique identifier for the node
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Pointer to the CM object being indexed /// Pointer to the CM object being indexed
VOID * Object; VOID *Object;
/// Offset from the start of the PPTT table to the PPTT structure which is /// Offset from the start of the PPTT table to the PPTT structure which is
/// represented by Object /// represented by Object
UINT32 Offset; UINT32 Offset;
@ -159,7 +159,7 @@ typedef struct PpttNodeIndexer {
/// Indexer element in the processor and cache topology /// Indexer element in the processor and cache topology
/// e.g For a hardware thread the TopologyParent would point to a CPU node /// e.g For a hardware thread the TopologyParent would point to a CPU node
/// For a L1 cache the TopologyParent would point to a L2 cache /// For a L1 cache the TopologyParent would point to a L2 cache
struct PpttNodeIndexer * TopologyParent; struct PpttNodeIndexer *TopologyParent;
} PPTT_NODE_INDEXER; } PPTT_NODE_INDEXER;
typedef struct AcpiPpttGenerator { typedef struct AcpiPpttGenerator {
@ -174,14 +174,14 @@ typedef struct AcpiPpttGenerator {
/// Count of Id Structures /// Count of Id Structures
UINT32 IdStructCount; UINT32 IdStructCount;
/// List of indexed CM objects for PPTT generation /// List of indexed CM objects for PPTT generation
PPTT_NODE_INDEXER * NodeIndexer; PPTT_NODE_INDEXER *NodeIndexer;
/// Pointer to the start of Processor Hierarchy nodes in /// Pointer to the start of Processor Hierarchy nodes in
/// the Node Indexer array /// the Node Indexer array
PPTT_NODE_INDEXER * ProcHierarchyNodeIndexedList; PPTT_NODE_INDEXER *ProcHierarchyNodeIndexedList;
/// Pointer to the start of Cache Structures in the Node Indexer array /// Pointer to the start of Cache Structures in the Node Indexer array
PPTT_NODE_INDEXER * CacheStructIndexedList; PPTT_NODE_INDEXER *CacheStructIndexedList;
/// Pointer to the start of Id Structures in the Node Indexer array /// Pointer to the start of Id Structures in the Node Indexer array
PPTT_NODE_INDEXER * IdStructIndexedList; PPTT_NODE_INDEXER *IdStructIndexedList;
} ACPI_PPTT_GENERATOR; } ACPI_PPTT_GENERATOR;
#pragma pack() #pragma pack()

View File

@ -38,10 +38,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildRawTable ( BuildRawTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT (This != NULL); ASSERT (This != NULL);
@ -110,10 +110,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiRawLibConstructor ( AcpiRawLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&RawGenerator); Status = RegisterAcpiTableGenerator (&RawGenerator);
DEBUG ((DEBUG_INFO, "RAW: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "RAW: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -133,10 +134,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiRawLibDestructor ( AcpiRawLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&RawGenerator); Status = DeregisterAcpiTableGenerator (&RawGenerator);
DEBUG ((DEBUG_INFO, "RAW: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "RAW: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -120,15 +120,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeSpcrTableEx ( FreeSpcrTableEx (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table,
IN CONST UINTN TableCount IN CONST UINTN TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -138,7 +138,8 @@ FreeSpcrTableEx (
if ((Table == NULL) || if ((Table == NULL) ||
(*Table == NULL) || (*Table == NULL) ||
(TableCount != 2)) { (TableCount != 2))
{
DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid Table Pointer\n")); DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -147,7 +148,8 @@ FreeSpcrTableEx (
if ((TableList[1] == NULL) || if ((TableList[1] == NULL) ||
(TableList[1]->Signature != (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")); DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid SSDT table pointer.\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -191,17 +193,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSpcrTableEx ( BuildSpcrTableEx (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table,
OUT UINTN * CONST TableCount OUT UINTN *CONST TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo; CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
UINT32 SerialPortCount; UINT32 SerialPortCount;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -212,7 +214,8 @@ BuildSpcrTableEx (
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SPCR: Requested table revision = %d, is not supported." "ERROR: SPCR: Requested table revision = %d, is not supported."
@ -264,8 +267,8 @@ BuildSpcrTableEx (
} }
// Allocate a table to store pointers to the SPCR and SSDT tables. // Allocate a table to store pointers to the SPCR and SSDT tables.
TableList = (EFI_ACPI_DESCRIPTION_HEADER**) TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2); AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * 2);
if (TableList == NULL) { if (TableList == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -281,7 +284,7 @@ BuildSpcrTableEx (
Status = AddAcpiHeader ( Status = AddAcpiHeader (
CfgMgrProtocol, CfgMgrProtocol,
This, This,
(EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr, (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr,
AcpiTableInfo, AcpiTableInfo,
sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE) sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)
); );
@ -364,7 +367,7 @@ BuildSpcrTableEx (
goto error_handler; goto error_handler;
} // switch } // switch
TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr; TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr;
// Build a SSDT table describing the serial port. // Build a SSDT table describing the serial port.
Status = BuildSsdtSerialPortTable ( Status = BuildSsdtSerialPortTable (
@ -443,10 +446,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSpcrLibConstructor ( AcpiSpcrLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SpcrGenerator); Status = RegisterAcpiTableGenerator (&SpcrGenerator);
DEBUG ((DEBUG_INFO, "SPCR: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "SPCR: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -466,10 +470,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSpcrLibDestructor ( AcpiSpcrLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SpcrGenerator); Status = DeregisterAcpiTableGenerator (&SpcrGenerator);
DEBUG ((DEBUG_INFO, "SPCR: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "SPCR: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -97,7 +97,6 @@ GET_OBJECT_LIST (
CM_ARM_DEVICE_HANDLE_PCI CM_ARM_DEVICE_HANDLE_PCI
); );
/** Return the PCI Device information in BDF format /** Return the PCI Device information in BDF format
PCI Bus Number - Max 256 busses (Bits 15:8 of BDF) PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
@ -111,10 +110,11 @@ GET_OBJECT_LIST (
STATIC STATIC
UINT16 UINT16
GetBdf ( GetBdf (
IN CONST CM_ARM_DEVICE_HANDLE_PCI * DeviceHandlePci IN CONST CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci
) )
{ {
UINT16 Bdf; UINT16 Bdf;
Bdf = (UINT16)DeviceHandlePci->BusNumber << 8; Bdf = (UINT16)DeviceHandlePci->BusNumber << 8;
Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3; Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3;
Bdf |= DeviceHandlePci->FunctionNumber & 0x7; Bdf |= DeviceHandlePci->FunctionNumber & 0x7;
@ -136,19 +136,19 @@ GetBdf (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGICCAffinity ( AddGICCAffinity (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat,
IN CONST UINT32 GicCAffOffset, IN CONST UINT32 GicCAffOffset,
IN CONST CM_ARM_GICC_INFO * GicCInfo, IN CONST CM_ARM_GICC_INFO *GicCInfo,
IN UINT32 GicCCount IN UINT32 GicCCount
) )
{ {
EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE * GicCAff; EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *GicCAff;
ASSERT (Srat != NULL); ASSERT (Srat != NULL);
ASSERT (GicCInfo != NULL); ASSERT (GicCInfo != NULL);
GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8*)Srat + GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
GicCAffOffset); GicCAffOffset);
while (GicCCount-- != 0) { while (GicCCount-- != 0) {
@ -165,6 +165,7 @@ AddGICCAffinity (
GicCAff++; GicCAff++;
GicCInfo++; GicCInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -183,19 +184,19 @@ AddGICCAffinity (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGICItsAffinity ( AddGICItsAffinity (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat,
IN CONST UINT32 GicItsAffOffset, IN CONST UINT32 GicItsAffOffset,
IN CONST CM_ARM_GIC_ITS_INFO * GicItsInfo, IN CONST CM_ARM_GIC_ITS_INFO *GicItsInfo,
IN UINT32 GicItsCount IN UINT32 GicItsCount
) )
{ {
EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE * GicItsAff; EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *GicItsAff;
ASSERT (Srat != NULL); ASSERT (Srat != NULL);
ASSERT (GicItsInfo != NULL); ASSERT (GicItsInfo != NULL);
GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8*)Srat + GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
GicItsAffOffset); GicItsAffOffset);
while (GicItsCount-- != 0) { while (GicItsCount-- != 0) {
@ -212,6 +213,7 @@ AddGICItsAffinity (
GicItsAff++; GicItsAff++;
GicItsInfo++; GicItsInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -230,19 +232,19 @@ AddGICItsAffinity (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddMemoryAffinity ( AddMemoryAffinity (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat,
IN CONST UINT32 MemAffOffset, IN CONST UINT32 MemAffOffset,
IN CONST CM_ARM_MEMORY_AFFINITY_INFO * MemAffInfo, IN CONST CM_ARM_MEMORY_AFFINITY_INFO *MemAffInfo,
IN UINT32 MemAffCount IN UINT32 MemAffCount
) )
{ {
EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE * MemAff; EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *MemAff;
ASSERT (Srat != NULL); ASSERT (Srat != NULL);
ASSERT (MemAffInfo != NULL); ASSERT (MemAffInfo != NULL);
MemAff = (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *)((UINT8*)Srat + MemAff = (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
MemAffOffset); MemAffOffset);
while (MemAffCount-- != 0) { while (MemAffCount-- != 0) {
@ -264,10 +266,10 @@ AddMemoryAffinity (
MemAff++; MemAff++;
MemAffInfo++; MemAffInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/** Add the Generic Initiator Affinity Structures in the SRAT Table. /** Add the Generic Initiator Affinity Structures in the SRAT Table.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager @param [in] CfgMgrProtocol Pointer to the Configuration Manager
@ -290,24 +292,24 @@ AddMemoryAffinity (
STATIC STATIC
EFI_STATUS EFI_STATUS
AddGenericInitiatorAffinity ( AddGenericInitiatorAffinity (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat, IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat,
IN CONST UINT32 GenInitAffOff, IN CONST UINT32 GenInitAffOff,
IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO * GenInitAffInfo, IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO *GenInitAffInfo,
IN UINT32 GenInitAffCount IN UINT32 GenInitAffCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE * GenInitAff; EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *GenInitAff;
CM_ARM_DEVICE_HANDLE_ACPI * DeviceHandleAcpi; CM_ARM_DEVICE_HANDLE_ACPI *DeviceHandleAcpi;
CM_ARM_DEVICE_HANDLE_PCI * DeviceHandlePci; CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci;
UINT32 DeviceHandleCount; UINT32 DeviceHandleCount;
ASSERT (Srat != NULL); ASSERT (Srat != NULL);
ASSERT (GenInitAffInfo != NULL); ASSERT (GenInitAffInfo != NULL);
GenInitAff = (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *)( GenInitAff = (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *)(
(UINT8*)Srat + GenInitAffOff); (UINT8 *)Srat + GenInitAffOff);
while (GenInitAffCount-- != 0) { while (GenInitAffCount-- != 0) {
DEBUG ((DEBUG_INFO, "SRAT: GenInitAff = 0x%p\n", GenInitAff)); DEBUG ((DEBUG_INFO, "SRAT: GenInitAff = 0x%p\n", GenInitAff));
@ -358,7 +360,8 @@ AddGenericInitiatorAffinity (
GenInitAff->DeviceHandle.Acpi.Reserved[2] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Acpi.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Acpi.Reserved[3] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Acpi.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
} else if (GenInitAffInfo->DeviceHandleType == } else if (GenInitAffInfo->DeviceHandleType ==
EFI_ACPI_6_3_PCI_DEVICE_HANDLE) { EFI_ACPI_6_3_PCI_DEVICE_HANDLE)
{
Status = GetEArmObjDeviceHandlePci ( Status = GetEArmObjDeviceHandlePci (
CfgMgrProtocol, CfgMgrProtocol,
GenInitAffInfo->DeviceHandleToken, GenInitAffInfo->DeviceHandleToken,
@ -413,6 +416,7 @@ AddGenericInitiatorAffinity (
GenInitAff++; GenInitAff++;
GenInitAffInfo++; GenInitAffInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -443,10 +447,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSratTable ( BuildSratTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -461,12 +465,12 @@ BuildSratTable (
UINT32 MemAffOffset; UINT32 MemAffOffset;
UINT32 GenInitiatorAffOffset; UINT32 GenInitiatorAffOffset;
CM_ARM_GICC_INFO * GicCInfo; CM_ARM_GICC_INFO *GicCInfo;
CM_ARM_GIC_ITS_INFO * GicItsInfo; CM_ARM_GIC_ITS_INFO *GicItsInfo;
CM_ARM_MEMORY_AFFINITY_INFO * MemAffInfo; CM_ARM_MEMORY_AFFINITY_INFO *MemAffInfo;
CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO * GenInitiatorAffInfo; CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO *GenInitiatorAffInfo;
EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * Srat; EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *Srat;
ASSERT ( ASSERT (
(This != NULL) && (This != NULL) &&
@ -478,7 +482,8 @@ BuildSratTable (
); );
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SRAT: Requested table revision = %d is not supported. " "ERROR: SRAT: Requested table revision = %d is not supported. "
@ -588,7 +593,7 @@ BuildSratTable (
} }
// Allocate the Buffer for SRAT table // Allocate the Buffer for SRAT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize); *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
if (*Table == NULL) { if (*Table == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -601,7 +606,7 @@ BuildSratTable (
goto error_handler; goto error_handler;
} }
Srat = (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER*)*Table; Srat = (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *)*Table;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -728,10 +733,10 @@ error_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeSratTableResources ( FreeSratTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT ( ASSERT (
@ -801,10 +806,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSratLibConstructor ( AcpiSratLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SratGenerator); Status = RegisterAcpiTableGenerator (&SratGenerator);
DEBUG ((DEBUG_INFO, "SRAT: Register Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "SRAT: Register Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -824,10 +830,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSratLibDestructor ( AcpiSratLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SratGenerator); Status = DeregisterAcpiTableGenerator (&SratGenerator);
DEBUG ((DEBUG_INFO, "SRAT: Deregister Generator. Status = %r\n", Status)); DEBUG ((DEBUG_INFO, "SRAT: Deregister Generator. Status = %r\n", Status));
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -61,17 +61,18 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ValidateCmn600Info ( ValidateCmn600Info (
IN CONST CM_ARM_CMN_600_INFO * Cmn600InfoList, IN CONST CM_ARM_CMN_600_INFO *Cmn600InfoList,
IN CONST UINT32 Cmn600Count IN CONST UINT32 Cmn600Count
) )
{ {
UINT32 Index; UINT32 Index;
UINT32 DtcIndex; UINT32 DtcIndex;
CONST CM_ARM_CMN_600_INFO * Cmn600Info; CONST CM_ARM_CMN_600_INFO *Cmn600Info;
CONST CM_ARM_GENERIC_INTERRUPT * DtcInterrupt; CONST CM_ARM_GENERIC_INTERRUPT *DtcInterrupt;
if ((Cmn600InfoList == NULL) || if ((Cmn600InfoList == NULL) ||
(Cmn600Count == 0)) { (Cmn600Count == 0))
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -81,7 +82,8 @@ ValidateCmn600Info (
// At least one DTC is required. // At least one DTC is required.
if ((Cmn600Info->DtcCount == 0) || if ((Cmn600Info->DtcCount == 0) ||
(Cmn600Info->DtcCount > MAX_DTC_COUNT)) { (Cmn600Info->DtcCount > MAX_DTC_COUNT))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Invalid DTC configuration:\n" "ERROR: SSDT-CMN-600: Invalid DTC configuration:\n"
@ -91,7 +93,8 @@ ValidateCmn600Info (
// Check PERIPHBASE and ROOTNODEBASE address spaces are initialized. // Check PERIPHBASE and ROOTNODEBASE address spaces are initialized.
if ((Cmn600Info->PeriphBaseAddress == 0) || if ((Cmn600Info->PeriphBaseAddress == 0) ||
(Cmn600Info->RootNodeBaseAddress == 0)) { (Cmn600Info->RootNodeBaseAddress == 0))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Invalid PERIPHBASE or ROOTNODEBASE.\n" "ERROR: SSDT-CMN-600: Invalid PERIPHBASE or ROOTNODEBASE.\n"
@ -103,7 +106,8 @@ ValidateCmn600Info (
// dimension mesh, and 256MB aligned otherwise. // dimension mesh, and 256MB aligned otherwise.
// Check it is a least 64MB aligned. // Check it is a least 64MB aligned.
if ((Cmn600Info->PeriphBaseAddress & if ((Cmn600Info->PeriphBaseAddress &
(PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0) { (PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0)
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600: PERIPHBASE address must be 64MB aligned.\n" "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. // Check the 16 KB alignment of the ROOTNODEBASE address.
if ((Cmn600Info->PeriphBaseAddress & if ((Cmn600Info->PeriphBaseAddress &
(ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0) { (ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0)
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Root base address must be 16KB aligned.\n" "ERROR: SSDT-CMN-600: Root base address must be 16KB aligned.\n"
@ -135,7 +140,8 @@ ValidateCmn600Info (
// address space. // address space.
if ((Cmn600Info->PeriphBaseAddress > Cmn600Info->RootNodeBaseAddress) || if ((Cmn600Info->PeriphBaseAddress > Cmn600Info->RootNodeBaseAddress) ||
((Cmn600Info->PeriphBaseAddress + Cmn600Info->PeriphBaseAddressLength) < ((Cmn600Info->PeriphBaseAddress + Cmn600Info->PeriphBaseAddressLength) <
(Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH))) { (Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH)))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600:" "ERROR: SSDT-CMN-600:"
@ -147,7 +153,8 @@ ValidateCmn600Info (
for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) { for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex]; DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
if (((DtcInterrupt->Flags & if (((DtcInterrupt->Flags &
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0)) { EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n" "ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n"
@ -155,8 +162,7 @@ ValidateCmn600Info (
goto error_handler; goto error_handler;
} }
} // for DTC Interrupt } // for DTC Interrupt
} // for Cmn600InfoList
} //for Cmn600InfoList
return EFI_SUCCESS; return EFI_SUCCESS;
@ -193,6 +199,7 @@ error_handler:
DtcInterrupt->Flags DtcInterrupt->Flags
)); ));
} // for } // for
DEBUG_CODE_END (); DEBUG_CODE_END ();
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -218,18 +225,18 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FixupCmn600Info ( FixupCmn600Info (
IN CONST CM_ARM_CMN_600_INFO * Cmn600Info, IN CONST CM_ARM_CMN_600_INFO *Cmn600Info,
IN CONST CHAR8 * Name, IN CONST CHAR8 *Name,
IN CONST UINT64 Uid, IN CONST UINT64 Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS Status1; EFI_STATUS Status1;
UINT8 Index; UINT8 Index;
CONST CM_ARM_GENERIC_INTERRUPT * DtcInt; CONST CM_ARM_GENERIC_INTERRUPT *DtcInt;
EFI_ACPI_DESCRIPTION_HEADER * SsdtCmn600Template; EFI_ACPI_DESCRIPTION_HEADER *SsdtCmn600Template;
AML_ROOT_NODE_HANDLE RootNodeHandle; AML_ROOT_NODE_HANDLE RootNodeHandle;
AML_OBJECT_NODE_HANDLE NameOpIdNode; AML_OBJECT_NODE_HANDLE NameOpIdNode;
AML_OBJECT_NODE_HANDLE NameOpCrsNode; AML_OBJECT_NODE_HANDLE NameOpCrsNode;
@ -238,7 +245,7 @@ FixupCmn600Info (
AML_OBJECT_NODE_HANDLE DeviceNode; AML_OBJECT_NODE_HANDLE DeviceNode;
// Parse the Ssdt CMN-600 Template. // Parse the Ssdt CMN-600 Template.
SsdtCmn600Template = (EFI_ACPI_DESCRIPTION_HEADER*) SsdtCmn600Template = (EFI_ACPI_DESCRIPTION_HEADER *)
ssdtcmn600template_aml_code; ssdtcmn600template_aml_code;
RootNodeHandle = NULL; RootNodeHandle = NULL;
@ -346,7 +353,7 @@ FixupCmn600Info (
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK) != 0), EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK) != 0),
((DtcInt->Flags & ((DtcInt->Flags &
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0), EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0),
(UINT32*)&DtcInt->Interrupt, (UINT32 *)&DtcInt->Interrupt,
1, 1,
NameOpCrsNode, NameOpCrsNode,
NULL NULL
@ -365,7 +372,7 @@ FixupCmn600Info (
} }
// Update the CMN600 Device's name. // Update the CMN600 Device's name.
Status = AmlDeviceOpUpdateName (DeviceNode, (CHAR8*)Name); Status = AmlDeviceOpUpdateName (DeviceNode, (CHAR8 *)Name);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto error_handler; goto error_handler;
} }
@ -423,14 +430,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeSsdtCmn600TableResourcesEx ( FreeSsdtCmn600TableResourcesEx (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table,
IN CONST UINTN TableCount IN CONST UINTN TableCount
) )
{ {
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
UINTN Index; UINTN Index;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -441,7 +448,8 @@ FreeSsdtCmn600TableResourcesEx (
if ((Table == NULL) || if ((Table == NULL) ||
(*Table == NULL) || (*Table == NULL) ||
(TableCount == 0)) { (TableCount == 0))
{
DEBUG ((DEBUG_ERROR, "ERROR: SSDT-CMN-600: Invalid Table Pointer\n")); DEBUG ((DEBUG_ERROR, "ERROR: SSDT-CMN-600: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -451,7 +459,8 @@ FreeSsdtCmn600TableResourcesEx (
for (Index = 0; Index < TableCount; Index++) { for (Index = 0; Index < TableCount; Index++) {
if ((TableList[Index] != NULL) && if ((TableList[Index] != NULL) &&
(TableList[Index]->Signature == (TableList[Index]->Signature ==
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) { EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
{
FreePool (TableList[Index]); FreePool (TableList[Index]);
} else { } else {
DEBUG (( DEBUG ((
@ -463,7 +472,7 @@ FreeSsdtCmn600TableResourcesEx (
)); ));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
} //for } // for
// Free the table list. // Free the table list.
FreePool (*Table); FreePool (*Table);
@ -500,19 +509,19 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSsdtCmn600TableEx ( BuildSsdtCmn600TableEx (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table,
OUT UINTN * CONST TableCount OUT UINTN *CONST TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT64 Index; UINT64 Index;
CM_ARM_CMN_600_INFO * Cmn600Info; CM_ARM_CMN_600_INFO *Cmn600Info;
UINT32 Cmn600Count; UINT32 Cmn600Count;
CHAR8 NewName[AML_NAME_SEG_SIZE + 1]; CHAR8 NewName[AML_NAME_SEG_SIZE + 1];
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -563,9 +572,9 @@ BuildSsdtCmn600TableEx (
} }
// Allocate a table to store pointers to the SSDT tables. // Allocate a table to store pointers to the SSDT tables.
TableList = (EFI_ACPI_DESCRIPTION_HEADER**) TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
AllocateZeroPool ( AllocateZeroPool (
(sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * Cmn600Count) (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * Cmn600Count)
); );
if (TableList == NULL) { if (TableList == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
@ -664,7 +673,7 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtCmn600LibConstructor ( AcpiSsdtCmn600LibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -692,7 +701,7 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtCmn600LibDestructor ( AcpiSsdtCmn600LibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;

View File

@ -96,15 +96,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
TokenTableInitialize ( TokenTableInitialize (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN UINT32 Count IN UINT32 Count
) )
{ {
CM_OBJECT_TOKEN * Table; CM_OBJECT_TOKEN *Table;
if ((Generator == NULL) || if ((Generator == NULL) ||
(Count == 0) || (Count == 0) ||
(Count >= MAX_NODE_COUNT)) { (Count >= MAX_NODE_COUNT))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -128,7 +129,7 @@ STATIC
VOID VOID
EFIAPI EFIAPI
TokenTableFree ( TokenTableFree (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator
) )
{ {
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -153,11 +154,11 @@ STATIC
UINT32 UINT32
EFIAPI EFIAPI
TokenTableAdd ( TokenTableAdd (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CM_OBJECT_TOKEN Token IN CM_OBJECT_TOKEN Token
) )
{ {
CM_OBJECT_TOKEN * Table; CM_OBJECT_TOKEN *Table;
UINT32 Index; UINT32 Index;
UINT32 LastIndex; UINT32 LastIndex;
@ -205,13 +206,14 @@ EFIAPI
WriteAslName ( WriteAslName (
IN CHAR8 LeadChar, IN CHAR8 LeadChar,
IN UINT32 Value, IN UINT32 Value,
IN OUT CHAR8 * AslName IN OUT CHAR8 *AslName
) )
{ {
UINT8 Index; UINT8 Index;
if ((Value >= MAX_NODE_COUNT) || if ((Value >= MAX_NODE_COUNT) ||
(AslName == NULL)) { (AslName == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -262,9 +264,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateAmlLpiMethod ( CreateAmlLpiMethod (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeInfo, IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
IN AML_OBJECT_NODE_HANDLE * Node IN AML_OBJECT_NODE_HANDLE *Node
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -349,8 +351,8 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GenerateLpiStates ( GenerateLpiStates (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_OBJECT_NODE_HANDLE ScopeNode IN AML_OBJECT_NODE_HANDLE ScopeNode
) )
{ {
@ -360,10 +362,10 @@ GenerateLpiStates (
UINT32 LastIndex; UINT32 LastIndex;
AML_OBJECT_NODE_HANDLE LpiNode; AML_OBJECT_NODE_HANDLE LpiNode;
CM_ARM_OBJ_REF * LpiRefInfo; CM_ARM_OBJ_REF *LpiRefInfo;
UINT32 LpiRefInfoCount; UINT32 LpiRefInfoCount;
UINT32 LpiRefIndex; UINT32 LpiRefIndex;
CM_ARM_LPI_INFO * LpiInfo; CM_ARM_LPI_INFO *LpiInfo;
CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -465,11 +467,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateAmlCpu ( CreateAmlCpu (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN AML_NODE_HANDLE ParentNode, IN AML_NODE_HANDLE ParentNode,
IN CM_ARM_GICC_INFO * GicCInfo, IN CM_ARM_GICC_INFO *GicCInfo,
IN UINT32 CpuIndex, IN UINT32 CpuIndex,
OUT AML_OBJECT_NODE_HANDLE * CpuNodePtr OPTIONAL OUT AML_OBJECT_NODE_HANDLE *CpuNodePtr OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -541,15 +543,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateAmlCpuFromProcHierarchy ( CreateAmlCpuFromProcHierarchy (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_NODE_HANDLE ParentNode, IN AML_NODE_HANDLE ParentNode,
IN UINT32 CpuIndex, IN UINT32 CpuIndex,
IN CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeInfo IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_GICC_INFO * GicCInfo; CM_ARM_GICC_INFO *GicCInfo;
AML_OBJECT_NODE_HANDLE CpuNode; AML_OBJECT_NODE_HANDLE CpuNode;
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -619,12 +621,12 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateAmlCluster ( CreateAmlCluster (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_NODE_HANDLE ParentNode, IN AML_NODE_HANDLE ParentNode,
IN CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeInfo, IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
IN UINT32 ClusterIndex, IN UINT32 ClusterIndex,
OUT AML_OBJECT_NODE_HANDLE * ClusterNodePtr OUT AML_OBJECT_NODE_HANDLE *ClusterNodePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -713,8 +715,8 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateAmlCpuTopologyTree ( CreateAmlCpuTopologyTree (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CM_OBJECT_TOKEN NodeToken, IN CM_OBJECT_TOKEN NodeToken,
IN AML_NODE_HANDLE ParentNode IN AML_NODE_HANDLE ParentNode
) )
@ -739,12 +741,12 @@ CreateAmlCpuTopologyTree (
// Find the children of the CM_ARM_PROC_HIERARCHY_INFO // Find the children of the CM_ARM_PROC_HIERARCHY_INFO
// currently being handled (i.e. ParentToken == NodeToken). // currently being handled (i.e. ParentToken == NodeToken).
if (Generator->ProcNodeList[Index].ParentToken == NodeToken) { if (Generator->ProcNodeList[Index].ParentToken == NodeToken) {
// Only Cpus (leaf nodes in this tree) have a GicCToken. // Only Cpus (leaf nodes in this tree) have a GicCToken.
// Create a Cpu node. // Create a Cpu node.
if (Generator->ProcNodeList[Index].GicCToken != CM_NULL_TOKEN) { if (Generator->ProcNodeList[Index].GicCToken != CM_NULL_TOKEN) {
if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) != if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
PPTT_CPU_PROCESSOR_MASK) { PPTT_CPU_PROCESSOR_MASK)
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cpu: 0x%x.\n", "ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cpu: 0x%x.\n",
@ -767,13 +769,13 @@ CreateAmlCpuTopologyTree (
} }
CpuIndex++; CpuIndex++;
} else { } else {
// If this is not a Cpu, then this is a cluster. // If this is not a Cpu, then this is a cluster.
// Acpi processor Id for clusters is not handled. // Acpi processor Id for clusters is not handled.
if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) != if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
PPTT_CLUSTER_PROCESSOR_MASK) { PPTT_CLUSTER_PROCESSOR_MASK)
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cluster: 0x%x.\n", "ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cluster: 0x%x.\n",
@ -835,8 +837,8 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateTopologyFromProcHierarchy ( CreateTopologyFromProcHierarchy (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_OBJECT_NODE_HANDLE ScopeNode IN AML_OBJECT_NODE_HANDLE ScopeNode
) )
{ {
@ -865,7 +867,8 @@ CreateTopologyFromProcHierarchy (
for (Index = 0; Index < Generator->ProcNodeCount; Index++) { for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
if ((Generator->ProcNodeList[Index].ParentToken == CM_NULL_TOKEN) && if ((Generator->ProcNodeList[Index].ParentToken == CM_NULL_TOKEN) &&
(Generator->ProcNodeList[Index].Flags & (Generator->ProcNodeList[Index].Flags &
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL)) { EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL))
{
if (TopLevelProcNodeIndex != MAX_UINT32) { if (TopLevelProcNodeIndex != MAX_UINT32) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -875,6 +878,7 @@ CreateTopologyFromProcHierarchy (
ASSERT (0); ASSERT (0);
goto exit_handler; goto exit_handler;
} }
TopLevelProcNodeIndex = Index; TopLevelProcNodeIndex = Index;
} }
} // for } // for
@ -919,13 +923,13 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CreateTopologyFromGicC ( CreateTopologyFromGicC (
IN ACPI_CPU_TOPOLOGY_GENERATOR * Generator, IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_OBJECT_NODE_HANDLE ScopeNode IN AML_OBJECT_NODE_HANDLE ScopeNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_GICC_INFO * GicCInfo; CM_ARM_GICC_INFO *GicCInfo;
UINT32 GicCInfoCount; UINT32 GicCInfoCount;
UINT32 Index; UINT32 Index;
@ -988,18 +992,18 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSsdtCpuTopologyTable ( BuildSsdtCpuTopologyTable (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_ROOT_NODE_HANDLE RootNode; AML_ROOT_NODE_HANDLE RootNode;
AML_OBJECT_NODE_HANDLE ScopeNode; AML_OBJECT_NODE_HANDLE ScopeNode;
CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeList; CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
UINT32 ProcHierarchyNodeCount; UINT32 ProcHierarchyNodeCount;
ACPI_CPU_TOPOLOGY_GENERATOR * Generator; ACPI_CPU_TOPOLOGY_GENERATOR *Generator;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -1008,7 +1012,7 @@ BuildSsdtCpuTopologyTable (
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID); ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
Generator = (ACPI_CPU_TOPOLOGY_GENERATOR*)This; Generator = (ACPI_CPU_TOPOLOGY_GENERATOR *)This;
Status = AddSsdtAcpiHeader ( Status = AddSsdtAcpiHeader (
CfgMgrProtocol, CfgMgrProtocol,
@ -1034,7 +1038,8 @@ BuildSsdtCpuTopologyTable (
&ProcHierarchyNodeCount &ProcHierarchyNodeCount
); );
if (EFI_ERROR (Status) && if (EFI_ERROR (Status) &&
(Status != EFI_NOT_FOUND)) { (Status != EFI_NOT_FOUND))
{
goto exit_handler; goto exit_handler;
} }
@ -1098,10 +1103,10 @@ exit_handler:
STATIC STATIC
EFI_STATUS EFI_STATUS
FreeSsdtCpuTopologyTableResources ( FreeSsdtCpuTopologyTableResources (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
) )
{ {
ASSERT (This != NULL); ASSERT (This != NULL);
@ -1185,10 +1190,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtCpuTopologyLibConstructor ( AcpiSsdtCpuTopologyLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header); Status = RegisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -1213,10 +1219,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtCpuTopologyLibDestructor ( AcpiSsdtCpuTopologyLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header); Status = DeregisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,

View File

@ -106,7 +106,7 @@
typedef struct TokenTable { typedef struct TokenTable {
/// TokenTable, a table allowing to map: /// TokenTable, a table allowing to map:
/// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures). /// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
CM_OBJECT_TOKEN * Table; CM_OBJECT_TOKEN *Table;
/// Last used index of the TokenTable. /// Last used index of the TokenTable.
/// LastIndex is bound by ProcNodeCount. /// LastIndex is bound by ProcNodeCount.
@ -124,7 +124,7 @@ typedef struct AcpiCpuTopologyGenerator {
/// Private object used to handle token referencing. /// Private object used to handle token referencing.
TOKEN_TABLE TokenTable; TOKEN_TABLE TokenTable;
/// List of CM_ARM_PROC_HIERARCHY_INFO CM objects. /// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
CM_ARM_PROC_HIERARCHY_INFO * ProcNodeList; CM_ARM_PROC_HIERARCHY_INFO *ProcNodeList;
/// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects. /// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
UINT32 ProcNodeCount; UINT32 ProcNodeCount;
} ACPI_CPU_TOPOLOGY_GENERATOR; } ACPI_CPU_TOPOLOGY_GENERATOR;

View File

@ -76,15 +76,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeSsdtSerialPortTableEx ( FreeSsdtSerialPortTableEx (
IN CONST ACPI_TABLE_GENERATOR * CONST This, IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table,
IN CONST UINTN TableCount IN CONST UINTN TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
UINTN Index; UINTN Index;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -95,7 +95,8 @@ FreeSsdtSerialPortTableEx (
if ((Table == NULL) || if ((Table == NULL) ||
(*Table == NULL) || (*Table == NULL) ||
(TableCount == 0)) { (TableCount == 0))
{
DEBUG ((DEBUG_ERROR, "ERROR: SSDT-SERIAL-PORT: Invalid Table Pointer\n")); DEBUG ((DEBUG_ERROR, "ERROR: SSDT-SERIAL-PORT: Invalid Table Pointer\n"));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -105,7 +106,8 @@ FreeSsdtSerialPortTableEx (
for (Index = 0; Index < TableCount; Index++) { for (Index = 0; Index < TableCount; Index++) {
if ((TableList[Index] != NULL) && if ((TableList[Index] != NULL) &&
(TableList[Index]->Signature == (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]); Status = FreeSsdtSerialPortTable (TableList[Index]);
} else { } else {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
@ -121,7 +123,7 @@ FreeSsdtSerialPortTableEx (
)); ));
return Status; return Status;
} }
} //for } // for
// Free the table list. // Free the table list.
FreePool (*Table); FreePool (*Table);
@ -158,20 +160,20 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSsdtSerialPortTableEx ( BuildSsdtSerialPortTableEx (
IN CONST ACPI_TABLE_GENERATOR * This, IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table,
OUT UINTN * CONST TableCount OUT UINTN *CONST TableCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo; CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
UINT32 SerialPortCount; UINT32 SerialPortCount;
UINTN Index; UINTN Index;
CHAR8 NewName[AML_NAME_SEG_SIZE + 1]; CHAR8 NewName[AML_NAME_SEG_SIZE + 1];
UINT64 Uid; UINT64 Uid;
EFI_ACPI_DESCRIPTION_HEADER ** TableList; EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -222,9 +224,9 @@ BuildSsdtSerialPortTableEx (
} }
// Allocate a table to store pointers to the SSDT tables. // Allocate a table to store pointers to the SSDT tables.
TableList = (EFI_ACPI_DESCRIPTION_HEADER**) TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
AllocateZeroPool ( AllocateZeroPool (
(sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * SerialPortCount) (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * SerialPortCount)
); );
if (TableList == NULL) { if (TableList == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
@ -326,10 +328,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtSerialPortLibConstructor ( AcpiSsdtSerialPortLibConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = RegisterAcpiTableGenerator (&SsdtSerialPortGenerator); Status = RegisterAcpiTableGenerator (&SsdtSerialPortGenerator);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -354,10 +357,11 @@ EFI_STATUS
EFIAPI EFIAPI
AcpiSsdtSerialPortLibDestructor ( AcpiSsdtSerialPortLibDestructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = DeregisterAcpiTableGenerator (&SsdtSerialPortGenerator); Status = DeregisterAcpiTableGenerator (&SsdtSerialPortGenerator);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,

View File

@ -78,7 +78,7 @@ HexFromAscii (
**/ **/
BOOLEAN BOOLEAN
IsValidPnpId ( IsValidPnpId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
) )
{ {
UINTN Index; UINTN Index;
@ -113,7 +113,7 @@ IsValidPnpId (
**/ **/
BOOLEAN BOOLEAN
IsValidAcpiId ( IsValidAcpiId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
) )
{ {
UINTN Index; UINTN Index;
@ -153,13 +153,14 @@ IsValidAcpiId (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetEisaIdFromString ( AmlGetEisaIdFromString (
IN CONST CHAR8 * EisaIdStr, IN CONST CHAR8 *EisaIdStr,
OUT UINT32 * EisaIdInt OUT UINT32 *EisaIdInt
) )
{ {
if ((EisaIdStr == NULL) || if ((EisaIdStr == NULL) ||
(!IsValidPnpId (EisaIdStr)) || (!IsValidPnpId (EisaIdStr)) ||
(EisaIdInt == NULL)) { (EisaIdInt == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -68,8 +68,8 @@ EFI_STATUS
EFIAPI EFIAPI
AmlSerializeTree ( AmlSerializeTree (
IN AML_ROOT_NODE_HANDLE RootNode, IN AML_ROOT_NODE_HANDLE RootNode,
IN UINT8 * Buffer OPTIONAL, IN UINT8 *Buffer OPTIONAL,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
); );
/** Clone a node. /** Clone a node.
@ -90,7 +90,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCloneNode ( AmlCloneNode (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
OUT AML_NODE_HANDLE * ClonedNode OUT AML_NODE_HANDLE *ClonedNode
); );
/** /**
@ -303,7 +303,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetRootNodeInfo ( AmlGetRootNodeInfo (
IN AML_ROOT_NODE_HANDLE RootNode, IN AML_ROOT_NODE_HANDLE RootNode,
OUT EFI_ACPI_DESCRIPTION_HEADER * SdtHeaderBuffer OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer
); );
/** Get the ObjectNode information. /** Get the ObjectNode information.
@ -334,10 +334,10 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetObjectNodeInfo ( AmlGetObjectNodeInfo (
IN AML_OBJECT_NODE_HANDLE ObjectNode, IN AML_OBJECT_NODE_HANDLE ObjectNode,
OUT UINT8 * OpCode OPTIONAL, OUT UINT8 *OpCode OPTIONAL,
OUT UINT8 * SubOpCode OPTIONAL, OUT UINT8 *SubOpCode OPTIONAL,
OUT UINT32 * PkgLen OPTIONAL, OUT UINT32 *PkgLen OPTIONAL,
OUT BOOLEAN * IsNameSpaceNode OPTIONAL OUT BOOLEAN *IsNameSpaceNode OPTIONAL
); );
/** Returns the count of the fixed arguments for the input Node. /** Returns the count of the fixed arguments for the input Node.
@ -369,7 +369,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetNodeDataType ( AmlGetNodeDataType (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
OUT EAML_NODE_DATA_TYPE * DataType OUT EAML_NODE_DATA_TYPE *DataType
); );
/** Get the descriptor Id of the resource data element /** Get the descriptor Id of the resource data element
@ -393,7 +393,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetResourceDataType ( AmlGetResourceDataType (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
OUT AML_RD_HEADER * ResourceDataType OUT AML_RD_HEADER *ResourceDataType
); );
/** Get the data buffer and size of the DataNode. /** Get the data buffer and size of the DataNode.
@ -423,8 +423,8 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetDataNodeBuffer ( AmlGetDataNodeBuffer (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
OUT UINT8 * Buffer OPTIONAL, OUT UINT8 *Buffer OPTIONAL,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
); );
/** Update the ACPI DSDT/SSDT table header. /** Update the ACPI DSDT/SSDT table header.
@ -445,7 +445,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlUpdateRootNode ( AmlUpdateRootNode (
IN AML_ROOT_NODE_HANDLE RootNode, IN AML_ROOT_NODE_HANDLE RootNode,
IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader
); );
/** Update an object node representing an integer with a new value. /** Update an object node representing an integer with a new value.
@ -498,7 +498,7 @@ EFIAPI
AmlUpdateDataNode ( AmlUpdateDataNode (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
IN EAML_NODE_DATA_TYPE DataType, IN EAML_NODE_DATA_TYPE DataType,
IN UINT8 * Buffer, IN UINT8 *Buffer,
IN UINT32 Size IN UINT32 Size
); );
@ -682,10 +682,10 @@ AmlGetPreviousVariableArgument (
**/ **/
typedef typedef
BOOLEAN BOOLEAN
(EFIAPI * EDKII_AML_TREE_ENUM_CALLBACK) ( (EFIAPI *EDKII_AML_TREE_ENUM_CALLBACK)(
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN OUT VOID * Context OPTIONAL, IN OUT VOID *Context OPTIONAL,
IN OUT EFI_STATUS * Status OPTIONAL IN OUT EFI_STATUS *Status OPTIONAL
); );
/** Enumerate all nodes of the subtree under the input Node in the AML /** Enumerate all nodes of the subtree under the input Node in the AML
@ -714,8 +714,8 @@ EFIAPI
AmlEnumTree ( AmlEnumTree (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN EDKII_AML_TREE_ENUM_CALLBACK CallBack, IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
IN OUT VOID * Context OPTIONAL, IN OUT VOID *Context OPTIONAL,
OUT EFI_STATUS * Status OPTIONAL OUT EFI_STATUS *Status OPTIONAL
); );
/** /**
@ -760,8 +760,8 @@ EFI_STATUS
EFIAPI EFIAPI
AmlGetAslPathName ( AmlGetAslPathName (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
OUT CHAR8 * Buffer, OUT CHAR8 *Buffer,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
); );
#endif // AML_CORE_INTERFACE_H_ #endif // AML_CORE_INTERFACE_H_

View File

@ -19,7 +19,7 @@
/** String table representing AML Data types as defined by EAML_NODE_DATA_TYPE. /** String table representing AML Data types as defined by EAML_NODE_DATA_TYPE.
*/ */
CONST CHAR8 * NodeDataTypeStrTbl[] = { CONST CHAR8 *NodeDataTypeStrTbl[] = {
"EAmlNodeDataTypeNone", "EAmlNodeDataTypeNone",
"EAmlNodeDataTypeReserved1", "EAmlNodeDataTypeReserved1",
"EAmlNodeDataTypeReserved2", "EAmlNodeDataTypeReserved2",
@ -37,7 +37,7 @@ CONST CHAR8 * NodeDataTypeStrTbl[] = {
/** String table representing AML Node types as defined by EAML_NODE_TYPE. /** String table representing AML Node types as defined by EAML_NODE_TYPE.
*/ */
CONST CHAR8 * NodeTypeStrTbl[] = { CONST CHAR8 *NodeTypeStrTbl[] = {
"EAmlNodeUnknown", "EAmlNodeUnknown",
"EAmlNodeRoot", "EAmlNodeRoot",
"EAmlNodeObject", "EAmlNodeObject",
@ -55,7 +55,7 @@ VOID
EFIAPI EFIAPI
AmlDbgPrintChars ( AmlDbgPrintChars (
IN UINT32 ErrorLevel, IN UINT32 ErrorLevel,
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN UINT32 Size IN UINT32 Size
) )
{ {
@ -79,7 +79,7 @@ AmlDbgPrintChars (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameSeg ( AmlDbgPrintNameSeg (
IN CONST CHAR8 * Buffer IN CONST CHAR8 *Buffer
) )
{ {
if (Buffer == NULL) { if (Buffer == NULL) {
@ -90,18 +90,23 @@ AmlDbgPrintNameSeg (
DEBUG ((DEBUG_INFO, "%c", Buffer[0])); DEBUG ((DEBUG_INFO, "%c", Buffer[0]));
if ((Buffer[1] == AML_NAME_CHAR__) && if ((Buffer[1] == AML_NAME_CHAR__) &&
(Buffer[2] == AML_NAME_CHAR__) && (Buffer[2] == AML_NAME_CHAR__) &&
(Buffer[3] == AML_NAME_CHAR__)) { (Buffer[3] == AML_NAME_CHAR__))
{
return; return;
} }
DEBUG ((DEBUG_INFO, "%c", Buffer[1])); DEBUG ((DEBUG_INFO, "%c", Buffer[1]));
if ((Buffer[2] == AML_NAME_CHAR__) && if ((Buffer[2] == AML_NAME_CHAR__) &&
(Buffer[3] == AML_NAME_CHAR__)) { (Buffer[3] == AML_NAME_CHAR__))
{
return; return;
} }
DEBUG ((DEBUG_INFO, "%c", Buffer[2])); DEBUG ((DEBUG_INFO, "%c", Buffer[2]));
if (Buffer[3] == AML_NAME_CHAR__) { if (Buffer[3] == AML_NAME_CHAR__) {
return; return;
} }
DEBUG ((DEBUG_INFO, "%c", Buffer[3])); DEBUG ((DEBUG_INFO, "%c", Buffer[3]));
return; return;
} }
@ -114,7 +119,7 @@ AmlDbgPrintNameSeg (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameString ( AmlDbgPrintNameString (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN BOOLEAN NewLine IN BOOLEAN NewLine
) )
{ {
@ -153,6 +158,7 @@ AmlDbgPrintNameString (
ASSERT (0); ASSERT (0);
return; return;
} }
SegCount = 1; SegCount = 1;
} else if (*Buffer == AML_ZERO_OP) { } else if (*Buffer == AML_ZERO_OP) {
SegCount = 0; SegCount = 0;
@ -188,7 +194,7 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNodeHeader ( AmlDbgPrintNodeHeader (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN UINT8 Level IN UINT8 Level
) )
{ {
@ -214,7 +220,7 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintDataNode ( AmlDbgPrintDataNode (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
@ -225,38 +231,39 @@ AmlDbgPrintDataNode (
return; return;
} }
AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level); AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)DataNode, Level);
DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType])); DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size)); DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
if ((DataNode->DataType == EAmlNodeDataTypeNameString) || if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
(DataNode->DataType == EAmlNodeDataTypeString)) { (DataNode->DataType == EAmlNodeDataTypeString))
{
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_INFO, DEBUG_INFO,
(CONST CHAR8*)DataNode->Buffer, (CONST CHAR8 *)DataNode->Buffer,
DataNode->Size DataNode->Size
); );
} else if (DataNode->DataType == EAmlNodeDataTypeUInt) { } else if (DataNode->DataType == EAmlNodeDataTypeUInt) {
switch (DataNode->Size) { switch (DataNode->Size) {
case 1: case 1:
{ {
DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8*)DataNode->Buffer))); DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8 *)DataNode->Buffer)));
break; break;
} }
case 2: case 2:
{ {
DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16*)DataNode->Buffer))); DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16 *)DataNode->Buffer)));
break; break;
} }
case 4: case 4:
{ {
DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32*)DataNode->Buffer))); DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32 *)DataNode->Buffer)));
break; break;
} }
case 8: case 8:
{ {
DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64*)DataNode->Buffer))); DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64 *)DataNode->Buffer)));
break; break;
} }
default: default:
@ -284,7 +291,7 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintObjectNode ( AmlDbgPrintObjectNode (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
@ -293,22 +300,30 @@ AmlDbgPrintObjectNode (
return; return;
} }
AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)ObjectNode, Level); AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)ObjectNode, Level);
DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->OpCode)); DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->OpCode));
DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->SubOpCode)); DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->SubOpCode));
// Print a string corresponding to the field object OpCode/SubOpCode. // Print a string corresponding to the field object OpCode/SubOpCode.
if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) { if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr ( DEBUG ((
DEBUG_INFO,
"%-15a ",
AmlGetFieldOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode, ObjectNode->AmlByteEncoding->OpCode,
0 0
))); )
));
} else { } else {
// Print a string corresponding to the object OpCode/SubOpCode. // Print a string corresponding to the object OpCode/SubOpCode.
DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr ( DEBUG ((
DEBUG_INFO,
"%-15a | ",
AmlGetOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode, ObjectNode->AmlByteEncoding->OpCode,
ObjectNode->AmlByteEncoding->SubOpCode) ObjectNode->AmlByteEncoding->SubOpCode
)
)); ));
} }
@ -317,7 +332,7 @@ AmlDbgPrintObjectNode (
DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen)); DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen));
if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) { if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
AMLDBG_PRINT_NAMESTR ( AMLDBG_PRINT_NAMESTR (
AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode), AmlNodeGetName ((CONST AML_OBJECT_NODE *)ObjectNode),
FALSE FALSE
); );
} }
@ -334,7 +349,7 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintRootNode ( AmlDbgPrintRootNode (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
@ -343,7 +358,7 @@ AmlDbgPrintRootNode (
return; return;
} }
AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)RootNode, Level); AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)RootNode, Level);
DEBUG ((DEBUG_INFO, "%8x | ", RootNode->SdtHeader->Signature)); DEBUG ((DEBUG_INFO, "%8x | ", RootNode->SdtHeader->Signature));
DEBUG ((DEBUG_INFO, "0x%08x | ", RootNode->SdtHeader->Length)); DEBUG ((DEBUG_INFO, "0x%08x | ", RootNode->SdtHeader->Length));
@ -413,12 +428,12 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintTreeInternal ( AmlDbgPrintTreeInternal (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN BOOLEAN Recurse, IN BOOLEAN Recurse,
IN UINT8 Level IN UINT8 Level
) )
{ {
AML_NODE_HEADER * ChildNode; AML_NODE_HEADER *ChildNode;
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0); ASSERT (0);
@ -426,12 +441,12 @@ AmlDbgPrintTreeInternal (
} }
if (IS_AML_DATA_NODE (Node)) { if (IS_AML_DATA_NODE (Node)) {
AmlDbgPrintDataNode ((AML_DATA_NODE*)Node, Level); AmlDbgPrintDataNode ((AML_DATA_NODE *)Node, Level);
return; return;
} else if (IS_AML_OBJECT_NODE (Node)) { } else if (IS_AML_OBJECT_NODE (Node)) {
AmlDbgPrintObjectNode ((AML_OBJECT_NODE*)Node, Level); AmlDbgPrintObjectNode ((AML_OBJECT_NODE *)Node, Level);
} else if (IS_AML_ROOT_NODE (Node)) { } else if (IS_AML_ROOT_NODE (Node)) {
AmlDbgPrintRootNode ((AML_ROOT_NODE*)Node, Level); AmlDbgPrintRootNode ((AML_ROOT_NODE *)Node, Level);
} else { } else {
// Should not be possible. // Should not be possible.
ASSERT (0); ASSERT (0);
@ -459,7 +474,7 @@ AmlDbgPrintTreeInternal (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNode ( AmlDbgPrintNode (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
AmlDbgPrintTableHeader (); AmlDbgPrintTableHeader ();
@ -474,7 +489,7 @@ AmlDbgPrintNode (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintTree ( AmlDbgPrintTree (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
AmlDbgPrintTableHeader (); AmlDbgPrintTableHeader ();
@ -489,7 +504,7 @@ AmlDbgPrintTree (
VOID VOID
EFIAPI EFIAPI
AmlDbgDumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 *Ptr,
IN UINT32 Length IN UINT32 Length
) )
{ {
@ -532,6 +547,7 @@ AmlDbgDumpRaw (
if ((Length & 0x0F) <= 8) { if ((Length & 0x0F) <= 8) {
PartLineChars += 2; PartLineChars += 2;
} }
while (PartLineChars > 0) { while (PartLineChars > 0) {
DEBUG ((DEBUG_VERBOSE, " ")); DEBUG ((DEBUG_VERBOSE, " "));
PartLineChars--; PartLineChars--;

View File

@ -24,7 +24,7 @@
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
#include <AmlInclude.h> #include <AmlInclude.h>
/** /**
@defgroup DbgPrintApis Print APIs for debugging. @defgroup DbgPrintApis Print APIs for debugging.
@ -46,7 +46,7 @@
VOID VOID
EFIAPI EFIAPI
AmlDbgDumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 *Ptr,
IN UINT32 Length IN UINT32 Length
); );
@ -62,7 +62,7 @@ VOID
EFIAPI EFIAPI
AmlDbgPrintChars ( AmlDbgPrintChars (
IN UINT32 ErrorLevel, IN UINT32 ErrorLevel,
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN UINT32 Size IN UINT32 Size
); );
@ -74,7 +74,7 @@ AmlDbgPrintChars (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameSeg ( AmlDbgPrintNameSeg (
IN CONST CHAR8 * Buffer IN CONST CHAR8 *Buffer
); );
/** Print an AML NameString. /** Print an AML NameString.
@ -85,7 +85,7 @@ AmlDbgPrintNameSeg (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameString ( AmlDbgPrintNameString (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN BOOLEAN NewLine IN BOOLEAN NewLine
); );
@ -145,7 +145,7 @@ AmlDbgPrintNameSpace (
#define AMLDBG_PRINT_NAMESEG(Buffer) \ #define AMLDBG_PRINT_NAMESEG(Buffer) \
AmlDbgPrintNameSeg (Buffer) AmlDbgPrintNameSeg (Buffer)
#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine) \ #define AMLDBG_PRINT_NAMESTR(Buffer, NewLine) \
AmlDbgPrintNameString (Buffer,NewLine) AmlDbgPrintNameString (Buffer,NewLine)
#define AMLDBG_PRINT_NODE(Node) \ #define AMLDBG_PRINT_NODE(Node) \
@ -165,7 +165,7 @@ AmlDbgPrintNameSpace (
#define AMLDBG_PRINT_NAMESEG(Buffer) #define AMLDBG_PRINT_NAMESEG(Buffer)
#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine) #define AMLDBG_PRINT_NAMESTR(Buffer, NewLine)
#define AMLDBG_PRINT_NODE(Node) #define AMLDBG_PRINT_NODE(Node)

View File

@ -83,151 +83,151 @@ STATIC
CONST CONST
AML_BYTE_ENCODING mAmlByteEncoding[] = { AML_BYTE_ENCODING mAmlByteEncoding[] = {
// Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute // Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute
/* 0x00 */ {AML_OPCODE_DEF ("ZeroOp", AML_ZERO_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x00 */ { AML_OPCODE_DEF ("ZeroOp", AML_ZERO_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x01 */ {AML_OPCODE_DEF ("OneOp", AML_ONE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x01 */ { AML_OPCODE_DEF ("OneOp", AML_ONE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x06 */ {AML_OPCODE_DEF ("AliasOp", AML_ALIAS_OP), 0, 2, 1, {EAmlName, EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x06 */ { AML_OPCODE_DEF ("AliasOp", AML_ALIAS_OP), 0, 2, 1, { EAmlName, EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x08 */ {AML_OPCODE_DEF ("NameOp", AML_NAME_OP), 0, 2, 0, {EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x08 */ { AML_OPCODE_DEF ("NameOp", AML_NAME_OP), 0, 2, 0, { EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x0A */ {AML_OPCODE_DEF ("BytePrefix", AML_BYTE_PREFIX), 0, 1, 0, {EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x0A */ { AML_OPCODE_DEF ("BytePrefix", AML_BYTE_PREFIX), 0, 1, 0, { EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x0B */ {AML_OPCODE_DEF ("WordPrefix", AML_WORD_PREFIX), 0, 1, 0, {EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x0B */ { AML_OPCODE_DEF ("WordPrefix", AML_WORD_PREFIX), 0, 1, 0, { EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x0C */ {AML_OPCODE_DEF ("DWordPrefix", AML_DWORD_PREFIX), 0, 1, 0, {EAmlUInt32, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x0C */ { AML_OPCODE_DEF ("DWordPrefix", AML_DWORD_PREFIX), 0, 1, 0, { EAmlUInt32, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x0D */ {AML_OPCODE_DEF ("StringPrefix", AML_STRING_PREFIX), 0, 1, 0, {EAmlString, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x0D */ { AML_OPCODE_DEF ("StringPrefix", AML_STRING_PREFIX), 0, 1, 0, { EAmlString, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x0E */ {AML_OPCODE_DEF ("QWordPrefix", AML_QWORD_PREFIX), 0, 1, 0, {EAmlUInt64, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x0E */ { AML_OPCODE_DEF ("QWordPrefix", AML_QWORD_PREFIX), 0, 1, 0, { EAmlUInt64, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x10 */ {AML_OPCODE_DEF ("ScopeOp", AML_SCOPE_OP), 0, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x10 */ { AML_OPCODE_DEF ("ScopeOp", AML_SCOPE_OP), 0, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x11 */ {AML_OPCODE_DEF ("BufferOp", AML_BUFFER_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST}, /* 0x11 */ { AML_OPCODE_DEF ("BufferOp", AML_BUFFER_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST },
/* 0x12 */ {AML_OPCODE_DEF ("PackageOp", AML_PACKAGE_OP), 0, 1, 0, {EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ}, /* 0x12 */ { AML_OPCODE_DEF ("PackageOp", AML_PACKAGE_OP), 0, 1, 0, { EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* 0x13 */ {AML_OPCODE_DEF ("VarPackageOp", AML_VAR_PACKAGE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ}, /* 0x13 */ { AML_OPCODE_DEF ("VarPackageOp", AML_VAR_PACKAGE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* 0x14 */ {AML_OPCODE_DEF ("MethodOp", AML_METHOD_OP), 0, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x14 */ { AML_OPCODE_DEF ("MethodOp", AML_METHOD_OP), 0, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x15 */ {AML_OPCODE_DEF ("ExternalOp", AML_EXTERNAL_OP), 0, 3, 0, {EAmlName, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x15 */ { AML_OPCODE_DEF ("ExternalOp", AML_EXTERNAL_OP), 0, 3, 0, { EAmlName, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x2E */ {AML_OPCODE_DEF ("DualNamePrefix", AML_DUAL_NAME_PREFIX), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x2E */ { AML_OPCODE_DEF ("DualNamePrefix", AML_DUAL_NAME_PREFIX), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x2F */ {AML_OPCODE_DEF ("MultiNamePrefix", AML_MULTI_NAME_PREFIX), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x2F */ { AML_OPCODE_DEF ("MultiNamePrefix", AML_MULTI_NAME_PREFIX), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x41 */ {AML_OPCODE_DEF ("NameChar_A", 'A'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x41 */ { AML_OPCODE_DEF ("NameChar_A", 'A'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x42 */ {AML_OPCODE_DEF ("NameChar_B", 'B'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x42 */ { AML_OPCODE_DEF ("NameChar_B", 'B'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x43 */ {AML_OPCODE_DEF ("NameChar_C", 'C'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x43 */ { AML_OPCODE_DEF ("NameChar_C", 'C'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x44 */ {AML_OPCODE_DEF ("NameChar_D", 'D'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x44 */ { AML_OPCODE_DEF ("NameChar_D", 'D'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x45 */ {AML_OPCODE_DEF ("NameChar_E", 'E'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x45 */ { AML_OPCODE_DEF ("NameChar_E", 'E'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x46 */ {AML_OPCODE_DEF ("NameChar_F", 'F'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x46 */ { AML_OPCODE_DEF ("NameChar_F", 'F'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x47 */ {AML_OPCODE_DEF ("NameChar_G", 'G'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x47 */ { AML_OPCODE_DEF ("NameChar_G", 'G'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x48 */ {AML_OPCODE_DEF ("NameChar_H", 'H'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x48 */ { AML_OPCODE_DEF ("NameChar_H", 'H'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x49 */ {AML_OPCODE_DEF ("NameChar_I", 'I'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x49 */ { AML_OPCODE_DEF ("NameChar_I", 'I'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4A */ {AML_OPCODE_DEF ("NameChar_J", 'J'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4A */ { AML_OPCODE_DEF ("NameChar_J", 'J'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4B */ {AML_OPCODE_DEF ("NameChar_K", 'K'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4B */ { AML_OPCODE_DEF ("NameChar_K", 'K'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4C */ {AML_OPCODE_DEF ("NameChar_L", 'L'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4C */ { AML_OPCODE_DEF ("NameChar_L", 'L'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4D */ {AML_OPCODE_DEF ("NameChar_M", 'M'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4D */ { AML_OPCODE_DEF ("NameChar_M", 'M'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4E */ {AML_OPCODE_DEF ("NameChar_N", 'N'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4E */ { AML_OPCODE_DEF ("NameChar_N", 'N'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x4F */ {AML_OPCODE_DEF ("NameChar_O", 'O'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x4F */ { AML_OPCODE_DEF ("NameChar_O", 'O'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x50 */ {AML_OPCODE_DEF ("NameChar_P", 'P'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x50 */ { AML_OPCODE_DEF ("NameChar_P", 'P'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x51 */ {AML_OPCODE_DEF ("NameChar_Q", 'Q'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x51 */ { AML_OPCODE_DEF ("NameChar_Q", 'Q'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x52 */ {AML_OPCODE_DEF ("NameChar_R", 'R'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x52 */ { AML_OPCODE_DEF ("NameChar_R", 'R'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x53 */ {AML_OPCODE_DEF ("NameChar_S", 'S'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x53 */ { AML_OPCODE_DEF ("NameChar_S", 'S'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x54 */ {AML_OPCODE_DEF ("NameChar_T", 'T'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x54 */ { AML_OPCODE_DEF ("NameChar_T", 'T'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x55 */ {AML_OPCODE_DEF ("NameChar_U", 'U'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x55 */ { AML_OPCODE_DEF ("NameChar_U", 'U'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x56 */ {AML_OPCODE_DEF ("NameChar_V", 'V'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x56 */ { AML_OPCODE_DEF ("NameChar_V", 'V'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x57 */ {AML_OPCODE_DEF ("NameChar_W", 'W'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x57 */ { AML_OPCODE_DEF ("NameChar_W", 'W'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x58 */ {AML_OPCODE_DEF ("NameChar_X", 'X'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x58 */ { AML_OPCODE_DEF ("NameChar_X", 'X'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x59 */ {AML_OPCODE_DEF ("NameChar_Y", 'Y'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x59 */ { AML_OPCODE_DEF ("NameChar_Y", 'Y'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x5A */ {AML_OPCODE_DEF ("NameChar_Z", 'Z'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x5A */ { AML_OPCODE_DEF ("NameChar_Z", 'Z'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x5B 0x01 */ {AML_OPCODE_DEF ("MutexOp", AML_EXT_OP), AML_EXT_MUTEX_OP, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x5B 0x01 */ { AML_OPCODE_DEF ("MutexOp", AML_EXT_OP), AML_EXT_MUTEX_OP, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x5B 0x02 */ {AML_OPCODE_DEF ("EventOp", AML_EXT_OP), AML_EXT_EVENT_OP, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x5B 0x02 */ { AML_OPCODE_DEF ("EventOp", AML_EXT_OP), AML_EXT_EVENT_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x5B 0x12 */ {AML_OPCODE_DEF ("CondRefOfOp", AML_EXT_OP), AML_EXT_COND_REF_OF_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x12 */ { AML_OPCODE_DEF ("CondRefOfOp", AML_EXT_OP), AML_EXT_COND_REF_OF_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x13 */ {AML_OPCODE_DEF ("CreateFieldOp", AML_EXT_OP), AML_EXT_CREATE_FIELD_OP,4, 3, {EAmlObject, EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x5B 0x13 */ { AML_OPCODE_DEF ("CreateFieldOp", AML_EXT_OP), AML_EXT_CREATE_FIELD_OP, 4, 3, { EAmlObject, EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x5B 0x1F */ {AML_OPCODE_DEF ("LoadTableOp", AML_EXT_OP), AML_EXT_LOAD_TABLE_OP, 6, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject}, 0}, /* 0x5B 0x1F */ { AML_OPCODE_DEF ("LoadTableOp", AML_EXT_OP), AML_EXT_LOAD_TABLE_OP, 6, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject }, 0 },
/* 0x5B 0x20 */ {AML_OPCODE_DEF ("LoadOp", AML_EXT_OP), AML_EXT_LOAD_OP, 2, 0, {EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x20 */ { AML_OPCODE_DEF ("LoadOp", AML_EXT_OP), AML_EXT_LOAD_OP, 2, 0, { EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x21 */ {AML_OPCODE_DEF ("StallOp", AML_EXT_OP), AML_EXT_STALL_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x21 */ { AML_OPCODE_DEF ("StallOp", AML_EXT_OP), AML_EXT_STALL_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x22 */ {AML_OPCODE_DEF ("SleepOp", AML_EXT_OP), AML_EXT_SLEEP_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x22 */ { AML_OPCODE_DEF ("SleepOp", AML_EXT_OP), AML_EXT_SLEEP_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x23 */ {AML_OPCODE_DEF ("AcquireOp", AML_EXT_OP), AML_EXT_ACQUIRE_OP, 2, 0, {EAmlObject, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x23 */ { AML_OPCODE_DEF ("AcquireOp", AML_EXT_OP), AML_EXT_ACQUIRE_OP, 2, 0, { EAmlObject, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x24 */ {AML_OPCODE_DEF ("SignalOp", AML_EXT_OP), AML_EXT_SIGNAL_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x24 */ { AML_OPCODE_DEF ("SignalOp", AML_EXT_OP), AML_EXT_SIGNAL_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x25 */ {AML_OPCODE_DEF ("WaitOp", AML_EXT_OP), AML_EXT_WAIT_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x25 */ { AML_OPCODE_DEF ("WaitOp", AML_EXT_OP), AML_EXT_WAIT_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x26 */ {AML_OPCODE_DEF ("ResetOp", AML_EXT_OP), AML_EXT_RESET_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x26 */ { AML_OPCODE_DEF ("ResetOp", AML_EXT_OP), AML_EXT_RESET_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x27 */ {AML_OPCODE_DEF ("ReleaseOp", AML_EXT_OP), AML_EXT_RELEASE_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x27 */ { AML_OPCODE_DEF ("ReleaseOp", AML_EXT_OP), AML_EXT_RELEASE_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x28 */ {AML_OPCODE_DEF ("FromBCDOp", AML_EXT_OP), AML_EXT_FROM_BCD_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x28 */ { AML_OPCODE_DEF ("FromBCDOp", AML_EXT_OP), AML_EXT_FROM_BCD_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x29 */ {AML_OPCODE_DEF ("ToBCDOp", AML_EXT_OP), AML_EXT_TO_BCD_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x29 */ { AML_OPCODE_DEF ("ToBCDOp", AML_EXT_OP), AML_EXT_TO_BCD_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x2A */ {AML_OPCODE_DEF ("UnloadOp", AML_EXT_OP), AML_EXT_UNLOAD_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x2A */ { AML_OPCODE_DEF ("UnloadOp", AML_EXT_OP), AML_EXT_UNLOAD_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x30 */ {AML_OPCODE_DEF ("RevisionOp", AML_EXT_OP), AML_EXT_REVISION_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x30 */ { AML_OPCODE_DEF ("RevisionOp", AML_EXT_OP), AML_EXT_REVISION_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x31 */ {AML_OPCODE_DEF ("DebugOp", AML_EXT_OP), AML_EXT_DEBUG_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x31 */ { AML_OPCODE_DEF ("DebugOp", AML_EXT_OP), AML_EXT_DEBUG_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x32 */ {AML_OPCODE_DEF ("FatalOp", AML_EXT_OP), AML_EXT_FATAL_OP, 3, 0, {EAmlUInt8, EAmlUInt32, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x32 */ { AML_OPCODE_DEF ("FatalOp", AML_EXT_OP), AML_EXT_FATAL_OP, 3, 0, { EAmlUInt8, EAmlUInt32, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x33 */ {AML_OPCODE_DEF ("TimerOp", AML_EXT_OP), AML_EXT_TIMER_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x5B 0x33 */ { AML_OPCODE_DEF ("TimerOp", AML_EXT_OP), AML_EXT_TIMER_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x5B 0x80 */ {AML_OPCODE_DEF ("OpRegionOp", AML_EXT_OP), AML_EXT_REGION_OP, 4, 0, {EAmlName, EAmlUInt8, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x5B 0x80 */ { AML_OPCODE_DEF ("OpRegionOp", AML_EXT_OP), AML_EXT_REGION_OP, 4, 0, { EAmlName, EAmlUInt8, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x5B 0x81 */ {AML_OPCODE_DEF ("FieldOp", AML_EXT_OP), AML_EXT_FIELD_OP, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST}, /* 0x5B 0x81 */ { AML_OPCODE_DEF ("FieldOp", AML_EXT_OP), AML_EXT_FIELD_OP, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
/* 0x5B 0x82 */ {AML_OPCODE_DEF ("DeviceOp", AML_EXT_OP), AML_EXT_DEVICE_OP, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x5B 0x82 */ { AML_OPCODE_DEF ("DeviceOp", AML_EXT_OP), AML_EXT_DEVICE_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x5B 0x83 */ {AML_OPCODE_DEF ("ProcessorOp", AML_EXT_OP), AML_EXT_PROCESSOR_OP, 4, 0, {EAmlName, EAmlUInt8, EAmlUInt32, EAmlUInt8, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x5B 0x83 */ { AML_OPCODE_DEF ("ProcessorOp", AML_EXT_OP), AML_EXT_PROCESSOR_OP, 4, 0, { EAmlName, EAmlUInt8, EAmlUInt32, EAmlUInt8, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x5B 0x84 */ {AML_OPCODE_DEF ("PowerResOp", AML_EXT_OP), AML_EXT_POWER_RES_OP, 3, 0, {EAmlName, EAmlUInt8, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x5B 0x84 */ { AML_OPCODE_DEF ("PowerResOp", AML_EXT_OP), AML_EXT_POWER_RES_OP, 3, 0, { EAmlName, EAmlUInt8, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x5B 0x85 */ {AML_OPCODE_DEF ("ThermalZoneOp", AML_EXT_OP), AML_EXT_THERMAL_ZONE_OP,1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE}, /* 0x5B 0x85 */ { AML_OPCODE_DEF ("ThermalZoneOp", AML_EXT_OP), AML_EXT_THERMAL_ZONE_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* 0x5B 0x86 */ {AML_OPCODE_DEF ("IndexFieldOp", AML_EXT_OP), AML_EXT_INDEX_FIELD_OP, 3, 0, {EAmlName, EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST}, /* 0x5B 0x86 */ { AML_OPCODE_DEF ("IndexFieldOp", AML_EXT_OP), AML_EXT_INDEX_FIELD_OP, 3, 0, { EAmlName, EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
/* 0x5B 0x87 */ {AML_OPCODE_DEF ("BankFieldOp", AML_EXT_OP), AML_EXT_BANK_FIELD_OP, 4, 0, {EAmlName, EAmlName, EAmlObject, EAmlUInt8, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST}, /* 0x5B 0x87 */ { AML_OPCODE_DEF ("BankFieldOp", AML_EXT_OP), AML_EXT_BANK_FIELD_OP, 4, 0, { EAmlName, EAmlName, EAmlObject, EAmlUInt8, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
/* 0x5B 0x88 */ {AML_OPCODE_DEF ("DataRegionOp", AML_EXT_OP), AML_EXT_DATA_REGION_OP, 4, 0, {EAmlName, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x5B 0x88 */ { AML_OPCODE_DEF ("DataRegionOp", AML_EXT_OP), AML_EXT_DATA_REGION_OP, 4, 0, { EAmlName, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x5C */ {AML_OPCODE_DEF ("RootChar", AML_ROOT_CHAR), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x5C */ { AML_OPCODE_DEF ("RootChar", AML_ROOT_CHAR), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x5E */ {AML_OPCODE_DEF ("ParentPrefixChar", AML_PARENT_PREFIX_CHAR), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x5E */ { AML_OPCODE_DEF ("ParentPrefixChar", AML_PARENT_PREFIX_CHAR), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x5F */ {AML_OPCODE_DEF ("NameChar", '_'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR}, /* 0x5F */ { AML_OPCODE_DEF ("NameChar", '_'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
/* 0x60 */ {AML_OPCODE_DEF ("Local0Op", AML_LOCAL0), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x60 */ { AML_OPCODE_DEF ("Local0Op", AML_LOCAL0), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x61 */ {AML_OPCODE_DEF ("Local1Op", AML_LOCAL1), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x61 */ { AML_OPCODE_DEF ("Local1Op", AML_LOCAL1), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x62 */ {AML_OPCODE_DEF ("Local2Op", AML_LOCAL2), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x62 */ { AML_OPCODE_DEF ("Local2Op", AML_LOCAL2), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x63 */ {AML_OPCODE_DEF ("Local3Op", AML_LOCAL3), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x63 */ { AML_OPCODE_DEF ("Local3Op", AML_LOCAL3), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x64 */ {AML_OPCODE_DEF ("Local4Op", AML_LOCAL4), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x64 */ { AML_OPCODE_DEF ("Local4Op", AML_LOCAL4), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x65 */ {AML_OPCODE_DEF ("Local5Op", AML_LOCAL5), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x65 */ { AML_OPCODE_DEF ("Local5Op", AML_LOCAL5), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x66 */ {AML_OPCODE_DEF ("Local6Op", AML_LOCAL6), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x66 */ { AML_OPCODE_DEF ("Local6Op", AML_LOCAL6), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x67 */ {AML_OPCODE_DEF ("Local7Op", AML_LOCAL7), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x67 */ { AML_OPCODE_DEF ("Local7Op", AML_LOCAL7), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x68 */ {AML_OPCODE_DEF ("Arg0Op", AML_ARG0), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x68 */ { AML_OPCODE_DEF ("Arg0Op", AML_ARG0), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x69 */ {AML_OPCODE_DEF ("Arg1Op", AML_ARG1), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x69 */ { AML_OPCODE_DEF ("Arg1Op", AML_ARG1), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x6A */ {AML_OPCODE_DEF ("Arg2Op", AML_ARG2), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x6A */ { AML_OPCODE_DEF ("Arg2Op", AML_ARG2), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x6B */ {AML_OPCODE_DEF ("Arg3Op", AML_ARG3), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x6B */ { AML_OPCODE_DEF ("Arg3Op", AML_ARG3), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x6C */ {AML_OPCODE_DEF ("Arg4Op", AML_ARG4), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x6C */ { AML_OPCODE_DEF ("Arg4Op", AML_ARG4), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x6D */ {AML_OPCODE_DEF ("Arg5Op", AML_ARG5), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x6D */ { AML_OPCODE_DEF ("Arg5Op", AML_ARG5), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x6E */ {AML_OPCODE_DEF ("Arg6Op", AML_ARG6), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x6E */ { AML_OPCODE_DEF ("Arg6Op", AML_ARG6), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x70 */ {AML_OPCODE_DEF ("StoreOp", AML_STORE_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x70 */ { AML_OPCODE_DEF ("StoreOp", AML_STORE_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x71 */ {AML_OPCODE_DEF ("RefOfOp", AML_REF_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x71 */ { AML_OPCODE_DEF ("RefOfOp", AML_REF_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x72 */ {AML_OPCODE_DEF ("AddOp", AML_ADD_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x72 */ { AML_OPCODE_DEF ("AddOp", AML_ADD_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x73 */ {AML_OPCODE_DEF ("ConcatOp", AML_CONCAT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x73 */ { AML_OPCODE_DEF ("ConcatOp", AML_CONCAT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x74 */ {AML_OPCODE_DEF ("SubtractOp", AML_SUBTRACT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x74 */ { AML_OPCODE_DEF ("SubtractOp", AML_SUBTRACT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x75 */ {AML_OPCODE_DEF ("IncrementOp", AML_INCREMENT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x75 */ { AML_OPCODE_DEF ("IncrementOp", AML_INCREMENT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x76 */ {AML_OPCODE_DEF ("DecrementOp", AML_DECREMENT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x76 */ { AML_OPCODE_DEF ("DecrementOp", AML_DECREMENT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x77 */ {AML_OPCODE_DEF ("MultiplyOp", AML_MULTIPLY_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x77 */ { AML_OPCODE_DEF ("MultiplyOp", AML_MULTIPLY_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x78 */ {AML_OPCODE_DEF ("DivideOp", AML_DIVIDE_OP), 0, 4, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, 0}, /* 0x78 */ { AML_OPCODE_DEF ("DivideOp", AML_DIVIDE_OP), 0, 4, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, 0 },
/* 0x79 */ {AML_OPCODE_DEF ("ShiftLeftOp", AML_SHIFT_LEFT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x79 */ { AML_OPCODE_DEF ("ShiftLeftOp", AML_SHIFT_LEFT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7A */ {AML_OPCODE_DEF ("ShiftRightOp", AML_SHIFT_RIGHT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7A */ { AML_OPCODE_DEF ("ShiftRightOp", AML_SHIFT_RIGHT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7B */ {AML_OPCODE_DEF ("AndOp", AML_AND_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7B */ { AML_OPCODE_DEF ("AndOp", AML_AND_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7C */ {AML_OPCODE_DEF ("NAndOp", AML_NAND_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7C */ { AML_OPCODE_DEF ("NAndOp", AML_NAND_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7D */ {AML_OPCODE_DEF ("OrOp", AML_OR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7D */ { AML_OPCODE_DEF ("OrOp", AML_OR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7E */ {AML_OPCODE_DEF ("NorOp", AML_NOR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7E */ { AML_OPCODE_DEF ("NorOp", AML_NOR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x7F */ {AML_OPCODE_DEF ("XOrOp", AML_XOR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x7F */ { AML_OPCODE_DEF ("XOrOp", AML_XOR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x80 */ {AML_OPCODE_DEF ("NotOp", AML_NOT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x80 */ { AML_OPCODE_DEF ("NotOp", AML_NOT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x81 */ {AML_OPCODE_DEF ("FindSetLeftBitOp", AML_FIND_SET_LEFT_BIT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x81 */ { AML_OPCODE_DEF ("FindSetLeftBitOp", AML_FIND_SET_LEFT_BIT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x82 */ {AML_OPCODE_DEF ("FindSetRightBitOp", AML_FIND_SET_RIGHT_BIT_OP),0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x82 */ { AML_OPCODE_DEF ("FindSetRightBitOp", AML_FIND_SET_RIGHT_BIT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x83 */ {AML_OPCODE_DEF ("DerefOfOp", AML_DEREF_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x83 */ { AML_OPCODE_DEF ("DerefOfOp", AML_DEREF_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x84 */ {AML_OPCODE_DEF ("ConcatResOp", AML_CONCAT_RES_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x84 */ { AML_OPCODE_DEF ("ConcatResOp", AML_CONCAT_RES_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x85 */ {AML_OPCODE_DEF ("ModOp", AML_MOD_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x85 */ { AML_OPCODE_DEF ("ModOp", AML_MOD_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x86 */ {AML_OPCODE_DEF ("NotifyOp", AML_NOTIFY_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x86 */ { AML_OPCODE_DEF ("NotifyOp", AML_NOTIFY_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x87 */ {AML_OPCODE_DEF ("SizeOfOp", AML_SIZE_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x87 */ { AML_OPCODE_DEF ("SizeOfOp", AML_SIZE_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x88 */ {AML_OPCODE_DEF ("IndexOp", AML_INDEX_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x88 */ { AML_OPCODE_DEF ("IndexOp", AML_INDEX_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x89 */ {AML_OPCODE_DEF ("MatchOp", AML_MATCH_OP), 0, 6, 0, {EAmlObject, EAmlUInt8, EAmlObject, EAmlUInt8, EAmlObject, EAmlObject}, 0}, /* 0x89 */ { AML_OPCODE_DEF ("MatchOp", AML_MATCH_OP), 0, 6, 0, { EAmlObject, EAmlUInt8, EAmlObject, EAmlUInt8, EAmlObject, EAmlObject }, 0 },
/* 0x8A */ {AML_OPCODE_DEF ("CreateDWordFieldOp", AML_CREATE_DWORD_FIELD_OP),0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x8A */ { AML_OPCODE_DEF ("CreateDWordFieldOp", AML_CREATE_DWORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x8B */ {AML_OPCODE_DEF ("CreateWordFieldOp", AML_CREATE_WORD_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x8B */ { AML_OPCODE_DEF ("CreateWordFieldOp", AML_CREATE_WORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x8C */ {AML_OPCODE_DEF ("CreateByteFieldOp", AML_CREATE_BYTE_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x8C */ { AML_OPCODE_DEF ("CreateByteFieldOp", AML_CREATE_BYTE_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x8D */ {AML_OPCODE_DEF ("CreateBitFieldOp", AML_CREATE_BIT_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x8D */ { AML_OPCODE_DEF ("CreateBitFieldOp", AML_CREATE_BIT_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x8E */ {AML_OPCODE_DEF ("ObjectTypeOp", AML_OBJECT_TYPE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x8E */ { AML_OPCODE_DEF ("ObjectTypeOp", AML_OBJECT_TYPE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x8F */ {AML_OPCODE_DEF ("CreateQWordFieldOp", AML_CREATE_QWORD_FIELD_OP),0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE}, /* 0x8F */ { AML_OPCODE_DEF ("CreateQWordFieldOp", AML_CREATE_QWORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
/* 0x90 */ {AML_OPCODE_DEF ("LAndOp", AML_LAND_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x90 */ { AML_OPCODE_DEF ("LAndOp", AML_LAND_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x91 */ {AML_OPCODE_DEF ("LOrOp", AML_LOR_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x91 */ { AML_OPCODE_DEF ("LOrOp", AML_LOR_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x92 */ {AML_OPCODE_DEF ("LNotOp", AML_LNOT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x92 */ { AML_OPCODE_DEF ("LNotOp", AML_LNOT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x93 */ {AML_OPCODE_DEF ("LEqualOp", AML_LEQUAL_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x93 */ { AML_OPCODE_DEF ("LEqualOp", AML_LEQUAL_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x94 */ {AML_OPCODE_DEF ("LGreaterOp", AML_LGREATER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x94 */ { AML_OPCODE_DEF ("LGreaterOp", AML_LGREATER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x95 */ {AML_OPCODE_DEF ("LLessOp", AML_LLESS_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x95 */ { AML_OPCODE_DEF ("LLessOp", AML_LLESS_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x96 */ {AML_OPCODE_DEF ("ToBufferOp", AML_TO_BUFFER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x96 */ { AML_OPCODE_DEF ("ToBufferOp", AML_TO_BUFFER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x97 */ {AML_OPCODE_DEF ("ToDecimalStringOp", AML_TO_DEC_STRING_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x97 */ { AML_OPCODE_DEF ("ToDecimalStringOp", AML_TO_DEC_STRING_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x98 */ {AML_OPCODE_DEF ("ToHexStringOp", AML_TO_HEX_STRING_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x98 */ { AML_OPCODE_DEF ("ToHexStringOp", AML_TO_HEX_STRING_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x99 */ {AML_OPCODE_DEF ("ToIntegerOp", AML_TO_INTEGER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x99 */ { AML_OPCODE_DEF ("ToIntegerOp", AML_TO_INTEGER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x9C */ {AML_OPCODE_DEF ("ToStringOp", AML_TO_STRING_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x9C */ { AML_OPCODE_DEF ("ToStringOp", AML_TO_STRING_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x9D */ {AML_OPCODE_DEF ("CopyObjectOp", AML_COPY_OBJECT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x9D */ { AML_OPCODE_DEF ("CopyObjectOp", AML_COPY_OBJECT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x9E */ {AML_OPCODE_DEF ("MidOp", AML_MID_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x9E */ { AML_OPCODE_DEF ("MidOp", AML_MID_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0x9F */ {AML_OPCODE_DEF ("ContinueOp", AML_CONTINUE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0x9F */ { AML_OPCODE_DEF ("ContinueOp", AML_CONTINUE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0xA0 */ {AML_OPCODE_DEF ("IfOp", AML_IF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ}, /* 0xA0 */ { AML_OPCODE_DEF ("IfOp", AML_IF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* 0xA1 */ {AML_OPCODE_DEF ("ElseOp", AML_ELSE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ}, /* 0xA1 */ { AML_OPCODE_DEF ("ElseOp", AML_ELSE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* 0xA2 */ {AML_OPCODE_DEF ("WhileOp", AML_WHILE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ}, /* 0xA2 */ { AML_OPCODE_DEF ("WhileOp", AML_WHILE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* 0xA3 */ {AML_OPCODE_DEF ("NoopOp", AML_NOOP_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0xA3 */ { AML_OPCODE_DEF ("NoopOp", AML_NOOP_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0xA4 */ {AML_OPCODE_DEF ("ReturnOp", AML_RETURN_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0xA4 */ { AML_OPCODE_DEF ("ReturnOp", AML_RETURN_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0xA5 */ {AML_OPCODE_DEF ("BreakOp", AML_BREAK_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0xA5 */ { AML_OPCODE_DEF ("BreakOp", AML_BREAK_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0xCC */ {AML_OPCODE_DEF ("BreakPointOp", AML_BREAK_POINT_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0xCC */ { AML_OPCODE_DEF ("BreakPointOp", AML_BREAK_POINT_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
/* 0xD0 */ {AML_OPCODE_DEF ("MethodInvocOp", AML_METHOD_INVOC_OP), 0, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ}, /* 0xD0 */ { AML_OPCODE_DEF ("MethodInvocOp", AML_METHOD_INVOC_OP), 0, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ },
/* 0xFF */ {AML_OPCODE_DEF ("OnesOp", AML_ONES_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0}, /* 0xFF */ { AML_OPCODE_DEF ("OnesOp", AML_ONES_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
}; };
/** AML grammar encoding for field elements. /** AML grammar encoding for field elements.
@ -266,11 +266,11 @@ STATIC
CONST CONST
AML_BYTE_ENCODING mAmlFieldEncoding[] = { AML_BYTE_ENCODING mAmlFieldEncoding[] = {
// Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute // Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute
/* 0x00 */ {AML_OPCODE_DEF ("FieldReservedOp", AML_FIELD_RESERVED_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH}, /* 0x00 */ { AML_OPCODE_DEF ("FieldReservedOp", AML_FIELD_RESERVED_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH },
/* 0x01 */ {AML_OPCODE_DEF ("FieldAccessOp", AML_FIELD_ACCESS_OP), 0, 2, 0, {EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT}, /* 0x01 */ { AML_OPCODE_DEF ("FieldAccessOp", AML_FIELD_ACCESS_OP), 0, 2, 0, { EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
/* 0x02 */ {AML_OPCODE_DEF ("FieldConnectionOp", AML_FIELD_CONNECTION_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT}, /* 0x02 */ { AML_OPCODE_DEF ("FieldConnectionOp", AML_FIELD_CONNECTION_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
/* 0x03 */ {AML_OPCODE_DEF ("FieldExtAccessOp", AML_FIELD_EXT_ACCESS_OP), 0, 3, 0, {EAmlUInt8, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT}, /* 0x03 */ { AML_OPCODE_DEF ("FieldExtAccessOp", AML_FIELD_EXT_ACCESS_OP), 0, 3, 0, { EAmlUInt8, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
/* 0x04 */ {AML_OPCODE_DEF ("FieldNamed", AML_FIELD_NAMED_OP), 0, 2, 0, {EAmlName, EAmlFieldPkgLen, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE} /* 0x04 */ { AML_OPCODE_DEF ("FieldNamed", AML_FIELD_NAMED_OP), 0, 2, 0, { EAmlName, EAmlFieldPkgLen, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE }
}; };
/** Get the AML_BYTE_ENCODING entry in the AML encoding table. /** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@ -288,7 +288,7 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetByteEncoding ( AmlGetByteEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
) )
{ {
UINT8 OpCode; UINT8 OpCode;
@ -311,16 +311,20 @@ AmlGetByteEncoding (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0])); Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) { Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) && if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) { (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) == 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. // A pseudo OpCode cannot be parsed as it is internal to this library.
// The MethodInvocation encoding can be detected by NameSpace lookup. // The MethodInvocation encoding can be detected by NameSpace lookup.
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
return &mAmlByteEncoding[Index]; return &mAmlByteEncoding[Index];
} }
} }
@ -350,12 +354,15 @@ AmlGetByteEncodingByOpCode (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0])); Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) { Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) && if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) { (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return &mAmlByteEncoding[Index]; return &mAmlByteEncoding[Index];
} }
} }
return NULL; return NULL;
} }
@ -374,7 +381,7 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetFieldEncoding ( AmlGetFieldEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
) )
{ {
UINT8 OpCode; UINT8 OpCode;
@ -391,16 +398,19 @@ AmlGetFieldEncoding (
// Search in the table. // Search in the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0])); Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) { Index++)
{
if (mAmlFieldEncoding[Index].OpCode == OpCode) { if (mAmlFieldEncoding[Index].OpCode == OpCode) {
if ((mAmlFieldEncoding[Index].Attribute & AML_IS_PSEUDO_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. // A pseudo OpCode cannot be parsed as it is internal to this library.
// The NamedField encoding can be detected because it begins with a // The NamedField encoding can be detected because it begins with a
// char. // char.
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
return &mAmlFieldEncoding[Index]; return &mAmlFieldEncoding[Index];
} }
} }
@ -431,17 +441,21 @@ AmlGetFieldEncodingByOpCode (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0])); Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) { Index++)
{
if ((mAmlFieldEncoding[Index].OpCode == OpCode) && if ((mAmlFieldEncoding[Index].OpCode == OpCode) &&
(mAmlFieldEncoding[Index].SubOpCode == SubOpCode)) { (mAmlFieldEncoding[Index].SubOpCode == SubOpCode))
{
return &mAmlFieldEncoding[Index]; return &mAmlFieldEncoding[Index];
} }
} }
return NULL; return NULL;
} }
// Enable this function for debug. // Enable this function for debug.
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
/** Look for an OpCode/SubOpCode couple in the AML grammar, /** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string. and return a corresponding string.
@ -463,9 +477,11 @@ AmlGetOpCodeStr (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0])); Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) { Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) && if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) { (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return mAmlByteEncoding[Index].Str; return mAmlByteEncoding[Index].Str;
} }
} }
@ -500,7 +516,8 @@ AmlGetFieldOpCodeStr (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0])); Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
Index++) { Index++)
{
if ((mAmlFieldEncoding[Index].OpCode == OpCode)) { if ((mAmlFieldEncoding[Index].OpCode == OpCode)) {
return mAmlFieldEncoding[Index].Str; return mAmlFieldEncoding[Index].Str;
} }
@ -509,6 +526,7 @@ AmlGetFieldOpCodeStr (
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
#endif // MDEPKG_NDEBUG #endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry /** Check whether the OpCode/SubOpcode couple is a valid entry
@ -532,12 +550,15 @@ AmlIsOpCodeValid (
// Search the table. // Search the table.
for (Index = 0; for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0])); Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++) { Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) && if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode)) { (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
@ -577,7 +598,8 @@ AmlTypeToNodeDataType (
) )
{ {
if (AmlType >= if (AmlType >=
(sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0]))) { (sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0])))
{
ASSERT (0); ASSERT (0);
return EAmlNodeDataTypeNone; return EAmlNodeDataTypeNone;
} }
@ -597,8 +619,8 @@ AmlTypeToNodeDataType (
UINT32 UINT32
EFIAPI EFIAPI
AmlGetPkgLength ( AmlGetPkgLength (
IN CONST UINT8 * Buffer, IN CONST UINT8 *Buffer,
OUT UINT32 * PkgLength OUT UINT32 *PkgLength
) )
{ {
UINT8 LeadByte; UINT8 LeadByte;
@ -607,7 +629,8 @@ AmlGetPkgLength (
UINT32 Offset; UINT32 Offset;
if ((Buffer == NULL) || if ((Buffer == NULL) ||
(PkgLength == NULL)) { (PkgLength == NULL))
{
ASSERT (0); ASSERT (0);
return 0; return 0;
} }
@ -700,7 +723,7 @@ UINT8
EFIAPI EFIAPI
AmlSetPkgLength ( AmlSetPkgLength (
IN UINT32 Length, IN UINT32 Length,
OUT UINT8 * Buffer OUT UINT8 *Buffer
) )
{ {
UINT8 LeadByte; UINT8 LeadByte;
@ -720,7 +743,6 @@ AmlSetPkgLength (
if ((Length < (1 << 6))) { if ((Length < (1 << 6))) {
// Length < 2^6, only need one byte to encode it. // Length < 2^6, only need one byte to encode it.
LeadByte = (UINT8)Length; LeadByte = (UINT8)Length;
} else { } else {
// Need more than one byte to encode it. // Need more than one byte to encode it.
// Test Length to find how many bytes are needed. // Test Length to find how many bytes are needed.
@ -729,19 +751,15 @@ AmlSetPkgLength (
// Length >= 2^28, should not be possible. // Length >= 2^28, should not be possible.
ASSERT (0); ASSERT (0);
return 0; return 0;
} else if (Length >= (1 << 20)) { } else if (Length >= (1 << 20)) {
// Length >= 2^20 // Length >= 2^20
Offset = 3; Offset = 3;
} else if (Length >= (1 << 12)) { } else if (Length >= (1 << 12)) {
// Length >= 2^12 // Length >= 2^12
Offset = 2; Offset = 2;
} else if (Length >= (1 << 6)) { } else if (Length >= (1 << 6)) {
// Length >= 2^6 // Length >= 2^6
Offset = 1; Offset = 1;
} else { } else {
// Should not be possible. // Should not be possible.
ASSERT (0); ASSERT (0);
@ -786,15 +804,12 @@ AmlComputePkgLengthWidth (
if (Length >= (1 << 28)) { if (Length >= (1 << 28)) {
ASSERT (0); ASSERT (0);
return 0; return 0;
} else if (Length >= (1 << 20)) { } else if (Length >= (1 << 20)) {
// Length >= 2^20 // Length >= 2^20
return 4; return 4;
} else if (Length >= (1 << 12)) { } else if (Length >= (1 << 12)) {
// Length >= 2^12 // Length >= 2^12
return 3; return 3;
} else if (Length >= (1 << 6)) { } else if (Length >= (1 << 6)) {
// Length >= 2^6 // Length >= 2^6
return 2; return 2;
@ -846,7 +861,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlComputePkgLength ( AmlComputePkgLength (
IN UINT32 Length, IN UINT32 Length,
OUT UINT32 * PkgLen OUT UINT32 *PkgLen
) )
{ {
UINT32 PkgLenWidth; UINT32 PkgLenWidth;
@ -874,7 +889,8 @@ AmlComputePkgLength (
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length); ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
if (ReComputedPkgLenWidth != PkgLenWidth) { if (ReComputedPkgLenWidth != PkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) && if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4)) { (ReComputedPkgLenWidth < 4))
{
// No need to recompute the PkgLen since a new threshold cannot // No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one. // be reached by incrementing the value by one.
Length += 1; Length += 1;

View File

@ -112,11 +112,11 @@ typedef UINT32 AML_OP_ATTRIBUTE;
Cf. ACPI 6.3 specification, s20.2. Cf. ACPI 6.3 specification, s20.2.
*/ */
typedef struct _AML_BYTE_ENCODING { typedef struct _AML_BYTE_ENCODING {
// Enable this field for debug. // Enable this field for debug.
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
/// String field allowing to print the AML object. /// String field allowing to print the AML object.
CONST CHAR8 * Str; CONST CHAR8 *Str;
#endif // MDEPKG_NDEBUG #endif // MDEPKG_NDEBUG
/// OpCode of the AML object. /// OpCode of the AML object.
UINT8 OpCode; UINT8 OpCode;
@ -160,7 +160,7 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetByteEncoding ( AmlGetByteEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
); );
/** Get the AML_BYTE_ENCODING entry in the AML encoding table /** Get the AML_BYTE_ENCODING entry in the AML encoding table
@ -195,7 +195,7 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetFieldEncoding ( AmlGetFieldEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
); );
/** Get the AML_BYTE_ENCODING entry in the field encoding table /** Get the AML_BYTE_ENCODING entry in the field encoding table
@ -218,6 +218,7 @@ AmlGetFieldEncodingByOpCode (
// Enable this function for debug. // Enable this function for debug.
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
/** Look for an OpCode/SubOpCode couple in the AML grammar, /** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string. and return a corresponding string.
@ -249,6 +250,7 @@ AmlGetFieldOpCodeStr (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
#endif // MDEPKG_NDEBUG #endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry /** Check whether the OpCode/SubOpcode couple is a valid entry
@ -292,8 +294,8 @@ AmlTypeToNodeDataType (
UINT32 UINT32
EFIAPI EFIAPI
AmlGetPkgLength ( AmlGetPkgLength (
IN CONST UINT8 * Buffer, IN CONST UINT8 *Buffer,
OUT UINT32 * PkgLength OUT UINT32 *PkgLength
); );
/** Convert the Length to the AML PkgLen encoding, /** Convert the Length to the AML PkgLen encoding,
@ -309,7 +311,7 @@ UINT8
EFIAPI EFIAPI
AmlSetPkgLength ( AmlSetPkgLength (
IN UINT32 Length, IN UINT32 Length,
OUT UINT8 * Buffer OUT UINT8 *Buffer
); );
/** Compute the number of bytes required to write a package length. /** Compute the number of bytes required to write a package length.
@ -368,8 +370,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlComputePkgLength ( AmlComputePkgLength (
IN UINT32 Length, IN UINT32 Length,
OUT UINT32 * PkgLen OUT UINT32 *PkgLen
); );
#endif // AML_H_ #endif // AML_H_

View File

@ -22,7 +22,7 @@ typedef struct AmlNodeHeader {
LIST_ENTRY Link; LIST_ENTRY Link;
/// Parent of this node. NULL for the root node. /// Parent of this node. NULL for the root node.
struct AmlNodeHeader * Parent; struct AmlNodeHeader *Parent;
/// Node type allowing to identify a root/object/data node. /// Node type allowing to identify a root/object/data node.
EAML_NODE_TYPE NodeType; EAML_NODE_TYPE NodeType;
@ -30,7 +30,7 @@ typedef struct AmlNodeHeader {
/** Node handle. /** Node handle.
*/ */
typedef AML_NODE_HEADER* AML_NODE_HANDLE; typedef AML_NODE_HEADER *AML_NODE_HANDLE;
/** AML root node. /** AML root node.
@ -47,12 +47,12 @@ typedef struct AmlRootNode {
LIST_ENTRY VariableArgs; LIST_ENTRY VariableArgs;
/// ACPI DSDT/SSDT header. /// ACPI DSDT/SSDT header.
EFI_ACPI_DESCRIPTION_HEADER * SdtHeader; EFI_ACPI_DESCRIPTION_HEADER *SdtHeader;
} AML_ROOT_NODE; } AML_ROOT_NODE;
/** Root Node handle. /** Root Node handle.
*/ */
typedef AML_ROOT_NODE* AML_ROOT_NODE_HANDLE; typedef AML_ROOT_NODE *AML_ROOT_NODE_HANDLE;
/** AML object node. /** AML object node.
@ -71,11 +71,11 @@ typedef struct AmlObjectNode {
/// Fixed arguments of this object node. /// Fixed arguments of this object node.
/// These are children and can be object/data nodes. /// These are children and can be object/data nodes.
/// Cf ACPI specification, s20.3. /// Cf ACPI specification, s20.3.
AML_NODE_HEADER * FixedArgs[EAmlParseIndexMax]; AML_NODE_HEADER *FixedArgs[EAmlParseIndexMax];
/// AML byte encoding. Stores the encoding information: /// AML byte encoding. Stores the encoding information:
/// (OpCode/SubOpCode/number of fixed arguments/ attributes). /// (OpCode/SubOpCode/number of fixed arguments/ attributes).
CONST AML_BYTE_ENCODING * AmlByteEncoding; CONST AML_BYTE_ENCODING *AmlByteEncoding;
/// Some nodes have a PkgLen following their OpCode/SubOpCode in the /// Some nodes have a PkgLen following their OpCode/SubOpCode in the
/// AML bytestream. This field stores the decoded value of the PkgLen. /// AML bytestream. This field stores the decoded value of the PkgLen.
@ -84,7 +84,7 @@ typedef struct AmlObjectNode {
/** Object Node handle. /** Object Node handle.
*/ */
typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE; typedef AML_OBJECT_NODE *AML_OBJECT_NODE_HANDLE;
/** AML data node. /** AML data node.
@ -101,7 +101,7 @@ typedef struct AmlDataNode {
EAML_NODE_DATA_TYPE DataType; EAML_NODE_DATA_TYPE DataType;
/// Buffer containing the data stored by this node. /// Buffer containing the data stored by this node.
UINT8 * Buffer; UINT8 *Buffer;
/// Size of the Buffer. /// Size of the Buffer.
UINT32 Size; UINT32 Size;
@ -109,7 +109,7 @@ typedef struct AmlDataNode {
/** Data Node handle. /** Data Node handle.
*/ */
typedef AML_DATA_NODE* AML_DATA_NODE_HANDLE; typedef AML_DATA_NODE *AML_DATA_NODE_HANDLE;
/** Check whether a Node has a valid NodeType. /** Check whether a Node has a valid NodeType.

View File

@ -40,20 +40,21 @@ EFI_STATUS
EFIAPI EFIAPI
AmlDeviceOpUpdateName ( AmlDeviceOpUpdateName (
IN AML_OBJECT_NODE_HANDLE DeviceOpNode, IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
IN CHAR8 * NewNameString IN CHAR8 *NewNameString
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE_HANDLE DeviceNameDataNode; AML_DATA_NODE_HANDLE DeviceNameDataNode;
CHAR8 * NewAmlNameString; CHAR8 *NewAmlNameString;
UINT32 NewAmlNameStringSize; UINT32 NewAmlNameStringSize;
// Check the input node is an object node. // Check the input node is an object node.
if ((DeviceOpNode == NULL) || if ((DeviceOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)DeviceOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (DeviceOpNode, AML_EXT_OP, AML_EXT_DEVICE_OP)) || (!AmlNodeHasOpCode (DeviceOpNode, AML_EXT_OP, AML_EXT_DEVICE_OP)) ||
(NewNameString == NULL)) { (NewNameString == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -66,7 +67,8 @@ AmlDeviceOpUpdateName (
); );
if ((DeviceNameDataNode == NULL) || if ((DeviceNameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceNameDataNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)DeviceNameDataNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString))) { (!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -87,7 +89,7 @@ AmlDeviceOpUpdateName (
Status = AmlUpdateDataNode ( Status = AmlUpdateDataNode (
DeviceNameDataNode, DeviceNameDataNode,
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)NewAmlNameString, (UINT8 *)NewAmlNameString,
NewAmlNameStringSize NewAmlNameStringSize
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -124,7 +126,8 @@ AmlNameOpUpdateInteger (
if ((NameOpNode == NULL) || if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) { (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -138,7 +141,8 @@ AmlNameOpUpdateInteger (
EAmlParseIndexTerm1 EAmlParseIndexTerm1
); );
if ((IntegerOpNode == NULL) || if ((IntegerOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject)) { (AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -171,7 +175,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpUpdateString ( AmlNameOpUpdateString (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
IN CONST CHAR8 * NewName IN CONST CHAR8 *NewName
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -180,7 +184,8 @@ AmlNameOpUpdateString (
if ((NameOpNode == NULL) || if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) { (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -193,7 +198,8 @@ AmlNameOpUpdateString (
EAmlParseIndexTerm1 EAmlParseIndexTerm1
); );
if ((StringOpNode == NULL) || if ((StringOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject)) { (AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -205,7 +211,8 @@ AmlNameOpUpdateString (
EAmlParseIndexTerm0 EAmlParseIndexTerm0
); );
if ((StringDataNode == NULL) || if ((StringDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData)) { (AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -214,7 +221,7 @@ AmlNameOpUpdateString (
Status = AmlUpdateDataNode ( Status = AmlUpdateDataNode (
StringDataNode, StringDataNode,
EAmlNodeDataTypeString, EAmlNodeDataTypeString,
(UINT8*)NewName, (UINT8 *)NewName,
(UINT32)AsciiStrLen (NewName) + 1 (UINT32)AsciiStrLen (NewName) + 1
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -251,7 +258,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpGetFirstRdNode ( AmlNameOpGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
) )
{ {
AML_OBJECT_NODE_HANDLE BufferOpNode; AML_OBJECT_NODE_HANDLE BufferOpNode;
@ -260,7 +267,8 @@ AmlNameOpGetFirstRdNode (
if ((NameOpNode == NULL) || if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) || (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(OutRdNode == NULL)) { (OutRdNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -275,7 +283,8 @@ AmlNameOpGetFirstRdNode (
); );
if ((BufferOpNode == NULL) || if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) { (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -288,7 +297,8 @@ AmlNameOpGetFirstRdNode (
); );
if ((FirstRdNode == NULL) || if ((FirstRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)FirstRdNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)FirstRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData))) { (!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -328,7 +338,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpGetNextRdNode ( AmlNameOpGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode, IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
) )
{ {
AML_OBJECT_NODE_HANDLE NameOpNode; AML_OBJECT_NODE_HANDLE NameOpNode;
@ -337,7 +347,8 @@ AmlNameOpGetNextRdNode (
if ((CurrRdNode == NULL) || if ((CurrRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)CurrRdNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)CurrRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (CurrRdNode, EAmlNodeDataTypeResourceData)) || (!AmlNodeHasDataType (CurrRdNode, EAmlNodeDataTypeResourceData)) ||
(OutRdNode == NULL)) { (OutRdNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -349,7 +360,8 @@ AmlNameOpGetNextRdNode (
(AML_NODE_HANDLE)CurrRdNode (AML_NODE_HANDLE)CurrRdNode
); );
if ((BufferOpNode == NULL) || if ((BufferOpNode == NULL) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) { (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -359,7 +371,8 @@ AmlNameOpGetNextRdNode (
(AML_NODE_HANDLE)BufferOpNode (AML_NODE_HANDLE)BufferOpNode
); );
if ((NameOpNode == NULL) || if ((NameOpNode == NULL) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) { (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -372,7 +385,9 @@ AmlNameOpGetNextRdNode (
// If the Resource Data is an End Tag, return NULL. // If the Resource Data is an End Tag, return NULL.
if (AmlNodeHasRdDataType ( if (AmlNodeHasRdDataType (
*OutRdNode, *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; *OutRdNode = NULL;
} }
@ -416,7 +431,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpCrsGetFirstRdNode ( AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
) )
{ {
return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode); return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
@ -456,7 +471,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlNameOpCrsGetNextRdNode ( AmlNameOpCrsGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode, IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode OUT AML_DATA_NODE_HANDLE *OutRdNode
) )
{ {
return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode); return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);

View File

@ -45,13 +45,13 @@ BOOLEAN
EFIAPI EFIAPI
AmlNameOpCompareName ( AmlNameOpCompareName (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
IN CHAR8 * AslName IN CHAR8 *AslName
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE_HANDLE NameDataNode; AML_DATA_NODE_HANDLE NameDataNode;
CHAR8 * AmlName; CHAR8 *AmlName;
UINT32 AmlNameSize; UINT32 AmlNameSize;
BOOLEAN RetVal; BOOLEAN RetVal;
@ -59,7 +59,8 @@ AmlNameOpCompareName (
if ((NameOpNode == NULL) || if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) || (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(AslName == NULL)) { (AslName == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -72,7 +73,8 @@ AmlNameOpCompareName (
); );
if ((NameDataNode == NULL) || if ((NameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameDataNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)NameDataNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString))) { (!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString)))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -92,7 +94,7 @@ AmlNameOpCompareName (
} }
// Fetch the name. // Fetch the name.
Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8*)AmlName, &AmlNameSize); Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8 *)AmlName, &AmlNameSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
FreePool (AmlName); FreePool (AmlName);
ASSERT (0); ASSERT (0);
@ -144,7 +146,8 @@ AmlNodeHasOpCode (
// Check the OpCode and SubOpCode. // Check the OpCode and SubOpCode.
if ((OpCode != NodeOpCode) || if ((OpCode != NodeOpCode) ||
(SubOpCode != NodeSubOpCode)) { (SubOpCode != NodeSubOpCode))
{
return FALSE; return FALSE;
} }

View File

@ -37,7 +37,7 @@ BOOLEAN
EFIAPI EFIAPI
AmlNameOpCompareName ( AmlNameOpCompareName (
IN AML_OBJECT_NODE_HANDLE NameOpNode, IN AML_OBJECT_NODE_HANDLE NameOpNode,
IN CHAR8 * AslName IN CHAR8 *AslName
); );
/** Check whether ObjectNode has the input OpCode/SubOpcode couple. /** Check whether ObjectNode has the input OpCode/SubOpcode couple.

View File

@ -46,19 +46,23 @@ AmlUpdateRdInterrupt (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 * FirstInterrupt; UINT32 *FirstInterrupt;
UINT8 * QueryBuffer; UINT8 *QueryBuffer;
UINT32 QueryBufferSize; UINT32 QueryBufferSize;
if ((InterruptRdNode == NULL) || if ((InterruptRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType ( (!AmlNodeHasDataType (
InterruptRdNode, InterruptRdNode,
EAmlNodeDataTypeResourceData)) || EAmlNodeDataTypeResourceData
)) ||
(!AmlNodeHasRdDataType ( (!AmlNodeHasRdDataType (
InterruptRdNode, InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID ( AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME)))) { ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
)
)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -102,7 +106,7 @@ AmlUpdateRdInterrupt (
// Get the address of the first interrupt field. // Get the address of the first interrupt field.
FirstInterrupt = FirstInterrupt =
((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)QueryBuffer)->InterruptNumber; ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)QueryBuffer)->InterruptNumber;
*FirstInterrupt = Irq; *FirstInterrupt = Irq;
@ -121,6 +125,7 @@ error_handler:
if (QueryBuffer != NULL) { if (QueryBuffer != NULL) {
FreePool (QueryBuffer); FreePool (QueryBuffer);
} }
return Status; return Status;
} }
@ -156,28 +161,32 @@ AmlUpdateRdInterruptEx (
IN BOOLEAN EdgeTriggered, IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow, IN BOOLEAN ActiveLow,
IN BOOLEAN Shared, IN BOOLEAN Shared,
IN UINT32 * IrqList, IN UINT32 *IrqList,
IN UINT8 IrqCount IN UINT8 IrqCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR * RdInterrupt; EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *RdInterrupt;
UINT32 * FirstInterrupt; UINT32 *FirstInterrupt;
UINT8 * UpdateBuffer; UINT8 *UpdateBuffer;
UINT16 UpdateBufferSize; UINT16 UpdateBufferSize;
if ((InterruptRdNode == NULL) || if ((InterruptRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType ( (!AmlNodeHasDataType (
InterruptRdNode, InterruptRdNode,
EAmlNodeDataTypeResourceData)) || EAmlNodeDataTypeResourceData
)) ||
(!AmlNodeHasRdDataType ( (!AmlNodeHasRdDataType (
InterruptRdNode, InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID ( AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME))) || ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
)
)) ||
(IrqList == NULL) || (IrqList == NULL) ||
(IrqCount == 0)) { (IrqCount == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -194,7 +203,7 @@ AmlUpdateRdInterruptEx (
} }
// Update the Resource Data information (structure size, interrupt count). // Update the Resource Data information (structure size, interrupt count).
RdInterrupt = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer; RdInterrupt = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer;
RdInterrupt->Header.Header.Byte = RdInterrupt->Header.Header.Byte =
AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME); AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME);
RdInterrupt->Header.Length = RdInterrupt->Header.Length =
@ -207,7 +216,7 @@ AmlUpdateRdInterruptEx (
// Get the address of the first interrupt field. // Get the address of the first interrupt field.
FirstInterrupt = FirstInterrupt =
((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer)->InterruptNumber; ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer)->InterruptNumber;
// Copy the input list of interrupts. // Copy the input list of interrupts.
CopyMem (FirstInterrupt, IrqList, (sizeof (UINT32) * IrqCount)); CopyMem (FirstInterrupt, IrqList, (sizeof (UINT32) * IrqCount));
@ -249,9 +258,9 @@ AmlUpdateRdQWord (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR * RdQWord; EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *RdQWord;
UINT8 * QueryBuffer; UINT8 *QueryBuffer;
UINT32 QueryBufferSize; UINT32 QueryBufferSize;
if ((QWordRdNode == NULL) || if ((QWordRdNode == NULL) ||
@ -260,7 +269,10 @@ AmlUpdateRdQWord (
(!AmlNodeHasRdDataType ( (!AmlNodeHasRdDataType (
QWordRdNode, QWordRdNode,
AML_RD_BUILD_LARGE_DESC_ID ( AML_RD_BUILD_LARGE_DESC_ID (
ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME)))) { ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME
)
)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -294,7 +306,7 @@ AmlUpdateRdQWord (
goto error_handler; goto error_handler;
} }
RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR*)QueryBuffer; RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *)QueryBuffer;
// Update the Base Address and Length. // Update the Base Address and Length.
RdQWord->AddrRangeMin = BaseAddress; RdQWord->AddrRangeMin = BaseAddress;
@ -316,5 +328,6 @@ error_handler:
if (QueryBuffer != NULL) { if (QueryBuffer != NULL) {
FreePool (QueryBuffer); FreePool (QueryBuffer);
} }
return Status; return Status;
} }

View File

@ -35,9 +35,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
LinkNode ( LinkNode (
IN AML_OBJECT_NODE * Node, IN AML_OBJECT_NODE *Node,
IN AML_NODE_HEADER * ParentNode, IN AML_NODE_HEADER *ParentNode,
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -48,7 +48,7 @@ LinkNode (
// Add RdNode as the last element. // Add RdNode as the last element.
if (ParentNode != NULL) { if (ParentNode != NULL) {
Status = AmlVarListAddTail (ParentNode, (AML_NODE_HEADER*)Node); Status = AmlVarListAddTail (ParentNode, (AML_NODE_HEADER *)Node);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -89,11 +89,11 @@ LinkNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenDefinitionBlock ( AmlCodeGenDefinitionBlock (
IN CONST CHAR8 * TableSignature, IN CONST CHAR8 *TableSignature,
IN CONST CHAR8 * OemId, IN CONST CHAR8 *OemId,
IN CONST CHAR8 * OemTableId, IN CONST CHAR8 *OemTableId,
IN UINT32 OemRevision, IN UINT32 OemRevision,
OUT AML_ROOT_NODE ** NewRootNode OUT AML_ROOT_NODE **NewRootNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -102,7 +102,8 @@ AmlCodeGenDefinitionBlock (
if ((TableSignature == NULL) || if ((TableSignature == NULL) ||
(OemId == NULL) || (OemId == NULL) ||
(OemTableId == NULL) || (OemTableId == NULL) ||
(NewRootNode == NULL)) { (NewRootNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -136,16 +137,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenString ( AmlCodeGenString (
IN CHAR8 * String, IN CHAR8 *String,
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
if ((String == NULL) || if ((String == NULL) ||
(NewObjectNode == NULL)) { (NewObjectNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -164,7 +166,7 @@ AmlCodeGenString (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeString, EAmlNodeDataTypeString,
(UINT8*)String, (UINT8 *)String,
(UINT32)AsciiStrLen (String) + 1, (UINT32)AsciiStrLen (String) + 1,
&DataNode &DataNode
); );
@ -176,11 +178,11 @@ AmlCodeGenString (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler; goto error_handler;
} }
@ -188,7 +190,7 @@ AmlCodeGenString (
return Status; return Status;
error_handler: error_handler:
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
return Status; return Status;
} }
@ -207,7 +209,7 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenInteger ( AmlCodeGenInteger (
IN UINT64 Integer, IN UINT64 Integer,
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -233,7 +235,7 @@ AmlCodeGenInteger (
Status = AmlNodeSetIntegerValue (*NewObjectNode, Integer, &ValueWidthDiff); Status = AmlNodeSetIntegerValue (*NewObjectNode, Integer, &ValueWidthDiff);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)*NewObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)*NewObjectNode);
} }
return Status; return Status;
@ -255,11 +257,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenPackage ( AmlCodeGenPackage (
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
UINT8 NodeCount; UINT8 NodeCount;
if (NewObjectNode == NULL) { if (NewObjectNode == NULL) {
@ -301,7 +303,7 @@ AmlCodeGenPackage (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
*NewObjectNode, *NewObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -311,10 +313,11 @@ AmlCodeGenPackage (
return Status; return Status;
error_handler: error_handler:
AmlDeleteTree ((AML_NODE_HEADER*)*NewObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)*NewObjectNode);
if (DataNode != NULL) { if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
} }
return Status; return Status;
} }
@ -341,21 +344,22 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenBuffer ( AmlCodeGenBuffer (
IN CONST UINT8 * Buffer OPTIONAL, IN CONST UINT8 *Buffer OPTIONAL,
IN UINT32 BufferSize OPTIONAL, IN UINT32 BufferSize OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * BufferNode; AML_OBJECT_NODE *BufferNode;
AML_OBJECT_NODE * BufferSizeNode; AML_OBJECT_NODE *BufferSizeNode;
UINT32 BufferSizeNodeSize; UINT32 BufferSizeNodeSize;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
UINT32 PkgLen; UINT32 PkgLen;
// Buffer and BufferSize must be either both set, or both clear. // Buffer and BufferSize must be either both set, or both clear.
if ((NewObjectNode == NULL) || if ((NewObjectNode == NULL) ||
((Buffer == NULL) != (BufferSize == 0))) { ((Buffer == NULL) != (BufferSize == 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -376,7 +380,7 @@ AmlCodeGenBuffer (
// Get the number of bytes required to encode the BufferSizeNode. // Get the number of bytes required to encode the BufferSizeNode.
Status = AmlComputeSize ( Status = AmlComputeSize (
(AML_NODE_HEADER*)BufferSizeNode, (AML_NODE_HEADER *)BufferSizeNode,
&BufferSizeNodeSize &BufferSizeNodeSize
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -406,7 +410,7 @@ AmlCodeGenBuffer (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
BufferNode, BufferNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)BufferSizeNode (AML_NODE_HEADER *)BufferSizeNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -430,8 +434,8 @@ AmlCodeGenBuffer (
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HEADER*)BufferNode, (AML_NODE_HEADER *)BufferNode,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -444,14 +448,17 @@ AmlCodeGenBuffer (
error_handler: error_handler:
if (BufferSizeNode != NULL) { if (BufferSizeNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)BufferSizeNode); AmlDeleteTree ((AML_NODE_HEADER *)BufferSizeNode);
} }
if (BufferNode != NULL) { if (BufferNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)BufferNode); AmlDeleteTree ((AML_NODE_HEADER *)BufferNode);
} }
if (DataNode != NULL) { if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
} }
return Status; return Status;
} }
@ -477,11 +484,11 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenResourceTemplate ( AmlCodeGenResourceTemplate (
OUT AML_OBJECT_NODE ** NewObjectNode OUT AML_OBJECT_NODE **NewObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * BufferNode; AML_OBJECT_NODE *BufferNode;
if (NewObjectNode == NULL) { if (NewObjectNode == NULL) {
ASSERT (0); ASSERT (0);
@ -499,7 +506,7 @@ AmlCodeGenResourceTemplate (
Status = AmlCodeGenEndTag (0, BufferNode, NULL); Status = AmlCodeGenEndTag (0, BufferNode, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)BufferNode); AmlDeleteTree ((AML_NODE_HEADER *)BufferNode);
return Status; return Status;
} }
@ -526,21 +533,22 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenName ( AmlCodeGenName (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_OBJECT_NODE * Object, IN AML_OBJECT_NODE *Object,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
CHAR8 * AmlNameString; CHAR8 *AmlNameString;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
if ((NameString == NULL) || if ((NameString == NULL) ||
(Object == NULL) || (Object == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -573,7 +581,7 @@ AmlCodeGenName (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)AmlNameString, (UINT8 *)AmlNameString,
AmlNameStringSize, AmlNameStringSize,
&DataNode &DataNode
); );
@ -585,18 +593,18 @@ AmlCodeGenName (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2; goto error_handler2;
} }
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm1, EAmlParseIndexTerm1,
(AML_NODE_HEADER*)Object (AML_NODE_HEADER *)Object
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -619,7 +627,7 @@ AmlCodeGenName (
error_handler2: error_handler2:
if (ObjectNode != NULL) { if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
error_handler1: error_handler1:
@ -653,18 +661,19 @@ error_handler1:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenNameString ( AmlCodeGenNameString (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN CHAR8 * String, IN CHAR8 *String,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) || if ((NameString == NULL) ||
(String == NULL) || (String == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -683,7 +692,7 @@ AmlCodeGenNameString (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
return Status; return Status;
@ -711,17 +720,18 @@ AmlCodeGenNameString (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenNameInteger ( AmlCodeGenNameInteger (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN UINT64 Integer, IN UINT64 Integer,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) || if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -740,7 +750,7 @@ AmlCodeGenNameInteger (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
return Status; return Status;
@ -767,19 +777,20 @@ AmlCodeGenNameInteger (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenDevice ( AmlCodeGenDevice (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
CHAR8 * AmlNameString; CHAR8 *AmlNameString;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
if ((NameString == NULL) || if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -812,7 +823,7 @@ AmlCodeGenDevice (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)AmlNameString, (UINT8 *)AmlNameString,
AmlNameStringSize, AmlNameStringSize,
&DataNode &DataNode
); );
@ -824,11 +835,11 @@ AmlCodeGenDevice (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2; goto error_handler2;
} }
@ -848,7 +859,7 @@ AmlCodeGenDevice (
error_handler2: error_handler2:
if (ObjectNode != NULL) { if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
error_handler1: error_handler1:
@ -880,19 +891,20 @@ error_handler1:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenScope ( AmlCodeGenScope (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
CHAR8 * AmlNameString; CHAR8 *AmlNameString;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
if ((NameString == NULL) || if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -925,7 +937,7 @@ AmlCodeGenScope (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)AmlNameString, (UINT8 *)AmlNameString,
AmlNameStringSize, AmlNameStringSize,
&DataNode &DataNode
); );
@ -937,11 +949,11 @@ AmlCodeGenScope (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2; goto error_handler2;
} }
@ -961,7 +973,7 @@ AmlCodeGenScope (
error_handler2: error_handler2:
if (ObjectNode != NULL) { if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
error_handler1: error_handler1:
@ -1009,26 +1021,27 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenMethod ( AmlCodeGenMethod (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN UINT8 NumArgs, IN UINT8 NumArgs,
IN BOOLEAN IsSerialized, IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel, IN UINT8 SyncLevel,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 PkgLen; UINT32 PkgLen;
UINT8 Flags; UINT8 Flags;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
CHAR8 * AmlNameString; CHAR8 *AmlNameString;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
if ((NameString == NULL) || if ((NameString == NULL) ||
(NumArgs > 6) || (NumArgs > 6) ||
(SyncLevel > 15) || (SyncLevel > 15) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1080,7 +1093,7 @@ AmlCodeGenMethod (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)AmlNameString, (UINT8 *)AmlNameString,
AmlNameStringSize, AmlNameStringSize,
&DataNode &DataNode
); );
@ -1093,7 +1106,7 @@ AmlCodeGenMethod (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1116,7 +1129,7 @@ AmlCodeGenMethod (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm1, EAmlParseIndexTerm1,
(AML_NODE_HEADER*)DataNode (AML_NODE_HEADER *)DataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1143,16 +1156,18 @@ AmlCodeGenMethod (
error_handler2: error_handler2:
if (ObjectNode != NULL) { if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
if (DataNode != NULL) { if (DataNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)DataNode); AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
} }
error_handler1: error_handler1:
if (AmlNameString != NULL) { if (AmlNameString != NULL) {
FreePool (AmlNameString); FreePool (AmlNameString);
} }
return Status; return Status;
} }
@ -1189,19 +1204,23 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenReturn ( AmlCodeGenReturn (
IN AML_NODE_HEADER * ReturnNode, IN AML_NODE_HEADER *ReturnNode,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
if ((ReturnNode == NULL) || if ((ReturnNode == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL)) || ((ParentNode == NULL) && (NewObjectNode == NULL)) ||
((ParentNode != NULL) && ((ParentNode != NULL) &&
!AmlNodeCompareOpCode ( !AmlNodeCompareOpCode (
(AML_OBJECT_NODE*)ParentNode, AML_METHOD_OP, 0))) { (AML_OBJECT_NODE *)ParentNode,
AML_METHOD_OP,
0
)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1219,7 +1238,7 @@ AmlCodeGenReturn (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)ReturnNode (AML_NODE_HEADER *)ReturnNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1244,9 +1263,11 @@ error_handler:
if (ReturnNode != NULL) { if (ReturnNode != NULL) {
AmlDeleteTree (ReturnNode); AmlDeleteTree (ReturnNode);
} }
if (ObjectNode != NULL) { if (ObjectNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
} }
return Status; return Status;
} }
@ -1287,14 +1308,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenReturnNameString ( AmlCodeGenReturnNameString (
IN CONST CHAR8 * NameString, IN CONST CHAR8 *NameString,
IN AML_NODE_HEADER * ParentNode OPTIONAL, IN AML_NODE_HEADER *ParentNode OPTIONAL,
OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
CHAR8 * AmlNameString; CHAR8 *AmlNameString;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
DataNode = NULL; DataNode = NULL;
@ -1313,7 +1334,7 @@ AmlCodeGenReturnNameString (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
(UINT8*)AmlNameString, (UINT8 *)AmlNameString,
AmlNameStringSize, AmlNameStringSize,
&DataNode &DataNode
); );
@ -1324,7 +1345,7 @@ AmlCodeGenReturnNameString (
// AmlCodeGenReturn() deletes DataNode if error. // AmlCodeGenReturn() deletes DataNode if error.
Status = AmlCodeGenReturn ( Status = AmlCodeGenReturn (
(AML_NODE_HEADER*)DataNode, (AML_NODE_HEADER *)DataNode,
ParentNode, ParentNode,
NewObjectNode NewObjectNode
); );
@ -1334,6 +1355,7 @@ exit_handler:
if (AmlNameString != NULL) { if (AmlNameString != NULL) {
FreePool (AmlNameString); FreePool (AmlNameString);
} }
return Status; return Status;
} }
@ -1379,20 +1401,21 @@ exit_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenMethodRetNameString ( AmlCodeGenMethodRetNameString (
IN CONST CHAR8 * MethodNameString, IN CONST CHAR8 *MethodNameString,
IN CONST CHAR8 * ReturnedNameString OPTIONAL, IN CONST CHAR8 *ReturnedNameString OPTIONAL,
IN UINT8 NumArgs, IN UINT8 NumArgs,
IN BOOLEAN IsSerialized, IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel, IN UINT8 SyncLevel,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE_HANDLE MethodNode; AML_OBJECT_NODE_HANDLE MethodNode;
if ((MethodNameString == NULL) || if ((MethodNameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL))) { ((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1440,6 +1463,7 @@ error_handler:
if (MethodNode != NULL) { if (MethodNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)MethodNode); AmlDeleteTree ((AML_NODE_HANDLE)MethodNode);
} }
return Status; return Status;
} }
@ -1478,11 +1502,11 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateLpiNode ( AmlCreateLpiNode (
IN CONST CHAR8 * LpiNameString, IN CONST CHAR8 *LpiNameString,
IN UINT16 Revision, IN UINT16 Revision,
IN UINT64 LevelId, IN UINT64 LevelId,
IN AML_NODE_HANDLE ParentNode OPTIONAL, IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE * NewLpiNode OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1490,7 +1514,8 @@ AmlCreateLpiNode (
AML_OBJECT_NODE_HANDLE IntegerNode; AML_OBJECT_NODE_HANDLE IntegerNode;
if ((LpiNameString == NULL) || if ((LpiNameString == NULL) ||
((ParentNode == NULL) && (NewLpiNode == NULL))) { ((ParentNode == NULL) && (NewLpiNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1573,6 +1598,7 @@ error_handler:
if (IntegerNode != NULL) { if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode); AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
} }
return Status; return Status;
} }
@ -1637,11 +1663,11 @@ AmlAddLpiState (
IN UINT32 ArchFlags, IN UINT32 ArchFlags,
IN UINT32 ResCntFreq, IN UINT32 ResCntFreq,
IN UINT32 EnableParentState, IN UINT32 EnableParentState,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * GenericRegisterDescriptor OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL,
IN UINT64 Integer OPTIONAL, IN UINT64 Integer OPTIONAL,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * ResidencyCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * UsageCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL,
IN CHAR8 * StateName OPTIONAL, IN CHAR8 *StateName OPTIONAL,
IN AML_OBJECT_NODE_HANDLE LpiNode IN AML_OBJECT_NODE_HANDLE LpiNode
) )
{ {
@ -1659,7 +1685,8 @@ AmlAddLpiState (
if ((LpiNode == NULL) || if ((LpiNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)LpiNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)LpiNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0))) { (!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1683,7 +1710,8 @@ AmlAddLpiState (
); );
if ((PackageNode == NULL) || if ((PackageNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) { (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1706,6 +1734,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
Status = AmlUpdateInteger (CountNode, Count + 1); Status = AmlUpdateInteger (CountNode, Count + 1);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1725,6 +1754,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1733,6 +1763,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// WorstCaseWakeLatency // WorstCaseWakeLatency
@ -1742,6 +1773,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1750,6 +1782,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// Flags // Flags
@ -1759,6 +1792,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1767,6 +1801,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// ArchFlags // ArchFlags
@ -1776,6 +1811,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1784,6 +1820,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// ResCntFreq // ResCntFreq
@ -1793,6 +1830,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1801,6 +1839,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// EnableParentState // EnableParentState
@ -1810,6 +1849,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1818,6 +1858,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
// Entry Method // Entry Method
@ -1829,6 +1870,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlCodeGenRdRegister ( Status = AmlCodeGenRdRegister (
GenericRegisterDescriptor->AddressSpaceId, GenericRegisterDescriptor->AddressSpaceId,
GenericRegisterDescriptor->RegisterBitWidth, GenericRegisterDescriptor->RegisterBitWidth,
@ -1849,6 +1891,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
RdNode = NULL; RdNode = NULL;
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
@ -1859,6 +1902,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
} else { } else {
// Entry Method: As an integer // Entry Method: As an integer
@ -1868,6 +1912,7 @@ AmlAddLpiState (
IntegerNode = NULL; IntegerNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode (AML_NODE_HANDLE)IntegerNode
@ -1876,6 +1921,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
IntegerNode = NULL; IntegerNode = NULL;
} }
@ -1886,6 +1932,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
goto error_handler; goto error_handler;
} }
if (ResidencyCounterRegister != NULL) { if (ResidencyCounterRegister != NULL) {
Status = AmlCodeGenRdRegister ( Status = AmlCodeGenRdRegister (
ResidencyCounterRegister->AddressSpaceId, ResidencyCounterRegister->AddressSpaceId,
@ -1907,6 +1954,7 @@ AmlAddLpiState (
&RdNode &RdNode
); );
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
RdNode = NULL; RdNode = NULL;
@ -1918,6 +1966,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
RdNode = NULL; RdNode = NULL;
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
@ -1928,6 +1977,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
// Usage Counter Register. // Usage Counter Register.
@ -1937,6 +1987,7 @@ AmlAddLpiState (
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
goto error_handler; goto error_handler;
} }
if (UsageCounterRegister != NULL) { if (UsageCounterRegister != NULL) {
Status = AmlCodeGenRdRegister ( Status = AmlCodeGenRdRegister (
UsageCounterRegister->AddressSpaceId, UsageCounterRegister->AddressSpaceId,
@ -1958,6 +2009,7 @@ AmlAddLpiState (
&RdNode &RdNode
); );
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
RdNode = NULL; RdNode = NULL;
@ -1969,6 +2021,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
RdNode = NULL; RdNode = NULL;
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
@ -1979,6 +2032,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
ResourceTemplateNode = NULL; ResourceTemplateNode = NULL;
// State name. // State name.
@ -1987,11 +2041,13 @@ AmlAddLpiState (
} else { } else {
Status = AmlCodeGenString ("", &StringNode); Status = AmlCodeGenString ("", &StringNode);
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
StringNode = NULL; StringNode = NULL;
goto error_handler; goto error_handler;
} }
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode, (AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)StringNode (AML_NODE_HANDLE)StringNode
@ -2000,6 +2056,7 @@ AmlAddLpiState (
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
} }
StringNode = NULL; StringNode = NULL;
// Add the new LPI state to the LpiNode. // Add the new LPI state to the LpiNode.
@ -2018,15 +2075,19 @@ error_handler:
if (RdNode != NULL) { if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)RdNode); AmlDeleteTree ((AML_NODE_HANDLE)RdNode);
} }
if (NewLpiPackageNode != NULL) { if (NewLpiPackageNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)NewLpiPackageNode); AmlDeleteTree ((AML_NODE_HANDLE)NewLpiPackageNode);
} }
if (StringNode != NULL) { if (StringNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)StringNode); AmlDeleteTree ((AML_NODE_HANDLE)StringNode);
} }
if (IntegerNode != NULL) { if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode); AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
} }
if (ResourceTemplateNode != NULL) { if (ResourceTemplateNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode); AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode);
} }

View File

@ -44,9 +44,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
LinkRdNode ( LinkRdNode (
IN AML_DATA_NODE * RdNode, IN AML_DATA_NODE *RdNode,
IN AML_OBJECT_NODE * ParentNode, IN AML_OBJECT_NODE *ParentNode,
OUT AML_DATA_NODE ** NewRdNode OUT AML_DATA_NODE **NewRdNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -73,7 +73,8 @@ LinkRdNode (
); );
if ((BufferOpNode == NULL) || if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) || (AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) { (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
{
ASSERT (0); ASSERT (0);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto error_handler; goto error_handler;
@ -94,7 +95,7 @@ LinkRdNode (
return EFI_SUCCESS; return EFI_SUCCESS;
error_handler: error_handler:
Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode); Status1 = AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
ASSERT_EFI_ERROR (Status1); ASSERT_EFI_ERROR (Status1);
// Return original error. // Return original error.
return Status; return Status;
@ -148,13 +149,14 @@ AmlCodeGenRdInterrupt (
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * RdNode; AML_DATA_NODE *RdNode;
EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR RdInterrupt; EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR RdInterrupt;
UINT32 * FirstInterrupt; UINT32 *FirstInterrupt;
if ((IrqList == NULL) || if ((IrqList == NULL) ||
(IrqCount == 0) || (IrqCount == 0) ||
((NameOpNode == NULL) && (NewRdNode == NULL))) { ((NameOpNode == NULL) && (NewRdNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -181,7 +183,7 @@ AmlCodeGenRdInterrupt (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData, EAmlNodeDataTypeResourceData,
(UINT8*)&RdInterrupt, (UINT8 *)&RdInterrupt,
sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR), sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR),
&RdNode &RdNode
); );
@ -243,11 +245,12 @@ AmlCodeGenRdRegister (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * RdNode; AML_DATA_NODE *RdNode;
EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister; EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
if ((AccessSize > EFI_ACPI_6_4_QWORD) || if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
((NameOpNode == NULL) && (NewRdNode == NULL))) { ((NameOpNode == NULL) && (NewRdNode == NULL)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -268,7 +271,7 @@ AmlCodeGenRdRegister (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData, EAmlNodeDataTypeResourceData,
(UINT8*)&RdRegister, (UINT8 *)&RdRegister,
sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR), sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
&RdNode &RdNode
); );
@ -319,12 +322,12 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenEndTag ( AmlCodeGenEndTag (
IN UINT8 CheckSum OPTIONAL, IN UINT8 CheckSum OPTIONAL,
IN AML_OBJECT_NODE * ParentNode OPTIONAL, IN AML_OBJECT_NODE *ParentNode OPTIONAL,
OUT AML_DATA_NODE ** NewRdNode OPTIONAL OUT AML_DATA_NODE **NewRdNode OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * RdNode; AML_DATA_NODE *RdNode;
EFI_ACPI_END_TAG_DESCRIPTOR EndTag; EFI_ACPI_END_TAG_DESCRIPTOR EndTag;
ACPI_SMALL_RESOURCE_HEADER SmallResHdr; ACPI_SMALL_RESOURCE_HEADER SmallResHdr;
@ -347,7 +350,7 @@ AmlCodeGenEndTag (
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData, EAmlNodeDataTypeResourceData,
(UINT8*)&EndTag, (UINT8 *)&EndTag,
sizeof (EFI_ACPI_END_TAG_DESCRIPTOR), sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),
&RdNode &RdNode
); );
@ -365,8 +368,9 @@ AmlCodeGenEndTag (
// This is a hard check: do not allow to add an EndTag if the BufferNode // This is a hard check: do not allow to add an EndTag if the BufferNode
// already has resource data elements attached. Indeed, the EndTag should // already has resource data elements attached. Indeed, the EndTag should
// have already been added. // have already been added.
if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) != if (AmlGetNextVariableArgument ((AML_NODE_HEADER *)ParentNode, NULL) !=
NULL) { NULL)
{
ASSERT (0); ASSERT (0);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto error_handler; goto error_handler;
@ -375,8 +379,8 @@ AmlCodeGenEndTag (
// Add the EndTag RdNode. Indeed, the AmlAppendRdNode function // Add the EndTag RdNode. Indeed, the AmlAppendRdNode function
// is looking for an EndTag, which we are adding here. // is looking for an EndTag, which we are adding here.
Status = AmlVarListAddTail ( Status = AmlVarListAddTail (
(AML_NODE_HEADER*)ParentNode, (AML_NODE_HEADER *)ParentNode,
(AML_NODE_HEADER*)RdNode (AML_NODE_HEADER *)RdNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -388,8 +392,9 @@ AmlCodeGenEndTag (
error_handler: error_handler:
if (RdNode != NULL) { if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)RdNode); AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
} }
return Status; return Status;
} }
@ -451,7 +456,7 @@ AmlCodeGenCrsAddRdInterrupt (
IN BOOLEAN EdgeTriggered, IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow, IN BOOLEAN ActiveLow,
IN BOOLEAN Shared, IN BOOLEAN Shared,
IN UINT32 * IrqList, IN UINT32 *IrqList,
IN UINT8 IrqCount IN UINT8 IrqCount
) )
{ {

View File

@ -143,8 +143,8 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCodeGenEndTag ( AmlCodeGenEndTag (
IN UINT8 CheckSum OPTIONAL, IN UINT8 CheckSum OPTIONAL,
IN AML_OBJECT_NODE * ParentNode OPTIONAL, IN AML_OBJECT_NODE *ParentNode OPTIONAL,
OUT AML_DATA_NODE ** NewRdNode OPTIONAL OUT AML_DATA_NODE **NewRdNode OPTIONAL
); );
#endif // AML_RESOURCE_DATA_CODE_GEN_H_ #endif // AML_RESOURCE_DATA_CODE_GEN_H_

View File

@ -110,18 +110,18 @@
*/ */
typedef struct AmlPathSearchContext { typedef struct AmlPathSearchContext {
/// Backward stream holding the raw AML absolute searched path. /// Backward stream holding the raw AML absolute searched path.
AML_STREAM * SearchPathBStream; AML_STREAM *SearchPathBStream;
/// An empty backward stream holding a pre-allocated buffer. This prevents /// An empty backward stream holding a pre-allocated buffer. This prevents
/// from having to do multiple allocations during the search. /// from having to do multiple allocations during the search.
/// This stream is used to query the raw AML absolute path of the node /// This stream is used to query the raw AML absolute path of the node
/// currently being probed. /// currently being probed.
AML_STREAM * CurrNodePathBStream; AML_STREAM *CurrNodePathBStream;
/// If the node being visited is the node being searched, /// If the node being visited is the node being searched,
/// i.e. its path and the searched path match, /// i.e. its path and the searched path match,
/// save its reference in this pointer. /// save its reference in this pointer.
AML_NODE_HEADER * OutNode; AML_NODE_HEADER *OutNode;
} AML_PATH_SEARCH_CONTEXT; } AML_PATH_SEARCH_CONTEXT;
/** Return the first AML namespace node up in the parent hierarchy. /** Return the first AML namespace node up in the parent hierarchy.
@ -140,12 +140,13 @@ typedef struct AmlPathSearchContext {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetFirstAncestorNameSpaceNode ( AmlGetFirstAncestorNameSpaceNode (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -156,7 +157,7 @@ AmlGetFirstAncestorNameSpaceNode (
return EFI_SUCCESS; return EFI_SUCCESS;
} else { } else {
// Else, get the parent node. // Else, get the parent node.
Node = AmlGetParent ((AML_NODE_HEADER*)Node); Node = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -168,12 +169,13 @@ AmlGetFirstAncestorNameSpaceNode (
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
break; break;
} else if (AmlNodeHasAttribute ( } else if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE AML_IN_NAMESPACE
)) { ))
{
break; break;
} else { } else {
Node = AmlGetParent ((AML_NODE_HEADER*)Node); Node = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -181,7 +183,7 @@ AmlGetFirstAncestorNameSpaceNode (
} }
} // while } // while
*OutNode = (AML_NODE_HEADER*)Node; *OutNode = (AML_NODE_HEADER *)Node;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -234,16 +236,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetAncestorNameSpaceNode ( AmlGetAncestorNameSpaceNode (
IN CONST AML_OBJECT_NODE * Node, IN CONST AML_OBJECT_NODE *Node,
IN OUT UINT32 * Levels, IN OUT UINT32 *Levels,
OUT UINT32 * HasRoot, OUT UINT32 *HasRoot,
OUT CONST AML_NODE_HEADER ** OutNode OUT CONST AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CONST AML_NODE_HEADER * NameSpaceNode; CONST AML_NODE_HEADER *NameSpaceNode;
CHAR8 * NodeName; CHAR8 *NodeName;
UINT32 ParentCnt; UINT32 ParentCnt;
UINT32 Root; UINT32 Root;
@ -253,7 +255,8 @@ AmlGetAncestorNameSpaceNode (
if (!IS_AML_OBJECT_NODE (Node) || if (!IS_AML_OBJECT_NODE (Node) ||
(Levels == NULL) || (Levels == NULL) ||
(HasRoot == NULL) || (HasRoot == NULL) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -265,15 +268,15 @@ AmlGetAncestorNameSpaceNode (
do { do {
// Get the next namespace node in the hierarchy. // Get the next namespace node in the hierarchy.
Status = AmlGetFirstAncestorNameSpaceNode ( Status = AmlGetFirstAncestorNameSpaceNode (
(CONST AML_NODE_HEADER*)Node, (CONST AML_NODE_HEADER *)Node,
(AML_NODE_HEADER**)&NameSpaceNode (AML_NODE_HEADER **)&NameSpaceNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
Node = (CONST AML_OBJECT_NODE*)NameSpaceNode; Node = (CONST AML_OBJECT_NODE *)NameSpaceNode;
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
// Node is the root node. It is not possible to go beyond. // Node is the root node. It is not possible to go beyond.
@ -281,11 +284,12 @@ AmlGetAncestorNameSpaceNode (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*HasRoot = 1; *HasRoot = 1;
break; break;
} }
NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node); NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) { if (NodeName == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -316,8 +320,8 @@ AmlGetAncestorNameSpaceNode (
if (SegCount == ParentCnt) { if (SegCount == ParentCnt) {
// There are exactly enough AML namespace levels to consume. // There are exactly enough AML namespace levels to consume.
// This means the root node was the searched node. // This means the root node was the searched node.
Node = (CONST AML_OBJECT_NODE*)AmlGetRootNode ( Node = (CONST AML_OBJECT_NODE *)AmlGetRootNode (
(CONST AML_NODE_HEADER*)Node (CONST AML_NODE_HEADER *)Node
); );
if (!IS_AML_ROOT_NODE (Node)) { if (!IS_AML_ROOT_NODE (Node)) {
ASSERT (0); ASSERT (0);
@ -350,14 +354,15 @@ AmlGetAncestorNameSpaceNode (
// The node name doesn't have any carets. Get the next namespace // The node name doesn't have any carets. Get the next namespace
// node and return. // node and return.
Status = AmlGetFirstAncestorNameSpaceNode ( Status = AmlGetFirstAncestorNameSpaceNode (
(CONST AML_NODE_HEADER*)Node, (CONST AML_NODE_HEADER *)Node,
(AML_NODE_HEADER**)&NameSpaceNode (AML_NODE_HEADER **)&NameSpaceNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
Node = (CONST AML_OBJECT_NODE*)NameSpaceNode;
Node = (CONST AML_OBJECT_NODE *)NameSpaceNode;
ParentCnt = 0; ParentCnt = 0;
break; break;
} else { } else {
@ -375,7 +380,7 @@ AmlGetAncestorNameSpaceNode (
} }
} while (ParentCnt != 0); } while (ParentCnt != 0);
*OutNode = (CONST AML_NODE_HEADER*)Node; *OutNode = (CONST AML_NODE_HEADER *)Node;
*Levels = ParentCnt; *Levels = ParentCnt;
return EFI_SUCCESS; return EFI_SUCCESS;
@ -415,29 +420,31 @@ AmlGetAncestorNameSpaceNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetRawNameSpacePath ( AmlGetRawNameSpacePath (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN UINT32 InputParent, IN UINT32 InputParent,
OUT AML_STREAM * RawAbsPathBStream OUT AML_STREAM *RawAbsPathBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
CHAR8 * NodeName; CHAR8 *NodeName;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
CONST CHAR8 * NameSeg; CONST CHAR8 *NameSeg;
if ((!IS_AML_ROOT_NODE (Node) && if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) || AML_IN_NAMESPACE
)) ||
!IS_STREAM (RawAbsPathBStream) || !IS_STREAM (RawAbsPathBStream) ||
IS_END_OF_STREAM (RawAbsPathBStream) || IS_END_OF_STREAM (RawAbsPathBStream) ||
!IS_STREAM_BACKWARD (RawAbsPathBStream) || !IS_STREAM_BACKWARD (RawAbsPathBStream) ||
(InputParent > MAX_UINT8)) { (InputParent > MAX_UINT8))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -447,7 +454,7 @@ AmlGetRawNameSpacePath (
break; break;
} }
NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node); NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) { if (NodeName == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -470,13 +477,14 @@ AmlGetRawNameSpacePath (
NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix); NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix);
Status = AmlStreamWrite ( Status = AmlStreamWrite (
RawAbsPathBStream, RawAbsPathBStream,
(CONST UINT8*)NameSeg, (CONST UINT8 *)NameSeg,
(SegCount - InputParent) * AML_NAME_SEG_SIZE (SegCount - InputParent) * AML_NAME_SEG_SIZE
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
InputParent = 0; InputParent = 0;
} else { } else {
// (SegCount <= InputParent) // (SegCount <= InputParent)
@ -494,17 +502,19 @@ AmlGetRawNameSpacePath (
ASSERT (0); ASSERT (0);
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
break; break;
} }
Status = AmlGetAncestorNameSpaceNode ( Status = AmlGetAncestorNameSpaceNode (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
&InputParent, &InputParent,
&Root, &Root,
(CONST AML_NODE_HEADER**)&ParentNode (CONST AML_NODE_HEADER **)&ParentNode
); );
if (EFI_ERROR (Status) || if (EFI_ERROR (Status) ||
(!IS_AML_NODE_VALID (ParentNode))) { (!IS_AML_NODE_VALID (ParentNode)))
{
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
@ -524,7 +534,7 @@ AmlGetRawNameSpacePath (
// Then exit. // Then exit.
if (InputParent != 0) { if (InputParent != 0) {
// Get the absolute pathname. // Get the absolute pathname.
NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node); NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) { if (NodeName == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -547,7 +557,7 @@ AmlGetRawNameSpacePath (
NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix); NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix);
Status = AmlStreamWrite ( Status = AmlStreamWrite (
RawAbsPathBStream, RawAbsPathBStream,
(CONST UINT8*)NameSeg, (CONST UINT8 *)NameSeg,
(SegCount - InputParent) * AML_NAME_SEG_SIZE (SegCount - InputParent) * AML_NAME_SEG_SIZE
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -557,7 +567,6 @@ AmlGetRawNameSpacePath (
break; break;
} // (InputParent != 0) } // (InputParent != 0)
} }
} // while } // while
@ -584,7 +593,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAddPrefix ( AmlAddPrefix (
IN OUT AML_STREAM * AmlPathBStream IN OUT AML_STREAM *AmlPathBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -598,7 +607,8 @@ AmlAddPrefix (
// The Stream contains concatenated NameSegs. // The Stream contains concatenated NameSegs.
if (!IS_STREAM (AmlPathBStream) || if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) || IS_END_OF_STREAM (AmlPathBStream) ||
!IS_STREAM_BACKWARD (AmlPathBStream)) { !IS_STREAM_BACKWARD (AmlPathBStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -650,7 +660,7 @@ AmlAddPrefix (
} }
// Add the RootChar + prefix (if needed) at the beginning of the pathname. // Add the RootChar + prefix (if needed) at the beginning of the pathname.
Status = AmlStreamWrite (AmlPathBStream, (CONST UINT8*)Prefix, PrefixSize); Status = AmlStreamWrite (AmlPathBStream, (CONST UINT8 *)Prefix, PrefixSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -679,7 +689,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlRemovePrefix ( AmlRemovePrefix (
IN OUT AML_STREAM * AmlPathBStream IN OUT AML_STREAM *AmlPathBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -693,13 +703,14 @@ AmlRemovePrefix (
if (!IS_STREAM (AmlPathBStream) || if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) || IS_END_OF_STREAM (AmlPathBStream) ||
!IS_STREAM_BACKWARD (AmlPathBStream)) { !IS_STREAM_BACKWARD (AmlPathBStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Status = AmlParseNameStringInfo ( Status = AmlParseNameStringInfo (
(CHAR8*)AmlStreamGetCurrPos (AmlPathBStream), (CHAR8 *)AmlStreamGetCurrPos (AmlPathBStream),
&Root, &Root,
&ParentPrefix, &ParentPrefix,
&SegCount &SegCount
@ -755,20 +766,20 @@ AmlRemovePrefix (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetAslPathName ( AmlGetAslPathName (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
OUT CHAR8 * Buffer, OUT CHAR8 *Buffer,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
// Backward stream used to build the raw AML absolute path to the node. // Backward stream used to build the raw AML absolute path to the node.
AML_STREAM RawAmlAbsPathBStream; AML_STREAM RawAmlAbsPathBStream;
CHAR8 * RawAmlAbsPathBuffer; CHAR8 *RawAmlAbsPathBuffer;
UINT32 RawAmlAbsPathBufferSize; UINT32 RawAmlAbsPathBufferSize;
CHAR8 * AmlPathName; CHAR8 *AmlPathName;
CHAR8 * AslPathName; CHAR8 *AslPathName;
UINT32 AslPathNameSize; UINT32 AslPathNameSize;
UINT32 Root; UINT32 Root;
@ -777,9 +788,11 @@ AmlGetAslPathName (
if ((!IS_AML_ROOT_NODE (Node) && if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) || AML_IN_NAMESPACE
(BufferSize == NULL)) { )) ||
(BufferSize == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -796,7 +809,7 @@ AmlGetAslPathName (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAmlAbsPathBStream, &RawAmlAbsPathBStream,
(UINT8*)RawAmlAbsPathBuffer, (UINT8 *)RawAmlAbsPathBuffer,
RawAmlAbsPathBufferSize, RawAmlAbsPathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -821,11 +834,11 @@ AmlGetAslPathName (
goto exit_handler; goto exit_handler;
} }
AmlPathName = (CHAR8*)AmlStreamGetCurrPos (&RawAmlAbsPathBStream); AmlPathName = (CHAR8 *)AmlStreamGetCurrPos (&RawAmlAbsPathBStream);
// Analyze the NameString. // Analyze the NameString.
Status = AmlParseNameStringInfo ( Status = AmlParseNameStringInfo (
(CONST CHAR8*)AmlPathName, (CONST CHAR8 *)AmlPathName,
&Root, &Root,
&ParentPrefix, &ParentPrefix,
&SegCount &SegCount
@ -890,23 +903,24 @@ STATIC
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlDbgPrintNameSpaceCallback ( AmlDbgPrintNameSpaceCallback (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN VOID * Context, IN VOID *Context,
IN OUT EFI_STATUS * Status OPTIONAL IN OUT EFI_STATUS *Status OPTIONAL
) )
{ {
BOOLEAN ContinueEnum; BOOLEAN ContinueEnum;
EFI_STATUS Status1; EFI_STATUS Status1;
AML_STREAM * CurrNodePathFStream; AML_STREAM *CurrNodePathFStream;
CHAR8 * CurrNodePathBuffer; CHAR8 *CurrNodePathBuffer;
UINT32 CurrNodePathBufferSize; UINT32 CurrNodePathBufferSize;
ContinueEnum = TRUE; ContinueEnum = TRUE;
Status1 = EFI_SUCCESS; Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) { (Context == NULL))
{
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
@ -915,8 +929,10 @@ AmlDbgPrintNameSpaceCallback (
if (!IS_AML_ROOT_NODE (Node) && if (!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) { AML_IN_NAMESPACE
))
{
// Skip this node and continue enumeration. // Skip this node and continue enumeration.
goto exit_handler; goto exit_handler;
} }
@ -924,26 +940,28 @@ AmlDbgPrintNameSpaceCallback (
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
DEBUG ((DEBUG_INFO, "\\\n")); DEBUG ((DEBUG_INFO, "\\\n"));
} else if (AmlNodeHasAttribute ( } else if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) { AML_IN_NAMESPACE
))
CurrNodePathFStream = (AML_STREAM*)Context; {
CurrNodePathFStream = (AML_STREAM *)Context;
// Check the Context's content. // Check the Context's content.
if (!IS_STREAM (CurrNodePathFStream) || if (!IS_STREAM (CurrNodePathFStream) ||
IS_END_OF_STREAM (CurrNodePathFStream) || IS_END_OF_STREAM (CurrNodePathFStream) ||
!IS_STREAM_FORWARD (CurrNodePathFStream)) { !IS_STREAM_FORWARD (CurrNodePathFStream))
{
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
goto exit_handler; goto exit_handler;
} }
CurrNodePathBuffer = (CHAR8*)AmlStreamGetBuffer (CurrNodePathFStream); CurrNodePathBuffer = (CHAR8 *)AmlStreamGetBuffer (CurrNodePathFStream);
CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream); CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream);
Status1 = AmlGetAslPathName ( Status1 = AmlGetAslPathName (
(AML_NODE_HEADER*)Node, (AML_NODE_HEADER *)Node,
CurrNodePathBuffer, CurrNodePathBuffer,
&CurrNodePathBufferSize &CurrNodePathBufferSize
); );
@ -954,7 +972,6 @@ AmlDbgPrintNameSpaceCallback (
} }
DEBUG ((DEBUG_INFO, "%a\n", CurrNodePathBuffer)); DEBUG ((DEBUG_INFO, "%a\n", CurrNodePathBuffer));
} else { } else {
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
@ -982,13 +999,13 @@ exit_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDbgPrintNameSpace ( AmlDbgPrintNameSpace (
IN AML_ROOT_NODE * RootNode IN AML_ROOT_NODE *RootNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_STREAM CurrNodePathFStream; AML_STREAM CurrNodePathFStream;
CHAR8 * CurrNodePathBuffer; CHAR8 *CurrNodePathBuffer;
UINT32 CurrNodePathBufferSize; UINT32 CurrNodePathBufferSize;
if (!IS_AML_ROOT_NODE (RootNode)) { if (!IS_AML_ROOT_NODE (RootNode)) {
@ -1010,7 +1027,7 @@ AmlDbgPrintNameSpace (
// to avoid multiple allocations during the enumeration. // to avoid multiple allocations during the enumeration.
Status = AmlStreamInit ( Status = AmlStreamInit (
&CurrNodePathFStream, &CurrNodePathFStream,
(UINT8*)CurrNodePathBuffer, (UINT8 *)CurrNodePathBuffer,
CurrNodePathBufferSize, CurrNodePathBufferSize,
EAmlStreamDirectionForward EAmlStreamDirectionForward
); );
@ -1020,9 +1037,9 @@ AmlDbgPrintNameSpace (
} }
AmlEnumTree ( AmlEnumTree (
(AML_NODE_HEADER*)RootNode, (AML_NODE_HEADER *)RootNode,
AmlDbgPrintNameSpaceCallback, AmlDbgPrintNameSpaceCallback,
(VOID*)&CurrNodePathFStream, (VOID *)&CurrNodePathFStream,
&Status &Status
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -1064,26 +1081,27 @@ STATIC
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlEnumeratePathCallback ( AmlEnumeratePathCallback (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN OUT VOID * Context, IN OUT VOID *Context,
IN OUT EFI_STATUS * Status OPTIONAL IN OUT EFI_STATUS *Status OPTIONAL
) )
{ {
BOOLEAN ContinueEnum; BOOLEAN ContinueEnum;
EFI_STATUS Status1; EFI_STATUS Status1;
AML_PATH_SEARCH_CONTEXT * PathSearchContext; AML_PATH_SEARCH_CONTEXT *PathSearchContext;
AML_STREAM * SearchPathBStream; AML_STREAM *SearchPathBStream;
AML_STREAM * CurrNodePathBStream; AML_STREAM *CurrNodePathBStream;
UINT32 CurrNodePathSize; UINT32 CurrNodePathSize;
ContinueEnum = TRUE; ContinueEnum = TRUE;
Status1 = EFI_SUCCESS; Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) { (Context == NULL))
{
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
@ -1091,12 +1109,14 @@ AmlEnumeratePathCallback (
} }
if (!AmlNodeHasAttribute ( if (!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE)) { AML_IN_NAMESPACE
))
{
goto exit_handler; goto exit_handler;
} }
PathSearchContext = (AML_PATH_SEARCH_CONTEXT*)Context; PathSearchContext = (AML_PATH_SEARCH_CONTEXT *)Context;
SearchPathBStream = PathSearchContext->SearchPathBStream; SearchPathBStream = PathSearchContext->SearchPathBStream;
CurrNodePathBStream = PathSearchContext->CurrNodePathBStream; CurrNodePathBStream = PathSearchContext->CurrNodePathBStream;
@ -1106,7 +1126,8 @@ AmlEnumeratePathCallback (
!IS_STREAM_BACKWARD (SearchPathBStream) || !IS_STREAM_BACKWARD (SearchPathBStream) ||
!IS_STREAM (CurrNodePathBStream) || !IS_STREAM (CurrNodePathBStream) ||
IS_END_OF_STREAM (CurrNodePathBStream) || IS_END_OF_STREAM (CurrNodePathBStream) ||
!IS_STREAM_BACKWARD (CurrNodePathBStream)) { !IS_STREAM_BACKWARD (CurrNodePathBStream))
{
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
@ -1137,13 +1158,13 @@ AmlEnumeratePathCallback (
DEBUG ((DEBUG_VERBOSE, "Search path:")); DEBUG ((DEBUG_VERBOSE, "Search path:"));
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CHAR8*)AmlStreamGetCurrPos (SearchPathBStream), (CHAR8 *)AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream) AmlStreamGetIndex (SearchPathBStream)
); );
DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: ")); DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: "));
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CHAR8*)AmlStreamGetCurrPos (CurrNodePathBStream), (CHAR8 *)AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetIndex (CurrNodePathBStream) AmlStreamGetIndex (CurrNodePathBStream)
); );
DEBUG ((DEBUG_VERBOSE, "\n")); DEBUG ((DEBUG_VERBOSE, "\n"));
@ -1154,7 +1175,9 @@ AmlEnumeratePathCallback (
(CompareMem ( (CompareMem (
AmlStreamGetCurrPos (CurrNodePathBStream), AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetCurrPos (SearchPathBStream), AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream)) == 0)) { AmlStreamGetIndex (SearchPathBStream)
) == 0))
{
Status1 = EFI_SUCCESS; Status1 = EFI_SUCCESS;
ContinueEnum = FALSE; ContinueEnum = FALSE;
PathSearchContext->OutNode = Node; PathSearchContext->OutNode = Node;
@ -1210,13 +1233,13 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlBuildAbsoluteAmlPath ( AmlBuildAbsoluteAmlPath (
IN AML_NODE_HEADER * ReferenceNode, IN AML_NODE_HEADER *ReferenceNode,
IN CHAR8 * AslPath, IN CHAR8 *AslPath,
IN OUT AML_STREAM * RawAmlAbsSearchPathBStream IN OUT AML_STREAM *RawAmlAbsSearchPathBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CHAR8 * AmlPath; CHAR8 *AmlPath;
UINT32 AmlNameStringSize; UINT32 AmlNameStringSize;
UINT32 Root; UINT32 Root;
@ -1225,12 +1248,14 @@ AmlBuildAbsoluteAmlPath (
if ((!IS_AML_ROOT_NODE (ReferenceNode) && if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)ReferenceNode, (CONST AML_OBJECT_NODE *)ReferenceNode,
AML_IN_NAMESPACE)) || AML_IN_NAMESPACE
)) ||
(AslPath == NULL) || (AslPath == NULL) ||
!IS_STREAM (RawAmlAbsSearchPathBStream) || !IS_STREAM (RawAmlAbsSearchPathBStream) ||
IS_END_OF_STREAM (RawAmlAbsSearchPathBStream) || IS_END_OF_STREAM (RawAmlAbsSearchPathBStream) ||
!IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream)) { !IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1265,7 +1290,7 @@ AmlBuildAbsoluteAmlPath (
// 2.1. Write the AML path to the stream. // 2.1. Write the AML path to the stream.
Status = AmlStreamWrite ( Status = AmlStreamWrite (
RawAmlAbsSearchPathBStream, RawAmlAbsSearchPathBStream,
(CONST UINT8*)AmlPath, (CONST UINT8 *)AmlPath,
AmlNameStringSize AmlNameStringSize
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1347,35 +1372,37 @@ exit_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlFindNode ( AmlFindNode (
IN AML_NODE_HEADER * ReferenceNode, IN AML_NODE_HEADER *ReferenceNode,
IN CHAR8 * AslPath, IN CHAR8 *AslPath,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_PATH_SEARCH_CONTEXT PathSearchContext; AML_PATH_SEARCH_CONTEXT PathSearchContext;
AML_ROOT_NODE * RootNode; AML_ROOT_NODE *RootNode;
// Backward stream used to build the raw AML absolute path to the searched // Backward stream used to build the raw AML absolute path to the searched
// node. // node.
AML_STREAM RawAmlAbsSearchPathBStream; AML_STREAM RawAmlAbsSearchPathBStream;
CHAR8 * RawAmlAbsSearchPathBuffer; CHAR8 *RawAmlAbsSearchPathBuffer;
UINT32 RawAmlAbsSearchPathBufferSize; UINT32 RawAmlAbsSearchPathBufferSize;
// Backward stream used to store the raw AML absolute path of the node // Backward stream used to store the raw AML absolute path of the node
// currently enumerated in the tree. This path can then be compared to the // currently enumerated in the tree. This path can then be compared to the
// RawAmlAbsSearchPath. // RawAmlAbsSearchPath.
AML_STREAM RawAmlAbsCurrNodePathBStream; AML_STREAM RawAmlAbsCurrNodePathBStream;
CHAR8 * RawAmlAbsCurrNodePathBuffer; CHAR8 *RawAmlAbsCurrNodePathBuffer;
UINT32 RawAmlAbsCurrNodePathBufferSize; UINT32 RawAmlAbsCurrNodePathBufferSize;
if ((!IS_AML_ROOT_NODE (ReferenceNode) && if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)ReferenceNode, (CONST AML_OBJECT_NODE *)ReferenceNode,
AML_IN_NAMESPACE)) || AML_IN_NAMESPACE
)) ||
(AslPath == NULL) || (AslPath == NULL) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1395,7 +1422,7 @@ AmlFindNode (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAmlAbsSearchPathBStream, &RawAmlAbsSearchPathBStream,
(UINT8*)RawAmlAbsSearchPathBuffer, (UINT8 *)RawAmlAbsSearchPathBuffer,
RawAmlAbsSearchPathBufferSize, RawAmlAbsSearchPathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -1427,7 +1454,7 @@ AmlFindNode (
// For the Root Node there is no NameSegs so the length of // For the Root Node there is no NameSegs so the length of
// the stream will be zero. // the stream will be zero.
if (AmlStreamGetIndex (&RawAmlAbsSearchPathBStream) == 0) { if (AmlStreamGetIndex (&RawAmlAbsSearchPathBStream) == 0) {
*OutNode = (AML_NODE_HEADER*)RootNode; *OutNode = (AML_NODE_HEADER *)RootNode;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto exit_handler; goto exit_handler;
} }
@ -1447,7 +1474,7 @@ AmlFindNode (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAmlAbsCurrNodePathBStream, &RawAmlAbsCurrNodePathBStream,
(UINT8*)RawAmlAbsCurrNodePathBuffer, (UINT8 *)RawAmlAbsCurrNodePathBuffer,
RawAmlAbsCurrNodePathBufferSize, RawAmlAbsCurrNodePathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -1470,9 +1497,9 @@ AmlFindNode (
// For each namespace node, build its raw AML absolute path. Then compare // For each namespace node, build its raw AML absolute path. Then compare
// it with the search path. // it with the search path.
AmlEnumTree ( AmlEnumTree (
(AML_NODE_HEADER*)RootNode, (AML_NODE_HEADER *)RootNode,
AmlEnumeratePathCallback, AmlEnumeratePathCallback,
(VOID*)&PathSearchContext, (VOID *)&PathSearchContext,
&Status &Status
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {

View File

@ -28,8 +28,8 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetFirstAncestorNameSpaceNode ( AmlGetFirstAncestorNameSpaceNode (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
); );
/** Build the raw absolute AML pathname to Node and write it to a stream. /** Build the raw absolute AML pathname to Node and write it to a stream.
@ -66,9 +66,9 @@ AmlGetFirstAncestorNameSpaceNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetRawNameSpacePath ( AmlGetRawNameSpacePath (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN UINT32 InputParent, IN UINT32 InputParent,
OUT AML_STREAM * RawAbsPathBStream OUT AML_STREAM *RawAbsPathBStream
); );
#endif // AML_NAMESPACE_H_ #endif // AML_NAMESPACE_H_

View File

@ -46,16 +46,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFieldElement ( AmlParseFieldElement (
IN CONST AML_BYTE_ENCODING * FieldByteEncoding, IN CONST AML_BYTE_ENCODING *FieldByteEncoding,
IN OUT AML_OBJECT_NODE * FieldNode, IN OUT AML_OBJECT_NODE *FieldNode,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 * CurrPos; UINT8 *CurrPos;
AML_OBJECT_NODE * NewNode; AML_OBJECT_NODE *NewNode;
UINT32 PkgLenOffset; UINT32 PkgLenOffset;
UINT32 PkgLenSize; UINT32 PkgLenSize;
@ -70,7 +70,8 @@ AmlParseFieldElement (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -98,7 +99,8 @@ AmlParseFieldElement (
// Parse the PkgLen if available. // Parse the PkgLen if available.
PkgLenSize = 0; PkgLenSize = 0;
if ((FieldByteEncoding->Attribute & AML_HAS_PKG_LENGTH) == if ((FieldByteEncoding->Attribute & AML_HAS_PKG_LENGTH) ==
AML_HAS_PKG_LENGTH) { AML_HAS_PKG_LENGTH)
{
PkgLenOffset = AmlGetPkgLength (CurrPos, &PkgLenSize); PkgLenOffset = AmlGetPkgLength (CurrPos, &PkgLenSize);
if (PkgLenOffset == 0) { if (PkgLenOffset == 0) {
ASSERT (0); ASSERT (0);
@ -129,14 +131,14 @@ AmlParseFieldElement (
// Add the FieldElement to the Variable Argument List. // Add the FieldElement to the Variable Argument List.
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)FieldNode, (AML_NODE_HEADER *)FieldNode,
(AML_NODE_HEADER*)NewNode (AML_NODE_HEADER *)NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
// Delete the sub-tree if the insertion failed. // Delete the sub-tree if the insertion failed.
// Otherwise its reference will be lost. // Otherwise its reference will be lost.
AmlDeleteTree ((AML_NODE_HEADER*)NewNode); AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status; return Status;
} }
@ -182,14 +184,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseNamedFieldElement ( AmlParseNamedFieldElement (
IN CONST AML_BYTE_ENCODING * NamedFieldByteEncoding, IN CONST AML_BYTE_ENCODING *NamedFieldByteEncoding,
IN OUT AML_OBJECT_NODE * FieldNode, IN OUT AML_OBJECT_NODE *FieldNode,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * NewNode; AML_OBJECT_NODE *NewNode;
// Check whether the node is an Object Node and has a field list. // Check whether the node is an Object Node and has a field list.
// The byte encoding must be a char. // The byte encoding must be a char.
@ -199,7 +201,8 @@ AmlParseNamedFieldElement (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -217,14 +220,14 @@ AmlParseNamedFieldElement (
// Add the NamedField node to the variable argument list. // Add the NamedField node to the variable argument list.
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)FieldNode, (AML_NODE_HEADER *)FieldNode,
(AML_NODE_HEADER*)NewNode (AML_NODE_HEADER *)NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
// Delete the sub-tree if the insertion failed. // Delete the sub-tree if the insertion failed.
// Otherwise its reference will be lost. // Otherwise its reference will be lost.
AmlDeleteTree ((AML_NODE_HEADER*)NewNode); AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status; return Status;
} }
@ -306,23 +309,24 @@ AmlParseNamedFieldElement (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFieldList ( AmlParseFieldList (
IN AML_OBJECT_NODE * FieldNode, IN AML_OBJECT_NODE *FieldNode,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 * CurrPos; UINT8 *CurrPos;
CONST AML_BYTE_ENCODING * FieldByteEncoding; CONST AML_BYTE_ENCODING *FieldByteEncoding;
CONST AML_BYTE_ENCODING * NamedFieldByteEncoding; CONST AML_BYTE_ENCODING *NamedFieldByteEncoding;
// Check whether the node is an Object Node and has a field list. // Check whether the node is an Object Node and has a field list.
if (!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST) || if (!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST) ||
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -351,7 +355,8 @@ AmlParseFieldList (
// call AmlGetByteEncoding() to check that the encoding is NameChar. // call AmlGetByteEncoding() to check that the encoding is NameChar.
NamedFieldByteEncoding = AmlGetByteEncoding (CurrPos); NamedFieldByteEncoding = AmlGetByteEncoding (CurrPos);
if ((NamedFieldByteEncoding != NULL) && 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. // This is a NamedField field element since it is starting with a char.
Status = AmlParseNamedFieldElement ( Status = AmlParseNamedFieldElement (
NamedFieldByteEncoding, NamedFieldByteEncoding,

View File

@ -69,9 +69,9 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFieldList ( AmlParseFieldList (
IN AML_OBJECT_NODE * FieldNode, IN AML_OBJECT_NODE *FieldNode,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
); );
#endif // AML_FIELD_LIST_PARSER_H_ #endif // AML_FIELD_LIST_PARSER_H_

View File

@ -30,7 +30,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteNameSpaceRefNode ( AmlDeleteNameSpaceRefNode (
IN AML_NAMESPACE_REF_NODE * NameSpaceRefNode IN AML_NAMESPACE_REF_NODE *NameSpaceRefNode
) )
{ {
if (NameSpaceRefNode == NULL) { if (NameSpaceRefNode == NULL) {
@ -39,7 +39,7 @@ AmlDeleteNameSpaceRefNode (
} }
if (NameSpaceRefNode->RawAbsolutePath != NULL) { if (NameSpaceRefNode->RawAbsolutePath != NULL) {
FreePool ((CHAR8*)NameSpaceRefNode->RawAbsolutePath); FreePool ((CHAR8 *)NameSpaceRefNode->RawAbsolutePath);
} else { } else {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -59,11 +59,11 @@ AmlDeleteNameSpaceRefNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteNameSpaceRefList ( AmlDeleteNameSpaceRefList (
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
LIST_ENTRY * CurrentLink; LIST_ENTRY *CurrentLink;
if (NameSpaceRefList == NULL) { if (NameSpaceRefList == NULL) {
ASSERT (0); ASSERT (0);
@ -74,7 +74,7 @@ AmlDeleteNameSpaceRefList (
CurrentLink = NameSpaceRefList->ForwardLink; CurrentLink = NameSpaceRefList->ForwardLink;
RemoveEntryList (CurrentLink); RemoveEntryList (CurrentLink);
Status = AmlDeleteNameSpaceRefNode ( Status = AmlDeleteNameSpaceRefNode (
(AML_NAMESPACE_REF_NODE*)CurrentLink (AML_NAMESPACE_REF_NODE *)CurrentLink
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -106,18 +106,19 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateMethodRefNode ( AmlCreateMethodRefNode (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
IN CONST CHAR8 * RawAbsolutePath, IN CONST CHAR8 *RawAbsolutePath,
IN UINT32 RawAbsolutePathSize, IN UINT32 RawAbsolutePathSize,
OUT AML_NAMESPACE_REF_NODE ** NameSpaceRefNodePtr OUT AML_NAMESPACE_REF_NODE **NameSpaceRefNodePtr
) )
{ {
AML_NAMESPACE_REF_NODE * NameSpaceRefNode; AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) || if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(RawAbsolutePath == NULL) || (RawAbsolutePath == NULL) ||
(RawAbsolutePathSize == 0) || (RawAbsolutePathSize == 0) ||
(NameSpaceRefNodePtr == NULL)) { (NameSpaceRefNodePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -156,11 +157,11 @@ AmlCreateMethodRefNode (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameSpaceRefList ( AmlDbgPrintNameSpaceRefList (
IN CONST LIST_ENTRY * NameSpaceRefList IN CONST LIST_ENTRY *NameSpaceRefList
) )
{ {
LIST_ENTRY * CurrLink; LIST_ENTRY *CurrLink;
AML_NAMESPACE_REF_NODE * CurrNameSpaceNode; AML_NAMESPACE_REF_NODE *CurrNameSpaceNode;
if (NameSpaceRefList == NULL) { if (NameSpaceRefList == NULL) {
ASSERT (0); ASSERT (0);
@ -171,7 +172,7 @@ AmlDbgPrintNameSpaceRefList (
CurrLink = NameSpaceRefList->ForwardLink; CurrLink = NameSpaceRefList->ForwardLink;
while (CurrLink != NameSpaceRefList) { while (CurrLink != NameSpaceRefList) {
CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink; CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE *)CurrLink;
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_INFO, DEBUG_INFO,
@ -215,14 +216,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlInitRawPathBStream ( AmlInitRawPathBStream (
IN CONST AML_STREAM * FStream, IN CONST AML_STREAM *FStream,
OUT AML_STREAM * RawPathNameBStream OUT AML_STREAM *RawPathNameBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 * RawPathBuffer; UINT8 *RawPathBuffer;
CONST CHAR8 * Buffer; CONST CHAR8 *Buffer;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
@ -231,12 +232,13 @@ AmlInitRawPathBStream (
if (!IS_STREAM (FStream) || if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(RawPathNameBStream == NULL)) { (RawPathNameBStream == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Buffer = (CONST CHAR8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST CHAR8 *)AmlStreamGetCurrPos (FStream);
if (Buffer == NULL) { if (Buffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -255,7 +257,7 @@ AmlInitRawPathBStream (
} }
// Get the beginning of the raw NameString. // Get the beginning of the raw NameString.
RawPathBuffer = (UINT8*)AmlGetFirstNameSeg ( RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
Buffer, Buffer,
Root, Root,
ParentPrefix ParentPrefix
@ -313,16 +315,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetFirstNamedAncestorNode ( AmlGetFirstNamedAncestorNode (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
OUT AML_NODE_HEADER ** OutNamedNode OUT AML_NODE_HEADER **OutNamedNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CONST AML_NODE_HEADER * NameSpaceNode; CONST AML_NODE_HEADER *NameSpaceNode;
if ((!IS_AML_OBJECT_NODE (Node) && if ((!IS_AML_OBJECT_NODE (Node) &&
!IS_AML_ROOT_NODE (Node)) || !IS_AML_ROOT_NODE (Node)) ||
(OutNamedNode == NULL)) { (OutNamedNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -331,23 +334,26 @@ AmlGetFirstNamedAncestorNode (
// get the ancestor NameSpace node. // get the ancestor NameSpace node.
while (!IS_AML_ROOT_NODE (Node) && while (!IS_AML_ROOT_NODE (Node) &&
!(AmlNodeHasAttribute ( !(AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE) && AML_IN_NAMESPACE
AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node) != NULL)) { ) &&
AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node) != NULL))
{
Status = AmlGetFirstAncestorNameSpaceNode ( Status = AmlGetFirstAncestorNameSpaceNode (
Node, Node,
(AML_NODE_HEADER**)&NameSpaceNode (AML_NODE_HEADER **)&NameSpaceNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
// The NameSpaceNode may not have its name defined as yet. In this // The NameSpaceNode may not have its name defined as yet. In this
// case get the next ancestor node. // case get the next ancestor node.
Node = NameSpaceNode; Node = NameSpaceNode;
} }
*OutNamedNode = (AML_NODE_HEADER*)Node; *OutNamedNode = (AML_NODE_HEADER *)Node;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -380,16 +386,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlBuildRawMethodAbsolutePath ( AmlBuildRawMethodAbsolutePath (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN CONST AML_STREAM * PathnameFStream, IN CONST AML_STREAM *PathnameFStream,
IN OUT AML_STREAM * AbsolutePathBStream IN OUT AML_STREAM *AbsolutePathBStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * NamedParentNode; AML_NODE_HEADER *NamedParentNode;
UINT8 * RawPathBuffer; UINT8 *RawPathBuffer;
CONST CHAR8 * CurrPos; CONST CHAR8 *CurrPos;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
@ -402,12 +408,13 @@ AmlBuildRawMethodAbsolutePath (
!IS_STREAM_FORWARD (PathnameFStream) || !IS_STREAM_FORWARD (PathnameFStream) ||
!IS_STREAM (AbsolutePathBStream) || !IS_STREAM (AbsolutePathBStream) ||
IS_END_OF_STREAM (AbsolutePathBStream) || IS_END_OF_STREAM (AbsolutePathBStream) ||
!IS_STREAM_BACKWARD (AbsolutePathBStream)) { !IS_STREAM_BACKWARD (AbsolutePathBStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
CurrPos = (CONST CHAR8*)AmlStreamGetCurrPos (PathnameFStream); CurrPos = (CONST CHAR8 *)AmlStreamGetCurrPos (PathnameFStream);
if (CurrPos == NULL) { if (CurrPos == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -428,7 +435,7 @@ AmlBuildRawMethodAbsolutePath (
// Copy the method invocation raw relative path at the end of the Stream. // Copy the method invocation raw relative path at the end of the Stream.
if (SegCount != 0) { if (SegCount != 0) {
// Get the beginning of the raw NameString. // Get the beginning of the raw NameString.
RawPathBuffer = (UINT8*)AmlGetFirstNameSeg ( RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
CurrPos, CurrPos,
Root, Root,
ParentPrefix ParentPrefix
@ -487,9 +494,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCompareRawNameString ( AmlCompareRawNameString (
IN CONST AML_STREAM * RawFStream1, IN CONST AML_STREAM *RawFStream1,
IN CONST AML_STREAM * RawFStream2, IN CONST AML_STREAM *RawFStream2,
OUT UINT32 * CompareCount OUT UINT32 *CompareCount
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -507,7 +514,8 @@ AmlCompareRawNameString (
!IS_STREAM_FORWARD (RawFStream1) || !IS_STREAM_FORWARD (RawFStream1) ||
!IS_STREAM (RawFStream2) || !IS_STREAM (RawFStream2) ||
IS_END_OF_STREAM (RawFStream2) || IS_END_OF_STREAM (RawFStream2) ||
(CompareCount == NULL)) { (CompareCount == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -543,8 +551,10 @@ AmlCompareRawNameString (
if (!AmlStreamCmp ( if (!AmlStreamCmp (
&RawFStream1Clone, &RawFStream1Clone,
&RawFStream2Clone, &RawFStream2Clone,
AML_NAME_SEG_SIZE) AML_NAME_SEG_SIZE
) { )
)
{
// NameSegs are different. Break. // NameSegs are different. Break.
break; break;
} }
@ -554,6 +564,7 @@ AmlCompareRawNameString (
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
Status = AmlStreamProgress (&RawFStream2Clone, AML_NAME_SEG_SIZE); Status = AmlStreamProgress (&RawFStream2Clone, AML_NAME_SEG_SIZE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -599,26 +610,27 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlResolveAliasMethod ( AmlResolveAliasMethod (
IN CONST AML_OBJECT_NODE * AliasNode, IN CONST AML_OBJECT_NODE *AliasNode,
IN CONST LIST_ENTRY * NameSpaceRefList, IN CONST LIST_ENTRY *NameSpaceRefList,
OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_STREAM SourceAliasFStream; AML_STREAM SourceAliasFStream;
CONST AML_DATA_NODE * DataNode; CONST AML_DATA_NODE *DataNode;
if (!AmlNodeCompareOpCode (AliasNode, AML_ALIAS_OP, 0) || if (!AmlNodeCompareOpCode (AliasNode, AML_ALIAS_OP, 0) ||
(NameSpaceRefList == NULL) || (NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) { (OutNameSpaceRefNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// The aliased NameString (the source name) is the first fixed argument, // The aliased NameString (the source name) is the first fixed argument,
// cf. ACPI6.3 spec, s19.6.4: Alias (SourceObject, AliasObject) // cf. ACPI6.3 spec, s19.6.4: Alias (SourceObject, AliasObject)
DataNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument ( DataNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
(AML_OBJECT_NODE*)AliasNode, (AML_OBJECT_NODE *)AliasNode,
EAmlParseIndexTerm0 EAmlParseIndexTerm0
); );
if (DataNode == NULL) { if (DataNode == NULL) {
@ -641,7 +653,7 @@ AmlResolveAliasMethod (
// Recursively check whether the source alias NameString // Recursively check whether the source alias NameString
// is a method invocation. // is a method invocation.
Status = AmlIsMethodInvocation ( Status = AmlIsMethodInvocation (
AmlGetParent ((AML_NODE_HEADER*)AliasNode), AmlGetParent ((AML_NODE_HEADER *)AliasNode),
&SourceAliasFStream, &SourceAliasFStream,
NameSpaceRefList, NameSpaceRefList,
OutNameSpaceRefNode OutNameSpaceRefNode
@ -710,15 +722,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlFindMethodDefinition ( AmlFindMethodDefinition (
IN CONST AML_STREAM * RawAbsolutePathFStream, IN CONST AML_STREAM *RawAbsolutePathFStream,
IN CONST AML_STREAM * RawPathNameBStream, IN CONST AML_STREAM *RawPathNameBStream,
IN CONST LIST_ENTRY * NameSpaceRefList, IN CONST LIST_ENTRY *NameSpaceRefList,
OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
LIST_ENTRY * NextLink; LIST_ENTRY *NextLink;
// To resolve a pathname, scope levels need to be compared. // To resolve a pathname, scope levels need to be compared.
UINT32 NameSegScopeCount; UINT32 NameSegScopeCount;
@ -729,8 +741,8 @@ AmlFindMethodDefinition (
AML_STREAM ProbedRawAbsoluteFStream; AML_STREAM ProbedRawAbsoluteFStream;
AML_STREAM ProbedRawAbsoluteBStream; AML_STREAM ProbedRawAbsoluteBStream;
AML_NAMESPACE_REF_NODE * ProbedNameSpaceRefNode; AML_NAMESPACE_REF_NODE *ProbedNameSpaceRefNode;
AML_NAMESPACE_REF_NODE * BestNameSpaceRefNode; AML_NAMESPACE_REF_NODE *BestNameSpaceRefNode;
if (!IS_STREAM (RawAbsolutePathFStream) || if (!IS_STREAM (RawAbsolutePathFStream) ||
IS_END_OF_STREAM (RawAbsolutePathFStream) || IS_END_OF_STREAM (RawAbsolutePathFStream) ||
@ -743,7 +755,8 @@ AmlFindMethodDefinition (
((AmlStreamGetIndex (RawPathNameBStream) & ((AmlStreamGetIndex (RawPathNameBStream) &
(AML_NAME_SEG_SIZE - 1)) != 0) || (AML_NAME_SEG_SIZE - 1)) != 0) ||
(NameSpaceRefList == NULL) || (NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) { (OutNameSpaceRefNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -751,7 +764,7 @@ AmlFindMethodDefinition (
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: ")); DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: "));
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream), (CONST CHAR8 *)AmlStreamGetCurrPos (RawAbsolutePathFStream),
AmlStreamGetMaxBufferSize (RawAbsolutePathFStream) AmlStreamGetMaxBufferSize (RawAbsolutePathFStream)
); );
DEBUG ((DEBUG_VERBOSE, ".\n")); DEBUG ((DEBUG_VERBOSE, ".\n"));
@ -765,7 +778,7 @@ AmlFindMethodDefinition (
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Comparing with: ")); DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Comparing with: "));
NextLink = NameSpaceRefList->ForwardLink; NextLink = NameSpaceRefList->ForwardLink;
while (NextLink != NameSpaceRefList) { while (NextLink != NameSpaceRefList) {
ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink; ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE *)NextLink;
// Print the raw absolute path of the probed node. // Print the raw absolute path of the probed node.
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
@ -790,7 +803,7 @@ AmlFindMethodDefinition (
// "MET0" should be skipped. // "MET0" should be skipped.
Status = AmlStreamInit ( Status = AmlStreamInit (
&ProbedRawAbsoluteBStream, &ProbedRawAbsoluteBStream,
(UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath, (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
ProbedNameSpaceRefNode->RawAbsolutePathSize, ProbedNameSpaceRefNode->RawAbsolutePathSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -803,7 +816,9 @@ AmlFindMethodDefinition (
if (!AmlStreamCmp ( if (!AmlStreamCmp (
RawPathNameBStream, RawPathNameBStream,
&ProbedRawAbsoluteBStream, &ProbedRawAbsoluteBStream,
AmlStreamGetMaxBufferSize (RawPathNameBStream))) { AmlStreamGetMaxBufferSize (RawPathNameBStream)
))
{
NextLink = NextLink->ForwardLink; NextLink = NextLink->ForwardLink;
continue; continue;
} }
@ -820,7 +835,7 @@ AmlFindMethodDefinition (
// Thus, the best match is \AAAA.MET0. // Thus, the best match is \AAAA.MET0.
Status = AmlStreamInit ( Status = AmlStreamInit (
&ProbedRawAbsoluteFStream, &ProbedRawAbsoluteFStream,
(UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath, (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
ProbedNameSpaceRefNode->RawAbsolutePathSize, ProbedNameSpaceRefNode->RawAbsolutePathSize,
EAmlStreamDirectionForward EAmlStreamDirectionForward
); );
@ -871,11 +886,13 @@ AmlFindMethodDefinition (
// didn't because it is out of scope. // didn't because it is out of scope.
// Thus, the best match is \AAAA.MET0. // Thus, the best match is \AAAA.MET0.
if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) < if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) <
BestNameSpaceRefNode->RawAbsolutePathSize) { BestNameSpaceRefNode->RawAbsolutePathSize)
{
BestScopeCount = ProbedScopeCount; BestScopeCount = ProbedScopeCount;
BestNameSpaceRefNode = ProbedNameSpaceRefNode; BestNameSpaceRefNode = ProbedNameSpaceRefNode;
} else if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) == } else if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) ==
BestNameSpaceRefNode->RawAbsolutePathSize) { BestNameSpaceRefNode->RawAbsolutePathSize)
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -893,7 +910,10 @@ AmlFindMethodDefinition (
*OutNameSpaceRefNode = BestNameSpaceRefNode; *OutNameSpaceRefNode = BestNameSpaceRefNode;
} else if (AmlNodeCompareOpCode ( } else if (AmlNodeCompareOpCode (
BestNameSpaceRefNode->NodeRef, BestNameSpaceRefNode->NodeRef,
AML_ALIAS_OP, 0)) { AML_ALIAS_OP,
0
))
{
// The path matches an alias. Resolve the alias and check whether // The path matches an alias. Resolve the alias and check whether
// this is a method defintion. // this is a method defintion.
Status = AmlResolveAliasMethod ( Status = AmlResolveAliasMethod (
@ -943,10 +963,10 @@ AmlFindMethodDefinition (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIsMethodInvocation ( AmlIsMethodInvocation (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN CONST AML_STREAM * FStream, IN CONST AML_STREAM *FStream,
IN CONST LIST_ENTRY * NameSpaceRefList, IN CONST LIST_ENTRY *NameSpaceRefList,
OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -955,10 +975,10 @@ AmlIsMethodInvocation (
AML_STREAM RawAbsolutePathFStream; AML_STREAM RawAbsolutePathFStream;
AML_STREAM RawAbsolutePathBStream; AML_STREAM RawAbsolutePathBStream;
UINT8 * RawAbsolutePathBuffer; UINT8 *RawAbsolutePathBuffer;
UINT32 RawAbsolutePathBufferSize; UINT32 RawAbsolutePathBufferSize;
AML_NAMESPACE_REF_NODE * NameSpaceRefNode; AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
if ((!IS_AML_OBJECT_NODE (ParentNode) && if ((!IS_AML_OBJECT_NODE (ParentNode) &&
!IS_AML_ROOT_NODE (ParentNode)) || !IS_AML_ROOT_NODE (ParentNode)) ||
@ -966,15 +986,18 @@ AmlIsMethodInvocation (
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) || (NameSpaceRefList == NULL) ||
(OutNameSpaceRefNode == NULL)) { (OutNameSpaceRefNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// There cannot be a method invocation in a field list. Return. // There cannot be a method invocation in a field list. Return.
if (AmlNodeHasAttribute ( if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)ParentNode, (CONST AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) { AML_HAS_FIELD_LIST
))
{
*OutNameSpaceRefNode = NULL; *OutNameSpaceRefNode = NULL;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1060,7 +1083,7 @@ AmlIsMethodInvocation (
goto exit_handler; goto exit_handler;
} }
#if !defined(MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
// Print whether a method definition has been found. // Print whether a method definition has been found.
if (NameSpaceRefNode != NULL) { if (NameSpaceRefNode != NULL) {
DEBUG (( DEBUG ((
@ -1073,11 +1096,11 @@ AmlIsMethodInvocation (
NameSpaceRefNode->RawAbsolutePathSize NameSpaceRefNode->RawAbsolutePathSize
); );
DEBUG ((DEBUG_VERBOSE, ".\n")); DEBUG ((DEBUG_VERBOSE, ".\n"));
} else { } else {
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: No method definition found.\n")); DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: No method definition found.\n"));
} }
#endif // MDEPKG_NDEBUG
#endif // MDEPKG_NDEBUG
*OutNameSpaceRefNode = NameSpaceRefNode; *OutNameSpaceRefNode = NameSpaceRefNode;
@ -1105,27 +1128,28 @@ exit_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAddNameSpaceReference ( AmlAddNameSpaceReference (
IN CONST AML_OBJECT_NODE * Node, IN CONST AML_OBJECT_NODE *Node,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NAMESPACE_REF_NODE * NameSpaceRefNode; AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
AML_STREAM NodeNameFStream; AML_STREAM NodeNameFStream;
EAML_PARSE_INDEX NameIndex; EAML_PARSE_INDEX NameIndex;
CONST AML_DATA_NODE * NameNode; CONST AML_DATA_NODE *NameNode;
AML_STREAM RawAbsolutePathBStream; AML_STREAM RawAbsolutePathBStream;
UINT32 RawAbsolutePathBStreamSize; UINT32 RawAbsolutePathBStreamSize;
CHAR8 * AbsolutePathBuffer; CHAR8 *AbsolutePathBuffer;
UINT32 AbsolutePathBufferSize; UINT32 AbsolutePathBufferSize;
CONST AML_NODE_HEADER * ParentNode; CONST AML_NODE_HEADER *ParentNode;
if (!AmlNodeHasAttribute (Node, AML_IN_NAMESPACE) || if (!AmlNodeHasAttribute (Node, AML_IN_NAMESPACE) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1141,7 +1165,7 @@ AmlAddNameSpaceReference (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAbsolutePathBStream, &RawAbsolutePathBStream,
(UINT8*)AbsolutePathBuffer, (UINT8 *)AbsolutePathBuffer,
AbsolutePathBufferSize, AbsolutePathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -1161,12 +1185,13 @@ AmlAddNameSpaceReference (
} }
// Get the Node name. // Get the Node name.
NameNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument ( NameNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
NameIndex NameIndex
); );
if (!IS_AML_DATA_NODE (NameNode) || if (!IS_AML_DATA_NODE (NameNode) ||
(NameNode->DataType != EAmlNodeDataTypeNameString)) { (NameNode->DataType != EAmlNodeDataTypeNameString))
{
ASSERT (0); ASSERT (0);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto exit_handler; goto exit_handler;
@ -1186,7 +1211,7 @@ AmlAddNameSpaceReference (
goto exit_handler; goto exit_handler;
} }
ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (ParentNode == NULL) { if (ParentNode == NULL) {
ASSERT (0); ASSERT (0);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
@ -1214,7 +1239,7 @@ AmlAddNameSpaceReference (
// Create a NameSpace reference node. // Create a NameSpace reference node.
Status = AmlCreateMethodRefNode ( Status = AmlCreateMethodRefNode (
Node, Node,
(CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream), (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
RawAbsolutePathBStreamSize, RawAbsolutePathBStreamSize,
&NameSpaceRefNode &NameSpaceRefNode
); );
@ -1232,7 +1257,7 @@ AmlAddNameSpaceReference (
)); ));
AMLDBG_PRINT_CHARS ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream), (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
AmlStreamGetIndex (&RawAbsolutePathBStream) AmlStreamGetIndex (&RawAbsolutePathBStream)
); );
DEBUG ((DEBUG_VERBOSE, "\n")); DEBUG ((DEBUG_VERBOSE, "\n"));
@ -1275,30 +1300,31 @@ exit_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateMethodInvocationNode ( AmlCreateMethodInvocationNode (
IN CONST AML_NAMESPACE_REF_NODE * NameSpaceRefNode, IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode,
IN AML_DATA_NODE * MethodInvocationName, IN AML_DATA_NODE *MethodInvocationName,
OUT AML_OBJECT_NODE ** MethodInvocationNodePtr OUT AML_OBJECT_NODE **MethodInvocationNodePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 ArgCount; UINT8 ArgCount;
AML_DATA_NODE * ArgCountNode; AML_DATA_NODE *ArgCountNode;
AML_NODE_HEADER ** FixedArgs; AML_NODE_HEADER **FixedArgs;
AML_OBJECT_NODE * MethodDefinitionNode; AML_OBJECT_NODE *MethodDefinitionNode;
AML_OBJECT_NODE * MethodInvocationNode; AML_OBJECT_NODE *MethodInvocationNode;
if ((NameSpaceRefNode == NULL) || if ((NameSpaceRefNode == NULL) ||
!AmlIsMethodDefinitionNode (NameSpaceRefNode->NodeRef) || !AmlIsMethodDefinitionNode (NameSpaceRefNode->NodeRef) ||
!IS_AML_DATA_NODE (MethodInvocationName) || !IS_AML_DATA_NODE (MethodInvocationName) ||
(MethodInvocationName->DataType != EAmlNodeDataTypeNameString) || (MethodInvocationName->DataType != EAmlNodeDataTypeNameString) ||
(MethodInvocationNodePtr == NULL)) { (MethodInvocationNodePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Get the number of arguments of the method. // Get the number of arguments of the method.
MethodDefinitionNode = (AML_OBJECT_NODE*)NameSpaceRefNode->NodeRef; MethodDefinitionNode = (AML_OBJECT_NODE *)NameSpaceRefNode->NodeRef;
FixedArgs = MethodDefinitionNode->FixedArgs; FixedArgs = MethodDefinitionNode->FixedArgs;
// The method definition is an actual method definition. // The method definition is an actual method definition.
if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_METHOD_OP, 0)) { if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_METHOD_OP, 0)) {
@ -1312,8 +1338,8 @@ AmlCreateMethodInvocationNode (
// bit 4-7: SyncLevel (0x00-0x0f) // bit 4-7: SyncLevel (0x00-0x0f)
// Read the MethodFlags to decode the ArgCount. // Read the MethodFlags to decode the ArgCount.
ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm1]; ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm1];
ArgCount = *((UINT8*)ArgCountNode->Buffer) & 0x7; ArgCount = *((UINT8 *)ArgCountNode->Buffer) & 0x7;
} else if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_EXTERNAL_OP, 0)) { } else if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_EXTERNAL_OP, 0)) {
// The method definition is an external statement. // The method definition is an external statement.
// Cf ACPI 6.3 specification: // Cf ACPI 6.3 specification:
@ -1323,8 +1349,8 @@ AmlCreateMethodInvocationNode (
// ArgumentCount := ByteData (0 - 7) // ArgumentCount := ByteData (0 - 7)
// Read the ArgumentCount. // Read the ArgumentCount.
ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm2]; ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm2];
ArgCount = *((UINT8*)ArgCountNode->Buffer); ArgCount = *((UINT8 *)ArgCountNode->Buffer);
} else { } else {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -1349,7 +1375,7 @@ AmlCreateMethodInvocationNode (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
MethodInvocationNode, MethodInvocationNode,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)MethodInvocationName (AML_NODE_HEADER *)MethodInvocationName
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1374,7 +1400,7 @@ AmlCreateMethodInvocationNode (
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
MethodInvocationNode, MethodInvocationNode,
EAmlParseIndexTerm1, EAmlParseIndexTerm1,
(AML_NODE_HEADER*)ArgCountNode (AML_NODE_HEADER *)ArgCountNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1386,9 +1412,9 @@ AmlCreateMethodInvocationNode (
error_handler: error_handler:
// Delete the sub-tree: the method invocation name is already attached. // Delete the sub-tree: the method invocation name is already attached.
AmlDeleteTree ((AML_NODE_HEADER*)MethodInvocationNode); AmlDeleteTree ((AML_NODE_HEADER *)MethodInvocationNode);
if (ArgCountNode != NULL) { if (ArgCountNode != NULL) {
AmlDeleteNode ((AML_NODE_HEADER*)ArgCountNode); AmlDeleteNode ((AML_NODE_HEADER *)ArgCountNode);
} }
return Status; return Status;
@ -1415,16 +1441,17 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetMethodInvocationArgCount ( AmlGetMethodInvocationArgCount (
IN CONST AML_OBJECT_NODE * MethodInvocationNode, IN CONST AML_OBJECT_NODE *MethodInvocationNode,
OUT BOOLEAN * IsMethodInvocation, OUT BOOLEAN *IsMethodInvocation,
OUT UINT8 * ArgCount OUT UINT8 *ArgCount
) )
{ {
AML_DATA_NODE * NumArgsNode; AML_DATA_NODE *NumArgsNode;
if (!IS_AML_NODE_VALID (MethodInvocationNode) || if (!IS_AML_NODE_VALID (MethodInvocationNode) ||
(IsMethodInvocation == NULL) || (IsMethodInvocation == NULL) ||
(ArgCount == NULL)) { (ArgCount == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1440,17 +1467,19 @@ AmlGetMethodInvocationArgCount (
// MethodInvocationOp := Pseudo Opcode for Method Invocation // MethodInvocationOp := Pseudo Opcode for Method Invocation
// NameString := Method Name // NameString := Method Name
// ArgumentCount := ByteData (0 - 7) // ArgumentCount := ByteData (0 - 7)
NumArgsNode = (AML_DATA_NODE*)AmlGetFixedArgument ( NumArgsNode = (AML_DATA_NODE *)AmlGetFixedArgument (
(AML_OBJECT_NODE*)MethodInvocationNode, (AML_OBJECT_NODE *)MethodInvocationNode,
EAmlParseIndexTerm1 EAmlParseIndexTerm1
); );
if (!IS_AML_NODE_VALID (NumArgsNode) || if (!IS_AML_NODE_VALID (NumArgsNode) ||
(NumArgsNode->Buffer == NULL) || (NumArgsNode->Buffer == NULL) ||
(NumArgsNode->DataType != EAmlNodeDataTypeUInt) || (NumArgsNode->DataType != EAmlNodeDataTypeUInt) ||
(NumArgsNode->Size != 1)) { (NumArgsNode->Size != 1))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*ArgCount = *NumArgsNode->Buffer; *ArgCount = *NumArgsNode->Buffer;
*IsMethodInvocation = TRUE; *IsMethodInvocation = TRUE;

View File

@ -27,13 +27,13 @@ typedef struct AmlNameSpaceRefNode {
/// Node part of the AML namespace. It must have the AML_IN_NAMESPACE /// Node part of the AML namespace. It must have the AML_IN_NAMESPACE
/// attribute. /// attribute.
CONST AML_OBJECT_NODE * NodeRef; CONST AML_OBJECT_NODE *NodeRef;
/// Raw AML absolute pathname of the NodeRef. /// Raw AML absolute pathname of the NodeRef.
/// This is a raw AML NameString (cf AmlNameSpace.c: A concatenated list /// This is a raw AML NameString (cf AmlNameSpace.c: A concatenated list
/// of 4 chars long names. The dual/multi NameString prefix have been /// of 4 chars long names. The dual/multi NameString prefix have been
/// stripped.). /// stripped.).
CONST CHAR8 * RawAbsolutePath; CONST CHAR8 *RawAbsolutePath;
/// Size of the raw AML absolute pathname buffer. /// Size of the raw AML absolute pathname buffer.
UINT32 RawAbsolutePathSize; UINT32 RawAbsolutePathSize;
@ -49,11 +49,11 @@ typedef struct AmlNameSpaceRefNode {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteNameSpaceRefList ( AmlDeleteNameSpaceRefList (
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
); );
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
/** Print the list of raw absolute paths of the NameSpace reference list. /** Print the list of raw absolute paths of the NameSpace reference list.
@param [in] NameSpaceRefList List of NameSpace reference nodes. @param [in] NameSpaceRefList List of NameSpace reference nodes.
@ -61,7 +61,7 @@ AmlDeleteNameSpaceRefList (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameSpaceRefList ( AmlDbgPrintNameSpaceRefList (
IN CONST LIST_ENTRY * NameSpaceRefList IN CONST LIST_ENTRY *NameSpaceRefList
); );
#endif // MDEPKG_NDEBUG #endif // MDEPKG_NDEBUG
@ -95,10 +95,10 @@ AmlDbgPrintNameSpaceRefList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIsMethodInvocation ( AmlIsMethodInvocation (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN CONST AML_STREAM * FStream, IN CONST AML_STREAM *FStream,
IN CONST LIST_ENTRY * NameSpaceRefList, IN CONST LIST_ENTRY *NameSpaceRefList,
OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
); );
/** Create a namespace reference node and add it to the NameSpaceRefList. /** Create a namespace reference node and add it to the NameSpaceRefList.
@ -119,8 +119,8 @@ AmlIsMethodInvocation (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAddNameSpaceReference ( AmlAddNameSpaceReference (
IN CONST AML_OBJECT_NODE * Node, IN CONST AML_OBJECT_NODE *Node,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
); );
/** Create a method invocation node. /** Create a method invocation node.
@ -154,9 +154,9 @@ AmlAddNameSpaceReference (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateMethodInvocationNode ( AmlCreateMethodInvocationNode (
IN CONST AML_NAMESPACE_REF_NODE * NameSpaceRefNode, IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode,
IN AML_DATA_NODE * MethodInvocationName, IN AML_DATA_NODE *MethodInvocationName,
OUT AML_OBJECT_NODE ** MethodInvocationNodePtr OUT AML_OBJECT_NODE **MethodInvocationNodePtr
); );
/** Get the number of arguments of a method invocation node. /** Get the number of arguments of a method invocation node.
@ -180,9 +180,9 @@ AmlCreateMethodInvocationNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetMethodInvocationArgCount ( AmlGetMethodInvocationArgCount (
IN CONST AML_OBJECT_NODE * MethodInvocationNode, IN CONST AML_OBJECT_NODE *MethodInvocationNode,
OUT BOOLEAN * IsMethodInvocation, OUT BOOLEAN *IsMethodInvocation,
OUT UINT8 * ArgCount OUT UINT8 *ArgCount
); );
#endif // AML_METHOD_PARSER_H_ #endif // AML_METHOD_PARSER_H_

View File

@ -69,9 +69,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseStream ( AmlParseStream (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
); );
/** Function pointer to parse an AML construct. /** Function pointer to parse an AML construct.
@ -102,10 +102,10 @@ typedef
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
(*AML_PARSE_FUNCTION) ( (*AML_PARSE_FUNCTION) (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
); );
/** Parse a UInt<X> (where X=8, 16, 32 or 64). /** Parse a UInt<X> (where X=8, 16, 32 or 64).
@ -130,10 +130,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseUIntX ( AmlParseUIntX (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -148,7 +148,8 @@ AmlParseUIntX (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -175,7 +176,7 @@ AmlParseUIntX (
AmlTypeToNodeDataType (ExpectedFormat), AmlTypeToNodeDataType (ExpectedFormat),
AmlStreamGetCurrPos (FStream), AmlStreamGetCurrPos (FStream),
UIntXSize, UIntXSize,
(AML_DATA_NODE**)OutNode (AML_DATA_NODE **)OutNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -216,16 +217,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseNameString ( AmlParseNameString (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CONST UINT8 * Buffer; CONST UINT8 *Buffer;
CONST AML_BYTE_ENCODING * ByteEncoding; CONST AML_BYTE_ENCODING *ByteEncoding;
UINT32 StrSize; UINT32 StrSize;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
@ -234,23 +235,26 @@ AmlParseNameString (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
ByteEncoding = AmlGetByteEncoding (Buffer); ByteEncoding = AmlGetByteEncoding (Buffer);
if ((ByteEncoding == NULL) || if ((ByteEncoding == NULL) ||
((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0)) { ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Parse the NameString. // Parse the NameString.
Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &StrSize); Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &StrSize);
if ((EFI_ERROR (Status)) || if ((EFI_ERROR (Status)) ||
(StrSize > AmlStreamGetFreeSpace (FStream))) { (StrSize > AmlStreamGetFreeSpace (FStream)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -259,7 +263,7 @@ AmlParseNameString (
EAmlNodeDataTypeNameString, EAmlNodeDataTypeNameString,
Buffer, Buffer,
StrSize, StrSize,
(AML_DATA_NODE**)OutNode (AML_DATA_NODE **)OutNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -300,16 +304,16 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseString ( AmlParseString (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 StrSize; UINT32 StrSize;
UINT8 Byte; UINT8 Byte;
CONST UINT8 * Buffer; CONST UINT8 *Buffer;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
@ -317,12 +321,13 @@ AmlParseString (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
StrSize = 0; StrSize = 0;
// AML String is NULL terminated. // AML String is NULL terminated.
do { do {
@ -332,6 +337,7 @@ AmlParseString (
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
StrSize++; StrSize++;
} while (Byte != '\0'); } while (Byte != '\0');
@ -341,7 +347,7 @@ AmlParseString (
AmlTypeToNodeDataType (ExpectedFormat), AmlTypeToNodeDataType (ExpectedFormat),
Buffer, Buffer,
StrSize, StrSize,
(AML_DATA_NODE**)OutNode (AML_DATA_NODE **)OutNode
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -372,10 +378,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseObject ( AmlParseObject (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -385,8 +391,8 @@ AmlParseObject (
UINT32 PkgOffset; UINT32 PkgOffset;
UINT32 FreeSpace; UINT32 FreeSpace;
CONST AML_BYTE_ENCODING * AmlByteEncoding; CONST AML_BYTE_ENCODING *AmlByteEncoding;
CONST UINT8 * Buffer; CONST UINT8 *Buffer;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
@ -394,7 +400,8 @@ AmlParseObject (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -424,16 +431,18 @@ AmlParseObject (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
return Status; return Status;
} }
// 2. Determine the OpCode size to move the stream forward. // 2. Determine the OpCode size to move the stream forward.
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
if (*Buffer == AML_EXT_OP) { if (*Buffer == AML_EXT_OP) {
OpCodeSize = 2; OpCodeSize = 2;
} else { } else {
OpCodeSize = 1; OpCodeSize = 1;
} }
Status = AmlStreamProgress (FStream, OpCodeSize); Status = AmlStreamProgress (FStream, OpCodeSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -446,7 +455,7 @@ AmlParseObject (
if (!IS_END_OF_STREAM (FStream)) { if (!IS_END_OF_STREAM (FStream)) {
// 3. Parse the PkgLength field, if present. // 3. Parse the PkgLength field, if present.
if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) { if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
PkgOffset = AmlGetPkgLength (Buffer, &PkgLength); PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
if (PkgOffset == 0) { if (PkgOffset == 0) {
ASSERT (0); ASSERT (0);
@ -482,7 +491,7 @@ AmlParseObject (
Status = AmlCreateObjectNode ( Status = AmlCreateObjectNode (
AmlByteEncoding, AmlByteEncoding,
PkgLength, PkgLength,
(AML_OBJECT_NODE**)OutNode (AML_OBJECT_NODE **)OutNode
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -513,32 +522,33 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFieldPkgLen ( AmlParseFieldPkgLen (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS Status1; EFI_STATUS Status1;
CONST UINT8 * Buffer; CONST UINT8 *Buffer;
UINT32 PkgOffset; UINT32 PkgOffset;
UINT32 PkgLength; UINT32 PkgLength;
if (!AmlNodeHasAttribute ( if (!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)ParentNode, (CONST AML_OBJECT_NODE *)ParentNode,
AML_IS_FIELD_ELEMENT AML_IS_FIELD_ELEMENT
) || ) ||
(ExpectedFormat != EAmlFieldPkgLen) || (ExpectedFormat != EAmlFieldPkgLen) ||
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
PkgOffset = AmlGetPkgLength (Buffer, &PkgLength); PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
if (PkgOffset == 0) { if (PkgOffset == 0) {
@ -552,7 +562,7 @@ AmlParseFieldPkgLen (
AmlTypeToNodeDataType (ExpectedFormat), AmlTypeToNodeDataType (ExpectedFormat),
Buffer, Buffer,
PkgOffset, PkgOffset,
(AML_DATA_NODE**)OutNode (AML_DATA_NODE **)OutNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -611,15 +621,15 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCheckAndParseMethodInvoc ( AmlCheckAndParseMethodInvoc (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
IN OUT LIST_ENTRY * NameSpaceRefList, IN OUT LIST_ENTRY *NameSpaceRefList,
OUT AML_OBJECT_NODE ** OutNode OUT AML_OBJECT_NODE **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NAMESPACE_REF_NODE * NameSpaceRefNode; AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
AML_OBJECT_NODE * MethodInvocationNode; AML_OBJECT_NODE *MethodInvocationNode;
AML_STREAM FStream; AML_STREAM FStream;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
@ -627,7 +637,8 @@ AmlCheckAndParseMethodInvoc (
!IS_AML_DATA_NODE (DataNode) || !IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeNameString) || (DataNode->DataType != EAmlNodeDataTypeNameString) ||
(NameSpaceRefList == NULL) || (NameSpaceRefList == NULL) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -663,7 +674,7 @@ AmlCheckAndParseMethodInvoc (
// Create a method invocation node. // Create a method invocation node.
Status = AmlCreateMethodInvocationNode ( Status = AmlCreateMethodInvocationNode (
NameSpaceRefNode, NameSpaceRefNode,
(AML_DATA_NODE*)DataNode, (AML_DATA_NODE *)DataNode,
&MethodInvocationNode &MethodInvocationNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -701,17 +712,17 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseArgument ( AmlParseArgument (
IN CONST AML_NODE_HEADER * ParentNode, IN CONST AML_NODE_HEADER *ParentNode,
IN AML_PARSE_FORMAT ExpectedFormat, IN AML_PARSE_FORMAT ExpectedFormat,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList, IN OUT LIST_ENTRY *NameSpaceRefList,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_PARSE_FUNCTION ParsingFunction; AML_PARSE_FUNCTION ParsingFunction;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
AML_OBJECT_NODE * MethodInvocationNode; AML_OBJECT_NODE *MethodInvocationNode;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
@ -720,7 +731,8 @@ AmlParseArgument (
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) || (NameSpaceRefList == NULL) ||
(OutNode == NULL)) { (OutNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -746,15 +758,17 @@ AmlParseArgument (
// Check whether the parsed argument is a NameString when an object // Check whether the parsed argument is a NameString when an object
// is expected. In such case, it could be a method invocation. // is expected. In such case, it could be a method invocation.
DataNode = (AML_DATA_NODE*)*OutNode; DataNode = (AML_DATA_NODE *)*OutNode;
if (IS_AML_DATA_NODE (DataNode) && if (IS_AML_DATA_NODE (DataNode) &&
(DataNode->DataType == EAmlNodeDataTypeNameString) && (DataNode->DataType == EAmlNodeDataTypeNameString) &&
(ExpectedFormat == EAmlObject)) { (ExpectedFormat == EAmlObject))
{
Status = AmlCheckAndParseMethodInvoc ( Status = AmlCheckAndParseMethodInvoc (
ParentNode, ParentNode,
(AML_DATA_NODE*)*OutNode, (AML_DATA_NODE *)*OutNode,
NameSpaceRefList, NameSpaceRefList,
&MethodInvocationNode); &MethodInvocationNode
);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -764,7 +778,7 @@ AmlParseArgument (
// the NameString has been attached to the MethodInvocationNode. // the NameString has been attached to the MethodInvocationNode.
// Replace the OutNode with the MethodInvocationNode. // Replace the OutNode with the MethodInvocationNode.
if (MethodInvocationNode != NULL) { if (MethodInvocationNode != NULL) {
*OutNode = (AML_NODE_HEADER*)MethodInvocationNode; *OutNode = (AML_NODE_HEADER *)MethodInvocationNode;
} }
} }
@ -789,20 +803,21 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseByteList ( AmlParseByteList (
IN AML_OBJECT_NODE * BufferNode, IN AML_OBJECT_NODE *BufferNode,
IN OUT AML_STREAM * FStream IN OUT AML_STREAM *FStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * NewNode; AML_NODE_HEADER *NewNode;
CONST UINT8 * Buffer; CONST UINT8 *Buffer;
UINT32 BufferSize; UINT32 BufferSize;
// Check whether the node is an Object Node and has byte list. // Check whether the node is an Object Node and has byte list.
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) || if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) { !IS_STREAM_FORWARD (FStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -820,14 +835,14 @@ AmlParseByteList (
// Create a single node holding the whole buffer data. // Create a single node holding the whole buffer data.
// CreateDataNode checks the Buffer and BufferSize values. // CreateDataNode checks the Buffer and BufferSize values.
Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream); Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
BufferSize = AmlStreamGetFreeSpace (FStream); BufferSize = AmlStreamGetFreeSpace (FStream);
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeRaw, EAmlNodeDataTypeRaw,
Buffer, Buffer,
BufferSize, BufferSize,
(AML_DATA_NODE**)&NewNode (AML_DATA_NODE **)&NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -835,7 +850,7 @@ AmlParseByteList (
} }
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)BufferNode, (AML_NODE_HEADER *)BufferNode,
NewNode NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -877,19 +892,19 @@ AmlParseByteList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFixedArguments ( AmlParseFixedArguments (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * FixedArgNode; AML_NODE_HEADER *FixedArgNode;
AML_STREAM FixedArgFStream; AML_STREAM FixedArgFStream;
EAML_PARSE_INDEX TermIndex; EAML_PARSE_INDEX TermIndex;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
CONST AML_PARSE_FORMAT * Format; CONST AML_PARSE_FORMAT *Format;
// Fixed arguments of method invocations node are handled differently. // Fixed arguments of method invocations node are handled differently.
if (!IS_AML_OBJECT_NODE (ObjectNode) || if (!IS_AML_OBJECT_NODE (ObjectNode) ||
@ -897,17 +912,19 @@ AmlParseFixedArguments (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
TermIndex = EAmlParseIndexTerm0; TermIndex = EAmlParseIndexTerm0;
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)ObjectNode (AML_OBJECT_NODE *)ObjectNode
); );
if ((ObjectNode->AmlByteEncoding != NULL) && if ((ObjectNode->AmlByteEncoding != NULL) &&
(ObjectNode->AmlByteEncoding->Format != NULL)) { (ObjectNode->AmlByteEncoding->Format != NULL))
{
Format = ObjectNode->AmlByteEncoding->Format; Format = ObjectNode->AmlByteEncoding->Format;
} else { } else {
ASSERT (0); ASSERT (0);
@ -917,7 +934,8 @@ AmlParseFixedArguments (
// Parse all the FixedArgs. // Parse all the FixedArgs.
while ((TermIndex < MaxIndex) && while ((TermIndex < MaxIndex) &&
!IS_END_OF_STREAM (FStream) && !IS_END_OF_STREAM (FStream) &&
(Format[TermIndex] != EAmlNone)) { (Format[TermIndex] != EAmlNone))
{
// Initialize a FixedArgStream to parse the current fixed argument. // Initialize a FixedArgStream to parse the current fixed argument.
Status = AmlStreamInitSubStream (FStream, &FixedArgFStream); Status = AmlStreamInitSubStream (FStream, &FixedArgFStream);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -927,7 +945,7 @@ AmlParseFixedArguments (
// Parse the current fixed argument. // Parse the current fixed argument.
Status = AmlParseArgument ( Status = AmlParseArgument (
(CONST AML_NODE_HEADER*)ObjectNode, (CONST AML_NODE_HEADER *)ObjectNode,
Format[TermIndex], Format[TermIndex],
&FixedArgFStream, &FixedArgFStream,
NameSpaceRefList, NameSpaceRefList,
@ -941,7 +959,7 @@ AmlParseFixedArguments (
// Add the fixed argument to the parent node's fixed argument list. // Add the fixed argument to the parent node's fixed argument list.
// FixedArgNode can be an object or data node. // FixedArgNode can be an object or data node.
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
(AML_OBJECT_NODE*)ObjectNode, (AML_OBJECT_NODE *)ObjectNode,
TermIndex, TermIndex,
FixedArgNode FixedArgNode
); );
@ -957,7 +975,8 @@ AmlParseFixedArguments (
// Parse the AML bytecode of the FixedArgNode if this is an object node. // Parse the AML bytecode of the FixedArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (FixedArgNode) && if (IS_AML_OBJECT_NODE (FixedArgNode) &&
!IS_END_OF_STREAM (&FixedArgFStream)) { !IS_END_OF_STREAM (&FixedArgFStream))
{
Status = AmlParseStream ( Status = AmlParseStream (
FixedArgNode, FixedArgNode,
&FixedArgFStream, &FixedArgFStream,
@ -1011,9 +1030,9 @@ AmlParseFixedArguments (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseVariableArguments ( AmlParseVariableArguments (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1021,24 +1040,25 @@ AmlParseVariableArguments (
BOOLEAN IsMethodInvocation; BOOLEAN IsMethodInvocation;
UINT8 MethodInvocationArgCount; UINT8 MethodInvocationArgCount;
AML_NODE_HEADER * VarArgNode; AML_NODE_HEADER *VarArgNode;
AML_STREAM VarArgFStream; AML_STREAM VarArgFStream;
if ((!AmlNodeHasAttribute ( if ((!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_HAS_CHILD_OBJ AML_HAS_CHILD_OBJ
) && ) &&
!IS_AML_ROOT_NODE (Node)) || !IS_AML_ROOT_NODE (Node)) ||
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Status = AmlGetMethodInvocationArgCount ( Status = AmlGetMethodInvocationArgCount (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
&IsMethodInvocation, &IsMethodInvocation,
&MethodInvocationArgCount &MethodInvocationArgCount
); );
@ -1077,7 +1097,7 @@ AmlParseVariableArguments (
// Add the variable argument to its parent variable list of arguments. // Add the variable argument to its parent variable list of arguments.
// VarArgNode can be an object or data node. // VarArgNode can be an object or data node.
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)Node, (AML_NODE_HEADER *)Node,
VarArgNode VarArgNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1092,7 +1112,8 @@ AmlParseVariableArguments (
// Parse the AML bytecode of the VarArgNode if this is an object node. // Parse the AML bytecode of the VarArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (VarArgNode) && if (IS_AML_OBJECT_NODE (VarArgNode) &&
(!IS_END_OF_STREAM (&VarArgFStream))) { (!IS_END_OF_STREAM (&VarArgFStream)))
{
Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList); Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -1139,9 +1160,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPopulateRootNode ( AmlPopulateRootNode (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1150,14 +1171,15 @@ AmlPopulateRootNode (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// A Root Node only has variable arguments. // A Root Node only has variable arguments.
Status = AmlParseVariableArguments ( Status = AmlParseVariableArguments (
(AML_NODE_HEADER*)RootNode, (AML_NODE_HEADER *)RootNode,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
@ -1184,9 +1206,9 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPopulateObjectNode ( AmlPopulateObjectNode (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN OUT AML_STREAM * FStream, IN OUT AML_STREAM *FStream,
IN OUT LIST_ENTRY * NameSpaceRefList IN OUT LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1195,7 +1217,8 @@ AmlPopulateObjectNode (
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) || !IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL)) { (NameSpaceRefList == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1230,10 +1253,12 @@ AmlPopulateObjectNode (
// This allows to identify method invocations from other namespace // This allows to identify method invocations from other namespace
// paths. Method invocation need to be parsed differently. // paths. Method invocation need to be parsed differently.
if (AmlNodeHasAttribute ( if (AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)ObjectNode, (CONST AML_OBJECT_NODE *)ObjectNode,
AML_IN_NAMESPACE)) { AML_IN_NAMESPACE
))
{
Status = AmlAddNameSpaceReference ( Status = AmlAddNameSpaceReference (
(CONST AML_OBJECT_NODE*)ObjectNode, (CONST AML_OBJECT_NODE *)ObjectNode,
NameSpaceRefList NameSpaceRefList
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1246,7 +1271,7 @@ AmlPopulateObjectNode (
// Parse the variable list of arguments if present. // Parse the variable list of arguments if present.
if (AmlNodeHasAttribute (ObjectNode, AML_HAS_CHILD_OBJ)) { if (AmlNodeHasAttribute (ObjectNode, AML_HAS_CHILD_OBJ)) {
Status = AmlParseVariableArguments ( Status = AmlParseVariableArguments (
(AML_NODE_HEADER*)ObjectNode, (AML_NODE_HEADER *)ObjectNode,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
@ -1292,33 +1317,31 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseStream ( AmlParseStream (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
Status = AmlPopulateRootNode ( Status = AmlPopulateRootNode (
(AML_ROOT_NODE*)Node, (AML_ROOT_NODE *)Node,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
} else if (IS_AML_OBJECT_NODE (Node)) { } else if (IS_AML_OBJECT_NODE (Node)) {
Status = AmlPopulateObjectNode ( Status = AmlPopulateObjectNode (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
} else { } else {
// Data node or other. // Data node or other.
ASSERT (0); ASSERT (0);
@ -1346,37 +1369,39 @@ AmlParseStream (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseDefinitionBlock ( AmlParseDefinitionBlock (
IN CONST EFI_ACPI_DESCRIPTION_HEADER * DefinitionBlock, IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock,
OUT AML_ROOT_NODE ** RootPtr OUT AML_ROOT_NODE **RootPtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS Status1; EFI_STATUS Status1;
AML_STREAM Stream; AML_STREAM Stream;
AML_ROOT_NODE * Root; AML_ROOT_NODE *Root;
LIST_ENTRY NameSpaceRefList; LIST_ENTRY NameSpaceRefList;
UINT8 * Buffer; UINT8 *Buffer;
UINT32 MaxBufferSize; UINT32 MaxBufferSize;
if ((DefinitionBlock == NULL) || if ((DefinitionBlock == NULL) ||
(RootPtr == NULL)) { (RootPtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Buffer = (UINT8*)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER); Buffer = (UINT8 *)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
if (DefinitionBlock->Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) { if (DefinitionBlock->Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
MaxBufferSize = DefinitionBlock->Length - MaxBufferSize = DefinitionBlock->Length -
(UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER); (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
// Create a root node. // Create a root node.
Status = AmlCreateRootNode ( Status = AmlCreateRootNode (
(EFI_ACPI_DESCRIPTION_HEADER*)DefinitionBlock, (EFI_ACPI_DESCRIPTION_HEADER *)DefinitionBlock,
&Root &Root
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1408,7 +1433,7 @@ AmlParseDefinitionBlock (
// Parse the whole AML blob. // Parse the whole AML blob.
Status = AmlParseStream ( Status = AmlParseStream (
(AML_NODE_HEADER*)Root, (AML_NODE_HEADER *)Root,
&Stream, &Stream,
&NameSpaceRefList &NameSpaceRefList
); );
@ -1432,7 +1457,7 @@ AmlParseDefinitionBlock (
error_handler: error_handler:
if (Root != NULL) { if (Root != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)Root); AmlDeleteTree ((AML_NODE_HEADER *)Root);
} }
exit_handler: exit_handler:

View File

@ -33,9 +33,9 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseFixedArguments ( AmlParseFixedArguments (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
); );
/** Parse the variable list of arguments of the input ObjectNode. /** Parse the variable list of arguments of the input ObjectNode.
@ -64,9 +64,9 @@ AmlParseFixedArguments (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseVariableArguments ( AmlParseVariableArguments (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_STREAM * FStream, IN AML_STREAM *FStream,
IN LIST_ENTRY * NameSpaceRefList IN LIST_ENTRY *NameSpaceRefList
); );
#endif // AML_PARSER_H_ #endif // AML_PARSER_H_

View File

@ -36,19 +36,20 @@
UINT32 UINT32
EFIAPI EFIAPI
AmlRdStreamGetRdSize ( AmlRdStreamGetRdSize (
IN CONST AML_STREAM * FStream IN CONST AML_STREAM *FStream
) )
{ {
CONST AML_RD_HEADER * CurrRdElement; CONST AML_RD_HEADER *CurrRdElement;
if (!IS_STREAM (FStream) || if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) { !IS_STREAM_FORWARD (FStream))
{
ASSERT (0); ASSERT (0);
return 0; return 0;
} }
CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream); CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
if (CurrRdElement == NULL) { if (CurrRdElement == NULL) {
ASSERT (0); ASSERT (0);
return 0; return 0;
@ -57,7 +58,8 @@ AmlRdStreamGetRdSize (
// If the resource data element is of the large type, check for overflow. // If the resource data element is of the large type, check for overflow.
if (AML_RD_IS_LARGE (CurrRdElement) && if (AML_RD_IS_LARGE (CurrRdElement) &&
(AmlStreamGetFreeSpace (FStream) < (AmlStreamGetFreeSpace (FStream) <
sizeof (ACPI_LARGE_RESOURCE_HEADER))) { sizeof (ACPI_LARGE_RESOURCE_HEADER)))
{
return 0; return 0;
} }
@ -86,15 +88,16 @@ STATIC
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlRdCheckFunctionDescNesting ( AmlRdCheckFunctionDescNesting (
IN CONST AML_STREAM * FStream, IN CONST AML_STREAM *FStream,
IN OUT BOOLEAN * InFunctionDesc IN OUT BOOLEAN *InFunctionDesc
) )
{ {
CONST AML_RD_HEADER * CurrRdElement; CONST AML_RD_HEADER *CurrRdElement;
if (!IS_STREAM (FStream) || if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
(InFunctionDesc == NULL)) { (InFunctionDesc == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -110,7 +113,10 @@ AmlRdCheckFunctionDescNesting (
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (
CurrRdElement, CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID ( AML_RD_BUILD_SMALL_DESC_ID (
ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME))) { ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME
)
))
{
*InFunctionDesc = TRUE; *InFunctionDesc = TRUE;
return TRUE; return TRUE;
} }
@ -119,7 +125,10 @@ AmlRdCheckFunctionDescNesting (
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (
CurrRdElement, CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID ( AML_RD_BUILD_SMALL_DESC_ID (
ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME))) { ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME
)
))
{
if (*InFunctionDesc) { if (*InFunctionDesc) {
*InFunctionDesc = FALSE; *InFunctionDesc = FALSE;
return TRUE; return TRUE;
@ -155,19 +164,20 @@ AmlRdCheckFunctionDescNesting (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlRdIsResourceDataBuffer ( AmlRdIsResourceDataBuffer (
IN CONST AML_STREAM * FStream IN CONST AML_STREAM *FStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 FreeSpace; UINT32 FreeSpace;
AML_STREAM SubStream; AML_STREAM SubStream;
CONST AML_RD_HEADER * CurrRdElement; CONST AML_RD_HEADER *CurrRdElement;
UINT32 CurrRdElementSize; UINT32 CurrRdElementSize;
BOOLEAN InFunctionDesc; BOOLEAN InFunctionDesc;
if (!IS_STREAM (FStream) || if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) { !IS_STREAM_FORWARD (FStream))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -188,7 +198,9 @@ AmlRdIsResourceDataBuffer (
// The first element cannot be an end tag. // The first element cannot be an end tag.
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (
CurrRdElement, 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; return FALSE;
} }
@ -199,7 +211,8 @@ AmlRdIsResourceDataBuffer (
CurrRdElementSize = AmlRdStreamGetRdSize (&SubStream); CurrRdElementSize = AmlRdStreamGetRdSize (&SubStream);
if ((FreeSpace == 0) || if ((FreeSpace == 0) ||
(CurrRdElement == NULL) || (CurrRdElement == NULL) ||
(CurrRdElementSize == 0)) { (CurrRdElementSize == 0))
{
return FALSE; return FALSE;
} }
@ -218,7 +231,9 @@ AmlRdIsResourceDataBuffer (
// Thus the function should have already returned. // Thus the function should have already returned.
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (
CurrRdElement, 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; return FALSE;
} }
@ -252,21 +267,22 @@ AmlRdIsResourceDataBuffer (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseResourceData ( AmlParseResourceData (
IN AML_OBJECT_NODE * BufferNode, IN AML_OBJECT_NODE *BufferNode,
IN AML_STREAM * FStream IN AML_STREAM *FStream
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * NewNode; AML_DATA_NODE *NewNode;
UINT32 FreeSpace; UINT32 FreeSpace;
CONST AML_RD_HEADER * CurrRdElement; CONST AML_RD_HEADER *CurrRdElement;
UINT32 CurrRdElementSize; UINT32 CurrRdElementSize;
// Check that BufferNode is an ObjectNode and has a ByteList. // Check that BufferNode is an ObjectNode and has a ByteList.
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) || if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) || !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) || IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream)) { !IS_STREAM_FORWARD (FStream))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -280,12 +296,12 @@ AmlParseResourceData (
break; break;
} }
CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream); CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
CurrRdElementSize = AmlRdStreamGetRdSize (FStream); CurrRdElementSize = AmlRdStreamGetRdSize (FStream);
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData, EAmlNodeDataTypeResourceData,
(CONST UINT8*)CurrRdElement, (CONST UINT8 *)CurrRdElement,
CurrRdElementSize, CurrRdElementSize,
&NewNode &NewNode
); );
@ -295,12 +311,12 @@ AmlParseResourceData (
} }
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)BufferNode, (AML_NODE_HEADER *)BufferNode,
(AML_NODE_HEADER*)NewNode (AML_NODE_HEADER *)NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER*)NewNode); AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status; return Status;
} }
@ -315,11 +331,14 @@ AmlParseResourceData (
// Exit the loop when finding the resource data end tag. // Exit the loop when finding the resource data end tag.
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (
CurrRdElement, 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) { if (FreeSpace != CurrRdElementSize) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
break; break;
} }
} // while } // while

View File

@ -40,7 +40,7 @@
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlRdIsResourceDataBuffer ( AmlRdIsResourceDataBuffer (
IN CONST AML_STREAM * FStream IN CONST AML_STREAM *FStream
); );
/** Parse a ResourceDataBuffer. /** Parse a ResourceDataBuffer.
@ -63,9 +63,8 @@ AmlRdIsResourceDataBuffer (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseResourceData ( AmlParseResourceData (
IN AML_OBJECT_NODE * BufferNode, IN AML_OBJECT_NODE *BufferNode,
IN AML_STREAM * FStream IN AML_STREAM *FStream
); );
#endif // AML_RESOURCE_DATA_PARSER_H_ #endif // AML_RESOURCE_DATA_PARSER_H_

View File

@ -28,7 +28,7 @@
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlRdCompareDescId ( AmlRdCompareDescId (
IN CONST AML_RD_HEADER * Header, IN CONST AML_RD_HEADER *Header,
IN AML_RD_HEADER DescriptorId IN AML_RD_HEADER DescriptorId
) )
{ {
@ -56,7 +56,7 @@ AmlRdCompareDescId (
AML_RD_HEADER AML_RD_HEADER
EFIAPI EFIAPI
AmlRdGetDescId ( AmlRdGetDescId (
IN CONST AML_RD_HEADER * Header IN CONST AML_RD_HEADER *Header
) )
{ {
if (Header == NULL) { if (Header == NULL) {
@ -84,7 +84,7 @@ AmlRdGetDescId (
UINT32 UINT32
EFIAPI EFIAPI
AmlRdGetSize ( AmlRdGetSize (
IN CONST AML_RD_HEADER * Header IN CONST AML_RD_HEADER *Header
) )
{ {
if (Header == NULL) { if (Header == NULL) {
@ -93,12 +93,12 @@ AmlRdGetSize (
} }
if (AML_RD_IS_LARGE (Header)) { if (AML_RD_IS_LARGE (Header)) {
return ((ACPI_LARGE_RESOURCE_HEADER*)Header)->Length + return ((ACPI_LARGE_RESOURCE_HEADER *)Header)->Length +
sizeof (ACPI_LARGE_RESOURCE_HEADER); sizeof (ACPI_LARGE_RESOURCE_HEADER);
} }
// Header is a small resource data element. // Header is a small resource data element.
return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length + return ((ACPI_SMALL_RESOURCE_HEADER *)Header)->Bits.Length +
sizeof (ACPI_SMALL_RESOURCE_HEADER); sizeof (ACPI_SMALL_RESOURCE_HEADER);
} }
@ -119,18 +119,20 @@ AmlRdGetSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlRdSetEndTagChecksum ( AmlRdSetEndTagChecksum (
IN CONST AML_RD_HEADER * Header, IN CONST AML_RD_HEADER *Header,
IN UINT8 CheckSum IN UINT8 CheckSum
) )
{ {
if ((Header == NULL) || if ((Header == NULL) ||
!AmlRdCompareDescId ( !AmlRdCompareDescId (
Header, 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); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum; ((EFI_ACPI_END_TAG_DESCRIPTOR *)Header)->Checksum = CheckSum;
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -133,7 +133,7 @@ typedef UINT8 AML_RD_HEADER;
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlRdCompareDescId ( AmlRdCompareDescId (
IN CONST AML_RD_HEADER * Header, IN CONST AML_RD_HEADER *Header,
IN AML_RD_HEADER DescriptorId IN AML_RD_HEADER DescriptorId
); );
@ -151,7 +151,7 @@ AmlRdCompareDescId (
AML_RD_HEADER AML_RD_HEADER
EFIAPI EFIAPI
AmlRdGetDescId ( AmlRdGetDescId (
IN CONST AML_RD_HEADER * Header IN CONST AML_RD_HEADER *Header
); );
/** Get the size of a resource data element. /** Get the size of a resource data element.
@ -168,7 +168,7 @@ AmlRdGetDescId (
UINT32 UINT32
EFIAPI EFIAPI
AmlRdGetSize ( AmlRdGetSize (
IN CONST AML_RD_HEADER * Header IN CONST AML_RD_HEADER *Header
); );
/** Set the Checksum of an EndTag resource data. /** Set the Checksum of an EndTag resource data.
@ -188,7 +188,7 @@ AmlRdGetSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlRdSetEndTagChecksum ( AmlRdSetEndTagChecksum (
IN CONST AML_RD_HEADER * Header, IN CONST AML_RD_HEADER *Header,
IN UINT8 CheckSum IN UINT8 CheckSum
); );

View File

@ -38,27 +38,28 @@ STATIC
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlSerializeNodeCallback ( AmlSerializeNodeCallback (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN OUT VOID * Context OPTIONAL, IN OUT VOID *Context OPTIONAL,
IN OUT EFI_STATUS * Status OPTIONAL IN OUT EFI_STATUS *Status OPTIONAL
) )
{ {
EFI_STATUS Status1; EFI_STATUS Status1;
CONST AML_DATA_NODE * DataNode; CONST AML_DATA_NODE *DataNode;
CONST AML_OBJECT_NODE * ObjectNode; CONST AML_OBJECT_NODE *ObjectNode;
AML_STREAM * FStream; AML_STREAM *FStream;
// Bytes needed to store OpCode[1] + SubOpcode[1] + MaxPkgLen[4] = 6 bytes. // Bytes needed to store OpCode[1] + SubOpcode[1] + MaxPkgLen[4] = 6 bytes.
UINT8 ObjectNodeInfoArray[6]; UINT8 ObjectNodeInfoArray[6];
UINT32 Index; UINT32 Index;
BOOLEAN ContinueEnum; BOOLEAN ContinueEnum;
CONST AML_OBJECT_NODE * ParentNode; CONST AML_OBJECT_NODE *ParentNode;
EAML_PARSE_INDEX IndexPtr; EAML_PARSE_INDEX IndexPtr;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) { (Context == NULL))
{
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
@ -68,25 +69,27 @@ AmlSerializeNodeCallback (
// Ignore the second fixed argument of method invocation nodes // Ignore the second fixed argument of method invocation nodes
// as the information stored there (the argument count) is not in the // as the information stored there (the argument count) is not in the
// ACPI specification. // ACPI specification.
ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)Node);
if (IS_AML_OBJECT_NODE (ParentNode) && if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) && AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
AmlIsNodeFixedArgument (Node, &IndexPtr)) { AmlIsNodeFixedArgument (Node, &IndexPtr))
{
if (IndexPtr == EAmlParseIndexTerm1) { if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) { if (Status != NULL) {
*Status = EFI_SUCCESS; *Status = EFI_SUCCESS;
} }
return TRUE; return TRUE;
} }
} }
Status1 = EFI_SUCCESS; Status1 = EFI_SUCCESS;
ContinueEnum = TRUE; ContinueEnum = TRUE;
FStream = (AML_STREAM*)Context; FStream = (AML_STREAM *)Context;
if (IS_AML_DATA_NODE (Node)) { if (IS_AML_DATA_NODE (Node)) {
// Copy the content of the Buffer for a DataNode. // Copy the content of the Buffer for a DataNode.
DataNode = (AML_DATA_NODE*)Node; DataNode = (AML_DATA_NODE *)Node;
Status1 = AmlStreamWrite ( Status1 = AmlStreamWrite (
FStream, FStream,
DataNode->Buffer, DataNode->Buffer,
@ -97,15 +100,16 @@ AmlSerializeNodeCallback (
ContinueEnum = FALSE; ContinueEnum = FALSE;
goto error_handler; goto error_handler;
} }
} else if (IS_AML_OBJECT_NODE (Node) && } else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IS_PSEUDO_OPCODE)) { AML_IS_PSEUDO_OPCODE
))
{
// Ignore pseudo-opcodes as they are not part of the // Ignore pseudo-opcodes as they are not part of the
// ACPI specification. // ACPI specification.
ObjectNode = (AML_OBJECT_NODE*)Node; ObjectNode = (AML_OBJECT_NODE *)Node;
Index = 0; Index = 0;
// Copy the opcode(s). // Copy the opcode(s).
@ -138,6 +142,7 @@ error_handler:
if (Status != NULL) { if (Status != NULL) {
*Status = Status1; *Status = Status1;
} }
return ContinueEnum; return ContinueEnum;
} }
@ -169,9 +174,9 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSerializeTree ( AmlSerializeTree (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
IN UINT8 * Buffer OPTIONAL, IN UINT8 *Buffer OPTIONAL,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -179,14 +184,15 @@ AmlSerializeTree (
UINT32 TableSize; UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) || if (!IS_AML_ROOT_NODE (RootNode) ||
(BufferSize == NULL)) { (BufferSize == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Compute the total size of the AML blob. // Compute the total size of the AML blob.
Status = AmlComputeSize ( Status = AmlComputeSize (
(CONST AML_NODE_HEADER*)RootNode, (CONST AML_NODE_HEADER *)RootNode,
&TableSize &TableSize
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -226,7 +232,7 @@ AmlSerializeTree (
// Serialize the header. // Serialize the header.
Status = AmlStreamWrite ( Status = AmlStreamWrite (
&FStream, &FStream,
(UINT8*)RootNode->SdtHeader, (UINT8 *)RootNode->SdtHeader,
sizeof (EFI_ACPI_DESCRIPTION_HEADER) sizeof (EFI_ACPI_DESCRIPTION_HEADER)
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -236,9 +242,9 @@ AmlSerializeTree (
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
AmlEnumTree ( AmlEnumTree (
(AML_NODE_HEADER*)RootNode, (AML_NODE_HEADER *)RootNode,
AmlSerializeNodeCallback, AmlSerializeNodeCallback,
(VOID*)&FStream, (VOID *)&FStream,
&Status &Status
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -247,7 +253,7 @@ AmlSerializeTree (
} }
// Update the checksum. // Update the checksum.
return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER*)Buffer); return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER *)Buffer);
} }
/** Serialize an AML definition block. /** Serialize an AML definition block.
@ -267,16 +273,17 @@ AmlSerializeTree (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSerializeDefinitionBlock ( AmlSerializeDefinitionBlock (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 * TableBuffer; UINT8 *TableBuffer;
UINT32 TableSize; UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) || if (!IS_AML_ROOT_NODE (RootNode) ||
(Table == NULL)) { (Table == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -296,7 +303,7 @@ AmlSerializeDefinitionBlock (
return Status; return Status;
} }
TableBuffer = (UINT8*)AllocateZeroPool (TableSize); TableBuffer = (UINT8 *)AllocateZeroPool (TableSize);
if (TableBuffer == NULL) { if (TableBuffer == NULL) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -317,7 +324,7 @@ AmlSerializeDefinitionBlock (
ASSERT (0); ASSERT (0);
} else { } else {
// Save the allocated Table buffer in the table list // Save the allocated Table buffer in the table list
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)TableBuffer; *Table = (EFI_ACPI_DESCRIPTION_HEADER *)TableBuffer;
} }
return Status; return Status;

View File

@ -23,8 +23,8 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamInit ( AmlStreamInit (
IN OUT AML_STREAM * Stream, IN OUT AML_STREAM *Stream,
IN UINT8 * Buffer, IN UINT8 *Buffer,
IN UINT32 MaxBufferSize, IN UINT32 MaxBufferSize,
IN EAML_STREAM_DIRECTION Direction IN EAML_STREAM_DIRECTION Direction
) )
@ -33,7 +33,8 @@ AmlStreamInit (
(Buffer == NULL) || (Buffer == NULL) ||
(MaxBufferSize == 0) || (MaxBufferSize == 0) ||
((Direction != EAmlStreamDirectionForward) && ((Direction != EAmlStreamDirectionForward) &&
(Direction != EAmlStreamDirectionBackward))) { (Direction != EAmlStreamDirectionBackward)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -60,12 +61,13 @@ AmlStreamInit (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamClone ( AmlStreamClone (
IN CONST AML_STREAM * Stream, IN CONST AML_STREAM *Stream,
OUT AML_STREAM * ClonedStream OUT AML_STREAM *ClonedStream
) )
{ {
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
(ClonedStream == NULL)) { (ClonedStream == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -105,12 +107,13 @@ AmlStreamClone (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamInitSubStream ( AmlStreamInitSubStream (
IN CONST AML_STREAM * Stream, IN CONST AML_STREAM *Stream,
OUT AML_STREAM * SubStream OUT AML_STREAM *SubStream
) )
{ {
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
(SubStream == NULL)) { (SubStream == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -141,13 +144,14 @@ AmlStreamInitSubStream (
UINT8 * UINT8 *
EFIAPI EFIAPI
AmlStreamGetBuffer ( AmlStreamGetBuffer (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
return Stream->Buffer; return Stream->Buffer;
} }
@ -161,13 +165,14 @@ AmlStreamGetBuffer (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetMaxBufferSize ( AmlStreamGetMaxBufferSize (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
ASSERT (0); ASSERT (0);
return 0; return 0;
} }
return Stream->MaxBufferSize; return Stream->MaxBufferSize;
} }
@ -183,13 +188,14 @@ AmlStreamGetMaxBufferSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReduceMaxBufferSize ( AmlStreamReduceMaxBufferSize (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Diff IN UINT32 Diff
) )
{ {
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
(Diff == 0) || (Diff == 0) ||
((Stream->MaxBufferSize - Diff) <= Stream->Index)) { ((Stream->MaxBufferSize - Diff) <= Stream->Index))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -214,13 +220,14 @@ AmlStreamReduceMaxBufferSize (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetIndex ( AmlStreamGetIndex (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
ASSERT (0); ASSERT (0);
return 0; return 0;
} }
return Stream->Index; return Stream->Index;
} }
@ -234,13 +241,14 @@ AmlStreamGetIndex (
EAML_STREAM_DIRECTION EAML_STREAM_DIRECTION
EFIAPI EFIAPI
AmlStreamGetDirection ( AmlStreamGetDirection (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
ASSERT (0); ASSERT (0);
return EAmlStreamDirectionInvalid; return EAmlStreamDirectionInvalid;
} }
return Stream->Direction; return Stream->Direction;
} }
@ -254,7 +262,7 @@ AmlStreamGetDirection (
UINT8 * UINT8 *
EFIAPI EFIAPI
AmlStreamGetCurrPos ( AmlStreamGetCurrPos (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
@ -282,7 +290,7 @@ AmlStreamGetCurrPos (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetFreeSpace ( AmlStreamGetFreeSpace (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
@ -314,13 +322,14 @@ AmlStreamGetFreeSpace (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamProgress ( AmlStreamProgress (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
) )
{ {
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) || IS_END_OF_STREAM (Stream) ||
(Offset == 0)) { (Offset == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -350,12 +359,13 @@ AmlStreamProgress (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamRewind ( AmlStreamRewind (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
) )
{ {
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
(Offset == 0)) { (Offset == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -380,7 +390,7 @@ AmlStreamRewind (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReset ( AmlStreamReset (
IN AML_STREAM * Stream IN AML_STREAM *Stream
) )
{ {
if (!IS_STREAM (Stream)) { if (!IS_STREAM (Stream)) {
@ -409,15 +419,16 @@ AmlStreamReset (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamPeekByte ( AmlStreamPeekByte (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
OUT UINT8 * OutByte OUT UINT8 *OutByte
) )
{ {
UINT8 * CurPos; UINT8 *CurPos;
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) || IS_END_OF_STREAM (Stream) ||
(OutByte == NULL)) { (OutByte == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -448,15 +459,16 @@ AmlStreamPeekByte (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReadByte ( AmlStreamReadByte (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
OUT UINT8 * OutByte OUT UINT8 *OutByte
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) || IS_END_OF_STREAM (Stream) ||
(OutByte == NULL)) { (OutByte == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -498,17 +510,18 @@ AmlStreamReadByte (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamWrite ( AmlStreamWrite (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN CONST UINT8 * Buffer, IN CONST UINT8 *Buffer,
IN UINT32 Size IN UINT32 Size
) )
{ {
UINT8 * CurrPos; UINT8 *CurrPos;
if (!IS_STREAM (Stream) || if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) || IS_END_OF_STREAM (Stream) ||
(Buffer == NULL) || (Buffer == NULL) ||
(Size == 0)) { (Size == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -554,21 +567,22 @@ AmlStreamWrite (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlStreamCmp ( AmlStreamCmp (
IN CONST AML_STREAM * Stream1, IN CONST AML_STREAM *Stream1,
IN CONST AML_STREAM * Stream2, IN CONST AML_STREAM *Stream2,
IN UINT32 Size IN UINT32 Size
) )
{ {
UINT32 MinSize; UINT32 MinSize;
UINT8 * CurrPosStream1; UINT8 *CurrPosStream1;
UINT8 * CurrPosStream2; UINT8 *CurrPosStream2;
if (!IS_STREAM (Stream1) || if (!IS_STREAM (Stream1) ||
IS_END_OF_STREAM (Stream1) || IS_END_OF_STREAM (Stream1) ||
!IS_STREAM (Stream2) || !IS_STREAM (Stream2) ||
IS_END_OF_STREAM (Stream2) || IS_END_OF_STREAM (Stream2) ||
(Stream1->Direction != Stream2->Direction) || (Stream1->Direction != Stream2->Direction) ||
(Size == 0)) { (Size == 0))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -589,6 +603,7 @@ AmlStreamCmp (
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
CurrPosStream2 = AmlStreamGetCurrPos (Stream2); CurrPosStream2 = AmlStreamGetCurrPos (Stream2);
if (CurrPosStream2 == NULL) { if (CurrPosStream2 == NULL) {
ASSERT (0); ASSERT (0);
@ -633,19 +648,20 @@ AmlStreamCmp (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamCpyS ( AmlStreamCpyS (
OUT CHAR8 * DstBuffer, OUT CHAR8 *DstBuffer,
IN UINT32 MaxDstBufferSize, IN UINT32 MaxDstBufferSize,
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Size IN UINT32 Size
) )
{ {
CHAR8 * StreamBufferStart; CHAR8 *StreamBufferStart;
// Stream is checked in the function call. // Stream is checked in the function call.
if ((DstBuffer == NULL) || if ((DstBuffer == NULL) ||
(MaxDstBufferSize == 0) || (MaxDstBufferSize == 0) ||
(Size > MaxDstBufferSize) || (Size > MaxDstBufferSize) ||
(Size > AmlStreamGetMaxBufferSize (Stream))) { (Size > AmlStreamGetMaxBufferSize (Stream)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -655,7 +671,7 @@ AmlStreamCpyS (
} }
// Find the address at which the data is starting. // Find the address at which the data is starting.
StreamBufferStart = (CHAR8*)(IS_STREAM_FORWARD (Stream) ? StreamBufferStart = (CHAR8 *)(IS_STREAM_FORWARD (Stream) ?
Stream->Buffer : Stream->Buffer :
AmlStreamGetCurrPos (Stream)); AmlStreamGetCurrPos (Stream));

View File

@ -31,7 +31,7 @@ typedef enum EAmlStreamDirection {
*/ */
typedef struct AmlStream { typedef struct AmlStream {
/// Pointer to a buffer. /// Pointer to a buffer.
UINT8 * Buffer; UINT8 *Buffer;
/// Size of Buffer. /// Size of Buffer.
UINT32 MaxBufferSize; UINT32 MaxBufferSize;
@ -116,8 +116,8 @@ typedef struct AmlStream {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamInit ( AmlStreamInit (
IN OUT AML_STREAM * Stream, IN OUT AML_STREAM *Stream,
IN UINT8 * Buffer, IN UINT8 *Buffer,
IN UINT32 MaxBufferSize, IN UINT32 MaxBufferSize,
IN EAML_STREAM_DIRECTION Direction IN EAML_STREAM_DIRECTION Direction
); );
@ -136,8 +136,8 @@ AmlStreamInit (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamClone ( AmlStreamClone (
IN CONST AML_STREAM * Stream, IN CONST AML_STREAM *Stream,
OUT AML_STREAM * ClonedStream OUT AML_STREAM *ClonedStream
); );
/** Initialize a sub-stream from a stream. /** Initialize a sub-stream from a stream.
@ -167,8 +167,8 @@ AmlStreamClone (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamInitSubStream ( AmlStreamInitSubStream (
IN CONST AML_STREAM * Stream, IN CONST AML_STREAM *Stream,
OUT AML_STREAM * SubStream OUT AML_STREAM *SubStream
); );
/** Get the buffer of a stream. /** Get the buffer of a stream.
@ -181,7 +181,7 @@ AmlStreamInitSubStream (
UINT8 * UINT8 *
EFIAPI EFIAPI
AmlStreamGetBuffer ( AmlStreamGetBuffer (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Get the size of Stream's Buffer. /** Get the size of Stream's Buffer.
@ -194,7 +194,7 @@ AmlStreamGetBuffer (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetMaxBufferSize ( AmlStreamGetMaxBufferSize (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Reduce the maximal size of Stream's Buffer (MaxBufferSize field). /** Reduce the maximal size of Stream's Buffer (MaxBufferSize field).
@ -209,7 +209,7 @@ AmlStreamGetMaxBufferSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReduceMaxBufferSize ( AmlStreamReduceMaxBufferSize (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Diff IN UINT32 Diff
); );
@ -229,7 +229,7 @@ AmlStreamReduceMaxBufferSize (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetIndex ( AmlStreamGetIndex (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Get Stream's Direction. /** Get Stream's Direction.
@ -242,7 +242,7 @@ AmlStreamGetIndex (
EAML_STREAM_DIRECTION EAML_STREAM_DIRECTION
EFIAPI EFIAPI
AmlStreamGetDirection ( AmlStreamGetDirection (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Return a pointer to the current position in the stream. /** Return a pointer to the current position in the stream.
@ -255,7 +255,7 @@ AmlStreamGetDirection (
UINT8 * UINT8 *
EFIAPI EFIAPI
AmlStreamGetCurrPos ( AmlStreamGetCurrPos (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Get the space available in the stream. /** Get the space available in the stream.
@ -268,7 +268,7 @@ AmlStreamGetCurrPos (
UINT32 UINT32
EFIAPI EFIAPI
AmlStreamGetFreeSpace ( AmlStreamGetFreeSpace (
IN CONST AML_STREAM * Stream IN CONST AML_STREAM *Stream
); );
/** Move Stream by Offset bytes. /** Move Stream by Offset bytes.
@ -287,7 +287,7 @@ AmlStreamGetFreeSpace (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamProgress ( AmlStreamProgress (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
); );
@ -306,7 +306,7 @@ AmlStreamProgress (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamRewind ( AmlStreamRewind (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
); );
@ -320,7 +320,7 @@ AmlStreamRewind (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReset ( AmlStreamReset (
IN AML_STREAM * Stream IN AML_STREAM *Stream
); );
/** Peek one byte at Stream's current position. /** Peek one byte at Stream's current position.
@ -339,8 +339,8 @@ AmlStreamReset (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamPeekByte ( AmlStreamPeekByte (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
OUT UINT8 * OutByte OUT UINT8 *OutByte
); );
/** Read one byte at Stream's current position. /** Read one byte at Stream's current position.
@ -359,8 +359,8 @@ AmlStreamPeekByte (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReadByte ( AmlStreamReadByte (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
OUT UINT8 * OutByte OUT UINT8 *OutByte
); );
/** Write Size bytes in the stream. /** Write Size bytes in the stream.
@ -388,8 +388,8 @@ AmlStreamReadByte (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamWrite ( AmlStreamWrite (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN CONST UINT8 * Buffer, IN CONST UINT8 *Buffer,
IN UINT32 Size IN UINT32 Size
); );
@ -416,8 +416,8 @@ AmlStreamWrite (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlStreamCmp ( AmlStreamCmp (
IN CONST AML_STREAM * Stream1, IN CONST AML_STREAM *Stream1,
IN CONST AML_STREAM * Stream2, IN CONST AML_STREAM *Stream2,
IN UINT32 Size IN UINT32 Size
); );
@ -442,9 +442,9 @@ AmlStreamCmp (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamCpyS ( AmlStreamCpyS (
OUT CHAR8 * DstBuffer, OUT CHAR8 *DstBuffer,
IN UINT32 MaxDstBufferSize, IN UINT32 MaxDstBufferSize,
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Size IN UINT32 Size
); );

View File

@ -39,9 +39,11 @@ AmlIsNameString (
(ParentPrefix <= MAX_UINT8) && (ParentPrefix <= MAX_UINT8) &&
(!((ParentPrefix != 0) && (Root != 0))) && (!((ParentPrefix != 0) && (Root != 0))) &&
(SegCount <= MAX_UINT8) && (SegCount <= MAX_UINT8) &&
((SegCount + Root + ParentPrefix) != 0)) { ((SegCount + Root + ParentPrefix) != 0))
{
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
@ -61,16 +63,17 @@ AmlIsNameString (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpperCaseMemCpyS ( AmlUpperCaseMemCpyS (
OUT CHAR8 * DstBuffer, OUT CHAR8 *DstBuffer,
IN UINT32 MaxDstBufferSize, IN UINT32 MaxDstBufferSize,
IN CONST CHAR8 * SrcBuffer, IN CONST CHAR8 *SrcBuffer,
IN UINT32 Count IN UINT32 Count
) )
{ {
UINT32 Index; UINT32 Index;
if ((DstBuffer == NULL) || if ((DstBuffer == NULL) ||
(SrcBuffer == NULL)) { (SrcBuffer == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -107,7 +110,7 @@ AmlUpperCaseMemCpyS (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsRootPath ( AmlIsRootPath (
IN CONST CHAR8 * Buffer IN CONST CHAR8 *Buffer
) )
{ {
if (Buffer == NULL) { if (Buffer == NULL) {
@ -142,7 +145,7 @@ AmlIsLeadNameChar (
IN CHAR8 Ch 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; return TRUE;
} else { } else {
return FALSE; return FALSE;
@ -174,7 +177,7 @@ AmlIsNameChar (
IN CHAR8 Ch IN CHAR8 Ch
) )
{ {
if (AmlIsLeadNameChar (Ch) || (Ch >= '0' && Ch <= '9')) { if (AmlIsLeadNameChar (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
@ -195,14 +198,15 @@ AmlIsNameChar (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AslIsNameSeg ( AslIsNameSeg (
IN CONST CHAR8 * AslBuffer, IN CONST CHAR8 *AslBuffer,
OUT UINT32 * Size OUT UINT32 *Size
) )
{ {
UINT32 Index; UINT32 Index;
if ((AslBuffer == NULL) || if ((AslBuffer == NULL) ||
(Size == NULL)) { (Size == NULL))
{
return FALSE; return FALSE;
} }
@ -212,7 +216,8 @@ AslIsNameSeg (
for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) { for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
if ((AslBuffer[Index] == '.') || if ((AslBuffer[Index] == '.') ||
(AslBuffer[Index] == '\0')) { (AslBuffer[Index] == '\0'))
{
*Size = Index; *Size = Index;
return TRUE; return TRUE;
} else if (!AmlIsNameChar (AslBuffer[Index])) { } else if (!AmlIsNameChar (AslBuffer[Index])) {
@ -237,7 +242,7 @@ AslIsNameSeg (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNameSeg ( AmlIsNameSeg (
IN CONST CHAR8 * AmlBuffer IN CONST CHAR8 *AmlBuffer
) )
{ {
UINT32 Index; UINT32 Index;
@ -279,10 +284,10 @@ AmlIsNameSeg (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AslParseNameStringInfo ( AslParseNameStringInfo (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
OUT UINT32 * Root, OUT UINT32 *Root,
OUT UINT32 * ParentPrefix, OUT UINT32 *ParentPrefix,
OUT UINT32 * SegCount OUT UINT32 *SegCount
) )
{ {
UINT32 NameSegSize; UINT32 NameSegSize;
@ -290,7 +295,8 @@ AslParseNameStringInfo (
if ((Buffer == NULL) || if ((Buffer == NULL) ||
(Root == NULL) || (Root == NULL) ||
(ParentPrefix == NULL) || (ParentPrefix == NULL) ||
(SegCount == NULL)) { (SegCount == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -363,16 +369,17 @@ AslParseNameStringInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseNameStringInfo ( AmlParseNameStringInfo (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
OUT UINT32 * Root, OUT UINT32 *Root,
OUT UINT32 * ParentPrefix, OUT UINT32 *ParentPrefix,
OUT UINT32 * SegCount OUT UINT32 *SegCount
) )
{ {
if ((Buffer == NULL) || if ((Buffer == NULL) ||
(Root == NULL) || (Root == NULL) ||
(ParentPrefix == NULL) || (ParentPrefix == NULL) ||
(SegCount == NULL)) { (SegCount == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -396,7 +403,7 @@ AmlParseNameStringInfo (
if (*Buffer == AML_DUAL_NAME_PREFIX) { if (*Buffer == AML_DUAL_NAME_PREFIX) {
*SegCount = 2; *SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) { } else if (*Buffer == AML_MULTI_NAME_PREFIX) {
*SegCount = *((UINT8*)(Buffer + 1)); *SegCount = *((UINT8 *)(Buffer + 1));
} else if (AmlIsNameSeg (Buffer)) { } else if (AmlIsNameSeg (Buffer)) {
*SegCount = 1; *SegCount = 1;
} else if (*Buffer == AML_ZERO_OP) { } else if (*Buffer == AML_ZERO_OP) {
@ -507,12 +514,13 @@ AmlComputeNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AslGetNameStringSize ( AslGetNameStringSize (
IN CONST CHAR8 * AslPath, IN CONST CHAR8 *AslPath,
OUT UINT32 * AslPathSizePtr OUT UINT32 *AslPathSizePtr
) )
{ {
if ((AslPath == NULL) || if ((AslPath == NULL) ||
(AslPathSizePtr == NULL)) { (AslPathSizePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -537,8 +545,8 @@ AslGetNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetNameStringSize ( AmlGetNameStringSize (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
OUT UINT32 * AmlPathSizePtr OUT UINT32 *AmlPathSizePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -548,7 +556,8 @@ AmlGetNameStringSize (
UINT32 SegCount; UINT32 SegCount;
if ((AmlPath == NULL) || if ((AmlPath == NULL) ||
(AmlPathSizePtr == NULL)) { (AmlPathSizePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -587,8 +596,8 @@ AmlGetNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ConvertAslNameToAmlName ( ConvertAslNameToAmlName (
IN CONST CHAR8 * AslPath, IN CONST CHAR8 *AslPath,
OUT CHAR8 ** OutAmlPath OUT CHAR8 **OutAmlPath
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -599,12 +608,13 @@ ConvertAslNameToAmlName (
UINT32 TotalSize; UINT32 TotalSize;
UINT32 NameSegSize; UINT32 NameSegSize;
CONST CHAR8 * AslBuffer; CONST CHAR8 *AslBuffer;
CHAR8 * AmlBuffer; CHAR8 *AmlBuffer;
CHAR8 * AmlPath; CHAR8 *AmlPath;
if ((AslPath == NULL) || if ((AslPath == NULL) ||
(OutAmlPath == NULL)) { (OutAmlPath == NULL))
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -709,7 +719,6 @@ ConvertAslNameToAmlName (
} }
} }
} // while } // while
} else { } else {
// (SegCount == 0) // (SegCount == 0)
// '\0' needs to end the AML NameString/path. // '\0' needs to end the AML NameString/path.
@ -721,7 +730,8 @@ ConvertAslNameToAmlName (
// Check that AmlPath has been filled with TotalSize bytes. // Check that AmlPath has been filled with TotalSize bytes.
if ((SegCount != 0) || if ((SegCount != 0) ||
(*AslBuffer != AML_ZERO_OP) || (*AslBuffer != AML_ZERO_OP) ||
(((UINT32)(AmlBuffer - AmlPath)) != TotalSize)) { (((UINT32)(AmlBuffer - AmlPath)) != TotalSize))
{
ASSERT (0); ASSERT (0);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto error_handler; goto error_handler;
@ -749,8 +759,8 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ConvertAmlNameToAslName ( ConvertAmlNameToAslName (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
OUT CHAR8 ** OutAslPath OUT CHAR8 **OutAslPath
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -760,12 +770,13 @@ ConvertAmlNameToAslName (
UINT32 SegCount; UINT32 SegCount;
UINT32 TotalSize; UINT32 TotalSize;
CONST CHAR8 * AmlBuffer; CONST CHAR8 *AmlBuffer;
CHAR8 * AslBuffer; CHAR8 *AslBuffer;
CHAR8 * AslPath; CHAR8 *AslPath;
if ((AmlPath == NULL) || if ((AmlPath == NULL) ||
(OutAslPath == NULL)) { (OutAslPath == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -860,8 +871,8 @@ error_handler:
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AslCompareNameString ( AslCompareNameString (
IN CONST CHAR8 * AslName1, IN CONST CHAR8 *AslName1,
IN CONST CHAR8 * AslName2 IN CONST CHAR8 *AslName2
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -869,7 +880,8 @@ AslCompareNameString (
UINT32 AslName2Len; UINT32 AslName2Len;
if ((AslName1 == NULL) || if ((AslName1 == NULL) ||
(AslName2 == NULL)) { (AslName2 == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -905,8 +917,8 @@ AslCompareNameString (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlCompareNameString ( AmlCompareNameString (
IN CONST CHAR8 * AmlName1, IN CONST CHAR8 *AmlName1,
IN CONST CHAR8 * AmlName2 IN CONST CHAR8 *AmlName2
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -914,7 +926,8 @@ AmlCompareNameString (
UINT32 AmlName2Len; UINT32 AmlName2Len;
if ((AmlName1 == NULL) || if ((AmlName1 == NULL) ||
(AmlName2 == NULL)) { (AmlName2 == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -956,17 +969,18 @@ AmlCompareNameString (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
CompareAmlWithAslNameString ( CompareAmlWithAslNameString (
IN CONST CHAR8 * AmlName1, IN CONST CHAR8 *AmlName1,
IN CONST CHAR8 * AslName2 IN CONST CHAR8 *AslName2
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CHAR8 * AmlName2; CHAR8 *AmlName2;
BOOLEAN RetVal; BOOLEAN RetVal;
if ((AmlName1 == NULL) || if ((AmlName1 == NULL) ||
(AslName2 == NULL)) { (AslName2 == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -986,6 +1000,7 @@ CompareAmlWithAslNameString (
return RetVal; return RetVal;
} }
/** Given an AmlPath, return the address of the first NameSeg. /** Given an AmlPath, return the address of the first NameSeg.
It is possible to determine the size of an AML NameString/path just It is possible to determine the size of an AML NameString/path just
@ -1004,7 +1019,7 @@ CONST
CHAR8 * CHAR8 *
EFIAPI EFIAPI
AmlGetFirstNameSeg ( AmlGetFirstNameSeg (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix IN UINT32 ParentPrefix
) )

View File

@ -63,9 +63,9 @@ AmlIsNameString (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpperCaseMemCpyS ( AmlUpperCaseMemCpyS (
OUT CHAR8 * DstBuffer, OUT CHAR8 *DstBuffer,
IN UINT32 MaxDstBufferSize, IN UINT32 MaxDstBufferSize,
IN CONST CHAR8 * SrcBuffer, IN CONST CHAR8 *SrcBuffer,
IN UINT32 Count IN UINT32 Count
); );
@ -82,7 +82,7 @@ AmlUpperCaseMemCpyS (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsRootPath ( AmlIsRootPath (
IN CONST CHAR8 * Buffer IN CONST CHAR8 *Buffer
); );
/** Check whether Ch is an ASL/AML LeadName. /** Check whether Ch is an ASL/AML LeadName.
@ -145,8 +145,8 @@ AmlIsNameChar (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AslIsNameSeg ( AslIsNameSeg (
IN CONST CHAR8 * AslBuffer, IN CONST CHAR8 *AslBuffer,
OUT UINT32 * Size OUT UINT32 *Size
); );
/** Check whether AmlBuffer is an AML NameSeg. /** Check whether AmlBuffer is an AML NameSeg.
@ -162,7 +162,7 @@ AslIsNameSeg (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNameSeg ( AmlIsNameSeg (
IN CONST CHAR8 * AmlBuffer IN CONST CHAR8 *AmlBuffer
); );
/** Parse an ASL NameString/path. /** Parse an ASL NameString/path.
@ -185,10 +185,10 @@ AmlIsNameSeg (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AslParseNameStringInfo ( AslParseNameStringInfo (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
OUT UINT32 * Root, OUT UINT32 *Root,
OUT UINT32 * ParentPrefix, OUT UINT32 *ParentPrefix,
OUT UINT32 * SegCount OUT UINT32 *SegCount
); );
/** Parse an AML NameString/path. /** Parse an AML NameString/path.
@ -212,10 +212,10 @@ AslParseNameStringInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlParseNameStringInfo ( AmlParseNameStringInfo (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
OUT UINT32 * Root, OUT UINT32 *Root,
OUT UINT32 * ParentPrefix, OUT UINT32 *ParentPrefix,
OUT UINT32 * SegCount OUT UINT32 *SegCount
); );
/** Compute the ASL NameString/path size from NameString /** Compute the ASL NameString/path size from NameString
@ -269,8 +269,8 @@ AmlComputeNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AslGetNameStringSize ( AslGetNameStringSize (
IN CONST CHAR8 * AslPath, IN CONST CHAR8 *AslPath,
OUT UINT32 * AslPathSizePtr OUT UINT32 *AslPathSizePtr
); );
/** Get the AML NameString/path size. /** Get the AML NameString/path size.
@ -284,8 +284,8 @@ AslGetNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetNameStringSize ( AmlGetNameStringSize (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
OUT UINT32 * AmlPathSizePtr OUT UINT32 *AmlPathSizePtr
); );
/** Convert an ASL NameString/path to an AML NameString/path. /** Convert an ASL NameString/path to an AML NameString/path.
@ -302,8 +302,8 @@ AmlGetNameStringSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ConvertAslNameToAmlName ( ConvertAslNameToAmlName (
IN CONST CHAR8 * AslPath, IN CONST CHAR8 *AslPath,
OUT CHAR8 ** OutAmlPath OUT CHAR8 **OutAmlPath
); );
/** Convert an AML NameString/path to an ASL NameString/path. /** Convert an AML NameString/path to an ASL NameString/path.
@ -320,8 +320,8 @@ ConvertAslNameToAmlName (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ConvertAmlNameToAslName ( ConvertAmlNameToAslName (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
OUT CHAR8 ** OutAslPath OUT CHAR8 **OutAslPath
); );
/** Compare two ASL NameStrings. /** Compare two ASL NameStrings.
@ -335,8 +335,8 @@ ConvertAmlNameToAslName (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AslCompareNameString ( AslCompareNameString (
IN CONST CHAR8 * AslName1, IN CONST CHAR8 *AslName1,
IN CONST CHAR8 * AslName2 IN CONST CHAR8 *AslName2
); );
/** Compare two AML NameStrings. /** Compare two AML NameStrings.
@ -350,8 +350,8 @@ AslCompareNameString (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlCompareNameString ( AmlCompareNameString (
IN CONST CHAR8 * AmlName1, IN CONST CHAR8 *AmlName1,
IN CONST CHAR8 * AmlName2 IN CONST CHAR8 *AmlName2
); );
/** Compare an AML NameString and an ASL NameString. /** Compare an AML NameString and an ASL NameString.
@ -371,8 +371,8 @@ AmlCompareNameString (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
CompareAmlWithAslNameString ( CompareAmlWithAslNameString (
IN CONST CHAR8 * AmlName1, IN CONST CHAR8 *AmlName1,
IN CONST CHAR8 * AslName2 IN CONST CHAR8 *AslName2
); );
/** Given an AmlPath, return the address of the first NameSeg. /** Given an AmlPath, return the address of the first NameSeg.
@ -393,7 +393,7 @@ CONST
CHAR8 * CHAR8 *
EFIAPI EFIAPI
AmlGetFirstNameSeg ( AmlGetFirstNameSeg (
IN CONST CHAR8 * AmlPath, IN CONST CHAR8 *AmlPath,
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix IN UINT32 ParentPrefix
); );

View File

@ -27,50 +27,51 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCloneNode ( AmlCloneNode (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
OUT AML_NODE_HEADER ** ClonedNode OUT AML_NODE_HEADER **ClonedNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
AML_ROOT_NODE * RootNode; AML_ROOT_NODE *RootNode;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(ClonedNode == NULL)) { (ClonedNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (IS_AML_DATA_NODE (Node)) { if (IS_AML_DATA_NODE (Node)) {
DataNode = (AML_DATA_NODE*)Node; DataNode = (AML_DATA_NODE *)Node;
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
DataNode->DataType, DataNode->DataType,
DataNode->Buffer, DataNode->Buffer,
DataNode->Size, DataNode->Size,
(AML_DATA_NODE**)ClonedNode (AML_DATA_NODE **)ClonedNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
} else if (IS_AML_OBJECT_NODE (Node)) { } else if (IS_AML_OBJECT_NODE (Node)) {
ObjectNode = (AML_OBJECT_NODE*)Node; ObjectNode = (AML_OBJECT_NODE *)Node;
Status = AmlCreateObjectNode ( Status = AmlCreateObjectNode (
ObjectNode->AmlByteEncoding, ObjectNode->AmlByteEncoding,
ObjectNode->PkgLen, ObjectNode->PkgLen,
(AML_OBJECT_NODE**)ClonedNode (AML_OBJECT_NODE **)ClonedNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
} else if (IS_AML_ROOT_NODE (Node)) { } else if (IS_AML_ROOT_NODE (Node)) {
RootNode = (AML_ROOT_NODE*)Node; RootNode = (AML_ROOT_NODE *)Node;
Status = AmlCreateRootNode ( Status = AmlCreateRootNode (
RootNode->SdtHeader, RootNode->SdtHeader,
(AML_ROOT_NODE**)ClonedNode (AML_ROOT_NODE **)ClonedNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -99,24 +100,25 @@ AmlCloneNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCloneTree ( AmlCloneTree (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
OUT AML_NODE_HEADER ** ClonedNode OUT AML_NODE_HEADER **ClonedNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * HeadNode; AML_NODE_HEADER *HeadNode;
AML_NODE_HEADER * ClonedChildNode; AML_NODE_HEADER *ClonedChildNode;
AML_NODE_HEADER * FixedArgNode; AML_NODE_HEADER *FixedArgNode;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
LIST_ENTRY * StartLink; LIST_ENTRY *StartLink;
LIST_ENTRY * CurrentLink; LIST_ENTRY *CurrentLink;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(ClonedNode == NULL)) { (ClonedNode == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -129,10 +131,10 @@ AmlCloneTree (
// Clone the fixed arguments and bind them to their parent. // Clone the fixed arguments and bind them to their parent.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)Node (AML_OBJECT_NODE *)Node
); );
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) { for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index); FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
if (FixedArgNode == NULL) { if (FixedArgNode == NULL) {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
ASSERT (0); ASSERT (0);
@ -151,7 +153,7 @@ AmlCloneTree (
// Bind child. // Bind child.
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
(AML_OBJECT_NODE*)HeadNode, (AML_OBJECT_NODE *)HeadNode,
Index, Index,
ClonedChildNode ClonedChildNode
); );
@ -168,7 +170,7 @@ AmlCloneTree (
CurrentLink = StartLink->ForwardLink; CurrentLink = StartLink->ForwardLink;
while (CurrentLink != StartLink) { while (CurrentLink != StartLink) {
// Clone child. // Clone child.
Status = AmlCloneTree ((AML_NODE_HEADER*)CurrentLink, &ClonedChildNode); Status = AmlCloneTree ((AML_NODE_HEADER *)CurrentLink, &ClonedChildNode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;

View File

@ -24,7 +24,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlInitializeNodeHeader ( AmlInitializeNodeHeader (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN EAML_NODE_TYPE NodeType IN EAML_NODE_TYPE NodeType
) )
{ {
@ -55,7 +55,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteRootNode ( AmlDeleteRootNode (
IN AML_ROOT_NODE * RootNode IN AML_ROOT_NODE *RootNode
) )
{ {
if (!IS_AML_ROOT_NODE (RootNode)) { if (!IS_AML_ROOT_NODE (RootNode)) {
@ -90,15 +90,16 @@ AmlDeleteRootNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateRootNode ( AmlCreateRootNode (
IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader, IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader,
OUT AML_ROOT_NODE ** NewRootNodePtr OUT AML_ROOT_NODE **NewRootNodePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_ROOT_NODE * RootNode; AML_ROOT_NODE *RootNode;
if ((SdtHeader == NULL) || if ((SdtHeader == NULL) ||
(NewRootNodePtr == NULL)) { (NewRootNodePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -149,7 +150,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteObjectNode ( AmlDeleteObjectNode (
IN AML_OBJECT_NODE * ObjectNode IN AML_OBJECT_NODE *ObjectNode
) )
{ {
if (!IS_AML_OBJECT_NODE (ObjectNode)) { if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@ -178,16 +179,17 @@ AmlDeleteObjectNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateObjectNode ( AmlCreateObjectNode (
IN CONST AML_BYTE_ENCODING * AmlByteEncoding, IN CONST AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT32 PkgLength, IN UINT32 PkgLength,
OUT AML_OBJECT_NODE ** NewObjectNodePtr OUT AML_OBJECT_NODE **NewObjectNodePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
if ((AmlByteEncoding == NULL) || if ((AmlByteEncoding == NULL) ||
(NewObjectNodePtr == NULL)) { (NewObjectNodePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -234,7 +236,7 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteDataNode ( AmlDeleteDataNode (
IN AML_DATA_NODE * DataNode IN AML_DATA_NODE *DataNode
) )
{ {
if (!IS_AML_DATA_NODE (DataNode)) { if (!IS_AML_DATA_NODE (DataNode)) {
@ -272,13 +274,13 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCreateDataNode ( AmlCreateDataNode (
IN EAML_NODE_DATA_TYPE DataType, IN EAML_NODE_DATA_TYPE DataType,
IN CONST UINT8 * Data, IN CONST UINT8 *Data,
IN UINT32 DataSize, IN UINT32 DataSize,
OUT AML_DATA_NODE ** NewDataNodePtr OUT AML_DATA_NODE **NewDataNodePtr
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
// A data node must not be created for certain data types. // A data node must not be created for certain data types.
if ((DataType == EAmlNodeDataTypeNone) || if ((DataType == EAmlNodeDataTypeNone) ||
@ -289,7 +291,8 @@ AmlCreateDataNode (
(DataType == EAmlNodeDataTypeReserved5) || (DataType == EAmlNodeDataTypeReserved5) ||
(Data == NULL) || (Data == NULL) ||
(DataSize == 0) || (DataSize == 0) ||
(NewDataNodePtr == NULL)) { (NewDataNodePtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -334,7 +337,7 @@ AmlCreateDataNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteNode ( AmlDeleteNode (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -344,7 +347,8 @@ AmlDeleteNode (
// When removing the node, its parent and list are reset // When removing the node, its parent and list are reset
// with InitializeListHead. Thus it must be empty. // with InitializeListHead. Thus it must be empty.
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
!AML_NODE_IS_DETACHED (Node)) { !AML_NODE_IS_DETACHED (Node))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -358,10 +362,11 @@ AmlDeleteNode (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Status = AmlDeleteRootNode ((AML_ROOT_NODE*)Node); Status = AmlDeleteRootNode ((AML_ROOT_NODE *)Node);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
break; break;
} }
@ -375,25 +380,27 @@ AmlDeleteNode (
// Check the fixed argument list has been cleaned. // Check the fixed argument list has been cleaned.
for (Index = EAmlParseIndexTerm0; Index < EAmlParseIndexMax; Index++) { for (Index = EAmlParseIndexTerm0; Index < EAmlParseIndexMax; Index++) {
if (((AML_OBJECT_NODE*)Node)->FixedArgs[Index] != NULL) { if (((AML_OBJECT_NODE *)Node)->FixedArgs[Index] != NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
} }
Status = AmlDeleteObjectNode ((AML_OBJECT_NODE*)Node); Status = AmlDeleteObjectNode ((AML_OBJECT_NODE *)Node);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
break; break;
} }
case EAmlNodeData: case EAmlNodeData:
{ {
Status = AmlDeleteDataNode ((AML_DATA_NODE*)Node); Status = AmlDeleteDataNode ((AML_DATA_NODE *)Node);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
break; break;
} }
@ -421,12 +428,13 @@ AmlDeleteNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasAttribute ( AmlNodeHasAttribute (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
IN AML_OP_ATTRIBUTE Attribute IN AML_OP_ATTRIBUTE Attribute
) )
{ {
if (!IS_AML_OBJECT_NODE (ObjectNode) || if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(ObjectNode->AmlByteEncoding == NULL)) { (ObjectNode->AmlByteEncoding == NULL))
{
return FALSE; return FALSE;
} }
@ -447,13 +455,14 @@ AmlNodeHasAttribute (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeCompareOpCode ( AmlNodeCompareOpCode (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
if (!IS_AML_OBJECT_NODE (ObjectNode) || if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(ObjectNode->AmlByteEncoding == NULL)) { (ObjectNode->AmlByteEncoding == NULL))
{
return FALSE; return FALSE;
} }
@ -480,13 +489,14 @@ AmlNodeCompareOpCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsIntegerNode ( IsIntegerNode (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
) )
{ {
UINT8 OpCode; UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) || if (!IS_AML_OBJECT_NODE (Node) ||
(Node->AmlByteEncoding == NULL)) { (Node->AmlByteEncoding == NULL))
{
return FALSE; return FALSE;
} }
@ -495,7 +505,8 @@ IsIntegerNode (
if ((OpCode != AML_BYTE_PREFIX) && if ((OpCode != AML_BYTE_PREFIX) &&
(OpCode != AML_WORD_PREFIX) && (OpCode != AML_WORD_PREFIX) &&
(OpCode != AML_DWORD_PREFIX) && (OpCode != AML_DWORD_PREFIX) &&
(OpCode != AML_QWORD_PREFIX)) { (OpCode != AML_QWORD_PREFIX))
{
return FALSE; return FALSE;
} }
@ -515,13 +526,14 @@ IsIntegerNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsSpecialIntegerNode ( IsSpecialIntegerNode (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
) )
{ {
UINT8 OpCode; UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) || if (!IS_AML_OBJECT_NODE (Node) ||
(Node->AmlByteEncoding == NULL)) { (Node->AmlByteEncoding == NULL))
{
return FALSE; return FALSE;
} }
@ -529,7 +541,8 @@ IsSpecialIntegerNode (
if ((OpCode != AML_ZERO_OP) && if ((OpCode != AML_ZERO_OP) &&
(OpCode != AML_ONE_OP) && (OpCode != AML_ONE_OP) &&
(OpCode != AML_ONES_OP)) { (OpCode != AML_ONES_OP))
{
return FALSE; return FALSE;
} }
@ -555,10 +568,10 @@ IsSpecialIntegerNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsMethodDefinitionNode ( AmlIsMethodDefinitionNode (
IN CONST AML_OBJECT_NODE * Node IN CONST AML_OBJECT_NODE *Node
) )
{ {
AML_DATA_NODE * ObjectType; AML_DATA_NODE *ObjectType;
// Node is checked to be an object node aswell. // Node is checked to be an object node aswell.
if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) { if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) {
@ -569,14 +582,15 @@ AmlIsMethodDefinitionNode (
// ExternalOp := 0x15 // ExternalOp := 0x15
// ObjectType := ByteData // ObjectType := ByteData
// ArgumentCount := ByteData (0 - 7) // ArgumentCount := ByteData (0 - 7)
ObjectType = (AML_DATA_NODE*)AmlGetFixedArgument ( ObjectType = (AML_DATA_NODE *)AmlGetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
EAmlParseIndexTerm1 EAmlParseIndexTerm1
); );
if (IS_AML_DATA_NODE (ObjectType) && if (IS_AML_DATA_NODE (ObjectType) &&
(ObjectType->DataType == EAmlNodeDataTypeUInt) && (ObjectType->DataType == EAmlNodeDataTypeUInt) &&
((ObjectType->Size == 1))) { ((ObjectType->Size == 1)))
if (*((UINT8*)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) { {
if (*((UINT8 *)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
// The external definition is a method. // The external definition is a method.
return TRUE; return TRUE;
} else { } else {
@ -605,15 +619,16 @@ AmlIsMethodDefinitionNode (
**/ **/
EFI_STATUS EFI_STATUS
AmlNodeGetNameIndex ( AmlNodeGetNameIndex (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
OUT EAML_PARSE_INDEX * Index OUT EAML_PARSE_INDEX *Index
) )
{ {
EAML_PARSE_INDEX NameIndex; EAML_PARSE_INDEX NameIndex;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) || if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(ObjectNode->AmlByteEncoding == NULL) || (ObjectNode->AmlByteEncoding == NULL) ||
(Index == NULL)) { (Index == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -621,7 +636,8 @@ AmlNodeGetNameIndex (
NameIndex = ObjectNode->AmlByteEncoding->NameIndex; NameIndex = ObjectNode->AmlByteEncoding->NameIndex;
if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex) || if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex) ||
(ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName)) { (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -645,12 +661,12 @@ AmlNodeGetNameIndex (
CHAR8 * CHAR8 *
EFIAPI EFIAPI
AmlNodeGetName ( AmlNodeGetName (
IN CONST AML_OBJECT_NODE * ObjectNode IN CONST AML_OBJECT_NODE *ObjectNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EAML_PARSE_INDEX NameIndex; EAML_PARSE_INDEX NameIndex;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) { if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
ASSERT (0); ASSERT (0);
@ -665,10 +681,11 @@ AmlNodeGetName (
} }
// The name is stored in a Data node. // The name is stored in a Data node.
DataNode = (AML_DATA_NODE*)ObjectNode->FixedArgs[NameIndex]; DataNode = (AML_DATA_NODE *)ObjectNode->FixedArgs[NameIndex];
if (IS_AML_DATA_NODE (DataNode) && if (IS_AML_DATA_NODE (DataNode) &&
(DataNode->DataType == EAmlNodeDataTypeNameString)) { (DataNode->DataType == EAmlNodeDataTypeNameString))
return (CHAR8*)DataNode->Buffer; {
return (CHAR8 *)DataNode->Buffer;
} }
/* Return NULL if no name is found. /* Return NULL if no name is found.

View File

@ -28,8 +28,8 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateRootNode ( AmlCreateRootNode (
IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader, IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader,
OUT AML_ROOT_NODE ** NewRootNodePtr OUT AML_ROOT_NODE **NewRootNodePtr
); );
/** Create an AML_OBJECT_NODE. /** Create an AML_OBJECT_NODE.
@ -49,9 +49,9 @@ AmlCreateRootNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlCreateObjectNode ( AmlCreateObjectNode (
IN CONST AML_BYTE_ENCODING * AmlByteEncoding, IN CONST AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT32 PkgLength, IN UINT32 PkgLength,
OUT AML_OBJECT_NODE ** NewObjectNodePtr OUT AML_OBJECT_NODE **NewObjectNodePtr
); );
/** Create an AML_DATA_NODE. /** Create an AML_DATA_NODE.
@ -73,9 +73,9 @@ EFI_STATUS
EFIAPI EFIAPI
AmlCreateDataNode ( AmlCreateDataNode (
IN EAML_NODE_DATA_TYPE DataType, IN EAML_NODE_DATA_TYPE DataType,
IN CONST UINT8 * Data, IN CONST UINT8 *Data,
IN UINT32 DataSize, IN UINT32 DataSize,
OUT AML_DATA_NODE ** NewDataNodePtr OUT AML_DATA_NODE **NewDataNodePtr
); );
/** Delete a Node. /** Delete a Node.
@ -88,7 +88,7 @@ AmlCreateDataNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteNode ( AmlDeleteNode (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
); );
/** Check whether ObjectNode has the input attribute. /** Check whether ObjectNode has the input attribute.
@ -104,7 +104,7 @@ AmlDeleteNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasAttribute ( AmlNodeHasAttribute (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
IN AML_OP_ATTRIBUTE Attribute IN AML_OP_ATTRIBUTE Attribute
); );
@ -121,7 +121,7 @@ AmlNodeHasAttribute (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeCompareOpCode ( AmlNodeCompareOpCode (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
@ -142,7 +142,7 @@ AmlNodeCompareOpCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsIntegerNode ( IsIntegerNode (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
); );
/** Check whether a Node is a ZeroOp, a OneOp or a OnesOp. /** Check whether a Node is a ZeroOp, a OneOp or a OnesOp.
@ -158,7 +158,7 @@ IsIntegerNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
IsSpecialIntegerNode ( IsSpecialIntegerNode (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
); );
/** Check whether Node corresponds to a method definition. /** Check whether Node corresponds to a method definition.
@ -180,7 +180,7 @@ IsSpecialIntegerNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsMethodDefinitionNode ( AmlIsMethodDefinitionNode (
IN CONST AML_OBJECT_NODE * Node IN CONST AML_OBJECT_NODE *Node
); );
/** Get the index at which the name of the node is stored. /** Get the index at which the name of the node is stored.
@ -194,8 +194,8 @@ AmlIsMethodDefinitionNode (
**/ **/
EFI_STATUS EFI_STATUS
AmlNodeGetNameIndex ( AmlNodeGetNameIndex (
IN CONST AML_OBJECT_NODE * ObjectNode, IN CONST AML_OBJECT_NODE *ObjectNode,
OUT EAML_PARSE_INDEX * Index OUT EAML_PARSE_INDEX *Index
); );
/** Get the name of the Node. /** Get the name of the Node.
@ -212,7 +212,7 @@ AmlNodeGetNameIndex (
CHAR8 * CHAR8 *
EFIAPI EFIAPI
AmlNodeGetName ( AmlNodeGetName (
IN CONST AML_OBJECT_NODE * ObjectNode IN CONST AML_OBJECT_NODE *ObjectNode
); );
#endif // AML_NODE_H_ #endif // AML_NODE_H_

View File

@ -25,7 +25,7 @@
EAML_NODE_TYPE EAML_NODE_TYPE
EFIAPI EFIAPI
AmlGetNodeType ( AmlGetNodeType (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
@ -48,12 +48,13 @@ AmlGetNodeType (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetRootNodeInfo ( AmlGetRootNodeInfo (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
OUT EFI_ACPI_DESCRIPTION_HEADER * SdtHeaderBuffer OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer
) )
{ {
if (!IS_AML_ROOT_NODE (RootNode) || if (!IS_AML_ROOT_NODE (RootNode) ||
(SdtHeaderBuffer == NULL)) { (SdtHeaderBuffer == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -94,11 +95,11 @@ AmlGetRootNodeInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetObjectNodeInfo ( AmlGetObjectNodeInfo (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
OUT UINT8 * OpCode OPTIONAL, OUT UINT8 *OpCode OPTIONAL,
OUT UINT8 * SubOpCode OPTIONAL, OUT UINT8 *SubOpCode OPTIONAL,
OUT UINT32 * PkgLen OPTIONAL, OUT UINT32 *PkgLen OPTIONAL,
OUT BOOLEAN * IsNameSpaceNode OPTIONAL OUT BOOLEAN *IsNameSpaceNode OPTIONAL
) )
{ {
if (!IS_AML_OBJECT_NODE (ObjectNode)) { if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@ -109,12 +110,15 @@ AmlGetObjectNodeInfo (
if (OpCode != NULL) { if (OpCode != NULL) {
*OpCode = ObjectNode->AmlByteEncoding->OpCode; *OpCode = ObjectNode->AmlByteEncoding->OpCode;
} }
if (SubOpCode != NULL) { if (SubOpCode != NULL) {
*SubOpCode = ObjectNode->AmlByteEncoding->SubOpCode; *SubOpCode = ObjectNode->AmlByteEncoding->SubOpCode;
} }
if (PkgLen != NULL) { if (PkgLen != NULL) {
*PkgLen = ObjectNode->PkgLen; *PkgLen = ObjectNode->PkgLen;
} }
if (IsNameSpaceNode != NULL) { if (IsNameSpaceNode != NULL) {
*IsNameSpaceNode = AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE); *IsNameSpaceNode = AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE);
} }
@ -131,11 +135,12 @@ AmlGetObjectNodeInfo (
**/ **/
UINT8 UINT8
AmlGetFixedArgumentCount ( AmlGetFixedArgumentCount (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
) )
{ {
if (IS_AML_OBJECT_NODE (Node) && if (IS_AML_OBJECT_NODE (Node) &&
(Node->AmlByteEncoding != NULL)) { (Node->AmlByteEncoding != NULL))
{
return (UINT8)Node->AmlByteEncoding->MaxIndex; return (UINT8)Node->AmlByteEncoding->MaxIndex;
} }
@ -154,12 +159,13 @@ AmlGetFixedArgumentCount (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetNodeDataType ( AmlGetNodeDataType (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
OUT EAML_NODE_DATA_TYPE * DataType OUT EAML_NODE_DATA_TYPE *DataType
) )
{ {
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(DataType == NULL)) { (DataType == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -187,13 +193,14 @@ AmlGetNodeDataType (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetResourceDataType ( AmlGetResourceDataType (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
OUT AML_RD_HEADER * ResourceDataType OUT AML_RD_HEADER *ResourceDataType
) )
{ {
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(ResourceDataType == NULL) || (ResourceDataType == NULL) ||
(DataNode->DataType != EAmlNodeDataTypeResourceData)) { (DataNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -227,19 +234,21 @@ AmlGetResourceDataType (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlGetDataNodeBuffer ( AmlGetDataNodeBuffer (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
OUT UINT8 * Buffer OPTIONAL, OUT UINT8 *Buffer OPTIONAL,
IN OUT UINT32 * BufferSize IN OUT UINT32 *BufferSize
) )
{ {
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(BufferSize == NULL)) { (BufferSize == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((*BufferSize >= DataNode->Size) && if ((*BufferSize >= DataNode->Size) &&
(Buffer != NULL)) { (Buffer != NULL))
{
CopyMem (Buffer, DataNode->Buffer, DataNode->Size); CopyMem (Buffer, DataNode->Buffer, DataNode->Size);
} }
@ -263,8 +272,8 @@ AmlGetDataNodeBuffer (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateRootNode ( AmlUpdateRootNode (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -275,7 +284,8 @@ AmlUpdateRootNode (
((SdtHeader->Signature != ((SdtHeader->Signature !=
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) && EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) &&
(SdtHeader->Signature != (SdtHeader->Signature !=
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))) { EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -287,7 +297,7 @@ AmlUpdateRootNode (
); );
// Update the Length field. // Update the Length field.
Status = AmlComputeSize ((AML_NODE_HEADER*)RootNode, &Length); Status = AmlComputeSize ((AML_NODE_HEADER *)RootNode, &Length);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -323,7 +333,7 @@ AmlUpdateRootNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateInteger ( AmlUpdateInteger (
IN AML_OBJECT_NODE * IntegerOpNode, IN AML_OBJECT_NODE *IntegerOpNode,
IN UINT64 NewInteger IN UINT64 NewInteger
) )
{ {
@ -334,7 +344,8 @@ AmlUpdateInteger (
if (!IS_AML_OBJECT_NODE (IntegerOpNode) || if (!IS_AML_OBJECT_NODE (IntegerOpNode) ||
(!IsIntegerNode (IntegerOpNode) && (!IsIntegerNode (IntegerOpNode) &&
!IsSpecialIntegerNode (IntegerOpNode)) || !IsSpecialIntegerNode (IntegerOpNode)) ||
AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0)) { AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -349,7 +360,7 @@ AmlUpdateInteger (
if (ValueWidthDiff != 0) { if (ValueWidthDiff != 0) {
// Propagate the information. // Propagate the information.
Status = AmlPropagateInformation ( Status = AmlPropagateInformation (
(AML_NODE_HEADER*)IntegerOpNode, (AML_NODE_HEADER *)IntegerOpNode,
(ValueWidthDiff > 0) ? TRUE : FALSE, (ValueWidthDiff > 0) ? TRUE : FALSE,
ABS (ValueWidthDiff), ABS (ValueWidthDiff),
0 0
@ -380,28 +391,29 @@ AmlUpdateInteger (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateDataNode ( AmlUpdateDataNode (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
IN EAML_NODE_DATA_TYPE DataType, IN EAML_NODE_DATA_TYPE DataType,
IN UINT8 * Buffer, IN UINT8 *Buffer,
IN UINT32 Size IN UINT32 Size
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 ExpectedSize; UINT32 ExpectedSize;
AML_OBJECT_NODE * ParentNode; AML_OBJECT_NODE *ParentNode;
EAML_NODE_DATA_TYPE ExpectedArgType; EAML_NODE_DATA_TYPE ExpectedArgType;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(DataType > EAmlNodeDataTypeMax) || (DataType > EAmlNodeDataTypeMax) ||
(Buffer == NULL) || (Buffer == NULL) ||
(Size == 0)) { (Size == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ParentNode = (AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)DataNode); ParentNode = (AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)DataNode);
if (!IS_AML_OBJECT_NODE (ParentNode)) { if (!IS_AML_OBJECT_NODE (ParentNode)) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -419,7 +431,8 @@ AmlUpdateDataNode (
(((ExpectedArgType != EAmlNodeDataTypeRaw) && (((ExpectedArgType != EAmlNodeDataTypeRaw) &&
(ExpectedArgType != EAmlNodeDataTypeResourceData)) || (ExpectedArgType != EAmlNodeDataTypeResourceData)) ||
((DataType != EAmlNodeDataTypeRaw) && ((DataType != EAmlNodeDataTypeRaw) &&
(DataType != EAmlNodeDataTypeResourceData)))) { (DataType != EAmlNodeDataTypeResourceData))))
{
ASSERT (0); ASSERT (0);
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -430,12 +443,14 @@ AmlUpdateDataNode (
{ {
// Check the name contained in the Buffer is an AML name // Check the name contained in the Buffer is an AML name
// with the right size. // with the right size.
Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &ExpectedSize); Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &ExpectedSize);
if (EFI_ERROR (Status) || if (EFI_ERROR (Status) ||
(Size != ExpectedSize)) { (Size != ExpectedSize))
{
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
break; break;
} }
case EAmlNodeDataTypeString: case EAmlNodeDataTypeString:
@ -450,6 +465,7 @@ AmlUpdateDataNode (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ExpectedSize++; ExpectedSize++;
} }
@ -457,13 +473,15 @@ AmlUpdateDataNode (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
break; break;
} }
case EAmlNodeDataTypeUInt: case EAmlNodeDataTypeUInt:
{ {
if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER*)DataNode, &Index)) { if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER *)DataNode, &Index)) {
if ((ParentNode->AmlByteEncoding == NULL) || if ((ParentNode->AmlByteEncoding == NULL) ||
(ParentNode->AmlByteEncoding->Format == NULL)) { (ParentNode->AmlByteEncoding->Format == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -472,11 +490,13 @@ AmlUpdateDataNode (
// E.g. for PackageOp the first fixed argument is of type EAmlUInt8 // E.g. for PackageOp the first fixed argument is of type EAmlUInt8
// and represents the count of elements. This type cannot be changed. // and represents the count of elements. This type cannot be changed.
if ((ParentNode->AmlByteEncoding->Format[Index] != EAmlObject) && if ((ParentNode->AmlByteEncoding->Format[Index] != EAmlObject) &&
(DataNode->Size != Size)) { (DataNode->Size != Size))
{
ASSERT (0); ASSERT (0);
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
} }
break; break;
} }
case EAmlNodeDataTypeRaw: case EAmlNodeDataTypeRaw:
@ -486,6 +506,7 @@ AmlUpdateDataNode (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
break; break;
} }
case EAmlNodeDataTypeResourceData: case EAmlNodeDataTypeResourceData:
@ -495,7 +516,8 @@ AmlUpdateDataNode (
// Large resource data must be at least as long as the header // Large resource data must be at least as long as the header
// of a large resource data. // of a large resource data.
if (AML_RD_IS_LARGE (Buffer) && if (AML_RD_IS_LARGE (Buffer) &&
(Size < sizeof (ACPI_LARGE_RESOURCE_HEADER))) { (Size < sizeof (ACPI_LARGE_RESOURCE_HEADER)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -529,6 +551,7 @@ AmlUpdateDataNode (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
break; break;
} }
// None and reserved types. // None and reserved types.
@ -564,6 +587,7 @@ AmlUpdateDataNode (
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
DataNode->Size = Size; DataNode->Size = Size;
} }

View File

@ -23,11 +23,12 @@
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetParent ( AmlGetParent (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
if (IS_AML_DATA_NODE (Node) || if (IS_AML_DATA_NODE (Node) ||
IS_AML_OBJECT_NODE (Node)) { IS_AML_OBJECT_NODE (Node))
{
return Node->Parent; return Node->Parent;
} }
@ -45,7 +46,7 @@ AmlGetParent (
AML_ROOT_NODE * AML_ROOT_NODE *
EFIAPI EFIAPI
AmlGetRootNode ( AmlGetRootNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
) )
{ {
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
@ -60,7 +61,8 @@ AmlGetRootNode (
return NULL; return NULL;
} }
} }
return (AML_ROOT_NODE*)Node;
return (AML_ROOT_NODE *)Node;
} }
/** Get the node at the input Index in the fixed argument list of the input /** Get the node at the input Index in the fixed argument list of the input
@ -77,7 +79,7 @@ AmlGetRootNode (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetFixedArgument ( AmlGetFixedArgument (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN EAML_PARSE_INDEX Index IN EAML_PARSE_INDEX Index
) )
{ {
@ -106,23 +108,24 @@ AmlGetFixedArgument (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNodeFixedArgument ( AmlIsNodeFixedArgument (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
OUT EAML_PARSE_INDEX * IndexPtr OUT EAML_PARSE_INDEX *IndexPtr
) )
{ {
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
if ((IndexPtr == NULL) || if ((IndexPtr == NULL) ||
(!IS_AML_DATA_NODE (Node) && (!IS_AML_DATA_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node))) { !IS_AML_OBJECT_NODE (Node)))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (IS_AML_ROOT_NODE (ParentNode)) { if (IS_AML_ROOT_NODE (ParentNode)) {
return FALSE; return FALSE;
} else if (IS_AML_DATA_NODE (ParentNode)) { } else if (IS_AML_DATA_NODE (ParentNode)) {
@ -133,10 +136,10 @@ AmlIsNodeFixedArgument (
// Check whether the Node is in the fixed argument list. // Check whether the Node is in the fixed argument list.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)ParentNode (AML_OBJECT_NODE *)ParentNode
); );
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) { for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
if (AmlGetFixedArgument ((AML_OBJECT_NODE*)ParentNode, Index) == Node) { if (AmlGetFixedArgument ((AML_OBJECT_NODE *)ParentNode, Index) == Node) {
*IndexPtr = Index; *IndexPtr = Index;
return TRUE; return TRUE;
} }
@ -163,21 +166,22 @@ AmlIsNodeFixedArgument (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSetFixedArgument ( AmlSetFixedArgument (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN EAML_PARSE_INDEX Index, IN EAML_PARSE_INDEX Index,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
if (IS_AML_OBJECT_NODE (ObjectNode) && if (IS_AML_OBJECT_NODE (ObjectNode) &&
(Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) && (Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) &&
((NewNode == NULL) || ((NewNode == NULL) ||
IS_AML_OBJECT_NODE (NewNode) || IS_AML_OBJECT_NODE (NewNode) ||
IS_AML_DATA_NODE (NewNode))) { IS_AML_DATA_NODE (NewNode)))
{
ObjectNode->FixedArgs[Index] = NewNode; ObjectNode->FixedArgs[Index] = NewNode;
// If NewNode is a data node or an object node, set its parent. // If NewNode is a data node or an object node, set its parent.
if (NewNode != NULL) { if (NewNode != NULL) {
NewNode->Parent = (AML_NODE_HEADER*)ObjectNode; NewNode->Parent = (AML_NODE_HEADER *)ObjectNode;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
@ -199,14 +203,15 @@ AmlSetFixedArgument (
LIST_ENTRY * LIST_ENTRY *
EFIAPI EFIAPI
AmlNodeGetVariableArgList ( AmlNodeGetVariableArgList (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
) )
{ {
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
return &(((AML_ROOT_NODE*)Node)->VariableArgs); return &(((AML_ROOT_NODE *)Node)->VariableArgs);
} else if (IS_AML_OBJECT_NODE (Node)) { } else if (IS_AML_OBJECT_NODE (Node)) {
return &(((AML_OBJECT_NODE*)Node)->VariableArgs); return &(((AML_OBJECT_NODE *)Node)->VariableArgs);
} }
return NULL; return NULL;
} }
@ -226,22 +231,24 @@ AmlNodeGetVariableArgList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlRemoveNodeFromVarArgList ( AmlRemoveNodeFromVarArgList (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
UINT32 Size; UINT32 Size;
if ((!IS_AML_DATA_NODE (Node) && if ((!IS_AML_DATA_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node))) { !IS_AML_OBJECT_NODE (Node)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ParentNode = AmlGetParent (Node); ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) && if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) { !IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -249,7 +256,9 @@ AmlRemoveNodeFromVarArgList (
// Check the node is in its parent variable list of arguments. // Check the node is in its parent variable list of arguments.
if (!IsNodeInList ( if (!IsNodeInList (
AmlNodeGetVariableArgList (ParentNode), AmlNodeGetVariableArgList (ParentNode),
&Node->Link)) { &Node->Link
))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -289,7 +298,7 @@ AmlRemoveNodeFromVarArgList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDetachNode ( AmlDetachNode (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
return AmlRemoveNodeFromVarArgList (Node); return AmlRemoveNodeFromVarArgList (Node);
@ -308,13 +317,13 @@ AmlDetachNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddHead ( AmlVarListAddHead (
IN AML_NODE_HEADER * ParentNode, IN AML_NODE_HEADER *ParentNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 NewSize; UINT32 NewSize;
LIST_ENTRY * ChildrenList; LIST_ENTRY *ChildrenList;
// Check arguments and that NewNode is not already attached to a tree. // Check arguments and that NewNode is not already attached to a tree.
// ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached. // ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@ -322,7 +331,8 @@ AmlVarListAddHead (
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) && (!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -367,11 +377,11 @@ AmlVarListAddHead (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddTailInternal ( AmlVarListAddTailInternal (
IN AML_NODE_HEADER * ParentNode, IN AML_NODE_HEADER *ParentNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
LIST_ENTRY * ChildrenList; LIST_ENTRY *ChildrenList;
// Check arguments and that NewNode is not already attached to a tree. // Check arguments and that NewNode is not already attached to a tree.
// ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached. // ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@ -379,7 +389,8 @@ AmlVarListAddTailInternal (
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) && (!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -410,8 +421,8 @@ AmlVarListAddTailInternal (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddTail ( AmlVarListAddTail (
IN AML_NODE_HEADER * ParentNode, IN AML_NODE_HEADER *ParentNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -451,25 +462,27 @@ AmlVarListAddTail (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddBefore ( AmlVarListAddBefore (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
UINT32 NewSize; UINT32 NewSize;
// Check arguments and that NewNode is not already attached to a tree. // Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) && if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ParentNode = AmlGetParent (Node); ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) && if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) { !IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -505,25 +518,27 @@ AmlVarListAddBefore (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddAfter ( AmlVarListAddAfter (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
UINT32 NewSize; UINT32 NewSize;
// Check arguments and that NewNode is not already attached to a tree. // Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) && if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ParentNode = AmlGetParent (Node); ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) && if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) { !IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -561,16 +576,17 @@ AmlVarListAddAfter (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAppendRdNode ( AmlAppendRdNode (
IN AML_OBJECT_NODE * BufferOpNode, IN AML_OBJECT_NODE *BufferOpNode,
IN AML_DATA_NODE * NewRdNode IN AML_DATA_NODE *NewRdNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * LastRdNode; AML_DATA_NODE *LastRdNode;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) || if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) ||
!IS_AML_DATA_NODE (NewRdNode) || !IS_AML_DATA_NODE (NewRdNode) ||
(NewRdNode->DataType != EAmlNodeDataTypeResourceData)) { (NewRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -590,21 +606,23 @@ AmlAppendRdNode (
// Get the last Resource data node in the variable list of argument of the // Get the last Resource data node in the variable list of argument of the
// BufferOp node. This must be an EndTag, otherwise setting the checksum // BufferOp node. This must be an EndTag, otherwise setting the checksum
// would have failed. // would have failed.
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument ( LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
(AML_NODE_HEADER*)BufferOpNode, (AML_NODE_HEADER *)BufferOpNode,
NULL NULL
); );
if ((LastRdNode == NULL) || if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) || !IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) { (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Add NewRdNode before the EndTag. // Add NewRdNode before the EndTag.
Status = AmlVarListAddBefore ( Status = AmlVarListAddBefore (
(AML_NODE_HEADER*)LastRdNode, (AML_NODE_HEADER *)LastRdNode,
(AML_NODE_HEADER*)NewRdNode) (AML_NODE_HEADER *)NewRdNode
)
; ;
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
return Status; return Status;
@ -628,14 +646,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlReplaceFixedArgument ( AmlReplaceFixedArgument (
IN AML_OBJECT_NODE * ParentNode, IN AML_OBJECT_NODE *ParentNode,
IN EAML_PARSE_INDEX Index, IN EAML_PARSE_INDEX Index,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * OldNode; AML_NODE_HEADER *OldNode;
UINT32 NewSize; UINT32 NewSize;
UINT32 OldSize; UINT32 OldSize;
AML_PARSE_FORMAT FixedArgType; AML_PARSE_FORMAT FixedArgType;
@ -644,7 +662,8 @@ AmlReplaceFixedArgument (
if (!IS_AML_OBJECT_NODE (ParentNode) || if (!IS_AML_OBJECT_NODE (ParentNode) ||
(!IS_AML_DATA_NODE (NewNode) && (!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -657,11 +676,14 @@ AmlReplaceFixedArgument (
// A FieldPkgLen can only have a parent node with the // A FieldPkgLen can only have a parent node with the
// AML_IS_FIELD_ELEMENT flag. // AML_IS_FIELD_ELEMENT flag.
if (!AmlNodeHasAttribute ( if (!AmlNodeHasAttribute (
(AML_OBJECT_NODE*)ParentNode, (AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) { AML_HAS_FIELD_LIST
))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Fall through. // Fall through.
} }
@ -676,11 +698,13 @@ AmlReplaceFixedArgument (
// data node of the same type. // data node of the same type.
// Note: This condition might be too strict, but safer. // Note: This condition might be too strict, but safer.
if (!IS_AML_DATA_NODE (NewNode) || if (!IS_AML_DATA_NODE (NewNode) ||
(((AML_DATA_NODE*)NewNode)->DataType != (((AML_DATA_NODE *)NewNode)->DataType !=
AmlTypeToNodeDataType (FixedArgType))) { AmlTypeToNodeDataType (FixedArgType)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
break; break;
} }
@ -733,7 +757,7 @@ AmlReplaceFixedArgument (
// Propagate the new information. // Propagate the new information.
Status = AmlPropagateInformation ( Status = AmlPropagateInformation (
(AML_NODE_HEADER*)ParentNode, (AML_NODE_HEADER *)ParentNode,
(NewSize > OldSize) ? TRUE : FALSE, (NewSize > OldSize) ? TRUE : FALSE,
(NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize), (NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize),
0 0
@ -760,8 +784,8 @@ AmlReplaceFixedArgument (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlReplaceVariableArgument ( AmlReplaceVariableArgument (
IN AML_NODE_HEADER * OldNode, IN AML_NODE_HEADER *OldNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -769,9 +793,9 @@ AmlReplaceVariableArgument (
UINT32 OldSize; UINT32 OldSize;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
AML_DATA_NODE * NewDataNode; AML_DATA_NODE *NewDataNode;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
LIST_ENTRY * NextLink; LIST_ENTRY *NextLink;
// Check arguments, that NewNode is not already attached to a tree, // Check arguments, that NewNode is not already attached to a tree,
// and that OldNode is attached and not in a fixed list of arguments. // and that OldNode is attached and not in a fixed list of arguments.
@ -781,19 +805,21 @@ AmlReplaceVariableArgument (
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode) || !AML_NODE_IS_DETACHED (NewNode) ||
AML_NODE_IS_DETACHED (OldNode) || AML_NODE_IS_DETACHED (OldNode) ||
AmlIsNodeFixedArgument (OldNode, &Index)) { AmlIsNodeFixedArgument (OldNode, &Index))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ParentNode = AmlGetParent (OldNode); ParentNode = AmlGetParent (OldNode);
if (!IS_AML_ROOT_NODE (ParentNode) && if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) { !IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
NewDataNode = (AML_DATA_NODE*)NewNode; NewDataNode = (AML_DATA_NODE *)NewNode;
// Check attributes if the parent node is an object node. // Check attributes if the parent node is an object node.
if (IS_AML_OBJECT_NODE (ParentNode)) { if (IS_AML_OBJECT_NODE (ParentNode)) {
@ -801,21 +827,26 @@ AmlReplaceVariableArgument (
// data node or an object node. This has already been checked. So, // data node or an object node. This has already been checked. So,
// check for other cases. // check for other cases.
if (AmlNodeHasAttribute ((AML_OBJECT_NODE*)ParentNode, AML_HAS_BYTE_LIST)) { if (AmlNodeHasAttribute ((AML_OBJECT_NODE *)ParentNode, AML_HAS_BYTE_LIST)) {
if (!IS_AML_DATA_NODE (NewNode) || if (!IS_AML_DATA_NODE (NewNode) ||
((NewDataNode->DataType != EAmlNodeDataTypeRaw) && ((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, // A child node of a node with the BYTE_LIST flag must be a data node,
// containing raw data or a resource data. // containing raw data or a resource data.
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
} else if (AmlNodeHasAttribute ( } else if (AmlNodeHasAttribute (
(AML_OBJECT_NODE*)ParentNode, (AML_OBJECT_NODE *)ParentNode,
AML_HAS_FIELD_LIST)) { AML_HAS_FIELD_LIST
))
{
if (!AmlNodeHasAttribute ( if (!AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)NewNode, (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 // A child node of a node with the FIELD_LIST flag must be an object
// node with AML_IS_FIELD_ELEMENT flag. // node with AML_IS_FIELD_ELEMENT flag.
ASSERT (0); ASSERT (0);
@ -882,12 +913,12 @@ AmlReplaceVariableArgument (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlReplaceArgument ( AmlReplaceArgument (
IN AML_NODE_HEADER * OldNode, IN AML_NODE_HEADER *OldNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
// Check arguments and that NewNode is not already attached to a tree. // Check arguments and that NewNode is not already attached to a tree.
@ -895,7 +926,8 @@ AmlReplaceArgument (
!IS_AML_OBJECT_NODE (OldNode)) || !IS_AML_OBJECT_NODE (OldNode)) ||
(!IS_AML_DATA_NODE (NewNode) && (!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) || !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode)) { !AML_NODE_IS_DETACHED (NewNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -903,7 +935,8 @@ AmlReplaceArgument (
// ParentNode can be a root node or an object node. // ParentNode can be a root node or an object node.
ParentNode = AmlGetParent (OldNode); ParentNode = AmlGetParent (OldNode);
if (!IS_AML_ROOT_NODE (ParentNode) && if (!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) { !IS_AML_OBJECT_NODE (ParentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -911,7 +944,7 @@ AmlReplaceArgument (
if (AmlIsNodeFixedArgument (OldNode, &Index)) { if (AmlIsNodeFixedArgument (OldNode, &Index)) {
// OldNode is in its parent's fixed argument list at the Index. // OldNode is in its parent's fixed argument list at the Index.
Status = AmlReplaceFixedArgument ( Status = AmlReplaceFixedArgument (
(AML_OBJECT_NODE*)ParentNode, (AML_OBJECT_NODE *)ParentNode,
Index, Index,
NewNode NewNode
); );
@ -942,7 +975,7 @@ AmlReplaceArgument (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteTree ( AmlDeleteTree (
IN AML_NODE_HEADER * Node IN AML_NODE_HEADER *Node
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -950,10 +983,10 @@ AmlDeleteTree (
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
AML_NODE_HEADER * Arg; AML_NODE_HEADER *Arg;
LIST_ENTRY * StartLink; LIST_ENTRY *StartLink;
LIST_ENTRY * CurrentLink; LIST_ENTRY *CurrentLink;
LIST_ENTRY * NextLink; LIST_ENTRY *NextLink;
// Check that the node being deleted is unlinked. // Check that the node being deleted is unlinked.
// When removing the node, its parent pointer and // When removing the node, its parent pointer and
@ -961,7 +994,8 @@ AmlDeleteTree (
// InitializeListHead. Thus it must be detached // InitializeListHead. Thus it must be detached
// from the tree to avoid memory leaks. // from the tree to avoid memory leaks.
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
!AML_NODE_IS_DETACHED (Node)) { !AML_NODE_IS_DETACHED (Node))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -970,10 +1004,10 @@ AmlDeleteTree (
// Iterate through the fixed list of arguments. // Iterate through the fixed list of arguments.
if (IS_AML_OBJECT_NODE (Node)) { if (IS_AML_OBJECT_NODE (Node)) {
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)Node (AML_OBJECT_NODE *)Node
); );
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) { for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
Arg = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index); Arg = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
if (Arg == NULL) { if (Arg == NULL) {
// A fixed argument is missing. The tree is inconsistent. // A fixed argument is missing. The tree is inconsistent.
// Note: During CodeGeneration, the fixed arguments should be set // Note: During CodeGeneration, the fixed arguments should be set
@ -986,7 +1020,7 @@ AmlDeleteTree (
// Remove the node from the fixed argument list. // Remove the node from the fixed argument list.
Arg->Parent = NULL; Arg->Parent = NULL;
Status = AmlSetFixedArgument ((AML_OBJECT_NODE*)Node, Index, NULL); Status = AmlSetFixedArgument ((AML_OBJECT_NODE *)Node, Index, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -1011,9 +1045,9 @@ AmlDeleteTree (
// Unlink the node from the tree. // Unlink the node from the tree.
NextLink = RemoveEntryList (CurrentLink); NextLink = RemoveEntryList (CurrentLink);
InitializeListHead (CurrentLink); InitializeListHead (CurrentLink);
((AML_NODE_HEADER*)CurrentLink)->Parent = NULL; ((AML_NODE_HEADER *)CurrentLink)->Parent = NULL;
Status = AmlDeleteTree ((AML_NODE_HEADER*)CurrentLink); Status = AmlDeleteTree ((AML_NODE_HEADER *)CurrentLink);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;

View File

@ -22,7 +22,7 @@
AML_ROOT_NODE * AML_ROOT_NODE *
EFIAPI EFIAPI
AmlGetRootNode ( AmlGetRootNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
); );
/** Check whether the input Node is in the fixed argument list of its parent /** Check whether the input Node is in the fixed argument list of its parent
@ -41,8 +41,8 @@ AmlGetRootNode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNodeFixedArgument ( AmlIsNodeFixedArgument (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
OUT EAML_PARSE_INDEX * IndexPtr OUT EAML_PARSE_INDEX *IndexPtr
); );
/** Set the fixed argument of the ObjectNode at the Index to the NewNode. /** Set the fixed argument of the ObjectNode at the Index to the NewNode.
@ -63,9 +63,9 @@ AmlIsNodeFixedArgument (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSetFixedArgument ( AmlSetFixedArgument (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN EAML_PARSE_INDEX Index, IN EAML_PARSE_INDEX Index,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
); );
/** If the given AML_NODE_HEADER has a variable list of arguments, /** If the given AML_NODE_HEADER has a variable list of arguments,
@ -80,7 +80,7 @@ AmlSetFixedArgument (
LIST_ENTRY * LIST_ENTRY *
EFIAPI EFIAPI
AmlNodeGetVariableArgList ( AmlNodeGetVariableArgList (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
); );
/** Add the NewNode to the tail of the variable list of arguments /** Add the NewNode to the tail of the variable list of arguments
@ -99,8 +99,8 @@ AmlNodeGetVariableArgList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddTailInternal ( AmlVarListAddTailInternal (
IN AML_NODE_HEADER * ParentNode, IN AML_NODE_HEADER *ParentNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
); );
/** Replace the OldNode by the NewNode. /** Replace the OldNode by the NewNode.
@ -119,9 +119,8 @@ AmlVarListAddTailInternal (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlReplaceArgument ( AmlReplaceArgument (
IN AML_NODE_HEADER * OldNode, IN AML_NODE_HEADER *OldNode,
IN AML_NODE_HEADER * NewNode IN AML_NODE_HEADER *NewNode
); );
#endif // AML_TREE_H_ #endif // AML_TREE_H_

View File

@ -33,10 +33,10 @@
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlEnumTree ( AmlEnumTree (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN EDKII_AML_TREE_ENUM_CALLBACK CallBack, IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
IN OUT VOID * Context OPTIONAL, IN OUT VOID *Context OPTIONAL,
OUT EFI_STATUS * Status OPTIONAL OUT EFI_STATUS *Status OPTIONAL
) )
{ {
BOOLEAN ContinueEnum; BOOLEAN ContinueEnum;
@ -44,14 +44,15 @@ AmlEnumTree (
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
LIST_ENTRY * StartLink; LIST_ENTRY *StartLink;
LIST_ENTRY * CurrentLink; LIST_ENTRY *CurrentLink;
if (!IS_AML_NODE_VALID (Node) || (CallBack == NULL)) { if (!IS_AML_NODE_VALID (Node) || (CallBack == NULL)) {
ASSERT (0); ASSERT (0);
if (Status != NULL) { if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER; *Status = EFI_INVALID_PARAMETER;
} }
return FALSE; return FALSE;
} }
@ -62,11 +63,11 @@ AmlEnumTree (
// Iterate through the fixed list of arguments. // Iterate through the fixed list of arguments.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)Node (AML_OBJECT_NODE *)Node
); );
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) { for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
ContinueEnum = AmlEnumTree ( ContinueEnum = AmlEnumTree (
AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index), AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index),
CallBack, CallBack,
Context, Context,
Status Status
@ -82,7 +83,7 @@ AmlEnumTree (
CurrentLink = StartLink->ForwardLink; CurrentLink = StartLink->ForwardLink;
while (CurrentLink != StartLink) { while (CurrentLink != StartLink) {
ContinueEnum = AmlEnumTree ( ContinueEnum = AmlEnumTree (
(AML_NODE_HEADER*)CurrentLink, (AML_NODE_HEADER *)CurrentLink,
CallBack, CallBack,
Context, Context,
Status Status
@ -90,6 +91,7 @@ AmlEnumTree (
if (ContinueEnum == FALSE) { if (ContinueEnum == FALSE) {
return ContinueEnum; return ContinueEnum;
} }
CurrentLink = CurrentLink->ForwardLink; CurrentLink = CurrentLink->ForwardLink;
} // while } // while
} }

View File

@ -25,10 +25,10 @@ typedef struct AmlTreeInternalIterator {
// of the Tree iterator APIs. // of the Tree iterator APIs.
/// Pointer to the node on which the iterator has been initialized. /// Pointer to the node on which the iterator has been initialized.
CONST AML_NODE_HEADER * InitialNode; CONST AML_NODE_HEADER *InitialNode;
/// Pointer to the current node. /// Pointer to the current node.
CONST AML_NODE_HEADER * CurrentNode; CONST AML_NODE_HEADER *CurrentNode;
/// Iteration mode. /// Iteration mode.
/// Allow to choose how to traverse the tree/choose which node is next. /// Allow to choose how to traverse the tree/choose which node is next.
@ -47,13 +47,13 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIteratorGetNode ( AmlIteratorGetNode (
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HEADER ** OutNode OUT AML_NODE_HEADER **OutNode
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot. // CurrentNode can be NULL, but InitialNode cannot.
if ((OutNode == NULL) || if ((OutNode == NULL) ||
@ -62,12 +62,13 @@ AmlIteratorGetNode (
(InternalIterator->Mode >= EAmlIteratorModeMax) || (InternalIterator->Mode >= EAmlIteratorModeMax) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
((InternalIterator->CurrentNode != NULL) && ((InternalIterator->CurrentNode != NULL) &&
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))) { !IS_AML_NODE_VALID (InternalIterator->CurrentNode)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*OutNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode; *OutNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -87,19 +88,20 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIteratorGetNextLinear ( AmlIteratorGetNextLinear (
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HEADER ** NextNode OUT AML_NODE_HEADER **NextNode
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot. // CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) || if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) || (InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -110,8 +112,9 @@ AmlIteratorGetNextLinear (
); );
if (NextNode != NULL) { if (NextNode != NULL) {
*NextNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode; *NextNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -130,19 +133,20 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIteratorGetPreviousLinear ( AmlIteratorGetPreviousLinear (
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HEADER ** PrevNode OUT AML_NODE_HEADER **PrevNode
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot. // CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) || if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) || (InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -152,8 +156,9 @@ AmlIteratorGetPreviousLinear (
InternalIterator->CurrentNode InternalIterator->CurrentNode
); );
if (PrevNode != NULL) { if (PrevNode != NULL) {
*PrevNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode; *PrevNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -172,20 +177,21 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIteratorGetNextBranch ( AmlIteratorGetNextBranch (
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HEADER ** NextNode OUT AML_NODE_HEADER **NextNode
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
AML_NODE_HEADER * Node; AML_NODE_HEADER *Node;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot. // CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) || if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) || (InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -193,7 +199,8 @@ AmlIteratorGetNextBranch (
Node = AmlGetNextNode (InternalIterator->CurrentNode); Node = AmlGetNextNode (InternalIterator->CurrentNode);
// Check whether NextNode is a sibling of InitialNode. // Check whether NextNode is a sibling of InitialNode.
if (AmlGetParent (Node) == if (AmlGetParent (Node) ==
AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) { AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
{
Node = NULL; Node = NULL;
} }
@ -202,6 +209,7 @@ AmlIteratorGetNextBranch (
if (NextNode != NULL) { if (NextNode != NULL) {
*NextNode = Node; *NextNode = Node;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -220,20 +228,21 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlIteratorGetPreviousBranch ( AmlIteratorGetPreviousBranch (
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HEADER ** PrevNode OUT AML_NODE_HEADER **PrevNode
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
AML_NODE_HEADER * Node; AML_NODE_HEADER *Node;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot. // CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) || if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) || (InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -241,7 +250,8 @@ AmlIteratorGetPreviousBranch (
Node = AmlGetPreviousNode (InternalIterator->CurrentNode); Node = AmlGetPreviousNode (InternalIterator->CurrentNode);
// Check whether PreviousNode is a sibling of InitialNode. // Check whether PreviousNode is a sibling of InitialNode.
if (AmlGetParent (Node) == if (AmlGetParent (Node) ==
AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) { AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
{
Node = NULL; Node = NULL;
} }
@ -250,6 +260,7 @@ AmlIteratorGetPreviousBranch (
if (PrevNode != NULL) { if (PrevNode != NULL) {
*PrevNode = Node; *PrevNode = Node;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -269,23 +280,24 @@ AmlIteratorGetPreviousBranch (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlInitializeIterator ( AmlInitializeIterator (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN EAML_ITERATOR_MODE IteratorMode, IN EAML_ITERATOR_MODE IteratorMode,
OUT AML_TREE_ITERATOR ** IteratorPtr OUT AML_TREE_ITERATOR **IteratorPtr
) )
{ {
AML_TREE_ITERATOR_INTERNAL * InternalIterator; AML_TREE_ITERATOR_INTERNAL *InternalIterator;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(IteratorMode <= EAmlIteratorUnknown) || (IteratorMode <= EAmlIteratorUnknown) ||
(IteratorMode >= EAmlIteratorModeMax) || (IteratorMode >= EAmlIteratorModeMax) ||
(IteratorPtr == NULL)) { (IteratorPtr == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*IteratorPtr = NULL; *IteratorPtr = NULL;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)AllocateZeroPool ( InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)AllocateZeroPool (
sizeof ( sizeof (
AML_TREE_ITERATOR_INTERNAL AML_TREE_ITERATOR_INTERNAL
) )
@ -339,7 +351,7 @@ AmlInitializeIterator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteIterator ( AmlDeleteIterator (
IN AML_TREE_ITERATOR * Iterator IN AML_TREE_ITERATOR *Iterator
) )
{ {
if (Iterator == NULL) { if (Iterator == NULL) {

View File

@ -115,9 +115,9 @@ typedef struct AmlTreeIterator AML_TREE_ITERATOR;
*/ */
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NODE) ( (EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NODE)(
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HANDLE * OutNode OUT AML_NODE_HANDLE *OutNode
); );
/** Function pointer to move the current node of the iterator to the /** Function pointer to move the current node of the iterator to the
@ -135,9 +135,9 @@ EFI_STATUS
*/ */
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NEXT) ( (EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NEXT)(
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HANDLE * NextNode OUT AML_NODE_HANDLE *NextNode
); );
/** Function pointer to move the current node of the iterator to the /** Function pointer to move the current node of the iterator to the
@ -155,9 +155,9 @@ EFI_STATUS
*/ */
typedef typedef
EFI_STATUS EFI_STATUS
(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_PREVIOUS) ( (EFIAPI *EDKII_AML_TREE_ITERATOR_GET_PREVIOUS)(
IN AML_TREE_ITERATOR * Iterator, IN AML_TREE_ITERATOR *Iterator,
OUT AML_NODE_HANDLE * PrevNode OUT AML_NODE_HANDLE *PrevNode
); );
/** Iterator structure to traverse the tree. /** Iterator structure to traverse the tree.
@ -175,7 +175,6 @@ typedef struct AmlTreeIterator {
EDKII_AML_TREE_ITERATOR_GET_PREVIOUS GetPrevious; EDKII_AML_TREE_ITERATOR_GET_PREVIOUS GetPrevious;
} AML_TREE_ITERATOR; } AML_TREE_ITERATOR;
/** Initialize an iterator. /** Initialize an iterator.
Note: The caller must call AmlDeleteIterator () to free the memory Note: The caller must call AmlDeleteIterator () to free the memory
@ -196,7 +195,7 @@ EFIAPI
AmlInitializeIterator ( AmlInitializeIterator (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN EAML_ITERATOR_MODE IteratorMode, IN EAML_ITERATOR_MODE IteratorMode,
OUT AML_TREE_ITERATOR ** IteratorPtr OUT AML_TREE_ITERATOR **IteratorPtr
); );
/** Delete an iterator. /** Delete an iterator.
@ -214,7 +213,7 @@ AmlInitializeIterator (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteIterator ( AmlDeleteIterator (
IN AML_TREE_ITERATOR * Iterator IN AML_TREE_ITERATOR *Iterator
); );
#endif // AML_ITERATOR_H_ #endif // AML_ITERATOR_H_

View File

@ -37,17 +37,18 @@
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetSiblingVariableArgument ( AmlGetSiblingVariableArgument (
IN AML_NODE_HEADER * VarArgNode IN AML_NODE_HEADER *VarArgNode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
// VarArgNode must be an object node or a data node, // VarArgNode must be an object node or a data node,
// and be in a variable list of arguments. // and be in a variable list of arguments.
if ((!IS_AML_OBJECT_NODE (VarArgNode) && if ((!IS_AML_OBJECT_NODE (VarArgNode) &&
!IS_AML_DATA_NODE (VarArgNode)) || !IS_AML_DATA_NODE (VarArgNode)) ||
AmlIsNodeFixedArgument (VarArgNode, &Index)) { AmlIsNodeFixedArgument (VarArgNode, &Index))
{
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
@ -85,12 +86,12 @@ AmlGetSiblingVariableArgument (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetNextVariableArgument ( AmlGetNextVariableArgument (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_NODE_HEADER * CurrVarArg IN AML_NODE_HEADER *CurrVarArg
) )
{ {
CONST LIST_ENTRY * StartLink; CONST LIST_ENTRY *StartLink;
CONST LIST_ENTRY * NextLink; CONST LIST_ENTRY *NextLink;
// Node must be a RootNode or an Object Node // Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node. // and the CurrVarArg must not be a Root Node.
@ -98,7 +99,8 @@ AmlGetNextVariableArgument (
!IS_AML_OBJECT_NODE (Node)) || !IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) && ((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) && (!IS_AML_OBJECT_NODE (CurrVarArg) &&
!IS_AML_DATA_NODE (CurrVarArg)))) { !IS_AML_DATA_NODE (CurrVarArg))))
{
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
@ -112,8 +114,9 @@ AmlGetNextVariableArgument (
if (CurrVarArg == NULL) { if (CurrVarArg == NULL) {
NextLink = StartLink->ForwardLink; NextLink = StartLink->ForwardLink;
if (NextLink != StartLink) { if (NextLink != StartLink) {
return (AML_NODE_HEADER*)NextLink; return (AML_NODE_HEADER *)NextLink;
} }
// List is empty. // List is empty.
return NULL; return NULL;
} }
@ -127,7 +130,7 @@ AmlGetNextVariableArgument (
// Get the node following the CurrVarArg. // Get the node following the CurrVarArg.
NextLink = CurrVarArg->Link.ForwardLink; NextLink = CurrVarArg->Link.ForwardLink;
if (NextLink != StartLink) { if (NextLink != StartLink) {
return (AML_NODE_HEADER*)NextLink; return (AML_NODE_HEADER *)NextLink;
} }
// End of the list has been reached. // End of the list has been reached.
@ -159,12 +162,12 @@ AmlGetNextVariableArgument (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetPreviousVariableArgument ( AmlGetPreviousVariableArgument (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN AML_NODE_HEADER * CurrVarArg IN AML_NODE_HEADER *CurrVarArg
) )
{ {
CONST LIST_ENTRY * StartLink; CONST LIST_ENTRY *StartLink;
CONST LIST_ENTRY * PreviousLink; CONST LIST_ENTRY *PreviousLink;
// Node must be a RootNode or an Object Node // Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node. // and the CurrVarArg must not be a Root Node.
@ -172,7 +175,8 @@ AmlGetPreviousVariableArgument (
!IS_AML_OBJECT_NODE (Node)) || !IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) && ((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) && (!IS_AML_OBJECT_NODE (CurrVarArg) &&
!IS_AML_DATA_NODE (CurrVarArg)))) { !IS_AML_DATA_NODE (CurrVarArg))))
{
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
@ -186,8 +190,9 @@ AmlGetPreviousVariableArgument (
if (CurrVarArg == NULL) { if (CurrVarArg == NULL) {
PreviousLink = StartLink->BackLink; PreviousLink = StartLink->BackLink;
if (PreviousLink != StartLink) { if (PreviousLink != StartLink) {
return (AML_NODE_HEADER*)PreviousLink; return (AML_NODE_HEADER *)PreviousLink;
} }
// List is empty. // List is empty.
return NULL; return NULL;
} }
@ -201,7 +206,7 @@ AmlGetPreviousVariableArgument (
// Get the node before the CurrVarArg. // Get the node before the CurrVarArg.
PreviousLink = CurrVarArg->Link.BackLink; PreviousLink = CurrVarArg->Link.BackLink;
if (PreviousLink != StartLink) { if (PreviousLink != StartLink) {
return (AML_NODE_HEADER*)PreviousLink; return (AML_NODE_HEADER *)PreviousLink;
} }
// We have reached the beginning of the list. // We have reached the beginning of the list.
@ -240,12 +245,12 @@ AmlGetPreviousVariableArgument (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetNextSibling ( AmlGetNextSibling (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN CONST AML_NODE_HEADER * ChildNode IN CONST AML_NODE_HEADER *ChildNode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
AML_NODE_HEADER * CandidateNode; AML_NODE_HEADER *CandidateNode;
// Node must be a RootNode or an Object Node // Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node. // and the CurrVarArg must not be a Root Node.
@ -253,7 +258,8 @@ AmlGetNextSibling (
!IS_AML_OBJECT_NODE (Node)) || !IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) && ((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) && (!IS_AML_OBJECT_NODE (ChildNode) &&
!IS_AML_DATA_NODE (ChildNode)))) { !IS_AML_DATA_NODE (ChildNode))))
{
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
@ -262,7 +268,7 @@ AmlGetNextSibling (
if (ChildNode == NULL) { if (ChildNode == NULL) {
// Get the fixed argument at index 0 of the ChildNode. // Get the fixed argument at index 0 of the ChildNode.
CandidateNode = AmlGetFixedArgument ( CandidateNode = AmlGetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
EAmlParseIndexTerm0 EAmlParseIndexTerm0
); );
if (CandidateNode != NULL) { if (CandidateNode != NULL) {
@ -275,14 +281,16 @@ AmlGetNextSibling (
Index++; Index++;
// The node is part of the list of fixed arguments. // The node is part of the list of fixed arguments.
if (Index == (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( 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. // It is at the last argument of the fixed argument list.
// Get the first argument of the variable list of arguments. // Get the first argument of the variable list of arguments.
ChildNode = NULL; ChildNode = NULL;
} else { } else {
// Else return the next node in the list of fixed arguments. // Else return the next node in the list of fixed arguments.
return AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index); return AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
} }
} }
} }
@ -290,8 +298,8 @@ AmlGetNextSibling (
// Else, get the next node in the variable list of arguments. // Else, get the next node in the variable list of arguments.
return AmlGetNextVariableArgument ( return AmlGetNextVariableArgument (
(AML_NODE_HEADER*)Node, (AML_NODE_HEADER *)Node,
(AML_NODE_HEADER*)ChildNode (AML_NODE_HEADER *)ChildNode
); );
} }
@ -325,14 +333,14 @@ AmlGetNextSibling (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetPreviousSibling ( AmlGetPreviousSibling (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN CONST AML_NODE_HEADER * ChildNode IN CONST AML_NODE_HEADER *ChildNode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
AML_NODE_HEADER * CandidateNode; AML_NODE_HEADER *CandidateNode;
// Node must be a Root Node or an Object Node // Node must be a Root Node or an Object Node
// and the ChildNode must not be a Root Node. // and the ChildNode must not be a Root Node.
@ -340,20 +348,22 @@ AmlGetPreviousSibling (
!IS_AML_OBJECT_NODE (Node)) || !IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) && ((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) && (!IS_AML_OBJECT_NODE (ChildNode) &&
!IS_AML_DATA_NODE (ChildNode)))) { !IS_AML_DATA_NODE (ChildNode))))
{
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount ( MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
(AML_OBJECT_NODE*)Node (AML_OBJECT_NODE *)Node
); );
// Get the last variable argument if no ChildNode. // Get the last variable argument if no ChildNode.
// Otherwise the fixed argument list is checked first. // Otherwise the fixed argument list is checked first.
if ((ChildNode != NULL) && if ((ChildNode != NULL) &&
IS_AML_OBJECT_NODE (Node) && IS_AML_OBJECT_NODE (Node) &&
(MaxIndex != EAmlParseIndexTerm0)) { (MaxIndex != EAmlParseIndexTerm0))
{
if (AmlIsNodeFixedArgument (ChildNode, &Index)) { if (AmlIsNodeFixedArgument (ChildNode, &Index)) {
// The node is part of the list of fixed arguments. // The node is part of the list of fixed arguments.
if (Index == EAmlParseIndexTerm0) { if (Index == EAmlParseIndexTerm0) {
@ -362,7 +372,7 @@ AmlGetPreviousSibling (
} else { } else {
// Return the previous node in the fixed argument list. // Return the previous node in the fixed argument list.
return AmlGetFixedArgument ( return AmlGetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
(EAML_PARSE_INDEX)(Index - 1) (EAML_PARSE_INDEX)(Index - 1)
); );
} }
@ -371,20 +381,21 @@ AmlGetPreviousSibling (
// ChildNode is in the variable list of arguments. // ChildNode is in the variable list of arguments.
CandidateNode = AmlGetPreviousVariableArgument ( CandidateNode = AmlGetPreviousVariableArgument (
(AML_NODE_HEADER*)Node, (AML_NODE_HEADER *)Node,
(AML_NODE_HEADER*)ChildNode (AML_NODE_HEADER *)ChildNode
); );
if (CandidateNode != NULL) { if (CandidateNode != NULL) {
if (!IS_AML_NODE_VALID (CandidateNode)) { if (!IS_AML_NODE_VALID (CandidateNode)) {
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
// A Node has been found // A Node has been found
return CandidateNode; return CandidateNode;
} else if (MaxIndex != EAmlParseIndexTerm0) { } else if (MaxIndex != EAmlParseIndexTerm0) {
// ChildNode was the first node of the variable list of arguments. // ChildNode was the first node of the variable list of arguments.
return AmlGetFixedArgument ( return AmlGetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
(EAML_PARSE_INDEX)(MaxIndex - 1) (EAML_PARSE_INDEX)(MaxIndex - 1)
); );
} else { } else {
@ -416,11 +427,11 @@ AmlGetPreviousSibling (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetNextNode ( AmlGetNextNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
) )
{ {
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
AML_NODE_HEADER * CandidateNode; AML_NODE_HEADER *CandidateNode;
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0); ASSERT (0);
@ -435,6 +446,7 @@ AmlGetNextNode (
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
// A Node has been found // A Node has been found
return CandidateNode; return CandidateNode;
} else if (IS_AML_ROOT_NODE (Node)) { } else if (IS_AML_ROOT_NODE (Node)) {
@ -452,7 +464,7 @@ AmlGetNextNode (
return NULL; return NULL;
} }
ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (ParentNode)) { if (!IS_AML_NODE_VALID (ParentNode)) {
ASSERT (0); ASSERT (0);
return NULL; return NULL;
@ -464,6 +476,7 @@ AmlGetNextNode (
ASSERT (0); ASSERT (0);
return NULL; return NULL;
} }
// A Node has been found // A Node has been found
return CandidateNode; return CandidateNode;
} }
@ -498,12 +511,12 @@ AmlGetNextNode (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetPreviousNode ( AmlGetPreviousNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
) )
{ {
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
AML_NODE_HEADER * CandidateNode; AML_NODE_HEADER *CandidateNode;
AML_NODE_HEADER * PreviousNode; AML_NODE_HEADER *PreviousNode;
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0); ASSERT (0);
@ -511,13 +524,12 @@ AmlGetPreviousNode (
} }
while (1) { while (1) {
if (IS_AML_ROOT_NODE (Node)) { if (IS_AML_ROOT_NODE (Node)) {
// This is the root node. // This is the root node.
return NULL; return NULL;
} }
ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
CandidateNode = AmlGetPreviousSibling (ParentNode, Node); CandidateNode = AmlGetPreviousSibling (ParentNode, Node);
if (CandidateNode == NULL) { if (CandidateNode == NULL) {
@ -539,7 +551,6 @@ AmlGetPreviousNode (
return CandidateNode; return CandidateNode;
} }
} // while } // while
} else { } else {
ASSERT (0); ASSERT (0);
return NULL; return NULL;

View File

@ -43,8 +43,8 @@
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetNextSibling ( AmlGetNextSibling (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN CONST AML_NODE_HEADER * ChildNode IN CONST AML_NODE_HEADER *ChildNode
); );
/** Get the previous sibling node among the children of the input Node. /** Get the previous sibling node among the children of the input Node.
@ -77,8 +77,8 @@ AmlGetNextSibling (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetPreviousSibling ( AmlGetPreviousSibling (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN CONST AML_NODE_HEADER * ChildNode IN CONST AML_NODE_HEADER *ChildNode
); );
/** Iterate through the nodes in the same order as the AML bytestream. /** Iterate through the nodes in the same order as the AML bytestream.
@ -104,7 +104,7 @@ AmlGetPreviousSibling (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetNextNode ( AmlGetNextNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
); );
/** Iterate through the nodes in the reverse order of the AML bytestream. /** Iterate through the nodes in the reverse order of the AML bytestream.
@ -131,8 +131,7 @@ AmlGetNextNode (
AML_NODE_HEADER * AML_NODE_HEADER *
EFIAPI EFIAPI
AmlGetPreviousNode ( AmlGetPreviousNode (
IN CONST AML_NODE_HEADER * Node IN CONST AML_NODE_HEADER *Node
); );
#endif // AML_TREE_TRAVERSAL_H_ #endif // AML_TREE_TRAVERSAL_H_

View File

@ -22,10 +22,10 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AcpiPlatformChecksum ( AcpiPlatformChecksum (
IN EFI_ACPI_DESCRIPTION_HEADER * AcpiTable IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable
) )
{ {
UINT8 * Ptr; UINT8 *Ptr;
UINT8 Sum; UINT8 Sum;
UINT32 Size; UINT32 Size;
@ -34,7 +34,7 @@ AcpiPlatformChecksum (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Ptr = (UINT8*)AcpiTable; Ptr = (UINT8 *)AcpiTable;
Size = AcpiTable->Length; Size = AcpiTable->Length;
Sum = 0; Sum = 0;
@ -76,70 +76,78 @@ STATIC
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlComputeSizeCallback ( AmlComputeSizeCallback (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN OUT VOID * Context, IN OUT VOID *Context,
IN OUT EFI_STATUS * Status OPTIONAL IN OUT EFI_STATUS *Status OPTIONAL
) )
{ {
UINT32 Size; UINT32 Size;
EAML_PARSE_INDEX IndexPtr; EAML_PARSE_INDEX IndexPtr;
CONST AML_OBJECT_NODE * ParentNode; CONST AML_OBJECT_NODE *ParentNode;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(Context == NULL)) { (Context == NULL))
{
ASSERT (0); ASSERT (0);
if (Status != NULL) { if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER; *Status = EFI_INVALID_PARAMETER;
} }
return FALSE; return FALSE;
} }
// Ignore the second fixed argument of method invocation nodes // Ignore the second fixed argument of method invocation nodes
// as the information stored there (the argument count) is not in the // as the information stored there (the argument count) is not in the
// ACPI specification. // ACPI specification.
ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent (Node); ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent (Node);
if (IS_AML_OBJECT_NODE (ParentNode) && if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) && AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
AmlIsNodeFixedArgument (Node, &IndexPtr)) { AmlIsNodeFixedArgument (Node, &IndexPtr))
{
if (IndexPtr == EAmlParseIndexTerm1) { if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) { if (Status != NULL) {
*Status = EFI_SUCCESS; *Status = EFI_SUCCESS;
} }
return TRUE; return TRUE;
} }
} }
Size = *((UINT32*)Context); Size = *((UINT32 *)Context);
if (IS_AML_DATA_NODE (Node)) { if (IS_AML_DATA_NODE (Node)) {
Size += ((AML_DATA_NODE*)Node)->Size; Size += ((AML_DATA_NODE *)Node)->Size;
} else if (IS_AML_OBJECT_NODE (Node) && } else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute ( !AmlNodeHasAttribute (
(CONST AML_OBJECT_NODE*)Node, (CONST AML_OBJECT_NODE *)Node,
AML_IS_PSEUDO_OPCODE)) { AML_IS_PSEUDO_OPCODE
))
{
// Ignore pseudo-opcodes as they are not part of the // Ignore pseudo-opcodes as they are not part of the
// ACPI specification. // ACPI specification.
Size += (((AML_OBJECT_NODE*)Node)->AmlByteEncoding->OpCode == Size += (((AML_OBJECT_NODE *)Node)->AmlByteEncoding->OpCode ==
AML_EXT_OP) ? 2 : 1; AML_EXT_OP) ? 2 : 1;
// Add the size of the PkgLen. // Add the size of the PkgLen.
if (AmlNodeHasAttribute ( if (AmlNodeHasAttribute (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
AML_HAS_PKG_LENGTH)) { AML_HAS_PKG_LENGTH
Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE*)Node)->PkgLen); ))
{
Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE *)Node)->PkgLen);
} }
} }
// Check for overflow. // Check for overflow.
// The root node has a null size, thus the strict comparison. // The root node has a null size, thus the strict comparison.
if (*((UINT32*)Context) > Size) { if (*((UINT32 *)Context) > Size) {
ASSERT (0); ASSERT (0);
*Status = EFI_INVALID_PARAMETER; *Status = EFI_INVALID_PARAMETER;
return FALSE; return FALSE;
} }
*((UINT32*)Context) = Size; *((UINT32 *)Context) = Size;
if (Status != NULL) { if (Status != NULL) {
*Status = EFI_SUCCESS; *Status = EFI_SUCCESS;
@ -159,14 +167,15 @@ AmlComputeSizeCallback (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlComputeSize ( AmlComputeSize (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN OUT UINT32 * Size IN OUT UINT32 *Size
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
if (!IS_AML_NODE_VALID (Node) || if (!IS_AML_NODE_VALID (Node) ||
(Size == NULL)) { (Size == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -174,9 +183,9 @@ AmlComputeSize (
*Size = 0; *Size = 0;
AmlEnumTree ( AmlEnumTree (
(AML_NODE_HEADER*)Node, (AML_NODE_HEADER *)Node,
AmlComputeSizeCallback, AmlComputeSizeCallback,
(VOID*)Size, (VOID *)Size,
&Status &Status
); );
@ -195,15 +204,16 @@ AmlComputeSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlNodeGetIntegerValue ( AmlNodeGetIntegerValue (
IN AML_OBJECT_NODE * Node, IN AML_OBJECT_NODE *Node,
OUT UINT64 * Value OUT UINT64 *Value
) )
{ {
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
if ((!IsIntegerNode (Node) && if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) || !IsSpecialIntegerNode (Node)) ||
(Value == NULL)) { (Value == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -219,13 +229,15 @@ AmlNodeGetIntegerValue (
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
} }
// For integer nodes, the value is in the first fixed argument. // For integer nodes, the value is in the first fixed argument.
DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0]; DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeUInt)) { (DataNode->DataType != EAmlNodeDataTypeUInt))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -233,22 +245,22 @@ AmlNodeGetIntegerValue (
switch (DataNode->Size) { switch (DataNode->Size) {
case 1: case 1:
{ {
*Value = *((UINT8*)(DataNode->Buffer)); *Value = *((UINT8 *)(DataNode->Buffer));
break; break;
} }
case 2: case 2:
{ {
*Value = *((UINT16*)(DataNode->Buffer)); *Value = *((UINT16 *)(DataNode->Buffer));
break; break;
} }
case 4: case 4:
{ {
*Value = *((UINT32*)(DataNode->Buffer)); *Value = *((UINT32 *)(DataNode->Buffer));
break; break;
} }
case 8: case 8:
{ {
*Value = *((UINT64*)(DataNode->Buffer)); *Value = *((UINT64 *)(DataNode->Buffer));
break; break;
} }
default: default:
@ -274,14 +286,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUnwindSpecialInteger ( AmlUnwindSpecialInteger (
IN AML_OBJECT_NODE * Node IN AML_OBJECT_NODE *Node
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * NewDataNode; AML_DATA_NODE *NewDataNode;
UINT8 Value; UINT8 Value;
CONST AML_BYTE_ENCODING * ByteEncoding; CONST AML_BYTE_ENCODING *ByteEncoding;
if (!IsSpecialIntegerNode (Node)) { if (!IsSpecialIntegerNode (Node)) {
ASSERT (0); ASSERT (0);
@ -303,7 +315,7 @@ AmlUnwindSpecialInteger (
EAmlNodeDataTypeUInt, EAmlNodeDataTypeUInt,
&Value, &Value,
sizeof (UINT8), sizeof (UINT8),
(AML_DATA_NODE**)&NewDataNode (AML_DATA_NODE **)&NewDataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -323,9 +335,9 @@ AmlUnwindSpecialInteger (
// Add the data node as the first fixed argument of the ByteOp object. // Add the data node as the first fixed argument of the ByteOp object.
Status = AmlSetFixedArgument ( Status = AmlSetFixedArgument (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
EAmlParseIndexTerm0, EAmlParseIndexTerm0,
(AML_NODE_HEADER*)NewDataNode (AML_NODE_HEADER *)NewDataNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -335,7 +347,7 @@ AmlUnwindSpecialInteger (
return Status; return Status;
error_handler: error_handler:
AmlDeleteTree ((AML_NODE_HEADER*)NewDataNode); AmlDeleteTree ((AML_NODE_HEADER *)NewDataNode);
return Status; return Status;
} }
@ -360,20 +372,21 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlNodeSetIntegerValue ( AmlNodeSetIntegerValue (
IN AML_OBJECT_NODE * Node, IN AML_OBJECT_NODE *Node,
IN UINT64 NewValue, IN UINT64 NewValue,
OUT INT8 * ValueWidthDiff OUT INT8 *ValueWidthDiff
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * DataNode; AML_DATA_NODE *DataNode;
UINT8 NewOpCode; UINT8 NewOpCode;
UINT8 NumberOfBytes; UINT8 NumberOfBytes;
if ((!IsIntegerNode (Node) && if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) || !IsSpecialIntegerNode (Node)) ||
(ValueWidthDiff == NULL)) { (ValueWidthDiff == NULL))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -396,6 +409,7 @@ AmlNodeSetIntegerValue (
ASSERT (0); ASSERT (0);
return Status; return Status;
} }
// The AmlUnwindSpecialInteger functions converts a special integer // The AmlUnwindSpecialInteger functions converts a special integer
// node to a UInt8/Byte data node. Thus, the size increments by one: // 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 // special integer are encoded as one byte (the opcode only) while byte
@ -406,9 +420,10 @@ AmlNodeSetIntegerValue (
} // IsSpecialIntegerNode (Node) } // IsSpecialIntegerNode (Node)
// For integer nodes, the value is in the first fixed argument. // For integer nodes, the value is in the first fixed argument.
DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0]; DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) || if (!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeUInt)) { (DataNode->DataType != EAmlNodeDataTypeUInt))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -427,7 +442,7 @@ AmlNodeSetIntegerValue (
// Detach and free the DataNode containing the integer value. // Detach and free the DataNode containing the integer value.
DataNode->NodeHeader.Parent = NULL; DataNode->NodeHeader.Parent = NULL;
Node->FixedArgs[EAmlParseIndexTerm0] = NULL; Node->FixedArgs[EAmlParseIndexTerm0] = NULL;
Status = AmlDeleteNode ((AML_NODE_HEADER*)DataNode); Status = AmlDeleteNode ((AML_NODE_HEADER *)DataNode);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -473,6 +488,7 @@ AmlNodeSetIntegerValue (
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
DataNode->Size = NumberOfBytes; DataNode->Size = NumberOfBytes;
} }
@ -504,10 +520,10 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlNodeUpdateIntegerValue ( AmlNodeUpdateIntegerValue (
IN AML_OBJECT_NODE * IntegerNode, IN AML_OBJECT_NODE *IntegerNode,
IN BOOLEAN IsIncrement, IN BOOLEAN IsIncrement,
IN UINT64 Diff, IN UINT64 Diff,
OUT INT8 * ValueWidthDiff OUT INT8 *ValueWidthDiff
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -528,7 +544,8 @@ AmlNodeUpdateIntegerValue (
// Check for UINT64 over/underflow. // Check for UINT64 over/underflow.
if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) || if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) ||
(!IsIncrement && (Value < Diff))) { (!IsIncrement && (Value < Diff)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -570,14 +587,14 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPropagateSize ( AmlPropagateSize (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN BOOLEAN IsIncrement, IN BOOLEAN IsIncrement,
IN UINT32 * Diff IN UINT32 *Diff
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE * ObjectNode; AML_OBJECT_NODE *ObjectNode;
AML_NODE_HEADER * ParentNode; AML_NODE_HEADER *ParentNode;
UINT32 Value; UINT32 Value;
UINT32 InitialPkgLenWidth; UINT32 InitialPkgLenWidth;
@ -586,13 +603,14 @@ AmlPropagateSize (
INT8 FieldWidthChange; INT8 FieldWidthChange;
if (!IS_AML_OBJECT_NODE (Node) && if (!IS_AML_OBJECT_NODE (Node) &&
!IS_AML_ROOT_NODE (Node)) { !IS_AML_ROOT_NODE (Node))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (IS_AML_OBJECT_NODE (Node)) { if (IS_AML_OBJECT_NODE (Node)) {
ObjectNode = (AML_OBJECT_NODE*)Node; ObjectNode = (AML_OBJECT_NODE *)Node;
// For BufferOp, the buffer size is stored in BufferSize. Therefore, // For BufferOp, the buffer size is stored in BufferSize. Therefore,
// BufferOp needs special handling to update the BufferSize. // BufferOp needs special handling to update the BufferSize.
@ -606,7 +624,7 @@ AmlPropagateSize (
// (can be a BYTE, WORD, DWORD or QWORD). // (can be a BYTE, WORD, DWORD or QWORD).
// BufferSize is an object node. // BufferSize is an object node.
Status = AmlNodeUpdateIntegerValue ( Status = AmlNodeUpdateIntegerValue (
(AML_OBJECT_NODE*)AmlGetFixedArgument ( (AML_OBJECT_NODE *)AmlGetFixedArgument (
ObjectNode, ObjectNode,
EAmlParseIndexTerm0 EAmlParseIndexTerm0
), ),
@ -624,7 +642,8 @@ AmlPropagateSize (
if ((IsIncrement && if ((IsIncrement &&
(FieldWidthChange < 0)) || (FieldWidthChange < 0)) ||
(!IsIncrement && (!IsIncrement &&
(FieldWidthChange > 0))) { (FieldWidthChange > 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -653,7 +672,8 @@ AmlPropagateSize (
// PkgLen is a 28 bit value, cf 20.2.4 Package Length Encoding // 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). // i.e. the maximum value is (2^28 - 1) = ((BIT0 << 28) - 1).
if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff)) || if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff)) ||
(!IsIncrement && (Value < *Diff))) { (!IsIncrement && (Value < *Diff)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -682,7 +702,8 @@ AmlPropagateSize (
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Value); ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Value);
if (ReComputedPkgLenWidth != NewPkgLenWidth) { if (ReComputedPkgLenWidth != NewPkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) && if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4)) { (ReComputedPkgLenWidth < 4))
{
// No need to recompute the PkgLen since a new threshold cannot // No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one. // be reached by incrementing the value by one.
Value += 1; Value += 1;
@ -702,7 +723,7 @@ AmlPropagateSize (
// there is no root node at the top of the tree. Stop // there is no root node at the top of the tree. Stop
// propagating the new size when finding a root node // propagating the new size when finding a root node
// OR when a NULL parent is found. // OR when a NULL parent is found.
ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node); ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (ParentNode != NULL) { if (ParentNode != NULL) {
// Propagate the size up the tree. // Propagate the size up the tree.
Status = AmlPropagateSize ( Status = AmlPropagateSize (
@ -715,14 +736,14 @@ AmlPropagateSize (
return Status; return Status;
} }
} }
} else if (IS_AML_ROOT_NODE (Node)) { } else if (IS_AML_ROOT_NODE (Node)) {
// Update the length field in the SDT header. // Update the length field in the SDT header.
Value = ((AML_ROOT_NODE*)Node)->SdtHeader->Length; Value = ((AML_ROOT_NODE *)Node)->SdtHeader->Length;
// Check for an over/underflows. // Check for an over/underflows.
if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) || if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) ||
(!IsIncrement && (Value < *Diff))) { (!IsIncrement && (Value < *Diff)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -734,7 +755,7 @@ AmlPropagateSize (
Value -= *Diff; Value -= *Diff;
} }
((AML_ROOT_NODE*)Node)->SdtHeader->Length = Value; ((AML_ROOT_NODE *)Node)->SdtHeader->Length = Value;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
@ -762,21 +783,22 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPropagateNodeCount ( AmlPropagateNodeCount (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN BOOLEAN IsIncrement, IN BOOLEAN IsIncrement,
IN UINT8 NodeCount, IN UINT8 NodeCount,
OUT INT8 * FieldWidthChange OUT INT8 *FieldWidthChange
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_NODE_HEADER * NodeCountArg; AML_NODE_HEADER *NodeCountArg;
UINT8 CurrNodeCount; UINT8 CurrNodeCount;
// Currently there is no use case where (NodeCount > 1). // Currently there is no use case where (NodeCount > 1).
if (!IS_AML_OBJECT_NODE (ObjectNode) || if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(FieldWidthChange == NULL) || (FieldWidthChange == NULL) ||
(NodeCount > 1)) { (NodeCount > 1))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -797,21 +819,22 @@ AmlPropagateNodeCount (
// in the package. It is an UINT8. // in the package. It is an UINT8.
// Check for over/underflow. // Check for over/underflow.
CurrNodeCount = *(((AML_DATA_NODE*)NodeCountArg)->Buffer); CurrNodeCount = *(((AML_DATA_NODE *)NodeCountArg)->Buffer);
if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) || if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) ||
(!IsIncrement && (CurrNodeCount == 0))) { (!IsIncrement && (CurrNodeCount == 0)))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Update the node count in the DataNode. // Update the node count in the DataNode.
CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1); CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
*(((AML_DATA_NODE*)NodeCountArg)->Buffer) = CurrNodeCount; *(((AML_DATA_NODE *)NodeCountArg)->Buffer) = CurrNodeCount;
} else if (AmlNodeCompareOpCode (ObjectNode, AML_VAR_PACKAGE_OP, 0)) { } else if (AmlNodeCompareOpCode (ObjectNode, AML_VAR_PACKAGE_OP, 0)) {
// First fixed argument of PackageOp stores the number of elements // First fixed argument of PackageOp stores the number of elements
// in the package. It is an integer (can be a BYTE, WORD, DWORD, QWORD). // in the package. It is an integer (can be a BYTE, WORD, DWORD, QWORD).
Status = AmlNodeUpdateIntegerValue ( Status = AmlNodeUpdateIntegerValue (
(AML_OBJECT_NODE*)NodeCountArg, (AML_OBJECT_NODE *)NodeCountArg,
IsIncrement, IsIncrement,
NodeCount, NodeCount,
FieldWidthChange FieldWidthChange
@ -845,7 +868,7 @@ AmlPropagateNodeCount (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPropagateInformation ( AmlPropagateInformation (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN BOOLEAN IsIncrement, IN BOOLEAN IsIncrement,
IN UINT32 Diff, IN UINT32 Diff,
IN UINT8 NodeCount IN UINT8 NodeCount
@ -857,7 +880,8 @@ AmlPropagateInformation (
// Currently there is no use case where (NodeCount > 1). // Currently there is no use case where (NodeCount > 1).
if ((!IS_AML_ROOT_NODE (Node) && if ((!IS_AML_ROOT_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node)) || !IS_AML_OBJECT_NODE (Node)) ||
(NodeCount > 1)) { (NodeCount > 1))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -865,9 +889,10 @@ AmlPropagateInformation (
// Propagate the node count first as it may change the number of bytes // Propagate the node count first as it may change the number of bytes
// needed to store the node count, and then impact FieldWidthChange. // needed to store the node count, and then impact FieldWidthChange.
if ((NodeCount != 0) && if ((NodeCount != 0) &&
IS_AML_OBJECT_NODE (Node)) { IS_AML_OBJECT_NODE (Node))
{
Status = AmlPropagateNodeCount ( Status = AmlPropagateNodeCount (
(AML_OBJECT_NODE*)Node, (AML_OBJECT_NODE *)Node,
IsIncrement, IsIncrement,
NodeCount, NodeCount,
&FieldWidthChange &FieldWidthChange
@ -885,10 +910,12 @@ AmlPropagateInformation (
((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) || ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) ||
(!IsIncrement && (!IsIncrement &&
((FieldWidthChange > 0) || ((FieldWidthChange > 0) ||
(Diff < (UINT32)ABS (FieldWidthChange))))) { (Diff < (UINT32)ABS (FieldWidthChange)))))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Diff = (UINT32)(Diff + (UINT8)ABS (FieldWidthChange)); Diff = (UINT32)(Diff + (UINT8)ABS (FieldWidthChange));
} }
@ -932,12 +959,12 @@ AmlPropagateInformation (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSetRdListCheckSum ( AmlSetRdListCheckSum (
IN AML_OBJECT_NODE * BufferOpNode, IN AML_OBJECT_NODE *BufferOpNode,
IN UINT8 CheckSum IN UINT8 CheckSum
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_DATA_NODE * LastRdNode; AML_DATA_NODE *LastRdNode;
AML_RD_HEADER RdDataType; AML_RD_HEADER RdDataType;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) { if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) {
@ -947,13 +974,14 @@ AmlSetRdListCheckSum (
// Get the last Resource data node in the variable list of // Get the last Resource data node in the variable list of
// argument of the BufferOp node. // argument of the BufferOp node.
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument ( LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
(AML_NODE_HEADER*)BufferOpNode, (AML_NODE_HEADER *)BufferOpNode,
NULL NULL
); );
if ((LastRdNode == NULL) || if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) || !IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) { (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -969,7 +997,9 @@ AmlSetRdListCheckSum (
// no EndTag. Return EFI_NOT_FOUND is such case. // no EndTag. Return EFI_NOT_FOUND is such case.
if (!AmlRdCompareDescId ( if (!AmlRdCompareDescId (
&RdDataType, &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); ASSERT (0);
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }

View File

@ -21,7 +21,7 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AcpiPlatformChecksum ( AcpiPlatformChecksum (
IN EFI_ACPI_DESCRIPTION_HEADER * AcpiTable IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable
); );
/** Compute the size of a tree/sub-tree. /** Compute the size of a tree/sub-tree.
@ -35,8 +35,8 @@ AcpiPlatformChecksum (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlComputeSize ( AmlComputeSize (
IN CONST AML_NODE_HEADER * Node, IN CONST AML_NODE_HEADER *Node,
IN OUT UINT32 * Size IN OUT UINT32 *Size
); );
/** Get the value contained in an integer node. /** Get the value contained in an integer node.
@ -51,8 +51,8 @@ AmlComputeSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlNodeGetIntegerValue ( AmlNodeGetIntegerValue (
IN AML_OBJECT_NODE * Node, IN AML_OBJECT_NODE *Node,
OUT UINT64 * Value OUT UINT64 *Value
); );
/** Set the value contained in an integer node. /** Set the value contained in an integer node.
@ -76,9 +76,9 @@ AmlNodeGetIntegerValue (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlNodeSetIntegerValue ( AmlNodeSetIntegerValue (
IN AML_OBJECT_NODE * Node, IN AML_OBJECT_NODE *Node,
IN UINT64 NewValue, IN UINT64 NewValue,
OUT INT8 * ValueWidthDiff OUT INT8 *ValueWidthDiff
); );
/** Propagate information up the tree. /** Propagate information up the tree.
@ -101,7 +101,7 @@ AmlNodeSetIntegerValue (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlPropagateInformation ( AmlPropagateInformation (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN BOOLEAN IsIncrement, IN BOOLEAN IsIncrement,
IN UINT32 Diff, IN UINT32 Diff,
IN UINT8 NodeCount IN UINT8 NodeCount
@ -135,9 +135,8 @@ AmlPropagateInformation (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlSetRdListCheckSum ( AmlSetRdListCheckSum (
IN AML_OBJECT_NODE * BufferOpNode, IN AML_OBJECT_NODE *BufferOpNode,
IN UINT8 CheckSum IN UINT8 CheckSum
); );
#endif // AML_UTILITY_H_ #endif // AML_UTILITY_H_

View File

@ -47,15 +47,16 @@ extern CHAR8 ssdtserialporttemplate_aml_code[];
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ValidateSerialPortInfo ( ValidateSerialPortInfo (
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfoTable, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfoTable,
IN UINT32 SerialPortCount IN UINT32 SerialPortCount
) )
{ {
UINT32 Index; UINT32 Index;
CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo; CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
if ((SerialPortInfoTable == NULL) || if ((SerialPortInfoTable == NULL) ||
(SerialPortCount == 0)) { (SerialPortCount == 0))
{
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -64,8 +65,9 @@ ValidateSerialPortInfo (
SerialPortInfo = &SerialPortInfoTable[Index]; SerialPortInfo = &SerialPortInfoTable[Index];
ASSERT (SerialPortInfo != NULL); ASSERT (SerialPortInfo != NULL);
if ((SerialPortInfo == NULL ) || if ((SerialPortInfo == NULL) ||
(SerialPortInfo->BaseAddress == 0)) { (SerialPortInfo->BaseAddress == 0))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: UART port base address is invalid. BaseAddress = 0x%llx\n", "ERROR: UART port base address is invalid. BaseAddress = 0x%llx\n",
@ -83,7 +85,8 @@ ValidateSerialPortInfo (
(SerialPortInfo->PortSubtype != (SerialPortInfo->PortSubtype !=
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC) && EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC) &&
(SerialPortInfo->PortSubtype != (SerialPortInfo->PortSubtype !=
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550)) { EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: UART port subtype is invalid." "ERROR: UART port subtype is invalid."
@ -97,7 +100,8 @@ ValidateSerialPortInfo (
DEBUG ((DEBUG_INFO, "UART Configuration:\n")); DEBUG ((DEBUG_INFO, "UART Configuration:\n"));
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" UART Base = 0x%llx\n", SerialPortInfo->BaseAddress " UART Base = 0x%llx\n",
SerialPortInfo->BaseAddress
)); ));
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -131,21 +135,21 @@ EFIAPI
FixupIds ( FixupIds (
IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN AML_ROOT_NODE_HANDLE RootNodeHandle,
IN CONST UINT64 Uid, IN CONST UINT64 Uid,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_OBJECT_NODE_HANDLE NameOpIdNode; AML_OBJECT_NODE_HANDLE NameOpIdNode;
CONST CHAR8 * HidString; CONST CHAR8 *HidString;
CONST CHAR8 * CidString; CONST CHAR8 *CidString;
CONST CHAR8 * NonBsaHid; CONST CHAR8 *NonBsaHid;
// Get the _CID and _HID value to write. // Get the _CID and _HID value to write.
switch (SerialPortInfo->PortSubtype) { switch (SerialPortInfo->PortSubtype) {
case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550: case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
{ {
// If there is a non-BSA compliant HID, use that. // If there is a non-BSA compliant HID, use that.
NonBsaHid = (CONST CHAR8*)PcdGetPtr (PcdNonBsaCompliant16550SerialHid); NonBsaHid = (CONST CHAR8 *)PcdGetPtr (PcdNonBsaCompliant16550SerialHid);
if ((NonBsaHid != NULL) && (AsciiStrLen (NonBsaHid) != 0)) { if ((NonBsaHid != NULL) && (AsciiStrLen (NonBsaHid) != 0)) {
if (!(IsValidPnpId (NonBsaHid) || IsValidAcpiId (NonBsaHid))) { if (!(IsValidPnpId (NonBsaHid) || IsValidAcpiId (NonBsaHid))) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -157,6 +161,7 @@ FixupIds (
HidString = "PNP0501"; HidString = "PNP0501";
CidString = "PNP0500"; CidString = "PNP0500";
} }
break; break;
} }
case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART: case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
@ -255,7 +260,7 @@ EFI_STATUS
EFIAPI EFIAPI
FixupCrs ( FixupCrs (
IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN AML_ROOT_NODE_HANDLE RootNodeHandle,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -288,7 +293,7 @@ FixupCrs (
QWordRdNode, QWordRdNode,
SerialPortInfo->BaseAddress, SerialPortInfo->BaseAddress,
((SerialPortInfo->BaseAddressLength < MIN_UART_ADDRESS_LENGTH) ? ((SerialPortInfo->BaseAddressLength < MIN_UART_ADDRESS_LENGTH) ?
MIN_UART_ADDRESS_LENGTH: SerialPortInfo->BaseAddressLength) MIN_UART_ADDRESS_LENGTH : SerialPortInfo->BaseAddressLength)
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
@ -330,8 +335,8 @@ EFI_STATUS
EFIAPI EFIAPI
FixupName ( FixupName (
IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN AML_ROOT_NODE_HANDLE RootNodeHandle,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
IN CONST CHAR8 * Name IN CONST CHAR8 *Name
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -344,7 +349,7 @@ FixupName (
} }
// Update the Device's name. // Update the Device's name.
return AmlDeviceOpUpdateName (DeviceNode, (CHAR8*)Name); return AmlDeviceOpUpdateName (DeviceNode, (CHAR8 *)Name);
} }
/** Fixup the Serial Port Information in the AML tree. /** Fixup the Serial Port Information in the AML tree.
@ -374,10 +379,10 @@ EFI_STATUS
EFIAPI EFIAPI
FixupSerialPortInfo ( FixupSerialPortInfo (
IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN AML_ROOT_NODE_HANDLE RootNodeHandle,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
IN CONST CHAR8 * Name, IN CONST CHAR8 *Name,
IN CONST UINT64 Uid, IN CONST UINT64 Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -415,7 +420,7 @@ FixupSerialPortInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FreeSsdtSerialPortTable ( FreeSsdtSerialPortTable (
IN EFI_ACPI_DESCRIPTION_HEADER * Table IN EFI_ACPI_DESCRIPTION_HEADER *Table
) )
{ {
ASSERT (Table != NULL); ASSERT (Table != NULL);
@ -443,11 +448,11 @@ FreeSsdtSerialPortTable (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BuildSsdtSerialPortTable ( BuildSsdtSerialPortTable (
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo, IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
IN CONST CHAR8 * Name, IN CONST CHAR8 *Name,
IN CONST UINT64 Uid, IN CONST UINT64 Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table OUT EFI_ACPI_DESCRIPTION_HEADER **Table
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -467,7 +472,7 @@ BuildSsdtSerialPortTable (
// Parse the SSDT Serial Port Template. // Parse the SSDT Serial Port Template.
Status = AmlParseDefinitionBlock ( Status = AmlParseDefinitionBlock (
(EFI_ACPI_DESCRIPTION_HEADER*)ssdtserialporttemplate_aml_code, (EFI_ACPI_DESCRIPTION_HEADER *)ssdtserialporttemplate_aml_code,
&RootNodeHandle &RootNodeHandle
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {

View File

@ -15,503 +15,503 @@ STATIC
VOID VOID
EFIAPI EFIAPI
PrintOemId ( PrintOemId (
CONST CHAR8* Format, CONST CHAR8 *Format,
UINT8* Ptr UINT8 *Ptr
); );
/** A parser for EArmObjBootArchInfo. /** A parser for EArmObjBootArchInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {
{"BootArchFlags", 2, "0x%x", NULL} { "BootArchFlags", 2, "0x%x", NULL }
}; };
/** A parser for EArmObjPowerManagementProfileInfo. /** A parser for EArmObjPowerManagementProfileInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {
{"PowerManagementProfile", 1, "0x%x", NULL} { "PowerManagementProfile", 1, "0x%x", NULL }
}; };
/** A parser for EArmObjGicCInfo. /** A parser for EArmObjGicCInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = {
{"CPUInterfaceNumber", 4, "0x%x", NULL}, { "CPUInterfaceNumber", 4, "0x%x", NULL },
{"AcpiProcessorUid", 4, "0x%x", NULL}, { "AcpiProcessorUid", 4, "0x%x", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"ParkingProtocolVersion", 4, "0x%x", NULL}, { "ParkingProtocolVersion", 4, "0x%x", NULL },
{"PerformanceInterruptGsiv", 4, "0x%x", NULL}, { "PerformanceInterruptGsiv", 4, "0x%x", NULL },
{"ParkedAddress", 8, "0x%llx", NULL}, { "ParkedAddress", 8, "0x%llx", NULL },
{"PhysicalBaseAddress", 8, "0x%llx", NULL}, { "PhysicalBaseAddress", 8, "0x%llx", NULL },
{"GICV", 8, "0x%llx", NULL}, { "GICV", 8, "0x%llx", NULL },
{"GICH", 8, "0x%llx", NULL}, { "GICH", 8, "0x%llx", NULL },
{"VGICMaintenanceInterrupt", 4, "0x%x", NULL}, { "VGICMaintenanceInterrupt", 4, "0x%x", NULL },
{"GICRBaseAddress", 8, "0x%llx", NULL}, { "GICRBaseAddress", 8, "0x%llx", NULL },
{"MPIDR", 8, "0x%llx", NULL}, { "MPIDR", 8, "0x%llx", NULL },
{"ProcessorPowerEfficiencyClass", 1, "0x%x", NULL}, { "ProcessorPowerEfficiencyClass", 1, "0x%x", NULL },
{"SpeOverflowInterrupt", 2, "0x%x", NULL}, { "SpeOverflowInterrupt", 2, "0x%x", NULL },
{"ProximityDomain", 4, "0x%x", NULL}, { "ProximityDomain", 4, "0x%x", NULL },
{"ClockDomain", 4, "0x%x", NULL}, { "ClockDomain", 4, "0x%x", NULL },
{"AffinityFlags", 4, "0x%x", NULL} { "AffinityFlags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjGicDInfo. /** A parser for EArmObjGicDInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = {
{"PhysicalBaseAddress", 8, "0x%llx", NULL}, { "PhysicalBaseAddress", 8, "0x%llx", NULL },
{"SystemVectorBase", 4, "0x%x", NULL}, { "SystemVectorBase", 4, "0x%x", NULL },
{"GicVersion", 1, "0x%x", NULL}, { "GicVersion", 1, "0x%x", NULL },
}; };
/** A parser for EArmObjGicMsiFrameInfo. /** A parser for EArmObjGicMsiFrameInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = {
{"GicMsiFrameId", 4, "0x%x", NULL}, { "GicMsiFrameId", 4, "0x%x", NULL },
{"PhysicalBaseAddress", 8, "0x%llx", NULL}, { "PhysicalBaseAddress", 8, "0x%llx", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"SPICount", 2, "0x%x", NULL}, { "SPICount", 2, "0x%x", NULL },
{"SPIBase", 2, "0x%x", NULL} { "SPIBase", 2, "0x%x", NULL }
}; };
/** A parser for EArmObjGicRedistributorInfo. /** A parser for EArmObjGicRedistributorInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = {
{"DiscoveryRangeBaseAddress", 8, "0x%llx", NULL}, { "DiscoveryRangeBaseAddress", 8, "0x%llx", NULL },
{"DiscoveryRangeLength", 4, "0x%x", NULL} { "DiscoveryRangeLength", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjGicItsInfo. /** A parser for EArmObjGicItsInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {
{"GicItsId", 4, "0x%x", NULL}, { "GicItsId", 4, "0x%x", NULL },
{"PhysicalBaseAddress", 8, "0x%llx", NULL}, { "PhysicalBaseAddress", 8, "0x%llx", NULL },
{"ProximityDomain", 4, "0x%x", NULL} { "ProximityDomain", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjSerialConsolePortInfo, /** A parser for EArmObjSerialConsolePortInfo,
EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo. EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"Interrupt", 4, "0x%x", NULL}, { "Interrupt", 4, "0x%x", NULL },
{"BaudRate", 8, "0x%llx", NULL}, { "BaudRate", 8, "0x%llx", NULL },
{"Clock", 4, "0x%x", NULL}, { "Clock", 4, "0x%x", NULL },
{"PortSubtype", 2, "0x%x", NULL}, { "PortSubtype", 2, "0x%x", NULL },
{"BaseAddressLength", 8, "0x%llx", NULL}, { "BaseAddressLength", 8, "0x%llx", NULL },
{"AccessSize", 1, "0x%d", NULL} { "AccessSize", 1, "0x%d", NULL }
}; };
/** A parser for EArmObjGenericTimerInfo. /** A parser for EArmObjGenericTimerInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = {
{"CounterControlBaseAddress", 8, "0x%llx", NULL}, { "CounterControlBaseAddress", 8, "0x%llx", NULL },
{"CounterReadBaseAddress", 8, "0x%llx", NULL}, { "CounterReadBaseAddress", 8, "0x%llx", NULL },
{"SecurePL1TimerGSIV", 4, "0x%x", NULL}, { "SecurePL1TimerGSIV", 4, "0x%x", NULL },
{"SecurePL1TimerFlags", 4, "0x%x", NULL}, { "SecurePL1TimerFlags", 4, "0x%x", NULL },
{"NonSecurePL1TimerGSIV", 4, "0x%x", NULL}, { "NonSecurePL1TimerGSIV", 4, "0x%x", NULL },
{"NonSecurePL1TimerFlags", 4, "0x%x", NULL}, { "NonSecurePL1TimerFlags", 4, "0x%x", NULL },
{"VirtualTimerGSIV", 4, "0x%x", NULL}, { "VirtualTimerGSIV", 4, "0x%x", NULL },
{"VirtualTimerFlags", 4, "0x%x", NULL}, { "VirtualTimerFlags", 4, "0x%x", NULL },
{"NonSecurePL2TimerGSIV", 4, "0x%x", NULL}, { "NonSecurePL2TimerGSIV", 4, "0x%x", NULL },
{"NonSecurePL2TimerFlags", 4, "0x%x", NULL}, { "NonSecurePL2TimerFlags", 4, "0x%x", NULL },
{"VirtualPL2TimerGSIV", 4, "0x%x", NULL}, { "VirtualPL2TimerGSIV", 4, "0x%x", NULL },
{"VirtualPL2TimerFlags", 4, "0x%x", NULL} { "VirtualPL2TimerFlags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjPlatformGTBlockInfo. /** A parser for EArmObjPlatformGTBlockInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = {
{"FrameNumber", 1, "0x%x", NULL}, { "FrameNumber", 1, "0x%x", NULL },
{"PhysicalAddressCntBase", 8, "0x%llx", NULL}, { "PhysicalAddressCntBase", 8, "0x%llx", NULL },
{"PhysicalAddressCntEL0Base", 8, "0x%llx", NULL}, { "PhysicalAddressCntEL0Base", 8, "0x%llx", NULL },
{"PhysicalTimerGSIV", 4, "0x%x", NULL}, { "PhysicalTimerGSIV", 4, "0x%x", NULL },
{"PhysicalTimerFlags", 4, "0x%x", NULL}, { "PhysicalTimerFlags", 4, "0x%x", NULL },
{"VirtualTimerGSIV", 4, "0x%x", NULL}, { "VirtualTimerGSIV", 4, "0x%x", NULL },
{"VirtualTimerFlags", 4, "0x%x", NULL}, { "VirtualTimerFlags", 4, "0x%x", NULL },
{"CommonFlags", 4, "0x%x", NULL} { "CommonFlags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjGTBlockTimerFrameInfo. /** A parser for EArmObjGTBlockTimerFrameInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = {
{"GTBlockPhysicalAddress", 8, "0x%llx", NULL}, { "GTBlockPhysicalAddress", 8, "0x%llx", NULL },
{"GTBlockTimerFrameCount", 4, "0x%x", NULL}, { "GTBlockTimerFrameCount", 4, "0x%x", NULL },
{"GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjPlatformGenericWatchdogInfo. /** A parser for EArmObjPlatformGenericWatchdogInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {
{"ControlFrameAddress", 8, "0x%llx", NULL}, { "ControlFrameAddress", 8, "0x%llx", NULL },
{"RefreshFrameAddress", 8, "0x%llx", NULL}, { "RefreshFrameAddress", 8, "0x%llx", NULL },
{"TimerGSIV", 4, "0x%x", NULL}, { "TimerGSIV", 4, "0x%x", NULL },
{"Flags", 4, "0x%x", NULL} { "Flags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjPciConfigSpaceInfo. /** A parser for EArmObjPciConfigSpaceInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"PciSegmentGroupNumber", 2, "0x%x", NULL}, { "PciSegmentGroupNumber", 2, "0x%x", NULL },
{"StartBusNumber", 1, "0x%x", NULL}, { "StartBusNumber", 1, "0x%x", NULL },
{"EndBusNumber", 1, "0x%x", NULL} { "EndBusNumber", 1, "0x%x", NULL }
}; };
/** A parser for EArmObjHypervisorVendorIdentity. /** A parser for EArmObjHypervisorVendorIdentity.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = { STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {
{"HypervisorVendorId", 8, "0x%llx", NULL} { "HypervisorVendorId", 8, "0x%llx", NULL }
}; };
/** A parser for EArmObjFixedFeatureFlags. /** A parser for EArmObjFixedFeatureFlags.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = { STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
{"Flags", 4, "0x%x", NULL} { "Flags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjItsGroup. /** A parser for EArmObjItsGroup.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"ItsIdCount", 4, "0x%x", NULL}, { "ItsIdCount", 4, "0x%x", NULL },
{"ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjNamedComponent. /** A parser for EArmObjNamedComponent.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"IdMappingCount", 4, "0x%x", NULL}, { "IdMappingCount", 4, "0x%x", NULL },
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"CacheCoherent", 4, "0x%x", NULL}, { "CacheCoherent", 4, "0x%x", NULL },
{"AllocationHints", 1, "0x%x", NULL}, { "AllocationHints", 1, "0x%x", NULL },
{"MemoryAccessFlags", 1, "0x%x", NULL}, { "MemoryAccessFlags", 1, "0x%x", NULL },
{"AddressSizeLimit", 1, "0x%x", NULL}, { "AddressSizeLimit", 1, "0x%x", NULL },
{"ObjectName", sizeof (CHAR8*), "%a", NULL} { "ObjectName", sizeof (CHAR8 *), "%a", NULL }
}; };
/** A parser for EArmObjRootComplex. /** A parser for EArmObjRootComplex.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"IdMappingCount", 4, "0x%x", NULL}, { "IdMappingCount", 4, "0x%x", NULL },
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"CacheCoherent", 4, "0x%x", NULL}, { "CacheCoherent", 4, "0x%x", NULL },
{"AllocationHints", 1, "0x%x", NULL}, { "AllocationHints", 1, "0x%x", NULL },
{"MemoryAccessFlags", 1, "0x%x", NULL}, { "MemoryAccessFlags", 1, "0x%x", NULL },
{"AtsAttribute", 4, "0x%x", NULL}, { "AtsAttribute", 4, "0x%x", NULL },
{"PciSegmentNumber", 4, "0x%x", NULL}, { "PciSegmentNumber", 4, "0x%x", NULL },
{"MemoryAddressSize", 1, "0x%x", NULL} { "MemoryAddressSize", 1, "0x%x", NULL }
}; };
/** A parser for EArmObjSmmuV1SmmuV2. /** A parser for EArmObjSmmuV1SmmuV2.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"IdMappingCount", 4, "0x%x", NULL}, { "IdMappingCount", 4, "0x%x", NULL },
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"Span", 8, "0x%llx", NULL}, { "Span", 8, "0x%llx", NULL },
{"Model", 4, "0x%x", NULL}, { "Model", 4, "0x%x", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"ContextInterruptCount", 4, "0x%x", NULL}, { "ContextInterruptCount", 4, "0x%x", NULL },
{"ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"PmuInterruptCount", 4, "0x%x", NULL}, { "PmuInterruptCount", 4, "0x%x", NULL },
{"PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"SMMU_NSgIrpt", 4, "0x%x", NULL}, { "SMMU_NSgIrpt", 4, "0x%x", NULL },
{"SMMU_NSgIrptFlags", 4, "0x%x", NULL}, { "SMMU_NSgIrptFlags", 4, "0x%x", NULL },
{"SMMU_NSgCfgIrpt", 4, "0x%x", NULL}, { "SMMU_NSgCfgIrpt", 4, "0x%x", NULL },
{"SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL} { "SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjSmmuV3. /** A parser for EArmObjSmmuV3.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"IdMappingCount", 4, "0x%x", NULL}, { "IdMappingCount", 4, "0x%x", NULL },
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"VatosAddress", 8, "0x%llx", NULL}, { "VatosAddress", 8, "0x%llx", NULL },
{"Model", 4, "0x%x", NULL}, { "Model", 4, "0x%x", NULL },
{"EventInterrupt", 4, "0x%x", NULL}, { "EventInterrupt", 4, "0x%x", NULL },
{"PriInterrupt", 4, "0x%x", NULL}, { "PriInterrupt", 4, "0x%x", NULL },
{"GerrInterrupt", 4, "0x%x", NULL}, { "GerrInterrupt", 4, "0x%x", NULL },
{"SyncInterrupt", 4, "0x%x", NULL}, { "SyncInterrupt", 4, "0x%x", NULL },
{"ProximityDomain", 4, "0x%x", NULL}, { "ProximityDomain", 4, "0x%x", NULL },
{"DeviceIdMappingIndex", 4, "0x%x", NULL} { "DeviceIdMappingIndex", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjPmcg. /** A parser for EArmObjPmcg.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = { STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"IdMappingCount", 4, "0x%x", NULL}, { "IdMappingCount", 4, "0x%x", NULL },
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"OverflowInterrupt", 4, "0x%x", NULL}, { "OverflowInterrupt", 4, "0x%x", NULL },
{"Page1BaseAddress", 8, "0x%llx", NULL}, { "Page1BaseAddress", 8, "0x%llx", NULL },
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjGicItsIdentifierArray. /** A parser for EArmObjGicItsIdentifierArray.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {
{"ItsId", 4, "0x%x", NULL} { "ItsId", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjIdMappingArray. /** A parser for EArmObjIdMappingArray.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = { STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {
{"InputBase", 4, "0x%x", NULL}, { "InputBase", 4, "0x%x", NULL },
{"NumIds", 4, "0x%x", NULL}, { "NumIds", 4, "0x%x", NULL },
{"OutputBase", 4, "0x%x", NULL}, { "OutputBase", 4, "0x%x", NULL },
{"OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"Flags", 4, "0x%x", NULL} { "Flags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjSmmuInterruptArray. /** A parser for EArmObjSmmuInterruptArray.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {
{"Interrupt", 4, "0x%x", NULL}, { "Interrupt", 4, "0x%x", NULL },
{"Flags", 4, "0x%x", NULL} { "Flags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjProcHierarchyInfo. /** A parser for EArmObjProcHierarchyInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"NoOfPrivateResources", 4, "0x%x", NULL}, { "NoOfPrivateResources", 4, "0x%x", NULL },
{"PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjCacheInfo. /** A parser for EArmObjCacheInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"Size", 4, "0x%x", NULL}, { "Size", 4, "0x%x", NULL },
{"NumberOfSets", 4, "0x%x", NULL}, { "NumberOfSets", 4, "0x%x", NULL },
{"Associativity", 4, "0x%x", NULL}, { "Associativity", 4, "0x%x", NULL },
{"Attributes", 1, "0x%x", NULL}, { "Attributes", 1, "0x%x", NULL },
{"LineSize", 2, "0x%x", NULL} { "LineSize", 2, "0x%x", NULL }
}; };
/** A parser for EArmObjProcNodeIdInfo. /** A parser for EArmObjProcNodeIdInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}, { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{"VendorId", 4, "0x%p", NULL}, { "VendorId", 4, "0x%p", NULL },
{"Level1Id", 8, "0x%x", NULL}, { "Level1Id", 8, "0x%x", NULL },
{"Level2Id", 8, "0x%x", NULL}, { "Level2Id", 8, "0x%x", NULL },
{"MajorRev", 2, "0x%x", NULL}, { "MajorRev", 2, "0x%x", NULL },
{"MinorRev", 2, "0x%x", NULL}, { "MinorRev", 2, "0x%x", NULL },
{"SpinRev", 2, "0x%x", NULL} { "SpinRev", 2, "0x%x", NULL }
}; };
/** A parser for EArmObjCmRef. /** A parser for EArmObjCmRef.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = { STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjMemoryAffinityInfo. /** A parser for EArmObjMemoryAffinityInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {
{"ProximityDomain", 4, "0x%x", NULL}, { "ProximityDomain", 4, "0x%x", NULL },
{"BaseAddress", 8, "0x%llx", NULL}, { "BaseAddress", 8, "0x%llx", NULL },
{"Length", 8, "0x%llx", NULL}, { "Length", 8, "0x%llx", NULL },
{"Flags", 4, "0x%x", NULL} { "Flags", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjDeviceHandleAcpi. /** A parser for EArmObjDeviceHandleAcpi.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = { STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {
{"Hid", 8, "0x%llx", NULL}, { "Hid", 8, "0x%llx", NULL },
{"Uid", 4, "0x%x", NULL} { "Uid", 4, "0x%x", NULL }
}; };
/** A parser for EArmObjDeviceHandlePci. /** A parser for EArmObjDeviceHandlePci.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = { STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {
{"SegmentNumber", 2, "0x%x", NULL}, { "SegmentNumber", 2, "0x%x", NULL },
{"BusNumber", 1, "0x%x", NULL}, { "BusNumber", 1, "0x%x", NULL },
{"DeviceNumber", 1, "0x%x", NULL}, { "DeviceNumber", 1, "0x%x", NULL },
{"FunctionNumber", 1, "0x%x", NULL} { "FunctionNumber", 1, "0x%x", NULL }
}; };
/** A parser for EArmObjGenericInitiatorAffinityInfo. /** A parser for EArmObjGenericInitiatorAffinityInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {
{"ProximityDomain", 4, "0x%x", NULL}, { "ProximityDomain", 4, "0x%x", NULL },
{"Flags", 4, "0x%x", NULL}, { "Flags", 4, "0x%x", NULL },
{"DeviceHandleType", 1, "0x%x", NULL}, { "DeviceHandleType", 1, "0x%x", NULL },
{"DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL} { "DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
}; };
/** A parser for EArmObjCmn600Info. /** A parser for EArmObjCmn600Info.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {
{"PeriphBaseAddress", 8, "0x%llx", NULL}, { "PeriphBaseAddress", 8, "0x%llx", NULL },
{"PeriphBaseAddressLength", 8, "0x%llx", NULL}, { "PeriphBaseAddressLength", 8, "0x%llx", NULL },
{"RootNodeBaseAddress", 8, "0x%llx", NULL}, { "RootNodeBaseAddress", 8, "0x%llx", NULL },
{"DtcCount", 1, "0x%x", NULL}, { "DtcCount", 1, "0x%x", NULL },
{"DtcInterrupt[0]", 4, "0x%x", NULL}, { "DtcInterrupt[0]", 4, "0x%x", NULL },
{"DtcFlags[0]", 4, "0x%x", NULL}, { "DtcFlags[0]", 4, "0x%x", NULL },
{"DtcInterrupt[1]", 4, "0x%x", NULL}, { "DtcInterrupt[1]", 4, "0x%x", NULL },
{"DtcFlags[1]", 4, "0x%x", NULL}, { "DtcFlags[1]", 4, "0x%x", NULL },
{"DtcInterrupt[2]", 4, "0x%x", NULL}, { "DtcInterrupt[2]", 4, "0x%x", NULL },
{"DtcFlags[2]", 4, "0x%x", NULL}, { "DtcFlags[2]", 4, "0x%x", NULL },
{"DtcInterrupt[3]", 4, "0x%x", NULL}, { "DtcInterrupt[3]", 4, "0x%x", NULL },
{"DtcFlags[3]", 4, "0x%x", NULL} { "DtcFlags[3]", 4, "0x%x", NULL }
}; };
/** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure. /** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.
*/ */
STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = { STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {
{"AddressSpaceId", 1, "%d", NULL}, { "AddressSpaceId", 1, "%d", NULL },
{"RegisterBitWidth", 1, "%d", NULL}, { "RegisterBitWidth", 1, "%d", NULL },
{"RegisterBitOffset", 1, "%d", NULL}, { "RegisterBitOffset", 1, "%d", NULL },
{"AccessSize", 1, "%d", NULL}, { "AccessSize", 1, "%d", NULL },
{"Address", 8, "0x%llx", NULL}, { "Address", 8, "0x%llx", NULL },
}; };
/** A parser for EArmObjLpiInfo. /** A parser for EArmObjLpiInfo.
*/ */
STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = { STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
{"MinResidency", 4, "0x%llx", NULL}, { "MinResidency", 4, "0x%llx", NULL },
{"WorstCaseWakeLatency", 4, "0x%llx", NULL}, { "WorstCaseWakeLatency", 4, "0x%llx", NULL },
{"Flags", 4, "0x%llx", NULL}, { "Flags", 4, "0x%llx", NULL },
{"ArchFlags", 4, "0x%llx", NULL}, { "ArchFlags", 4, "0x%llx", NULL },
{"ResCntFreq", 4, "0x%llx", NULL}, { "ResCntFreq", 4, "0x%llx", NULL },
{"EnableParentState", 4, "0x%llx", NULL}, { "EnableParentState", 4, "0x%llx", NULL },
{"IsInteger", 1, "%d", NULL}, { "IsInteger", 1, "%d", NULL },
{"IntegerEntryMethod", 8, "0x%llx", NULL}, { "IntegerEntryMethod", 8, "0x%llx", NULL },
{"RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE), { "RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser, NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)}, ARRAY_SIZE (AcpiGenericAddressParser) },
{"ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE), { "ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser, NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)}, ARRAY_SIZE (AcpiGenericAddressParser) },
{"UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE), { "UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser, NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)}, ARRAY_SIZE (AcpiGenericAddressParser) },
{"StateName", 16, "0x%a", NULL}, { "StateName", 16, "0x%a", NULL },
}; };
/** A parser for Arm namespace objects. /** A parser for Arm namespace objects.
*/ */
STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = { STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {
{"EArmObjReserved", NULL, 0}, { "EArmObjReserved", NULL, 0 },
{"EArmObjBootArchInfo", CmArmBootArchInfoParser, { "EArmObjBootArchInfo", CmArmBootArchInfoParser,
ARRAY_SIZE (CmArmBootArchInfoParser)}, ARRAY_SIZE (CmArmBootArchInfoParser) },
{"EArmObjCpuInfo", NULL, 0}, { "EArmObjCpuInfo", NULL, 0 },
{"EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser, { "EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,
ARRAY_SIZE (CmArmPowerManagementProfileInfoParser)}, ARRAY_SIZE (CmArmPowerManagementProfileInfoParser) },
{"EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser)}, { "EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser) },
{"EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser)}, { "EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser) },
{"EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser, { "EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,
ARRAY_SIZE (CmArmGicMsiFrameInfoParser)}, ARRAY_SIZE (CmArmGicMsiFrameInfoParser) },
{"EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser, { "EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,
ARRAY_SIZE (CmArmGicRedistInfoParser)}, ARRAY_SIZE (CmArmGicRedistInfoParser) },
{"EArmObjGicItsInfo", CmArmGicItsInfoParser, { "EArmObjGicItsInfo", CmArmGicItsInfoParser,
ARRAY_SIZE (CmArmGicItsInfoParser)}, ARRAY_SIZE (CmArmGicItsInfoParser) },
{"EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser, { "EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)}, ARRAY_SIZE (CmArmSerialPortInfoParser) },
{"EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser, { "EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)}, ARRAY_SIZE (CmArmSerialPortInfoParser) },
{"EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser, { "EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
ARRAY_SIZE (CmArmGenericTimerInfoParser)}, ARRAY_SIZE (CmArmGenericTimerInfoParser) },
{"EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser, { "EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,
ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser)}, ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },
{"EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser, { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,
ARRAY_SIZE (CmArmGTBlockInfoParser)}, ARRAY_SIZE (CmArmGTBlockInfoParser) },
{"EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser, { "EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,
ARRAY_SIZE (CmArmGenericWatchdogInfoParser)}, ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },
{"EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser, { "EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,
ARRAY_SIZE (CmArmPciConfigSpaceInfoParser)}, ARRAY_SIZE (CmArmPciConfigSpaceInfoParser) },
{"EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser, { "EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,
ARRAY_SIZE (CmArmHypervisorVendorIdParser)}, ARRAY_SIZE (CmArmHypervisorVendorIdParser) },
{"EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser, { "EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,
ARRAY_SIZE (CmArmFixedFeatureFlagsParser)}, ARRAY_SIZE (CmArmFixedFeatureFlagsParser) },
{"EArmObjItsGroup", CmArmItsGroupNodeParser, { "EArmObjItsGroup", CmArmItsGroupNodeParser,
ARRAY_SIZE (CmArmItsGroupNodeParser)}, ARRAY_SIZE (CmArmItsGroupNodeParser) },
{"EArmObjNamedComponent", CmArmNamedComponentNodeParser, { "EArmObjNamedComponent", CmArmNamedComponentNodeParser,
ARRAY_SIZE (CmArmNamedComponentNodeParser)}, ARRAY_SIZE (CmArmNamedComponentNodeParser) },
{"EArmObjRootComplex", CmArmRootComplexNodeParser, { "EArmObjRootComplex", CmArmRootComplexNodeParser,
ARRAY_SIZE (CmArmRootComplexNodeParser)}, ARRAY_SIZE (CmArmRootComplexNodeParser) },
{"EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser, { "EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,
ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser)}, ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser) },
{"EArmObjSmmuV3", CmArmSmmuV3NodeParser, { "EArmObjSmmuV3", CmArmSmmuV3NodeParser,
ARRAY_SIZE (CmArmSmmuV3NodeParser)}, ARRAY_SIZE (CmArmSmmuV3NodeParser) },
{"EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser)}, { "EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser) },
{"EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser, { "EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,
ARRAY_SIZE (CmArmGicItsIdentifierParser)}, ARRAY_SIZE (CmArmGicItsIdentifierParser) },
{"EArmObjIdMappingArray", CmArmIdMappingParser, { "EArmObjIdMappingArray", CmArmIdMappingParser,
ARRAY_SIZE (CmArmIdMappingParser)}, ARRAY_SIZE (CmArmIdMappingParser) },
{"EArmObjSmmuInterruptArray", CmArmGenericInterruptParser, { "EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,
ARRAY_SIZE (CmArmGenericInterruptParser)}, ARRAY_SIZE (CmArmGenericInterruptParser) },
{"EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser, { "EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,
ARRAY_SIZE (CmArmProcHierarchyInfoParser)}, ARRAY_SIZE (CmArmProcHierarchyInfoParser) },
{"EArmObjCacheInfo", CmArmCacheInfoParser, { "EArmObjCacheInfo", CmArmCacheInfoParser,
ARRAY_SIZE (CmArmCacheInfoParser)}, ARRAY_SIZE (CmArmCacheInfoParser) },
{"EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser, { "EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,
ARRAY_SIZE (CmArmProcNodeIdInfoParser)}, ARRAY_SIZE (CmArmProcNodeIdInfoParser) },
{"EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser)}, { "EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser) },
{"EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser, { "EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,
ARRAY_SIZE (CmArmMemoryAffinityInfoParser)}, ARRAY_SIZE (CmArmMemoryAffinityInfoParser) },
{"EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser, { "EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,
ARRAY_SIZE (CmArmDeviceHandleAcpiParser)}, ARRAY_SIZE (CmArmDeviceHandleAcpiParser) },
{"EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser, { "EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,
ARRAY_SIZE (CmArmDeviceHandlePciParser)}, ARRAY_SIZE (CmArmDeviceHandlePciParser) },
{"EArmObjGenericInitiatorAffinityInfo", { "EArmObjGenericInitiatorAffinityInfo",
CmArmGenericInitiatorAffinityInfoParser, CmArmGenericInitiatorAffinityInfoParser,
ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser)}, ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser) },
{"EArmObjSerialPortInfo", CmArmSerialPortInfoParser, { "EArmObjSerialPortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)}, ARRAY_SIZE (CmArmSerialPortInfoParser) },
{"EArmObjCmn600Info", CmArmCmn600InfoParser, { "EArmObjCmn600Info", CmArmCmn600InfoParser,
ARRAY_SIZE (CmArmCmn600InfoParser)}, ARRAY_SIZE (CmArmCmn600InfoParser) },
{"EArmObjLpiInfo", CmArmLpiInfoParser, { "EArmObjLpiInfo", CmArmLpiInfoParser,
ARRAY_SIZE (CmArmLpiInfoParser)}, ARRAY_SIZE (CmArmLpiInfoParser) },
{"EArmObjMax", NULL, 0}, { "EArmObjMax", NULL, 0 },
}; };
/** A parser for EStdObjCfgMgrInfo. /** A parser for EStdObjCfgMgrInfo.
*/ */
STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = { STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {
{"Revision", 4, "0x%x", NULL}, { "Revision", 4, "0x%x", NULL },
{"OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId} { "OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId }
}; };
/** A parser for EStdObjAcpiTableList. /** A parser for EStdObjAcpiTableList.
*/ */
STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = { STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {
{"AcpiTableSignature", 4, "0x%x", NULL}, { "AcpiTableSignature", 4, "0x%x", NULL },
{"AcpiTableRevision", 1, "%d", NULL}, { "AcpiTableRevision", 1, "%d", NULL },
{"TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL}, { "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL },
{"AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER*), "0x%p", NULL}, { "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p", NULL },
{"OemTableId", 8, "0x%LLX", NULL}, { "OemTableId", 8, "0x%LLX", NULL },
{"OemRevision", 4, "0x%x", NULL} { "OemRevision", 4, "0x%x", NULL }
}; };
/** A parser for EStdObjSmbiosTableList. /** A parser for EStdObjSmbiosTableList.
*/ */
STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = { STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {
{"TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL}, { "TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL },
{"SmbiosTableData", sizeof (SMBIOS_STRUCTURE*), "0x%p", NULL} { "SmbiosTableData", sizeof (SMBIOS_STRUCTURE *), "0x%p", NULL }
}; };
/** A parser for Standard namespace objects. /** A parser for Standard namespace objects.
*/ */
STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = { STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
{"EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser, { "EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,
ARRAY_SIZE (StdObjCfgMgrInfoParser)}, ARRAY_SIZE (StdObjCfgMgrInfoParser) },
{"EStdObjAcpiTableList", StdObjAcpiTableInfoParser, { "EStdObjAcpiTableList", StdObjAcpiTableInfoParser,
ARRAY_SIZE (StdObjAcpiTableInfoParser)}, ARRAY_SIZE (StdObjAcpiTableInfoParser) },
{"EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser, { "EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
ARRAY_SIZE (StdObjSmbiosTableInfoParser)}, ARRAY_SIZE (StdObjSmbiosTableInfoParser) },
}; };
/** Print OEM Id. /** Print OEM Id.
@ -523,8 +523,8 @@ STATIC
VOID VOID
EFIAPI EFIAPI
PrintOemId ( PrintOemId (
IN CONST CHAR8 * Format, IN CONST CHAR8 *Format,
IN UINT8 * Ptr IN UINT8 *Ptr
) )
{ {
DEBUG (( DEBUG ((
@ -566,7 +566,8 @@ PrintCmObjDesc (
if ((Data == NULL) || if ((Data == NULL) ||
(Parser == NULL) || (Parser == NULL) ||
(ItemCount == 0) || (ItemCount == 0) ||
(RemainingSize == NULL)) { (RemainingSize == NULL))
{
ASSERT (0); ASSERT (0);
return; return;
} }
@ -601,16 +602,16 @@ PrintCmObjDesc (
} else if (Parser[Index].Format != NULL) { } else if (Parser[Index].Format != NULL) {
switch (Parser[Index].Length) { switch (Parser[Index].Length) {
case 1: case 1:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8*)Data)); DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8 *)Data));
break; break;
case 2: case 2:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16*)Data)); DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16 *)Data));
break; break;
case 4: case 4:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32*)Data)); DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32 *)Data));
break; break;
case 8: case 8:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64(Data))); DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64 (Data)));
break; break;
default: default:
DEBUG (( DEBUG ((
@ -640,8 +641,9 @@ PrintCmObjDesc (
Parser[Index].Length Parser[Index].Length
)); ));
} }
DEBUG ((DEBUG_ERROR, "\n")); DEBUG ((DEBUG_ERROR, "\n"));
Data = (UINT8*)Data + Parser[Index].Length; Data = (UINT8 *)Data + Parser[Index].Length;
} // for } // for
} }
@ -652,7 +654,7 @@ PrintCmObjDesc (
VOID VOID
EFIAPI EFIAPI
ParseCmObjDesc ( ParseCmObjDesc (
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc
) )
{ {
UINTN ObjId; UINTN ObjId;
@ -660,7 +662,7 @@ ParseCmObjDesc (
UINT32 ObjIndex; UINT32 ObjIndex;
UINT32 ObjectCount; UINT32 ObjectCount;
INTN RemainingSize; INTN RemainingSize;
CONST CM_OBJ_PARSER_ARRAY * ParserArray; CONST CM_OBJ_PARSER_ARRAY *ParserArray;
if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) { if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {
return; return;
@ -675,6 +677,7 @@ ParseCmObjDesc (
ASSERT (0); ASSERT (0);
return; return;
} }
ParserArray = &StdNamespaceObjectParser[ObjId]; ParserArray = &StdNamespaceObjectParser[ObjId];
break; break;
case EObjNameSpaceArm: case EObjNameSpaceArm:
@ -682,6 +685,7 @@ ParseCmObjDesc (
ASSERT (0); ASSERT (0);
return; return;
} }
ParserArray = &ArmNamespaceObjectParser[ObjId]; ParserArray = &ArmNamespaceObjectParser[ObjId];
break; break;
default: default:

View File

@ -17,7 +17,7 @@
the 'Format' member of ACPI_PARSER. the 'Format' member of ACPI_PARSER.
@param [in] Ptr Pointer to the start of the buffer. @param [in] Ptr Pointer to the start of the buffer.
**/ **/
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr); typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8 *Format, UINT8 *Ptr);
/** /**
The CM_OBJ_PARSER structure describes the fields of an CmObject and The CM_OBJ_PARSER structure describes the fields of an CmObject and
@ -28,16 +28,15 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
*/ */
typedef struct CmObjParser CM_OBJ_PARSER; typedef struct CmObjParser CM_OBJ_PARSER;
struct CmObjParser { struct CmObjParser {
/// String describing the Cm Object /// String describing the Cm Object
CONST CHAR8* NameStr; CONST CHAR8 *NameStr;
/// The length of the field. /// The length of the field.
UINT32 Length; UINT32 Length;
/// Optional Print() style format string for tracing the data. If not /// Optional Print() style format string for tracing the data. If not
/// used this must be set to NULL. /// used this must be set to NULL.
CONST CHAR8* Format; CONST CHAR8 *Format;
/// Optional pointer to a print formatter function which /// Optional pointer to a print formatter function which
/// is typically used to trace complex field information. /// is typically used to trace complex field information.
@ -59,12 +58,11 @@ struct CmObjParser {
with their object names. with their object names.
*/ */
typedef struct CmObjParserArray { typedef struct CmObjParserArray {
/// Object name /// Object name
CONST CHAR8 * ObjectName; CONST CHAR8 *ObjectName;
/// Function pointer to the parser /// Function pointer to the parser
CONST CM_OBJ_PARSER * Parser; CONST CM_OBJ_PARSER *Parser;
/// Count of items /// Count of items
UINTN ItemCount; UINTN ItemCount;

View File

@ -34,8 +34,8 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetCgfMgrInfo ( GetCgfMgrInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO **CfgMfrInfo
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -72,7 +72,8 @@ GetCgfMgrInfo (
} }
if (CmObjectDesc.Size < if (CmObjectDesc.Size <
(sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count)) { (sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: EStdObjCfgMgrInfo: Buffer too small, size = 0x%x\n", "ERROR: EStdObjCfgMgrInfo: Buffer too small, size = 0x%x\n",
@ -82,7 +83,7 @@ GetCgfMgrInfo (
return EFI_BAD_BUFFER_SIZE; return EFI_BAD_BUFFER_SIZE;
} }
*CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO*)CmObjectDesc.Data; *CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *)CmObjectDesc.Data;
return Status; return Status;
} }
@ -109,15 +110,15 @@ GetCgfMgrInfo (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AddAcpiHeader ( AddAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST UINT32 Length IN CONST UINT32 Length
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -130,7 +131,8 @@ AddAcpiHeader (
(AcpiHeader == NULL) || (AcpiHeader == NULL) ||
(AcpiTableInfo == NULL) || (AcpiTableInfo == NULL) ||
(Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
) { )
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -212,16 +214,16 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AddSsdtAcpiHeader ( AddSsdtAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator, IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
OUT AML_ROOT_NODE_HANDLE * RootNode OUT AML_ROOT_NODE_HANDLE *RootNode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT64 OemTableId; UINT64 OemTableId;
UINT32 OemRevision; UINT32 OemRevision;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo;
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
@ -229,7 +231,8 @@ AddSsdtAcpiHeader (
if ((CfgMgrProtocol == NULL) || if ((CfgMgrProtocol == NULL) ||
(Generator == NULL) || (Generator == NULL) ||
(AcpiTableInfo == NULL)) { (AcpiTableInfo == NULL))
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -263,8 +266,8 @@ AddSsdtAcpiHeader (
Status = AmlCodeGenDefinitionBlock ( Status = AmlCodeGenDefinitionBlock (
"SSDT", "SSDT",
(CONST CHAR8*)&CfgMfrInfo->OemId, (CONST CHAR8 *)&CfgMfrInfo->OemId,
(CONST CHAR8*)&OemTableId, (CONST CHAR8 *)&OemTableId,
OemRevision, OemRevision,
RootNode RootNode
); );
@ -289,7 +292,7 @@ AddSsdtAcpiHeader (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
FindDuplicateValue ( FindDuplicateValue (
IN CONST VOID * Array, IN CONST VOID *Array,
IN CONST UINTN Count, IN CONST UINTN Count,
IN CONST UINTN ElementSize, IN CONST UINTN ElementSize,
IN PFN_IS_EQUAL EqualTestFunction IN PFN_IS_EQUAL EqualTestFunction
@ -297,8 +300,8 @@ FindDuplicateValue (
{ {
UINTN Index1; UINTN Index1;
UINTN Index2; UINTN Index2;
UINT8 * Element1; UINT8 *Element1;
UINT8 * Element2; UINT8 *Element2;
if (Array == NULL) { if (Array == NULL) {
DEBUG ((DEBUG_ERROR, "ERROR: FindDuplicateValues: Array is NULL.\n")); DEBUG ((DEBUG_ERROR, "ERROR: FindDuplicateValues: Array is NULL.\n"));
@ -324,13 +327,14 @@ FindDuplicateValue (
for (Index1 = 0; Index1 < Count - 1; Index1++) { for (Index1 = 0; Index1 < Count - 1; Index1++) {
for (Index2 = Index1 + 1; Index2 < Count; Index2++) { for (Index2 = Index1 + 1; Index2 < Count; Index2++) {
Element1 = (UINT8*)Array + (Index1 * ElementSize); Element1 = (UINT8 *)Array + (Index1 * ElementSize);
Element2 = (UINT8*)Array + (Index2 * ElementSize); Element2 = (UINT8 *)Array + (Index2 * ElementSize);
if (EqualTestFunction (Element1, Element2, Index1, Index2)) { if (EqualTestFunction (Element1, Element2, Index1, Index2)) {
return TRUE; return TRUE;
} }
} }
} }
return FALSE; return FALSE;
} }