Skip to content

Commit

Permalink
ACPI: Support PCIe root port and switches in Windows and Linux
Browse files Browse the repository at this point in the history
To deal with the broken ECAM on this platform, reuse some existing OS
workarounds:
- for Windows: "NXPMX6" OEM ID in FADT and split MCFG entries for root
port and main config space.

- for Linux: "AMAZON" OEM ID + "GRAVITON" OEM Table ID in MCFG. An
"AMZN0001" device with _UID matching the RC segment number returns the
root port's DBI address in _CRS.

Both workarounds filter device > 0 on primary and secondary buses of RP
to hide ghost and duplicate devices.

The compatibility mode used can be configured in the setup menu.
Default is "Auto (NXPMX6 + Single Device)", which selects the NXPMX6
mode when Windows is booted and the classic single device/bus mode for
other OSes, since it's the most compatible one.

Also move the PCIe and SATA SSDT definitions in DSDT and patch _STA
instead to disable the unnecessary controllers.

Signed-off-by: Mario Bălănică <[email protected]>
  • Loading branch information
mariobalanica committed Feb 11, 2024
1 parent ccf967e commit 4b915e6
Show file tree
Hide file tree
Showing 56 changed files with 595 additions and 971 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Firefly/ITX-3588J/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588S", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
8 changes: 0 additions & 8 deletions edk2-rockchip/Platform/Hinlink/H88K/AcpiTables/AcpiTables.inf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Hinlink/H88K/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
8 changes: 0 additions & 8 deletions edk2-rockchip/Platform/Khadas/Edge2/AcpiTables/AcpiTables.inf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Khadas/Edge2/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Mekotronics/R58X/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Mixtile/Blade3/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/OrangePi/OrangePi5/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
// include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
8 changes: 0 additions & 8 deletions edk2-rockchip/Platform/Radxa/ROCK5A/AcpiTables/AcpiTables.inf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Radxa/ROCK5A/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
8 changes: 0 additions & 8 deletions edk2-rockchip/Platform/Radxa/ROCK5B/AcpiTables/AcpiTables.inf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
$(RK_COMMON_ACPI_DIR)/Mcfg.aslc
$(RK_COMMON_ACPI_DIR)/Dbg2.aslc
$(RK_COMMON_ACPI_DIR)/Pptt.aslc
$(RK_COMMON_ACPI_DIR)/Pcie3x4.asl
$(RK_COMMON_ACPI_DIR)/Pcie3x2.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l0.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l1.asl
$(RK_COMMON_ACPI_DIR)/Pcie2x1l2.asl
$(RK_COMMON_ACPI_DIR)/Sata0.asl
$(RK_COMMON_ACPI_DIR)/Sata1.asl
$(RK_COMMON_ACPI_DIR)/Sata2.asl

[Packages]
ArmPkg/ArmPkg.dec
Expand Down
2 changes: 2 additions & 0 deletions edk2-rockchip/Platform/Radxa/ROCK5B/AcpiTables/Dsdt.asl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
include ("Cpu.asl")

include ("Pcie.asl")
include ("Sata.asl")
include ("Emmc.asl")
include ("Sdhc.asl")
include ("Dma.asl")
Expand Down
Loading

0 comments on commit 4b915e6

Please sign in to comment.