mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn_helgaas@hp.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: mj@ucw.cz, linux-kernel@vger.kernel.org
Subject: [PATCH] PCI: disable decoding while sizing BARs
Date: Mon, 16 Dec 2002 17:41:53 -0700	[thread overview]
Message-ID: <200212161741.53287.bjorn_helgaas@hp.com> (raw)

While sizing BARs, devices are temporarily assigned ranges
that may conflict with other things in the system, like IOSAPICs.
Here's a detailed description of a hang that results from leaving
device decoding enabled while sizing the BARs:

    https://lists.linuxia64.org/archives//linux-ia64/2002-April/003302.html

This patch applies to current 2.4 BitKeeper.

--- linux-2.4/drivers/pci/pci.c	2002-12-16 10:44:21.000000000 -0700
+++ testing/drivers/pci/pci.c	2002-12-16 17:22:26.000000000 -0700
@@ -1058,8 +1058,14 @@
 {
 	unsigned int pos, reg, next;
 	u32 l, sz;
+	u16 cmd;
 	struct resource *res;
 
+	/* Disable I/O & memory decoding while we size the BARs. */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND,
+		cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
+
 	for(pos=0; pos<howmany; pos = next) {
 		next = pos+1;
 		res = &dev->resource[pos];
@@ -1131,6 +1137,8 @@
 			res->end = res->start + (unsigned long) sz;
 		}
 	}
+
+	pci_write_config_word(dev, PCI_COMMAND, cmd);
 }
 
 void __devinit pci_read_bridge_bases(struct pci_bus *child)


             reply	other threads:[~2002-12-17  0:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-17  0:41 Bjorn Helgaas [this message]
2002-12-17 14:29 ` Ivan Kokshaysky
2002-12-18 12:30   ` Marcelo Tosatti

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=200212161741.53287.bjorn_helgaas@hp.com \
    --to=bjorn_helgaas@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=mj@ucw.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

all inboxes | Powered by JetHome®