From: Hollis Blanchard <hollis@austin.ibm.com>
To: linuxppc-dev@lists.linuxppc.org
Subject: fixing up PCI bus resources
Date: Fri, 20 Jul 2001 11:35:43 -0500 [thread overview]
Message-ID: <20010720113543.B15642@austin.ibm.com> (raw)
Summary: I have to fix up the resources on my host bridge (the firmware sets
them incorrectly). How can I do this from a struct pci_bus?
First I need to make sure the bus needs fixing, by seeing if it's IO lies
between PREP_ISA_IO_BASE and PREP_ISA_MEM_BASE.
for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
busdev = pci_dev_b(ln);
if (busdev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
break; /* XXX found the right one? */
}
if (!busdev)
return;
^^ is there a better way to find busdev? being the host bridge, bus->self is
NULL :( [The pci_read_config_byte's below were copied from
pci_read_bridge_bases()]
for (i = 0; i < 4; ++i) {
struct resource *res;
if ((res = bus->resource[i]) == NULL)
continue;
if (!res->flags)
continue;
if (res->flags & IORESOURCE_IO) {
u16 io_base_hi, io_limit_hi;
u8 io_base_lo, io_limit_lo;
unsigned long base, limit;
pci_read_config_byte(busdev, PCI_IO_BASE, &io_base_lo);
pci_read_config_byte(busdev, PCI_IO_LIMIT, &io_limit_lo);
pci_read_config_word(busdev, PCI_IO_BASE_UPPER16, &io_base_hi);
pci_read_config_word(busdev, PCI_IO_LIMIT_UPPER16, &io_limit_hi);
base = ((io_base_lo & PCI_IO_RANGE_MASK) << 8) |
(io_base_hi << 16);
limit = ((io_limit_lo & PCI_IO_RANGE_MASK) << 8) |
(io_limit_hi << 16);
...
base and limit don't seem to be correct though (perhaps they're from the
PCI-PCI bridge on the host bus, not the host bus itself).
Any tips? Thanks...
-Hollis
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
reply other threads:[~2001-07-20 16:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20010720113543.B15642@austin.ibm.com \
--to=hollis@austin.ibm.com \
--cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).