]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Add cramfs support for m68k
authorWolfgang Denk <wd@pollux.(none)>
Sun, 25 Sep 2005 14:59:36 +0000 (16:59 +0200)
committerWolfgang Denk <wd@pollux.(none)>
Sun, 25 Sep 2005 14:59:36 +0000 (16:59 +0200)
Patch by Zachary Landau, 21 Feb 2005

CHANGELOG
include/cramfs/cramfs_fs.h
include/linux/stat.h

index ff659f421a756b4c977d6c160af0fc8125523728..7009ce74b6bfca4024a57f3dcd5e03511a14ef88 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
 Changes for U-Boot 1.1.4:
 ======================================================================
 
+* Add cramfs support for m68k
+  Patch by Zachary Landau, 21 Feb 2005
+
 * Update ep8260: Fix flash timeouts; improve clock resolution for faster UARTs
   Patch by Jeff Angielski, 21 Feb 2005 
     
index e0c14f04af57489bcb3da6184f53b4199ab5742a..9f1b1d529c917eafc8cb6aa01e4c2eff07736351 100644 (file)
@@ -84,6 +84,7 @@ struct cramfs_super {
                                | CRAMFS_FLAG_WRONG_SIGNATURE \
                                | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define CRAMFS_16(x)   (x)
 #define CRAMFS_24(x)   (x)
 #define CRAMFS_32(x)   (x)
@@ -91,6 +92,27 @@ struct cramfs_super {
 #define CRAMFS_GET_OFFSET(x)   ((x)->offset)
 #define CRAMFS_SET_OFFSET(x,y) ((x)->offset = (y))
 #define CRAMFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __KERNEL__
+#define CRAMFS_16(x)   swab16(x)
+#define CRAMFS_24(x)   ((swab32(x)) >> 8)
+#define CRAMFS_32(x)   swab32(x)
+#else /* not __KERNEL__ */
+#define CRAMFS_16(x)   bswap_16(x)
+#define CRAMFS_24(x)   ((bswap_32(x)) >> 8)
+#define CRAMFS_32(x)   bswap_32(x)
+#endif /* not __KERNEL__ */
+#define CRAMFS_GET_NAMELEN(x)  (((u8*)(x))[8] & 0x3f)
+#define CRAMFS_GET_OFFSET(x)   ((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) |\
+                                ((((u32*)(x))[2] & 0xc0000000) >> 30))
+#define CRAMFS_SET_NAMELEN(x,y)        (((u8*)(x))[8] = (((0x3f & (y))) | \
+                                                 (0xc0 & ((u8*)(x))[8])))
+#define CRAMFS_SET_OFFSET(x,y) (((u32*)(x))[2] = (((y) & 3) << 30) | \
+                                CRAMFS_24((((y) & 0x03ffffff) >> 2)) | \
+                                (((u32)(((u8*)(x))[8] & 0x3f)) << 24))
+#else
+#error "__BYTE_ORDER must be __LITTLE_ENDIAN or __BIG_ENDIAN"
+#endif
 
 /* Uncompression interfaces to the underlying zlib */
 int cramfs_uncompress_block(void *dst, void *src, int srclen);
index 63a96f13cc2dd1c9da9e57860e15d21a15beb994..2f7a3b36acf08862dc486fd1364bf7e0cc91c3cf 100644 (file)
@@ -67,7 +67,7 @@ struct stat {
 
 #endif /* __PPC__ */
 
-#if defined (__ARM__) || defined (__I386__)
+#if defined (__ARM__) || defined (__I386__) || defined (__M68K__)
 
 struct stat {
        unsigned short st_dev;