From: Matthew Wilcox <matthew@wil.cx>
To: linux-pci@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org
Cc: Robert Hancock <hancockr@shaw.ca>,
Jesse Barnes <jesse.barnes@intel.com>, Greg KH <greg@kroah.com>
Subject: [PATCH] Fix boot-time hang on G31/G33 PC
Date: Sat, 25 Aug 2007 19:55:56 -0600 [thread overview]
Message-ID: <20070826015556.GC14130@parisc-linux.org> (raw)
This patch, loosely based on a patch from Robert Hancock, which was in
turn based on a patch from Jesse Barnes, fixes a boot-time hang on my
shiny new PC. The 'conflict' mentioned in the patch in my case happens
to be between mmconfig and the graphics card, but it could easily be
between any pair of devices if they are left enabled by the BIOS and
mappen in the wrong place.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 34b8dae..51ef450 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -180,11 +180,26 @@ static inline int is_64bit_memory(u32 mask)
return 0;
}
+/*
+ * Sizing PCI BARs requires us to disable decoding, otherwise we may run
+ * into conflicts with other devices while trying to size the BAR. Normally
+ * this isn't a problem, but it happens on some machines normally, and can
+ * happen on others during PCI device hotplug. Don't disable BARs for host
+ * bridges, though. Some of them do silly things like disable accesses to
+ * RAM from the CPU
+ */
static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
{
unsigned int pos, reg, next;
u32 l, sz;
struct resource *res;
+ u16 orig_cmd;
+
+ if ((dev->class >> 8) != PCI_CLASS_BRIDGE_HOST) {
+ pci_read_config_word(dev, PCI_COMMAND, &orig_cmd);
+ pci_write_config_word(dev, PCI_COMMAND,
+ orig_cmd & ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO));
+ }
for(pos=0; pos<howmany; pos = next) {
u64 l64;
@@ -283,6 +298,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
}
}
}
+
+ if ((dev->class >> 8) != PCI_CLASS_BRIDGE_HOST)
+ pci_write_config_word(dev, PCI_COMMAND, orig_cmd);
}
void __devinit pci_read_bridge_bases(struct pci_bus *child)
--
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
next reply other threads:[~2007-08-26 1:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 1:55 Matthew Wilcox [this message]
2007-08-26 4:24 ` [PATCH] Fix boot-time hang on G31/G33 PC Robert Hancock
2007-08-26 12:55 ` Matthew Wilcox
2007-08-26 14:07 ` Matthew Wilcox
2007-08-26 17:59 ` Robert Hancock
2007-08-28 17:22 ` Jesse Barnes
2007-08-28 17:59 ` Grant Grundler
2007-08-28 18:28 ` Grant Grundler
2007-09-26 21:18 ` PCI: " Greg KH
2007-09-26 21:55 ` Jesse Barnes
2007-09-26 21:56 ` Greg KH
2007-09-26 22:20 ` Jesse Barnes
2007-09-26 23:04 ` Robert Hancock
2007-09-27 14:31 ` Ivan Kokshaysky
2007-09-27 18:36 ` Kok, Auke
2007-09-27 23:13 ` Greg KH
2007-10-12 14:26 ` Vitaliy Gusev
2007-10-12 17:07 ` Kok, Auke
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=20070826015556.GC14130@parisc-linux.org \
--to=matthew@wil.cx \
--cc=greg@kroah.com \
--cc=hancockr@shaw.ca \
--cc=jesse.barnes@intel.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