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

@ -22,7 +22,7 @@
#include "DynamicTableFactory.h" #include "DynamicTableFactory.h"
extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo; extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
/** Return a pointer to the ACPI table generator. /** Return a pointer to the ACPI table generator.
@ -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);
@ -63,12 +63,13 @@ GetAcpiTableGenerator (
} }
*Generator = NULL; *Generator = NULL;
TableId = GET_TABLE_ID (GeneratorId); TableId = GET_TABLE_ID (GeneratorId);
if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) { if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
if (TableId >= EStdAcpiTableIdMax) { if (TableId >= EStdAcpiTableIdMax) {
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

@ -21,7 +21,7 @@
#include "DynamicTableFactory.h" #include "DynamicTableFactory.h"
extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo; extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
/** Return a pointer to the DT table generator. /** Return a pointer to the DT table generator.
@ -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);
@ -62,12 +62,13 @@ GetDtTableGenerator (
} }
*Generator = NULL; *Generator = NULL;
TableId = GET_TABLE_ID (GeneratorId); TableId = GET_TABLE_ID (GeneratorId);
if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) { if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
if (TableId >= EStdDtTableIdMax) { if (TableId >= EStdDtTableIdMax) {
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

@ -22,33 +22,33 @@
typedef struct DynamicTableFactoryInfo { typedef struct DynamicTableFactoryInfo {
/// An array for holding the list of Standard ACPI Table Generators. /// An array for holding the list of Standard ACPI Table Generators.
CONST ACPI_TABLE_GENERATOR * CONST ACPI_TABLE_GENERATOR *
StdAcpiTableGeneratorList[EStdAcpiTableIdMax]; StdAcpiTableGeneratorList[EStdAcpiTableIdMax];
/// An array for holding the list of Custom ACPI Table Generators. /// An array for holding the list of Custom ACPI Table Generators.
CONST ACPI_TABLE_GENERATOR * CONST ACPI_TABLE_GENERATOR *
CustomAcpiTableGeneratorList[FixedPcdGet16 ( CustomAcpiTableGeneratorList[FixedPcdGet16 (
PcdMaxCustomACPIGenerators PcdMaxCustomACPIGenerators
)]; )];
/// An array for holding the list of Standard SMBIOS Table Generators. /// An array for holding the list of Standard SMBIOS Table Generators.
CONST SMBIOS_TABLE_GENERATOR * CONST SMBIOS_TABLE_GENERATOR *
StdSmbiosTableGeneratorList[EStdSmbiosTableIdMax]; StdSmbiosTableGeneratorList[EStdSmbiosTableIdMax];
/// An array for holding the list of Custom SMBIOS Table Generators. /// An array for holding the list of Custom SMBIOS Table Generators.
CONST SMBIOS_TABLE_GENERATOR * CONST SMBIOS_TABLE_GENERATOR *
CustomSmbiosTableGeneratorList[FixedPcdGet16 ( CustomSmbiosTableGeneratorList[FixedPcdGet16 (
PcdMaxCustomSMBIOSGenerators PcdMaxCustomSMBIOSGenerators
)]; )];
/// An array for holding the list of Standard DT Table Generators. /// An array for holding the list of Standard DT Table Generators.
CONST DT_TABLE_GENERATOR * CONST DT_TABLE_GENERATOR *
StdDtTableGeneratorList[EStdDtTableIdMax]; StdDtTableGeneratorList[EStdDtTableIdMax];
/// An array for holding the list of Custom DT Table Generators. /// An array for holding the list of Custom DT Table Generators.
CONST DT_TABLE_GENERATOR * CONST DT_TABLE_GENERATOR *
CustomDtTableGeneratorList[FixedPcdGet16 ( CustomDtTableGeneratorList[FixedPcdGet16 (
PcdMaxCustomDTGenerators PcdMaxCustomDTGenerators
)]; )];
} EDKII_DYNAMIC_TABLE_FACTORY_INFO; } EDKII_DYNAMIC_TABLE_FACTORY_INFO;
/** Return a pointer to the ACPI table generator. /** Return a pointer to the ACPI table generator.
@ -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

@ -27,14 +27,14 @@
/** The Dynamic Table Factory protocol structure that holds the /** The Dynamic Table Factory protocol structure that holds the
list of registered ACPI and SMBIOS table generators. list of registered ACPI and SMBIOS table generators.
*/ */
EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo; EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
/** A structure describing the Dynamic Table Factory protocol. /** A structure describing the Dynamic Table Factory protocol.
*/ */
STATIC STATIC
CONST CONST
EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = { EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
CREATE_REVISION (1, 0), CREATE_REVISION (1, 0),
GetAcpiTableGenerator, GetAcpiTableGenerator,
RegisterAcpiTableGenerator, RegisterAcpiTableGenerator,
DeregisterAcpiTableGenerator, DeregisterAcpiTableGenerator,
@ -60,8 +60,8 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
EFI_STATUS 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

@ -22,7 +22,7 @@
#include "DynamicTableFactory.h" #include "DynamicTableFactory.h"
extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo; extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
/** Return a pointer to the SMBIOS table generator. /** Return a pointer to the SMBIOS table generator.
@ -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);
@ -63,12 +63,13 @@ GetSmbiosTableGenerator (
} }
*Generator = NULL; *Generator = NULL;
TableId = GET_TABLE_ID (GeneratorId); TableId = GET_TABLE_ID (GeneratorId);
if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) { if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
if (TableId >= EStdSmbiosTableIdMax) { if (TableId >= EStdSmbiosTableIdMax) {
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,25 +56,25 @@ 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;
Status = Generator->BuildAcpiTable ( Status = Generator->BuildAcpiTable (
Generator, Generator,
AcpiTableInfo, AcpiTableInfo,
CfgMgrProtocol, CfgMgrProtocol,
&AcpiTable &AcpiTable
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -122,11 +122,11 @@ exit_handler:
// Free any resources allocated for generating the tables. // Free any resources allocated for generating the tables.
if (Generator->FreeTableResources != NULL) { if (Generator->FreeTableResources != NULL) {
Status1 = Generator->FreeTableResources ( Status1 = Generator->FreeTableResources (
Generator, Generator,
AcpiTableInfo, AcpiTableInfo,
CfgMgrProtocol, CfgMgrProtocol,
&AcpiTable &AcpiTable
); );
if (EFI_ERROR (Status1)) { if (EFI_ERROR (Status1)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -142,6 +142,7 @@ exit_handler:
Status = Status1; Status = Status1;
} }
} }
return Status; return Status;
} }
@ -170,29 +171,29 @@ 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;
AcpiTable = NULL; AcpiTable = NULL;
TableCount = 0; TableCount = 0;
Status = Generator->BuildAcpiTableEx ( Status = Generator->BuildAcpiTableEx (
Generator, Generator,
AcpiTableInfo, AcpiTableInfo,
CfgMgrProtocol, CfgMgrProtocol,
&AcpiTable, &AcpiTable,
&TableCount &TableCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -241,12 +242,12 @@ exit_handler:
// Free any resources allocated for generating the tables. // Free any resources allocated for generating the tables.
if (Generator->FreeTableResourcesEx != NULL) { if (Generator->FreeTableResourcesEx != NULL) {
Status1 = Generator->FreeTableResourcesEx ( Status1 = Generator->FreeTableResourcesEx (
Generator, Generator,
AcpiTableInfo, AcpiTableInfo,
CfgMgrProtocol, CfgMgrProtocol,
&AcpiTable, &AcpiTable,
TableCount TableCount
); );
if (EFI_ERROR (Status1)) { if (EFI_ERROR (Status1)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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);
@ -312,11 +314,11 @@ BuildAndInstallAcpiTable (
)); ));
Generator = NULL; Generator = NULL;
Status = TableFactoryProtocol->GetAcpiTableGenerator ( Status = TableFactoryProtocol->GetAcpiTableGenerator (
TableFactoryProtocol, TableFactoryProtocol,
AcpiTableInfo->TableGeneratorId, AcpiTableInfo->TableGeneratorId,
&Generator &Generator
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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
) )
{ {
@ -410,7 +412,7 @@ VerifyMandatoryTablesArePresent (
BOOLEAN Dbg2Found; BOOLEAN Dbg2Found;
BOOLEAN SpcrFound; BOOLEAN SpcrFound;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
FadtFound = FALSE; FadtFound = FALSE;
MadtFound = FALSE; MadtFound = FALSE;
GtdtFound = FALSE; GtdtFound = FALSE;
@ -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,15 +496,15 @@ 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;
ASSERT (TableFactoryProtocol != NULL); ASSERT (TableFactoryProtocol != NULL);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -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,16 +605,18 @@ 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;
} }
// Skip the Reserved table Generator ID for standard generators // Skip the Reserved table Generator ID for standard generators
if ((IS_GENERATOR_NAMESPACE_STD (AcpiTableInfo[Idx].TableGeneratorId)) && if ((IS_GENERATOR_NAMESPACE_STD (AcpiTableInfo[Idx].TableGeneratorId)) &&
((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",
@ -655,20 +667,20 @@ ProcessAcpiTables (
EFI_STATUS 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

@ -160,7 +160,7 @@ typedef enum StdAcpiTableId {
@param [in] Type The ACPI table structure. @param [in] Type The ACPI table structure.
@param [in] Revision The ACPI table revision. @param [in] Revision The ACPI table revision.
**/ **/
#define ACPI_HEADER(Signature, Type, Revision) { \ #define ACPI_HEADER(Signature, Type, Revision) { \
Signature, /* UINT32 Signature */ \ Signature, /* UINT32 Signature */ \
sizeof (Type), /* UINT32 Length */ \ sizeof (Type), /* UINT32 Length */ \
Revision, /* UINT8 Revision */ \ Revision, /* UINT8 Revision */ \
@ -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
); );
@ -293,42 +293,42 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
**/ **/
typedef struct AcpiTableGenerator { typedef struct AcpiTableGenerator {
/// The ACPI table generator ID. /// The ACPI table generator ID.
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;
/// The ACPI table revision. /// The ACPI table revision.
UINT8 AcpiTableRevision; UINT8 AcpiTableRevision;
/// The minimum supported ACPI table revision. /// The minimum supported ACPI table revision.
UINT8 MinAcpiTableRevision; UINT8 MinAcpiTableRevision;
/// The ACPI table creator ID. /// The ACPI table creator ID.
UINT32 CreatorId; UINT32 CreatorId;
/// The ACPI table creator revision. /// The ACPI table creator revision.
UINT32 CreatorRevision; UINT32 CreatorRevision;
/// ACPI table build function pointer. /// ACPI table build function pointer.
ACPI_TABLE_GENERATOR_BUILD_TABLE BuildAcpiTable; ACPI_TABLE_GENERATOR_BUILD_TABLE BuildAcpiTable;
/** The function to free any resources /** The function to free any resources
allocated for building the ACPI table. allocated for building the ACPI table.
*/ */
ACPI_TABLE_GENERATOR_FREE_TABLE FreeTableResources; ACPI_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
/// ACPI table extended build function pointer. /// ACPI table extended build function pointer.
ACPI_TABLE_GENERATOR_BUILD_TABLEEX BuildAcpiTableEx; ACPI_TABLE_GENERATOR_BUILD_TABLEEX BuildAcpiTableEx;
/** The function to free any resources /** The function to free any resources
allocated for building the ACPI table allocated for building the ACPI table
using the extended interface. using the extended interface.
*/ */
ACPI_TABLE_GENERATOR_FREE_TABLEEX FreeTableResourcesEx; ACPI_TABLE_GENERATOR_FREE_TABLEEX FreeTableResourcesEx;
} ACPI_TABLE_GENERATOR; } ACPI_TABLE_GENERATOR;
/** Register ACPI table factory generator. /** Register ACPI table factory generator.
@ -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

@ -71,7 +71,7 @@ typedef struct CmArmBootArchInfo {
/** This is the ARM_BOOT_ARCH flags field of the FADT Table /** This is the ARM_BOOT_ARCH flags field of the FADT Table
described in the ACPI Table Specification. described in the ACPI Table Specification.
*/ */
UINT16 BootArchFlags; UINT16 BootArchFlags;
} CM_ARM_BOOT_ARCH_INFO; } CM_ARM_BOOT_ARCH_INFO;
/** A structure that describes the /** A structure that describes the
@ -83,7 +83,7 @@ typedef struct CmArmPowerManagementProfileInfo {
/** This is the Preferred_PM_Profile field of the FADT Table /** This is the Preferred_PM_Profile field of the FADT Table
described in the ACPI Specification described in the ACPI Specification
*/ */
UINT8 PowerManagementProfile; UINT8 PowerManagementProfile;
} CM_ARM_POWER_MANAGEMENT_PROFILE_INFO; } CM_ARM_POWER_MANAGEMENT_PROFILE_INFO;
/** A structure that describes the /** A structure that describes the
@ -93,99 +93,99 @@ typedef struct CmArmPowerManagementProfileInfo {
*/ */
typedef struct CmArmGicCInfo { typedef struct CmArmGicCInfo {
/// The GIC CPU Interface number. /// The GIC CPU Interface number.
UINT32 CPUInterfaceNumber; UINT32 CPUInterfaceNumber;
/** The ACPI Processor UID. This must match the /** The ACPI Processor UID. This must match the
_UID of the CPU Device object information described _UID of the CPU Device object information described
in the DSDT/SSDT for the CPU. in the DSDT/SSDT for the CPU.
*/ */
UINT32 AcpiProcessorUid; UINT32 AcpiProcessorUid;
/** The flags field as described by the GICC structure /** The flags field as described by the GICC structure
in the ACPI Specification. in the ACPI Specification.
*/ */
UINT32 Flags; UINT32 Flags;
/** The parking protocol version field as described by /** The parking protocol version field as described by
the GICC structure in the ACPI Specification. the GICC structure in the ACPI Specification.
*/ */
UINT32 ParkingProtocolVersion; UINT32 ParkingProtocolVersion;
/** The Performance Interrupt field as described by /** The Performance Interrupt field as described by
the GICC structure in the ACPI Specification. the GICC structure in the ACPI Specification.
*/ */
UINT32 PerformanceInterruptGsiv; UINT32 PerformanceInterruptGsiv;
/** The CPU Parked address field as described by /** The CPU Parked address field as described by
the GICC structure in the ACPI Specification. the GICC structure in the ACPI Specification.
*/ */
UINT64 ParkedAddress; UINT64 ParkedAddress;
/** The base address for the GIC CPU Interface /** The base address for the GIC CPU Interface
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT64 PhysicalBaseAddress; UINT64 PhysicalBaseAddress;
/** The base address for GICV interface /** The base address for GICV interface
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT64 GICV; UINT64 GICV;
/** The base address for GICH interface /** The base address for GICH interface
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT64 GICH; UINT64 GICH;
/** The GICV maintenance interrupt /** The GICV maintenance interrupt
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT32 VGICMaintenanceInterrupt; UINT32 VGICMaintenanceInterrupt;
/** The base address for GICR interface /** The base address for GICR interface
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT64 GICRBaseAddress; UINT64 GICRBaseAddress;
/** The MPIDR for the CPU /** The MPIDR for the CPU
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT64 MPIDR; UINT64 MPIDR;
/** The Processor Power Efficiency class /** The Processor Power Efficiency class
as described by the GICC structure in the as described by the GICC structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT8 ProcessorPowerEfficiencyClass; UINT8 ProcessorPowerEfficiencyClass;
/** Statistical Profiling Extension buffer overflow GSIV. Zero if /** Statistical Profiling Extension buffer overflow GSIV. Zero if
unsupported by this processor. This field was introduced in unsupported by this processor. This field was introduced in
ACPI 6.3 (MADT revision 5) and is therefore ignored when ACPI 6.3 (MADT revision 5) and is therefore ignored when
generating MADT revision 4 or lower. generating MADT revision 4 or lower.
*/ */
UINT16 SpeOverflowInterrupt; UINT16 SpeOverflowInterrupt;
/** The proximity domain to which the logical processor belongs. /** The proximity domain to which the logical processor belongs.
This field is used to populate the GICC affinity structure This field is used to populate the GICC affinity structure
in the SRAT table. in the SRAT table.
*/ */
UINT32 ProximityDomain; UINT32 ProximityDomain;
/** The clock domain to which the logical processor belongs. /** The clock domain to which the logical processor belongs.
This field is used to populate the GICC affinity structure This field is used to populate the GICC affinity structure
in the SRAT table. in the SRAT table.
*/ */
UINT32 ClockDomain; UINT32 ClockDomain;
/** The GICC Affinity flags field as described by the GICC Affinity structure /** The GICC Affinity flags field as described by the GICC Affinity structure
in the SRAT table. in the SRAT table.
*/ */
UINT32 AffinityFlags; UINT32 AffinityFlags;
} CM_ARM_GICC_INFO; } CM_ARM_GICC_INFO;
/** A structure that describes the /** A structure that describes the
@ -195,19 +195,19 @@ typedef struct CmArmGicCInfo {
*/ */
typedef struct CmArmGicDInfo { typedef struct CmArmGicDInfo {
/// The Physical Base address for the GIC Distributor. /// The Physical Base address for the GIC Distributor.
UINT64 PhysicalBaseAddress; UINT64 PhysicalBaseAddress;
/** The global system interrupt /** The global system interrupt
number where this GIC Distributor's number where this GIC Distributor's
interrupt inputs start. interrupt inputs start.
*/ */
UINT32 SystemVectorBase; UINT32 SystemVectorBase;
/** The GIC version as described /** The GIC version as described
by the GICD structure in the by the GICD structure in the
ACPI Specification. ACPI Specification.
*/ */
UINT8 GicVersion; UINT8 GicVersion;
} CM_ARM_GICD_INFO; } CM_ARM_GICD_INFO;
/** A structure that describes the /** A structure that describes the
@ -217,22 +217,22 @@ typedef struct CmArmGicDInfo {
*/ */
typedef struct CmArmGicMsiFrameInfo { typedef struct CmArmGicMsiFrameInfo {
/// The GIC MSI Frame ID /// The GIC MSI Frame ID
UINT32 GicMsiFrameId; UINT32 GicMsiFrameId;
/// The Physical base address for the MSI Frame /// The Physical base address for the MSI Frame
UINT64 PhysicalBaseAddress; UINT64 PhysicalBaseAddress;
/** The GIC MSI Frame flags /** The GIC MSI Frame flags
as described by the GIC MSI frame as described by the GIC MSI frame
structure in the ACPI Specification. structure in the ACPI Specification.
*/ */
UINT32 Flags; UINT32 Flags;
/// SPI Count used by this frame /// SPI Count used by this frame
UINT16 SPICount; UINT16 SPICount;
/// SPI Base used by this frame /// SPI Base used by this frame
UINT16 SPIBase; UINT16 SPIBase;
} CM_ARM_GIC_MSI_FRAME_INFO; } CM_ARM_GIC_MSI_FRAME_INFO;
/** A structure that describes the /** A structure that describes the
@ -244,10 +244,10 @@ typedef struct CmArmGicRedistInfo {
/** The physical address of a page range /** The physical address of a page range
containing all GIC Redistributors. containing all GIC Redistributors.
*/ */
UINT64 DiscoveryRangeBaseAddress; UINT64 DiscoveryRangeBaseAddress;
/// Length of the GIC Redistributor Discovery page range /// Length of the GIC Redistributor Discovery page range
UINT32 DiscoveryRangeLength; UINT32 DiscoveryRangeLength;
} CM_ARM_GIC_REDIST_INFO; } CM_ARM_GIC_REDIST_INFO;
/** A structure that describes the /** A structure that describes the
@ -257,16 +257,16 @@ typedef struct CmArmGicRedistInfo {
*/ */
typedef struct CmArmGicItsInfo { typedef struct CmArmGicItsInfo {
/// The GIC ITS ID /// The GIC ITS ID
UINT32 GicItsId; UINT32 GicItsId;
/// The physical address for the Interrupt Translation Service /// The physical address for the Interrupt Translation Service
UINT64 PhysicalBaseAddress; UINT64 PhysicalBaseAddress;
/** The proximity domain to which the logical processor belongs. /** The proximity domain to which the logical processor belongs.
This field is used to populate the GIC ITS affinity structure This field is used to populate the GIC ITS affinity structure
in the SRAT table. in the SRAT table.
*/ */
UINT32 ProximityDomain; UINT32 ProximityDomain;
} CM_ARM_GIC_ITS_INFO; } CM_ARM_GIC_ITS_INFO;
/** A structure that describes the /** A structure that describes the
@ -278,25 +278,25 @@ typedef struct CmArmGicItsInfo {
*/ */
typedef struct CmArmSerialPortInfo { typedef struct CmArmSerialPortInfo {
/// The physical base address for the serial port /// The physical base address for the serial port
UINT64 BaseAddress; UINT64 BaseAddress;
/// The serial port interrupt /// The serial port interrupt
UINT32 Interrupt; UINT32 Interrupt;
/// The serial port baud rate /// The serial port baud rate
UINT64 BaudRate; UINT64 BaudRate;
/// The serial port clock /// The serial port clock
UINT32 Clock; UINT32 Clock;
/// Serial Port subtype /// Serial Port subtype
UINT16 PortSubtype; UINT16 PortSubtype;
/// The Base address length /// The Base address length
UINT64 BaseAddressLength; UINT64 BaseAddressLength;
/// The access size /// The access size
UINT8 AccessSize; UINT8 AccessSize;
} CM_ARM_SERIAL_PORT_INFO; } CM_ARM_SERIAL_PORT_INFO;
/** A structure that describes the /** A structure that describes the
@ -306,40 +306,40 @@ typedef struct CmArmSerialPortInfo {
*/ */
typedef struct CmArmGenericTimerInfo { typedef struct CmArmGenericTimerInfo {
/// The physical base address for the counter control frame /// The physical base address for the counter control frame
UINT64 CounterControlBaseAddress; UINT64 CounterControlBaseAddress;
/// The physical base address for the counter read frame /// The physical base address for the counter read frame
UINT64 CounterReadBaseAddress; UINT64 CounterReadBaseAddress;
/// The secure PL1 timer interrupt /// The secure PL1 timer interrupt
UINT32 SecurePL1TimerGSIV; UINT32 SecurePL1TimerGSIV;
/// The secure PL1 timer flags /// The secure PL1 timer flags
UINT32 SecurePL1TimerFlags; UINT32 SecurePL1TimerFlags;
/// The non-secure PL1 timer interrupt /// The non-secure PL1 timer interrupt
UINT32 NonSecurePL1TimerGSIV; UINT32 NonSecurePL1TimerGSIV;
/// The non-secure PL1 timer flags /// The non-secure PL1 timer flags
UINT32 NonSecurePL1TimerFlags; UINT32 NonSecurePL1TimerFlags;
/// The virtual timer interrupt /// The virtual timer interrupt
UINT32 VirtualTimerGSIV; UINT32 VirtualTimerGSIV;
/// The virtual timer flags /// The virtual timer flags
UINT32 VirtualTimerFlags; UINT32 VirtualTimerFlags;
/// The non-secure PL2 timer interrupt /// The non-secure PL2 timer interrupt
UINT32 NonSecurePL2TimerGSIV; UINT32 NonSecurePL2TimerGSIV;
/// The non-secure PL2 timer flags /// The non-secure PL2 timer flags
UINT32 NonSecurePL2TimerFlags; UINT32 NonSecurePL2TimerFlags;
/// GSIV for the virtual EL2 timer /// GSIV for the virtual EL2 timer
UINT32 VirtualPL2TimerGSIV; UINT32 VirtualPL2TimerGSIV;
/// Flags for the virtual EL2 timer /// Flags for the virtual EL2 timer
UINT32 VirtualPL2TimerFlags; UINT32 VirtualPL2TimerFlags;
} CM_ARM_GENERIC_TIMER_INFO; } CM_ARM_GENERIC_TIMER_INFO;
/** A structure that describes the /** A structure that describes the
@ -349,34 +349,34 @@ typedef struct CmArmGenericTimerInfo {
*/ */
typedef struct CmArmGTBlockTimerFrameInfo { typedef struct CmArmGTBlockTimerFrameInfo {
/// The Generic Timer frame number /// The Generic Timer frame number
UINT8 FrameNumber; UINT8 FrameNumber;
/// The physical base address for the CntBase block /// The physical base address for the CntBase block
UINT64 PhysicalAddressCntBase; UINT64 PhysicalAddressCntBase;
/// The physical base address for the CntEL0Base block /// The physical base address for the CntEL0Base block
UINT64 PhysicalAddressCntEL0Base; UINT64 PhysicalAddressCntEL0Base;
/// The physical timer interrupt /// The physical timer interrupt
UINT32 PhysicalTimerGSIV; UINT32 PhysicalTimerGSIV;
/** The physical timer flags as described by the GT Block /** The physical timer flags as described by the GT Block
Timer frame Structure in the ACPI Specification. Timer frame Structure in the ACPI Specification.
*/ */
UINT32 PhysicalTimerFlags; UINT32 PhysicalTimerFlags;
/// The virtual timer interrupt /// The virtual timer interrupt
UINT32 VirtualTimerGSIV; UINT32 VirtualTimerGSIV;
/** The virtual timer flags as described by the GT Block /** The virtual timer flags as described by the GT Block
Timer frame Structure in the ACPI Specification. Timer frame Structure in the ACPI Specification.
*/ */
UINT32 VirtualTimerFlags; UINT32 VirtualTimerFlags;
/** The common timer flags as described by the GT Block /** The common timer flags as described by the GT Block
Timer frame Structure in the ACPI Specification. Timer frame Structure in the ACPI Specification.
*/ */
UINT32 CommonFlags; UINT32 CommonFlags;
} CM_ARM_GTBLOCK_TIMER_FRAME_INFO; } CM_ARM_GTBLOCK_TIMER_FRAME_INFO;
/** A structure that describes the /** A structure that describes the
@ -386,13 +386,13 @@ typedef struct CmArmGTBlockTimerFrameInfo {
*/ */
typedef struct CmArmGTBlockInfo { typedef struct CmArmGTBlockInfo {
/// The physical base address for the GT Block Timer structure /// The physical base address for the GT Block Timer structure
UINT64 GTBlockPhysicalAddress; UINT64 GTBlockPhysicalAddress;
/// The number of timer frames implemented in the GT Block /// The number of timer frames implemented in the GT Block
UINT32 GTBlockTimerFrameCount; UINT32 GTBlockTimerFrameCount;
/// Reference token for the GT Block timer frame list /// Reference token for the GT Block timer frame list
CM_OBJECT_TOKEN GTBlockTimerFrameToken; CM_OBJECT_TOKEN GTBlockTimerFrameToken;
} CM_ARM_GTBLOCK_INFO; } CM_ARM_GTBLOCK_INFO;
/** A structure that describes the /** A structure that describes the
@ -402,18 +402,18 @@ typedef struct CmArmGTBlockInfo {
*/ */
typedef struct CmArmGenericWatchdogInfo { typedef struct CmArmGenericWatchdogInfo {
/// The physical base address of the Arm Watchdog control frame /// The physical base address of the Arm Watchdog control frame
UINT64 ControlFrameAddress; UINT64 ControlFrameAddress;
/// The physical base address of the Arm Watchdog refresh frame /// The physical base address of the Arm Watchdog refresh frame
UINT64 RefreshFrameAddress; UINT64 RefreshFrameAddress;
/// The watchdog interrupt /// The watchdog interrupt
UINT32 TimerGSIV; UINT32 TimerGSIV;
/** The flags for the watchdog as described by the Arm watchdog /** The flags for the watchdog as described by the Arm watchdog
structure in the ACPI specification. structure in the ACPI specification.
*/ */
UINT32 Flags; UINT32 Flags;
} CM_ARM_GENERIC_WATCHDOG_INFO; } CM_ARM_GENERIC_WATCHDOG_INFO;
/** A structure that describes the /** A structure that describes the
@ -423,16 +423,16 @@ typedef struct CmArmGenericWatchdogInfo {
*/ */
typedef struct CmArmPciConfigSpaceInfo { typedef struct CmArmPciConfigSpaceInfo {
/// The physical base address for the PCI segment /// The physical base address for the PCI segment
UINT64 BaseAddress; UINT64 BaseAddress;
/// The PCI segment group number /// The PCI segment group number
UINT16 PciSegmentGroupNumber; UINT16 PciSegmentGroupNumber;
/// The start bus number /// The start bus number
UINT8 StartBusNumber; UINT8 StartBusNumber;
/// The end bus number /// The end bus number
UINT8 EndBusNumber; UINT8 EndBusNumber;
} CM_ARM_PCI_CONFIG_SPACE_INFO; } CM_ARM_PCI_CONFIG_SPACE_INFO;
/** A structure that describes the /** A structure that describes the
@ -442,7 +442,7 @@ typedef struct CmArmPciConfigSpaceInfo {
*/ */
typedef struct CmArmHypervisorVendorId { typedef struct CmArmHypervisorVendorId {
/// The hypervisor Vendor ID /// The hypervisor Vendor ID
UINT64 HypervisorVendorId; UINT64 HypervisorVendorId;
} CM_ARM_HYPERVISOR_VENDOR_ID; } CM_ARM_HYPERVISOR_VENDOR_ID;
/** A structure that describes the /** A structure that describes the
@ -452,7 +452,7 @@ typedef struct CmArmHypervisorVendorId {
*/ */
typedef struct CmArmFixedFeatureFlags { typedef struct CmArmFixedFeatureFlags {
/// The Fixed feature flags /// The Fixed feature flags
UINT32 Flags; UINT32 Flags;
} CM_ARM_FIXED_FEATURE_FLAGS; } CM_ARM_FIXED_FEATURE_FLAGS;
/** A structure that describes the /** A structure that describes the
@ -462,11 +462,11 @@ typedef struct CmArmFixedFeatureFlags {
*/ */
typedef struct CmArmItsGroupNode { typedef struct CmArmItsGroupNode {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// The number of ITS identifiers in the ITS node /// The number of ITS identifiers in the ITS node
UINT32 ItsIdCount; UINT32 ItsIdCount;
/// Reference token for the ITS identifier array /// Reference token for the ITS identifier array
CM_OBJECT_TOKEN ItsIdToken; CM_OBJECT_TOKEN ItsIdToken;
} CM_ARM_ITS_GROUP_NODE; } CM_ARM_ITS_GROUP_NODE;
/** A structure that describes the /** A structure that describes the
@ -476,28 +476,29 @@ typedef struct CmArmItsGroupNode {
*/ */
typedef struct CmArmNamedComponentNode { typedef struct CmArmNamedComponentNode {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Number of ID mappings /// Number of ID mappings
UINT32 IdMappingCount; UINT32 IdMappingCount;
/// Reference token for the ID mapping array /// Reference token for the ID mapping array
CM_OBJECT_TOKEN IdMappingToken; CM_OBJECT_TOKEN IdMappingToken;
/// Flags for the named component /// Flags for the named component
UINT32 Flags; UINT32 Flags;
/// Memory access properties : Cache coherent attributes /// Memory access properties : Cache coherent attributes
UINT32 CacheCoherent; UINT32 CacheCoherent;
/// Memory access properties : Allocation hints /// Memory access properties : Allocation hints
UINT8 AllocationHints; UINT8 AllocationHints;
/// Memory access properties : Memory access flags /// Memory access properties : Memory access flags
UINT8 MemoryAccessFlags; UINT8 MemoryAccessFlags;
/// 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
@ -507,25 +508,25 @@ typedef struct CmArmNamedComponentNode {
*/ */
typedef struct CmArmRootComplexNode { typedef struct CmArmRootComplexNode {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Number of ID mappings /// Number of ID mappings
UINT32 IdMappingCount; UINT32 IdMappingCount;
/// Reference token for the ID mapping array /// Reference token for the ID mapping array
CM_OBJECT_TOKEN IdMappingToken; CM_OBJECT_TOKEN IdMappingToken;
/// Memory access properties : Cache coherent attributes /// Memory access properties : Cache coherent attributes
UINT32 CacheCoherent; UINT32 CacheCoherent;
/// Memory access properties : Allocation hints /// Memory access properties : Allocation hints
UINT8 AllocationHints; UINT8 AllocationHints;
/// Memory access properties : Memory access flags /// Memory access properties : Memory access flags
UINT8 MemoryAccessFlags; UINT8 MemoryAccessFlags;
/// ATS attributes /// ATS attributes
UINT32 AtsAttribute; UINT32 AtsAttribute;
/// PCI segment number /// PCI segment number
UINT32 PciSegmentNumber; UINT32 PciSegmentNumber;
/// Memory address size limit /// Memory address size limit
UINT8 MemoryAddressSize; UINT8 MemoryAddressSize;
} CM_ARM_ROOT_COMPLEX_NODE; } CM_ARM_ROOT_COMPLEX_NODE;
/** A structure that describes the /** A structure that describes the
@ -535,39 +536,39 @@ typedef struct CmArmRootComplexNode {
*/ */
typedef struct CmArmSmmuV1SmmuV2Node { typedef struct CmArmSmmuV1SmmuV2Node {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Number of ID mappings /// Number of ID mappings
UINT32 IdMappingCount; UINT32 IdMappingCount;
/// Reference token for the ID mapping array /// Reference token for the ID mapping array
CM_OBJECT_TOKEN IdMappingToken; CM_OBJECT_TOKEN IdMappingToken;
/// SMMU Base Address /// SMMU Base Address
UINT64 BaseAddress; UINT64 BaseAddress;
/// Length of the memory range covered by the SMMU /// Length of the memory range covered by the SMMU
UINT64 Span; UINT64 Span;
/// SMMU Model /// SMMU Model
UINT32 Model; UINT32 Model;
/// SMMU flags /// SMMU flags
UINT32 Flags; UINT32 Flags;
/// Number of context interrupts /// Number of context interrupts
UINT32 ContextInterruptCount; UINT32 ContextInterruptCount;
/// Reference token for the context interrupt array /// Reference token for the context interrupt array
CM_OBJECT_TOKEN ContextInterruptToken; CM_OBJECT_TOKEN ContextInterruptToken;
/// Number of PMU interrupts /// Number of PMU interrupts
UINT32 PmuInterruptCount; UINT32 PmuInterruptCount;
/// Reference token for the PMU interrupt array /// Reference token for the PMU interrupt array
CM_OBJECT_TOKEN PmuInterruptToken; CM_OBJECT_TOKEN PmuInterruptToken;
/// GSIV of the SMMU_NSgIrpt interrupt /// GSIV of the SMMU_NSgIrpt interrupt
UINT32 SMMU_NSgIrpt; UINT32 SMMU_NSgIrpt;
/// SMMU_NSgIrpt interrupt flags /// SMMU_NSgIrpt interrupt flags
UINT32 SMMU_NSgIrptFlags; UINT32 SMMU_NSgIrptFlags;
/// GSIV of the SMMU_NSgCfgIrpt interrupt /// GSIV of the SMMU_NSgCfgIrpt interrupt
UINT32 SMMU_NSgCfgIrpt; UINT32 SMMU_NSgCfgIrpt;
/// SMMU_NSgCfgIrpt interrupt flags /// SMMU_NSgCfgIrpt interrupt flags
UINT32 SMMU_NSgCfgIrptFlags; UINT32 SMMU_NSgCfgIrptFlags;
} CM_ARM_SMMUV1_SMMUV2_NODE; } CM_ARM_SMMUV1_SMMUV2_NODE;
/** A structure that describes the /** A structure that describes the
@ -577,33 +578,33 @@ typedef struct CmArmSmmuV1SmmuV2Node {
*/ */
typedef struct CmArmSmmuV3Node { typedef struct CmArmSmmuV3Node {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Number of ID mappings /// Number of ID mappings
UINT32 IdMappingCount; UINT32 IdMappingCount;
/// Reference token for the ID mapping array /// Reference token for the ID mapping array
CM_OBJECT_TOKEN IdMappingToken; CM_OBJECT_TOKEN IdMappingToken;
/// SMMU Base Address /// SMMU Base Address
UINT64 BaseAddress; UINT64 BaseAddress;
/// SMMU flags /// SMMU flags
UINT32 Flags; UINT32 Flags;
/// VATOS address /// VATOS address
UINT64 VatosAddress; UINT64 VatosAddress;
/// Model /// Model
UINT32 Model; UINT32 Model;
/// GSIV of the Event interrupt if SPI based /// GSIV of the Event interrupt if SPI based
UINT32 EventInterrupt; UINT32 EventInterrupt;
/// PRI Interrupt if SPI based /// PRI Interrupt if SPI based
UINT32 PriInterrupt; UINT32 PriInterrupt;
/// GERR interrupt if GSIV based /// GERR interrupt if GSIV based
UINT32 GerrInterrupt; UINT32 GerrInterrupt;
/// Sync interrupt if GSIV based /// Sync interrupt if GSIV based
UINT32 SyncInterrupt; UINT32 SyncInterrupt;
/// Proximity domain flag /// Proximity domain flag
UINT32 ProximityDomain; UINT32 ProximityDomain;
/// Index into the array of ID mapping /// Index into the array of ID mapping
UINT32 DeviceIdMappingIndex; UINT32 DeviceIdMappingIndex;
} CM_ARM_SMMUV3_NODE; } CM_ARM_SMMUV3_NODE;
/** A structure that describes the /** A structure that describes the
@ -613,21 +614,21 @@ typedef struct CmArmSmmuV3Node {
*/ */
typedef struct CmArmPmcgNode { typedef struct CmArmPmcgNode {
/// An unique token used to identify this object /// An unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Number of ID mappings /// Number of ID mappings
UINT32 IdMappingCount; UINT32 IdMappingCount;
/// Reference token for the ID mapping array /// Reference token for the ID mapping array
CM_OBJECT_TOKEN IdMappingToken; CM_OBJECT_TOKEN IdMappingToken;
/// Base Address for performance monitor counter group /// Base Address for performance monitor counter group
UINT64 BaseAddress; UINT64 BaseAddress;
/// GSIV for the Overflow interrupt /// GSIV for the Overflow interrupt
UINT32 OverflowInterrupt; UINT32 OverflowInterrupt;
/// Page 1 Base address /// Page 1 Base address
UINT64 Page1BaseAddress; UINT64 Page1BaseAddress;
/// Reference token for the IORT node associated with this node /// Reference token for the IORT node associated with this node
CM_OBJECT_TOKEN ReferenceToken; CM_OBJECT_TOKEN ReferenceToken;
} CM_ARM_PMCG_NODE; } CM_ARM_PMCG_NODE;
/** A structure that describes the /** A structure that describes the
@ -637,7 +638,7 @@ typedef struct CmArmPmcgNode {
*/ */
typedef struct CmArmGicItsIdentifier { typedef struct CmArmGicItsIdentifier {
/// The ITS Identifier /// The ITS Identifier
UINT32 ItsId; UINT32 ItsId;
} CM_ARM_ITS_IDENTIFIER; } CM_ARM_ITS_IDENTIFIER;
/** A structure that describes the /** A structure that describes the
@ -647,15 +648,15 @@ typedef struct CmArmGicItsIdentifier {
*/ */
typedef struct CmArmIdMapping { typedef struct CmArmIdMapping {
/// Input base /// Input base
UINT32 InputBase; UINT32 InputBase;
/// Number of input IDs /// Number of input IDs
UINT32 NumIds; UINT32 NumIds;
/// Output Base /// Output Base
UINT32 OutputBase; UINT32 OutputBase;
/// Reference token for the output node /// Reference token for the output node
CM_OBJECT_TOKEN OutputReferenceToken; CM_OBJECT_TOKEN OutputReferenceToken;
/// Flags /// Flags
UINT32 Flags; UINT32 Flags;
} CM_ARM_ID_MAPPING; } CM_ARM_ID_MAPPING;
/** A structure that describes the Arm /** A structure that describes the Arm
@ -694,28 +695,28 @@ typedef CM_ARM_GENERIC_INTERRUPT CM_ARM_EXTENDED_INTERRUPT;
*/ */
typedef struct CmArmProcHierarchyInfo { typedef struct CmArmProcHierarchyInfo {
/// A unique token used to identify this object /// A unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155) /// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155)
UINT32 Flags; UINT32 Flags;
/// Token for the parent CM_ARM_PROC_HIERARCHY_INFO object in the processor /// Token for the parent CM_ARM_PROC_HIERARCHY_INFO object in the processor
/// topology. A value of CM_NULL_TOKEN means this node has no parent. /// topology. A value of CM_NULL_TOKEN means this node has no parent.
CM_OBJECT_TOKEN ParentToken; CM_OBJECT_TOKEN ParentToken;
/// Token of the associated CM_ARM_GICC_INFO object which has the /// Token of the associated CM_ARM_GICC_INFO object which has the
/// corresponding ACPI Processor ID. A value of CM_NULL_TOKEN means this /// corresponding ACPI Processor ID. A value of CM_NULL_TOKEN means this
/// node represents a group of associated processors and it does not have an /// node represents a group of associated processors and it does not have an
/// associated GIC CPU interface. /// associated GIC CPU interface.
CM_OBJECT_TOKEN GicCToken; CM_OBJECT_TOKEN GicCToken;
/// Number of resources private to this Node /// Number of resources private to this Node
UINT32 NoOfPrivateResources; UINT32 NoOfPrivateResources;
/// Token of the array which contains references to the resources private to /// Token of the array which contains references to the resources private to
/// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if /// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if
/// the NoOfPrivateResources is 0, in which case it is recommended to set /// the NoOfPrivateResources is 0, in which case it is recommended to set
/// this field to CM_NULL_TOKEN. /// this field to CM_NULL_TOKEN.
CM_OBJECT_TOKEN PrivateResourcesArrayToken; CM_OBJECT_TOKEN PrivateResourcesArrayToken;
/// Optional field: Reference Token for the Lpi state of this processor. /// Optional field: Reference Token for the Lpi state of this processor.
/// Token identifying a CM_ARM_OBJ_REF structure, itself referencing /// Token identifying a CM_ARM_OBJ_REF structure, itself referencing
/// CM_ARM_LPI_INFO objects. /// CM_ARM_LPI_INFO objects.
CM_OBJECT_TOKEN LpiToken; CM_OBJECT_TOKEN LpiToken;
} CM_ARM_PROC_HIERARCHY_INFO; } CM_ARM_PROC_HIERARCHY_INFO;
/** A structure that describes the Cache Type Structure (Type 1) in PPTT /** A structure that describes the Cache Type Structure (Type 1) in PPTT
@ -724,26 +725,26 @@ typedef struct CmArmProcHierarchyInfo {
*/ */
typedef struct CmArmCacheInfo { typedef struct CmArmCacheInfo {
/// A unique token used to identify this object /// A unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
/// Reference token for the next level of cache that is private to the same /// Reference token for the next level of cache that is private to the same
/// CM_ARM_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN means this /// CM_ARM_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN means this
/// entry represents the last cache level appropriate to the processor /// entry represents the last cache level appropriate to the processor
/// hierarchy node structures using this entry. /// hierarchy node structures using this entry.
CM_OBJECT_TOKEN NextLevelOfCacheToken; CM_OBJECT_TOKEN NextLevelOfCacheToken;
/// Size of the cache in bytes /// Size of the cache in bytes
UINT32 Size; UINT32 Size;
/// Number of sets in the cache /// Number of sets in the cache
UINT32 NumberOfSets; UINT32 NumberOfSets;
/// Integer number of ways. The maximum associativity supported by /// Integer number of ways. The maximum associativity supported by
/// ACPI Cache type structure is limited to MAX_UINT8. However, /// ACPI Cache type structure is limited to MAX_UINT8. However,
/// the maximum number of ways supported by the architecture is /// the maximum number of ways supported by the architecture is
/// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field
/// is 32-bit wide. /// is 32-bit wide.
UINT32 Associativity; UINT32 Associativity;
/// Cache attributes (ACPI 6.3 - January 2019, PPTT, Table 5-156) /// Cache attributes (ACPI 6.3 - January 2019, PPTT, Table 5-156)
UINT8 Attributes; UINT8 Attributes;
/// Line size in bytes /// Line size in bytes
UINT16 LineSize; UINT16 LineSize;
} CM_ARM_CACHE_INFO; } CM_ARM_CACHE_INFO;
/** A structure that describes the ID Structure (Type 2) in PPTT /** A structure that describes the ID Structure (Type 2) in PPTT
@ -752,19 +753,19 @@ typedef struct CmArmCacheInfo {
*/ */
typedef struct CmArmProcNodeIdInfo { typedef struct CmArmProcNodeIdInfo {
/// A unique token used to identify this object /// A unique token used to identify this object
CM_OBJECT_TOKEN Token; CM_OBJECT_TOKEN Token;
// Vendor ID (as described in ACPI ID registry) // Vendor ID (as described in ACPI ID registry)
UINT32 VendorId; UINT32 VendorId;
/// First level unique node ID /// First level unique node ID
UINT64 Level1Id; UINT64 Level1Id;
/// Second level unique node ID /// Second level unique node ID
UINT64 Level2Id; UINT64 Level2Id;
/// Major revision of the node /// Major revision of the node
UINT16 MajorRev; UINT16 MajorRev;
/// Minor revision of the node /// Minor revision of the node
UINT16 MinorRev; UINT16 MinorRev;
/// Spin revision of the node /// Spin revision of the node
UINT16 SpinRev; UINT16 SpinRev;
} CM_ARM_PROC_NODE_ID_INFO; } CM_ARM_PROC_NODE_ID_INFO;
/** A structure that describes a reference to another Configuration Manager /** A structure that describes a reference to another Configuration Manager
@ -780,7 +781,7 @@ typedef struct CmArmProcNodeIdInfo {
*/ */
typedef struct CmArmObjRef { typedef struct CmArmObjRef {
/// Token of the CM object being referenced /// Token of the CM object being referenced
CM_OBJECT_TOKEN ReferenceToken; CM_OBJECT_TOKEN ReferenceToken;
} CM_ARM_OBJ_REF; } CM_ARM_OBJ_REF;
/** A structure that describes the Memory Affinity Structure (Type 1) in SRAT /** A structure that describes the Memory Affinity Structure (Type 1) in SRAT
@ -789,16 +790,16 @@ typedef struct CmArmObjRef {
*/ */
typedef struct CmArmMemoryAffinityInfo { typedef struct CmArmMemoryAffinityInfo {
/// The proximity domain to which the "range of memory" belongs. /// The proximity domain to which the "range of memory" belongs.
UINT32 ProximityDomain; UINT32 ProximityDomain;
/// Base Address /// Base Address
UINT64 BaseAddress; UINT64 BaseAddress;
/// Length /// Length
UINT64 Length; UINT64 Length;
/// Flags /// Flags
UINT32 Flags; UINT32 Flags;
} CM_ARM_MEMORY_AFFINITY_INFO; } CM_ARM_MEMORY_AFFINITY_INFO;
/** A structure that describes the ACPI Device Handle (Type 0) in the /** A structure that describes the ACPI Device Handle (Type 0) in the
@ -808,10 +809,10 @@ typedef struct CmArmMemoryAffinityInfo {
*/ */
typedef struct CmArmDeviceHandleAcpi { typedef struct CmArmDeviceHandleAcpi {
/// Hardware ID /// Hardware ID
UINT64 Hid; UINT64 Hid;
/// Unique Id /// Unique Id
UINT32 Uid; UINT32 Uid;
} CM_ARM_DEVICE_HANDLE_ACPI; } CM_ARM_DEVICE_HANDLE_ACPI;
/** A structure that describes the PCI Device Handle (Type 1) in the /** A structure that describes the PCI Device Handle (Type 1) in the
@ -821,16 +822,16 @@ typedef struct CmArmDeviceHandleAcpi {
*/ */
typedef struct CmArmDeviceHandlePci { typedef struct CmArmDeviceHandlePci {
/// PCI Segment Number /// PCI Segment Number
UINT16 SegmentNumber; UINT16 SegmentNumber;
/// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF) /// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
UINT8 BusNumber; UINT8 BusNumber;
/// PCI Device Number - Max 32 devices (Bits 7:3 of BDF) /// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
UINT8 DeviceNumber; UINT8 DeviceNumber;
/// PCI Function Number - Max 8 functions (Bits 2:0 of BDF) /// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
UINT8 FunctionNumber; UINT8 FunctionNumber;
} CM_ARM_DEVICE_HANDLE_PCI; } CM_ARM_DEVICE_HANDLE_PCI;
/** A structure that describes the Generic Initiator Affinity structure in SRAT /** A structure that describes the Generic Initiator Affinity structure in SRAT
@ -839,16 +840,16 @@ typedef struct CmArmDeviceHandlePci {
*/ */
typedef struct CmArmGenericInitiatorAffinityInfo { typedef struct CmArmGenericInitiatorAffinityInfo {
/// The proximity domain to which the generic initiator belongs. /// The proximity domain to which the generic initiator belongs.
UINT32 ProximityDomain; UINT32 ProximityDomain;
/// Flags /// Flags
UINT32 Flags; UINT32 Flags;
/// Device Handle Type /// Device Handle Type
UINT8 DeviceHandleType; UINT8 DeviceHandleType;
/// Reference Token for the Device Handle /// Reference Token for the Device Handle
CM_OBJECT_TOKEN DeviceHandleToken; CM_OBJECT_TOKEN DeviceHandleToken;
} CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO; } CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO;
/** A structure that describes the CMN-600 hardware. /** A structure that describes the CMN-600 hardware.
@ -858,19 +859,19 @@ typedef struct CmArmGenericInitiatorAffinityInfo {
typedef struct CmArmCmn600Info { typedef struct CmArmCmn600Info {
/// The PERIPHBASE address. /// The PERIPHBASE address.
/// Corresponds to the Configuration Node Region (CFGR) base address. /// Corresponds to the Configuration Node Region (CFGR) base address.
UINT64 PeriphBaseAddress; UINT64 PeriphBaseAddress;
/// The PERIPHBASE address length. /// The PERIPHBASE address length.
/// Corresponds to the CFGR base address length. /// Corresponds to the CFGR base address length.
UINT64 PeriphBaseAddressLength; UINT64 PeriphBaseAddressLength;
/// The ROOTNODEBASE address. /// The ROOTNODEBASE address.
/// Corresponds to the Root node (ROOT) base address. /// Corresponds to the Root node (ROOT) base address.
UINT64 RootNodeBaseAddress; UINT64 RootNodeBaseAddress;
/// The Debug and Trace Logic Controller (DTC) count. /// The Debug and Trace Logic Controller (DTC) count.
/// CMN-600 can have maximum 4 DTCs. /// CMN-600 can have maximum 4 DTCs.
UINT8 DtcCount; UINT8 DtcCount;
/// DTC Interrupt list. /// DTC Interrupt list.
/// The first interrupt resource descriptor pertains to /// The first interrupt resource descriptor pertains to
@ -880,7 +881,7 @@ typedef struct CmArmCmn600Info {
/// and DtcInterrupt[3] are ignored. /// and DtcInterrupt[3] are ignored.
/// Note: The size of CM_ARM_CMN_600_INFO structure remains /// Note: The size of CM_ARM_CMN_600_INFO structure remains
/// constant and does not vary with the DTC count. /// constant and does not vary with the DTC count.
CM_ARM_EXTENDED_INTERRUPT DtcInterrupt[4]; CM_ARM_EXTENDED_INTERRUPT DtcInterrupt[4];
} CM_ARM_CMN_600_INFO; } CM_ARM_CMN_600_INFO;
/** A structure that describes the Lpi information. /** A structure that describes the Lpi information.
@ -894,28 +895,28 @@ typedef struct CmArmLpiInfo {
/** Minimum Residency. Time in microseconds after which a /** Minimum Residency. Time in microseconds after which a
state becomes more energy efficient than any shallower state. state becomes more energy efficient than any shallower state.
*/ */
UINT32 MinResidency; UINT32 MinResidency;
/** Worst case time in microseconds from a wake interrupt /** Worst case time in microseconds from a wake interrupt
being asserted to the return to a running state being asserted to the return to a running state
*/ */
UINT32 WorstCaseWakeLatency; UINT32 WorstCaseWakeLatency;
/** Flags. /** Flags.
*/ */
UINT32 Flags; UINT32 Flags;
/** Architecture specific context loss flags. /** Architecture specific context loss flags.
*/ */
UINT32 ArchFlags; UINT32 ArchFlags;
/** Residency counter frequency in cycles-per-second (Hz). /** Residency counter frequency in cycles-per-second (Hz).
*/ */
UINT32 ResCntFreq; UINT32 ResCntFreq;
/** Every shallower power state in the parent is also enabled. /** Every shallower power state in the parent is also enabled.
*/ */
UINT32 EnableParentState; UINT32 EnableParentState;
/** The EntryMethod _LPI field can be described as an integer /** The EntryMethod _LPI field can be described as an integer
or in a Register resource data descriptor. or in a Register resource data descriptor.
@ -923,27 +924,27 @@ typedef struct CmArmLpiInfo {
If IsInteger is TRUE, the IntegerEntryMethod field is used. If IsInteger is TRUE, the IntegerEntryMethod field is used.
If IsInteger is FALSE, the RegisterEntryMethod field is used. If IsInteger is FALSE, the RegisterEntryMethod field is used.
*/ */
BOOLEAN IsInteger; BOOLEAN IsInteger;
/** EntryMethod described as an Integer. /** EntryMethod described as an Integer.
*/ */
UINT64 IntegerEntryMethod; UINT64 IntegerEntryMethod;
/** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR. /** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
*/ */
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod; EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod;
/** Residency counter register. /** Residency counter register.
*/ */
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister; EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister;
/** Usage counter register. /** Usage counter register.
*/ */
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister; EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister;
/** String representing the Lpi state /** String representing the Lpi state
*/ */
CHAR8 StateName[16]; CHAR8 StateName[16];
} CM_ARM_LPI_INFO; } CM_ARM_LPI_INFO;
#pragma pack() #pragma pack()

View File

@ -82,19 +82,19 @@ Object ID's in the ARM Namespace:
29 - Processor Hierarchy Node ID Info 29 - Processor Hierarchy Node ID Info
30 - CM Object Reference 30 - CM Object Reference
*/ */
typedef UINT32 CM_OBJECT_ID; typedef UINT32 CM_OBJECT_ID;
/** A mask for Object ID /** A mask for Object ID
*/ */
#define OBJECT_ID_MASK 0xFF #define OBJECT_ID_MASK 0xFF
/** A mask for Namespace ID /** A mask for Namespace ID
*/ */
#define NAMESPACE_ID_MASK 0xF #define NAMESPACE_ID_MASK 0xF
/** Starting bit position for Namespace ID /** Starting bit position for Namespace ID
*/ */
#define NAMESPACE_ID_BIT_SHIFT 28 #define NAMESPACE_ID_BIT_SHIFT 28
/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces /** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces
for the Configuration Manager Objects. for the Configuration Manager Objects.
@ -113,16 +113,16 @@ typedef enum ObjectNameSpaceID {
*/ */
typedef struct CmObjDescriptor { typedef struct CmObjDescriptor {
/// Object Id /// Object Id
CM_OBJECT_ID ObjectId; CM_OBJECT_ID ObjectId;
/// Size of the described Object or Object List /// Size of the described Object or Object List
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;
} CM_OBJ_DESCRIPTOR; } CM_OBJ_DESCRIPTOR;
#pragma pack() #pragma pack()
@ -143,7 +143,7 @@ typedef struct CmObjDescriptor {
@retval Returns the Object ID corresponding to the CmObjectID. @retval Returns the Object ID corresponding to the CmObjectID.
**/ **/
#define GET_CM_OBJECT_ID(CmObjectId) ((CmObjectId) & OBJECT_ID_MASK) #define GET_CM_OBJECT_ID(CmObjectId) ((CmObjectId) & OBJECT_ID_MASK)
/** This macro returns a Configuration Manager Object ID /** This macro returns a Configuration Manager Object ID
from the NameSpace ID and the ObjectID. from the NameSpace ID and the ObjectID.

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
@ -120,16 +120,16 @@ typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) (
*/ */
typedef struct DtTableGenerator { typedef struct DtTableGenerator {
/// The DT table generator ID. /// The DT table generator ID.
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;
/// The function to free any resources allocated for building the DT table. /// The function to free any resources allocated for building the DT table.
DT_TABLE_GENERATOR_FREE_TABLE FreeTableResources; DT_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
} DT_TABLE_GENERATOR; } DT_TABLE_GENERATOR;
/** Register DT table factory generator. /** Register DT table factory generator.
@ -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

@ -10,15 +10,15 @@
/** Is a character upper case /** Is a character upper case
*/ */
#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z')) #define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
/** Is a character a decimal digit /** Is a character a decimal digit
*/ */
#define IS_DIGIT(x) ((x >= '0') && (x <= '9')) #define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
/** Is a character an upper case hexadecimal digit /** Is a character an upper case hexadecimal digit
*/ */
#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x)) #define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
/** Convert a hex number to its ASCII code. /** Convert a hex number to its ASCII code.
@ -31,7 +31,7 @@
UINT8 UINT8
EFIAPI EFIAPI
AsciiFromHex ( AsciiFromHex (
IN UINT8 Hex IN UINT8 Hex
); );
/** Convert an ASCII char representing an hexadecimal number /** Convert an ASCII char representing an hexadecimal number
@ -46,7 +46,7 @@ AsciiFromHex (
UINT8 UINT8
EFIAPI EFIAPI
HexFromAscii ( HexFromAscii (
IN CHAR8 Char IN CHAR8 Char
); );
/** Check if a HID is a valid PNP ID. /** Check if a HID is a valid PNP ID.
@ -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.
@ -101,8 +101,8 @@ AmlParseDefinitionBlock (
EFI_STATUS 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).
@ -123,8 +123,8 @@ AmlSerializeDefinitionBlock (
EFI_STATUS 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.
@ -142,7 +142,7 @@ AmlCloneTree (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDeleteTree ( AmlDeleteTree (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Detach the Node from the tree. /** Detach the Node from the tree.
@ -163,7 +163,7 @@ AmlDeleteTree (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlDetachNode ( AmlDetachNode (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Find a node in the AML namespace, given an ASL path and a reference Node. /** Find a node in the AML namespace, given an ASL path and a reference Node.
@ -212,9 +212,9 @@ AmlDetachNode (
EFI_STATUS 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
); );
/** /**
@ -247,8 +247,8 @@ AmlFindNode (
EFI_STATUS 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.
@ -297,8 +297,8 @@ AmlNameOpUpdateInteger (
EFI_STATUS 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.
@ -331,8 +331,8 @@ AmlNameOpUpdateString (
EFI_STATUS 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.
@ -367,8 +367,8 @@ AmlNameOpGetFirstRdNode (
EFI_STATUS 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.
@ -393,8 +393,8 @@ AmlNameOpGetNextRdNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateRdInterrupt ( AmlUpdateRdInterrupt (
IN AML_DATA_NODE_HANDLE InterruptRdNode, IN AML_DATA_NODE_HANDLE InterruptRdNode,
IN UINT32 Irq IN UINT32 Irq
); );
/** Update the base address and length of a QWord resource data node. /** Update the base address and length of a QWord 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 ().
@ -773,18 +773,18 @@ AmlCreateLpiNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAddLpiState ( AmlAddLpiState (
IN UINT32 MinResidency, IN UINT32 MinResidency,
IN UINT32 WorstCaseWakeLatency, IN UINT32 WorstCaseWakeLatency,
IN UINT32 Flags, IN UINT32 Flags,
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
); );
// DEPRECATED APIS // DEPRECATED APIS
@ -823,8 +823,8 @@ AmlAddLpiState (
EFI_STATUS 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
@ -860,8 +860,8 @@ AmlNameOpCrsGetFirstRdNode (
EFI_STATUS 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,8 +61,8 @@ 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
); );
#endif // SSDT_SERIAL_PORT_LIB_H_ #endif // SSDT_SERIAL_PORT_LIB_H_

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,10 +136,10 @@ 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
); );
/** Parse and print a CmObjDesc. /** Parse and print a CmObjDesc.
@ -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

@ -32,8 +32,8 @@
/** /**
Forward declarations: Forward declarations:
*/ */
typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL; typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
typedef struct PlatformRepositoryInfo EDKII_PLATFORM_REPOSITORY_INFO; typedef struct PlatformRepositoryInfo EDKII_PLATFORM_REPOSITORY_INFO;
/** The GetObject function defines the interface implemented by the /** The GetObject function defines the interface implemented by the
Configuration Manager Protocol for returning the Configuration Configuration Manager Protocol for returning the Configuration
@ -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
@ -95,27 +95,27 @@ EFI_STATUS
*/ */
typedef struct ConfigurationManagerProtocol { typedef struct ConfigurationManagerProtocol {
/// The Configuration Manager Protocol revision. /// The Configuration Manager Protocol revision.
UINT32 Revision; UINT32 Revision;
/** The interface used to request information about /** The interface used to request information about
the Configuration Manager Objects. the Configuration Manager Objects.
*/ */
EDKII_CONFIGURATION_MANAGER_GET_OBJECT GetObject; EDKII_CONFIGURATION_MANAGER_GET_OBJECT GetObject;
/** The interface used to update the information stored /** The interface used to update the information stored
in the Configuration Manager repository. in the Configuration Manager repository.
*/ */
EDKII_CONFIGURATION_MANAGER_SET_OBJECT SetObject; EDKII_CONFIGURATION_MANAGER_SET_OBJECT SetObject;
/** 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.
*/ */
extern EFI_GUID gEdkiiConfigurationManagerProtocolGuid; extern EFI_GUID gEdkiiConfigurationManagerProtocolGuid;
#pragma pack() #pragma pack()

View File

@ -35,8 +35,8 @@
/** /**
Forward declarations: Forward declarations:
*/ */
typedef struct DynamicTableFactoryProtocol EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL; typedef struct DynamicTableFactoryProtocol EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO; typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
/** Return a pointer to the ACPI table generator. /** Return a pointer to the ACPI table generator.
@ -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,58 +196,58 @@ 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.
*/ */
typedef struct DynamicTableFactoryProtocol { typedef struct DynamicTableFactoryProtocol {
/// The Dynamic Table Factory Protocol revision. /// The Dynamic Table Factory Protocol revision.
UINT32 Revision; UINT32 Revision;
/// The interface used to request an ACPI Table Generator. /// The interface used to request an ACPI Table Generator.
EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR GetAcpiTableGenerator; EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR GetAcpiTableGenerator;
/// Register an ACPI table Generator /// Register an ACPI table Generator
EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR
RegisterAcpiTableGenerator; RegisterAcpiTableGenerator;
/// Deregister an ACPI table Generator /// Deregister an ACPI table Generator
EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR
DeregisterAcpiTableGenerator; DeregisterAcpiTableGenerator;
/// The interface used to request a SMBIOS Table Generator. /// The interface used to request a SMBIOS Table Generator.
EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR GetSmbiosTableGenerator; EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR GetSmbiosTableGenerator;
/// Register an SMBIOS table Generator /// Register an SMBIOS table Generator
EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
RegisterSmbiosTableGenerator; RegisterSmbiosTableGenerator;
/// Deregister an SMBIOS table Generator /// Deregister an SMBIOS table Generator
EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
DeregisterSmbiosTableGenerator; DeregisterSmbiosTableGenerator;
/// The interface used to request a Device Tree Table Generator. /// The interface used to request a Device Tree Table Generator.
EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR GetDtTableGenerator; EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR GetDtTableGenerator;
/// Register a DT generator /// Register a DT generator
EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR
RegisterDtTableGenerator; RegisterDtTableGenerator;
/// Deregister a DT generator /// Deregister a DT generator
EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR
DeregisterDtTableGenerator; DeregisterDtTableGenerator;
/** 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.
*/ */
extern EFI_GUID gEdkiiDynamicTableFactoryProtocolGuid; extern EFI_GUID gEdkiiDynamicTableFactoryProtocolGuid;
#pragma pack() #pragma pack()

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
@ -173,22 +173,22 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) (
*/ */
typedef struct SmbiosTableGenerator { typedef struct SmbiosTableGenerator {
/// The SMBIOS table generator ID. /// The SMBIOS table generator ID.
SMBIOS_TABLE_GENERATOR_ID GeneratorID; SMBIOS_TABLE_GENERATOR_ID GeneratorID;
/// 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;
/// SMBIOS table build function pointer. /// SMBIOS table build function pointer.
SMBIOS_TABLE_GENERATOR_BUILD_TABLE BuildSmbiosTable; SMBIOS_TABLE_GENERATOR_BUILD_TABLE BuildSmbiosTable;
/** The function to free any resources /** The function to free any resources
allocated for building the SMBIOS table. allocated for building the SMBIOS table.
*/ */
SMBIOS_TABLE_GENERATOR_FREE_TABLE FreeTableResources; SMBIOS_TABLE_GENERATOR_FREE_TABLE FreeTableResources;
} SMBIOS_TABLE_GENERATOR; } SMBIOS_TABLE_GENERATOR;
/** Register SMBIOS table factory generator. /** Register SMBIOS table factory generator.
@ -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

@ -38,7 +38,7 @@
Note: The token value 0 is reserved for a NULL token and does Note: The token value 0 is reserved for a NULL token and does
not identify any object. not identify any object.
**/ **/
typedef UINTN CM_OBJECT_TOKEN; typedef UINTN CM_OBJECT_TOKEN;
/** The ESTD_OBJECT_ID enum describes the Object IDs /** The ESTD_OBJECT_ID enum describes the Object IDs
in the Standard Namespace. in the Standard Namespace.
@ -54,12 +54,12 @@ typedef enum StdObjectID {
*/ */
typedef struct CmStdObjConfigurationManagerInfo { typedef struct CmStdObjConfigurationManagerInfo {
/// The Configuration Manager Revision. /// The Configuration Manager Revision.
UINT32 Revision; UINT32 Revision;
/** The OEM ID. This information is used to /** The OEM ID. This information is used to
populate the ACPI table header information. populate the ACPI table header information.
*/ */
UINT8 OemId[6]; UINT8 OemId[6];
} CM_STD_OBJ_CONFIGURATION_MANAGER_INFO; } CM_STD_OBJ_CONFIGURATION_MANAGER_INFO;
/** A structure used to describe the ACPI table generators to be invoked. /** A structure used to describe the ACPI table generators to be invoked.
@ -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
@ -97,14 +97,14 @@ typedef struct CmAStdObjAcpiTableInfo {
/// Generators shall populate this information using part of the /// Generators shall populate this information using part of the
/// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the
/// ACPI table signature. /// ACPI table signature.
UINT64 OemTableId; UINT64 OemTableId;
/// An OEM-supplied revision number. Larger numbers are assumed to be /// An OEM-supplied revision number. Larger numbers are assumed to be
/// newer revisions. /// newer revisions.
/// Note: If this field is not populated (has value of Zero), then the /// Note: If this field is not populated (has value of Zero), then the
/// Generators shall populate this information using the revision of the /// Generators shall populate this information using the revision of the
/// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision). /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).
UINT32 OemRevision; UINT32 OemRevision;
} CM_STD_OBJ_ACPI_TABLE_INFO; } CM_STD_OBJ_ACPI_TABLE_INFO;
/** A structure used to describe the SMBIOS table generators to be invoked. /** A structure used to describe the SMBIOS table generators to be invoked.
@ -120,10 +120,10 @@ typedef struct CmAStdObjAcpiTableInfo {
*/ */
typedef struct CmStdObjSmbiosTableInfo { typedef struct CmStdObjSmbiosTableInfo {
/// The SMBIOS Table Generator ID /// The SMBIOS Table Generator ID
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

@ -107,7 +107,7 @@ _______________________________________________________________________________
128 - Table Type126 128 - Table Type126
129 - Table Type127 129 - Table Type127
**/ **/
typedef UINT32 TABLE_GENERATOR_ID; typedef UINT32 TABLE_GENERATOR_ID;
/** This enum lists the Table Generator Types. /** This enum lists the Table Generator Types.
*/ */
@ -127,19 +127,19 @@ typedef enum TableGeneratorNameSpace {
/** A mask for the Table ID bits of TABLE_GENERATOR_ID. /** A mask for the Table ID bits of TABLE_GENERATOR_ID.
*/ */
#define TABLE_ID_MASK 0xFF #define TABLE_ID_MASK 0xFF
/** A mask for the Namespace ID bits of TABLE_GENERATOR_ID. /** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
*/ */
#define TABLE_NAMESPACEID_MASK (BIT31) #define TABLE_NAMESPACEID_MASK (BIT31)
/** A mask for the Table Type bits of TABLE_GENERATOR_ID. /** A mask for the Table Type bits of TABLE_GENERATOR_ID.
*/ */
#define TABLE_TYPE_MASK (BIT29 | BIT28) #define TABLE_TYPE_MASK (BIT29 | BIT28)
/** Starting bit position for the Table Type bits /** Starting bit position for the Table Type bits
*/ */
#define TABLE_TYPE_BIT_SHIFT 28 #define TABLE_TYPE_BIT_SHIFT 28
/** Starting bit position for the Table Namespace ID bit /** Starting bit position for the Table Namespace ID bit
*/ */
@ -204,11 +204,11 @@ typedef enum TableGeneratorNameSpace {
/** A mask for Major revision. /** A mask for Major revision.
*/ */
#define MAJOR_REVISION_MASK 0xFFFF #define MAJOR_REVISION_MASK 0xFFFF
/** A mask for Minor revision. /** A mask for Minor revision.
*/ */
#define MINOR_REVISION_MASK 0xFFFF #define MINOR_REVISION_MASK 0xFFFF
/** This macro generates a Major.Minor version /** This macro generates a Major.Minor version
where the Major and Minor fields are 16 bit. where the Major and Minor fields are 16 bit.
@ -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

@ -40,48 +40,48 @@ Requirements:
/** The number of debug ports represented by the Table. /** The number of debug ports represented by the Table.
*/ */
#define DBG2_NUM_DEBUG_PORTS 1 #define DBG2_NUM_DEBUG_PORTS 1
/** The number of Generic Address Registers /** The number of Generic Address Registers
presented in the debug device information. presented in the debug device information.
*/ */
#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1 #define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1
/** The index for the debug port 0 in the Debug port information list. /** The index for the debug port 0 in the Debug port information list.
*/ */
#define INDEX_DBG_PORT0 0 #define INDEX_DBG_PORT0 0
/** A string representing the name of the debug port 0. /** A string representing the name of the debug port 0.
*/ */
#define NAME_STR_DBG_PORT0 "COM0" #define NAME_STR_DBG_PORT0 "COM0"
/** An UID representing the debug port 0. /** An UID representing the debug port 0.
*/ */
#define UID_DBG_PORT0 0 #define UID_DBG_PORT0 0
/** The length of the namespace string. /** The length of the namespace string.
*/ */
#define DBG2_NAMESPACESTRING_FIELD_SIZE sizeof (NAME_STR_DBG_PORT0) #define DBG2_NAMESPACESTRING_FIELD_SIZE sizeof (NAME_STR_DBG_PORT0)
/** The PL011 UART address range length. /** The PL011 UART address range length.
*/ */
#define PL011_UART_LENGTH 0x1000 #define PL011_UART_LENGTH 0x1000
/** A structure that provides the OS with the required information /** A structure that provides the OS with the required information
for initializing a debugger connection. for initializing a debugger connection.
*/ */
typedef struct { typedef struct {
/// The debug device information for the platform /// The debug device information for the platform
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device; EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
/// The base address register for the serial port /// The base address register for the serial port
EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister; EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister;
/// The address size /// The address size
UINT32 AddressSize; UINT32 AddressSize;
/// The debug port name string /// The debug port name string
UINT8 NameSpaceString[DBG2_NAMESPACESTRING_FIELD_SIZE]; UINT8 NameSpaceString[DBG2_NAMESPACESTRING_FIELD_SIZE];
} DBG2_DEBUG_DEVICE_INFORMATION; } DBG2_DEBUG_DEVICE_INFORMATION;
/** A structure representing the information about the debug port(s) /** A structure representing the information about the debug port(s)
@ -89,10 +89,10 @@ typedef struct {
*/ */
typedef struct { typedef struct {
/// The DBG2 table header /// The DBG2 table header
EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description; EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description;
/// Debug port information list /// Debug port information list
DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[DBG2_NUM_DEBUG_PORTS]; DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[DBG2_NUM_DEBUG_PORTS];
} DBG2_TABLE; } DBG2_TABLE;
/** A helper macro used for initializing the debug port device /** A helper macro used for initializing the debug port device
@ -104,42 +104,42 @@ typedef struct {
@param [in] UartNameStr The UART port name string. @param [in] UartNameStr The UART port name string.
**/ **/
#define DBG2_DEBUG_PORT_DDI( \ #define DBG2_DEBUG_PORT_DDI( \
SubType, \ SubType, \
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, \
/* UINT16 Length */ \ /* UINT16 Length */ \
sizeof (DBG2_DEBUG_DEVICE_INFORMATION), \ sizeof (DBG2_DEBUG_DEVICE_INFORMATION), \
/* UINT8 NumberofGenericAddressRegisters */ \ /* UINT8 NumberofGenericAddressRegisters */ \
DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, \ DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, \
/* UINT16 NameSpaceStringLength */ \ /* UINT16 NameSpaceStringLength */ \
DBG2_NAMESPACESTRING_FIELD_SIZE, \ DBG2_NAMESPACESTRING_FIELD_SIZE, \
/* UINT16 NameSpaceStringOffset */ \ /* UINT16 NameSpaceStringOffset */ \
OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), \ OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), \
/* UINT16 OemDataLength */ \ /* UINT16 OemDataLength */ \
0, \ 0, \
/* UINT16 OemDataOffset */ \ /* UINT16 OemDataOffset */ \
0, \ 0, \
/* UINT16 Port Type */ \ /* UINT16 Port Type */ \
EFI_ACPI_DBG2_PORT_TYPE_SERIAL, \ EFI_ACPI_DBG2_PORT_TYPE_SERIAL, \
/* UINT16 Port Subtype */ \ /* UINT16 Port Subtype */ \
SubType, \ SubType, \
/* UINT8 Reserved[2] */ \ /* UINT8 Reserved[2] */ \
{EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, \ {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, \
/* UINT16 BaseAddressRegister Offset */ \ /* UINT16 BaseAddressRegister Offset */ \
OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), \ OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), \
/* UINT16 AddressSize Offset */ \ /* UINT16 AddressSize Offset */ \
OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) \ OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) \
}, \ }, \
/* EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \ /* EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
ARM_GAS32 (UartBase), \ ARM_GAS32 (UartBase), \
/* UINT32 AddressSize */ \ /* UINT32 AddressSize */ \
UartAddrLen, \ UartAddrLen, \
/* UINT8 NameSpaceString[MAX_DBG2_NAME_LEN] */ \ /* UINT8 NameSpaceString[MAX_DBG2_NAME_LEN] */ \
UartNameStr \ UartNameStr \
} }
@ -148,7 +148,7 @@ typedef struct {
Note: fields marked with "{Template}" will be set dynamically Note: fields marked with "{Template}" will be set dynamically
*/ */
STATIC STATIC
DBG2_TABLE AcpiDbg2 = { DBG2_TABLE AcpiDbg2 = {
{ {
ACPI_HEADER ( ACPI_HEADER (
EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
@ -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;
@ -209,20 +209,20 @@ SetupDebugUart (
// Initialize the Serial Debug UART // Initialize the Serial Debug UART
DEBUG ((DEBUG_INFO, "Initializing Serial Debug UART...\n")); DEBUG ((DEBUG_INFO, "Initializing Serial Debug UART...\n"));
ReceiveFifoDepth = 0; // Use the default value for FIFO depth ReceiveFifoDepth = 0; // Use the default value for FIFO depth
Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity); Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);
DataBits = FixedPcdGet8 (PcdUartDefaultDataBits); DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);
StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits); StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
BaudRate = SerialPortInfo->BaudRate; BaudRate = SerialPortInfo->BaudRate;
Status = PL011UartInitializePort ( Status = PL011UartInitializePort (
(UINTN)SerialPortInfo->BaseAddress, (UINTN)SerialPortInfo->BaseAddress,
SerialPortInfo->Clock, SerialPortInfo->Clock,
&BaudRate, &BaudRate,
&ReceiveFifoDepth, &ReceiveFifoDepth,
&Parity, &Parity,
&DataBits, &DataBits,
&StopBits &StopBits
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
return Status; return 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)
); );
@ -447,11 +450,12 @@ BuildDbg2TableEx (
SerialPortInfo->PortSubtype; SerialPortInfo->PortSubtype;
if ((SerialPortInfo->PortSubtype == if ((SerialPortInfo->PortSubtype ==
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART) || EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART) ||
(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 (
@ -484,7 +488,7 @@ BuildDbg2TableEx (
} }
*TableCount = 2; *TableCount = 2;
*Table = TableList; *Table = TableList;
return Status; return Status;
@ -498,13 +502,13 @@ error_handler:
/** This macro defines the DBG2 Table Generator revision. /** This macro defines the DBG2 Table Generator revision.
*/ */
#define DBG2_GENERATOR_REVISION CREATE_REVISION (1, 0) #define DBG2_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the DBG2 Table Generator. /** The interface for the DBG2 Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR Dbg2Generator = { ACPI_TABLE_GENERATOR Dbg2Generator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
// Generator Description // Generator Description
@ -542,11 +546,12 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
EFI_STATUS 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);
@ -565,11 +570,12 @@ AcpiDbg2LibConstructor (
EFI_STATUS 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

@ -78,7 +78,7 @@ Requirements:
Note: fields marked with "{Template}" will be updated dynamically. Note: fields marked with "{Template}" will be updated dynamically.
*/ */
STATIC STATIC
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = { EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
ACPI_HEADER ( ACPI_HEADER (
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE, EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE,
@ -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,20 +598,20 @@ BuildFadtTable (
} }
} }
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt; *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt;
error_handler: error_handler:
return Status; return Status;
} }
/** This macro defines the FADT Table Generator revision. /** This macro defines the FADT Table Generator revision.
*/ */
#define FADT_GENERATOR_REVISION CREATE_REVISION (1, 0) #define FADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the FADT Table Generator. /** The interface for the FADT Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR FadtGenerator = { ACPI_TABLE_GENERATOR FadtGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
// Generator Description // Generator Description
@ -648,11 +651,12 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
EFI_STATUS 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);
@ -671,11 +675,12 @@ AcpiFadtLibConstructor (
EFI_STATUS 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);
@ -120,23 +120,23 @@ AddGenericTimerInfo (
Gtdt->CntControlBasePhysicalAddress = Gtdt->CntControlBasePhysicalAddress =
GenericTimerInfo->CounterControlBaseAddress; GenericTimerInfo->CounterControlBaseAddress;
Gtdt->Reserved = EFI_ACPI_RESERVED_DWORD; Gtdt->Reserved = EFI_ACPI_RESERVED_DWORD;
Gtdt->SecurePL1TimerGSIV = GenericTimerInfo->SecurePL1TimerGSIV; Gtdt->SecurePL1TimerGSIV = GenericTimerInfo->SecurePL1TimerGSIV;
Gtdt->SecurePL1TimerFlags = GenericTimerInfo->SecurePL1TimerFlags; Gtdt->SecurePL1TimerFlags = GenericTimerInfo->SecurePL1TimerFlags;
Gtdt->NonSecurePL1TimerGSIV = GenericTimerInfo->NonSecurePL1TimerGSIV; Gtdt->NonSecurePL1TimerGSIV = GenericTimerInfo->NonSecurePL1TimerGSIV;
Gtdt->NonSecurePL1TimerFlags = GenericTimerInfo->NonSecurePL1TimerFlags; Gtdt->NonSecurePL1TimerFlags = GenericTimerInfo->NonSecurePL1TimerFlags;
Gtdt->VirtualTimerGSIV = GenericTimerInfo->VirtualTimerGSIV; Gtdt->VirtualTimerGSIV = GenericTimerInfo->VirtualTimerGSIV;
Gtdt->VirtualTimerFlags = GenericTimerInfo->VirtualTimerFlags; Gtdt->VirtualTimerFlags = GenericTimerInfo->VirtualTimerFlags;
Gtdt->NonSecurePL2TimerGSIV = GenericTimerInfo->NonSecurePL2TimerGSIV; Gtdt->NonSecurePL2TimerGSIV = GenericTimerInfo->NonSecurePL2TimerGSIV;
Gtdt->NonSecurePL2TimerFlags = GenericTimerInfo->NonSecurePL2TimerFlags; Gtdt->NonSecurePL2TimerFlags = GenericTimerInfo->NonSecurePL2TimerFlags;
Gtdt->CntReadBasePhysicalAddress = Gtdt->CntReadBasePhysicalAddress =
GenericTimerInfo->CounterReadBaseAddress; GenericTimerInfo->CounterReadBaseAddress;
Gtdt->PlatformTimerCount = PlatformTimerCount; Gtdt->PlatformTimerCount = PlatformTimerCount;
Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 : Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE); sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) { if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) {
Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV; Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV;
Gtdt->VirtualPL2TimerFlags = GenericTimerInfo->VirtualPL2TimerFlags; Gtdt->VirtualPL2TimerFlags = GenericTimerInfo->VirtualPL2TimerFlags;
} }
@ -154,32 +154,32 @@ 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
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog)); DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG; Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
Watchdog->Length = Watchdog->Length =
sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE); sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE);
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE; Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
Watchdog->RefreshFramePhysicalAddress = Watchdog->RefreshFramePhysicalAddress =
WatchdogInfoList->RefreshFrameAddress; WatchdogInfoList->RefreshFrameAddress;
Watchdog->WatchdogControlFramePhysicalAddress = Watchdog->WatchdogControlFramePhysicalAddress =
WatchdogInfoList->ControlFrameAddress; WatchdogInfoList->ControlFrameAddress;
Watchdog->WatchdogTimerGSIV = WatchdogInfoList->TimerGSIV; Watchdog->WatchdogTimerGSIV = WatchdogInfoList->TimerGSIV;
Watchdog->WatchdogTimerFlags = WatchdogInfoList->Flags; Watchdog->WatchdogTimerFlags = WatchdogInfoList->Flags;
Watchdog++; Watchdog++;
WatchdogInfoList++; WatchdogInfoList++;
@ -206,19 +206,19 @@ 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
) )
{ {
UINT8 FrameNumber1; UINT8 FrameNumber1;
UINT8 FrameNumber2; UINT8 FrameNumber2;
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,12 +249,12 @@ 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;
ASSERT (GtBlockFrame != NULL); ASSERT (GtBlockFrame != NULL);
ASSERT (GTBlockTimerFrameList != NULL); ASSERT (GTBlockTimerFrameList != NULL);
@ -282,16 +282,16 @@ AddGTBlockTimerFrames (
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: GTDT: Frame number %d is not in the range 0-7\n", "ERROR: GTDT: Frame number %d is not in the range 0-7\n",
GTBlockTimerFrameList->FrameNumber GTBlockTimerFrameList->FrameNumber
)); ));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
GtBlockFrame->GTFrameNumber = GTBlockTimerFrameList->FrameNumber; GtBlockFrame->GTFrameNumber = GTBlockTimerFrameList->FrameNumber;
GtBlockFrame->Reserved[0] = EFI_ACPI_RESERVED_BYTE; GtBlockFrame->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GtBlockFrame->Reserved[1] = EFI_ACPI_RESERVED_BYTE; GtBlockFrame->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
GtBlockFrame->Reserved[2] = EFI_ACPI_RESERVED_BYTE; GtBlockFrame->Reserved[2] = EFI_ACPI_RESERVED_BYTE;
GtBlockFrame->CntBaseX = GTBlockTimerFrameList->PhysicalAddressCntBase; GtBlockFrame->CntBaseX = GTBlockTimerFrameList->PhysicalAddressCntBase;
GtBlockFrame->CntEL0BaseX = GtBlockFrame->CntEL0BaseX =
GTBlockTimerFrameList->PhysicalAddressCntEL0Base; GTBlockTimerFrameList->PhysicalAddressCntEL0Base;
@ -300,7 +300,7 @@ AddGTBlockTimerFrames (
GtBlockFrame->GTxPhysicalTimerFlags = GtBlockFrame->GTxPhysicalTimerFlags =
GTBlockTimerFrameList->PhysicalTimerFlags; GTBlockTimerFrameList->PhysicalTimerFlags;
GtBlockFrame->GTxVirtualTimerGSIV = GTBlockTimerFrameList->VirtualTimerGSIV; GtBlockFrame->GTxVirtualTimerGSIV = GTBlockTimerFrameList->VirtualTimerGSIV;
GtBlockFrame->GTxVirtualTimerFlags = GtBlockFrame->GTxVirtualTimerFlags =
GTBlockTimerFrameList->VirtualTimerFlags; GTBlockTimerFrameList->VirtualTimerFlags;
@ -308,6 +308,7 @@ AddGTBlockTimerFrames (
GtBlockFrame++; GtBlockFrame++;
GTBlockTimerFrameList++; GTBlockTimerFrameList++;
} // for } // for
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -328,25 +329,25 @@ 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) {
DEBUG ((DEBUG_INFO, "GTDT: GTBlock = 0x%p\n", GTBlock)); DEBUG ((DEBUG_INFO, "GTDT: GTBlock = 0x%p\n", GTBlock));
@ -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",
@ -368,8 +370,8 @@ AddGTBlockList (
} }
Length = sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) + Length = sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) +
(sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) * (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
GTBlockInfo->GTBlockTimerFrameCount); GTBlockInfo->GTBlockTimerFrameCount);
// Check that the length of the GT block does not // Check that the length of the GT block does not
// exceed MAX_UINT16 // exceed MAX_UINT16
@ -386,16 +388,16 @@ AddGTBlockList (
return Status; return Status;
} }
GTBlock->Type = EFI_ACPI_6_4_GTDT_GT_BLOCK; GTBlock->Type = EFI_ACPI_6_4_GTDT_GT_BLOCK;
GTBlock->Length = (UINT16)Length; GTBlock->Length = (UINT16)Length;
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE; GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress; GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount; GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
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,23 +450,23 @@ 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;
UINT32 TableSize; UINT32 TableSize;
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;
ASSERT (This != NULL); ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
@ -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."
@ -527,12 +531,12 @@ BuildGtdtTable (
// Calculate the GTDT Table Size // Calculate the GTDT Table Size
PlatformTimerCount = 0; PlatformTimerCount = 0;
TableSize = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE); TableSize = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
if (BlockTimerCount != 0) { if (BlockTimerCount != 0) {
GTBlockOffset = TableSize; GTBlockOffset = TableSize;
PlatformTimerCount += BlockTimerCount; PlatformTimerCount += BlockTimerCount;
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) *
BlockTimerCount); BlockTimerCount);
for (Idx = 0; Idx < BlockTimerCount; Idx++) { for (Idx = 0; Idx < BlockTimerCount; Idx++) {
if (GTBlockInfo[Idx].GTBlockTimerFrameCount > 8) { if (GTBlockInfo[Idx].GTBlockTimerFrameCount > 8) {
@ -546,8 +550,9 @@ 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);
} }
DEBUG (( DEBUG ((
@ -560,10 +565,10 @@ BuildGtdtTable (
WatchdogOffset = 0; WatchdogOffset = 0;
if (WatchdogCount != 0) { if (WatchdogCount != 0) {
WatchdogOffset = TableSize; WatchdogOffset = TableSize;
PlatformTimerCount += WatchdogCount; PlatformTimerCount += WatchdogCount;
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) *
WatchdogCount); WatchdogCount);
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"GTDT: WatchdogOffset = 0x%x, PLATFORM_TIMER_COUNT = %d\n", "GTDT: WatchdogOffset = 0x%x, PLATFORM_TIMER_COUNT = %d\n",
@ -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);
@ -700,13 +706,13 @@ FreeGtdtTableResources (
/** This macro defines the GTDT Table Generator revision. /** This macro defines the GTDT Table Generator revision.
*/ */
#define GTDT_GENERATOR_REVISION CREATE_REVISION (1, 0) #define GTDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the GTDT Table Generator. /** The interface for the GTDT Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR GtdtGenerator = { ACPI_TABLE_GENERATOR GtdtGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
// Generator Description // Generator Description
@ -745,11 +751,12 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
EFI_STATUS 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);
@ -768,11 +775,12 @@ AcpiGtdtLibConstructor (
EFI_STATUS 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

@ -22,21 +22,21 @@ 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;
typedef struct AcpiIortGenerator { typedef struct AcpiIortGenerator {
/// ACPI Table generator header /// ACPI Table generator header
ACPI_TABLE_GENERATOR Header; ACPI_TABLE_GENERATOR Header;
// IORT Generator private data // IORT Generator private data
/// 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,19 +167,19 @@ 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
) )
{ {
UINT32 Uid1; UINT32 Uid1;
UINT32 Uid2; UINT32 Uid2;
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,13 +214,13 @@ 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
) )
{ {
BOOLEAN IsAcpiProcUidDuplicated; BOOLEAN IsAcpiProcUidDuplicated;
ASSERT (Gicc != NULL); ASSERT (Gicc != NULL);
ASSERT (GicCInfo != NULL); ASSERT (GicCInfo != NULL);
@ -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,22 +289,22 @@ 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);
GicMsiFrame->Type = EFI_ACPI_6_3_GIC_MSI_FRAME; GicMsiFrame->Type = EFI_ACPI_6_3_GIC_MSI_FRAME;
GicMsiFrame->Length = sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE); GicMsiFrame->Length = sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE);
GicMsiFrame->Reserved1 = EFI_ACPI_RESERVED_WORD; GicMsiFrame->Reserved1 = EFI_ACPI_RESERVED_WORD;
GicMsiFrame->GicMsiFrameId = GicMsiFrameInfo->GicMsiFrameId; GicMsiFrame->GicMsiFrameId = GicMsiFrameInfo->GicMsiFrameId;
GicMsiFrame->PhysicalBaseAddress = GicMsiFrameInfo->PhysicalBaseAddress; GicMsiFrame->PhysicalBaseAddress = GicMsiFrameInfo->PhysicalBaseAddress;
GicMsiFrame->Flags = GicMsiFrameInfo->Flags; GicMsiFrame->Flags = GicMsiFrameInfo->Flags;
GicMsiFrame->SPICount = GicMsiFrameInfo->SPICount; GicMsiFrame->SPICount = GicMsiFrameInfo->SPICount;
GicMsiFrame->SPIBase = GicMsiFrameInfo->SPIBase; GicMsiFrame->SPIBase = GicMsiFrameInfo->SPIBase;
} }
/** Add the GIC MSI Frame Information to the MADT Table. /** Add the GIC MSI Frame Information to the MADT Table.
@ -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,16 +337,16 @@ 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);
ASSERT (GicRedistributorInfo != NULL); ASSERT (GicRedistributorInfo != NULL);
Gicr->Type = EFI_ACPI_6_3_GICR; Gicr->Type = EFI_ACPI_6_3_GICR;
Gicr->Length = sizeof (EFI_ACPI_6_3_GICR_STRUCTURE); Gicr->Length = sizeof (EFI_ACPI_6_3_GICR_STRUCTURE);
Gicr->Reserved = EFI_ACPI_RESERVED_WORD; Gicr->Reserved = EFI_ACPI_RESERVED_WORD;
Gicr->DiscoveryRangeBaseAddress = Gicr->DiscoveryRangeBaseAddress =
GicRedistributorInfo->DiscoveryRangeBaseAddress; GicRedistributorInfo->DiscoveryRangeBaseAddress;
Gicr->DiscoveryRangeLength = GicRedistributorInfo->DiscoveryRangeLength; Gicr->DiscoveryRangeLength = GicRedistributorInfo->DiscoveryRangeLength;
@ -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,19 +382,19 @@ 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);
GicIts->Type = EFI_ACPI_6_3_GIC_ITS; GicIts->Type = EFI_ACPI_6_3_GIC_ITS;
GicIts->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE); GicIts->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE);
GicIts->Reserved = EFI_ACPI_RESERVED_WORD; GicIts->Reserved = EFI_ACPI_RESERVED_WORD;
GicIts->GicItsId = GicItsInfo->GicItsId; GicIts->GicItsId = GicItsInfo->GicItsId;
GicIts->PhysicalBaseAddress = GicItsInfo->PhysicalBaseAddress; GicIts->PhysicalBaseAddress = GicItsInfo->PhysicalBaseAddress;
GicIts->Reserved2 = EFI_ACPI_RESERVED_DWORD; GicIts->Reserved2 = EFI_ACPI_RESERVED_DWORD;
} }
/** Add the GIC Interrupt Translation Service Information /** Add the GIC Interrupt Translation Service Information
@ -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,31 +446,31 @@ 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;
UINT32 TableSize; UINT32 TableSize;
UINT32 GicCCount; UINT32 GicCCount;
UINT32 GicDCount; UINT32 GicDCount;
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."
@ -610,16 +611,16 @@ BuildMadtTable (
TableSize += (sizeof (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE) * GicDCount); TableSize += (sizeof (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE) * GicDCount);
GicMSIOffset = TableSize; GicMSIOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE) * GicMSICount); TableSize += (sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE) * GicMSICount);
GicRedistOffset = TableSize; GicRedistOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_GICR_STRUCTURE) * GicRedistCount); TableSize += (sizeof (EFI_ACPI_6_3_GICR_STRUCTURE) * GicRedistCount);
GicItsOffset = TableSize; GicItsOffset = TableSize;
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,11 +659,11 @@ 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
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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);
@ -750,13 +752,13 @@ FreeMadtTableResources (
/** The MADT Table Generator revision. /** The MADT Table Generator revision.
*/ */
#define MADT_GENERATOR_REVISION CREATE_REVISION (1, 0) #define MADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the MADT Table Generator. /** The interface for the MADT Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR MadtGenerator = { ACPI_TABLE_GENERATOR MadtGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
// Generator Description // Generator Description
@ -795,11 +797,12 @@ ACPI_TABLE_GENERATOR MadtGenerator = {
EFI_STATUS 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);
@ -818,11 +821,12 @@ AcpiMadtLibConstructor (
EFI_STATUS 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,27 +68,27 @@ 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
PciCfgSpace->BaseAddress = PciCfgSpaceInfoList->BaseAddress; PciCfgSpace->BaseAddress = PciCfgSpaceInfoList->BaseAddress;
PciCfgSpace->PciSegmentGroupNumber = PciCfgSpace->PciSegmentGroupNumber =
PciCfgSpaceInfoList->PciSegmentGroupNumber; PciCfgSpaceInfoList->PciSegmentGroupNumber;
PciCfgSpace->StartBusNumber = PciCfgSpaceInfoList->StartBusNumber; PciCfgSpace->StartBusNumber = PciCfgSpaceInfoList->StartBusNumber;
PciCfgSpace->EndBusNumber = PciCfgSpaceInfoList->EndBusNumber; PciCfgSpace->EndBusNumber = PciCfgSpaceInfoList->EndBusNumber;
PciCfgSpace->Reserved = EFI_ACPI_RESERVED_DWORD; PciCfgSpace->Reserved = EFI_ACPI_RESERVED_DWORD;
PciCfgSpace++; PciCfgSpace++;
PciCfgSpaceInfoList++; PciCfgSpaceInfoList++;
} }
@ -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."
@ -154,13 +155,14 @@ BuildMcfgTable (
*Table = NULL; *Table = NULL;
Status = GetEArmObjPciConfigSpaceInfo ( Status = GetEArmObjPciConfigSpaceInfo (
CfgMgrProtocol, CfgMgrProtocol,
CM_NULL_TOKEN, CM_NULL_TOKEN,
&PciConfigSpaceInfoList, &PciConfigSpaceInfoList,
&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
@ -187,9 +189,9 @@ BuildMcfgTable (
// Calculate the MCFG Table Size // Calculate the MCFG Table Size
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);
@ -284,13 +287,13 @@ FreeMcfgTableResources (
/** This macro defines the MCFG Table Generator revision. /** This macro defines the MCFG Table Generator revision.
*/ */
#define MCFG_GENERATOR_REVISION CREATE_REVISION (1, 0) #define MCFG_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the MCFG Table Generator. /** The interface for the MCFG Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR McfgGenerator = { ACPI_TABLE_GENERATOR McfgGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
// Generator Description // Generator Description
@ -329,11 +332,12 @@ ACPI_TABLE_GENERATOR McfgGenerator = {
EFI_STATUS 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);
@ -352,11 +356,12 @@ AcpiMcfgLibConstructor (
EFI_STATUS 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,14 +101,14 @@ 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);
// <size of Processor Hierarchy Node> + <size of Private Resources array> // <size of Processor Hierarchy Node> + <size of Private Resources array>
return sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + return sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) +
(Node->NoOfPrivateResources * sizeof (UINT32)); (Node->NoOfPrivateResources * sizeof (UINT32));
} }
/** /**
@ -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;
@ -183,7 +183,7 @@ GetPpttNodeReferencedByToken (
if (NodeIndexer->Token == SearchToken) { if (NodeIndexer->Token == SearchToken) {
*IndexedNodeFound = NodeIndexer; *IndexedNodeFound = NodeIndexer;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"PPTT: Node Indexer: Token = %p. Found, Status = %r\n", "PPTT: Node Indexer: Token = %p. Found, Status = %r\n",
@ -192,6 +192,7 @@ GetPpttNodeReferencedByToken (
)); ));
return Status; return Status;
} }
NodeIndexer++; NodeIndexer++;
} }
@ -218,17 +219,17 @@ 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);
Iterator = Generator->NodeIndexer; Iterator = Generator->NodeIndexer;
NodesRemaining = Generator->ProcTopologyStructCount; NodesRemaining = Generator->ProcTopologyStructCount;
while (NodesRemaining != 0) { while (NodesRemaining != 0) {
@ -265,7 +266,7 @@ DetectCyclesInTopology (
// Stamp the visited node // Stamp the visited node
CycleDetector->CycleDetectionStamp = NodesRemaining; CycleDetector->CycleDetectionStamp = NodesRemaining;
CycleDetector = CycleDetector->TopologyParent; CycleDetector = CycleDetector->TopologyParent;
} // Continue topology tree walk } // Continue topology tree walk
Iterator++; Iterator++;
@ -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,27 +486,27 @@ 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;
ASSERT ( ASSERT (
(Generator != NULL) && (Generator != NULL) &&
@ -512,11 +514,11 @@ 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;
NodeCount = Generator->ProcHierarchyNodeCount; NodeCount = Generator->ProcHierarchyNodeCount;
// Check if every GICC Object is referenced by onlu one Proc Node // Check if every GICC Object is referenced by onlu one Proc Node
IsGicCTokenDuplicated = FindDuplicateValue ( IsGicCTokenDuplicated = FindDuplicateValue (
@ -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.
@ -556,16 +558,16 @@ AddProcHierarchyNodes (
} }
// Populate the node header // Populate the node header
ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR; ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR;
ProcStruct->Length = (UINT8)Length; ProcStruct->Length = (UINT8)Length;
ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE; ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE; ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
// Populate the flags // Populate the flags
ProcStruct->Flags.PhysicalPackage = ProcInfoNode->Flags & BIT0; ProcStruct->Flags.PhysicalPackage = ProcInfoNode->Flags & BIT0;
ProcStruct->Flags.AcpiProcessorIdValid = (ProcInfoNode->Flags & BIT1) >> 1; ProcStruct->Flags.AcpiProcessorIdValid = (ProcInfoNode->Flags & BIT1) >> 1;
ProcStruct->Flags.ProcessorIsAThread = (ProcInfoNode->Flags & BIT2) >> 2; ProcStruct->Flags.ProcessorIsAThread = (ProcInfoNode->Flags & BIT2) >> 2;
ProcStruct->Flags.NodeIsALeaf = (ProcInfoNode->Flags & BIT3) >> 3; ProcStruct->Flags.NodeIsALeaf = (ProcInfoNode->Flags & BIT3) >> 3;
ProcStruct->Flags.IdenticalImplementation = ProcStruct->Flags.IdenticalImplementation =
(ProcInfoNode->Flags & BIT4) >> 4; (ProcInfoNode->Flags & BIT4) >> 4;
ProcStruct->Flags.Reserved = 0; ProcStruct->Flags.Reserved = 0;
@ -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,18 +680,18 @@ 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) {
// Populate the private resources array // Populate the private resources array
Status = AddPrivateResources ( Status = AddPrivateResources (
Generator, Generator,
CfgMgrProtocol, CfgMgrProtocol,
PrivateResources, PrivateResources,
ProcStruct->NumberOfPrivateResources, ProcStruct->NumberOfPrivateResources,
ProcInfoNode->PrivateResourcesArrayToken ProcInfoNode->PrivateResourcesArrayToken
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -700,8 +704,8 @@ 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,18 +766,18 @@ 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 (
(Generator != NULL) && (Generator != NULL) &&
@ -781,31 +785,31 @@ 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;
CacheStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE); CacheStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE);
CacheStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE; CacheStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
CacheStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE; CacheStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
// "On Arm-based systems, all cache properties must be provided in the // "On Arm-based systems, all cache properties must be provided in the
// table." (ACPI 6.3, Section 5.2.29.2) // table." (ACPI 6.3, Section 5.2.29.2)
CacheStruct->Flags.SizePropertyValid = 1; CacheStruct->Flags.SizePropertyValid = 1;
CacheStruct->Flags.NumberOfSetsValid = 1; CacheStruct->Flags.NumberOfSetsValid = 1;
CacheStruct->Flags.AssociativityValid = 1; CacheStruct->Flags.AssociativityValid = 1;
CacheStruct->Flags.AllocationTypeValid = 1; CacheStruct->Flags.AllocationTypeValid = 1;
CacheStruct->Flags.CacheTypeValid = 1; CacheStruct->Flags.CacheTypeValid = 1;
CacheStruct->Flags.WritePolicyValid = 1; CacheStruct->Flags.WritePolicyValid = 1;
CacheStruct->Flags.LineSizeValid = 1; CacheStruct->Flags.LineSizeValid = 1;
CacheStruct->Flags.Reserved = 0; CacheStruct->Flags.Reserved = 0;
// Populate the reference to the next level of cache // Populate the reference to the next level of cache
if (CacheInfoNode->NextLevelOfCacheToken == CM_NULL_TOKEN) { if (CacheInfoNode->NextLevelOfCacheToken == CM_NULL_TOKEN) {
@ -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,8 +961,8 @@ 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,17 +989,16 @@ 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) &&
@ -1002,28 +1006,28 @@ AddIdTypeStructures (
(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;
IdStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_ID); IdStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_ID);
IdStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE; IdStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
IdStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE; IdStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
IdStruct->VendorId = ProcIdInfoNode->VendorId; IdStruct->VendorId = ProcIdInfoNode->VendorId;
IdStruct->Level1Id = ProcIdInfoNode->Level1Id; IdStruct->Level1Id = ProcIdInfoNode->Level1Id;
IdStruct->Level2Id = ProcIdInfoNode->Level2Id; IdStruct->Level2Id = ProcIdInfoNode->Level2Id;
IdStruct->MajorRev = ProcIdInfoNode->MajorRev; IdStruct->MajorRev = ProcIdInfoNode->MajorRev;
IdStruct->MinorRev = ProcIdInfoNode->MinorRev; IdStruct->MinorRev = ProcIdInfoNode->MinorRev;
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,33 +1061,33 @@ 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;
UINT32 TableSize; UINT32 TableSize;
UINT32 ProcTopologyStructCount; UINT32 ProcTopologyStructCount;
UINT32 ProcHierarchyNodeCount; UINT32 ProcHierarchyNodeCount;
UINT32 CacheStructCount; UINT32 CacheStructCount;
UINT32 IdStructCount; UINT32 IdStructCount;
UINT32 ProcHierarchyNodeOffset; UINT32 ProcHierarchyNodeOffset;
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,8 +1112,8 @@ 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
// structure count with Processor Hierarchy Nodes (Type 0) // structure count with Processor Hierarchy Nodes (Type 0)
@ -1127,7 +1132,7 @@ BuildPpttTable (
goto error_handler; goto error_handler;
} }
ProcTopologyStructCount = ProcHierarchyNodeCount; ProcTopologyStructCount = ProcHierarchyNodeCount;
Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount; Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount;
// Get the cache info and update the processor topology structure count with // Get the cache info and update the processor topology structure count with
@ -1147,7 +1152,7 @@ BuildPpttTable (
goto error_handler; goto error_handler;
} }
ProcTopologyStructCount += CacheStructCount; ProcTopologyStructCount += CacheStructCount;
Generator->CacheStructCount = CacheStructCount; Generator->CacheStructCount = CacheStructCount;
// Get the processor hierarchy node ID info and update the processor topology // Get the processor hierarchy node ID info and update the processor topology
@ -1172,10 +1177,10 @@ 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
); );
if (NodeIndexer == NULL) { if (NodeIndexer == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
DEBUG (( DEBUG ((
@ -1188,21 +1193,21 @@ BuildPpttTable (
DEBUG ((DEBUG_INFO, "INFO: NodeIndexer = %p\n", NodeIndexer)); DEBUG ((DEBUG_INFO, "INFO: NodeIndexer = %p\n", NodeIndexer));
Generator->ProcTopologyStructCount = ProcTopologyStructCount; Generator->ProcTopologyStructCount = ProcTopologyStructCount;
Generator->NodeIndexer = NodeIndexer; Generator->NodeIndexer = NodeIndexer;
// Calculate the size of the PPTT table // Calculate the size of the PPTT table
TableSize = sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER); TableSize = sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER);
// Include the size of Processor Hierarchy Nodes and index them // Include the size of Processor Hierarchy Nodes and index them
if (Generator->ProcHierarchyNodeCount != 0) { if (Generator->ProcHierarchyNodeCount != 0) {
ProcHierarchyNodeOffset = TableSize; ProcHierarchyNodeOffset = TableSize;
Generator->ProcHierarchyNodeIndexedList = NodeIndexer; Generator->ProcHierarchyNodeIndexedList = NodeIndexer;
TableSize += GetSizeofProcHierarchyNodes ( TableSize += GetSizeofProcHierarchyNodes (
ProcHierarchyNodeOffset, ProcHierarchyNodeOffset,
ProcHierarchyNodeList, ProcHierarchyNodeList,
Generator->ProcHierarchyNodeCount, Generator->ProcHierarchyNodeCount,
&NodeIndexer &NodeIndexer
); );
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
@ -1213,19 +1218,18 @@ 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
if (Generator->CacheStructCount != 0) { if (Generator->CacheStructCount != 0) {
CacheStructOffset = TableSize; CacheStructOffset = TableSize;
Generator->CacheStructIndexedList = NodeIndexer; Generator->CacheStructIndexedList = NodeIndexer;
TableSize += GetSizeofCacheTypeStructs ( TableSize += GetSizeofCacheTypeStructs (
CacheStructOffset, CacheStructOffset,
CacheStructList, CacheStructList,
Generator->CacheStructCount, Generator->CacheStructCount,
&NodeIndexer &NodeIndexer
); );
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" CacheStructCount = %d\n" \ " CacheStructCount = %d\n" \
@ -1239,14 +1243,14 @@ BuildPpttTable (
// Include the size of ID Type Structures and index them // Include the size of ID Type Structures and index them
if (Generator->IdStructCount != 0) { if (Generator->IdStructCount != 0) {
IdStructOffset = TableSize; IdStructOffset = TableSize;
Generator->IdStructIndexedList = NodeIndexer; Generator->IdStructIndexedList = NodeIndexer;
TableSize += GetSizeofIdStructs ( TableSize += GetSizeofIdStructs (
IdStructOffset, IdStructOffset,
IdStructList, IdStructList,
Generator->IdStructCount, Generator->IdStructCount,
&NodeIndexer &NodeIndexer
); );
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" IdStructCount = %d\n" \ " IdStructCount = %d\n" \
@ -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) {
@ -1443,12 +1447,12 @@ FreePpttTableResources (
/** The PPTT Table Generator revision. /** The PPTT Table Generator revision.
*/ */
#define PPTT_GENERATOR_REVISION CREATE_REVISION (1, 0) #define PPTT_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the PPTT Table Generator. /** The interface for the PPTT Table Generator.
*/ */
STATIC STATIC
ACPI_PPTT_GENERATOR PpttGenerator = { ACPI_PPTT_GENERATOR PpttGenerator = {
// ACPI table generator header // ACPI table generator header
{ {
// Generator ID // Generator ID
@ -1504,11 +1508,12 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
EFI_STATUS 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);
@ -1528,11 +1533,12 @@ AcpiPpttLibConstructor (
EFI_STATUS 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

@ -21,30 +21,30 @@
/// Cache parameters allowed by the architecture with /// Cache parameters allowed by the architecture with
/// ARMv8.3-CCIDX (Cache extended number of sets) /// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001
#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24) #define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24)
#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21) #define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21)
/// Cache parameters allowed by the architecture without /// Cache parameters allowed by the architecture without
/// ARMv8.3-CCIDX (Cache extended number of sets) /// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000
#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15) #define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15)
#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10) #define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10)
/// Common cache parameters /// Common cache parameters
/// Derived from CCSIDR_EL1 /// Derived from CCSIDR_EL1
/// The LineSize is represented by bits 2:0 /// The LineSize is represented by bits 2:0
/// (Log2(Number of bytes in cache line)) - 4 is used to represent /// (Log2(Number of bytes in cache line)) - 4 is used to represent
/// the LineSize bits. /// the LineSize bits.
#define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11) #define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11)
#define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4) #define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4)
/// Test if the given Processor Hierarchy Info object has the 'Node is a Leaf' /// Test if the given Processor Hierarchy Info object has the 'Node is a Leaf'
/// flag set /// flag set
#define IS_PROC_NODE_LEAF(Node) ((Node->Flags & BIT3) != 0) #define IS_PROC_NODE_LEAF(Node) ((Node->Flags & BIT3) != 0)
/// Test if the given Processor Hierarchy Info object has the 'ACPI Processor /// Test if the given Processor Hierarchy Info object has the 'ACPI Processor
/// ID valid' flag set /// ID valid' flag set
#define IS_ACPI_PROC_ID_VALID(Node) ((Node->Flags & BIT1) != 0) #define IS_ACPI_PROC_ID_VALID(Node) ((Node->Flags & BIT1) != 0)
/** /**
The GET_SIZE_OF_PPTT_STRUCTS macro expands to a function that is used to The GET_SIZE_OF_PPTT_STRUCTS macro expands to a function that is used to
@ -90,10 +90,10 @@
@param [in] CmObjectType Data type of the CM nodes in NodesToIndex. @param [in] CmObjectType Data type of the CM nodes in NodesToIndex.
**/ **/
#define GET_SIZE_OF_PPTT_STRUCTS( \ #define GET_SIZE_OF_PPTT_STRUCTS( \
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,29 +159,29 @@ 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 {
/// ACPI Table generator header /// ACPI Table generator header
ACPI_TABLE_GENERATOR Header; ACPI_TABLE_GENERATOR Header;
/// PPTT structure count /// PPTT structure count
UINT32 ProcTopologyStructCount; UINT32 ProcTopologyStructCount;
/// Count of Processor Hierarchy Nodes /// Count of Processor Hierarchy Nodes
UINT32 ProcHierarchyNodeCount; UINT32 ProcHierarchyNodeCount;
/// Count of Cache Structures /// Count of Cache Structures
UINT32 CacheStructCount; UINT32 CacheStructCount;
/// 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);
@ -63,13 +63,13 @@ BuildRawTable (
/** This macro defines the Raw Generator revision. /** This macro defines the Raw Generator revision.
*/ */
#define RAW_GENERATOR_REVISION CREATE_REVISION (1, 0) #define RAW_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the Raw Table Generator. /** The interface for the Raw Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR RawGenerator = { ACPI_TABLE_GENERATOR RawGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdRaw), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdRaw),
// Generator Description // Generator Description
@ -109,11 +109,12 @@ ACPI_TABLE_GENERATOR RawGenerator = {
EFI_STATUS 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);
@ -132,11 +133,12 @@ AcpiRawLibConstructor (
EFI_STATUS 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

@ -45,22 +45,22 @@ NOTE: This implementation ignores the possibility that the Serial settings may
/** A string representing the name of the SPCR port. /** A string representing the name of the SPCR port.
*/ */
#define NAME_STR_SPCR_PORT "COM1" #define NAME_STR_SPCR_PORT "COM1"
/** An UID representing the SPCR port. /** An UID representing the SPCR port.
*/ */
#define UID_SPCR_PORT 1 #define UID_SPCR_PORT 1
/** This macro defines the no flow control option. /** This macro defines the no flow control option.
*/ */
#define SPCR_FLOW_CONTROL_NONE 0 #define SPCR_FLOW_CONTROL_NONE 0
/**A template for generating the SPCR Table. /**A template for generating the SPCR Table.
Note: fields marked "{Template}" will be updated dynamically. Note: fields marked "{Template}" will be updated dynamically.
*/ */
STATIC STATIC
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = { EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = {
ACPI_HEADER ( ACPI_HEADER (
EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE,
@ -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 (
@ -384,7 +387,7 @@ BuildSpcrTableEx (
} }
*TableCount = 2; *TableCount = 2;
*Table = TableList; *Table = TableList;
return Status; return Status;
@ -398,13 +401,13 @@ error_handler:
/** This macro defines the SPCR Table Generator revision. /** This macro defines the SPCR Table Generator revision.
*/ */
#define SPCR_GENERATOR_REVISION CREATE_REVISION (1, 0) #define SPCR_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the SPCR Table Generator. /** The interface for the SPCR Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR SpcrGenerator = { ACPI_TABLE_GENERATOR SpcrGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
// Generator Description // Generator Description
@ -442,11 +445,12 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
EFI_STATUS 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);
@ -465,11 +469,12 @@ AcpiSpcrLibConstructor (
EFI_STATUS 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,11 +110,12 @@ 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;
return Bdf; return Bdf;
@ -136,35 +136,36 @@ 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) {
DEBUG ((DEBUG_INFO, "SRAT: GicCAff = 0x%p\n", GicCAff)); DEBUG ((DEBUG_INFO, "SRAT: GicCAff = 0x%p\n", GicCAff));
GicCAff->Type = EFI_ACPI_6_3_GICC_AFFINITY; GicCAff->Type = EFI_ACPI_6_3_GICC_AFFINITY;
GicCAff->Length = sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE); GicCAff->Length = sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE);
GicCAff->ProximityDomain = GicCInfo->ProximityDomain; GicCAff->ProximityDomain = GicCInfo->ProximityDomain;
GicCAff->AcpiProcessorUid = GicCInfo->AcpiProcessorUid; GicCAff->AcpiProcessorUid = GicCInfo->AcpiProcessorUid;
GicCAff->Flags = GicCInfo->AffinityFlags; GicCAff->Flags = GicCInfo->AffinityFlags;
GicCAff->ClockDomain = GicCInfo->ClockDomain; GicCAff->ClockDomain = GicCInfo->ClockDomain;
// Next // Next
GicCAff++; GicCAff++;
GicCInfo++; GicCInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -183,35 +184,36 @@ 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) {
DEBUG ((DEBUG_INFO, "SRAT: GicItsAff = 0x%p\n", GicItsAff)); DEBUG ((DEBUG_INFO, "SRAT: GicItsAff = 0x%p\n", GicItsAff));
GicItsAff->Type = EFI_ACPI_6_3_GIC_ITS_AFFINITY; GicItsAff->Type = EFI_ACPI_6_3_GIC_ITS_AFFINITY;
GicItsAff->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE); GicItsAff->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE);
GicItsAff->ProximityDomain = GicItsInfo->ProximityDomain; GicItsAff->ProximityDomain = GicItsInfo->ProximityDomain;
GicItsAff->Reserved[0] = EFI_ACPI_RESERVED_BYTE; GicItsAff->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE; GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
GicItsAff->ItsId = GicItsInfo->GicItsId; GicItsAff->ItsId = GicItsInfo->GicItsId;
// Next // Next
GicItsAff++; GicItsAff++;
GicItsInfo++; GicItsInfo++;
}// while }// while
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -230,44 +232,44 @@ 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) {
DEBUG ((DEBUG_INFO, "SRAT: MemAff = 0x%p\n", MemAff)); DEBUG ((DEBUG_INFO, "SRAT: MemAff = 0x%p\n", MemAff));
MemAff->Type = EFI_ACPI_6_3_MEMORY_AFFINITY; MemAff->Type = EFI_ACPI_6_3_MEMORY_AFFINITY;
MemAff->Length = sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE); MemAff->Length = sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE);
MemAff->ProximityDomain = MemAffInfo->ProximityDomain; MemAff->ProximityDomain = MemAffInfo->ProximityDomain;
MemAff->Reserved1 = EFI_ACPI_RESERVED_WORD; MemAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
MemAff->AddressBaseLow = (UINT32)(MemAffInfo->BaseAddress & MAX_UINT32); MemAff->AddressBaseLow = (UINT32)(MemAffInfo->BaseAddress & MAX_UINT32);
MemAff->AddressBaseHigh = (UINT32)(MemAffInfo->BaseAddress >> 32); MemAff->AddressBaseHigh = (UINT32)(MemAffInfo->BaseAddress >> 32);
MemAff->LengthLow = (UINT32)(MemAffInfo->Length & MAX_UINT32); MemAff->LengthLow = (UINT32)(MemAffInfo->Length & MAX_UINT32);
MemAff->LengthHigh = (UINT32)(MemAffInfo->Length >> 32); MemAff->LengthHigh = (UINT32)(MemAffInfo->Length >> 32);
MemAff->Reserved2 = EFI_ACPI_RESERVED_DWORD; MemAff->Reserved2 = EFI_ACPI_RESERVED_DWORD;
MemAff->Flags = MemAffInfo->Flags; MemAff->Flags = MemAffInfo->Flags;
MemAff->Reserved3 = EFI_ACPI_RESERVED_QWORD; MemAff->Reserved3 = EFI_ACPI_RESERVED_QWORD;
// Next // Next
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,34 +292,34 @@ 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));
GenInitAff->Type = EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY; GenInitAff->Type = EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY;
GenInitAff->Length = GenInitAff->Length =
sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE); sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE);
GenInitAff->Reserved1 = EFI_ACPI_RESERVED_WORD; GenInitAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
GenInitAff->DeviceHandleType = GenInitAffInfo->DeviceHandleType; GenInitAff->DeviceHandleType = GenInitAffInfo->DeviceHandleType;
GenInitAff->ProximityDomain = GenInitAffInfo->ProximityDomain; GenInitAff->ProximityDomain = GenInitAffInfo->ProximityDomain;
if (GenInitAffInfo->DeviceHandleToken == CM_NULL_TOKEN) { if (GenInitAffInfo->DeviceHandleToken == CM_NULL_TOKEN) {
DEBUG (( DEBUG ((
@ -351,14 +353,15 @@ AddGenericInitiatorAffinity (
ASSERT (DeviceHandleCount == 1); ASSERT (DeviceHandleCount == 1);
// Populate the ACPI device handle information. // Populate the ACPI device handle information.
GenInitAff->DeviceHandle.Acpi.AcpiHid = DeviceHandleAcpi->Hid; GenInitAff->DeviceHandle.Acpi.AcpiHid = DeviceHandleAcpi->Hid;
GenInitAff->DeviceHandle.Acpi.AcpiUid = DeviceHandleAcpi->Uid; GenInitAff->DeviceHandle.Acpi.AcpiUid = DeviceHandleAcpi->Uid;
GenInitAff->DeviceHandle.Acpi.Reserved[0] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Acpi.Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Acpi.Reserved[1] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Acpi.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
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,
@ -381,19 +384,19 @@ AddGenericInitiatorAffinity (
ASSERT (DeviceHandleCount == 1); ASSERT (DeviceHandleCount == 1);
// Populate the ACPI device handle information. // Populate the ACPI device handle information.
GenInitAff->DeviceHandle.Pci.PciSegment = DeviceHandlePci->SegmentNumber; GenInitAff->DeviceHandle.Pci.PciSegment = DeviceHandlePci->SegmentNumber;
GenInitAff->DeviceHandle.Pci.PciBdfNumber = GetBdf (DeviceHandlePci); GenInitAff->DeviceHandle.Pci.PciBdfNumber = GetBdf (DeviceHandlePci);
GenInitAff->DeviceHandle.Pci.Reserved[0] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[1] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[2] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[3] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[4] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[4] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[5] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[5] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[6] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[6] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[7] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[7] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[8] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[8] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[9] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[9] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[10] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[10] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[11] = EFI_ACPI_RESERVED_BYTE; GenInitAff->DeviceHandle.Pci.Reserved[11] = EFI_ACPI_RESERVED_BYTE;
} else { } else {
@ -405,7 +408,7 @@ AddGenericInitiatorAffinity (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
GenInitAff->Flags = GenInitAffInfo->Flags; GenInitAff->Flags = GenInitAffInfo->Flags;
GenInitAff->Reserved2[0] = EFI_ACPI_RESERVED_BYTE; GenInitAff->Reserved2[0] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->Reserved2[1] = EFI_ACPI_RESERVED_BYTE; GenInitAff->Reserved2[1] = EFI_ACPI_RESERVED_BYTE;
@ -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;
@ -456,17 +460,17 @@ BuildSratTable (
UINT32 MemAffCount; UINT32 MemAffCount;
UINT32 GenInitiatorAffCount; UINT32 GenInitiatorAffCount;
UINT32 GicCAffOffset; UINT32 GicCAffOffset;
UINT32 GicItsAffOffset; UINT32 GicItsAffOffset;
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. "
@ -567,28 +572,28 @@ BuildSratTable (
TableSize = sizeof (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER); TableSize = sizeof (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER);
GicCAffOffset = TableSize; GicCAffOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) * GicCCount); TableSize += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) * GicCCount);
if (GicItsCount != 0) { if (GicItsCount != 0) {
GicItsAffOffset = TableSize; GicItsAffOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) *
GicItsCount); GicItsCount);
} }
if (MemAffCount != 0) { if (MemAffCount != 0) {
MemAffOffset = TableSize; MemAffOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE) *
MemAffCount); MemAffCount);
} }
if (GenInitiatorAffCount != 0) { if (GenInitiatorAffCount != 0) {
GenInitiatorAffOffset = TableSize; GenInitiatorAffOffset = TableSize;
TableSize += (sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE) * TableSize += (sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE) *
GenInitiatorAffCount); GenInitiatorAffCount);
} }
// 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,
@ -649,12 +654,12 @@ BuildSratTable (
if (GicItsCount != 0) { if (GicItsCount != 0) {
Status = AddGICItsAffinity ( Status = AddGICItsAffinity (
CfgMgrProtocol, CfgMgrProtocol,
Srat, Srat,
GicItsAffOffset, GicItsAffOffset,
GicItsInfo, GicItsInfo,
GicItsCount GicItsCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -667,12 +672,12 @@ BuildSratTable (
if (MemAffCount != 0) { if (MemAffCount != 0) {
Status = AddMemoryAffinity ( Status = AddMemoryAffinity (
CfgMgrProtocol, CfgMgrProtocol,
Srat, Srat,
MemAffOffset, MemAffOffset,
MemAffInfo, MemAffInfo,
MemAffCount MemAffCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -685,12 +690,12 @@ BuildSratTable (
if (GenInitiatorAffCount != 0) { if (GenInitiatorAffCount != 0) {
Status = AddGenericInitiatorAffinity ( Status = AddGenericInitiatorAffinity (
CfgMgrProtocol, CfgMgrProtocol,
Srat, Srat,
GenInitiatorAffOffset, GenInitiatorAffOffset,
GenInitiatorAffInfo, GenInitiatorAffInfo,
GenInitiatorAffCount GenInitiatorAffCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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 (
@ -755,13 +760,13 @@ FreeSratTableResources (
/** The SRAT Table Generator revision. /** The SRAT Table Generator revision.
*/ */
#define SRAT_GENERATOR_REVISION CREATE_REVISION (1, 0) #define SRAT_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the SRAT Table Generator. /** The interface for the SRAT Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR SratGenerator = { ACPI_TABLE_GENERATOR SratGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSrat), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSrat),
// Generator Description // Generator Description
@ -800,11 +805,12 @@ ACPI_TABLE_GENERATOR SratGenerator = {
EFI_STATUS 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);
@ -823,11 +829,12 @@ AcpiSratLibConstructor (
EFI_STATUS 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,16 +153,16 @@ 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"
)); ));
goto error_handler; goto error_handler;
} }
} // for DTC Interrupt } // for DTC Interrupt
} // for Cmn600InfoList
} //for Cmn600InfoList
return EFI_SUCCESS; return EFI_SUCCESS;
@ -174,26 +180,27 @@ error_handler:
Cmn600Info->DtcCount Cmn600Info->DtcCount
)); ));
DEBUG_CODE_BEGIN (); DEBUG_CODE_BEGIN ();
for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) { for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex]; DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
" DTC[%d]:\n", " DTC[%d]:\n",
DtcIndex DtcIndex
)); ));
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
" Interrupt = 0x%lx\n", " Interrupt = 0x%lx\n",
DtcInterrupt->Interrupt DtcInterrupt->Interrupt
)); ));
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
" Flags = 0x%lx\n", " Flags = 0x%lx\n",
DtcInterrupt->Flags DtcInterrupt->Flags
)); ));
} // for } // for
DEBUG_CODE_END ();
DEBUG_CODE_END ();
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -218,34 +225,34 @@ 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;
AML_DATA_NODE_HANDLE CmnPeriphBaseRdNode; AML_DATA_NODE_HANDLE CmnPeriphBaseRdNode;
AML_DATA_NODE_HANDLE CmnRootNodeBaseRdNode; AML_DATA_NODE_HANDLE CmnRootNodeBaseRdNode;
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;
Status = AmlParseDefinitionBlock ( Status = AmlParseDefinitionBlock (
SsdtCmn600Template, SsdtCmn600Template,
&RootNodeHandle &RootNodeHandle
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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,15 +430,15 @@ 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);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != 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;
@ -619,13 +628,13 @@ BuildSsdtCmn600TableEx (
/** This macro defines the Raw Generator revision. /** This macro defines the Raw Generator revision.
*/ */
#define SSDT_CMN_600_GENERATOR_REVISION CREATE_REVISION (1, 0) #define SSDT_CMN_600_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the Raw Table Generator. /** The interface for the Raw Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR SsdtCmn600Generator = { ACPI_TABLE_GENERATOR SsdtCmn600Generator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCmn600), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCmn600),
// Generator Description // Generator Description
@ -663,8 +672,8 @@ ACPI_TABLE_GENERATOR SsdtCmn600Generator = {
EFI_STATUS 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;
@ -691,8 +700,8 @@ AcpiSsdtCmn600LibConstructor (
EFI_STATUS 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

@ -20,24 +20,24 @@
/** PeriphBase maximum address length is 256MB (0x10000000) /** PeriphBase maximum address length is 256MB (0x10000000)
for a (X >= 4) || (Y >= 4) dimensions mesh. for a (X >= 4) || (Y >= 4) dimensions mesh.
*/ */
#define PERIPHBASE_MAX_ADDRESS_LENGTH SIZE_256MB #define PERIPHBASE_MAX_ADDRESS_LENGTH SIZE_256MB
/** PeriphBase minimum address length is 64MB (0x04000000) /** PeriphBase minimum address length is 64MB (0x04000000)
for a (X < 4) && (Y < 4) dimensions mesh. for a (X < 4) && (Y < 4) dimensions mesh.
*/ */
#define PERIPHBASE_MIN_ADDRESS_LENGTH SIZE_64MB #define PERIPHBASE_MIN_ADDRESS_LENGTH SIZE_64MB
/** RootNodeBase address length is 16KB (0x00004000). /** RootNodeBase address length is 16KB (0x00004000).
*/ */
#define ROOTNODEBASE_ADDRESS_LENGTH SIZE_16KB #define ROOTNODEBASE_ADDRESS_LENGTH SIZE_16KB
/** Maximum number of CMN-600 Debug and Trace Logic Controllers (DTC). /** Maximum number of CMN-600 Debug and Trace Logic Controllers (DTC).
*/ */
#define MAX_DTC_COUNT 4 #define MAX_DTC_COUNT 4
/** Starting value for the UID to represent the CMN600 devices. /** Starting value for the UID to represent the CMN600 devices.
*/ */
#define CMN600_DEVICE_START_UID 0 #define CMN600_DEVICE_START_UID 0
/** Maximum CMN-600 devices supported by this generator. /** Maximum CMN-600 devices supported by this generator.
This generator supports a maximum of 16 CMN-600 devices. This generator supports a maximum of 16 CMN-600 devices.
@ -46,6 +46,6 @@
UID fields describing the serial port. UID fields describing the serial port.
*/ */
#define MAX_CMN600_DEVICES_SUPPORTED 16 #define MAX_CMN600_DEVICES_SUPPORTED 16
#endif // SSDT_CMN600_GENERATOR_H_ #endif // SSDT_CMN600_GENERATOR_H_

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,18 +154,18 @@ 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;
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
ASSERT (Generator->TokenTable.Table != NULL); ASSERT (Generator->TokenTable.Table != NULL);
Table = Generator->TokenTable.Table; Table = Generator->TokenTable.Table;
LastIndex = Generator->TokenTable.LastIndex; LastIndex = Generator->TokenTable.LastIndex;
// Search if there is already an entry with this Token. // Search if there is already an entry with this Token.
@ -203,20 +204,21 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI 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;
} }
AslName[0] = LeadChar; AslName[0] = LeadChar;
AslName[AML_NAME_SEG_SIZE] = '\0'; AslName[AML_NAME_SEG_SIZE] = '\0';
for (Index = 0; Index < AML_NAME_SEG_SIZE - 1; Index++) { for (Index = 0; Index < AML_NAME_SEG_SIZE - 1; Index++) {
@ -262,14 +264,14 @@ 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;
UINT32 TokenIndex; UINT32 TokenIndex;
CHAR8 AslName[SB_SCOPE_PREFIX_SIZE + AML_NAME_SEG_SIZE]; CHAR8 AslName[SB_SCOPE_PREFIX_SIZE + AML_NAME_SEG_SIZE];
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
ASSERT (ProcHierarchyNodeInfo != NULL); ASSERT (ProcHierarchyNodeInfo != NULL);
@ -349,22 +351,22 @@ 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
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 Index; UINT32 Index;
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);
ASSERT (Generator->TokenTable.Table != NULL); ASSERT (Generator->TokenTable.Table != NULL);
@ -422,11 +424,11 @@ GenerateLpiStates (
LpiInfo->ResCntFreq, LpiInfo->ResCntFreq,
LpiInfo->EnableParentState, LpiInfo->EnableParentState,
LpiInfo->IsInteger ? LpiInfo->IsInteger ?
NULL : NULL :
&LpiInfo->RegisterEntryMethod, &LpiInfo->RegisterEntryMethod,
LpiInfo->IsInteger ? LpiInfo->IsInteger ?
LpiInfo->IntegerEntryMethod : LpiInfo->IntegerEntryMethod :
0, 0,
&LpiInfo->ResidencyCounterRegister, &LpiInfo->ResidencyCounterRegister,
&LpiInfo->UsageCounterRegister, &LpiInfo->UsageCounterRegister,
LpiInfo->StateName, LpiInfo->StateName,
@ -465,16 +467,16 @@ 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;
AML_OBJECT_NODE_HANDLE CpuNode; AML_OBJECT_NODE_HANDLE CpuNode;
CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
ASSERT (ParentNode != NULL); ASSERT (ParentNode != NULL);
@ -541,16 +543,16 @@ 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);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -619,17 +621,17 @@ 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;
AML_OBJECT_NODE_HANDLE ClusterNode; AML_OBJECT_NODE_HANDLE ClusterNode;
CHAR8 AslNameCluster[AML_NAME_SEG_SIZE + 1]; CHAR8 AslNameCluster[AML_NAME_SEG_SIZE + 1];
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -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
) )
@ -732,19 +734,19 @@ CreateAmlCpuTopologyTree (
ASSERT (NodeToken != CM_NULL_TOKEN); ASSERT (NodeToken != CM_NULL_TOKEN);
ASSERT (ParentNode != NULL); ASSERT (ParentNode != NULL);
CpuIndex = 0; CpuIndex = 0;
ClusterIndex = 0; ClusterIndex = 0;
for (Index = 0; Index < Generator->ProcNodeCount; Index++) { for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
// 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,15 +923,15 @@ 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;
ASSERT (Generator != NULL); ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL); ASSERT (CfgMgrProtocol != NULL);
@ -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;
} }
@ -1051,7 +1056,7 @@ BuildSsdtCpuTopologyTable (
} }
} else { } else {
// Generate the topology from CM_ARM_PROC_HIERARCHY_INFO objects. // Generate the topology from CM_ARM_PROC_HIERARCHY_INFO objects.
Generator->ProcNodeList = ProcHierarchyNodeList; Generator->ProcNodeList = ProcHierarchyNodeList;
Generator->ProcNodeCount = ProcHierarchyNodeCount; Generator->ProcNodeCount = ProcHierarchyNodeCount;
Status = CreateTopologyFromProcHierarchy ( Status = CreateTopologyFromProcHierarchy (
@ -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);
@ -1123,12 +1128,12 @@ FreeSsdtCpuTopologyTableResources (
/** This macro defines the SSDT Cpu Topology Table Generator revision. /** This macro defines the SSDT Cpu Topology Table Generator revision.
*/ */
#define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION CREATE_REVISION (1, 0) #define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the SSDT Cpu Topology Table Generator. /** The interface for the SSDT Cpu Topology Table Generator.
*/ */
STATIC STATIC
ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = { ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
// ACPI table generator header // ACPI table generator header
{ {
// Generator ID // Generator ID
@ -1160,10 +1165,10 @@ ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
// TokenTable // TokenTable
{ {
// Table // Table
NULL, NULL,
// LastIndex // LastIndex
0 0
}, },
// ProcNodeList // ProcNodeList
NULL, NULL,
@ -1184,11 +1189,12 @@ ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
EFI_STATUS 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,
@ -1212,11 +1218,12 @@ AcpiSsdtCpuTopologyLibConstructor (
EFI_STATUS 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

@ -14,13 +14,13 @@
#pragma pack(1) #pragma pack(1)
// Mask for the flags that need to be checked. // Mask for the flags that need to be checked.
#define PPTT_PROCESSOR_MASK ( \ #define PPTT_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \ (EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3)) (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
// Mask for the cpu flags. // Mask for the cpu flags.
#define PPTT_CPU_PROCESSOR_MASK ( \ #define PPTT_CPU_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \ (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3)) (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
@ -29,7 +29,7 @@
// Even though a _UID is generated for clusters, it is simpler to use // Even though a _UID is generated for clusters, it is simpler to use
// EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of // EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
// the PPTT table (not sure the PPTT table is generated). // the PPTT table (not sure the PPTT table is generated).
#define PPTT_CLUSTER_PROCESSOR_MASK ( \ #define PPTT_CLUSTER_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \ (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3)) (EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
@ -37,22 +37,22 @@
/** LPI states are stored in the ASL namespace at '\_SB_.Lxxx', /** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
with xxx being the node index of the LPI state. with xxx being the node index of the LPI state.
*/ */
#define SB_SCOPE "\\_SB_" #define SB_SCOPE "\\_SB_"
#define SB_SCOPE_PREFIX SB_SCOPE "." #define SB_SCOPE_PREFIX SB_SCOPE "."
/// Size of the SB_SCOPE_PREFIX string. /// Size of the SB_SCOPE_PREFIX string.
#define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX) #define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
/// HID for a processor device. /// HID for a processor device.
#define ACPI_HID_PROCESSOR_DEVICE "ACPI0007" #define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
/// HID for a processor container device. /// HID for a processor container device.
#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010" #define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
/** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states. /** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
The 'xxx' is an index on 12 bits is given to node name, The 'xxx' is an index on 12 bits is given to node name,
thus the limitation in the number of nodes. thus the limitation in the number of nodes.
*/ */
#define MAX_NODE_COUNT (1 << 12) #define MAX_NODE_COUNT (1 << 12)
/** A structure used to handle the Lpi structures referencing. /** A structure used to handle the Lpi structures referencing.
@ -106,11 +106,11 @@
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.
UINT32 LastIndex; UINT32 LastIndex;
} TOKEN_TABLE; } TOKEN_TABLE;
/** A structure holding the Cpu topology generator and additional private data. /** A structure holding the Cpu topology generator and additional private data.
@ -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

@ -46,7 +46,7 @@ GET_OBJECT_LIST (
respectively. So, the UIDs for serial ports for general use respectively. So, the UIDs for serial ports for general use
start at 2. start at 2.
*/ */
#define SERIAL_PORT_START_UID 2 #define SERIAL_PORT_START_UID 2
/** Maximum serial ports supported by this generator. /** Maximum serial ports supported by this generator.
This generator supports a maximum of 14 (16 - 2) serial ports. This generator supports a maximum of 14 (16 - 2) serial ports.
@ -57,7 +57,7 @@ GET_OBJECT_LIST (
UID fields describing the serial port. UID fields describing the serial port.
*/ */
#define MAX_SERIAL_PORTS_SUPPORTED 14 #define MAX_SERIAL_PORTS_SUPPORTED 14
/** Free any resources allocated for constructing the tables. /** Free any resources allocated for constructing the tables.
@ -76,16 +76,16 @@ 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);
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != 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;
@ -246,7 +248,7 @@ BuildSsdtSerialPortTableEx (
NewName[2] = 'M'; NewName[2] = 'M';
NewName[4] = '\0'; NewName[4] = '\0';
for (Index = 0; Index < SerialPortCount; Index++) { for (Index = 0; Index < SerialPortCount; Index++) {
Uid = SERIAL_PORT_START_UID + Index; Uid = SERIAL_PORT_START_UID + Index;
NewName[3] = AsciiFromHex ((UINT8)(Uid)); NewName[3] = AsciiFromHex ((UINT8)(Uid));
// Build a SSDT table describing the serial port. // Build a SSDT table describing the serial port.
@ -281,13 +283,13 @@ error_handler:
/** This macro defines the SSDT Serial Port Table Generator revision. /** This macro defines the SSDT Serial Port Table Generator revision.
*/ */
#define SSDT_SERIAL_GENERATOR_REVISION CREATE_REVISION (1, 0) #define SSDT_SERIAL_GENERATOR_REVISION CREATE_REVISION (1, 0)
/** The interface for the SSDT Serial Port Table Generator. /** The interface for the SSDT Serial Port Table Generator.
*/ */
STATIC STATIC
CONST CONST
ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = { ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
// Generator ID // Generator ID
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtSerialPort), CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtSerialPort),
// Generator Description // Generator Description
@ -325,11 +327,12 @@ ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
EFI_STATUS 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,
@ -353,11 +356,12 @@ AcpiSsdtSerialPortLibConstructor (
EFI_STATUS 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

@ -23,7 +23,7 @@
UINT8 UINT8
EFIAPI EFIAPI
AsciiFromHex ( AsciiFromHex (
IN UINT8 Hex IN UINT8 Hex
) )
{ {
if (Hex < 10) { if (Hex < 10) {
@ -50,7 +50,7 @@ AsciiFromHex (
UINT8 UINT8
EFIAPI EFIAPI
HexFromAscii ( HexFromAscii (
IN CHAR8 Char IN CHAR8 Char
) )
{ {
if ((Char >= '0') && (Char <= '9')) { if ((Char >= '0') && (Char <= '9')) {
@ -78,10 +78,10 @@ HexFromAscii (
**/ **/
BOOLEAN BOOLEAN
IsValidPnpId ( IsValidPnpId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
) )
{ {
UINTN Index; UINTN Index;
if (AsciiStrLen (Hid) != 7) { if (AsciiStrLen (Hid) != 7) {
return FALSE; return FALSE;
@ -113,10 +113,10 @@ IsValidPnpId (
**/ **/
BOOLEAN BOOLEAN
IsValidAcpiId ( IsValidAcpiId (
IN CONST CHAR8 * Hid IN CONST CHAR8 *Hid
) )
{ {
UINTN Index; UINTN Index;
if (AsciiStrLen (Hid) != 8) { if (AsciiStrLen (Hid) != 8) {
return FALSE; return FALSE;
@ -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;
} }
@ -197,14 +198,14 @@ AmlGetEisaIdFromString (
Bit 3-0: 4th hex digit of product number "3" Bit 3-0: 4th hex digit of product number "3"
*/ */
*EisaIdInt = SwapBytes32 ( *EisaIdInt = SwapBytes32 (
((EisaIdStr[0] - 0x40) << 26) | ((EisaIdStr[0] - 0x40) << 26) |
((EisaIdStr[1] - 0x40) << 21) | ((EisaIdStr[1] - 0x40) << 21) |
((EisaIdStr[2] - 0x40) << 16) | ((EisaIdStr[2] - 0x40) << 16) |
(HexFromAscii (EisaIdStr[3]) << 12) | (HexFromAscii (EisaIdStr[3]) << 12) |
(HexFromAscii (EisaIdStr[4]) << 8) | (HexFromAscii (EisaIdStr[4]) << 8) |
(HexFromAscii (EisaIdStr[5]) << 4) | (HexFromAscii (EisaIdStr[5]) << 4) |
(HexFromAscii (EisaIdStr[6])) (HexFromAscii (EisaIdStr[6]))
); );
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -67,9 +67,9 @@
EFI_STATUS 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.
@ -89,8 +89,8 @@ AmlSerializeTree (
EFI_STATUS 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
); );
/** /**
@ -127,7 +127,7 @@ AmlCloneNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlRemoveNodeFromVarArgList ( AmlRemoveNodeFromVarArgList (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Add the NewNode to the head of the variable list of arguments /** Add the NewNode to the head of the variable list of arguments
@ -145,8 +145,8 @@ AmlRemoveNodeFromVarArgList (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddHead ( AmlVarListAddHead (
IN AML_NODE_HANDLE ParentNode, IN AML_NODE_HANDLE ParentNode,
IN AML_NODE_HANDLE NewNode IN AML_NODE_HANDLE NewNode
); );
/** Add the NewNode to the tail of the variable list of arguments /** Add the NewNode to the tail of the variable list of arguments
@ -164,8 +164,8 @@ AmlVarListAddHead (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddTail ( AmlVarListAddTail (
IN AML_NODE_HANDLE ParentNode, IN AML_NODE_HANDLE ParentNode,
IN AML_NODE_HANDLE NewNode IN AML_NODE_HANDLE NewNode
); );
/** Add the NewNode before the Node in the list of variable /** Add the NewNode before the Node in the list of variable
@ -183,8 +183,8 @@ AmlVarListAddTail (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddBefore ( AmlVarListAddBefore (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN AML_NODE_HANDLE NewNode IN AML_NODE_HANDLE NewNode
); );
/** Add the NewNode after the Node in the variable list of arguments /** Add the NewNode after the Node in the variable list of arguments
@ -202,8 +202,8 @@ AmlVarListAddBefore (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlVarListAddAfter ( AmlVarListAddAfter (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN AML_NODE_HANDLE NewNode IN AML_NODE_HANDLE NewNode
); );
/** Append a Resource Data node to the BufferOpNode. /** Append a Resource Data node to the BufferOpNode.
@ -221,8 +221,8 @@ AmlVarListAddAfter (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlAppendRdNode ( AmlAppendRdNode (
IN AML_OBJECT_NODE_HANDLE BufferOpNode, IN AML_OBJECT_NODE_HANDLE BufferOpNode,
IN AML_DATA_NODE_HANDLE NewRdNode IN AML_DATA_NODE_HANDLE NewRdNode
); );
/** Replace the OldNode, which is in a variable list of arguments, /** Replace the OldNode, which is in a variable list of arguments,
@ -244,8 +244,8 @@ AmlAppendRdNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlReplaceVariableArgument ( AmlReplaceVariableArgument (
IN AML_NODE_HANDLE OldNode, IN AML_NODE_HANDLE OldNode,
IN AML_NODE_HANDLE NewNode IN AML_NODE_HANDLE NewNode
); );
/** /**
@ -285,7 +285,7 @@ AmlReplaceVariableArgument (
EAML_NODE_TYPE EAML_NODE_TYPE
EFIAPI EFIAPI
AmlGetNodeType ( AmlGetNodeType (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Get the RootNode information. /** Get the RootNode information.
@ -302,8 +302,8 @@ AmlGetNodeType (
EFI_STATUS 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.
@ -333,11 +333,11 @@ AmlGetRootNodeInfo (
EFI_STATUS 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.
@ -368,8 +368,8 @@ AmlGetFixedArgumentCount (
EFI_STATUS 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
@ -392,8 +392,8 @@ AmlGetNodeDataType (
EFI_STATUS 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.
@ -422,9 +422,9 @@ AmlGetResourceDataType (
EFI_STATUS 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.
@ -444,8 +444,8 @@ AmlGetDataNodeBuffer (
EFI_STATUS 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.
@ -472,8 +472,8 @@ AmlUpdateRootNode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateInteger ( AmlUpdateInteger (
IN AML_OBJECT_NODE_HANDLE IntegerOpNode, IN AML_OBJECT_NODE_HANDLE IntegerOpNode,
IN UINT64 NewInteger IN UINT64 NewInteger
); );
/** Update the buffer of a data node. /** Update the buffer of a data node.
@ -496,10 +496,10 @@ AmlUpdateInteger (
EFI_STATUS EFI_STATUS
EFIAPI 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
); );
/** /**
@ -541,7 +541,7 @@ AmlUpdateDataNode (
AML_NODE_HANDLE AML_NODE_HANDLE
EFIAPI EFIAPI
AmlGetParent ( AmlGetParent (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE 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
@ -590,7 +590,7 @@ AmlGetFixedArgument (
AML_NODE_HANDLE AML_NODE_HANDLE
EFIAPI EFIAPI
AmlGetSiblingVariableArgument ( AmlGetSiblingVariableArgument (
IN AML_NODE_HANDLE VarArgNode IN AML_NODE_HANDLE VarArgNode
); );
/** Get the next variable argument. /** Get the next variable argument.
@ -619,8 +619,8 @@ AmlGetSiblingVariableArgument (
AML_NODE_HANDLE AML_NODE_HANDLE
EFIAPI EFIAPI
AmlGetNextVariableArgument ( AmlGetNextVariableArgument (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN AML_NODE_HANDLE CurrVarArg IN AML_NODE_HANDLE CurrVarArg
); );
/** Get the previous variable argument. /** Get the previous variable argument.
@ -650,8 +650,8 @@ AmlGetNextVariableArgument (
AML_NODE_HANDLE AML_NODE_HANDLE
EFIAPI EFIAPI
AmlGetPreviousVariableArgument ( AmlGetPreviousVariableArgument (
IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE Node,
IN AML_NODE_HANDLE CurrVarArg IN AML_NODE_HANDLE CurrVarArg
); );
/** /**
@ -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
@ -712,10 +712,10 @@ BOOLEAN
BOOLEAN BOOLEAN
EFIAPI 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
); );
/** /**
@ -759,9 +759,9 @@ AmlEnumTree (
EFI_STATUS 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",
@ -54,9 +54,9 @@ CONST CHAR8 * NodeTypeStrTbl[] = {
VOID 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
) )
{ {
UINT32 i; UINT32 i;
@ -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,12 +119,12 @@ AmlDbgPrintNameSeg (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameString ( AmlDbgPrintNameString (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN BOOLEAN NewLine IN BOOLEAN NewLine
) )
{ {
UINT8 SegCount; UINT8 SegCount;
UINT8 Index; UINT8 Index;
if (Buffer == NULL) { if (Buffer == NULL) {
ASSERT (0); ASSERT (0);
@ -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,8 +194,8 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNodeHeader ( AmlDbgPrintNodeHeader (
IN AML_NODE_HEADER * Node, IN AML_NODE_HEADER *Node,
IN UINT8 Level IN UINT8 Level
) )
{ {
if (!IS_AML_NODE_VALID (Node)) { if (!IS_AML_NODE_VALID (Node)) {
@ -214,8 +220,8 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintDataNode ( AmlDbgPrintDataNode (
IN AML_DATA_NODE * DataNode, IN AML_DATA_NODE *DataNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
UINT32 Idx; UINT32 Idx;
@ -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,8 +291,8 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintObjectNode ( AmlDbgPrintObjectNode (
IN AML_OBJECT_NODE * ObjectNode, IN AML_OBJECT_NODE *ObjectNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
if (!IS_AML_OBJECT_NODE (ObjectNode)) { if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@ -293,23 +300,31 @@ 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 ((
ObjectNode->AmlByteEncoding->OpCode, DEBUG_INFO,
0 "%-15a ",
))); AmlGetFieldOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
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 ((
ObjectNode->AmlByteEncoding->OpCode, DEBUG_INFO,
ObjectNode->AmlByteEncoding->SubOpCode) "%-15a | ",
)); AmlGetOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
ObjectNode->AmlByteEncoding->SubOpCode
)
));
} }
DEBUG ((DEBUG_INFO, "%3d | ", ObjectNode->AmlByteEncoding->MaxIndex)); DEBUG ((DEBUG_INFO, "%3d | ", ObjectNode->AmlByteEncoding->MaxIndex));
@ -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,8 +349,8 @@ STATIC
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintRootNode ( AmlDbgPrintRootNode (
IN AML_ROOT_NODE * RootNode, IN AML_ROOT_NODE *RootNode,
IN UINT8 Level IN UINT8 Level
) )
{ {
if (!IS_AML_ROOT_NODE (RootNode)) { if (!IS_AML_ROOT_NODE (RootNode)) {
@ -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));
@ -379,25 +394,25 @@ AmlDbgPrintTableHeader (
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" | %-15a | Signature| Length | Rev | CSum | OemId | " " | %-15a | Signature| Length | Rev | CSum | OemId | "
"OemTableId | OemRev | CreatorId| CreatorRev\n", "OemTableId | OemRev | CreatorId| CreatorRev\n",
NodeTypeStrTbl[EAmlNodeRoot] NodeTypeStrTbl[EAmlNodeRoot]
)); ));
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" | %-15a | Op | SubOp| OpName | MaxI| Attribute | " " | %-15a | Op | SubOp| OpName | MaxI| Attribute | "
"PkgLen | NodeName (opt)\n", "PkgLen | NodeName (opt)\n",
NodeTypeStrTbl[EAmlNodeObject] NodeTypeStrTbl[EAmlNodeObject]
)); ));
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
" | %-15a | Data Type | Size | " " | %-15a | Data Type | Size | "
"Buffer\n", "Buffer\n",
NodeTypeStrTbl[EAmlNodeData] NodeTypeStrTbl[EAmlNodeData]
)); ));
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"---------------------------------------" "---------------------------------------"
"---------------------------------------\n" "---------------------------------------\n"
)); ));
} }
@ -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,8 +504,8 @@ AmlDbgPrintTree (
VOID VOID
EFIAPI EFIAPI
AmlDbgDumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 *Ptr,
IN UINT32 Length IN UINT32 Length
) )
{ {
UINT32 ByteCount; UINT32 ByteCount;
@ -498,7 +513,7 @@ AmlDbgDumpRaw (
UINT32 AsciiBufferIndex; UINT32 AsciiBufferIndex;
CHAR8 AsciiBuffer[17]; CHAR8 AsciiBuffer[17];
ByteCount = 0; ByteCount = 0;
AsciiBufferIndex = 0; AsciiBufferIndex = 0;
DEBUG ((DEBUG_VERBOSE, "Address : 0x%p\n", Ptr)); DEBUG ((DEBUG_VERBOSE, "Address : 0x%p\n", Ptr));
@ -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,8 +46,8 @@
VOID VOID
EFIAPI EFIAPI
AmlDbgDumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 *Ptr,
IN UINT32 Length IN UINT32 Length
); );
/** Print Size chars at Buffer address. /** Print Size chars at Buffer address.
@ -61,9 +61,9 @@ AmlDbgDumpRaw (
VOID 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
); );
/** Print an AML NameSeg. /** Print an AML NameSeg.
@ -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,8 +85,8 @@ AmlDbgPrintNameSeg (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNameString ( AmlDbgPrintNameString (
IN CONST CHAR8 * Buffer, IN CONST CHAR8 *Buffer,
IN BOOLEAN NewLine IN BOOLEAN NewLine
); );
/** Print Node information. /** Print Node information.
@ -99,7 +99,7 @@ AmlDbgPrintNameString (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintNode ( AmlDbgPrintNode (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Recursively print the subtree under the Node. /** Recursively print the subtree under the Node.
@ -112,7 +112,7 @@ AmlDbgPrintNode (
VOID VOID
EFIAPI EFIAPI
AmlDbgPrintTree ( AmlDbgPrintTree (
IN AML_NODE_HANDLE Node IN AML_NODE_HANDLE Node
); );
/** Print the absolute pathnames in the AML namespace of /** Print the absolute pathnames in the AML namespace of
@ -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

@ -62,7 +62,7 @@ typedef enum EAmlNodeDataType {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
typedef enum EAmlParseIndex { typedef enum EAmlParseIndex {
EAmlParseIndexTerm0 = 0, ///< First fixed argument index. EAmlParseIndexTerm0 = 0, ///< First fixed argument index.
EAmlParseIndexTerm1, ///< Second fixed argument index. EAmlParseIndexTerm1, ///< Second fixed argument index.
EAmlParseIndexTerm2, ///< Third fixed argument index. EAmlParseIndexTerm2, ///< Third fixed argument index.
EAmlParseIndexTerm3, ///< Fourth fixed argument index. EAmlParseIndexTerm3, ///< Fourth fixed argument index.
@ -84,7 +84,7 @@ typedef enum EAmlParseIndex {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
#define MAX_AML_NAMESTRING_SIZE 1277U #define MAX_AML_NAMESTRING_SIZE 1277U
/** Maximum size of an ASL NameString. /** Maximum size of an ASL NameString.
@ -98,7 +98,7 @@ typedef enum EAmlParseIndex {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
#define MAX_ASL_NAMESTRING_SIZE 1529U #define MAX_ASL_NAMESTRING_SIZE 1529U
/** Pseudo OpCode for method invocations. /** Pseudo OpCode for method invocations.
@ -117,7 +117,7 @@ typedef enum EAmlParseIndex {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
#define AML_METHOD_INVOC_OP 0xD0 #define AML_METHOD_INVOC_OP 0xD0
/** Pseudo OpCode for NamedField field elements. /** Pseudo OpCode for NamedField field elements.
@ -136,7 +136,7 @@ typedef enum EAmlParseIndex {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
#define AML_FIELD_NAMED_OP 0x04 #define AML_FIELD_NAMED_OP 0x04
/** AML object types. /** AML object types.
@ -146,7 +146,7 @@ typedef enum EAmlParseIndex {
@ingroup TreeStructures @ingroup TreeStructures
*/ */
typedef enum EAmlObjType { typedef enum EAmlObjType {
EAmlObjTypeUnknown = 0x0, EAmlObjTypeUnknown = 0x0,
EAmlObjTypeInt, EAmlObjTypeInt,
EAmlObjTypeStrObj, EAmlObjTypeStrObj,
EAmlObjTypeBuffObj, EAmlObjTypeBuffObj,

View File

@ -81,153 +81,153 @@
GLOBAL_REMOVE_IF_UNREFERENCED GLOBAL_REMOVE_IF_UNREFERENCED
STATIC 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.
@ -264,13 +264,13 @@ AML_BYTE_ENCODING mAmlByteEncoding[] = {
GLOBAL_REMOVE_IF_UNREFERENCED GLOBAL_REMOVE_IF_UNREFERENCED
STATIC 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,12 +288,12 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetByteEncoding ( AmlGetByteEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
) )
{ {
UINT8 OpCode; UINT8 OpCode;
UINT8 SubOpCode; UINT8 SubOpCode;
UINT32 Index; UINT32 Index;
if (Buffer == NULL) { if (Buffer == NULL) {
ASSERT (0); ASSERT (0);
@ -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) == {
AML_IS_PSEUDO_OPCODE) { if ((mAmlByteEncoding[Index].Attribute & 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];
} }
} }
@ -341,21 +345,24 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetByteEncodingByOpCode ( AmlGetByteEncodingByOpCode (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
UINT32 Index; UINT32 Index;
// 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,11 +381,11 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetFieldEncoding ( AmlGetFieldEncoding (
IN CONST UINT8 * Buffer IN CONST UINT8 *Buffer
) )
{ {
UINT8 OpCode; UINT8 OpCode;
UINT32 Index; UINT32 Index;
if (Buffer == NULL) { if (Buffer == NULL) {
ASSERT (0); ASSERT (0);
@ -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];
} }
} }
@ -422,26 +432,30 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetFieldEncodingByOpCode ( AmlGetFieldEncodingByOpCode (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
UINT32 Index; UINT32 Index;
// 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.
@ -454,8 +468,8 @@ AmlGetFieldEncodingByOpCode (
CONST CONST
CHAR8 * CHAR8 *
AmlGetOpCodeStr ( AmlGetOpCodeStr (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
@ -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;
} }
} }
@ -486,8 +502,8 @@ AmlGetOpCodeStr (
CONST CONST
CHAR8 * CHAR8 *
AmlGetFieldOpCodeStr ( AmlGetFieldOpCodeStr (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
@ -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
@ -523,8 +541,8 @@ AmlGetFieldOpCodeStr (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsOpCodeValid ( AmlIsOpCodeValid (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
@ -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;
} }
@ -551,7 +572,7 @@ AmlIsOpCodeValid (
GLOBAL_REMOVE_IF_UNREFERENCED GLOBAL_REMOVE_IF_UNREFERENCED
STATIC STATIC
CONST CONST
EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] = { EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] = {
EAmlNodeDataTypeNone, // EAmlNone EAmlNodeDataTypeNone, // EAmlNone
EAmlNodeDataTypeUInt, // EAmlUInt8 EAmlNodeDataTypeUInt, // EAmlUInt8
EAmlNodeDataTypeUInt, // EAmlUInt16 EAmlNodeDataTypeUInt, // EAmlUInt16
@ -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,17 +619,18 @@ 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;
UINT8 ByteCount; UINT8 ByteCount;
UINT32 RealLength; UINT32 RealLength;
UINT32 Offset; UINT32 Offset;
if ((Buffer == NULL) || if ((Buffer == NULL) ||
(PkgLength == NULL)) { (PkgLength == NULL))
{
ASSERT (0); ASSERT (0);
return 0; return 0;
} }
@ -641,9 +664,9 @@ AmlGetPkgLength (
package length is 2**28. package length is 2**28.
*/ */
LeadByte = *Buffer; LeadByte = *Buffer;
ByteCount = (LeadByte >> 6) & 0x03U; ByteCount = (LeadByte >> 6) & 0x03U;
Offset = ByteCount + 1U; Offset = ByteCount + 1U;
RealLength = 0; RealLength = 0;
// Switch on the number of bytes used to store the PkgLen. // Switch on the number of bytes used to store the PkgLen.
@ -661,17 +684,17 @@ AmlGetPkgLength (
} }
case 2: case 2:
{ {
RealLength = *(Buffer + 1); RealLength = *(Buffer + 1);
RealLength |= ((UINT32)(*(Buffer + 2))) << 8; RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
RealLength = (RealLength << 4) | (LeadByte & 0xF); RealLength = (RealLength << 4) | (LeadByte & 0xF);
break; break;
} }
case 3: case 3:
{ {
RealLength = *(Buffer + 1); RealLength = *(Buffer + 1);
RealLength |= ((UINT32)(*(Buffer + 2))) << 8; RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
RealLength |= ((UINT32)(*(Buffer + 3))) << 16; RealLength |= ((UINT32)(*(Buffer + 3))) << 16;
RealLength = (RealLength << 4) | (LeadByte & 0xF); RealLength = (RealLength << 4) | (LeadByte & 0xF);
break; break;
} }
default: default:
@ -699,8 +722,8 @@ AmlGetPkgLength (
UINT8 UINT8
EFIAPI EFIAPI
AmlSetPkgLength ( AmlSetPkgLength (
IN UINT32 Length, IN UINT32 Length,
OUT UINT8 * Buffer OUT UINT8 *Buffer
) )
{ {
UINT8 LeadByte; UINT8 LeadByte;
@ -715,12 +738,11 @@ AmlSetPkgLength (
} }
LeadByte = 0; LeadByte = 0;
Offset = 0; Offset = 0;
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);
@ -754,13 +772,13 @@ AmlSetPkgLength (
} }
// Write to the Buffer. // Write to the Buffer.
*Buffer = LeadByte; *Buffer = LeadByte;
CurrentOffset = 1; CurrentOffset = 1;
while (CurrentOffset < (Offset + 1)) { while (CurrentOffset < (Offset + 1)) {
CurrentShift = (UINT8)((CurrentOffset - 1) * 8); CurrentShift = (UINT8)((CurrentOffset - 1) * 8);
ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift); ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift);
ComputedLength = (ComputedLength) >> (4 + CurrentShift); ComputedLength = (ComputedLength) >> (4 + CurrentShift);
LeadByte = (UINT8)(ComputedLength & 0xFF); LeadByte = (UINT8)(ComputedLength & 0xFF);
*(Buffer + CurrentOffset) = LeadByte; *(Buffer + CurrentOffset) = LeadByte;
CurrentOffset++; CurrentOffset++;
} }
@ -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;
@ -845,8 +860,8 @@ AmlComputePkgLengthWidth (
EFI_STATUS 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

@ -15,9 +15,9 @@
#include <IndustryStandard/AcpiAml.h> #include <IndustryStandard/AcpiAml.h>
#if !defined (MDEPKG_NDEBUG) #if !defined (MDEPKG_NDEBUG)
#define AML_OPCODE_DEF(str, OpCode) str, OpCode #define AML_OPCODE_DEF(str, OpCode) str, OpCode
#else #else
#define AML_OPCODE_DEF(str, OpCode) OpCode #define AML_OPCODE_DEF(str, OpCode) OpCode
#endif // MDEPKG_NDEBUG #endif // MDEPKG_NDEBUG
/** AML types. /** AML types.
@ -31,7 +31,7 @@
These are internal types. These are internal types.
*/ */
typedef enum EAmlParseFormat { typedef enum EAmlParseFormat {
EAmlNone = 0, ///< No data expected. EAmlNone = 0, ///< No data expected.
EAmlUInt8, ///< One byte value evaluated as a UINT8. EAmlUInt8, ///< One byte value evaluated as a UINT8.
EAmlUInt16, ///< Two byte value evaluated as a UINT16. EAmlUInt16, ///< Two byte value evaluated as a UINT16.
EAmlUInt32, ///< Four byte value evaluated as a UINT32. EAmlUInt32, ///< Four byte value evaluated as a UINT32.
@ -61,46 +61,46 @@ typedef UINT32 AML_OP_ATTRIBUTE;
/** A PkgLength is expected between the OpCode/SubOpCode couple and the first /** A PkgLength is expected between the OpCode/SubOpCode couple and the first
fixed argument of the object. fixed argument of the object.
*/ */
#define AML_HAS_PKG_LENGTH 0x00001U #define AML_HAS_PKG_LENGTH 0x00001U
/** The object's OpCode is actually a character. Encodings with this attribute /** The object's OpCode is actually a character. Encodings with this attribute
don't describe objects. The dual/multi name prefix have this attribute, don't describe objects. The dual/multi name prefix have this attribute,
indicating the start of a longer NameString. indicating the start of a longer NameString.
*/ */
#define AML_IS_NAME_CHAR 0x00002U #define AML_IS_NAME_CHAR 0x00002U
/** A variable list of arguments is following the last fixed argument. Each /** A variable list of arguments is following the last fixed argument. Each
argument is evaluated as an EAmlObject. argument is evaluated as an EAmlObject.
*/ */
#define AML_HAS_CHILD_OBJ 0x00004U #define AML_HAS_CHILD_OBJ 0x00004U
/** This is a sub-type of a variable list of arguments. It can only be /** This is a sub-type of a variable list of arguments. It can only be
found in buffer objects. A ByteList is either a list of found in buffer objects. A ByteList is either a list of
bytes or a list of resource data elements. Resource data elements bytes or a list of resource data elements. Resource data elements
have specific opcodes. have specific opcodes.
*/ */
#define AML_HAS_BYTE_LIST 0x00008U #define AML_HAS_BYTE_LIST 0x00008U
/** This is a sub-type of a variable list of arguments. It can only be /** This is a sub-type of a variable list of arguments. It can only be
found in Fields, IndexFields and BankFields. found in Fields, IndexFields and BankFields.
A FieldList is made of FieldElements. FieldElements have specific opcodes. A FieldList is made of FieldElements. FieldElements have specific opcodes.
*/ */
#define AML_HAS_FIELD_LIST 0x00010U #define AML_HAS_FIELD_LIST 0x00010U
/** This object node is a field element. Its opcode is to be fetched from /** This object node is a field element. Its opcode is to be fetched from
the field encoding table. the field encoding table.
*/ */
#define AML_IS_FIELD_ELEMENT 0x00020U #define AML_IS_FIELD_ELEMENT 0x00020U
/** The object has a name and which is part of the AML namespace. The name /** The object has a name and which is part of the AML namespace. The name
can be found in the fixed argument list at the NameIndex. can be found in the fixed argument list at the NameIndex.
*/ */
#define AML_IN_NAMESPACE 0x10000U #define AML_IN_NAMESPACE 0x10000U
/** Some OpCodes have been created in this library. They are called /** Some OpCodes have been created in this library. They are called
pseudo opcodes and must stay internal to this library. pseudo opcodes and must stay internal to this library.
*/ */
#define AML_IS_PSEUDO_OPCODE 0x20000U #define AML_IS_PSEUDO_OPCODE 0x20000U
/** Encoding of an AML object. /** Encoding of an AML object.
@ -112,37 +112,37 @@ 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;
/// SubOpCode of the AML object. /// SubOpCode of the AML object.
/// The SubOpcode field has a valid value when the OpCode is 0x5B, /// The SubOpcode field has a valid value when the OpCode is 0x5B,
/// otherwise this field must be zero. /// otherwise this field must be zero.
/// For field objects, the SubOpCode is not used. /// For field objects, the SubOpCode is not used.
UINT8 SubOpCode; UINT8 SubOpCode;
/// Number of fixed arguments for the AML statement represented /// Number of fixed arguments for the AML statement represented
/// by the OpCode & SubOpcode. /// by the OpCode & SubOpcode.
/// Maximum is 6 for AML objects. /// Maximum is 6 for AML objects.
/// Maximum is 3 for field objects. /// Maximum is 3 for field objects.
EAML_PARSE_INDEX MaxIndex; EAML_PARSE_INDEX MaxIndex;
/// If the encoding has the AML_IN_NAMESPACE attribute (cf Attribute /// If the encoding has the AML_IN_NAMESPACE attribute (cf Attribute
/// field below), indicate where to find the name in the fixed list /// field below), indicate where to find the name in the fixed list
/// of arguments. /// of arguments.
EAML_PARSE_INDEX NameIndex; EAML_PARSE_INDEX NameIndex;
/// Type of each fixed argument. /// Type of each fixed argument.
AML_PARSE_FORMAT Format[EAmlParseIndexMax]; AML_PARSE_FORMAT Format[EAmlParseIndexMax];
/// Additional information on the AML object. /// Additional information on the AML object.
AML_OP_ATTRIBUTE Attribute; AML_OP_ATTRIBUTE Attribute;
} AML_BYTE_ENCODING; } AML_BYTE_ENCODING;
/** Get the AML_BYTE_ENCODING entry in the AML encoding table. /** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@ -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
@ -176,8 +176,8 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetByteEncodingByOpCode ( AmlGetByteEncodingByOpCode (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
/** Get the AML_BYTE_ENCODING entry in the field encoding table. /** Get the AML_BYTE_ENCODING entry in the field 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
@ -212,12 +212,13 @@ CONST
AML_BYTE_ENCODING * AML_BYTE_ENCODING *
EFIAPI EFIAPI
AmlGetFieldEncodingByOpCode ( AmlGetFieldEncodingByOpCode (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
// 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.
@ -230,8 +231,8 @@ AmlGetFieldEncodingByOpCode (
CONST CONST
CHAR8 * CHAR8 *
AmlGetOpCodeStr ( AmlGetOpCodeStr (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
/** Look for an OpCode/SubOpCode couple in the AML field element grammar, /** Look for an OpCode/SubOpCode couple in the AML field element grammar,
@ -246,9 +247,10 @@ AmlGetOpCodeStr (
CONST CONST
CHAR8 * CHAR8 *
AmlGetFieldOpCodeStr ( 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
@ -263,8 +265,8 @@ AmlGetFieldOpCodeStr (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsOpCodeValid ( AmlIsOpCodeValid (
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
/** Convert an AML_PARSE_FORMAT to its corresponding EAML_NODE_DATA_TYPE. /** Convert an AML_PARSE_FORMAT to its corresponding EAML_NODE_DATA_TYPE.
@ -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,
@ -308,8 +310,8 @@ AmlGetPkgLength (
UINT8 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.
@ -367,9 +369,8 @@ AmlComputePkgLengthWidth (
EFI_STATUS 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.
@ -94,22 +94,22 @@ typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE;
*/ */
typedef struct AmlDataNode { typedef struct AmlDataNode {
/// Header information. Must be the first field of the struct. /// Header information. Must be the first field of the struct.
AML_NODE_HEADER NodeHeader; AML_NODE_HEADER NodeHeader;
/// Tag identifying what data is stored in this node. /// Tag identifying what data is stored in this node.
/// E.g. UINT, NULL terminated string, resource data element, etc. /// E.g. UINT, NULL terminated string, resource data element, etc.
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;
} AML_DATA_NODE; } AML_DATA_NODE;
/** 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

@ -39,21 +39,22 @@
EFI_STATUS 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;
} }
@ -170,8 +174,8 @@ AmlNameOpUpdateInteger (
EFI_STATUS 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);
@ -250,8 +257,8 @@ AmlNameOpUpdateString (
EFI_STATUS 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;
} }
@ -327,17 +337,18 @@ AmlNameOpGetFirstRdNode (
EFI_STATUS 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;
AML_OBJECT_NODE_HANDLE BufferOpNode; AML_OBJECT_NODE_HANDLE BufferOpNode;
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;
} }
@ -415,8 +430,8 @@ AmlNameOpGetNextRdNode (
EFI_STATUS 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);
@ -455,8 +470,8 @@ AmlNameOpCrsGetFirstRdNode (
EFI_STATUS 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

@ -44,22 +44,23 @@
BOOLEAN 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;
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);
@ -120,14 +122,14 @@ AmlNameOpCompareName (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasOpCode ( AmlNodeHasOpCode (
IN AML_OBJECT_NODE_HANDLE ObjectNode, IN AML_OBJECT_NODE_HANDLE ObjectNode,
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT8 NodeOpCode; UINT8 NodeOpCode;
UINT8 NodeSubOpCode; UINT8 NodeSubOpCode;
// Get the Node information. // Get the Node information.
Status = AmlGetObjectNodeInfo ( Status = AmlGetObjectNodeInfo (
@ -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;
} }
@ -163,12 +166,12 @@ AmlNodeHasOpCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasDataType ( AmlNodeHasDataType (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
IN EAML_NODE_DATA_TYPE DataType IN EAML_NODE_DATA_TYPE DataType
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EAML_NODE_DATA_TYPE NodeDataType; EAML_NODE_DATA_TYPE NodeDataType;
// Get the data type. // Get the data type.
Status = AmlGetNodeDataType (DataNode, &NodeDataType); Status = AmlGetNodeDataType (DataNode, &NodeDataType);
@ -197,12 +200,12 @@ AmlNodeHasDataType (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasRdDataType ( AmlNodeHasRdDataType (
IN AML_DATA_NODE_HANDLE RdNode, IN AML_DATA_NODE_HANDLE RdNode,
IN AML_RD_HEADER RdDataType IN AML_RD_HEADER RdDataType
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
AML_RD_HEADER NodeRdDataType; AML_RD_HEADER NodeRdDataType;
// Get the resource data type. // Get the resource data type.
Status = AmlGetResourceDataType ( Status = AmlGetResourceDataType (

View File

@ -36,8 +36,8 @@
BOOLEAN 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.
@ -53,9 +53,9 @@ AmlNameOpCompareName (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasOpCode ( AmlNodeHasOpCode (
IN AML_OBJECT_NODE_HANDLE ObjectNode, IN AML_OBJECT_NODE_HANDLE ObjectNode,
IN UINT8 OpCode, IN UINT8 OpCode,
IN UINT8 SubOpCode IN UINT8 SubOpCode
); );
/** Check whether DataNode has the input DataType. /** Check whether DataNode has the input DataType.
@ -70,8 +70,8 @@ AmlNodeHasOpCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasDataType ( AmlNodeHasDataType (
IN AML_DATA_NODE_HANDLE DataNode, IN AML_DATA_NODE_HANDLE DataNode,
IN EAML_NODE_DATA_TYPE DataType IN EAML_NODE_DATA_TYPE DataType
); );
/** Check whether RdNode has the input RdDataType. /** Check whether RdNode has the input RdDataType.
@ -86,8 +86,8 @@ AmlNodeHasDataType (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlNodeHasRdDataType ( AmlNodeHasRdDataType (
IN AML_DATA_NODE_HANDLE RdNode, IN AML_DATA_NODE_HANDLE RdNode,
IN AML_RD_HEADER RdDataType IN AML_RD_HEADER RdDataType
); );
#endif // AML_HELPER_H_ #endif // AML_HELPER_H_

View File

@ -41,24 +41,28 @@
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateRdInterrupt ( AmlUpdateRdInterrupt (
IN AML_DATA_NODE_HANDLE InterruptRdNode, IN AML_DATA_NODE_HANDLE InterruptRdNode,
IN UINT32 Irq IN UINT32 Irq
) )
{ {
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;
} }
@ -151,40 +156,44 @@ error_handler:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlUpdateRdInterruptEx ( AmlUpdateRdInterruptEx (
IN AML_DATA_NODE_HANDLE InterruptRdNode, IN AML_DATA_NODE_HANDLE InterruptRdNode,
IN BOOLEAN ResourceConsumer, IN BOOLEAN ResourceConsumer,
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;
} }
UpdateBuffer = NULL; UpdateBuffer = NULL;
UpdateBufferSize = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) + UpdateBufferSize = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) +
((IrqCount - 1) * sizeof (UINT32)); ((IrqCount - 1) * sizeof (UINT32));
// Allocate a buffer to update the data. // Allocate a buffer to update the data.
UpdateBuffer = AllocatePool (UpdateBufferSize); UpdateBuffer = AllocatePool (UpdateBufferSize);
@ -194,9 +203,9 @@ 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 =
UpdateBufferSize - sizeof (ACPI_LARGE_RESOURCE_HEADER); UpdateBufferSize - sizeof (ACPI_LARGE_RESOURCE_HEADER);
RdInterrupt->InterruptTableLength = IrqCount; RdInterrupt->InterruptTableLength = IrqCount;
@ -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));
@ -248,11 +257,11 @@ AmlUpdateRdQWord (
IN UINT64 BaseAddressLength IN UINT64 BaseAddressLength
) )
{ {
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) ||
(AmlGetNodeType ((AML_NODE_HANDLE)QWordRdNode) != EAmlNodeData) || (AmlGetNodeType ((AML_NODE_HANDLE)QWordRdNode) != EAmlNodeData) ||
@ -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,12 +306,12 @@ 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;
RdQWord->AddrRangeMax = BaseAddress + BaseAddressLength - 1; RdQWord->AddrRangeMax = BaseAddress + BaseAddressLength - 1;
RdQWord->AddrLen = BaseAddressLength; RdQWord->AddrLen = BaseAddressLength;
// Update Base Address Resource Data node. // Update Base Address Resource Data node.
Status = AmlUpdateDataNode ( Status = AmlUpdateDataNode (
@ -316,5 +328,6 @@ error_handler:
if (QueryBuffer != NULL) { if (QueryBuffer != NULL) {
FreePool (QueryBuffer); FreePool (QueryBuffer);
} }
return Status; return Status;
} }

File diff suppressed because it is too large Load Diff

View File

@ -44,14 +44,14 @@ 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;
EFI_STATUS Status1; EFI_STATUS Status1;
AML_OBJECT_NODE *BufferOpNode; AML_OBJECT_NODE *BufferOpNode;
if (NewRdNode != NULL) { if (NewRdNode != NULL) {
*NewRdNode = NULL; *NewRdNode = NULL;
@ -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;
@ -146,15 +147,16 @@ AmlCodeGenRdInterrupt (
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
) )
{ {
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;
} }
@ -163,8 +165,8 @@ AmlCodeGenRdInterrupt (
RdInterrupt.Header.Header.Bits.Name = RdInterrupt.Header.Header.Bits.Name =
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME; ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME;
RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG; RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) - RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
sizeof (ACPI_LARGE_RESOURCE_HEADER); sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body // Body
RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) | RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) |
@ -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
); );
@ -242,12 +244,13 @@ AmlCodeGenRdRegister (
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
) )
{ {
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;
} }
@ -256,19 +259,19 @@ AmlCodeGenRdRegister (
RdRegister.Header.Header.Bits.Name = RdRegister.Header.Header.Bits.Name =
ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME; ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME;
RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG; RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) - RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
sizeof (ACPI_LARGE_RESOURCE_HEADER); sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body // Body
RdRegister.AddressSpaceId = AddressSpace; RdRegister.AddressSpaceId = AddressSpace;
RdRegister.RegisterBitWidth = BitWidth; RdRegister.RegisterBitWidth = BitWidth;
RdRegister.RegisterBitOffset = BitOffset; RdRegister.RegisterBitOffset = BitOffset;
RdRegister.AddressSize = AccessSize; RdRegister.AddressSize = AccessSize;
RdRegister.RegisterAddress = Address; RdRegister.RegisterAddress = Address;
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData, EAmlNodeDataTypeResourceData,
(UINT8*)&RdRegister, (UINT8 *)&RdRegister,
sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR), sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
&RdNode &RdNode
); );
@ -318,15 +321,15 @@ AmlCodeGenRdRegister (
EFI_STATUS 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;
if ((ParentNode == NULL) && (NewRdNode == NULL)) { if ((ParentNode == NULL) && (NewRdNode == NULL)) {
ASSERT (0); ASSERT (0);
@ -337,17 +340,17 @@ AmlCodeGenEndTag (
// Header // Header
SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) - SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -
sizeof (ACPI_SMALL_RESOURCE_HEADER); sizeof (ACPI_SMALL_RESOURCE_HEADER);
SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME; SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;
SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG; SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;
// Body // Body
EndTag.Desc = SmallResHdr.Byte; EndTag.Desc = SmallResHdr.Byte;
EndTag.Checksum = CheckSum; EndTag.Checksum = CheckSum;
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

@ -142,9 +142,9 @@ AmlCodeGenRdRegister (
EFI_STATUS 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,46 +236,47 @@ 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;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
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;
} }
ParentCnt = *Levels; ParentCnt = *Levels;
*HasRoot = 0; *HasRoot = 0;
// ParentCnt namespace levels need to be climbed. // ParentCnt namespace levels need to be climbed.
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;
@ -293,11 +297,11 @@ AmlGetAncestorNameSpaceNode (
// Analyze the node name. // Analyze the node name.
Status = AmlParseNameStringInfo ( Status = AmlParseNameStringInfo (
NodeName, NodeName,
&Root, &Root,
&ParentPrefix, &ParentPrefix,
&SegCount &SegCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -316,9 +320,9 @@ 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);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -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,8 +380,8 @@ 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;
@ -468,15 +475,16 @@ AmlGetRawNameSpacePath (
// 1.1. If the Node's name has enough levels to consume all the // 1.1. If the Node's name has enough levels to consume all the
// InputParent carets, write the levels that are left. // InputParent carets, write the levels that are left.
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)
@ -488,23 +496,25 @@ AmlGetRawNameSpacePath (
InputParent += ParentPrefix; InputParent += ParentPrefix;
if (Root != 0) { if (Root != 0) {
// 2. The Node's name is an absolute path. // 2. The Node's name is an absolute path.
// Exit, the root has been reached. // Exit, the root has been reached.
if (InputParent != 0) { if (InputParent != 0) {
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;
@ -532,11 +542,11 @@ AmlGetRawNameSpacePath (
// Analyze the absolute pathname. // Analyze the absolute pathname.
Status = AmlParseNameStringInfo ( Status = AmlParseNameStringInfo (
NodeName, NodeName,
&Root, &Root,
&ParentPrefix, &ParentPrefix,
&SegCount &SegCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -545,9 +555,9 @@ AmlGetRawNameSpacePath (
// Writing the n first NameSegs. // Writing the n first NameSegs.
// n = SegCount - InputParent // n = SegCount - InputParent
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,21 +593,22 @@ 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;
UINT32 NameSegCount; UINT32 NameSegCount;
UINT32 NameSegSize; UINT32 NameSegSize;
// At most 3 bytes are needed for: RootChar + MultiNamePrefix + SegCount. // At most 3 bytes are needed for: RootChar + MultiNamePrefix + SegCount.
CHAR8 Prefix[3]; CHAR8 Prefix[3];
UINT32 PrefixSize; UINT32 PrefixSize;
// 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;
} }
@ -625,7 +635,7 @@ AmlAddPrefix (
case 0: case 0:
{ {
// Root and parents only NameString (no NameSeg(s)) end with '\0'. // Root and parents only NameString (no NameSeg(s)) end with '\0'.
Prefix[1] = AML_ZERO_OP; Prefix[1] = AML_ZERO_OP;
PrefixSize = 2; PrefixSize = 2;
break; break;
} }
@ -636,21 +646,21 @@ AmlAddPrefix (
} }
case 2: case 2:
{ {
Prefix[1] = AML_DUAL_NAME_PREFIX; Prefix[1] = AML_DUAL_NAME_PREFIX;
PrefixSize = 2; PrefixSize = 2;
break; break;
} }
default: default:
{ {
Prefix[1] = AML_MULTI_NAME_PREFIX; Prefix[1] = AML_MULTI_NAME_PREFIX;
Prefix[2] = (UINT8)NameSegCount; Prefix[2] = (UINT8)NameSegCount;
PrefixSize = 3; PrefixSize = 3;
break; break;
} }
} }
// 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,27 +689,28 @@ 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;
UINT32 TotalSize; UINT32 TotalSize;
UINT32 RewindSize; UINT32 RewindSize;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
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,31 +766,33 @@ 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;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
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;
} }
@ -788,7 +801,7 @@ AmlGetAslPathName (
// Allocate a Stream to get the raw AML absolute pathname. // Allocate a Stream to get the raw AML absolute pathname.
RawAmlAbsPathBufferSize = MAX_AML_NAMESTRING_SIZE; RawAmlAbsPathBufferSize = MAX_AML_NAMESTRING_SIZE;
RawAmlAbsPathBuffer = AllocateZeroPool (RawAmlAbsPathBufferSize); RawAmlAbsPathBuffer = AllocateZeroPool (RawAmlAbsPathBufferSize);
if (RawAmlAbsPathBuffer == NULL) { if (RawAmlAbsPathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -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,33 +903,36 @@ 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;
goto exit_handler; goto exit_handler;
} }
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,40 +940,41 @@ 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.
if (!IS_STREAM (CurrNodePathFStream) ||
IS_END_OF_STREAM (CurrNodePathFStream) ||
!IS_STREAM_FORWARD (CurrNodePathFStream))
{
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
// Check the Context's content. CurrNodePathBuffer = (CHAR8 *)AmlStreamGetBuffer (CurrNodePathFStream);
if (!IS_STREAM (CurrNodePathFStream) || CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream);
IS_END_OF_STREAM (CurrNodePathFStream) ||
!IS_STREAM_FORWARD (CurrNodePathFStream)) {
ASSERT (0);
Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
CurrNodePathBuffer = (CHAR8*)AmlStreamGetBuffer (CurrNodePathFStream); Status1 = AmlGetAslPathName (
CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream); (AML_NODE_HEADER *)Node,
CurrNodePathBuffer,
Status1 = AmlGetAslPathName ( &CurrNodePathBufferSize
(AML_NODE_HEADER*)Node, );
CurrNodePathBuffer, if (EFI_ERROR (Status1)) {
&CurrNodePathBufferSize ASSERT (0);
); ContinueEnum = FALSE;
if (EFI_ERROR (Status1)) { goto exit_handler;
ASSERT (0); }
ContinueEnum = FALSE;
goto exit_handler;
}
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;
ContinueEnum = FALSE; ContinueEnum = FALSE;
} }
@ -982,14 +999,14 @@ 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)) {
ASSERT (0); ASSERT (0);
@ -1000,7 +1017,7 @@ AmlDbgPrintNameSpace (
// Allocate memory to build the absolute ASL path to each node. // Allocate memory to build the absolute ASL path to each node.
CurrNodePathBufferSize = MAX_AML_NAMESTRING_SIZE; CurrNodePathBufferSize = MAX_AML_NAMESTRING_SIZE;
CurrNodePathBuffer = AllocateZeroPool (CurrNodePathBufferSize); CurrNodePathBuffer = AllocateZeroPool (CurrNodePathBufferSize);
if (CurrNodePathBuffer == NULL) { if (CurrNodePathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -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,40 +1081,43 @@ 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;
goto exit_handler; goto exit_handler;
} }
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;
// Check the Context's content. // Check the Context's content.
@ -1106,9 +1126,10 @@ 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;
goto exit_handler; goto exit_handler;
} }
@ -1116,7 +1137,7 @@ AmlEnumeratePathCallback (
CurrNodePathSize = AmlStreamGetMaxBufferSize (CurrNodePathBStream); CurrNodePathSize = AmlStreamGetMaxBufferSize (CurrNodePathBStream);
if (CurrNodePathSize == 0) { if (CurrNodePathSize == 0) {
ASSERT (0); ASSERT (0);
Status1 = EFI_INVALID_PARAMETER; Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE; ContinueEnum = FALSE;
goto exit_handler; goto exit_handler;
} }
@ -1137,26 +1158,28 @@ 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"));
// Compare the searched path and Node's path. // Compare the searched path and Node's path.
if ((AmlStreamGetIndex (CurrNodePathBStream) == if ((AmlStreamGetIndex (CurrNodePathBStream) ==
AmlStreamGetIndex (SearchPathBStream)) && AmlStreamGetIndex (SearchPathBStream)) &&
(CompareMem ( (CompareMem (
AmlStreamGetCurrPos (CurrNodePathBStream), AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetCurrPos (SearchPathBStream), AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream)) == 0)) { AmlStreamGetIndex (SearchPathBStream)
Status1 = EFI_SUCCESS; ) == 0))
ContinueEnum = FALSE; {
Status1 = EFI_SUCCESS;
ContinueEnum = FALSE;
PathSearchContext->OutNode = Node; PathSearchContext->OutNode = Node;
} else { } else {
// If the paths don't match, reset the CurrNodePathStream's content. // If the paths don't match, reset the CurrNodePathStream's content.
@ -1210,27 +1233,29 @@ 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;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
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;
} }
@ -1264,10 +1289,10 @@ 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)) {
ASSERT (0); ASSERT (0);
goto exit_handler; goto exit_handler;
@ -1347,47 +1372,49 @@ 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;
} }
*OutNode = NULL; *OutNode = NULL;
RawAmlAbsCurrNodePathBuffer = NULL; RawAmlAbsCurrNodePathBuffer = NULL;
// 1. Build a raw absolute AML path from the reference node and the ASL // 1. Build a raw absolute AML path from the reference node and the ASL
// path. For this: // path. For this:
// 1.1. First initialize a backward stream. // 1.1. First initialize a backward stream.
RawAmlAbsSearchPathBufferSize = MAX_AML_NAMESTRING_SIZE; RawAmlAbsSearchPathBufferSize = MAX_AML_NAMESTRING_SIZE;
RawAmlAbsSearchPathBuffer = AllocateZeroPool (RawAmlAbsSearchPathBufferSize); RawAmlAbsSearchPathBuffer = AllocateZeroPool (RawAmlAbsSearchPathBufferSize);
if (RawAmlAbsSearchPathBuffer == NULL) { if (RawAmlAbsSearchPathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -1395,7 +1422,7 @@ AmlFindNode (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAmlAbsSearchPathBStream, &RawAmlAbsSearchPathBStream,
(UINT8*)RawAmlAbsSearchPathBuffer, (UINT8 *)RawAmlAbsSearchPathBuffer,
RawAmlAbsSearchPathBufferSize, RawAmlAbsSearchPathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -1427,8 +1454,8 @@ 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;
} }
@ -1436,9 +1463,9 @@ AmlFindNode (
// during enumeration. This prevents from doing multiple allocation/free // during enumeration. This prevents from doing multiple allocation/free
// operations. // operations.
RawAmlAbsCurrNodePathBufferSize = MAX_ASL_NAMESTRING_SIZE; RawAmlAbsCurrNodePathBufferSize = MAX_ASL_NAMESTRING_SIZE;
RawAmlAbsCurrNodePathBuffer = AllocateZeroPool ( RawAmlAbsCurrNodePathBuffer = AllocateZeroPool (
RawAmlAbsCurrNodePathBufferSize RawAmlAbsCurrNodePathBufferSize
); );
if (RawAmlAbsCurrNodePathBuffer == NULL) { if (RawAmlAbsCurrNodePathBuffer == NULL) {
ASSERT (0); ASSERT (0);
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
@ -1447,7 +1474,7 @@ AmlFindNode (
Status = AmlStreamInit ( Status = AmlStreamInit (
&RawAmlAbsCurrNodePathBStream, &RawAmlAbsCurrNodePathBStream,
(UINT8*)RawAmlAbsCurrNodePathBuffer, (UINT8 *)RawAmlAbsCurrNodePathBuffer,
RawAmlAbsCurrNodePathBufferSize, RawAmlAbsCurrNodePathBufferSize,
EAmlStreamDirectionBackward EAmlStreamDirectionBackward
); );
@ -1462,17 +1489,17 @@ AmlFindNode (
// - CurrNodePathStream: backward stream containing the raw absolute AML // - CurrNodePathStream: backward stream containing the raw absolute AML
// of the node currently being enumerated; // of the node currently being enumerated;
// - OutNode: node pointer to the store the potentially found node. // - OutNode: node pointer to the store the potentially found node.
PathSearchContext.SearchPathBStream = &RawAmlAbsSearchPathBStream; PathSearchContext.SearchPathBStream = &RawAmlAbsSearchPathBStream;
PathSearchContext.CurrNodePathBStream = &RawAmlAbsCurrNodePathBStream; PathSearchContext.CurrNodePathBStream = &RawAmlAbsCurrNodePathBStream;
PathSearchContext.OutNode = NULL; PathSearchContext.OutNode = NULL;
// 6. Iterate through the namespace nodes of the tree. // 6. Iterate through the namespace nodes of the tree.
// 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,31 +46,32 @@ 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;
// 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 field element. // The byte encoding must be a field element.
if ((FieldByteEncoding == NULL) || if ((FieldByteEncoding == NULL) ||
((FieldByteEncoding->Attribute & AML_IS_FIELD_ELEMENT) == 0) || ((FieldByteEncoding->Attribute & AML_IS_FIELD_ELEMENT) == 0) ||
((FieldByteEncoding->Attribute & AML_IS_PSEUDO_OPCODE) == ((FieldByteEncoding->Attribute & AML_IS_PSEUDO_OPCODE) ==
AML_IS_PSEUDO_OPCODE) || AML_IS_PSEUDO_OPCODE) ||
!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST) || !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;
} }
@ -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;
} }
@ -144,10 +146,10 @@ AmlParseFieldElement (
if (!IS_END_OF_STREAM (FStream)) { if (!IS_END_OF_STREAM (FStream)) {
// Parse the fixed arguments of the field element. // Parse the fixed arguments of the field element.
Status = AmlParseFixedArguments ( Status = AmlParseFixedArguments (
NewNode, NewNode,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
} }
@ -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;
} }
@ -129,10 +130,10 @@ AmlCreateMethodRefNode (
} }
NameSpaceRefNode->RawAbsolutePathSize = RawAbsolutePathSize; NameSpaceRefNode->RawAbsolutePathSize = RawAbsolutePathSize;
NameSpaceRefNode->RawAbsolutePath = AllocateCopyPool ( NameSpaceRefNode->RawAbsolutePath = AllocateCopyPool (
RawAbsolutePathSize, RawAbsolutePathSize,
RawAbsolutePath RawAbsolutePath
); );
if (NameSpaceRefNode->RawAbsolutePath == NULL) { if (NameSpaceRefNode->RawAbsolutePath == NULL) {
FreePool (NameSpaceRefNode); FreePool (NameSpaceRefNode);
ASSERT (0); ASSERT (0);
@ -142,7 +143,7 @@ AmlCreateMethodRefNode (
InitializeListHead (&NameSpaceRefNode->Link); InitializeListHead (&NameSpaceRefNode->Link);
NameSpaceRefNode->NodeRef = ObjectNode; NameSpaceRefNode->NodeRef = ObjectNode;
*NameSpaceRefNodePtr = NameSpaceRefNode; *NameSpaceRefNodePtr = NameSpaceRefNode;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -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,28 +216,29 @@ 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;
UINT32 SegCount; UINT32 SegCount;
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,11 +257,11 @@ 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
); );
if (RawPathBuffer == NULL) { if (RawPathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -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,20 +386,20 @@ 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;
UINT32 SegCount; UINT32 SegCount;
if ((!IS_AML_OBJECT_NODE (ParentNode) && if ((!IS_AML_OBJECT_NODE (ParentNode) &&
!IS_AML_ROOT_NODE (ParentNode)) || !IS_AML_ROOT_NODE (ParentNode)) ||
@ -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,11 +435,11 @@ 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
); );
Status = AmlStreamWrite ( Status = AmlStreamWrite (
AbsolutePathBStream, AbsolutePathBStream,
@ -487,19 +494,19 @@ 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;
UINT32 Index; UINT32 Index;
AML_STREAM RawFStream1Clone; AML_STREAM RawFStream1Clone;
AML_STREAM RawFStream2Clone; AML_STREAM RawFStream2Clone;
UINT32 Stream1Size; UINT32 Stream1Size;
UINT32 Stream2Size; UINT32 Stream2Size;
UINT32 CompareLen; UINT32 CompareLen;
// Raw NameStrings have a size that is a multiple of the size of NameSegs. // Raw NameStrings have a size that is a multiple of the size of NameSegs.
if (!IS_STREAM (RawFStream1) || if (!IS_STREAM (RawFStream1) ||
@ -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;
} }
@ -537,14 +545,16 @@ AmlCompareRawNameString (
} }
CompareLen = MIN (Stream1Size, Stream2Size); CompareLen = MIN (Stream1Size, Stream2Size);
Index = 0; Index = 0;
// Check there is enough space for a NameSeg in both Stream1 and Stream2. // Check there is enough space for a NameSeg in both Stream1 and Stream2.
while (Index < CompareLen) { while (Index < CompareLen) {
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,28 +610,29 @@ 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) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -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,27 +722,27 @@ 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;
UINT32 PathNameSegScopeCount; UINT32 PathNameSegScopeCount;
UINT32 ProbedScopeCount; UINT32 ProbedScopeCount;
UINT32 BestScopeCount; UINT32 BestScopeCount;
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,21 +764,21 @@ 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"));
BestNameSpaceRefNode = NULL; BestNameSpaceRefNode = NULL;
BestScopeCount = 0; BestScopeCount = 0;
NameSegScopeCount = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream); NameSegScopeCount = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream);
PathNameSegScopeCount = AmlStreamGetMaxBufferSize (RawPathNameBStream); PathNameSegScopeCount = AmlStreamGetMaxBufferSize (RawPathNameBStream);
// Iterate through the raw AML absolute path to find the best match. // Iterate through the raw AML absolute path to find the best match.
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
); );
@ -847,7 +862,7 @@ AmlFindMethodDefinition (
} else if (ProbedScopeCount > BestScopeCount) { } else if (ProbedScopeCount > BestScopeCount) {
// The probed node has more scope levels in common than the // The probed node has more scope levels in common than the
// last best match. Update the best match. // last best match. Update the best match.
BestScopeCount = ProbedScopeCount; BestScopeCount = ProbedScopeCount;
BestNameSpaceRefNode = ProbedNameSpaceRefNode; BestNameSpaceRefNode = ProbedNameSpaceRefNode;
} else if (ProbedScopeCount == BestScopeCount) { } else if (ProbedScopeCount == BestScopeCount) {
// The probed node has the same number of scope levels in // The probed node has the same number of scope levels in
@ -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,22 +963,22 @@ 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;
AML_STREAM RawPathNameBStream; AML_STREAM RawPathNameBStream;
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,22 +986,25 @@ 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;
} }
// Allocate memory for the raw absolute path. // Allocate memory for the raw absolute path.
RawAbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE; RawAbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
RawAbsolutePathBuffer = AllocateZeroPool (RawAbsolutePathBufferSize); RawAbsolutePathBuffer = AllocateZeroPool (RawAbsolutePathBufferSize);
if (RawAbsolutePathBuffer == NULL) { if (RawAbsolutePathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -1018,7 +1041,7 @@ AmlIsMethodInvocation (
"Root node cannot be a method invocation\n" "Root node cannot be a method invocation\n"
)); ));
*OutNameSpaceRefNode = NULL; *OutNameSpaceRefNode = NULL;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto exit_handler; goto exit_handler;
} }
@ -1049,18 +1072,18 @@ AmlIsMethodInvocation (
// Go through the NameSpaceRefList elements to check for // Go through the NameSpaceRefList elements to check for
// a corresponding method definition. // a corresponding method definition.
NameSpaceRefNode = NULL; NameSpaceRefNode = NULL;
Status = AmlFindMethodDefinition ( Status = AmlFindMethodDefinition (
&RawAbsolutePathFStream, &RawAbsolutePathFStream,
&RawPathNameBStream, &RawPathNameBStream,
NameSpaceRefList, NameSpaceRefList,
&NameSpaceRefNode &NameSpaceRefNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
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;
} }
@ -1133,7 +1157,7 @@ AmlAddNameSpaceReference (
// Allocate a buffer to get the raw AML absolute pathname of the // Allocate a buffer to get the raw AML absolute pathname of the
// namespace node. // namespace node.
AbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE; AbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
AbsolutePathBuffer = AllocateZeroPool (AbsolutePathBufferSize); AbsolutePathBuffer = AllocateZeroPool (AbsolutePathBufferSize);
if (AbsolutePathBuffer == NULL) { if (AbsolutePathBuffer == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -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,31 +1300,32 @@ 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)) {
// Cf ACPI 6.3 specification: // Cf ACPI 6.3 specification:
@ -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);
@ -1359,12 +1385,12 @@ AmlCreateMethodInvocationNode (
// Create a data node holding the number of arguments // Create a data node holding the number of arguments
// of the method invocation. // of the method invocation.
ArgCountNode = NULL; ArgCountNode = NULL;
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
EAmlNodeDataTypeUInt, EAmlNodeDataTypeUInt,
&ArgCount, &ArgCount,
sizeof (UINT8), sizeof (UINT8),
&ArgCountNode &ArgCountNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
goto error_handler; goto error_handler;
@ -1372,10 +1398,10 @@ AmlCreateMethodInvocationNode (
// The second fixed argument is the number of arguments. // The second fixed argument is the number of arguments.
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);
goto error_handler; goto error_handler;
@ -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;
} }
@ -1432,7 +1459,7 @@ AmlGetMethodInvocationArgCount (
// Check whether MethodInvocationNode is a method invocation. // Check whether MethodInvocationNode is a method invocation.
if (!AmlNodeCompareOpCode (MethodInvocationNode, AML_METHOD_INVOC_OP, 0)) { if (!AmlNodeCompareOpCode (MethodInvocationNode, AML_METHOD_INVOC_OP, 0)) {
*IsMethodInvocation = FALSE; *IsMethodInvocation = FALSE;
*ArgCount = 0; *ArgCount = 0;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -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

@ -23,20 +23,20 @@
typedef struct AmlNameSpaceRefNode { typedef struct AmlNameSpaceRefNode {
/// Double linked list. /// Double linked list.
/// This must be the first field in this structure. /// This must be the first field in this structure.
LIST_ENTRY Link; LIST_ENTRY Link;
/// 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;
} AML_NAMESPACE_REF_NODE; } AML_NAMESPACE_REF_NODE;
/** Delete a list of namespace reference nodes. /** Delete a list of namespace reference nodes.
@ -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,14 +130,14 @@ 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;
UINT32 UIntXSize; UINT32 UIntXSize;
if ((!IS_AML_ROOT_NODE (ParentNode) && if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
@ -148,34 +148,35 @@ 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;
} }
switch (ExpectedFormat) { switch (ExpectedFormat) {
case EAmlUInt8: case EAmlUInt8:
UIntXSize = 1; UIntXSize = 1;
break; break;
case EAmlUInt16: case EAmlUInt16:
UIntXSize = 2; UIntXSize = 2;
break; break;
case EAmlUInt32: case EAmlUInt32:
UIntXSize = 4; UIntXSize = 4;
break; break;
case EAmlUInt64: case EAmlUInt64:
UIntXSize = 8; UIntXSize = 8;
break; break;
default: default:
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
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,17 +217,17 @@ 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) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_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,21 +378,21 @@ 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;
UINT8 OpCodeSize; UINT8 OpCodeSize;
UINT32 PkgLength; UINT32 PkgLength;
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);
@ -577,7 +587,7 @@ AmlParseFieldPkgLen (
statements. The AML_PARSE_FORMAT enum definition lists these constructs statements. The AML_PARSE_FORMAT enum definition lists these constructs
and the corresponding parsing functions. and the corresponding parsing functions.
*/ */
AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax] = { AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax] = {
NULL, // EAmlNone NULL, // EAmlNone
AmlParseUIntX, // EAmlUInt8 AmlParseUIntX, // EAmlUInt8
AmlParseUIntX, // EAmlUInt16 AmlParseUIntX, // EAmlUInt16
@ -611,23 +621,24 @@ 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) &&
!IS_AML_OBJECT_NODE (ParentNode)) || !IS_AML_OBJECT_NODE (ParentNode)) ||
!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;
} }
@ -646,12 +657,12 @@ AmlCheckAndParseMethodInvoc (
// Check whether the NameString is a method invocation. // Check whether the NameString is a method invocation.
NameSpaceRefNode = NULL; NameSpaceRefNode = NULL;
Status = AmlIsMethodInvocation ( Status = AmlIsMethodInvocation (
ParentNode, ParentNode,
&FStream, &FStream,
NameSpaceRefList, NameSpaceRefList,
&NameSpaceRefNode &NameSpaceRefNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -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,9 +850,9 @@ AmlParseByteList (
} }
Status = AmlVarListAddTailInternal ( Status = AmlVarListAddTailInternal (
(AML_NODE_HEADER*)BufferNode, (AML_NODE_HEADER *)BufferNode,
NewNode NewNode
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
AmlDeleteTree (NewNode); AmlDeleteTree (NewNode);
@ -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,34 +1030,35 @@ 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;
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,25 +1160,26 @@ 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;
if (!IS_AML_ROOT_NODE (RootNode) || if (!IS_AML_ROOT_NODE (RootNode) ||
!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,18 +1206,19 @@ 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;
if (!IS_AML_OBJECT_NODE (ObjectNode) || if (!IS_AML_OBJECT_NODE (ObjectNode) ||
!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,23 +1271,23 @@ 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
); );
} else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_BYTE_LIST)) { } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_BYTE_LIST)) {
// Parse the byte list if present. // Parse the byte list if present.
Status = AmlParseByteList ( Status = AmlParseByteList (
ObjectNode, ObjectNode,
FStream FStream
); );
} else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_FIELD_LIST)) { } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_FIELD_LIST)) {
// Parse the field list if present. // Parse the field list if present.
Status = AmlParseFieldList ( Status = AmlParseFieldList (
ObjectNode, ObjectNode,
FStream, FStream,
NameSpaceRefList NameSpaceRefList
); );
} }
// Check status and assert // Check status and assert
@ -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;
} }
@ -187,19 +197,22 @@ 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;
} }
InFunctionDesc = FALSE; InFunctionDesc = FALSE;
while (TRUE) { while (TRUE) {
FreeSpace = AmlStreamGetFreeSpace (&SubStream); FreeSpace = AmlStreamGetFreeSpace (&SubStream);
CurrRdElement = AmlStreamGetCurrPos (&SubStream); CurrRdElement = AmlStreamGetCurrPos (&SubStream);
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,8 +28,8 @@
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
) )
{ {
if (Header == NULL) { if (Header == NULL) {
@ -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,13 +93,13 @@ 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);
} }
/** Set the Checksum of an EndTag resource data. /** Set the Checksum of an EndTag resource data.
@ -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

@ -58,19 +58,19 @@ typedef UINT8 AML_RD_HEADER;
@ingroup ResourceDataStructures @ingroup ResourceDataStructures
*/ */
#define AML_RD_SMALL_SIZE_MASK (0x7U) #define AML_RD_SMALL_SIZE_MASK (0x7U)
/** Mask for the small resource data ID. /** Mask for the small resource data ID.
@ingroup ResourceDataStructures @ingroup ResourceDataStructures
*/ */
#define AML_RD_SMALL_ID_MASK (0xFU << 3) #define AML_RD_SMALL_ID_MASK (0xFU << 3)
/** Mask for the large resource data ID. /** Mask for the large resource data ID.
@ingroup ResourceDataStructures @ingroup ResourceDataStructures
*/ */
#define AML_RD_LARGE_ID_MASK (0x7FU) #define AML_RD_LARGE_ID_MASK (0x7FU)
/** /**
@defgroup ResourceDataApis Resource data APIs @defgroup ResourceDataApis Resource data APIs
@ -133,8 +133,8 @@ 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
); );
/** Get the descriptor Id of the resource data. /** Get the descriptor Id of the resource data.
@ -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,8 +188,8 @@ 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
); );
#endif // AML_RESOURCE_DATA_H_ #endif // AML_RESOURCE_DATA_H_

View File

@ -38,29 +38,30 @@ 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;
goto error_handler; goto error_handler;
} }
@ -68,44 +69,47 @@ 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,
DataNode->Size DataNode->Size
); );
if (EFI_ERROR (Status1)) { if (EFI_ERROR (Status1)) {
ASSERT (0); ASSERT (0);
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,26 +174,27 @@ 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;
AML_STREAM FStream; AML_STREAM FStream;
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)) {
ASSERT (0); ASSERT (0);
return Status; return 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,23 +273,24 @@ 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;
} }
*Table = NULL; *Table = NULL;
TableBuffer = NULL; TableBuffer = NULL;
TableSize = 0; TableSize = 0;
// Get the size of the SSDT table. // Get the size of the SSDT table.
Status = AmlSerializeTree ( Status = AmlSerializeTree (
@ -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,25 +23,26 @@
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
) )
{ {
if ((Stream == NULL) || if ((Stream == NULL) ||
(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;
} }
Stream->Buffer = Buffer; Stream->Buffer = Buffer;
Stream->MaxBufferSize = MaxBufferSize; Stream->MaxBufferSize = MaxBufferSize;
Stream->Index = 0; Stream->Index = 0;
Stream->Direction = Direction; Stream->Direction = Direction;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -60,20 +61,21 @@ 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;
} }
ClonedStream->Buffer = Stream->Buffer; ClonedStream->Buffer = Stream->Buffer;
ClonedStream->MaxBufferSize = Stream->MaxBufferSize; ClonedStream->MaxBufferSize = Stream->MaxBufferSize;
ClonedStream->Index = Stream->Index; ClonedStream->Index = Stream->Index;
ClonedStream->Direction = Stream->Direction; ClonedStream->Direction = Stream->Direction;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -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;
} }
@ -125,8 +128,8 @@ AmlStreamInitSubStream (
} }
SubStream->MaxBufferSize = AmlStreamGetFreeSpace (Stream); SubStream->MaxBufferSize = AmlStreamGetFreeSpace (Stream);
SubStream->Index = 0; SubStream->Index = 0;
SubStream->Direction = Stream->Direction; SubStream->Direction = Stream->Direction;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -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);
@ -606,10 +621,10 @@ AmlStreamCmp (
// ^ // ^
// CurrPos // CurrPos
return (0 == CompareMem ( return (0 == CompareMem (
CurrPosStream1 - (MinSize - 1), CurrPosStream1 - (MinSize - 1),
CurrPosStream2 - (MinSize - 1), CurrPosStream2 - (MinSize - 1),
MinSize MinSize
)); ));
} }
/** Copy Size bytes of the stream's data to DstBuffer. /** Copy Size bytes of the stream's data to DstBuffer.
@ -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,9 +671,9 @@ 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));
CopyMem (DstBuffer, StreamBufferStart, Size); CopyMem (DstBuffer, StreamBufferStart, Size);

View File

@ -31,17 +31,17 @@ 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;
/// Index in the Buffer. /// Index in the Buffer.
/// The Index field allows to keep track of how many bytes have been /// The Index field allows to keep track of how many bytes have been
/// read/written in the Buffer, and to retrieve the current stream position. /// read/written in the Buffer, and to retrieve the current stream position.
/// 0 <= Index <= MaxBufferSize. /// 0 <= Index <= MaxBufferSize.
/// If Index == MaxBufferSize, no more action is allowed on the stream. /// If Index == MaxBufferSize, no more action is allowed on the stream.
UINT32 Index; UINT32 Index;
/// The direction the stream is progressing. /// The direction the stream is progressing.
/// If the stream goes backward (toward lower addresses), the bytes written /// If the stream goes backward (toward lower addresses), the bytes written
@ -56,7 +56,7 @@ typedef struct AmlStream {
/// +---------------+-----+-----+-----+-----+-----+-----+---- +------+ /// +---------------+-----+-----+-----+-----+-----+-----+---- +------+
/// ^ /// ^
/// Current position. /// Current position.
EAML_STREAM_DIRECTION Direction; EAML_STREAM_DIRECTION Direction;
} AML_STREAM; } AML_STREAM;
/** Check whether a StreamPtr is a valid Stream. /** Check whether a StreamPtr is a valid Stream.
@ -88,7 +88,7 @@ typedef struct AmlStream {
@retval TRUE Stream goes forward. @retval TRUE Stream goes forward.
@retval FALSE Otherwise. @retval FALSE Otherwise.
*/ */
#define IS_STREAM_FORWARD(Stream) ( \ #define IS_STREAM_FORWARD(Stream) ( \
((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionForward) ((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionForward)
/** Check Stream goes backward. /** Check Stream goes backward.
@ -98,7 +98,7 @@ typedef struct AmlStream {
@retval TRUE Stream goes backward. @retval TRUE Stream goes backward.
@retval FALSE Otherwise. @retval FALSE Otherwise.
*/ */
#define IS_STREAM_BACKWARD(Stream) ( \ #define IS_STREAM_BACKWARD(Stream) ( \
((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionBackward) ((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionBackward)
/** Initialize a stream. /** Initialize a stream.
@ -116,10 +116,10 @@ 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
); );
/** Clone a stream. /** Clone a stream.
@ -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,8 +209,8 @@ AmlStreamGetMaxBufferSize (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamReduceMaxBufferSize ( AmlStreamReduceMaxBufferSize (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Diff IN UINT32 Diff
); );
/** Get Stream's Index. /** Get Stream's Index.
@ -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,8 +287,8 @@ AmlStreamGetFreeSpace (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamProgress ( AmlStreamProgress (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
); );
/** Rewind Stream of Offset bytes. /** Rewind Stream of Offset bytes.
@ -306,8 +306,8 @@ AmlStreamProgress (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AmlStreamRewind ( AmlStreamRewind (
IN AML_STREAM * Stream, IN AML_STREAM *Stream,
IN UINT32 Offset IN UINT32 Offset
); );
/** Reset the Stream (move the current position to the initial position). /** Reset the Stream (move the current position to the initial position).
@ -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,9 +388,9 @@ 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
); );
/** Compare Size bytes between Stream1 and Stream2 from their /** Compare Size bytes between Stream1 and Stream2 from their
@ -416,9 +416,9 @@ 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
); );
/** Copy Size bytes of the stream's data to DstBuffer. /** Copy Size bytes of the stream's data to DstBuffer.
@ -442,10 +442,10 @@ 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
); );
#endif // AML_STREAM_H_ #endif // AML_STREAM_H_

View File

@ -30,18 +30,20 @@
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNameString ( AmlIsNameString (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
) )
{ {
if (((Root == 0) || (Root == 1)) && if (((Root == 0) || (Root == 1)) &&
(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) {
@ -139,10 +142,10 @@ AmlIsRootPath (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsLeadNameChar ( 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,10 +242,10 @@ AslIsNameSeg (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNameSeg ( AmlIsNameSeg (
IN CONST CHAR8 * AmlBuffer IN CONST CHAR8 *AmlBuffer
) )
{ {
UINT32 Index; UINT32 Index;
if (AmlBuffer == NULL) { if (AmlBuffer == NULL) {
return FALSE; return FALSE;
@ -279,25 +284,26 @@ 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;
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;
} }
*Root = 0; *Root = 0;
*ParentPrefix = 0; *ParentPrefix = 0;
*SegCount = 0; *SegCount = 0;
// Handle Root and ParentPrefix(s). // Handle Root and ParentPrefix(s).
if (*Buffer == AML_ROOT_CHAR) { if (*Buffer == AML_ROOT_CHAR) {
@ -363,23 +369,24 @@ 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;
} }
*Root = 0; *Root = 0;
*ParentPrefix = 0; *ParentPrefix = 0;
*SegCount = 0; *SegCount = 0;
// Handle Root and ParentPrefix(s). // Handle Root and ParentPrefix(s).
if (*Buffer == AML_ROOT_CHAR) { if (*Buffer == AML_ROOT_CHAR) {
@ -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) {
@ -430,12 +437,12 @@ AmlParseNameStringInfo (
UINT32 UINT32
EFIAPI EFIAPI
AslComputeNameStringSize ( AslComputeNameStringSize (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
) )
{ {
UINT32 TotalSize; UINT32 TotalSize;
if (!AmlIsNameString (Root, ParentPrefix, SegCount)) { if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
ASSERT (0); ASSERT (0);
@ -472,12 +479,12 @@ AslComputeNameStringSize (
UINT32 UINT32
EFIAPI EFIAPI
AmlComputeNameStringSize ( AmlComputeNameStringSize (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
) )
{ {
UINT32 TotalSize; UINT32 TotalSize;
if (!AmlIsNameString (Root, ParentPrefix, SegCount)) { if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
ASSERT (0); ASSERT (0);
@ -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,18 +545,19 @@ 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;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
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,24 +596,25 @@ 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;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
UINT32 SegCount; UINT32 SegCount;
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,10 +730,11 @@ 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); {
Status = EFI_INVALID_PARAMETER; ASSERT (0);
goto error_handler; Status = EFI_INVALID_PARAMETER;
goto error_handler;
} }
*OutAmlPath = AmlPath; *OutAmlPath = AmlPath;
@ -749,23 +759,24 @@ 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;
UINT32 Root; UINT32 Root;
UINT32 ParentPrefix; UINT32 ParentPrefix;
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,16 +871,17 @@ 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;
UINT32 AslName1Len; UINT32 AslName1Len;
UINT32 AslName2Len; UINT32 AslName2Len;
if ((AslName1 == NULL) || if ((AslName1 == NULL) ||
(AslName2 == NULL)) { (AslName2 == NULL))
{
ASSERT (0); ASSERT (0);
return FALSE; return FALSE;
} }
@ -905,16 +917,17 @@ 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;
UINT32 AmlName1Len; UINT32 AmlName1Len;
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,9 +1019,9 @@ 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
) )
{ {
if (AmlPath == NULL) { if (AmlPath == NULL) {

View File

@ -42,9 +42,9 @@
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsNameString ( AmlIsNameString (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
); );
/** Copy bytes from SrcBuffer to DstBuffer and convert to upper case. /** Copy bytes from SrcBuffer to DstBuffer and convert to upper case.
@ -63,10 +63,10 @@ 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
); );
/** Check whether Buffer is a root path ('\'). /** Check whether Buffer is a root path ('\').
@ -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.
@ -103,7 +103,7 @@ AmlIsRootPath (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
AmlIsLeadNameChar ( AmlIsLeadNameChar (
IN CHAR8 Ch IN CHAR8 Ch
); );
/** Check whether Ch is an ASL/AML NameChar. /** Check whether Ch is an ASL/AML NameChar.
@ -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
@ -233,9 +233,9 @@ AmlParseNameStringInfo (
UINT32 UINT32
EFIAPI EFIAPI
AslComputeNameStringSize ( AslComputeNameStringSize (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
); );
/** Compute the AML NameString/path size from NameString /** Compute the AML NameString/path size from NameString
@ -253,9 +253,9 @@ AslComputeNameStringSize (
UINT32 UINT32
EFIAPI EFIAPI
AmlComputeNameStringSize ( AmlComputeNameStringSize (
IN UINT32 Root, IN UINT32 Root,
IN UINT32 ParentPrefix, IN UINT32 ParentPrefix,
IN UINT32 SegCount IN UINT32 SegCount
); );
/** Get the ASL NameString/path size. /** Get the ASL NameString/path size.
@ -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,9 +393,9 @@ 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
); );
#endif // AML_STRING_H_ #endif // AML_STRING_H_

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,8 +24,8 @@ 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
) )
{ {
if (Node == NULL) { if (Node == NULL) {
@ -35,7 +35,7 @@ AmlInitializeNodeHeader (
InitializeListHead (&Node->Link); InitializeListHead (&Node->Link);
Node->Parent = NULL; Node->Parent = NULL;
Node->NodeType = NodeType; Node->NodeType = NodeType;
return EFI_SUCCESS; return EFI_SUCCESS;
@ -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;
} }
@ -212,7 +214,7 @@ AmlCreateObjectNode (
// ObjectNode->FixedArgs[...] is already initialised to NULL as the // ObjectNode->FixedArgs[...] is already initialised to NULL as the
// ObjectNode is Zero allocated. // ObjectNode is Zero allocated.
ObjectNode->AmlByteEncoding = AmlByteEncoding; ObjectNode->AmlByteEncoding = AmlByteEncoding;
ObjectNode->PkgLen = PkgLength; ObjectNode->PkgLen = PkgLength;
*NewObjectNodePtr = ObjectNode; *NewObjectNodePtr = ObjectNode;
@ -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)) {
@ -271,14 +273,14 @@ AmlDeleteDataNode (
EFI_STATUS 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;
} }
@ -317,7 +320,7 @@ AmlCreateDataNode (
} }
DataNode->DataType = DataType; DataNode->DataType = DataType;
DataNode->Size = DataSize; DataNode->Size = DataSize;
*NewDataNodePtr = DataNode; *NewDataNodePtr = DataNode;
@ -334,17 +337,18 @@ 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;
EAML_PARSE_INDEX Index; EAML_PARSE_INDEX Index;
// Check that the node being deleted is unlinked. // Check that the node being deleted is unlinked.
// 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,21 +455,22 @@ 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;
} }
ASSERT (AmlIsOpCodeValid (OpCode, SubOpCode)); ASSERT (AmlIsOpCodeValid (OpCode, SubOpCode));
return ((ObjectNode->AmlByteEncoding->OpCode == OpCode) && return ((ObjectNode->AmlByteEncoding->OpCode == OpCode) &&
(ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ? (ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ?
TRUE : FALSE; TRUE : FALSE;
} }
/** Check whether a Node is an integer node. /** Check whether a Node is an integer node.
@ -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.
@ -72,10 +72,10 @@ AmlCreateObjectNode (
EFI_STATUS 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,8 +104,8 @@ 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
); );
/** Check whether ObjectNode has the input OpCode/SubOpcode couple. /** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@ -121,9 +121,9 @@ 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
); );
/** Check whether a Node is an integer node. /** Check whether a Node is an integer node.
@ -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,14 +297,14 @@ 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;
} }
RootNode->SdtHeader->Length = Length + RootNode->SdtHeader->Length = Length +
(UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER); (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
return Status; return Status;
} }
@ -323,18 +333,19 @@ 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
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
INT8 ValueWidthDiff; INT8 ValueWidthDiff;
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.
@ -547,8 +570,8 @@ AmlUpdateDataNode (
DataNode->NodeHeader.Parent, DataNode->NodeHeader.Parent,
(Size > DataNode->Size) ? TRUE : FALSE, (Size > DataNode->Size) ? TRUE : FALSE,
(Size > DataNode->Size) ? (Size > DataNode->Size) ?
(Size - DataNode->Size) : (Size - DataNode->Size) :
(DataNode->Size - Size), (DataNode->Size - Size),
0 0
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -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,8 +79,8 @@ 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
) )
{ {
if (IS_AML_OBJECT_NODE (ObjectNode)) { if (IS_AML_OBJECT_NODE (ObjectNode)) {
@ -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,22 +606,24 @@ 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,23 +646,24 @@ 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;
// 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_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,11 +757,11 @@ 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
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
return Status; return Status;
@ -760,18 +784,18 @@ 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;
UINT32 NewSize; UINT32 NewSize;
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,20 +913,21 @@ 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.
if ((!IS_AML_DATA_NODE (OldNode) && if ((!IS_AML_DATA_NODE (OldNode) &&
!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,18 +975,18 @@ 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;
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,25 +33,26 @@
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;
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,47 +280,48 @@ 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
) )
); );
if (InternalIterator == NULL) { if (InternalIterator == NULL) {
ASSERT (0); ASSERT (0);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
InternalIterator->InitialNode = Node; InternalIterator->InitialNode = Node;
InternalIterator->CurrentNode = Node; InternalIterator->CurrentNode = Node;
InternalIterator->Mode = IteratorMode; InternalIterator->Mode = IteratorMode;
InternalIterator->Iterator.GetNode = AmlIteratorGetNode; InternalIterator->Iterator.GetNode = AmlIteratorGetNode;
switch (InternalIterator->Mode) { switch (InternalIterator->Mode) {
case EAmlIteratorLinear: case EAmlIteratorLinear:
{ {
InternalIterator->Iterator.GetNext = AmlIteratorGetNextLinear; InternalIterator->Iterator.GetNext = AmlIteratorGetNextLinear;
InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousLinear; InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousLinear;
break; break;
} }
case EAmlIteratorBranch: case EAmlIteratorBranch:
{ {
InternalIterator->Iterator.GetNext = AmlIteratorGetNextBranch; InternalIterator->Iterator.GetNext = AmlIteratorGetNextBranch;
InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousBranch; InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousBranch;
break; break;
} }
@ -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.
@ -166,16 +166,15 @@ EFI_STATUS
*/ */
typedef struct AmlTreeIterator { typedef struct AmlTreeIterator {
/// Get the current node of the iterator. /// Get the current node of the iterator.
EDKII_AML_TREE_ITERATOR_GET_NODE GetNode; EDKII_AML_TREE_ITERATOR_GET_NODE GetNode;
/// Update the current node of the iterator with the next node. /// Update the current node of the iterator with the next node.
EDKII_AML_TREE_ITERATOR_GET_NEXT GetNext; EDKII_AML_TREE_ITERATOR_GET_NEXT GetNext;
/// Update the current node of the iterator with the previous node. /// Update the current node of the iterator with the previous node.
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
@ -194,9 +193,9 @@ typedef struct AmlTreeIterator {
EFI_STATUS EFI_STATUS
EFIAPI 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. )
// Get the first argument of the variable list of arguments. {
// It is at the last argument of the fixed argument list.
// 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) {
@ -531,7 +543,7 @@ AmlGetPreviousNode (
// then get the last child of this node. // then get the last child of this node.
// If this node has children, get its last child, etc. // If this node has children, get its last child, etc.
while (1) { while (1) {
PreviousNode = CandidateNode; PreviousNode = CandidateNode;
CandidateNode = AmlGetPreviousSibling (PreviousNode, NULL); CandidateNode = AmlGetPreviousSibling (PreviousNode, NULL);
if (CandidateNode == NULL) { if (CandidateNode == NULL) {
return PreviousNode; return PreviousNode;
@ -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,21 +22,21 @@
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;
if (AcpiTable == NULL) { if (AcpiTable == NULL) {
ASSERT (0); ASSERT (0);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Ptr = (UINT8*)AcpiTable; Ptr = (UINT8 *)AcpiTable;
Size = AcpiTable->Length; Size = AcpiTable->Length;
Sum = 0; Sum = 0;
// Set the checksum field to 0 first. // Set the checksum field to 0 first.
AcpiTable->Checksum = 0; AcpiTable->Checksum = 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);
@ -300,11 +312,11 @@ AmlUnwindSpecialInteger (
} }
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
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);
return Status; return Status;
@ -323,10 +335,10 @@ 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);
goto error_handler; goto error_handler;
@ -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;
} }
@ -416,7 +431,7 @@ AmlNodeSetIntegerValue (
// The value can be encoded with a special 0 or 1 OpCode. // The value can be encoded with a special 0 or 1 OpCode.
// The AML_ONES_OP is not handled. // The AML_ONES_OP is not handled.
if (NewValue <= 1) { if (NewValue <= 1) {
NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP; NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
Node->AmlByteEncoding = AmlGetByteEncodingByOpCode (NewOpCode, 0); Node->AmlByteEncoding = AmlGetByteEncodingByOpCode (NewOpCode, 0);
// The value is encoded with a AML_ZERO_OP or AML_ONE_OP. // The value is encoded with a AML_ZERO_OP or AML_ONE_OP.
@ -425,9 +440,9 @@ AmlNodeSetIntegerValue (
*ValueWidthDiff = -((INT8)DataNode->Size); *ValueWidthDiff = -((INT8)DataNode->Size);
// 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;
@ -439,19 +454,19 @@ AmlNodeSetIntegerValue (
// Check the number of bits needed to represent the value. // Check the number of bits needed to represent the value.
if (NewValue > MAX_UINT32) { if (NewValue > MAX_UINT32) {
// Value is 64 bits. // Value is 64 bits.
NewOpCode = AML_QWORD_PREFIX; NewOpCode = AML_QWORD_PREFIX;
NumberOfBytes = 8; NumberOfBytes = 8;
} else if (NewValue > MAX_UINT16) { } else if (NewValue > MAX_UINT16) {
// Value is 32 bits. // Value is 32 bits.
NewOpCode = AML_DWORD_PREFIX; NewOpCode = AML_DWORD_PREFIX;
NumberOfBytes = 4; NumberOfBytes = 4;
} else if (NewValue > MAX_UINT8) { } else if (NewValue > MAX_UINT8) {
// Value is 16 bits. // Value is 16 bits.
NewOpCode = AML_WORD_PREFIX; NewOpCode = AML_WORD_PREFIX;
NumberOfBytes = 2; NumberOfBytes = 2;
} else { } else {
// Value is 8 bits. // Value is 8 bits.
NewOpCode = AML_BYTE_PREFIX; NewOpCode = AML_BYTE_PREFIX;
NumberOfBytes = 1; NumberOfBytes = 1;
} }
@ -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,14 +520,14 @@ 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;
UINT64 Value; UINT64 Value;
if (ValueWidthDiff == NULL) { if (ValueWidthDiff == NULL) {
ASSERT (0); ASSERT (0);
@ -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,29 +587,30 @@ 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;
UINT32 NewPkgLenWidth; UINT32 NewPkgLenWidth;
UINT32 ReComputedPkgLenWidth; UINT32 ReComputedPkgLenWidth;
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,10 +624,10 @@ 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
), ),
IsIncrement, IsIncrement,
(UINT64)(*Diff), (UINT64)(*Diff),
&FieldWidthChange &FieldWidthChange
@ -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;
} }
@ -647,13 +666,14 @@ AmlPropagateSize (
// Subtract the size of the PkgLen encoding. The size of the PkgLen // Subtract the size of the PkgLen encoding. The size of the PkgLen
// encoding must be computed after having updated Value. // encoding must be computed after having updated Value.
InitialPkgLenWidth = AmlComputePkgLengthWidth (Value); InitialPkgLenWidth = AmlComputePkgLengthWidth (Value);
Value -= InitialPkgLenWidth; Value -= InitialPkgLenWidth;
// Check for an over/underflows. // Check for an over/underflows.
// 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;
@ -693,8 +714,8 @@ AmlPropagateSize (
} }
*Diff += (InitialPkgLenWidth > ReComputedPkgLenWidth) ? *Diff += (InitialPkgLenWidth > ReComputedPkgLenWidth) ?
(InitialPkgLenWidth - ReComputedPkgLenWidth) : (InitialPkgLenWidth - ReComputedPkgLenWidth) :
(ReComputedPkgLenWidth - InitialPkgLenWidth); (ReComputedPkgLenWidth - InitialPkgLenWidth);
ObjectNode->PkgLen = Value; ObjectNode->PkgLen = Value;
} // PkgLen update. } // PkgLen update.
@ -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,25 +819,26 @@ 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
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
return Status; return Status;
@ -845,10 +868,10 @@ 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
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -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
@ -881,14 +906,16 @@ AmlPropagateInformation (
// Maximum change is between UINT8/UINT64: 8 bytes. // Maximum change is between UINT8/UINT64: 8 bytes.
if ((ABS (FieldWidthChange) > 8) || if ((ABS (FieldWidthChange) > 8) ||
(IsIncrement && (IsIncrement &&
((FieldWidthChange < 0) || ((FieldWidthChange < 0) ||
((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,13 +959,13 @@ 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)) {
ASSERT (0); ASSERT (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;
} }
@ -968,8 +996,10 @@ AmlSetRdListCheckSum (
// It is possible to have only one Resource Data in a BufferOp with // It is possible to have only one Resource Data in a BufferOp with
// 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,10 +101,10 @@ 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
); );
/** Find and set the EndTag's Checksum of a list of Resource Data elements. /** Find and set the EndTag's Checksum of a list of Resource Data elements.
@ -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

@ -34,7 +34,7 @@ extern CHAR8 ssdtserialporttemplate_aml_code[];
/** UART address range length. /** UART address range length.
*/ */
#define MIN_UART_ADDRESS_LENGTH 0x1000U #define MIN_UART_ADDRESS_LENGTH 0x1000U
/** Validate the Serial Port Information. /** Validate the Serial Port Information.
@ -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,
@ -129,23 +133,23 @@ STATIC
EFI_STATUS EFI_STATUS
EFIAPI 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:
@ -254,14 +259,14 @@ STATIC
EFI_STATUS 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;
AML_OBJECT_NODE_HANDLE NameOpCrsNode; AML_OBJECT_NODE_HANDLE NameOpCrsNode;
AML_DATA_NODE_HANDLE QWordRdNode; AML_DATA_NODE_HANDLE QWordRdNode;
AML_DATA_NODE_HANDLE InterruptRdNode; AML_DATA_NODE_HANDLE InterruptRdNode;
// Get the "_CRS" object defined by the "Name ()" statement. // Get the "_CRS" object defined by the "Name ()" statement.
Status = AmlFindNode ( Status = AmlFindNode (
@ -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;
@ -329,13 +334,13 @@ STATIC
EFI_STATUS 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;
AML_OBJECT_NODE_HANDLE DeviceNode; AML_OBJECT_NODE_HANDLE DeviceNode;
// Get the COM0 variable defined by the "Device ()" statement. // Get the COM0 variable defined by the "Device ()" statement.
Status = AmlFindNode (RootNodeHandle, "\\_SB_.COM0", &DeviceNode); Status = AmlFindNode (RootNodeHandle, "\\_SB_.COM0", &DeviceNode);
@ -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.
@ -373,14 +378,14 @@ STATIC
EFI_STATUS 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;
ASSERT (RootNodeHandle != NULL); ASSERT (RootNodeHandle != NULL);
ASSERT (SerialPortInfo != NULL); ASSERT (SerialPortInfo != NULL);
@ -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,16 +448,16 @@ 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;
EFI_STATUS Status1; EFI_STATUS Status1;
AML_ROOT_NODE_HANDLE RootNodeHandle; AML_ROOT_NODE_HANDLE RootNodeHandle;
ASSERT (AcpiTableInfo != NULL); ASSERT (AcpiTableInfo != NULL);
ASSERT (SerialPortInfo != NULL); ASSERT (SerialPortInfo != NULL);
@ -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 ((
@ -552,11 +552,11 @@ PrintOemId (
STATIC STATIC
VOID VOID
PrintCmObjDesc ( PrintCmObjDesc (
IN VOID *Data, IN VOID *Data,
IN CONST CM_OBJ_PARSER *Parser, IN CONST CM_OBJ_PARSER *Parser,
IN UINTN ItemCount, IN UINTN ItemCount,
IN INTN *RemainingSize, IN INTN *RemainingSize,
IN UINT32 IndentLevel IN UINT32 IndentLevel
) )
{ {
UINT32 Index; UINT32 Index;
@ -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,22 +654,22 @@ PrintCmObjDesc (
VOID VOID
EFIAPI EFIAPI
ParseCmObjDesc ( ParseCmObjDesc (
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc
) )
{ {
UINTN ObjId; UINTN ObjId;
UINTN NameSpaceId; UINTN NameSpaceId;
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;
} }
NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId); NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);
ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId); ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
switch (NameSpaceId) { switch (NameSpaceId) {
case EObjNameSpaceStandard: case EObjNameSpaceStandard:
@ -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:
@ -690,7 +694,7 @@ ParseCmObjDesc (
return; return;
} // switch } // switch
ObjectCount = CmObjDesc->Count; ObjectCount = CmObjDesc->Count;
RemainingSize = CmObjDesc->Size; RemainingSize = CmObjDesc->Size;
for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) { for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {

View File

@ -9,7 +9,7 @@
#ifndef CONFIGURATION_MANAGER_OBJECT_PARSER_H_ #ifndef CONFIGURATION_MANAGER_OBJECT_PARSER_H_
#define CONFIGURATION_MANAGER_OBJECT_PARSER_H_ #define CONFIGURATION_MANAGER_OBJECT_PARSER_H_
#define OUTPUT_FIELD_COLUMN_WIDTH 32 #define OUTPUT_FIELD_COLUMN_WIDTH 32
/** Function prototype to format a field print. /** Function prototype to format a field print.
@ -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,30 +28,29 @@ 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.
/// If not used this must be set to NULL. /// If not used this must be set to NULL.
/// The Format string is passed to the PrintFormatter function /// The Format string is passed to the PrintFormatter function
/// but may be ignored by the implementation code. /// but may be ignored by the implementation code.
FNPTR_PRINT_FORMATTER PrintFormatter; FNPTR_PRINT_FORMATTER PrintFormatter;
/// Optional pointer to print the fields of another CM_OBJ_PARSER /// Optional pointer to print the fields of another CM_OBJ_PARSER
/// structure. This is useful to print sub-structures. /// structure. This is useful to print sub-structures.
CONST CM_OBJ_PARSER *SubObjParser; CONST CM_OBJ_PARSER *SubObjParser;
/// Count of items in the SubObj. /// Count of items in the SubObj.
UINTN SubObjItemCount; UINTN SubObjItemCount;
}; };
/** /**
@ -59,15 +58,14 @@ 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;
} CM_OBJ_PARSER_ARRAY; } CM_OBJ_PARSER_ARRAY;
#endif // CONFIGURATION_MANAGER_OBJECT_PARSER_H_ #endif // CONFIGURATION_MANAGER_OBJECT_PARSER_H_

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;
@ -45,12 +45,12 @@ GetCgfMgrInfo (
ASSERT (CfgMfrInfo != NULL); ASSERT (CfgMfrInfo != NULL);
*CfgMfrInfo = NULL; *CfgMfrInfo = NULL;
Status = CfgMgrProtocol->GetObject ( Status = CfgMgrProtocol->GetObject (
CfgMgrProtocol, CfgMgrProtocol,
CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo), CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo),
CM_NULL_TOKEN, CM_NULL_TOKEN,
&CmObjectDesc &CmObjectDesc
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -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,16 +292,16 @@ 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
) )
{ {
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;
} }