Pablo Greco 7b2c62
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Pablo Greco 7b2c62
From: Robert Richter <rrichter@redhat.com>
Pablo Greco 7b2c62
Date: Thu, 7 Jun 2018 22:59:32 -0400
Pablo Greco 7b2c62
Subject: [PATCH] Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Message-id: <1528412373-19128-2-git-send-email-rrichter@redhat.com>
Pablo Greco 7b2c62
Patchwork-id: 220950
Pablo Greco 7b2c62
O-Subject: [RHEL-8.0 BZ 1563590 v2 1/2] PCI: Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon
Pablo Greco 7b2c62
Bugzilla: 1563590
Pablo Greco 7b2c62
RH-Acked-by: Dean Nelson <dnelson@redhat.com>
Pablo Greco 7b2c62
RH-Acked-by: Mark Langsdorf <mlangsdo@redhat.com>
Pablo Greco 7b2c62
RH-Acked-by: Mark Salter <msalter@redhat.com>
Pablo Greco 7b2c62
Pablo Greco 7b2c62
From: Ashok Kumar Sekar <asekar@redhat.com>
Pablo Greco 7b2c62
Pablo Greco 7b2c62
PCI BAR 5 is not setup correctly for the on-board AHCI
Pablo Greco 7b2c62
controller on Broadcom's Vulcan processor. Added a quirk to fix BAR 5
Pablo Greco 7b2c62
by using BAR 4's resources which are populated correctly but NOT used
Pablo Greco 7b2c62
by the AHCI controller actually.
Pablo Greco 7b2c62
Pablo Greco 7b2c62
RHEL-only:
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Both patches are in RHEL-7.6 also. Inclusion of the patches into RHEL-8
Pablo Greco 7b2c62
was discussed. Since there are partners with Ax system configurations it
Pablo Greco 7b2c62
was decided to carry them in RHEL8 too. See:
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 https://bugzilla.redhat.com/show_bug.cgi?id=1563590#c1
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Upstream Status: RHEL only
Pablo Greco 7b2c62
Signed-off-by: Ashok Kumar Sekar <asekar@redhat.com>
Pablo Greco 7b2c62
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Pablo Greco 7b2c62
Signed-off-by: Robert Richter <rrichter@redhat.com>
Pablo Greco 7b2c62
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Pablo Greco 7b2c62
---
Pablo Greco 7b2c62
 drivers/pci/quirks.c | 24 ++++++++++++++++++++++++
Pablo Greco 7b2c62
 1 file changed, 24 insertions(+)
Pablo Greco 7b2c62
Pablo Greco 7b2c62
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
Pablo Greco 7b2c62
index bdf9b52567e0..1e98e20b7cc2 100644
Pablo Greco 7b2c62
--- a/drivers/pci/quirks.c
Pablo Greco 7b2c62
+++ b/drivers/pci/quirks.c
Pablo Greco 7b2c62
@@ -4196,6 +4196,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000,
Pablo Greco 7b2c62
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9084,
Pablo Greco 7b2c62
 				quirk_bridge_cavm_thrx2_pcie_root);
Pablo Greco 7b2c62
Pablo Greco 7b2c62
+/*
Pablo Greco 7b2c62
+ * PCI BAR 5 is not setup correctly for the on-board AHCI controller
Pablo Greco 7b2c62
+ * on Broadcom's Vulcan processor. Added a quirk to fix BAR 5 by
Pablo Greco 7b2c62
+ * using BAR 4's resources which are populated correctly and NOT
Pablo Greco 7b2c62
+ * actually used by the AHCI controller.
Pablo Greco 7b2c62
+ */
Pablo Greco 7b2c62
+static void quirk_fix_vulcan_ahci_bars(struct pci_dev *dev)
Pablo Greco 7b2c62
+{
Pablo Greco 7b2c62
+	struct resource *r =  &dev->resource[4];
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
+	if (!(r->flags & IORESOURCE_MEM) || (r->start == 0))
Pablo Greco 7b2c62
+		return;
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
+	/* Set BAR5 resource to BAR4 */
Pablo Greco 7b2c62
+	dev->resource[5] = *r;
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
+	/* Update BAR5 in pci config space */
Pablo Greco 7b2c62
+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_5, r->start);
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
+	/* Clear BAR4's resource */
Pablo Greco 7b2c62
+	memset(r, 0, sizeof(*r));
Pablo Greco 7b2c62
+}
Pablo Greco 7b2c62
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9027, quirk_fix_vulcan_ahci_bars);
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
 /*
Pablo Greco 7b2c62
  * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
Pablo Greco 7b2c62
  * class code.  Fix it.
Pablo Greco 7b2c62
-- 
Pablo Greco 7b2c62
2.28.0
Pablo Greco 7b2c62