mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	Arjan van de Ven <arjan@linux.intel.com>, Andi Kleen <ak@suse.de>
Subject: [PATCH 3/4] MMCONFIG: fix unreachable_devices()
Date: Wed, 10 Jan 2007 04:00:43 +0900	[thread overview]
Message-ID: <87wt3w3u04.fsf_-_@duaron.myhome.or.jp> (raw)
In-Reply-To: <871wm458lj.fsf@duaron.myhome.or.jp> (OGAWA Hirofumi's message of "Wed\, 10 Jan 2007 04\:00\:08 +0900")

Currently, unreachable_devices() compares value of mmconfig and value
of conf1. But it doesn't check the device is reachable or not.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 arch/i386/pci/mmconfig-shared.c |   12 +++++++-----
 arch/i386/pci/mmconfig.c        |    6 ++++++
 arch/i386/pci/pci.h             |    2 ++
 arch/x86_64/pci/mmconfig.c      |    6 ++++++
 4 files changed, 21 insertions(+), 5 deletions(-)

diff -puN arch/i386/pci/mmconfig-shared.c~pci-mmconfig-fix-unreachable_devices arch/i386/pci/mmconfig-shared.c
--- linux-2.6/arch/i386/pci/mmconfig-shared.c~pci-mmconfig-fix-unreachable_devices	2007-01-06 00:47:39.000000000 +0900
+++ linux-2.6-hirofumi/arch/i386/pci/mmconfig-shared.c	2007-01-06 04:47:21.000000000 +0900
@@ -43,12 +43,14 @@ static void __init unreachable_devices(v
 			if (val1 == 0xffffffff)
 				continue;
 
-			raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
-			if (val1 != val2) {
-				set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
-				printk(KERN_NOTICE "PCI: No mmconfig possible"
-				       " on device %02x:%02x\n", bus, i);
+			if (pci_mmcfg_arch_reachable(0, bus, devfn)) {
+				raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
+				if (val1 == val2)
+					continue;
 			}
+			set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
+			printk(KERN_NOTICE "PCI: No mmconfig possible on device"
+			       " %02x:%02x\n", bus, i);
 		}
 	}
 }
diff -puN arch/i386/pci/mmconfig.c~pci-mmconfig-fix-unreachable_devices arch/i386/pci/mmconfig.c
--- linux-2.6/arch/i386/pci/mmconfig.c~pci-mmconfig-fix-unreachable_devices	2007-01-06 00:47:39.000000000 +0900
+++ linux-2.6-hirofumi/arch/i386/pci/mmconfig.c	2007-01-06 04:47:14.000000000 +0900
@@ -136,6 +136,12 @@ static struct pci_raw_ops pci_mmcfg = {
 	.write =	pci_mmcfg_write,
 };
 
+int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+				    unsigned int devfn)
+{
+	return get_base_addr(seg, bus, devfn) != 0;
+}
+
 int __init pci_mmcfg_arch_init(void)
 {
 	printk(KERN_INFO "PCI: Using MMCONFIG\n");
diff -puN arch/x86_64/pci/mmconfig.c~pci-mmconfig-fix-unreachable_devices arch/x86_64/pci/mmconfig.c
--- linux-2.6/arch/x86_64/pci/mmconfig.c~pci-mmconfig-fix-unreachable_devices	2007-01-06 00:47:39.000000000 +0900
+++ linux-2.6-hirofumi/arch/x86_64/pci/mmconfig.c	2007-01-06 04:47:14.000000000 +0900
@@ -112,6 +112,12 @@ static struct pci_raw_ops pci_mmcfg = {
 	.write =	pci_mmcfg_write,
 };
 
+int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+				    unsigned int devfn)
+{
+	return pci_dev_base(seg, bus, devfn) != NULL;
+}
+
 int __init pci_mmcfg_arch_init(void)
 {
 	int i;
diff -puN arch/i386/pci/pci.h~pci-mmconfig-fix-unreachable_devices arch/i386/pci/pci.h
--- linux-2.6/arch/i386/pci/pci.h~pci-mmconfig-fix-unreachable_devices	2007-01-06 00:47:39.000000000 +0900
+++ linux-2.6-hirofumi/arch/i386/pci/pci.h	2007-01-06 00:47:39.000000000 +0900
@@ -101,4 +101,6 @@ extern void pcibios_sort(void);
 #define PCI_MMCFG_MAX_CHECK_BUS 16
 extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
 
+extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+					   unsigned int devfn);
 extern int __init pci_mmcfg_arch_init(void);
_

  reply	other threads:[~2007-01-09 19:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-09 18:59 [PATCH 1/4] MMCONFIG: cleanup OGAWA Hirofumi
2007-01-09 19:00 ` [PATCH 2/4] MMCONFIG: Reject a broken MCFG tables on Asus etc OGAWA Hirofumi
2007-01-09 19:00   ` OGAWA Hirofumi [this message]
2007-01-09 19:01     ` [PATCH 4/4] MMCONFIG: Fix x86_64 ioremap base_address OGAWA Hirofumi
2007-01-10  0:21 ` [PATCH 1/4] MMCONFIG: cleanup Andi Kleen
2007-01-10  0:41   ` OGAWA Hirofumi

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=87wt3w3u04.fsf_-_@duaron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®