Subject: Re: how to detect at runtime which system you're running on...
To: Chris Gilbert <>
From: Ben Harris <>
List: port-arm
Date: 06/20/2001 12:08:28
On Tue, 19 Jun 2001, Chris Gilbert wrote:

> I suppose I'm just looking for consistency and that we don't end up with a
> pile of flags just to indicate which platform you're on.

Why shouldn't we have such a pile of flags?  I'd certainly prefer

if (iomd_id() == IOMD7500)


if (plat == A7000 || plat == NC || plat == MICO || plat == R7500 ||
    plat == IBX101)

As has been said before, in almost all cases you should be checking for
the actual feature you care about, and then if you can't probe for
individual features, you should set up the feature table at boot time, or
something like that.  This will make supporting new platforms easier,
because you just have to set up the feature table properly for the new
platform, rather than changing every switch in the kernel.

> > That seems like overkill for the job at hand.  The problem is that you'll
> > probably end up putting the division between two "arch"es in the wrong
> > place anyway, and end up needing to distinguish between machines in the
> > same "arch", and you'll have to invent another mechanism to tell the
> > difference between _them_.  I think a better approach is to have a
> > variable to indicate the presence of the actual feature you're interested
> > in.
> Sorry what I really meant is to be able to distinguish the exact platform for
> those rare cases we need it.  I think I confused things by saying arch.

Even so, it's very easy to get the boundaries wrong.  Should I distinguish
the A5000 from the A440?  The A540 from the A440?  The R140 from the A440?
What happens when I change my mind?

Ben Harris                                                   <>
Portmaster, NetBSD/arm26               <URL:>