From: Russell King <rmk@arm.linux.org.uk>
To: Jon Smirl <jonsmirl@yahoo.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Standard driver call to enable/disable PCI ROM
Date: Tue, 19 Aug 2003 21:52:46 +0100 [thread overview]
Message-ID: <20030819215246.H23670@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20030819204643.75442.qmail@web14913.mail.yahoo.com>; from jonsmirl@yahoo.com on Tue, Aug 19, 2003 at 01:46:43PM -0700
On Tue, Aug 19, 2003 at 01:46:43PM -0700, Jon Smirl wrote:
> --- Russell King <rmk@arm.linux.org.uk> wrote:
> > You should use pcibios_resource_to_bus() to convert a resource to a
> > representation suitable for a BAR.
>
> I've never used pcibios_resource_to_bus(), what's the right way to do this?
> This is a good reason for making this into a common PCI driver function,
> it will stop people like me from messing up PCI calls.
It's a 2.5/2.6 invention.
Here follows a cut-down version of pci_update_resource() to illustrate
its use when updating up a BAR (see drivers/pci/setup-res.c for the full
version):
static void
pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
{
struct pci_bus_region region;
pcibios_resource_to_bus(dev, ®ion, res);
new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
if (resno < 6) {
reg = PCI_BASE_ADDRESS_0 + 4 * resno;
} else if (resno == PCI_ROM_RESOURCE) {
new |= res->flags & PCI_ROM_ADDRESS_ENABLE;
reg = dev->rom_base_reg;
}
pci_write_config_dword(dev, reg, new);
}
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
next prev parent reply other threads:[~2003-08-19 20:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-19 19:45 Standard driver call to enable/disable PCI ROM Jon Smirl
2003-08-19 20:06 ` Russell King
2003-08-19 20:46 ` Jon Smirl
2003-08-19 20:52 ` Russell King [this message]
2003-08-19 21:17 ` David S. Miller
2003-08-19 21:32 ` Russell King
2003-08-19 21:54 ` Jon Smirl
2003-08-20 0:05 ` Jamie Lokier
2003-08-20 0:02 ` David S. Miller
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=20030819215246.H23670@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=jonsmirl@yahoo.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