76 IN UINT32 AddressCells,
87 CheckAffMask = ARM_CORE_AFF0 | ARM_CORE_AFF1 | ARM_CORE_AFF2;
89 if (GicCInfo ==
NULL) {
91 return EFI_INVALID_PARAMETER;
94 Data = fdt_getprop (Fdt, CpuNode,
"reg", &DataSize);
96 ((DataSize !=
sizeof (UINT32)) &&
97 (DataSize !=
sizeof (UINT64))))
109 if (AddressCells == 2) {
110 MpIdr = fdt64_to_cpu (*((UINT64 *)Data));
111 CheckAffMask |= ARM_CORE_AFF3;
113 MpIdr = fdt32_to_cpu (*((UINT32 *)Data));
116 if ((MpIdr & ~CheckAffMask) != 0) {
118 return EFI_INVALID_PARAMETER;
123 ProcUid = MpIdr | ((MpIdr & ARM_CORE_AFF3) >> 8);
135 if (GicVersion == 2) {
136 GicCInfo->CPUInterfaceNumber = ProcUid;
138 GicCInfo->CPUInterfaceNumber = 0;
141 GicCInfo->AcpiProcessorUid = ProcUid;
143 GicCInfo->MPIDR = MpIdr;
169 IN UINT32 GicVersion,
180 UINT32 GicCInfoBufferSize;
182 if (NewGicCmObjDesc ==
NULL) {
184 return EFI_INVALID_PARAMETER;
187 AddressCells = fdt_address_cells (Fdt, CpusNode);
188 if (AddressCells < 0) {
195 if (EFI_ERROR (Status)) {
200 if (CpuNodeCount == 0) {
202 return EFI_NOT_FOUND;
208 if (GicCInfoBuffer ==
NULL) {
210 return EFI_OUT_OF_RESOURCES;
214 for (Index = 0; Index < CpuNodeCount; Index++) {
216 if (EFI_ERROR (Status)) {
218 if (Status == EFI_NOT_FOUND) {
220 Status = EFI_ABORTED;
229 Status = EFI_UNSUPPORTED;
238 &GicCInfoBuffer[Index]
240 if (EFI_ERROR (Status)) {
282 IN INT32 GicIntcNode,
293 if (GicCCmObjDesc ==
NULL) {
295 return EFI_INVALID_PARAMETER;
300 if (EFI_ERROR (Status)) {
309 Data = fdt_getprop (Fdt, GicIntcNode,
"interrupts", &DataSize);
310 if ((Data !=
NULL) && (DataSize == (IntCells *
sizeof (UINT32)))) {
314 GicCInfo->
Flags = DT_IRQ_IS_EDGE_TRIGGERED (
315 fdt32_to_cpu (((UINT32 *)Data)[IRQ_FLAGS_OFFSET])
317 EFI_ACPI_6_3_VGIC_MAINTENANCE_INTERRUPT_MODE_FLAGS :
320 }
else if (DataSize < 0) {
353 IN INT32 Gicv2IntcNode,
363 CONST UINT8 *GicCValue;
364 CONST UINT8 *GicVValue;
365 CONST UINT8 *GicHValue;
372 if (GicCCmObjDesc ==
NULL) {
374 return EFI_INVALID_PARAMETER;
388 if (EFI_ERROR (Status)) {
394 if ((AddressCells < 1) ||
395 (AddressCells > 2) ||
403 RegSize = (AddressCells + SizeCells) *
sizeof (UINT32);
405 Data = fdt_getprop (Fdt, Gicv2IntcNode,
"reg", &DataSize);
406 if ((Data ==
NULL) ||
408 ((DataSize % RegSize) != 0))
415 RegCount = DataSize/RegSize;
421 GicVValue = Data + (
sizeof (UINT32) *
428 GicHValue = Data + (
sizeof (UINT32) *
435 GicCValue = Data + (
sizeof (UINT32) *
448 for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
449 if (AddressCells == 2) {
451 GicCInfo[Index].
GICH = (GicHValue ==
NULL) ? 0 :
452 fdt64_to_cpu (*(UINT64 *)GicHValue);
453 GicCInfo[Index].
GICV = (GicVValue ==
NULL) ? 0 :
454 fdt64_to_cpu (*(UINT64 *)GicVValue);
457 GicCInfo[Index].
GICH = (GicHValue ==
NULL) ? 0 :
458 fdt32_to_cpu (*(UINT32 *)GicHValue);
459 GicCInfo[Index].
GICV = (GicVValue ==
NULL) ? 0 :
460 fdt32_to_cpu (*(UINT32 *)GicVValue);
490 IN INT32 Gicv3IntcNode,
499 UINT32 AdditionalRedistReg;
501 CONST UINT8 *GicCValue;
502 CONST UINT8 *GicVValue;
503 CONST UINT8 *GicHValue;
510 if (GicCCmObjDesc ==
NULL) {
512 return EFI_INVALID_PARAMETER;
527 if (EFI_ERROR (Status)) {
533 if ((AddressCells < 1) ||
534 (AddressCells > 2) ||
543 Data = fdt_getprop (Fdt, Gicv3IntcNode,
"#redistributor-regions", &DataSize);
544 if ((Data !=
NULL) && (DataSize ==
sizeof (UINT32))) {
545 ASSERT (fdt32_to_cpu (*(UINT32 *)Data) > 1);
546 AdditionalRedistReg = fdt32_to_cpu (*(UINT32 *)Data) - 1;
548 AdditionalRedistReg = 0;
551 RegSize = (AddressCells + SizeCells) *
sizeof (UINT32);
570 Data = fdt_getprop (Fdt, Gicv3IntcNode,
"reg", &DataSize);
571 if ((Data ==
NULL) ||
573 ((DataSize % RegSize) != 0))
580 RegCount = (DataSize / RegSize) - AdditionalRedistReg;
587 GicVValue = Data + (
sizeof (UINT32) *
589 4 + AdditionalRedistReg,
598 GicHValue = Data + (
sizeof (UINT32) *
600 3 + AdditionalRedistReg,
610 GicCValue = Data + (
sizeof (UINT32) *
612 2 + AdditionalRedistReg,
633 if (AddressCells == 2) {
634 for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
638 fdt64_to_cpu (*(UINT64 *)GicCValue);
639 GicCInfo[Index].
GICH = (GicHValue ==
NULL) ? 0 :
640 fdt64_to_cpu (*(UINT64 *)GicHValue);
641 GicCInfo[Index].
GICV = (GicVValue ==
NULL) ? 0 :
642 fdt64_to_cpu (*(UINT64 *)GicVValue);
645 for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
649 fdt32_to_cpu (*(UINT32 *)GicCValue);
650 GicCInfo[Index].
GICH = (GicHValue ==
NULL) ? 0 :
651 fdt32_to_cpu (*(UINT32 *)GicHValue);
652 GicCInfo[Index].
GICV = (GicVValue ==
NULL) ? 0 :
653 fdt32_to_cpu (*(UINT32 *)GicVValue);
680 IN INT32 GicIntcNode,
694 if (GicCCmObjDesc ==
NULL) {
695 ASSERT (GicCCmObjDesc !=
NULL);
696 return EFI_INVALID_PARAMETER;
709 if (EFI_ERROR (Status)) {
714 if (PmuNodeCount == 0) {
715 return EFI_NOT_FOUND;
724 if (EFI_ERROR (Status)) {
726 if (Status == EFI_NOT_FOUND) {
728 Status = EFI_ABORTED;
734 if (EFI_ERROR (Status)) {
739 Data = fdt_getprop (Fdt, PmuNode,
"interrupts", &DataSize);
740 if ((Data ==
NULL) || (DataSize != (IntCells *
sizeof (UINT32)))) {
742 ASSERT (Data !=
NULL);
743 ASSERT (DataSize == (IntCells *
sizeof (UINT32)));
753 if (PmuIrq != BSA_PMU_IRQ) {
754 ASSERT (PmuIrq == BSA_PMU_IRQ);
758 for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
820 if (FdtParserHandle ==
NULL) {
822 return EFI_INVALID_PARAMETER;
825 Fdt = FdtParserHandle->Fdt;
831 if (EFI_ERROR (Status)) {
833 if (Status == EFI_NOT_FOUND) {
835 Status = EFI_ABORTED;
842 if (EFI_ERROR (Status)) {
849 Status =
CpusNodeParser (Fdt, FdtBranch, GicVersion, &NewCmObjDesc);
850 if (EFI_ERROR (Status)) {
856 switch (GicVersion) {
871 Status = EFI_UNSUPPORTED;
875 if (EFI_ERROR (Status)) {
882 if (EFI_ERROR (Status)) {
889 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
896 if (EFI_ERROR (Status)) {
#define EFI_ACPI_6_3_GIC_ENABLED
UINT32 EFIAPI FdtGetInterruptId(UINT32 CONST *Data)
STATIC CONST COMPATIBILITY_STR CpuCompatibleStr[]
STATIC EFI_STATUS EFIAPI GicCIntcNodeParser(IN CONST VOID *Fdt, IN INT32 GicIntcNode, IN OUT CM_OBJ_DESCRIPTOR *GicCCmObjDesc)
STATIC EFI_STATUS EFIAPI CpuNodeParser(IN CONST VOID *Fdt, IN INT32 CpuNode, IN UINT32 GicVersion, IN UINT32 AddressCells, OUT CM_ARM_GICC_INFO *GicCInfo)
CONST COMPATIBILITY_INFO PmuCompatibleInfo
STATIC EFI_STATUS EFIAPI GicCPmuNodeParser(IN CONST VOID *Fdt, IN INT32 GicIntcNode, IN OUT CM_OBJ_DESCRIPTOR *GicCCmObjDesc)
STATIC CONST COMPATIBILITY_STR PmuCompatibleStr[]
STATIC CONST COMPATIBILITY_INFO CpuCompatibleInfo
STATIC EFI_STATUS EFIAPI GicCv2IntcNodeParser(IN CONST VOID *Fdt, IN INT32 Gicv2IntcNode, IN OUT CM_OBJ_DESCRIPTOR *GicCCmObjDesc)
STATIC EFI_STATUS EFIAPI CpusNodeParser(IN CONST VOID *Fdt, IN INT32 CpusNode, IN UINT32 GicVersion, OUT CM_OBJ_DESCRIPTOR **NewGicCmObjDesc)
EFI_STATUS EFIAPI ArmGicCInfoParser(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch)
STATIC EFI_STATUS EFIAPI GicCv3IntcNodeParser(IN CONST VOID *Fdt, IN INT32 Gicv3IntcNode, IN OUT CM_OBJ_DESCRIPTOR *GicCCmObjDesc)
EFI_STATUS EFIAPI GetGicVersion(IN CONST VOID *Fdt, IN INT32 IntcNode, OUT UINT32 *GicVersion)
@ EArmObjGicCInfo
2 - GIC CPU Interface Info
struct CmArmGicCInfo CM_ARM_GICC_INFO
EFI_STATUS EFIAPI FreeCmObjDesc(IN CM_OBJ_DESCRIPTOR *CmObjDesc)
EFI_STATUS EFIAPI AddMultipleCmObj(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc, IN UINT32 TokenCount, OPTIONAL OUT CM_OBJECT_TOKEN *TokenTable OPTIONAL)
EFI_STATUS EFIAPI CreateCmObjDesc(IN CM_OBJECT_ID ObjectId, IN UINT32 Count, IN VOID *Data, IN UINT32 Size, OUT CM_OBJ_DESCRIPTOR **NewCmObjDesc)
#define CREATE_CM_ARM_OBJECT_ID(ObjectId)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI FdtGetNextCompatNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, IN OUT INT32 *Node)
BOOLEAN EFIAPI FdtNodeIsCompatible(IN CONST VOID *Fdt, IN INT32 Node, IN CONST VOID *CompatInfo)
EFI_STATUS EFIAPI FdtGetParentAddressInfo(IN CONST VOID *Fdt, IN INT32 Node, OUT INT32 *AddressCells, OPTIONAL OUT INT32 *SizeCells OPTIONAL)
EFI_STATUS EFIAPI FdtCountCompatNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, OUT UINT32 *NodeCount)
EFI_STATUS EFIAPI FdtGetIntcParentNode(IN CONST VOID *Fdt, IN INT32 Node, OUT INT32 *IntcNode)
EFI_STATUS EFIAPI FdtGetInterruptCellsInfo(IN CONST VOID *Fdt, IN INT32 IntcNode, OUT INT32 *IntCells)
EFI_STATUS EFIAPI FdtGetNextNamedNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, IN OUT INT32 *Node)
EFI_STATUS EFIAPI FdtCountNamedNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, OUT UINT32 *NodeCount)
#define GET_DT_REG_ADDRESS_OFFSET(Index, AddrCells, SizeCells)
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
UINT64 PhysicalBaseAddress
UINT32 VGICMaintenanceInterrupt
UINT32 PerformanceInterruptGsiv