mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/3] pci: ignore BAR when it doesn't fit into bus resource
Date: Wed,  3 Apr 2024 10:07:03 +0200	[thread overview]
Message-ID: <20240403080703.4098404-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240403080703.4098404-1-s.hauer@pengutronix.de>

It can happen that a BAR doesn't fit into the bus resource. In this case
just ignore the BAR instead of failing the device. This is what Linux
does as well.
This helps me on the Protonic MECSBC where a NVME drive offers a 1GiB
BAR which doesn't seem to be needed to make the driver work.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bc083270d9..e6370b5c7f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -406,7 +406,7 @@ static void setup_device(struct pci_dev *dev, int max_bar)
 
 			if (ALIGN(*last_addr, size) + size > busres->end) {
 				pr_debug("BAR does not fit within bus %s res\n", kind);
-				return;
+				continue;
 			}
 
 			*last_addr = ALIGN(*last_addr, size);
-- 
2.39.2




  parent reply	other threads:[~2024-04-03  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  8:07 [PATCH 1/3] of: add of_property_read_variable_uxx_array() Sascha Hauer
2024-04-03  8:07 ` [PATCH 2/3] phy: rockchip: add pcie3 phy driver Sascha Hauer
2024-04-03  8:26   ` Ahmad Fatoum
2024-04-03 12:15     ` Sascha Hauer
2024-04-03  8:07 ` Sascha Hauer [this message]
2024-04-04  6:36 ` [PATCH 1/3] of: add of_property_read_variable_uxx_array() Sascha Hauer

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=20240403080703.4098404-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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