From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: linux-kernel@vger.kernel.org
Subject: Re: CFT/RFC: New cardbus resource allocation
Date: Mon, 11 Nov 2002 20:05:39 +0300 [thread overview]
Message-ID: <20021111200539.A846@jurassic.park.msu.ru> (raw)
In-Reply-To: <20021107103712.C7579@flint.arm.linux.org.uk>; from rmk@arm.linux.org.uk on Thu, Nov 07, 2002 at 10:37:12AM +0000
On Thu, Nov 07, 2002 at 10:37:12AM +0000, Russell King wrote:
> On Thu, Nov 07, 2002 at 01:25:40PM +0300, Ivan Kokshaysky wrote:
> > Looks quite reasonable.
> > Note that we don't need 2 similar functions in setup-res.c -
> > pci_assign_resource() can be easily converted to use your
> > pci_alloc_parent_resource(), and pci_assign_bus_resource() can
> > be killed then.
>
> I looked at that and decided it wasn't practical. pci_assign_resource()
> needs the parent resource to pass it down to the architecture specific
> layers. Unfortunately, trying to get that out of
> pci_alloc_parent_resource() makes the API rather disgusting IMHO.
Sigh. The API is already broken - passing parent resource to
pcibios_update_resource() is not only pointless (since we have
res->parent), but extremely misleading.
Almost all architectures declare
void
pcibios_update_resource(struct pci_dev *dev, struct resource *root,
^^^^
struct resource *res, int resource)
Obviously root != parent.
Vast majority of archs do not use `root' arg, but some do:
mips64/mips-boards/generic/pci.c
mips64/sgi-ip27/ip27-pci.c
mips/ite-boards/generic/it8172_pci.c
mips/mips-boards/generic/pci.c
ia64/pci/pci.c
All of these use exactly the same code:
pcibios_update_resource(struct pci_dev *dev, struct resource *root,
struct resource *res, int resource)
{
unsigned long where, size;
u32 reg;
where = PCI_BASE_ADDRESS_0 + (resource * 4);
size = res->end - res->start;
pci_read_config_dword(dev, where, ®);
reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
pci_write_config_dword(dev, where, reg);
}
Which is wrong if the `root' is a pointer to the PCI or CardBus bridge
resource.
The arg 2 to pcibios_update_resource() must be removed...
Ivan.
prev parent reply other threads:[~2002-11-11 16:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-06 19:41 Russell King
2002-11-06 19:46 ` Russell King
2002-11-07 10:25 ` Ivan Kokshaysky
2002-11-07 10:37 ` Russell King
2002-11-11 17:05 ` Ivan Kokshaysky [this message]
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=20021111200539.A846@jurassic.park.msu.ru \
--to=ink@jurassic.park.msu.ru \
--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
all inboxes | Powered by JetHome®