[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-atm
Subject:    Re: little indian/big indian problem on Fore PCA 200e
From:       Christophe Lizzi <lizzi () cnam ! fr>
Date:       2000-04-30 17:56:34
[Download RAW message or body]

Hi,

Jean MArc LACROIX wrote:
> 
> I am using kernel  2.3.99-pre5 with atm-0.76 with FORE Pci card 200e
> on a I386 platform.
 
> it seems that the there is a potential problem in little indian /big
> indian representation
> for the driver. (0x02000000, expected 0x00000002)
> ( this is also a comment of Christophe Lizzi in a the precedent release,
> for weach i have the
> same problem).
> After some (...) investigations, i have inverted the test of code
> generation in the makefile, because
> in the linux distrib, there is two releases, one for Power PC, the other
> for Pentium plateform.

> Please Christophe or Verner , can you confirm or not if the patch is ok.


Hmm... The initial test is supposed to be correct: 'pca200e.bin' is the
right firmware image for little-endian archs while 'pca200e_ecd.bin2'
is destined to big-endian ones.

I don't know exactly why you encounter problems there, but I propose the
following fix (against linux-atm 0.76) to default the test in question
to the little-endian PCA firmware:

diff -u Makefile.ORIG Makefile
--- Makefile.ORIG       Fri Apr 28 23:12:01 2000
+++ Makefile  Sun Apr 30 19:34:02 2000
@@ -103,7 +103,7 @@
   endif
   ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y)
 #   guess the target endianess to choose the right PCA-200E firmware image
-    CONFIG_ATM_FORE200E_PCA_FW := $(shell if test -n "`$(CC) -E -dM \
../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo pca200e.bin; \
else echo pca200e_ecd.bin2; fi) +    CONFIG_ATM_FORE200E_PCA_FW := $(shell if test -n \
"`$(CC) -E -dM ../../include/asm/byteorder.h | grep -w '__BIG_ENDIAN'`"; then echo \
pca200e_ecd.bin2; else echo pca200e.bin; fi)  endif
 endif
 ifeq ($(CONFIG_ATM_FORE200E_SBA),y)


Alternatively, the test might be rewritten as:

diff -u Makefile.ORIG Makefile
--- Makefile.ORIG       Fri Apr 28 23:12:01 2000
+++ Makefile        Sun Apr 30 19:21:51 2000
@@ -103,7 +103,16 @@
   endif
   ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y)
 #   guess the target endianess to choose the right PCA-200E firmware image
-    CONFIG_ATM_FORE200E_PCA_FW := $(shell if test -n "`$(CC) -E -dM \
../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo pca200e.bin; \
else echo pca200e_ecd.bin2; fi) +    CONFIG_ATM_FORE200E_PCA_FW := $(shell (          \
\ +      echo '\#include <asm/byteorder.h>' ;               \
+      echo '\#if defined(__LITTLE_ENDIAN)' ;             \
+      echo '\#define FORE200E_PCA_FW pca200e.bin' ;      \
+      echo '\#elif defined(__BIG_ENDIAN)' ;              \
+      echo '\#define FORE200E_PCA_FW pca200e_ecd.bin2' ; \
+      echo '\#else' ;                                    \
+      echo '\#error unknown endianess' ;                 \
+      echo '\#endif' ;                                   \
+    ) | $(CC) -E -dM -f - | grep 'FORE200E_PCA_FW' | awk '{print $$3}')
   endif
 endif
 ifeq ($(CONFIG_ATM_FORE200E_SBA),y)


Both versions are kludgy, though. If someone knows a better way to guess
the endianess of the target arch without compiling/executing anything
(because of cross-compiling), and without relying on lists of well-known
little and big endian archs, then please fell free to submit it...

--Christophe


PS: I currently read the list (at most) once a week. Please do not expect
real-time inputs. Thanks.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic