PCI: iproc: move quirks to driver
PATCH 1/1 PCI: iproc: move quirks to driver
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Move the quirks to driver code to fix the issue.
---
Feel free to change the commit message as you see fit.
--- drivers/pci/controller/pcie-iproc-platform.c | 24 ++++++++++++++++++ drivers/pci/quirks.c | 26 -------------------- 2 files changed, 24 insertions(+), 26 deletions(-)
drivers/pci/controller/pcie-iproc-platform.c +24 -0
@@ -19,6 +19,30 @@#include "../pci.h" #include "pcie-iproc.h" +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +static const struct of_device_id iproc_pcie_of_match_table[] = { { .compatible ="brcm,iproc-pcie" ,
drivers/pci/quirks.c +0 -26
@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the
Signature · 1 line
2.20.1
Quoted 6 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>
This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
Quoted 80 lines
--- drivers/pci/controller/pcie-iproc-platform.c | 24 ++++++++++++++++++ drivers/pci/quirks.c | 26 -------------------- 2 files changed, 24 insertions(+), 26 deletions(-)drivers/pci/controller/pcie-iproc-platform.c +24
-0@@ -19,6 +19,30 @@#include "../pci.h" #include "pcie-iproc.h" +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +static const struct of_device_id iproc_pcie_of_match_table[] = { { .compatible ="brcm,iproc-pcie" ,drivers/pci/quirks.c +0
-26@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the Signature · 1 line
2.20.1
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Quoted 9 lines
Quoted 3 lines
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
Opps! I was going to review and comment and you are quick, :)
I was going to say, I think it's better to keep this quirk in "pcie-iproc.c" instead of "pcie-iproc-platform.c".
The quirk is specific to certain PCIe devices under iProc (activated based on device ID), but should not be tied to a specific bus architecture (i.e., platform vs BCMA).
Thanks,
Ray
Quoted 80 lines
Quoted 80 lines
--- drivers/pci/controller/pcie-iproc-platform.c | 24 ++++++++++++++++++ drivers/pci/quirks.c | 26 -------------------- 2 files changed, 24 insertions(+), 26 deletions(-)drivers/pci/controller/pcie-iproc-platform.c +24
-0@@ -19,6 +19,30 @@#include "../pci.h" #include "pcie-iproc.h" +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +static const struct of_device_id iproc_pcie_of_match_table[] = { { .compatible ="brcm,iproc-pcie" ,drivers/pci/quirks.c +0
-26@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the Signature · 1 line
2.20.1
Quoted 18 lines · Ray Jui
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Quoted 9 lines
Quoted 3 lines
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
Quoted 8 lines
Opps! I was going to review and comment and you are quick, :)
I was going to say, I think it's better to keep this quirk in "
pcie-iproc.c" instead of "pcie-iproc-platform.c".The quirk is specific to certain PCIe devices under iProc (activated based on device ID), but should not be tied to a specific bus architecture (i.e., platform vs BCMA).
I'm happy to move it; that's no problem.
Quoted 80 lines
Quoted 80 lines
Quoted 80 lines
--- drivers/pci/controller/pcie-iproc-platform.c | 24 ++++++++++++++++++ drivers/pci/quirks.c | 26 -------------------- 2 files changed, 24 insertions(+), 26 deletions(-)drivers/pci/controller/pcie-iproc-platform.c +24
-0@@ -19,6 +19,30 @@#include "../pci.h" #include "pcie-iproc.h" +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +static const struct of_device_id iproc_pcie_of_match_table[] = { { .compatible ="brcm,iproc-pcie" ,drivers/pci/quirks.c +0
-27@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the -- 2.20.1
Quoted 21 lines · Bjorn Helgaas
Quoted 20 lines · Ray Jui
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Quoted 9 lines
Quoted 3 lines
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
Opps! I was going to review and comment and you are quick, :)
Quoted 9 lines
Quoted 6 lines
I was going to say, I think it's better to keep this quirk in "
pcie-iproc.c" instead of "pcie-iproc-platform.c".The quirk is specific to certain PCIe devices under iProc (activated based on device ID), but should not be tied to a specific bus architecture (i.e., platform vs BCMA).
I'm happy to move it; that's no problem.
Thanks, Bjorn!
Quoted 28 lines · Ray Jui
Quoted 24 lines · Bjorn Helgaas
Quoted 23 lines · Ray Jui
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Quoted 9 lines
Quoted 3 lines
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
Opps! I was going to review and comment and you are quick, :)
I was going to say, I think it's better to keep this quirk in "
pcie-iproc.c" instead of "pcie-iproc-platform.c".
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The quirk is specific to certain PCIe devices under iProc (activated based on device ID), but should not be tied to a specific bus architecture (i.e., platform vs BCMA).
I'm happy to move it; that's no problem.
Thanks, Bjorn!
Thank you both.
Wei.
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Quoted 8 lines
Quoted 3 lines
Move the quirks to driver code to fix the issue.
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
OK, I moved this to pcie-iproc.c:
commit 574f29036fce ("PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in")
Author: Wei Liu <[email protected]> Date: Wed Dec 11 17:45:11 2019 +0000
PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in
Previously quirk_paxc_bridge() was applied when the iproc driver was built-in, but not when it was compiled as a module.
This happened because it was under #ifdef CONFIG_PCIE_IPROC_PLATFORM:
PCIE_IPROC_PLATFORM=y causes CONFIG_PCIE_IPROC_PLATFORM to be defined, but PCIE_IPROC_PLATFORM=m causes CONFIG_PCIE_IPROC_PLATFORM_MODULE to be defined.
Move quirk_paxc_bridge() to pcie-iproc.c and drop the #ifdef so the quirk is always applied, whether iproc is built-in or a module.
drivers/pci/controller/pcie-iproc.c +24 -0
@@ -1588,6 +1588,30 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802,DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_disable_msi_parsing); +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom iPROC PCIe common driver" );MODULE_LICENSE ("GPL v2" );
drivers/pci/quirks.c +0 -26
@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Wei Liu
The quirks were originally enclosed by ifdef. That made the quirks not to be applied when respective drivers were compiled as modules.
Move the quirks to driver code to fix the issue.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>This straddles the core and native driver boundary, so I applied it to pci/misc for v5.6. Thanks, I think this is a great solution! It's always nice when we can encapsulate device-specific things in a driver.
OK, I moved this to
pcie-iproc.c:
Thanks a lot, Bjorn!
Quoted 95 lines
commit
574f29036fce("PCI: iproc: Applyquirk_paxc_bridge()for module as well as built-in")Author: Wei Liu <[email protected]> Date: Wed Dec 11 17:45:11 2019 +0000PCI: iproc: Apply
quirk_paxc_bridge()for module as well as built-inPreviously
quirk_paxc_bridge()was applied when the iproc driver was built-in, but not when it was compiled as a module.This happened because it was under #ifdef
CONFIG_PCIE_IPROC_PLATFORM:
PCIE_IPROC_PLATFORM=y causesCONFIG_PCIE_IPROC_PLATFORMto be defined, but PCIE_IPROC_PLATFORM=m causesCONFIG_PCIE_IPROC_PLATFORM_MODULEto be defined.Move
quirk_paxc_bridge()topcie-iproc.cand drop the #ifdef so the quirk is always applied, whether iproc is built-in or a module.[bhelgaas: commit log, move to pcie-iproc.c, not pcie-iproc-platform.c]Signed-off-by Wei Liu <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>drivers/pci/controller/pcie-iproc.c +24
-0@@ -1588,6 +1588,30 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802,DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_disable_msi_parsing); +static void quirk_paxc_bridge (struct pci_dev *pdev) +{ +/* +* The PCI config space is shared with the PAXC root port and the first +* Ethernet device. So, we need to workaround this by telling the PCI +* code that the bridge is not an Ethernet device. +*/ +if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) + pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; + +/* +* MPSS is not being set properly (as it is currently 0). This is +* because that area of the PCI config space is hard coded to zero, and +* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) +* so that the MPS can be set to the real max value. +*/ + pdev->pcie_mpss =2 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); +MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom iPROC PCIe common driver" );MODULE_LICENSE ("GPL v2" );drivers/pci/quirks.c +0
-26@@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,PCI_DEVICE_ID_TIGON3_5719 , quirk_brcm_5719_limit_mrrs); -#ifdef CONFIG_PCIE_IPROC_PLATFORM -static void quirk_paxc_bridge (struct pci_dev *pdev) -{ -/* -* The PCI config space is shared with the PAXC root port and the first -* Ethernet device. So, we need to workaround this by telling the PCI -* code that the bridge is not an Ethernet device. -*/ -if (pdev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) - pdev->class =PCI_CLASS_BRIDGE_PCI <<8 ; - -/* -* MPSS is not being set properly (as it is currently 0). This is -* because that area of the PCI config space is hard coded to zero, and -* is not modifiable by firmware. Set this to 2 (e.g., 512 byte MPS) -* so that the MPS can be set to the real max value. -*/ - pdev->pcie_mpss =2 ; -} -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16cd , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0x16f0 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd750 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd802 , quirk_paxc_bridge); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_BROADCOM ,0xd804 , quirk_paxc_bridge); -#endif -/* * Originally in EDAC sources for i82875P: Intel tells BIOS developers to * hide device 6 which configures the overflow device access containing the