Generalize the SMBus IO Enable quirk on all Intel ICHs

This has been tested safe on every ICH since the very first one by CPU-Z.
It also solves various SMBus access issues on Mobile PCHs (like #157)
This commit is contained in:
Sam Demeulemeester 2023-04-26 00:42:52 +02:00
parent 0fd2e4c37a
commit 1f1fe5bfe8
3 changed files with 10 additions and 21 deletions

View File

@ -99,15 +99,6 @@ static void amd_k8_revfg_temp(void)
cpu_temp_offset = 21.0f;
}
static void adl_unlock_smbus(void)
{
uint16_t x = pci_config_read16(0, 31, 4, 0x04);
if (!(x & 1)) {
pci_config_write16(0, 31, 4, 0x04, x | 1);
}
}
// ---------------------
// -- Public function --
// ---------------------
@ -208,13 +199,4 @@ void quirks_init(void)
}
}
}
// --------------------------------------------------
// -- SMBus unlock for ADL-N (and probably others) --
// --------------------------------------------------
if (imc_type == IMC_ADL_N && pci_config_read16(0, 31, 4, 0x2) == 0x54A3) { // ADL-N
quirk.id = QUIRK_ADL_SMB_UNLOCK;
quirk.type |= QUIRK_TYPE_SMBUS;
quirk.process = adl_unlock_smbus;
}
}

View File

@ -28,8 +28,7 @@ typedef enum {
QUIRK_X10SDV_NOSMP,
QUIRK_K8_BSTEP_NOTEMP,
QUIRK_K8_REVFG_TEMP,
QUIRK_AMD_ERRATA_319,
QUIRK_ADL_SMB_UNLOCK
QUIRK_AMD_ERRATA_319
} quirk_id_t;
typedef struct {

View File

@ -1340,10 +1340,18 @@ static bool ich5_get_smb(void)
{
uint16_t x;
// Enable SMBus IO Space if disabled
x = pci_config_read16(0, smbdev, smbfun, 0x4);
if (!(x & 1)) {
pci_config_write16(0, smbdev, smbfun, 0x4, x | 1);
}
// Read Base Address
x = pci_config_read16(0, smbdev, smbfun, 0x20);
smbusbase = x & 0xFFF0;
// Enable I2C Bus
// Enable I2C Host Controller Interface if disabled
uint8_t temp = pci_config_read8(0, smbdev, smbfun, 0x40);
if ((temp & 4) == 0) {
pci_config_write8(0, smbdev, smbfun, 0x40, temp | 0x04);