Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apu2 iommu fix #592

Open
wants to merge 11 commits into
base: dasharo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/config.pcengines_uefi_apu2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1=y
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
CONFIG_PAYLOAD_EDK2=y
CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2.git"
CONFIG_EDK2_TAG_OR_REV="f3e18c6cd9c9afb15b83edf9b88c76e5898dbd88"
CONFIG_EDK2_TAG_OR_REV="bbfa2d3c73ea62946182879a8ed84b84fe779063"
CONFIG_EDK2_USE_EDK2_PLATFORMS=y
CONFIG_EDK2_PLATFORMS_REPOSITORY="https://github.com/Dasharo/edk2-platforms"
CONFIG_EDK2_PLATFORMS_TAG_OR_REV="3323ed481d35096fb6a7eae7b49f35eff00f86cf"
Expand Down
2 changes: 1 addition & 1 deletion configs/config.pcengines_uefi_apu3
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1=y
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
CONFIG_PAYLOAD_EDK2=y
CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2.git"
CONFIG_EDK2_TAG_OR_REV="f3e18c6cd9c9afb15b83edf9b88c76e5898dbd88"
CONFIG_EDK2_TAG_OR_REV="bbfa2d3c73ea62946182879a8ed84b84fe779063"
CONFIG_EDK2_USE_EDK2_PLATFORMS=y
CONFIG_EDK2_PLATFORMS_REPOSITORY="https://github.com/Dasharo/edk2-platforms"
CONFIG_EDK2_PLATFORMS_TAG_OR_REV="3323ed481d35096fb6a7eae7b49f35eff00f86cf"
Expand Down
2 changes: 1 addition & 1 deletion configs/config.pcengines_uefi_apu4
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1=y
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
CONFIG_PAYLOAD_EDK2=y
CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2.git"
CONFIG_EDK2_TAG_OR_REV="f3e18c6cd9c9afb15b83edf9b88c76e5898dbd88"
CONFIG_EDK2_TAG_OR_REV="bbfa2d3c73ea62946182879a8ed84b84fe779063"
CONFIG_EDK2_USE_EDK2_PLATFORMS=y
CONFIG_EDK2_PLATFORMS_REPOSITORY="https://github.com/Dasharo/edk2-platforms"
CONFIG_EDK2_PLATFORMS_TAG_OR_REV="3323ed481d35096fb6a7eae7b49f35eff00f86cf"
Expand Down
2 changes: 1 addition & 1 deletion configs/config.pcengines_uefi_apu6
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1=y
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
CONFIG_PAYLOAD_EDK2=y
CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2.git"
CONFIG_EDK2_TAG_OR_REV="f3e18c6cd9c9afb15b83edf9b88c76e5898dbd88"
CONFIG_EDK2_TAG_OR_REV="bbfa2d3c73ea62946182879a8ed84b84fe779063"
CONFIG_EDK2_USE_EDK2_PLATFORMS=y
CONFIG_EDK2_PLATFORMS_REPOSITORY="https://github.com/Dasharo/edk2-platforms"
CONFIG_EDK2_PLATFORMS_TAG_OR_REV="3323ed481d35096fb6a7eae7b49f35eff00f86cf"
Expand Down
7 changes: 7 additions & 0 deletions src/acpi/dsdt_top.asl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <vendorcode/google/chromeos/acpi/chromeos.asl>
#endif

External (\_SB.PCI0.NAPE, MethodObj)

/* Operating system enumeration. */
Name (OSYS, 0)

Expand All @@ -28,6 +30,11 @@ Method (_PIC, 1)
{
/* Remember the OS' IRQ routing choice. */
PICM = Arg0

If (CondRefOf (\_SB.PCI0.NAPE))
{
\_SB.PCI0.NAPE(Arg0 & 1)
}
}

#if CONFIG(ECAM_MMCONF_SUPPORT)
Expand Down
5 changes: 5 additions & 0 deletions src/include/acpi/acpi_ivrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
#define CAP_OFFSET_10_MSI_NUM_PPR_SHIFT 27
#define CAP_OFFSET_10_MSI_NUM_PPR (0x1f << CAP_OFFSET_10_MSI_NUM_PPR_SHIFT)

#define PCI_DEVID(BUS, DEV, FN) ( \
(((BUS) & 0xFF) << 8) | \
(((DEV) & 0x1F) << 3) | \
(((FN) & 0x07)))

/* IVHD (I/O Virtualization Hardware Definition Block) 4-byte entry */
typedef struct ivrs_ivhd_generic {
uint8_t type;
Expand Down
6 changes: 4 additions & 2 deletions src/mainboard/pcengines/apu2/acpi/routing.asl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
/* Routing is in System Bus scope */
Name(PR0, Package(){
/* NB devices */
/* Bus 0, Dev 0 - F16 Host Controller */
/* Bus 0, Dev 0 - F0:F16 Host Controller/F2:IOMMU */
Package(){0x0000FFFF, 0, INTA, 0 },

/* Bus 0, Dev 1 - PCI Bridge for Internal Graphics(IGP) */
/* Bus 0, Dev 1, Func 1 - HDMI Audio Controller */
Expand Down Expand Up @@ -46,7 +47,8 @@ Name(PR0, Package(){

Name(APR0, Package(){
/* NB devices in APIC mode */
/* Bus 0, Dev 0 - F15 Host Controller */
/* Bus 0, Dev 0 - F0:F16 Host Controller/F2:IOMMU */
Package(){0x0000FFFF, 0, 0, 16 },

/* Bus 0, Dev 1 - PCI Bridge for Internal Graphics(IGP) */
Package(){0x0001FFFF, 0, 0, 44 },
Expand Down
4 changes: 2 additions & 2 deletions src/mainboard/pcengines/apu2/mainboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static const u8 mainboard_picr_data[FCH_INT_TABLE_SIZE] = {
static const u8 mainboard_intr_data[FCH_INT_TABLE_SIZE] = {
[0 ... FCH_INT_TABLE_SIZE-1] = 0x1F,
/* INTA# - INTH# */
[0x00] = 0x10,0x10,0x12,0x13,0x14,0x15,0x1F,0x1F,
[0x00] = 0x10,0x11,0x12,0x13,0x14,0x15,0x1F,0x1F,
/* Misc-nil,0,1,2, INT from Serial irq */
[0x08] = 0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1F,
/* SCI, SMBUS0, ASF, HDA, FC, RSVD, PerMon, SD */
Expand Down Expand Up @@ -425,7 +425,7 @@ static void mainboard_final(void *chip_info)
* doesn't work when these bits are set.
*/
val = pci_read_config32(D18F3, 0xB8);
val &= 0xF000003F;
val &= 0xF00003FF;
pci_write_config32(D18F3, 0xB8, val);

/* Disable ECC exclusion range */
Expand Down
43 changes: 43 additions & 0 deletions src/northbridge/amd/pi/00730F01/acpi/northbridge.asl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ External (TOM2)
Name(_HID, EISAID("PNP0A08")) /* PCI Express Root Bridge */
Name(_CID, EISAID("PNP0A03")) /* PCI Root Bridge */

OperationRegion (NAPC, PCI_Config, 0xF8, 0x08)
Field (NAPC, DWordAcc, NoLock, Preserve)
{
NAPX, 32, /* Northbridge IOAPIC Index */
NAPD, 32 /* Northbridge IOAPIC Data */
}

IndexField (NAPX, NAPD, DWordAcc, NoLock, Preserve)
{
NAFC, 32 /* Northbridge IOAPIC Feature Control */
}

Mutex (NAPM, 0x00)
Method (NAPE, 1, NotSerialized)
{
Acquire (NAPM, 0xFFFF)

Local0 = NAFC
Local0 &= 0xFFFFFFEF /* Clear IoapicSbFeatureEn for APIC mode */

/* Set IoapicSbFeatureEn if OS chose to use PIC mode */
If (Arg0 == 0) {
Local0 |= (1 << 4)
}

NAFC = Local0

Release (NAPM)
}

/* Describe the Northbridge devices */

Method(_BBN, 0, NotSerialized) /* Bus number = 0 */
Expand All @@ -31,6 +61,19 @@ Device(AMRT) {
Name(_ADR, 0x00000000)
} /* end AMRT */

Device(IOMU) {
Name(_ADR, 0x00000002)

Method(_PRT,0, NotSerialized)
{
If(PICM)
{
Return(APR0) /* APIC mode */
}
Return (PR0) /* PIC Mode */
}
} /* end AMRT */

/* Gpp 0 */
Device(PBR4) {
Name(_ADR, 0x00020001)
Expand Down
Loading
Loading