mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-23 12:35:41 +00:00
acpica: avoid special mmio address request
Add special handling for root bridge access for 12th Gen Framework laptop and Thinkpad X1 Nano Gen2 to avoid bogus MMIO memory accesses as seen in #5234 and #4643. Fixes #5234
This commit is contained in:
parent
a12ff58674
commit
ba473134da
@ -41,6 +41,17 @@ struct Bdf
|
||||
};
|
||||
|
||||
|
||||
static bool cpu_name(char const * name)
|
||||
{
|
||||
unsigned cpuid = 0, edx = 0, ebx = 0, ecx = 0;
|
||||
asm volatile ("cpuid" : "+a" (cpuid), "=d" (edx), "=b"(ebx), "=c"(ecx));
|
||||
|
||||
return ebx == *reinterpret_cast<unsigned const *>(name + 0) &&
|
||||
edx == *reinterpret_cast<unsigned const *>(name + 4) &&
|
||||
ecx == *reinterpret_cast<unsigned const *>(name + 8);
|
||||
}
|
||||
|
||||
|
||||
/*************************
|
||||
* Acpica PCI OS backend *
|
||||
*************************/
|
||||
@ -54,6 +65,26 @@ ACPI_STATUS AcpiOsReadPciConfiguration (ACPI_PCI_ID *pcidev, UINT32 reg,
|
||||
|
||||
Bdf bdf(pcidev->Bus, pcidev->Device, pcidev->Function);
|
||||
|
||||
bool const intel = cpu_name("GenuineIntel");
|
||||
bool const emulate = intel &&
|
||||
!pcidev->Bus && !pcidev->Device && !pcidev->Function;
|
||||
|
||||
/*
|
||||
* ACPI quirk for 12th Gen Framework laptop and Thinkpad X1 Nano Gen2
|
||||
*
|
||||
* XXX emulate some of the register accesses to the Intel root bridge to
|
||||
* avoid bogus calculation of physical addresses. The value seems to
|
||||
* be close to the pci config start address as provided by mcfg table
|
||||
* for those machines.
|
||||
*/
|
||||
if (emulate) {
|
||||
if (reg == 0x60 && width == 32) {
|
||||
*value = 0xe0000001;
|
||||
warning(bdf, " emulate read ", Hex(reg), " -> ", Hex(*value));
|
||||
return AE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* during startup suppress errors */
|
||||
if (!(AcpiDbgLevel & ACPI_LV_INIT))
|
||||
error(__func__, " ", bdf, " ", Hex(reg), " width=", width);
|
||||
|
Loading…
x
Reference in New Issue
Block a user