summaryrefslogtreecommitdiff
path: root/drivers/pci/pci-bridge-emul.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2022-01-12 07:40:50 -0300
committerGitHub <noreply@github.com>2022-01-12 07:40:50 -0300
commit712fcc850e5a6d0867b0d97a0b79f1addd01998f (patch)
treed092452bebc70059ffa9f913a1daea74d656300e /drivers/pci/pci-bridge-emul.c
parente99f775ed2f46b225106f0a156116a0080d16740 (diff)
parent0156d956a951c70743d2338132662b29aeb8847d (diff)
Merge pull request #517 from denisdrozdov/5.4-2.3.x-imx
Merge tag 'v5.4.161' into 5.4-2.3.x-imx
Diffstat (limited to 'drivers/pci/pci-bridge-emul.c')
-rw-r--r--drivers/pci/pci-bridge-emul.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c
index 06c800595e03..b3d63e319bb3 100644
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -432,8 +432,21 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where,
/* Clear the W1C bits */
new &= ~((value << shift) & (behavior[reg / 4].w1c & mask));
+ /* Save the new value with the cleared W1C bits into the cfgspace */
cfgspace[reg / 4] = cpu_to_le32(new);
+ /*
+ * Clear the W1C bits not specified by the write mask, so that the
+ * write_op() does not clear them.
+ */
+ new &= ~(behavior[reg / 4].w1c & ~mask);
+
+ /*
+ * Set the W1C bits specified by the write mask, so that write_op()
+ * knows about that they are to be cleared.
+ */
+ new |= (value << shift) & (behavior[reg / 4].w1c & mask);
+
if (write_op)
write_op(bridge, reg, old, new, mask);