public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: jbarnes@virtuousgeek.org
Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
	svenkatr@ti.com, yinghai@kernel.org, cjb@laptop.org,
	linux-pci@vger.kernel.org, linux-net-drivers@solarflare.com,
	bhutchings@solarflare.com, Ram Pai <linuxram@us.ibm.com>
Subject: [PATCH 4/4] PCI: make cardbus-bridge resources nice-to-have
Date: Mon, 20 Jun 2011 15:47:17 -0700	[thread overview]
Message-ID: <1308610037-6261-5-git-send-email-linuxram@us.ibm.com> (raw)
In-Reply-To: <1308610037-6261-1-git-send-email-linuxram@us.ibm.com>

Allocate resources to cardbus bridge only after all other genuine
resources requests are satisfied. Dont retry if resource allocation
for cardbus-bridge fails.

Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 drivers/pci/setup-bus.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 4f8873e..023fc9c 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -742,7 +742,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 	return 1;
 }
 
-static void pci_bus_size_cardbus(struct pci_bus *bus)
+static void pci_bus_size_cardbus(struct pci_bus *bus,
+			struct resource_list_x *add_head)
 {
 	struct pci_dev *bridge = bus->self;
 	struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
@@ -753,12 +754,14 @@ static void pci_bus_size_cardbus(struct pci_bus *bus)
 	 * a fixed amount of bus space for CardBus bridges.
 	 */
 	b_res[0].start = 0;
-	b_res[0].end = pci_cardbus_io_size - 1;
+	b_res[0].end = 0;
 	b_res[0].flags |= IORESOURCE_IO | IORESOURCE_SIZEALIGN;
+	add_to_list(add_head, bridge, b_res, pci_cardbus_io_size - 1, 1);
 
 	b_res[1].start = 0;
-	b_res[1].end = pci_cardbus_io_size - 1;
+	b_res[1].end = 0;
 	b_res[1].flags |= IORESOURCE_IO | IORESOURCE_SIZEALIGN;
+	add_to_list(add_head, bridge, b_res+1, pci_cardbus_io_size - 1, 1);
 
 	/*
 	 * Check whether prefetchable memory is supported
@@ -778,16 +781,19 @@ static void pci_bus_size_cardbus(struct pci_bus *bus)
 	 */
 	if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
 		b_res[2].start = 0;
-		b_res[2].end = pci_cardbus_mem_size - 1;
+		b_res[2].end = 0;
 		b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_SIZEALIGN;
+		add_to_list(add_head, bridge, b_res+2, pci_cardbus_mem_size - 1, 1);
 
 		b_res[3].start = 0;
-		b_res[3].end = pci_cardbus_mem_size - 1;
+		b_res[3].end = 0;
 		b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
+		add_to_list(add_head, bridge, b_res+3, pci_cardbus_mem_size - 1, 1);
 	} else {
 		b_res[3].start = 0;
-		b_res[3].end = pci_cardbus_mem_size * 2 - 1;
+		b_res[3].end = 0;
 		b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
+		add_to_list(add_head, bridge, b_res+3, pci_cardbus_mem_size * 2 - 1, 1);
 	}
 }
 
@@ -805,7 +811,7 @@ void __ref __pci_bus_size_bridges(struct pci_bus *bus,
 
 		switch (dev->class >> 8) {
 		case PCI_CLASS_BRIDGE_CARDBUS:
-			pci_bus_size_cardbus(b);
+			pci_bus_size_cardbus(b, add_head);
 			break;
 
 		case PCI_CLASS_BRIDGE_PCI:
-- 
1.7.0.4


  parent reply	other threads:[~2011-06-20 22:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20 22:47 [PATCH 0/4] PCI: fix cardbus and sriov regressions Ram Pai
2011-06-20 22:47 ` [PATCH 1/4] PCI: honor child buses add_size in hot plug configuration Ram Pai
2011-06-20 22:47 ` [PATCH 2/4] PCI : ability to resize assigned pci-resource Ram Pai
2011-06-20 22:47 ` [PATCH 3/4] PCI: make SRIOV resources nice-to-have Ram Pai
2011-06-20 22:47 ` Ram Pai [this message]
2011-06-21  7:57   ` [PATCH 4/4] PCI: make cardbus-bridge " Dominik Brodowski
2011-06-21 16:23     ` Ram Pai
2011-06-21 18:50       ` Jesse Barnes
2011-06-21 21:36       ` Jesse Barnes
2011-06-21 22:13         ` Dominik Brodowski
2011-06-22  0:48           ` Ram Pai
2011-06-23 20:31             ` Jesse Barnes
2011-06-23 20:42               ` Rafael J. Wysocki
2011-06-24 16:28                 ` Ram Pai
2011-06-24 23:45                   ` Rafael J. Wysocki

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=1308610037-6261-5-git-send-email-linuxram@us.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=bhutchings@solarflare.com \
    --cc=cjb@laptop.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-net-drivers@solarflare.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=svenkatr@ti.com \
    --cc=yinghai@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