99 ASSERT (Gicc !=
NULL);
100 ASSERT (GicCInfo !=
NULL);
103 Gicc->Type = EFI_ACPI_6_5_GIC;
107 Gicc->Reserved = EFI_ACPI_RESERVED_WORD;
110 Gicc->CPUInterfaceNumber = GicCInfo->CPUInterfaceNumber;
112 Gicc->AcpiProcessorUid = GicCInfo->AcpiProcessorUid;
114 Gicc->Flags = GicCInfo->Flags;
116 Gicc->ParkingProtocolVersion = GicCInfo->ParkingProtocolVersion;
118 Gicc->PerformanceInterruptGsiv = GicCInfo->PerformanceInterruptGsiv;
120 Gicc->ParkedAddress = GicCInfo->ParkedAddress;
123 Gicc->PhysicalBaseAddress = GicCInfo->PhysicalBaseAddress;
125 Gicc->GICV = GicCInfo->GICV;
127 Gicc->GICH = GicCInfo->GICH;
130 Gicc->VGICMaintenanceInterrupt = GicCInfo->VGICMaintenanceInterrupt;
132 Gicc->GICRBaseAddress = GicCInfo->GICRBaseAddress;
135 Gicc->MPIDR = GicCInfo->MPIDR;
137 Gicc->ProcessorPowerEfficiencyClass =
138 GicCInfo->ProcessorPowerEfficiencyClass;
140 Gicc->Reserved2 = EFI_ACPI_RESERVED_BYTE;
144 Gicc->SpeOverflowInterrupt = GicCInfo->SpeOverflowInterrupt;
149 Gicc->SpeOverflowInterrupt = 0;
154 Gicc->TrbeInterrupt = GicCInfo->TrbeInterrupt;
184 ASSERT ((GicCInfo1 !=
NULL) && (GicCInfo2 !=
NULL));
192 "ERROR: MADT: GICC Info Structures %d and %d have the same ACPI " \
193 "Processor UID: 0x%x.\n",
228 BOOLEAN IsAcpiProcUidDuplicated;
230 ASSERT (Gicc !=
NULL);
231 ASSERT (GicCInfo !=
NULL);
241 if (IsAcpiProcUidDuplicated) {
242 return EFI_INVALID_PARAMETER;
245 while (GicCCount-- != 0) {
246 AddGICC (Gicc++, GicCInfo++, MadtRev);
264 ASSERT (Gicd !=
NULL);
265 ASSERT (GicDInfo !=
NULL);
268 Gicd->Type = EFI_ACPI_6_5_GICD;
272 Gicd->Reserved1 = EFI_ACPI_RESERVED_WORD;
278 Gicd->PhysicalBaseAddress = GicDInfo->PhysicalBaseAddress;
280 Gicd->SystemVectorBase = EFI_ACPI_RESERVED_DWORD;
282 Gicd->GicVersion = GicDInfo->GicVersion;
284 Gicd->Reserved2[0] = EFI_ACPI_RESERVED_BYTE;
285 Gicd->Reserved2[1] = EFI_ACPI_RESERVED_BYTE;
286 Gicd->Reserved2[2] = EFI_ACPI_RESERVED_BYTE;
301 ASSERT (GicMsiFrame !=
NULL);
302 ASSERT (GicMsiFrameInfo !=
NULL);
304 GicMsiFrame->Type = EFI_ACPI_6_5_GIC_MSI_FRAME;
306 GicMsiFrame->Reserved1 = EFI_ACPI_RESERVED_WORD;
307 GicMsiFrame->GicMsiFrameId = GicMsiFrameInfo->GicMsiFrameId;
308 GicMsiFrame->PhysicalBaseAddress = GicMsiFrameInfo->PhysicalBaseAddress;
310 GicMsiFrame->Flags = GicMsiFrameInfo->Flags;
311 GicMsiFrame->SPICount = GicMsiFrameInfo->SPICount;
312 GicMsiFrame->SPIBase = GicMsiFrameInfo->SPIBase;
326 IN UINT32 GicMsiFrameCount
329 ASSERT (GicMsiFrame !=
NULL);
330 ASSERT (GicMsiFrameInfo !=
NULL);
332 while (GicMsiFrameCount-- != 0) {
349 ASSERT (Gicr !=
NULL);
350 ASSERT (GicRedistributorInfo !=
NULL);
352 Gicr->Type = EFI_ACPI_6_5_GICR;
354 Gicr->Reserved = EFI_ACPI_RESERVED_WORD;
355 Gicr->DiscoveryRangeBaseAddress =
356 GicRedistributorInfo->DiscoveryRangeBaseAddress;
357 Gicr->DiscoveryRangeLength = GicRedistributorInfo->DiscoveryRangeLength;
374 ASSERT (Gicr !=
NULL);
375 ASSERT (GicRInfo !=
NULL);
377 while (GicRCount-- != 0) {
394 ASSERT (GicIts !=
NULL);
395 ASSERT (GicItsInfo !=
NULL);
397 GicIts->Type = EFI_ACPI_6_5_GIC_ITS;
399 GicIts->Reserved = EFI_ACPI_RESERVED_WORD;
400 GicIts->GicItsId = GicItsInfo->GicItsId;
401 GicIts->PhysicalBaseAddress = GicItsInfo->PhysicalBaseAddress;
402 GicIts->Reserved2 = EFI_ACPI_RESERVED_DWORD;
417 IN UINT32 GicItsCount
420 ASSERT (GicIts !=
NULL);
421 ASSERT (GicItsInfo !=
NULL);
423 while (GicItsCount-- != 0) {
465 UINT32 GicRedistCount;
475 UINT32 GicRedistOffset;
480 ASSERT (This !=
NULL);
481 ASSERT (AcpiTableInfo !=
NULL);
482 ASSERT (CfgMgrProtocol !=
NULL);
483 ASSERT (Table !=
NULL);
484 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
485 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
487 if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
488 (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
492 "ERROR: MADT: Requested table revision = %d, is not supported."
493 "Supported table revision: Minimum = %d, Maximum = %d\n",
494 AcpiTableInfo->AcpiTableRevision,
495 This->MinAcpiTableRevision,
496 This->AcpiTableRevision
498 return EFI_INVALID_PARAMETER;
503 Status = GetEArmObjGicCInfo (
509 if (EFI_ERROR (Status)) {
512 "ERROR: MADT: Failed to get GICC Info. Status = %r\n",
518 if (GicCCount == 0) {
521 "ERROR: MADT: GIC CPU Interface information not provided.\n"
523 ASSERT (GicCCount != 0);
524 Status = EFI_INVALID_PARAMETER;
528 Status = GetEArmObjGicDInfo (
534 if (EFI_ERROR (Status)) {
537 "ERROR: MADT: Failed to get GICD Info. Status = %r\n",
543 if (GicDCount == 0) {
546 "ERROR: MADT: GIC Distributor information not provided.\n"
548 ASSERT (GicDCount != 0);
549 Status = EFI_INVALID_PARAMETER;
556 "ERROR: MADT: One, and only one, GIC distributor must be present."
560 ASSERT (GicDCount <= 1);
561 Status = EFI_INVALID_PARAMETER;
565 Status = GetEArmObjGicMsiFrameInfo (
571 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
574 "ERROR: MADT: Failed to get GIC MSI Info. Status = %r\n",
580 Status = GetEArmObjGicRedistributorInfo (
586 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
589 "ERROR: MADT: Failed to get GIC Redistributor Info. Status = %r\n",
595 Status = GetEArmObjGicItsInfo (
601 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
604 "ERROR: MADT: Failed to get GIC ITS Info. Status = %r\n",
612 GicCOffset = TableSize;
615 GicDOffset = TableSize;
618 GicMSIOffset = TableSize;
621 GicRedistOffset = TableSize;
624 GicItsOffset = TableSize;
629 if (*Table ==
NULL) {
630 Status = EFI_OUT_OF_RESOURCES;
633 "ERROR: MADT: Failed to allocate memory for MADT Table, Size = %d," \
645 "MADT: Madt = 0x%p TableSize = 0x%x\n",
657 if (EFI_ERROR (Status)) {
660 "ERROR: MADT: Failed to add ACPI header. Status = %r\n",
670 Madt->Header.Revision
672 if (EFI_ERROR (Status)) {
675 "ERROR: MADT: Failed to add GICC structures. Status = %r\n",
686 if (GicMSICount != 0) {
694 if (GicRedistCount != 0) {
702 if (GicItsCount != 0) {
713 if (*Table !=
NULL) {
741 ASSERT (This !=
NULL);
742 ASSERT (AcpiTableInfo !=
NULL);
743 ASSERT (CfgMgrProtocol !=
NULL);
744 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
745 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
747 if ((Table ==
NULL) || (*Table ==
NULL)) {
748 DEBUG ((DEBUG_ERROR,
"ERROR: MADT: Invalid Table Pointer\n"));
749 ASSERT ((Table !=
NULL) && (*Table !=
NULL));
750 return EFI_INVALID_PARAMETER;
760#define MADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
770 L
"ACPI.STD.MADT.GENERATOR",
812 DEBUG ((DEBUG_INFO,
"MADT: Register Generator. Status = %r\n", Status));
836 DEBUG ((DEBUG_INFO,
"MADT: Deregister Generator. Status = %r\n", Status));
#define EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
#define EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
#define EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE
#define EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
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)
@ EStdAcpiTableIdMadt
MADT Generator.
@ EArmObjGicCInfo
2 - GIC CPU Interface Info
@ EArmObjGicMsiFrameInfo
4 - GIC MSI Frame Info
@ EArmObjGicItsInfo
6 - GIC ITS Info
@ EArmObjGicRedistributorInfo
5 - GIC Redistributor Info
@ EArmObjGicDInfo
3 - GIC Distributor Info
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArm
ARM Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
STATIC VOID AddGICMsiFrame(IN EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE *CONST GicMsiFrame, IN CONST CM_ARM_GIC_MSI_FRAME_INFO *CONST GicMsiFrameInfo)
STATIC VOID AddGICRedistributor(IN EFI_ACPI_6_5_GICR_STRUCTURE *CONST Gicr, IN CONST CM_ARM_GIC_REDIST_INFO *CONST GicRedistributorInfo)
STATIC VOID AddGICInterruptTranslationService(IN EFI_ACPI_6_5_GIC_ITS_STRUCTURE *CONST GicIts, IN CONST CM_ARM_GIC_ITS_INFO *CONST GicItsInfo)
STATIC VOID AddGICRedistributorList(IN EFI_ACPI_6_5_GICR_STRUCTURE *Gicr, IN CONST CM_ARM_GIC_REDIST_INFO *GicRInfo, IN UINT32 GicRCount)
STATIC VOID AddGICMsiFrameInfoList(IN EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE *GicMsiFrame, IN CONST CM_ARM_GIC_MSI_FRAME_INFO *GicMsiFrameInfo, IN UINT32 GicMsiFrameCount)
BOOLEAN EFIAPI IsAcpiUidEqual(IN CONST VOID *GicCInfo1, IN CONST VOID *GicCInfo2, IN UINTN Index1, IN UINTN Index2)
STATIC VOID AddGICD(EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE *CONST Gicd, CONST CM_ARM_GICD_INFO *CONST GicDInfo)
STATIC EFI_STATUS EFIAPI BuildMadtTable(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, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
STATIC EFI_STATUS FreeMadtTableResources(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)
EFI_STATUS EFIAPI AcpiMadtLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC VOID AddGICItsList(IN EFI_ACPI_6_5_GIC_ITS_STRUCTURE *GicIts, IN CONST CM_ARM_GIC_ITS_INFO *GicItsInfo, IN UINT32 GicItsCount)
STATIC VOID AddGICC(IN EFI_ACPI_6_5_GIC_STRUCTURE *CONST Gicc, IN CONST CM_ARM_GICC_INFO *CONST GicCInfo, IN CONST UINT8 MadtRev)
#define MADT_GENERATOR_REVISION
EFI_STATUS EFIAPI AcpiMadtLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC CONST ACPI_TABLE_GENERATOR MadtGenerator
STATIC EFI_STATUS AddGICCList(IN EFI_ACPI_6_5_GIC_STRUCTURE *Gicc, IN CONST CM_ARM_GICC_INFO *GicCInfo, IN UINT32 GicCCount, IN CONST UINT8 MadtRev)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_STATUS EFIAPI AddAcpiHeader(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR *CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST UINT32 Length)
BOOLEAN EFIAPI FindDuplicateValue(IN CONST VOID *Array, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN PFN_IS_EQUAL EqualTestFunction)