Skip to content

Commit

Permalink
rock-5b: PCIe *seems* to be working in mainline Linux
Browse files Browse the repository at this point in the history
You will need `irqchip.gicv3_nolpi=1` in kernel cmdline
  • Loading branch information
strongtz committed Nov 24, 2022
1 parent 51c0f8a commit 4f6b1ce
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
20 changes: 20 additions & 0 deletions edk2-platforms/Platform/Radxa/ROCK5B/AcpiTables/AcpiTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@
EFI_ACPI_CREATOR_ID, /* UINT32 CreatorId */ \
EFI_ACPI_CREATOR_REVISION /* UINT32 CreatorRevision */ \
}

#define EFI_ACPI_6_0_GIC_REDISTRIBUTOR_INIT(RedisRegionAddr, RedisDiscLength) \
{ \
EFI_ACPI_6_0_GICR, \
sizeof (EFI_ACPI_6_0_GICR_STRUCTURE), \
0, \
RedisRegionAddr, \
RedisDiscLength \
}

#define EFI_ACPI_6_0_GIC_ITS_FRAME_INIT(Id, PhysAddress) \
{ \
EFI_ACPI_6_0_GIC_ITS, \
sizeof (EFI_ACPI_6_0_GIC_ITS_STRUCTURE), \
0, \
Id, \
PhysAddress, \
0 \
}

#endif // __ACPITABLES_H__
2 changes: 1 addition & 1 deletion edk2-platforms/Platform/Radxa/ROCK5B/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
}
}

include ("Pcie.aslc")
include ("Pcie.asl")
// include ("Sata.asl")
// include ("Emmc.asl")
// include ("Gmac.asl")
Expand Down
22 changes: 12 additions & 10 deletions edk2-platforms/Platform/Radxa/ROCK5B/AcpiTables/Madt.aslc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef struct {
EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
EFI_ACPI_6_0_GICR_STRUCTURE GicRedistributors;
EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE GicMsiFrame;
// EFI_ACPI_6_0_GIC_ITS_STRUCTURE GicIts[2];
} EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE;

#pragma pack ()
Expand Down Expand Up @@ -87,13 +88,8 @@ EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT (0, FixedPcdGet64 (PcdGicDistributorBase),
0, EFI_ACPI_6_0_GIC_V3),
// GIC Redistributors Entry
{
EFI_ACPI_6_0_GICR,
sizeof (EFI_ACPI_6_0_GICR_STRUCTURE),
0,
FixedPcdGet64 (PcdGicRedistributorsBase),
0x100000
},
EFI_ACPI_6_0_GIC_REDISTRIBUTOR_INIT (FixedPcdGet64 (PcdGicRedistributorsBase),
0x100000),
// GIC MSI Frame
{
EFI_ACPI_6_0_GIC_MSI_FRAME,
Expand All @@ -102,9 +98,15 @@ EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
0,
FixedPcdGet64 (PcdGicDistributorBase) + 0x10000,
EFI_ACPI_6_0_SPI_COUNT_BASE_SELECT,
24,
296
}
56,
424
},

/* ITS is broken on RK35xx!*/
// {
// EFI_ACPI_6_0_GIC_ITS_FRAME_INIT(0, 0xfe640000),
// EFI_ACPI_6_0_GIC_ITS_FRAME_INIT(1, 0xfe660000)
// },
};

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,23 @@ Device (PCI0) {
return (RBUF)
}

Method (_CBA, 0, NotSerialized) {
return (0x900000000) //指定外设ECAM空间,acpi_pci_root_get_mcfg_addr拿到的是这个,且不能和Mcfg里面的地址一样
}
// Method (_CBA, 0, NotSerialized) {
// return (0x900000000) //指定外设ECAM空间,acpi_pci_root_get_mcfg_addr拿到的是这个,且不能和Mcfg里面的地址一样
// }

Device (RES0) {
Name (_HID, "RKCP0001") // PCIe RC config base address
Name (_CID, "PNP0C02") // Motherboard reserved resource
Name (_UID, 0x0) // Unique ID
Name (_HID, "PNP0C02")
Name (_CRS, ResourceTemplate (){
Memory32Fixed (ReadWrite, 0xf5000000 , 0x400000) //DBI for accessing RC config base address
QWordMemory ( // 64-bit PCIe ECAM window
ResourceProducer,
PosDecode,
MinFixed,
MaxFixed,
NonCacheable,
ReadWrite,
0x0000000000000000, // Granularity
0x900000000, // Range Minimum
0x900ffffff, // Range Maximum
0x0000000000000000, // Translation Offset
0x1000000, // Length
,
,
,
AddressRangeMemory,
TypeStatic
// 64-bit PCIe ECAM window
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
0x0000000000000000, // Granularity
0x0000000900000000, // Range Minimum
0x0000000900ffffff, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000000001000000, // Length
)
})
})
}

// OS Control Handoff
Expand Down Expand Up @@ -128,4 +116,4 @@ Device (PCI0) {
Return(Arg3)
}
} // End _OSC
} // PCI0
}

0 comments on commit 4f6b1ce

Please sign in to comment.