Subject: Re: Changing ibm4xx device tree.
To: Shigeyuki Fukushima <shige@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: port-powerpc
Date: 05/05/2006 09:38:35
Shigeyuki Fukushima wrote:

> I have a plan for changing ibm4xx device tree.
> 
> Because we want to cancel ibm405gp-dependencies from
> powerpc/ibm4xx sources.
> 
> Now there are many ibm4xx family cpu, such as
> 403xx/405EP/405GP/405GPr/405CR/440GP/440GR/440EP/440SP,
> and so on. But they don't always have same devices.
> For example, 405CR has no PCI bus on PLB, but other 405xx
> have PCI bus on PLB. Devices on OPB, too.
> 
> 
> device tree [before changes]:
>   plb(root)
>    |
>    +-- cpu
>    +-- ecc
>    +-- opb  (almost 405GP-specific code)
>    +-- pchb (405GP-specific)
> 
> device tree [after changes]:
>   mainbus(root)  evbppc/evbppc/mainbus.c
>    +-- cpu       cpu-depend-setup
>         +-- plb  config_attach with cpu_attach_args
>              |     (device infomation each 4xx have)
>              +-- ecc
>              +-- opb
>              +-- pchb

Most ports have a "mainbus" which is a pseudo bus for the root of the
device tree.  For a handful of ports, this bus has a "real name".
On the 4xx PowerPC parts, this is called the PLB.  It's the wrong
abstraction to hang devices directly off the CPU core itself.

I can perhaps see an argument for attaching the plb to a mainbus if
there are SMP 4xx machines available in the future, but I think it's
more likely that we'll get multi-core 4xx before that.  If you have a
multi-core cpu, and the devices attaching to the cpu, which cpu would
you have the devices attach cpu0 or cpu1?  It can't attach to both.

There's also nothing really 405GP specific in opb.c.  There's a table in
there that currently has only 405GP and 405GPr entries, but that's where
entries for devices on other CPUs will also go.  If another CPU doesn't
have a PCI host controller, then it doesn't get a "pchb" entry in the
OPB device table and it doesn't show up.

In short, I can't see that there's anything wrong with the current
structure.  There's still a little bit of cleanup to be done, but
nothing fundamentally wrong.

Cheers,
Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/