All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: multiple separate pci bridges ...
@ 2004-01-06 21:09 Marcus Barrow
  2004-01-06 22:59 ` Benjamin Herrenschmidt
  2004-01-06 23:00 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 77+ messages in thread
From: Marcus Barrow @ 2004-01-06 21:09 UTC (permalink / raw)
  To: linuxppc-dev


oops, sorry i sent wrong note previously...

        I enabled the debugging option in drivers/pci.c and rebooted.
        Here is the pertinent output. As you can see, the two pci busses
        have different bus numbers (in dev->bus->number ).

        We use a modified version of the Marvell eval. board code. It
        doesn't seem to have been changed for some time now. Perhaps you
        need to look at your "agp ops"? Is this helpfull?

PCI: Probing PCI hardware
Scanning bus 00
Found 00:60 [8086/1008] 000200 00
Fixups for bus 00
Bus scan for 00 returning with max=00
Scanning bus 01
Found 01:38 [1077/2312] 000c04 00
Found 01:39 [1077/2312] 000c04 00
Fixups for bus 01
Bus scan for 01 returning with max=01

Ben writes>
           >Argh ????? They don't appear on PCI ? What piece of SHIT is
           >this bridge ?

           >Really totally insane.


        Would you care to rethink those comments?

        It seems unfair to call a chip shit, when you don't have
        a manual for it and appear to lack any knowledge of it's
        internals. Do the math for 3 GigE ports running line speed with
        64 byte packets, and full bandwidth on 2 PCI busses...

SVEN writes>

        >Well, the Discovery II use a internal crossbar switch, and the
        >ethernet are on the same level as the pci buses. This makes for
        >very efficient networking i guess, but has problems. In fact,
        >each of these ones has the same priority as each pci bus.

        Each of the ports of the crossbar has a programmable arbiter.
        (at least on Discovery, which is what we use.)

On Thu, 2004-01-01 at 13:11, Sven Luther wrote:
>
> I am currently trying to port linux to the Pegasos 2, which uses the
> Marvell Discovery 2 chip, and has two independent pci controllers,
> of which one is faked as an agp bus. This is with a modified 2.4.23
> kernel from the linuxppc_2_4 branch.
>
> Anyway, these two independent controllers both have one bus 0 on them:
>
> PCI bus 0 controlled by pci at 80000000
> PCI bus 0 controlled by pci at c0000000
>
> (This coming from chrp_find_bridges).
>
> For the pci bus, at 80000000, a simple indirect access can be used,
> and i setup a specialized io ops for the faked agp bus since it needs
> special care.
>
> Later, in pcibios_init, there is a problem in the pci_scan_bus. The
> first bus has no problems :
>
> Scanning bus 00
> Found 00:00 [11ab/6460] 000600 00
> Found 00:08 [1106/3044] 000c00 00
> Found 00:28 [1000/0001] 000100 00
> Found 00:60 [1106/8231] 000601 00
> Found 00:61 [1106/0571] 000101 00
> Found 00:62 [1106/3038] 000c03 00
> Found 00:63 [1106/3038] 000c03 00
> Found 00:64 [1106/8235] 000000 00
> Found 00:65 [1106/3058] 000401 00
> Found 00:66 [1106/3068] 000780 00
> Found 00:68 [1106/3065] 000200 00
> Fixups for bus 00
> Bus scan for 00 returning with max=00
>
> But the second fails with :
>
> PCI: Bus 00 already known
>
> Which comes because in drivers/pci/pci.c:pci_bus_exists does handle
> only buses, and thus know nothing of separate pci bridges with the
> same bus number, and thus the kernel dies when accessing bus->xxx
> something in pcibios_init.
>
> Now, i know that the powermacs in particular, and maybe others, also
> have this case of different same numbered pci buses with different
> base addresses, and that this kind of situation has already been
> solved.
>
> So, what is the workaround here, and where does it get set.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 77+ messages in thread
* Re: multiple separate pci bridges ...
@ 2004-01-18 14:44 Sven Luther
  2004-01-18 16:33 ` Michel Dänzer
  2004-01-19  9:11 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 77+ messages in thread
From: Sven Luther @ 2004-01-18 14:44 UTC (permalink / raw)
  To: Geert Uytterhoeven, linuxppc-dev list, Benjamin Herrenschmidt,
	Sven Luther


On Mon, Jan 19, 2004 at 10:24:52AM +1100, Benjamin Herrenschmidt wrote:
>
> > Ok, i have done this. I have followed the recomendations of the hardware
> > guy, and did the following :
> >
> >   device 0, function 0 : read access to bytes 0-15, read returns 0 on
> >   regs > 15. Write access fails silently.
>
> Show the code (just in case...)


  #define PEG2_PCI_OP(rw, size, type, op, mask, btrw)
  int __chrp
  peg2_##rw##_config_##size(struct pci_dev *dev, int offset, type val)
  {
          struct pci_controller *hose = dev->sysdata;
          u32 msr;
          u32 data;
          volatile unsigned int *f118 = hose->cfg_peg2_magic;
          volatile unsigned int *f11c = (unsigned int *) f118 + 1;

          /* We won't write on device 0 and only read byte 0-15 of func 0 */
          if (dev->bus->number == 0 || dev->bus->number == 0x10) {
                  if (dev->devfn == 0) {
                          if (!(btrw & 1) && (offset > 15)) {
                                  val = (type) 0x0;
                                  return PCIBIOS_SUCCESSFUL;
                          } else if (btrw & 1) {
                                  return PCIBIOS_SUCCESSFUL;
                          }
                  } else if ((dev->devfn >> 3) == 0) {
                          return PCIBIOS_DEVICE_NOT_FOUND;
                  }
          }

	  if (btrw & 2) {
                /* Disable cpu interrupts */
                msr = mfmsr();
                mtmsr(msr & ~MSR_EE);
                /* Enable PCI -> AGP idsel mapping */
                cfg_write(0x8000, f118, u32, out_be32);
          }

          data = 0x80000000 | ((dev->bus->number - hose->bus_offset) << 16)
                    | (dev->devfn << 8) | (offset & 0xff);
          cfg_write(data, hose->cfg_addr, u32, out_le32);
          cfg_##rw(val, hose->cfg_data + (offset & mask), type, op);

          if (btrw & 2) {
                /* Enable PCI -> AGP idsel mapping */
                cfg_write(0x8000, f11c, u32, out_be32);
                /* Disable cpu interrupts */
                mtmsr(msr);
          }
          return PCIBIOS_SUCCESSFUL;
  }

btrw is 0 for reads and 1 for writes. The second bit (0 or 2) also
encodes if we are on the pci or agp bus, to enable th agp config access
magic.

> >   device 0, function 1-7 : both read and writes fail with
> >   PCIBIOS_DEVICE_NOT_FOUND.
> >
> > Additionnally, i have nullified the ressources with :
> > 	dev->resource[i].flags = 0;
> > 	dev->resource[i].start = 0;
> > 	dev->resource[i].end = 0;
> > from the pcibios_fixup (not the right place, but i don't know where it
> > should be done instead).
>
> A quirk is one of the functions in the table in pci.c but you can
> use the fixup too at this point...

Ok.

> > This allows me to see the host bridge on both buses, and radeonfb works
> > fine :
> >
> > $ lspci
> > 00:00.0 Host bridge: Galileo Technology Ltd.: Unknown device 6460 (rev 03)
> > 00:01.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 46)
> > 00:05.0 SCSI storage controller: LSI Logic / Symbios Logic 53c810 (rev 23)
> > 00:0c.0 ISA bridge: VIA Technologies, Inc. VT8231 [PCI-to-ISA Bridge] (rev 10)
> > 00:0c.1 IDE interface: VIA Technologies, Inc.  VT82C586A/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE (rev 06)
> > 00:0c.2 USB Controller: VIA Technologies, Inc. USB (rev 1e)
> > 00:0c.3 USB Controller: VIA Technologies, Inc. USB (rev 1e)
> > 00:0c.4 Non-VGA unclassified device: VIA Technologies, Inc. VT8235 ACPI (rev 10)
> > 00:0c.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 40)
> > 00:0c.6 Communication controller: VIA Technologies, Inc. Intel 537 [AC97 Modem] (rev 20)
> > 00:0d.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 51)
> > 10:00.0 Host bridge: Galileo Technology Ltd.: Unknown device 6460 (rev 03)
> > 10:08.0 VGA compatible controller: ATI Technologies Inc: Unknown device 5964 (rev 01)
> >
> > But :
> >
> > $ hexdump /proc/bus/pci/10/00.0
> > 0000000 ab11 6064 0700 b022 0300 0006 2000 0000
> > 0000010 20df 85cf 20df 85cf 20df 85cf 20df 85cf
> > *
> > 0000040
> >
> > Why in hell do i have 0x20df85cf on all four bars of the config space
> > addresses 0x10 to 0x1f ?
>
> I don't know, make sure you are "filtering" things properly... You
> should return 0xff on anything after 0x10 I suppose (though you
> may want to return 0 for the BARs, I have to dbl check).

I am returning 0 for all of function 0. I dropped the whole struct
pci_dev ressource thingy, and they are well nullified. My limited
understanding of those pci issues let me make a guess though. I think
that either the stuff in the struct pci_dev is set later on (the BARs
are modifiable i think), or those values are read from the struct
pci_dev before i nullify them.

> > Finally, X works, altough DRI freezes after a second or two with my
> > radeon 9200SE, while it works for a Radeon 7500, but this is probably a
> > DRI issue.
>
> Which version of DRI ? Do you have the interrupt routing working
> properly ?

Mmm, maybe i should also allow to read (and write ?) the config 32-bit
word at 0x3c, those include the Interrupt Line and Pin, as well as the
Max_lat and Min_Gnt.

Maybe some of the first 16 bytes would also need to be modifiable, and
there should be no harm in allowing read of the subsytem id and vendor
id ?

As for the DRI version, i use the drm module from the linuxppc-2.4 tree,
using the v2.4.24 TAG to checkout, and the rest of the XFree86 stuff,
including the mesa libraries, from the 4.3.0-0pre1v5 experimental
package, rebuild with the Radeon 9200SE patch from Michel Daenzer.

The freeze happens when i first launch glxinfo, or when i first start
moving a window around (using a debian/unstable default gnome desktop).
I don't remember well, but i think it would also freeze when let running
for a time, but i am not sure. The box is still available trough ssh,
but killing the X server doesn't restore the fbdev console, and freeze
the box.

> > What makes me wonder, is that X needs around 20 seconds to launch, which
> > could not be something normal. It usually takes 5-8 seconds only.
> > Something strange is going on.
>
> Yah, XFree log could be useful.

Ok, i uploaded it at http://people.debian.org/~luther/XFree86.0.log,
since the list was not able to cope with it. I didn't see anything anormal
there though. Altough some of the bus ressources seem to be checked even
if i nullified them.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 77+ messages in thread
* Re: multiple separate pci bridges ...
@ 2004-01-06 20:53 Marcus Barrow
  0 siblings, 0 replies; 77+ messages in thread
From: Marcus Barrow @ 2004-01-06 20:53 UTC (permalink / raw)
  To: linuxppc-dev


        Hi Sven:

        I think there is some basic brokeness in the Discovery
        specific code. I've been meaning to go and look at some
        of the original code, to see if some stuff was left on
        the floor.

        On our evalution boards the P2P registers are not set
        up. So you indeed have two PCI bus 0. The P2P register
        for PCI bus 1 should be initialized to identify it as
        bus 1, or whatever the right value is considering
        any more bridges found on bus 0.

        If you insert pci cards which contain bridges on them,
        they only work on the bus 0 slots...

        Do you have something like ppcboot or uboot starting
        your system or just a kernel? If you are using a real
        boot rom, you could try initializing the p2p registers
        by hand, then booting...

        I'm hoping to work on this in the next few days.

                                Regards, Marcus Barrow




On Mon, 2004-01-05 at 11:40, Sven Luther wrote:
>
> On Sun, Jan 04, 2004 at 11:06:08PM +0100, Sven Luther wrote:
> >
> > On Mon, Jan 05, 2004 at 08:45:24AM +1100, Benjamin Herrenschmidt
wrote:
> > >
> > >
> > > > PCI: Probing PCI hardware
> > > > Scanning bus 00
> > > > Found 00:00 [11ab/6460] 000600 00
> > > > Found 00:08 [1106/3044] 000c00 00
> > > > Found 00:28 [1000/0001] 000100 00
> > > > Found 00:60 [1106/8231] 000601 00
> > > > Found 00:61 [1106/0571] 000101 00
> > > > Found 00:62 [1106/3038] 000c03 00
> > > > Found 00:63 [1106/3038] 000c03 00
> > > > Found 00:64 [1106/8235] 000000 00
> > > > Found 00:65 [1106/3058] 000401 00
> > > > Found 00:66 [1106/3068] 000780 00
> > > > Found 00:68 [1106/3065] 000200 00
> > > > Fixups for bus 00
> > > > Bus scan for 00 returning with max=00
> > > > Scanning bus 10
> > > > Fixups for bus 10
> > > > Bus scan for 10 returning with max=10
> > > > PCI: Cannot allocate resource region 4 of device 00:00.0
> > > >
> > > > So, the 0x10 incrementation is fine, but the agp bus is not
working
> > > > correctly, and thus the agp graphic card not recognized (and
thus no
> > > > radeonfb).
> > > >
> > > > That said, i believe the 00:00.0 (should that not be 10:00.0
because of
> > > > the renumbering) is the Marvell Discovery II pci controller, and
the
> > > > actual agp card should be found just behind.
> > >
> > > What video card is this ?
> >
> > A Radeon 9200 SE 64M, from Xpert Vision. The kernel is patched for
> > Radeon 9200 SE support. (Both i have are Yd models).
>
> Ok, i got it to work finally, at least upto asking me for a root
> filesystem, which i don't yet have on this harddisk.
>
> Now, I have some technical questions about how to best do a few
things.
>
> I was recommended to set the ppc_md.pci_exclude_device so that the
> device 0 (the marvell bridge itself) is not seen by linux. I did this
by
> following the 4xx example, which should be ok.
>
> But, i have to do access some address which i need to ioremap. I
created
> a hose->cfg_peg2_magic to to put this ioremapped address in. I guess
> this is not the most clean way of doing this or something, any hint on
> how to best do it ? I need to set this in chrp_find_bridges or
something
> such, and use the address in the read/write_config functions.
>
> Also, i had to manually set hose->bus_offset = 0x10, since that didn't
> seem to be set automatically. I don't know why though.
>
> And finally, about the stuff which blocked me most, i am somewhat
> bewildered. I use this :
>
>         data = 0x80000000 | ((dev->bus->number - hose->bus_offset) <<
16)
>               | (dev->devfn << 8) | (offset & 0xff);
>
> As the address to write to, but the indirect pci stuff uses offset &
> 0xfc, which blanks bits 0 & 1 for pci config type selection. What am i
> misunderstanding or doing wrong here ?
>
> A, and a last question to Rob Baxter, did you manage to get the
builtin
> gigabyte ethernet port to work, and if yes, with which code, an
> existing driver or some home built driver. Can you eventually share
the
> code or something such ?
>
> Anyway, thanks for your help.
>
> Friendly,
>
> Sven Luther
>
>
>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 77+ messages in thread
* multiple separate pci bridges ...
@ 2004-01-01 18:11 Sven Luther
  2004-01-02  4:03 ` Benjamin Herrenschmidt
  2004-01-02 15:18 ` Rob Baxter
  0 siblings, 2 replies; 77+ messages in thread
From: Sven Luther @ 2004-01-01 18:11 UTC (permalink / raw)
  To: linuxppc-dev


Hello,

I am currently trying to port linux to the Pegasos 2, which uses the
Marvell Discovery 2 chip, and has two independent pci controllers, of
which one is faked as an agp bus. This is with a modified 2.4.23 kernel
from the linuxppc_2_4 branch.

Anyway, these two independent controllers both have one bus 0 on them :

PCI bus 0 controlled by pci at 80000000
PCI bus 0 controlled by pci at c0000000

(This coming from chrp_find_bridges).

For the pci bus, at 80000000, a simple indirect access can be used, and
i setup a specialized io ops for the faked agp bus since it needs
special care.

Later, in pcibios_init, there is a problem in the pci_scan_bus. The
first bus has no problems :

Scanning bus 00
Found 00:00 [11ab/6460] 000600 00
Found 00:08 [1106/3044] 000c00 00
Found 00:28 [1000/0001] 000100 00
Found 00:60 [1106/8231] 000601 00
Found 00:61 [1106/0571] 000101 00
Found 00:62 [1106/3038] 000c03 00
Found 00:63 [1106/3038] 000c03 00
Found 00:64 [1106/8235] 000000 00
Found 00:65 [1106/3058] 000401 00
Found 00:66 [1106/3068] 000780 00
Found 00:68 [1106/3065] 000200 00
Fixups for bus 00
Bus scan for 00 returning with max=00

But the second fails with :

PCI: Bus 00 already known

Which comes because in drivers/pci/pci.c:pci_bus_exists does handle only
buses, and thus know nothing of separate pci bridges with the same bus
number, and thus the kernel dies when accessing bus->xxx something in
pcibios_init.

Now, i know that the powermacs in particular, and maybe others, also
have this case of different same numbered pci buses with different base
addresses, and that this kind of situation has already been solved.

So, what is the workaround here, and where does it get set.

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2004-01-19 22:08 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-06 21:09 multiple separate pci bridges Marcus Barrow
2004-01-06 22:59 ` Benjamin Herrenschmidt
2004-01-06 23:00 ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
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
2004-01-06 20:53 Marcus Barrow
2004-01-01 18:11 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
2004-01-03  1:12       ` Benjamin Herrenschmidt
2004-01-05  0:52         ` Rob Baxter
2004-01-05  2:13           ` Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.