73 if ((Cmn600InfoList ==
NULL) ||
76 return EFI_INVALID_PARAMETER;
80 for (Index = 0; Index < Cmn600Count; Index++) {
81 Cmn600Info = &Cmn600InfoList[Index];
84 if ((Cmn600Info->DtcCount == 0) ||
89 "ERROR: SSDT-CMN-600: Invalid DTC configuration:\n"
95 if ((Cmn600Info->PeriphBaseAddress == 0) ||
96 (Cmn600Info->RootNodeBaseAddress == 0))
100 "ERROR: SSDT-CMN-600: Invalid PERIPHBASE or ROOTNODEBASE.\n"
108 if ((Cmn600Info->PeriphBaseAddress &
113 "ERROR: SSDT-CMN-600: PERIPHBASE address must be 64MB aligned.\n"
123 "ERROR: SSDT-CMN-600: PERIPHBASE address range must be < 256MB.\n"
129 if ((Cmn600Info->PeriphBaseAddress &
134 "ERROR: SSDT-CMN-600: Root base address must be 16KB aligned.\n"
141 if ((Cmn600Info->PeriphBaseAddress > Cmn600Info->RootNodeBaseAddress) ||
142 ((Cmn600Info->PeriphBaseAddress + Cmn600Info->PeriphBaseAddressLength) <
147 "ERROR: SSDT-CMN-600:"
148 " ROOTNODEBASE address space not in PERIPHBASE address space.\n"
153 for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
154 DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
155 if (((DtcInterrupt->Flags &
156 EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0))
160 "ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n"
173 "PeriphBaseAddress = 0x%llx\n"
174 "PeriphBaseAddressLength = 0x%llx\n"
175 "RootNodeBaseAddress = 0x%llx\n"
177 Cmn600Info->PeriphBaseAddress,
178 Cmn600Info->PeriphBaseAddressLength,
179 Cmn600Info->RootNodeBaseAddress,
184 for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
185 DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
193 " Interrupt = 0x%lx\n",
194 DtcInterrupt->Interrupt
205 return EFI_INVALID_PARAMETER;
251 RootNodeHandle =
NULL;
256 if (EFI_ERROR (Status)) {
259 "ERROR: SSDT-CMN-600: Failed to parse SSDT CMN-600 Template."
273 if (EFI_ERROR (Status)) {
278 if (EFI_ERROR (Status)) {
288 if (EFI_ERROR (Status)) {
295 if (EFI_ERROR (Status)) {
299 if (CmnPeriphBaseRdNode ==
NULL) {
300 Status = EFI_INVALID_PARAMETER;
307 Cmn600Info->PeriphBaseAddress,
308 Cmn600Info->PeriphBaseAddressLength
310 if (EFI_ERROR (Status)) {
319 &CmnRootNodeBaseRdNode
321 if (EFI_ERROR (Status)) {
325 if (CmnRootNodeBaseRdNode ==
NULL) {
326 Status = EFI_INVALID_PARAMETER;
332 CmnRootNodeBaseRdNode,
333 Cmn600Info->RootNodeBaseAddress,
336 if (EFI_ERROR (Status)) {
344 for (Index = 0; Index < Cmn600Info->DtcCount; Index++) {
345 DtcInt = &Cmn600Info->DtcInterrupt[Index];
349 EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) != 0),
351 EFI_ACPI_EXTENDED_INTERRUPT_FLAG_MODE_MASK) != 0),
353 EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK) != 0),
355 EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0),
356 (UINT32 *)&DtcInt->Interrupt,
361 if (EFI_ERROR (Status)) {
369 Status =
AmlFindNode (RootNodeHandle,
"\\_SB_.CMN0", &DeviceNode);
370 if (EFI_ERROR (Status)) {
376 if (EFI_ERROR (Status)) {
385 if (EFI_ERROR (Status)) {
388 "ERROR: SSDT-CMN-600: Failed to Serialize SSDT Table Data."
396 if (RootNodeHandle !=
NULL) {
398 if (EFI_ERROR (Status1)) {
401 "ERROR: SSDT-CMN-600: Failed to cleanup AML tree."
407 if (!EFI_ERROR (Status)) {
443 ASSERT (This !=
NULL);
444 ASSERT (AcpiTableInfo !=
NULL);
445 ASSERT (CfgMgrProtocol !=
NULL);
446 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
447 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
449 if ((Table ==
NULL) ||
453 DEBUG ((DEBUG_ERROR,
"ERROR: SSDT-CMN-600: Invalid Table Pointer\n"));
454 return EFI_INVALID_PARAMETER;
459 for (Index = 0; Index < TableCount; Index++) {
460 if ((TableList[Index] !=
NULL) &&
461 (TableList[Index]->Signature ==
468 "ERROR: SSDT-CMN-600: Could not free SSDT table at index %d."
471 EFI_INVALID_PARAMETER
473 return EFI_INVALID_PARAMETER;
523 CHAR8 NewName[AML_NAME_SEG_SIZE + 1];
526 ASSERT (This !=
NULL);
527 ASSERT (AcpiTableInfo !=
NULL);
528 ASSERT (CfgMgrProtocol !=
NULL);
529 ASSERT (Table !=
NULL);
530 ASSERT (TableCount !=
NULL);
531 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
532 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
537 Status = GetEArmObjCmn600Info (
543 if (EFI_ERROR (Status)) {
546 "ERROR: SSDT-CMN-600: Failed to get the CMN-600 information."
556 "ERROR: SSDT-CMN-600: CMN600 peripheral count = %d."
557 " This must be between 1 to 16.\n",
560 return EFI_INVALID_PARAMETER;
565 if (EFI_ERROR (Status)) {
568 "ERROR: SSDT-CMN-600: Invalid CMN600 information. Status = %r\n",
579 if (TableList ==
NULL) {
580 Status = EFI_OUT_OF_RESOURCES;
583 "ERROR: SSDT-CMN-600: Failed to allocate memory for Table List."
598 for (Index = 0; Index < Cmn600Count; Index++) {
608 if (EFI_ERROR (Status)) {
611 "ERROR: SSDT-CMN-600: Failed to build associated SSDT table."
631#define SSDT_CMN_600_GENERATOR_REVISION CREATE_REVISION (1, 0)
641 L
"ACPI.STD.SSDT.CMN600.GENERATOR",
684 "SSDT-CMN-600: Register Generator. Status = %r\n",
712 "SSDT-CMN-600: Deregister Generator. Status = %r\n",
#define EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
UINT8 EFIAPI AsciiFromHex(IN UINT8 Hex)
EFI_STATUS EFIAPI RegisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
EFI_STATUS EFIAPI DeregisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
#define TABLE_GENERATOR_CREATOR_ID_ARM
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
@ EStdAcpiTableIdSsdtCmn600
SSDT Cmn-600 Generator.
void * AML_ROOT_NODE_HANDLE
void * AML_DATA_NODE_HANDLE
EFI_STATUS EFIAPI AmlCodeGenRdInterrupt(IN BOOLEAN ResourceConsumer, IN BOOLEAN EdgeTriggered, IN BOOLEAN ActiveLow, IN BOOLEAN Shared, IN UINT32 *IrqList, IN UINT8 IrqCount, IN AML_OBJECT_NODE_HANDLE NameOpNode OPTIONAL, OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
void * AML_OBJECT_NODE_HANDLE
@ EArmObjCmn600Info
20 - CMN-600 Info
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArm
ARM Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
EFI_STATUS EFIAPI AcpiSsdtCmn600LibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS EFIAPI ValidateCmn600Info(IN CONST CM_ARM_CMN_600_INFO *Cmn600InfoList, IN CONST UINT32 Cmn600Count)
STATIC EFI_STATUS EFIAPI FixupCmn600Info(IN CONST CM_ARM_CMN_600_INFO *Cmn600Info, IN CONST CHAR8 *Name, IN CONST UINT64 Uid, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
CHAR8 ssdtcmn600template_aml_code[]
STATIC EFI_STATUS EFIAPI BuildSsdtCmn600TableEx(IN CONST ACPI_TABLE_GENERATOR *This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table, OUT UINTN *CONST TableCount)
STATIC CONST ACPI_TABLE_GENERATOR SsdtCmn600Generator
EFI_STATUS EFIAPI AcpiSsdtCmn600LibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS EFIAPI FreeSsdtCmn600TableResourcesEx(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table, IN CONST UINTN TableCount)
#define SSDT_CMN_600_GENERATOR_REVISION
#define ROOTNODEBASE_ADDRESS_LENGTH
#define PERIPHBASE_MAX_ADDRESS_LENGTH
#define PERIPHBASE_MIN_ADDRESS_LENGTH
#define MAX_CMN600_DEVICES_SUPPORTED
EFI_STATUS EFIAPI AmlFindNode(IN AML_NODE_HANDLE ReferenceNode, IN CONST CHAR8 *AslPath, OUT AML_NODE_HANDLE *OutNode)
EFI_STATUS EFIAPI AmlDeleteTree(IN AML_NODE_HANDLE Node)
EFI_STATUS EFIAPI AmlUpdateRdQWord(IN AML_DATA_NODE_HANDLE QWordRdNode, IN UINT64 BaseAddress, IN UINT64 BaseAddressLength)
EFI_STATUS EFIAPI AmlParseDefinitionBlock(IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock, OUT AML_ROOT_NODE_HANDLE *RootPtr)
EFI_STATUS EFIAPI AmlNameOpGetNextRdNode(IN AML_DATA_NODE_HANDLE CurrRdNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
EFI_STATUS EFIAPI AmlNameOpGetFirstRdNode(IN AML_OBJECT_NODE_HANDLE NameOpNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
EFI_STATUS EFIAPI AmlDeviceOpUpdateName(IN AML_OBJECT_NODE_HANDLE DeviceOpNode, IN CONST CHAR8 *NewNameString)
EFI_STATUS EFIAPI AmlNameOpUpdateInteger(IN AML_OBJECT_NODE_HANDLE NameOpNode, IN UINT64 NewInt)
EFI_STATUS EFIAPI AmlSerializeDefinitionBlock(IN AML_ROOT_NODE_HANDLE RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)