Skip to contentSkip to conversation

The end of embedded Linux?

DISCUSSION [email protected] 3 participants 3 messages Oct 7, 2002 – Oct 8, 2002

lore
Share & tools
lore
#0 lore raw

Then shouldn't the thing thats different from the norm be programmed into a header file which contains how certain functions should be handled differently, which can be dynamically switched by a config option?

Cheers, Dean.

On Mon, 7 Oct 2002 20:11:11 +0100 Russell King <[email protected]> wrote:

Quoted 47 lines · george anzinger
Quoted 36 lines · Nicolas Pitre

#ifdef CONFIG_ASSABET_NEPONSET

/*
* These functions allow us to handle IO addressing as we wish - this
* ethernet controller can be connected to a variety of busses. Some
* busses do not support 16 bit or 32 bit transfers. --rmk */
static inline u8 smc_inb(u_int base, u_int reg)

{
        u_int port = base + reg * 4;

        return readb(port);
}

static inline u16 smc_inw(u_int base, u_int reg)

{
        u_int port = base + reg * 4;

        return readb(port) | readb(port + 4) << 8;
}

static inline void smc_outb(u8 val, u_int base, u_int reg)

{
        u_int port = base + reg * 4;

        writeb(val, port);
}

static inline void smc_outw(u16 val, u_int base, u_int reg)

{
        u_int port = base + reg * 4;

        writeb(val, port);
        writeb(val >> 8, port + 4);
}
Quoted 7 lines

#endif

As you can see such code duplicated multiple times for all bus arrangements in existence out there is just not pretty and was refused by Alan. We lack a global lightweight IO abstraction to nicely override the default IO macros for individual drivers at compile time to fix that problem optimally and keep the driver proper clean.

Uh, what about stuff like this (from tulip.h):

Quoted 14 lines

#ifndef USE_IO_OPS
#undef inb
#undef inw
#undef inl
#undef outb
#undef outw
#undef outl
#define inb(addr) readb((void*)(addr)) #define inw(addr) readw((void*)(addr)) #define inl(addr) readl((void*)(addr)) #define outb(val,addr) writeb((val), (void*)(addr)) #define outw(val,addr) writew((val), (void*)(addr)) #define outl(val,addr) writel((val), (void*)(addr)) #endif /* !USE_IO_OPS */

No, you don't quite get it. The above code Nico pasted supports _one_ ARM machine type only (the one I have here, hence why its in my tree) where the SMC chip is configured to be in 8-bit mode.

We also have the same device connected in 16-bit mode on other machines, with different ways to set it up:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=734/1

Now imagine the case when you have 100 different machine types, all different, using this device where each hardware designer has decided to connect the chip up differently.

Is putting this crud into drivers going to be maintainable? No.

Signature · 8 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#1 lore raw

From: <[email protected]>
Date: Mon, 7 Oct 2002 21:04:29 +0100

Then shouldn't the thing thats different from the norm be programmed into a header file which contains how certain functions should be handled differently, which can be dynamically switched by a config option?

If I gave you a dollar, would you go out and buy some newlines to use in future emails?

#2 lore raw
Quoted 7 lines · David S. Miller

From: <[email protected]>
Date: Mon, 7 Oct 2002 21:04:29 +0100

Then shouldn't the thing thats different from the norm be programmed into a header file which contains how certain functions should be handled differently, which can be dynamically switched by a config option?

If I gave you a dollar, would you go out and buy some newlines to use in future emails?

Maybe he could exchange the mime headers for newlines if he put his comments at the end where they belong.

Signature · 5 lines
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		[email protected]

		Remember Cernan and Schmitt