public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] PCI: Introduce new PCI_CONF1_ADDRESS() and PCI_CONF1_EXT_ADDRESS() macros
@ 2022-09-11 11:20 Pali Rohár
  2022-09-11 11:20 ` [RFC PATCH 1/3] PCI: Add standard PCI Config Address macros Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pali Rohár @ 2022-09-11 11:20 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Sergio Paracuellos, Matthias Brugger
  Cc: linux-kernel, linux-pci

PCI controllers and lot of non-ECAM compliant PCIe controllers still use
Intel PCI Configuration Mechanism #1 for accessing PCI config space.

Native PCIe controller drivers invents its own macros which implements
config space address calculation and in lof of cases it is just
duplication of the same code.

PCIe ECAM address macro PCIE_ECAM_OFFSET() is already in include header
file linux/pci-ecam.h and ECAM compliant drivers were already converted
to use it.

Do similar thing also for Intel PCI Configuration Mechanism #1.
Introduce a new file linux/pci-conf1.h with PCI_CONF1_ADDRESS() and
PCI_CONF1_EXT_ADDRESS() macros and convert two drivers pci-ftpci100.c
and pcie-mt7621.c to use it.

There are many more drivers which could be converted to this common
macros. This is just RFC patch series and if you like it, I can look at
conversion of other drivers.

What do you think?

Note that similar cleanup was applied for U-Boot PCI controller drivers:
https://lore.kernel.org/u-boot/20211126104252.5443-1-pali@kernel.org/

Pali Rohár (3):
  PCI: Add standard PCI Config Address macros
  PCI: ftpci100: Use PCI_CONF1_ADDRESS() macro
  PCI: mt7621: Use PCI_CONF1_EXT_ADDRESS() macro

 drivers/pci/controller/pci-ftpci100.c | 22 +++---------
 drivers/pci/controller/pcie-mt7621.c  |  4 +--
 include/linux/pci-conf1.h             | 51 +++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/pci-conf1.h

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-13 21:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-11 11:20 [RFC PATCH 0/3] PCI: Introduce new PCI_CONF1_ADDRESS() and PCI_CONF1_EXT_ADDRESS() macros Pali Rohár
2022-09-11 11:20 ` [RFC PATCH 1/3] PCI: Add standard PCI Config Address macros Pali Rohár
2022-09-13 21:11   ` Bjorn Helgaas
2022-09-13 21:24     ` Pali Rohár
2022-09-13 21:53       ` Bjorn Helgaas
2022-09-11 11:20 ` [RFC PATCH 2/3] PCI: ftpci100: Use PCI_CONF1_ADDRESS() macro Pali Rohár
2022-09-11 11:20 ` [RFC PATCH 3/3] PCI: mt7621: Use PCI_CONF1_EXT_ADDRESS() macro Pali Rohár
2022-09-12  9:30   ` Sergio Paracuellos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox