From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Jeff Chua <jeff.chua.linux@gmail.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>, Greg KH <gregkh@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Broken] PCI: clean up resource alignment management
Date: Tue, 22 Apr 2008 14:59:46 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0804221451270.2779@woody.linux-foundation.org> (raw)
In-Reply-To: <20080422214050.GA1166@jurassic.park.msu.ru>
On Wed, 23 Apr 2008, Ivan Kokshaysky wrote:
>
> Yes, exactly. My fault - I somehow missed the cardbus stuff...
Ok, this patch looks sane, but ...
Don't cardbus bus resources work the same way as _normal_ IO resources, ie
the alignment is the same as the size?
So I think we could clean this up a bit, and just use IORESOURCE_SIZEALIGN
for Cardbus bridges, which leads to much more obvious code (ie just keep
the base at zero)?
(In fact, I think cardbus bridges have a much more flexible alignment than
that size thing, and can be aligned at finer granularity, but I forget the
exact details, and since we didn't add a special "alignment" field, we
can't take advantage of it anyway).
Patch entirely UNTESTED!
Linus
---
drivers/pci/setup-bus.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index f9b7bdd..8ddb918 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -416,13 +416,13 @@ static void pci_bus_size_cardbus(struct pci_bus *bus)
* Reserve some resources for CardBus. We reserve
* a fixed amount of bus space for CardBus bridges.
*/
- b_res[0].start = pci_cardbus_io_size;
- b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1;
- b_res[0].flags |= IORESOURCE_IO;
+ b_res[0].start = 0;
+ b_res[0].end = pci_cardbus_io_size - 1;
+ b_res[0].flags |= IORESOURCE_IO | IORESOURCE_SIZEALIGN;
- b_res[1].start = pci_cardbus_io_size;
- b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1;
- b_res[1].flags |= IORESOURCE_IO;
+ b_res[1].start = 0;
+ b_res[1].end = pci_cardbus_io_size - 1;
+ b_res[1].flags |= IORESOURCE_IO | IORESOURCE_SIZEALIGN;
/*
* Check whether prefetchable memory is supported
@@ -441,17 +441,17 @@ static void pci_bus_size_cardbus(struct pci_bus *bus)
* twice the size.
*/
if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
- b_res[2].start = pci_cardbus_mem_size;
- b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1;
- b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
+ b_res[2].start = 0;
+ b_res[2].end = pci_cardbus_mem_size - 1;
+ b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_SIZEALIGN;
- b_res[3].start = pci_cardbus_mem_size;
- b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1;
- b_res[3].flags |= IORESOURCE_MEM;
+ b_res[3].start = 0;
+ b_res[3].end = pci_cardbus_mem_size - 1;
+ b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
} else {
- b_res[3].start = pci_cardbus_mem_size * 2;
- b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1;
- b_res[3].flags |= IORESOURCE_MEM;
+ b_res[3].start = 0;
+ b_res[3].end = pci_cardbus_mem_size * 2 - 1;
+ b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
}
}
next prev parent reply other threads:[~2008-04-22 22:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b6a2187b0804220943l26f7b441sb5a7309dff0e84dc@mail.gmail.com>
2008-04-22 16:44 ` [Broken] PCI: clean up resource alignment management Jeff Chua
2008-04-22 17:25 ` Linus Torvalds
2008-04-22 21:40 ` Ivan Kokshaysky
2008-04-22 21:59 ` Linus Torvalds [this message]
2008-04-22 22:13 ` Linus Torvalds
2008-04-22 22:51 ` Jesse Barnes
2008-04-23 1:06 ` Linus Torvalds
2008-04-23 1:05 ` Jeff Chua
2008-04-23 1:26 ` Linus Torvalds
2008-04-23 1:46 ` Jeff Chua
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=alpine.LFD.1.10.0804221451270.2779@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=ink@jurassic.park.msu.ru \
--cc=jbarnes@virtuousgeek.org \
--cc=jeff.chua.linux@gmail.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