Skip to content

Commit

Permalink
nb/amd/pi/00730F01,dsdt_top: Add hook for _PIC method
Browse files Browse the repository at this point in the history
Per family 16h models 30h-3fh BKDG the IoapicSbFeatureEn must be
configured according to the interrupt routing mode selecte by OS.
If OS chose APIC mode, the IoapicSbFeatureEn must be cleared.
Otherwise, it must be set, meaning PIC mode is used.

Add a hook to _PIC method to call SoC/northbridge specific code to
set/clear the bit to configure GNB IOAPIC properly.

ACPI specification says that _PIC method is optional and can be
called by OSPM to provide the interrupt routing mode information to
the firmware. However, if the method is not called, the firmware
must assume PIC mode is used. AGESA sets the IoapicSbFeatureEn
already to be compliant with ACPI. Previously, coreboot cleared the
bit unconditionally and left a comment to move that part to DSDT.
The hook allows to clear the IoapicSbFeatureEn bit if OS chooses APIC
mode for interrupt routing.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
  • Loading branch information
miczyg1 committed Nov 26, 2024
1 parent ace53ed commit 2b58e23
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
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
30 changes: 30 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 Down

0 comments on commit 2b58e23

Please sign in to comment.