Subject: Some ideas to think about for the hackathon
To: None <port-powerpc@netbsd.org>
From: Tim Rightnour <root@garbled.net>
List: port-powerpc
Date: 04/25/2007 00:46:09
These are just some rough thoughts on things I'd like to try to touch on during
the hackathon.  None of this is set in stone, just kinda brainstorming here. 
Please discuss anything you have ideas on, or stare at the code and think about
it.

1) unification of ext_intr_foo()'s. 
Lots of the ports have similar, or even identical ext_intr_xxx() routines. 
Rather than having each port roll thier own, I was thinking we could collect
them all, and put them in a single file in powerpc/oea.   Perhaps put an ifdef
around each one or something.  A quick look around shows that each one has the
following:

bebox: (has a really bizzare one, but its mostly the 8259 one)
ibmnws: uses the prep IVR method
macppc: has an MD one, and a mostly generic openpic one
mvmeppc: 8259
pmppc: looks similar to the 8259, but calls some cpc700 specific routines.
prep: uses an ivr method, and a openpic with IVR. (and an unused 8259 one)
sandpoint: generic openpic

I think with a little creative ifdef usage, we could probably make 3 generic
versions of the function.  (could also be done with small md calls rather
than ifdefs)

2) clock.c
I think most of the OEA ports could probably use prep's clock.c, or at least
use it with a few small modifications.  We could probably move it to
powerpc/oea and have everyone share it with a little work.

3) Other functions in extintr.c
Lots of other functions in that file look remarkably similar from port to port.
It seems rather likely that most of those could also be shared among some, if
not all of the ports.

4) Differences in the include files between ports.
For example, macppc's bus.h is a really big complex file with lots of bus_dma
stuff in it, while the other ports seem to be lacking that stuff.  It doesn't
look very port specific at first glance.. so why?

5) cpu.c
That file looks rather similar across most of the ports.  There are a few
md specific things in macppc, but most of those look like general OFW things,
which might be usable for ofppc, etc.

6) pmppc and sandpoint should probably be moved to evbppc.
They are both rather bizzare little boards, which aren't really common devices.
They both also appear to be primarily evaluation kits, which I think puts them
firmly under evbppc, rather than full fledged ports.

7) isa_machdep, pcib, pchb, etc.
These files occur in a few ports, and don't really seem to have a whole lot
that is very port-specific.  It seems reasonable to assume some of this stuff
can be more or less unified.

8) A few other general enhancements that could help many ports:
The openpic has an internal timer, which could probably be used to implement a
timecounter.  Additionally, it also has a watchdog which could also be utilized.

Also on the subject of the openpic, currently we hardcode all the interrupts on
the openpic to the same priority.  Rather than do this, we might consider
passing the IPL level to each one, and encoding them with an appropriate
priority.  As it is now, interrupt 7 will allways beat out interupt 8, because
it is lower.  If we encoded priorities, it might give the appropriate advantage
to certain devices over others.

9) I'd like to see all the ports converted over to using evcnt, timecounters,
generic soft interrupts, and struct cpu_info.

---
Tim Rightnour <root@garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
Genecys: Open Source 3D MMORPG: http://www.genecys.org/