summaryrefslogtreecommitdiff
path: root/drivers/edac
diff options
context:
space:
mode:
authorQiuxu Zhuo <qiuxu.zhuo@intel.com>2017-08-14 18:49:05 +0300
committerBorislav Petkov <bp@suse.de>2017-08-19 11:51:11 +0300
commitbc8f10babcc27c1f4d8e80d91cc543eabf9125c4 (patch)
tree797a999e317d6ba1b1b99f8fd29e5b86d43d4104 /drivers/edac
parent5fd77cb3bac77f690d1d9cf57dc7851fcb3e7945 (diff)
downloadlinux-bc8f10babcc27c1f4d8e80d91cc543eabf9125c4.tar.xz
EDAC, pnd2: Properly toggle hidden state for P2SB PCI device
Properly handle hidden state of P2SB PCI device (DEV:D, FUN:0) for Apollo Lake. Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Cc: Tony Luck <tony.luck@intel.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/20170814154905.21707-1-qiuxu.zhuo@intel.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/pnd2_edac.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 89cdd9a7a733..4395c84cdcbf 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -161,8 +161,12 @@ static int _apl_rd_reg(int port, int off, int op, u32 *data)
{
int retries = 0xff, ret;
u16 status;
+ u8 hidden;
- P2SB_WRITE(byte, P2SB_HIDE_OFF, 0);
+ /* Unhide the P2SB device, if it's hidden */
+ P2SB_READ(byte, P2SB_HIDE_OFF, &hidden);
+ if (hidden)
+ P2SB_WRITE(byte, P2SB_HIDE_OFF, 0);
if (p2sb_is_busy(&status)) {
ret = -EAGAIN;
@@ -185,7 +189,9 @@ static int _apl_rd_reg(int port, int off, int op, u32 *data)
P2SB_READ(dword, P2SB_DATA_OFF, data);
ret = (status >> 1) & 0x3;
out:
- P2SB_WRITE(byte, P2SB_HIDE_OFF, 1);
+ /* Hide the P2SB device, if it was hidden before */
+ if (hidden)
+ P2SB_WRITE(byte, P2SB_HIDE_OFF, hidden);
return ret;
}