From a2c5edeb2b0b357785033150c97ddeada5932f2d Mon Sep 17 00:00:00 2001 From: Gavin Shan Date: Tue, 26 Apr 2016 11:56:51 +1000 Subject: PHB3: Fix corruption of pref window register On P8+ Garrison platform, the root port's pref window register might be not writable and we have to emulate the window because of hardware defect. In order to detect that, we read the register content, write inversed value and read the register content again. The register is regarded as read-only if the values from the two continuous read are same. However, the original register content isn't written back and it causes corruption on pref window register if it's writable. This fixes the above issue by writing the original content back to the register at the end. Fixes: d40160f6 ("PHB3: Emulate root complex pref 64-bits window") Signed-off-by: Gavin Shan Signed-off-by: Stewart Smith --- hw/phb3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/phb3.c b/hw/phb3.c index c5c6fe3..849b1e2 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -527,6 +527,8 @@ static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev) PCI_CFG_PREF_MEM_BASE_U32, ~pref_hi); pci_cfg_read32(phb, dev->bdfn, PCI_CFG_PREF_MEM_BASE_U32, &tmp); + pci_cfg_write32(phb, dev->bdfn, + PCI_CFG_PREF_MEM_BASE_U32, pref_hi); if (tmp == pref_hi) pci_add_cfg_reg_filter(dev, PCI_CFG_PREF_MEM_BASE_U32, 12, -- cgit v1.1