Commit bfd4473b authored by Qiuxu Zhuo's avatar Qiuxu Zhuo Committed by Wolfram Sang

i2c: i801: Restore the presence state of P2SB PCI device after reading BAR

Sun, Yunying reported the following failure on Denverton micro-server:

 EDAC DEBUG: pnd2_init:
 EDAC DEBUG: pnd2_probe:
 EDAC DEBUG: dnv_rd_reg: Read b_cr_tolud_pci=00000000_80000000
 EDAC DEBUG: dnv_rd_reg: Read b_cr_touud_lo_pci=00000000_80000000
 EDAC DEBUG: dnv_rd_reg: Read b_cr_touud_hi_pci=00000000_00000004
 EDAC DEBUG: dnv_rd_reg: Read b_cr_asym_mem_region0_mchbar=00000000_00000000
 EDAC DEBUG: dnv_rd_reg: Read b_cr_asym_mem_region1_mchbar=00000000_00000000
 EDAC DEBUG: dnv_rd_reg: Read b_cr_mot_out_base_mchbar=00000000_00000000
 EDAC DEBUG: dnv_rd_reg: Read b_cr_mot_out_mask_mchbar=00000000_00000000
 EDAC pnd2: Failed to register device with error -19.

On Denverton micro-server, the presence of the P2SB bridge PCI device is
enabled or disabled by the item 'RelaxSecConf' in BIOS setup menu. When
'RelaxSecConf' is enabled, the P2SB PCI device is present and the pnd2_edac
EDAC driver also uses it to get BAR. Hiding the P2SB PCI device caused the
pnd2_edac EDAC driver failed to get BAR then reported the above failure.

Therefor, store the presence state of P2SB PCI device before unhiding it
for reading BAR and restore the presence state after reading BAR.
Signed-off-by: default avatarQiuxu Zhuo <qiuxu.zhuo@intel.com>
Reported-by: default avatarYunying Sun <yunying.sun@intel.com>
Tested-by: default avatarYunying Sun <yunying.sun@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent b505ae15
...@@ -1332,6 +1332,7 @@ static void i801_add_tco(struct i801_priv *priv) ...@@ -1332,6 +1332,7 @@ static void i801_add_tco(struct i801_priv *priv)
u32 tco_base, tco_ctl; u32 tco_base, tco_ctl;
u32 base_addr, ctrl_val; u32 base_addr, ctrl_val;
u64 base64_addr; u64 base64_addr;
u8 hidden;
if (!(priv->features & FEATURE_TCO)) if (!(priv->features & FEATURE_TCO))
return; return;
...@@ -1376,8 +1377,10 @@ static void i801_add_tco(struct i801_priv *priv) ...@@ -1376,8 +1377,10 @@ static void i801_add_tco(struct i801_priv *priv)
devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 1); devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 1);
/* Unhide the P2SB device */ /* Unhide the P2SB device, if it is hidden */
pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, 0x0); pci_bus_read_config_byte(pci_dev->bus, devfn, 0xe1, &hidden);
if (hidden)
pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, 0x0);
pci_bus_read_config_dword(pci_dev->bus, devfn, SBREG_BAR, &base_addr); pci_bus_read_config_dword(pci_dev->bus, devfn, SBREG_BAR, &base_addr);
base64_addr = base_addr & 0xfffffff0; base64_addr = base_addr & 0xfffffff0;
...@@ -1385,8 +1388,9 @@ static void i801_add_tco(struct i801_priv *priv) ...@@ -1385,8 +1388,9 @@ static void i801_add_tco(struct i801_priv *priv)
pci_bus_read_config_dword(pci_dev->bus, devfn, SBREG_BAR + 0x4, &base_addr); pci_bus_read_config_dword(pci_dev->bus, devfn, SBREG_BAR + 0x4, &base_addr);
base64_addr |= (u64)base_addr << 32; base64_addr |= (u64)base_addr << 32;
/* Hide the P2SB device */ /* Hide the P2SB device, if it was hidden before */
pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, 0x1); if (hidden)
pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden);
spin_unlock(&p2sb_spinlock); spin_unlock(&p2sb_spinlock);
res = &tco_res[ICH_RES_MEM_OFF]; res = &tco_res[ICH_RES_MEM_OFF];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment