Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Re: broken RM7000 in CVS
@ 2001-01-12 21:54 Justin Carlson
  2001-01-12 22:23 ` Jun Sun
  2001-01-15  6:31 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Justin Carlson @ 2001-01-12 21:54 UTC (permalink / raw)
  To: linux-mips

On Fri, 12 Jan 2001, you wrote:> Justin Carlson wrote:
> > Not if you want to have constant-defined offsets into the table.  Which is just
> > about the only reason to use a table for this...Either:
> > 
> 
> No, I am thinking to have constant-defined offset into the table.  Instead, I
> am thinking to do a linear search of the table and find a matching entry based
> on the PRID.
> 
> Without table, I can see two alternatives, 1) switch/case statement to fill in
> the data by statements (which is the current case) or 2) for each CPU
> (protected by #ifdef CONFIG_) we define a mips_cpu struct.
> 
> I guess I just like table better than switch/case statements.  Table seems
> cleaner to me.

You're not going to get rid of the big switch statement for older (non mips32)
processors because of the specialized checks to refine steppings, etc. 
as it is. 

I still would rather stick to the switch style of doing things in the future,
though, because it's a bit more flexible; if you've got companies that fix
errata without stepping PrID revisions or some such, then the table's going to
have some strange special cases that don't quite fit.

But this is much more workable than what I *thought* you were proposing.  And
not worth nearly as much trouble as I've been giving you over it.    

Luckily, in the end, you have to convince saner people than me.  :)

-Justin

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

* Re: broken RM7000 in CVS
  2001-01-12 21:54 broken RM7000 in CVS Justin Carlson
@ 2001-01-12 22:23 ` Jun Sun
  2001-01-15  6:31 ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Jun Sun @ 2001-01-12 22:23 UTC (permalink / raw)
  To: carlson; +Cc: linux-mips

Justin Carlson wrote:
> 
 
> I still would rather stick to the switch style of doing things in the future,
> though, because it's a bit more flexible; if you've got companies that fix
> errata without stepping PrID revisions or some such, then the table's going to
> have some strange special cases that don't quite fit.
> 

Ahh, in that case I suppose the mips_cpu_config function pointer in that entry
should not be NULL.  Instead it should modify the mips_cpu struct to fix
whatever quirks there.  Because this function is associated with a particular
CPU, this solution is probably cleaner than having all the quirk fixes
embedded inside a case block.

> 
> Luckily, in the end, you have to convince saner people than me.  :)
> 

Or I should wake up from hallucination.  :-)

Jun

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

* Re: broken RM7000 in CVS
  2001-01-12 21:54 broken RM7000 in CVS Justin Carlson
  2001-01-12 22:23 ` Jun Sun
@ 2001-01-15  6:31 ` Geert Uytterhoeven
  2001-01-15 18:45   ` Jun Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2001-01-15  6:31 UTC (permalink / raw)
  To: Justin Carlson; +Cc: linux-mips

On Fri, 12 Jan 2001, Justin Carlson wrote:
> I still would rather stick to the switch style of doing things in the future,
> though, because it's a bit more flexible; if you've got companies that fix
> errata without stepping PrID revisions or some such, then the table's going to
> have some strange special cases that don't quite fit.
> 
> But this is much more workable than what I *thought* you were proposing.  And
> not worth nearly as much trouble as I've been giving you over it.    

Then don't use a probe table, but a switch based CPU detection routine that
fills in a table of function pointers. So you need the switch only once.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven ------------- Sony Software Development Center Europe (SDCE)
Geert.Uytterhoeven@sonycom.com ------------------- Sint-Stevens-Woluwestraat 55
Voice +32-2-7248626 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

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

* Re: broken RM7000 in CVS
  2001-01-15  6:31 ` Geert Uytterhoeven
@ 2001-01-15 18:45   ` Jun Sun
  2001-01-16  6:46     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Jun Sun @ 2001-01-15 18:45 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Justin Carlson, linux-mips

Geert Uytterhoeven wrote:
> 
> On Fri, 12 Jan 2001, Justin Carlson wrote:
> > I still would rather stick to the switch style of doing things in the future,
> > though, because it's a bit more flexible; if you've got companies that fix
> > errata without stepping PrID revisions or some such, then the table's going to
> > have some strange special cases that don't quite fit.
> >
> > But this is much more workable than what I *thought* you were proposing.  And
> > not worth nearly as much trouble as I've been giving you over it.
> 
> Then don't use a probe table, but a switch based CPU detection routine that
> fills in a table of function pointers. So you need the switch only once.
> 

Geert,

Is there some concerns about using table?

mips_cpu structure is probably a mixture of data and function pointers.  To
use a switch statement, one either supplies a function which will fill out the
rest of member data in the structure, or fills in all the member data in the
case block.  Compared with the table solution, the former case is too
restricting (it mandates every CPU has its own "setup" routine") and the later
case is less clean-looking.

Performance-wise table should be basically identical to switch statements.  It
is a linear search of some integers (PrID).

Jun

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

* Re: broken RM7000 in CVS
  2001-01-15 18:45   ` Jun Sun
@ 2001-01-16  6:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2001-01-16  6:46 UTC (permalink / raw)
  To: Jun Sun; +Cc: Justin Carlson, linux-mips

On Mon, 15 Jan 2001, Jun Sun wrote:
> Geert Uytterhoeven wrote:
> > On Fri, 12 Jan 2001, Justin Carlson wrote:
> > > I still would rather stick to the switch style of doing things in the future,
> > > though, because it's a bit more flexible; if you've got companies that fix
> > > errata without stepping PrID revisions or some such, then the table's going to
> > > have some strange special cases that don't quite fit.
> > >
> > > But this is much more workable than what I *thought* you were proposing.  And
> > > not worth nearly as much trouble as I've been giving you over it.
> > 
> > Then don't use a probe table, but a switch based CPU detection routine that
> > fills in a table of function pointers. So you need the switch only once.
> 
> Is there some concerns about using table?
> 
> mips_cpu structure is probably a mixture of data and function pointers.  To
> use a switch statement, one either supplies a function which will fill out the
> rest of member data in the structure, or fills in all the member data in the
> case block.  Compared with the table solution, the former case is too
> restricting (it mandates every CPU has its own "setup" routine") and the later
> case is less clean-looking.
> 
> Performance-wise table should be basically identical to switch statements.  It
> is a linear search of some integers (PrID).

Yes. But the advantage of the switch (`code table') over a data table is that
you can easier incorporate tests for special cases.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven ------------- Sony Software Development Center Europe (SDCE)
Geert.Uytterhoeven@sonycom.com ------------------- Sint-Stevens-Woluwestraat 55
Voice +32-2-7248626 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

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

end of thread, other threads:[~2001-01-16  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-12 21:54 broken RM7000 in CVS Justin Carlson
2001-01-12 22:23 ` Jun Sun
2001-01-15  6:31 ` Geert Uytterhoeven
2001-01-15 18:45   ` Jun Sun
2001-01-16  6:46     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox