From: Rob Baxter <robb@synergymicro.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rob Baxter <robb@synergymicro.com>,
Sven Luther <sven.luther@wanadoo.fr>,
linuxppc-dev list <linuxppc-dev@lists.linuxppc.org>
Subject: Re: multiple separate pci bridges ...
Date: Fri, 2 Jan 2004 17:27:33 -0700 [thread overview]
Message-ID: <20040103002733.GA2112@synergy> (raw)
In-Reply-To: <1073087816.10542.16.camel@gaston>
On Sat, Jan 03, 2004 at 10:56:57AM +1100, Benjamin Herrenschmidt wrote:
> On Sat, 2004-01-03 at 02:18, Rob Baxter wrote:
> > Sven,
> >
> > Synergy Microsystems has designs with the Discovery 2 as well. We worked
> > around this by setting pci_assign_all_busses to true and with modifications
> > to the platform specific config cycle routines (only included one as an
> > example):
> >
> > int
> > gemini_pcibios_bus_fixup(struct pci_dev *dev, struct pci_controller *hose)
> > {
> > return ((dev->bus->number == hose->first_busno) ? 0 : dev->bus->number);
> > }
> >
> > int
> > gemini_pcibios_read_config_byte(struct pci_dev *dev, int offset, u8 *val)
> > {
> > unsigned long reg;
> > unsigned int addr;
> > int bus;
> > struct pci_controller *hose;
> >
> > hose = dev->sysdata;
> > bus = gemini_pcibios_bus_fixup(dev, hose);
> > addr = pci_config_type1_addr(bus, dev->devfn, offset & ~(0x3));
> >
> > reg = config_read(addr, hose->cfg_addr, hose->cfg_data);
> > *val = ((reg >> ((offset & 0x3) << 3)) & 0xff);
> > return PCIBIOS_SUCCESSFUL;
> > }
>
> Hrm... Why this bus fixup thing ? Why not just clearly writing
> something like
>
> if (dev->bus->number == hose->first_busno)
> discovery2_config_type0_addr(....);
> else
> discovery2_config_type1_addr(....);
>
> And those could be inline...
I like this, thank you, a much cleaner approach.
>
> Also, the way you define functions with a name that "looks" like a
> generic function (pci_config_type1_addr) is rather ugly...
It's a local macro, I agree, it's ugly, it was there before my time:
#define pci_config_type1_addr(bus,dev,offset) \
(0x80000000 | ((bus)<<16) | ((dev)<<8) | (offset))
#define pci_config_type0_addr(dev,offset) \
((1 << PCI_SLOT(dev)) | (PCI_FUNC(dev) << 8) | offset)
>
>
> > It is also necessary to set the first and last bus number fields of the
> > hose structure correctly in your platform specific code. These will get
> > over written later by the PCI driver code, and in our case, to the same
> > values. Our platform specific code does a preliminary scan of the PCI
> > buses to find the first and last bus numbers.
>
> Why would you need to set them correctly ? The PCI code will set them
> to sensible values before doing the bus scan and will fixup the last
> busno afterward for each controller, you do not need any pre-scan or
> whatever and you can leave those values to 0 at init time.
This was necessary because the PCI driver (scan/enumeration code) was using
these same config calls that was being fixed up. (A chicken and egg issue?)
>
> > This will also work when a PtP bridge is located on either of the primary
> > PCI buses of the Discovery. We're using a derivative of a 2.4.19 kernel.
>
> Yup, that should work fine.
>
> Ben.
--
-Rob
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2004-01-03 0:27 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-01 18:11 multiple separate pci bridges Sven Luther
2004-01-02 4:03 ` Benjamin Herrenschmidt
2004-01-02 7:40 ` Sven Luther
2004-01-02 7:49 ` Benjamin Herrenschmidt
2004-01-04 21:03 ` Sven Luther
2004-01-04 21:45 ` Benjamin Herrenschmidt
2004-01-04 22:06 ` Sven Luther
2004-01-05 16:40 ` Sven Luther
2004-01-05 21:28 ` Benjamin Herrenschmidt
2004-01-05 21:42 ` Sven Luther
2004-01-05 22:12 ` Benjamin Herrenschmidt
2004-01-06 7:39 ` Sven Luther
2004-01-06 8:00 ` Benjamin Herrenschmidt
2004-01-06 8:11 ` Sven Luther
2004-01-06 14:40 ` Geert Uytterhoeven
2004-01-06 14:45 ` Sven Luther
2004-01-06 15:33 ` Rob Baxter
2004-01-06 17:44 ` Sven Luther
2004-01-06 21:37 ` Benjamin Herrenschmidt
2004-01-06 22:10 ` Marcus Barrow
2004-01-06 22:17 ` Rob Baxter
2004-01-06 22:31 ` Benjamin Herrenschmidt
2004-01-07 2:35 ` Sven Luther
2004-01-07 2:36 ` Benjamin Herrenschmidt
2004-01-07 2:40 ` Sven Luther
2004-01-07 9:02 ` Michael Schmitz
2004-01-07 9:23 ` Benjamin Herrenschmidt
2004-01-07 9:56 ` Sven Luther
2004-01-07 10:27 ` Michael Schmitz
2004-01-13 9:56 ` Sven Luther
2004-01-13 10:26 ` Sven Luther
2004-01-18 12:15 ` Sven Luther
2004-01-18 13:00 ` Michel Dänzer
2004-01-18 13:14 ` Sven Luther
2004-01-19 9:12 ` Benjamin Herrenschmidt
2004-01-18 22:27 ` Sven Luther
2004-01-18 22:59 ` Benjamin Herrenschmidt
2004-01-19 9:21 ` Sven Luther
2004-01-18 23:24 ` Benjamin Herrenschmidt
2004-01-05 21:38 ` Marcus Barrow
2004-01-06 7:14 ` Sven Luther
2004-01-06 7:56 ` Benjamin Herrenschmidt
2004-01-06 8:20 ` Sven Luther
2004-01-02 18:34 ` Geert Uytterhoeven
2004-01-02 15:18 ` Rob Baxter
2004-01-02 23:56 ` Benjamin Herrenschmidt
2004-01-03 0:27 ` Rob Baxter [this message]
2004-01-03 1:12 ` Benjamin Herrenschmidt
2004-01-05 0:52 ` Rob Baxter
2004-01-05 2:13 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2004-01-06 20:53 Marcus Barrow
2004-01-06 21:09 Marcus Barrow
2004-01-06 22:59 ` Benjamin Herrenschmidt
2004-01-06 23:00 ` Benjamin Herrenschmidt
2004-01-18 14:44 Sven Luther
2004-01-18 16:33 ` Michel Dänzer
2004-01-18 17:28 ` Sven Luther
2004-01-18 18:24 ` Michel Dänzer
2004-01-18 22:20 ` Sven Luther
2004-01-18 23:33 ` Michel Dänzer
2004-01-19 9:55 ` Sven Luther
2004-01-19 13:48 ` Sven Luther
2004-01-19 13:54 ` Geert Uytterhoeven
2004-01-19 14:00 ` Sven Luther
2004-01-19 14:02 ` Michel Dänzer
2004-01-19 14:16 ` Sven Luther
2004-01-19 14:31 ` Michel Dänzer
2004-01-19 9:11 ` Benjamin Herrenschmidt
2004-01-18 22:33 ` Sven Luther
2004-01-18 23:23 ` Michel Dänzer
2004-01-18 23:42 ` Benjamin Herrenschmidt
2004-01-19 0:03 ` Michel Dänzer
2004-01-19 10:08 ` Geert Uytterhoeven
2004-01-19 11:41 ` Benjamin Herrenschmidt
2004-01-19 12:03 ` Sven Luther
2004-01-19 21:35 ` Benjamin Herrenschmidt
2004-01-19 22:08 ` Sven Luther
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=20040103002733.GA2112@synergy \
--to=robb@synergymicro.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=sven.luther@wanadoo.fr \
/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).