From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Cc: gregkh@suse.de
Subject: [PATCH] PCI: use the MCFG table to properly access pci devices (i386)
Date: Mon, 27 Jun 2005 22:32:55 -0700 [thread overview]
Message-ID: <11199367751620@kroah.com> (raw)
In-Reply-To: <11199367752277@kroah.com>
[PATCH] PCI: use the MCFG table to properly access pci devices (i386)
Now that we have access to the whole MCFG table, let's properly use it
for all pci device accesses (as that's what it is there for, some boxes
don't put all the busses into one entry.)
If, for some reason, the table is incorrect, we fallback to the "old
style" of mmconfig accesses, namely, we just assume the first entry in
the table is the one for us, and blindly use it.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
commit d57e26ceb7dbf44cd08128cb6146116d4281b58b
tree 3fd0f4ff6ec93f3b8f4342649a4b717beb97c903
parent 545493917dc90298e1c38f018ad893f5518928e7
author Greg Kroah-Hartman <gregkh@suse.de> Thu, 23 Jun 2005 17:35:56 -0700
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 27 Jun 2005 21:52:47 -0700
arch/i386/pci/mmconfig.c | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -22,10 +22,31 @@ static u32 mmcfg_last_accessed_device;
/*
* Functions for accessing PCI configuration space with MMCONFIG accesses
*/
+static u32 get_base_addr(unsigned int seg, int bus)
+{
+ int cfg_num = -1;
+ struct acpi_table_mcfg_config *cfg;
+
+ while (1) {
+ ++cfg_num;
+ if (cfg_num >= pci_mmcfg_config_num) {
+ /* something bad is going on, no cfg table is found. */
+ /* so we fall back to the old way we used to do this */
+ /* and just rely on the first entry to be correct. */
+ return pci_mmcfg_config[0].base_address;
+ }
+ cfg = &pci_mmcfg_config[cfg_num];
+ if (cfg->pci_segment_group_number != seg)
+ continue;
+ if ((cfg->start_bus_number <= bus) &&
+ (cfg->end_bus_number >= bus))
+ return cfg->base_address;
+ }
+}
-static inline void pci_exp_set_dev_base(int bus, int devfn)
+static inline void pci_exp_set_dev_base(unsigned int seg, int bus, int devfn)
{
- u32 dev_base = pci_mmcfg_config[0].base_address | (bus << 20) | (devfn << 12);
+ u32 dev_base = get_base_addr(seg, bus) | (bus << 20) | (devfn << 12);
if (dev_base != mmcfg_last_accessed_device) {
mmcfg_last_accessed_device = dev_base;
set_fixmap_nocache(FIX_PCIE_MCFG, dev_base);
@@ -42,7 +63,7 @@ static int pci_mmcfg_read(unsigned int s
spin_lock_irqsave(&pci_config_lock, flags);
- pci_exp_set_dev_base(bus, devfn);
+ pci_exp_set_dev_base(seg, bus, devfn);
switch (len) {
case 1:
@@ -71,7 +92,7 @@ static int pci_mmcfg_write(unsigned int
spin_lock_irqsave(&pci_config_lock, flags);
- pci_exp_set_dev_base(bus, devfn);
+ pci_exp_set_dev_base(seg, bus, devfn);
switch (len) {
case 1:
next prev parent reply other threads:[~2005-06-28 5:35 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-28 5:30 [GIT PATCH] PCI patches for 2.6.12 Greg KH
2005-06-28 5:32 ` [PATCH] PCI Allow OutOfRange PIRQ table address Greg KH
2005-06-28 5:32 ` [PATCH] pci: remove deprecates Greg KH
2005-06-28 5:32 ` Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Make pcibios_fixup_bus() hot-plug safe Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: ACPI based root bridge hot-add Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Fix pci_enable_device() for p2p bridges Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Link newly created pci child bus to its parent on creation Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Prevent duplicate bus numbers when scanning PCI bridge Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Take the PCI lock when modifying pci bus or device lists Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Make the PCI remove routines safe for failed hot-plug Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Remove hot-plugged devices that could not be allocated resources Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Read bridge resources when fixing up the bus Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: clean up notify handlers on acpiphp unload Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Allow ACPI .add and .start operations to be done independently Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: convert acpiphp to use generic resource code Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Export the interface to get PCI id for an ACPI handle Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: fix slot power-down problem with acpiphp Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: decouple slot power state changes from physical hotplug Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: aCPI based root bridge hot-add Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: ia64 support Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: add interfaces Greg KH
2005-06-28 5:32 ` [PATCH] PCI: fix-pci-mmap-on-ppc-and-ppc64.patch Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: acpiphp support Greg KH
2005-06-28 5:32 ` [PATCH] PCI: DMA bursting advice Greg KH
2005-06-28 5:32 ` [PATCH] cpqphp: fix oops during unload without probe Greg KH
2005-06-28 5:32 ` [PATCH] PCI: clean up the MSI code a bit Greg KH
2005-06-28 5:32 ` [PATCH] PCI: fix up errors after dma bursting patch and CONFIG_PCI=n Greg KH
2005-06-28 5:32 ` [PATCH] PCI: add proper MCFG table parsing to ACPI core Greg KH
2005-06-28 5:32 ` [PATCH] PCI: make drivers use the pci shutdown callback instead of the driver core callback Greg KH
2005-06-28 5:32 ` Greg KH [this message]
2005-06-28 5:32 ` [PATCH] PCI: use the MCFG table to properly access pci devices (x86-64) Greg KH
2005-06-29 16:33 ` [PATCH] acpi bridge hotadd: ACPI based root bridge hot-add Grant Grundler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11199367751620@kroah.com \
--to=gregkh@suse.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox