[Top] [All Lists]

PROPOSAL : machine dependent support

Subject: PROPOSAL : machine dependent support
From: Jun Sun <>
Date: Fri, 10 Nov 2000 11:18:02 -0800
More and more mips boards are popping and most of them have PCI bus.  I
was looking at having a common PCI code under arch/mips/kernel which
will do the same job which each machine is handling all by itself now. 
It will invoke various machine dependent calls to accomplish the same

Following the MIPS tradition, it seems appropriate to introduce some
struct like mach_pci_ops.  But I think I have a better idea. :-)

So far we already have several variables and data structures in the
similar nature.  (See a complete listing below).  Why don't we lump them
all together into one centralized structure?

OK, I have to be honest - I steal this idea from PPC.  PPC folks have
gone through some what similar phase when they tried to support ever
increasing number of boards in the past two years.  The machine
dependent structure is part of their solution.

I see several benefits :

1. I expect more machine/board abstraction down the road.  Other PCI,
things may include pwoer management, generic I/O interface, accessing
non-volatile storage for system, interrupt management, etc.  This
structure gives a systematic to include those support, rather than each
time investing some ad hoc stuff.

2. Easier to port Linux to a new board.  One central place with most of
the required functions and variables.  (It almost becomes a porting
layer - I said "almost". :-0)  With good and extensive document, I see
the header file is the starting point for anybody who wants to start
porting linux to a new board.

3. It makes the mips-common code easier to write - so my common PCI code
can be added more easily. 

Ok, enough bluffing.  

Specifically, I think I will start with a modest structure (read as
"least amount of work" :-0)

struct mips_mach_depend {
        /* _machine_xxx stuff */
        void    (*restart)(char *cmd);
        void    (*power_off)(void);
        void    (*halt)(void);

        /* board_time_init */
        void    (*time_init)(struct irqaction *irq);

        void    (*irq_setup)(void);

        /* mips_io_port_base */
        unsigned long   io_port_base;

extern mips_mach_depend mips_md;

I suppose rtc_ops and kbd_ops should be included there as well. 

I will add PCI stuff to it later.

Note that some functions can be NULL, and the mips-generic code will
supply default behavior.  For example, if power_off is not supplied, it
will probably just do a printk, cli() and loop forever.

What do you think?  I will volunteer to do the first phase change for
ALL existing boards so that nothing breaks.


P.S., I forgot to mention that one HUGE assumption behind this is that I
believe we are going to see 20 to 100 MIPS boards (including SOC,
"pseudo-MIPS', etc) in the coming a couple of years which want to use
Linux.  Certainly anything in this direction will help the proliferation
of Linux MIPS - unless someone think this would make Linux too easy to
port and they would lose the job. :-)  But we always have the option to
introduce bugs....

<Prev in Thread] Current Thread [Next in Thread>
  • PROPOSAL : machine dependent support, Jun Sun <=