summaryrefslogtreecommitdiff
path: root/packages/ixp4xx/ixp-osal-2.0/le.patch
blob: c941bbc31803945fdaa5f027b889ce307004d803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
diff -bBdurN hannes/ixp_osal/include/IxOsalAssert.h merged/ixp_osal/include/IxOsalAssert.h
--- ixp_osal/include/IxOsalAssert.h	2005-04-17 20:56:26.000000000 -0700
+++ ixp_osal/include/IxOsalAssert.h	2005-10-07 15:08:43.119207986 -0700
@@ -70,6 +70,9 @@
  *        This will be conditionally compiled out and
  *        may be used for test purposes.
  */
+#ifndef __ARMEB__
+#define IX_OSAL_ENSURE_ON
+#endif /* ! __ARMEB__ */
 #ifdef IX_OSAL_ENSURE_ON
 #define IX_OSAL_ENSURE(c, str) do { \
 if (!(c)) ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, str, \
@@ -79,5 +82,14 @@
 #define IX_OSAL_ENSURE(c, str)
 #endif
 
+#ifndef __ARMEB__
+#ifdef DEBUG_ACDC
+#define TRACE() printk("ixp400: %s(): line %d\n", __FUNCTION__, __LINE__)
+#define PRINTK(args...) printk(args...)
+#else
+#define TRACE() while (0) {}
+#define PRINTK(args...) while (0) {}
+#endif
+#endif /* ! __ARMEB__ */
 
 #endif /* IX_OSAL_ASSERT_H */
diff -bBdurN hannes/ixp_osal/include/modules/ioMem/IxOsalMemAccess.h merged/ixp_osal/include/modules/ioMem/IxOsalMemAccess.h
--- ixp_osal/include/modules/ioMem/IxOsalMemAccess.h	2005-04-17 20:56:25.000000000 -0700
+++ ixp_osal/include/modules/ioMem/IxOsalMemAccess.h	2005-10-07 15:08:43.115207734 -0700
@@ -84,7 +84,12 @@
 
 #elif defined (IX_OSAL_LINUX_LE)
 
+#ifndef __ARMEB__
+//#define IX_SDRAM_LE_DATA_COHERENT
+#define IX_SDRAM_LE_ADDRESS_COHERENT
+#else /* __ARMEB__ */
 #define IX_SDRAM_LE_DATA_COHERENT
+#endif /* __ARMEB__ */
 
 #elif defined (IX_OSAL_WINCE_LE)
 
@@ -232,7 +237,11 @@
   Redefine per OS if dynamic memory maps are used
   and I/O memory is accessed via functions instead of raw pointer access. */
 
+#ifndef __ARMEB__
+#define IX_OSAL_READ_LONG_COOKIE(wCookie)           (BARF; readl((UINT32) (wCookie) ))
+#else /* __ARMEB__ */
 #define IX_OSAL_READ_LONG_COOKIE(wCookie)           (readl((UINT32) (wCookie) ))
+#endif /* __ARMEB__ */
 #define IX_OSAL_READ_SHORT_COOKIE(sCookie)          (readw((UINT32) (sCookie) ))
 #define IX_OSAL_READ_BYTE_COOKIE(bCookie)           (readb((UINT32) (bCookie) ))
 #define IX_OSAL_WRITE_LONG_COOKIE(wCookie, wData)   (writel(wData, (UINT32) (wCookie) ))
@@ -343,7 +352,11 @@
 #include <asm/io.h>
 #endif /* ndef __wince */
 
+#ifndef __ARMEB__
+#define IX_OSAL_READ_LONG_IO(wAddr)            IX_OSAL_READ_LONG_COOKIE(wAddr); BARF;
+#else /* __ARMEB__ */
 #define IX_OSAL_READ_LONG_IO(wAddr)            IX_OSAL_READ_LONG_COOKIE(wAddr)
+#endif /* __ARMEB__ */
 #define IX_OSAL_READ_SHORT_IO(sAddr)           IX_OSAL_READ_SHORT_COOKIE(sAddr)
 #define IX_OSAL_READ_BYTE_IO(bAddr)            IX_OSAL_READ_BYTE_COOKIE(bAddr)
 #define IX_OSAL_WRITE_LONG_IO(wAddr, wData)    IX_OSAL_WRITE_LONG_COOKIE(wAddr, wData)
diff -bBdurN hannes/ixp_osal/os/linux/include/core/IxOsalOs.h merged/ixp_osal/os/linux/include/core/IxOsalOs.h
--- ixp_osal/os/linux/include/core/IxOsalOs.h	2005-10-07 09:29:02.388729473 -0700
+++ ixp_osal/os/linux/include/core/IxOsalOs.h	2005-10-07 15:08:43.127208490 -0700
@@ -53,10 +53,16 @@
 #error "Uncached memory not supported in linux environment"
 #endif
 
+#ifndef __ARMEB__
+#include <linux/config.h>
+#include <linux/version.h>
+#endif /* ! __ARMEB__ */
 #include <linux/cache.h>
 #include <linux/mm.h>
+#ifdef __ARMEB__
 #include <linux/config.h>
 #include <linux/version.h>
+#endif /* __ARMEB__ */
 #include <asm/pgalloc.h>
 
 /**
@@ -67,21 +73,41 @@
 
 #define IX_OSAL_OS_MMU_PHYS_TO_VIRT(addr)  ((addr) ? phys_to_virt((unsigned int)(addr)) : 0)
 
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+#ifndef __ARMEB__
+extern void ix_dcache_invalidate_range(unsigned long start, unsigned long size)
+;
+extern void ix_dcache_flush_range(unsigned long start, unsigned long size);
+
+#else /* __ARMEB__ */
 /*
  * 2.6 kernels do not export the required cache functions.
  */
 extern void ixOsalCacheInvalidateRange(unsigned long start, unsigned long size);
 extern void ixOsalCacheFlushRange(unsigned long start, unsigned long size);
+#endif /* __ARMEB__ */
 
+#ifndef __ARMEB__
+#define IX_OSAL_OS_CACHE_INVALIDATE(addr, size)  ( ix_dcache_invalidate_range((__u32)addr, (__u32)addr + size )) 
+#else /* __ARMEB__ */
 #define IX_OSAL_OS_CACHE_INVALIDATE(addr, size) \
 ixOsalCacheInvalidateRange((unsigned long)addr, (unsigned long)addr + size)
 #define IX_OSAL_OS_CACHE_FLUSH(addr, size) \
 ixOsalCacheFlushRange((unsigned long)addr, (unsigned long)addr + size )
+#endif /* __ARMEB__ */
 
+#ifndef __ARMEB__
+#define IX_OSAL_OS_CACHE_FLUSH(addr, size) ( ix_dcache_flush_range((__u32)addr, (__u32)addr + size ))
+#endif /* ! __ARMEB__ */
 #else
+#ifndef __ARMEB__
+#define IX_OSAL_OS_CACHE_INVALIDATE(addr, size)  ( invalidate_dcache_range((__u32)addr, (__u32)addr + size )) 
+#endif /* ! __ARMEB__ */
 
+#ifdef __ARMEB__
 #define IX_OSAL_OS_CACHE_INVALIDATE(addr, size)  ( invalidate_dcache_range((__u32)addr, (__u32)addr + size )) 
+#endif /* __ARMEB__ */
 #define IX_OSAL_OS_CACHE_FLUSH(addr, size) ( clean_dcache_range((__u32)addr, (__u32)addr + size ))
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) */
 
diff -bBdurN hannes/ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400.h merged/ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400.h
--- ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400.h	2005-10-07 09:29:02.392729725 -0700
+++ ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400.h	2005-10-07 15:08:43.147209748 -0700
@@ -110,6 +149,9 @@
 #define IX_OSAL_IXP400_NPEB_VIRT_BASE          IXP425_NPEB_BASE_VIRT
 #define IX_OSAL_IXP400_NPEC_VIRT_BASE          IXP425_NPEC_BASE_VIRT
 #define IX_OSAL_IXP400_PERIPHERAL_VIRT_BASE    IXP425_PERIPHERAL_BASE_VIRT
+#ifndef __ARMEB__
+#define IX_OSAL_IXP400_QMGR_VIRT_BASE          IXP425_QMGR_BASE_VIRT
+#endif /* ! __ARMEB__ */
 #define IX_OSAL_IXP400_OSTS_VIRT_BASE          IXP425_TIMER_BASE_VIRT
 #define IX_OSAL_IXP400_USB_VIRT_BASE           IXP425_USB_BASE_VIRT
 #define IX_OSAL_IXP400_EXP_CFG_VIRT_BASE       IXP425_EXP_CFG_BASE_VIRT
diff -bBdurN hannes/ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400CustomizedMapping.h merged/ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400CustomizedMapping.h
--- ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400CustomizedMapping.h	2005-04-17 20:56:27.000000000 -0700
+++ ixp_osal/os/linux/include/platforms/ixp400/IxOsalOsIxp400CustomizedMapping.h	2005-10-07 15:08:43.147209748 -0700
@@ -171,7 +171,12 @@
  ***************************/
 #if (IX_COMPONENT_NAME == ix_qmgr)
 
+#ifndef __ARMEB__
+//#define IX_OSAL_LE_DC_MAPPING
+#define IX_OSAL_LE_AC_MAPPING
+#else /* __ARMEB__ */
 #define IX_OSAL_LE_DC_MAPPING
+#endif /* __ARMEB__ */
 
 #endif /* qmgr */
 
diff -bBdurN hannes/ixp_osal/os/linux/include/platforms/ixp400/ixp425/IxOsalOsIxp425Sys.h merged/ixp_osal/os/linux/include/platforms/ixp400/ixp425/IxOsalOsIxp425Sys.h
--- ixp_osal/os/linux/include/platforms/ixp400/ixp425/IxOsalOsIxp425Sys.h	2005-10-07 09:29:02.392729725 -0700
+++ ixp_osal/os/linux/include/platforms/ixp400/ixp425/IxOsalOsIxp425Sys.h	2005-10-07 15:08:43.143209496 -0700
@@ -85,6 +85,17 @@
      * Queue Manager 
      */
     {
+#ifndef __ARMEB__
+     IX_OSAL_DYNAMIC_MAP,                  /* type            */
+     IX_OSAL_IXP400_QMGR_PHYS_BASE,	/* physicalAddress */
+     IX_OSAL_IXP400_QMGR_MAP_SIZE,	/* size            */
+     0,
+     ixOsalLinuxMemMap,		/* mapFunction     */
+     ixOsalLinuxMemUnmap,	/* unmapFunction   */
+     0,
+     IX_OSAL_BE | IX_OSAL_LE_AC,	/* endianType      */   
+     "qMgr"			/* name            */
+#else /* __ARMEB__ */
 #ifdef IXP425_QMGR_BASE_VIRT
      IX_OSAL_STATIC_MAP,	/* type            */
      IX_OSAL_IXP400_QMGR_PHYS_BASE,	/* physicalAddress */
@@ -103,6 +114,7 @@
      0,				/* refCount        */
      IX_OSAL_BE | IX_OSAL_LE_DC,	/* endianType      */   
      "qMgr"			/* name            */
+#endif /* __ARMEB__ */
      },
 
     /*
diff -bBdurN hannes/ixp_osal/os/linux/src/core/IxOsalOsCacheMMU.c merged/ixp_osal/os/linux/src/core/IxOsalOsCacheMMU.c
--- ixp_osal/os/linux/src/core/IxOsalOsCacheMMU.c	2005-10-07 09:29:02.388729473 -0700
+++ ixp_osal/os/linux/src/core/IxOsalOsCacheMMU.c	2005-10-07 15:08:43.159210503 -0700
@@ -210,6 +210,7 @@
 	free_pages ((unsigned int) memptr, order);
     }
 }
+#ifdef __ARMEB__
 
 
 /*
@@ -266,3 +267,4 @@
 #undef IX_CLM
 
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) */
+#endif /* __ARMEB__ */
diff -bBdurN hannes/ixp_osal/os/linux/src/core/IxOsalOsMsgQ.c merged/ixp_osal/os/linux/src/core/IxOsalOsMsgQ.c
--- ixp_osal/os/linux/src/core/IxOsalOsMsgQ.c	2005-10-07 09:29:02.388729473 -0700
+++ ixp_osal/os/linux/src/core/IxOsalOsMsgQ.c	2005-10-07 15:08:43.159210503 -0700
@@ -48,6 +48,9 @@
 #include <linux/spinlock.h>
 #include <linux/ipc.h>
 #include <linux/msg.h>
+#ifndef __ARMEB__
+#include <linux/spinlock.h>
+#endif /* ! __ARMEB__ */
 #include <linux/interrupt.h>
 
 #include "IxOsal.h"
diff -bBdurN hannes/ixp_osal/os/linux/src/core/IxOsalOsSemaphore.c merged/ixp_osal/os/linux/src/core/IxOsalOsSemaphore.c
--- ixp_osal/os/linux/src/core/IxOsalOsSemaphore.c	2005-10-07 09:29:02.388729473 -0700
+++ ixp_osal/os/linux/src/core/IxOsalOsSemaphore.c	2005-10-07 15:08:43.163210755 -0700
@@ -46,6 +46,9 @@
  */
 
 #include <linux/slab.h>
+#ifndef __ARMEB__
+//#include <asm-arm/hardirq.h>
+#endif /* ! __ARMEB__ */
 #include <linux/hardirq.h>
 #include "IxOsal.h"
 
@@ -93,7 +96,11 @@
 {
 
     IX_STATUS ixStatus = IX_SUCCESS;
+#ifndef __ARMEB__
+    UINT32 timeoutTime;
+#else /* __ARMEB__ */
     unsigned long timeoutTime;
+#endif /* __ARMEB__ */
 
     if (sid == NULL)
     {
diff -bBdurN hannes/ixp_osal/os/linux/src/core/IxOsalOsServices.c merged/ixp_osal/os/linux/src/core/IxOsalOsServices.c
--- ixp_osal/os/linux/src/core/IxOsalOsServices.c	2005-10-07 09:29:02.392729725 -0700
+++ ixp_osal/os/linux/src/core/IxOsalOsServices.c	2005-10-07 15:08:43.163210755 -0700
@@ -90,8 +89,12 @@
 /*
  * General interrupt handler
  */
+#ifndef __ARMEB__
+static irqreturn_t ixOsalOsIsrProxy (int irq, void *dev_id, struct pt_regs *regs)
+#else /* __ARMEB__ */
 static irqreturn_t
 ixOsalOsIsrProxy (int irq, void *dev_id, struct pt_regs *regs)
+#endif /* __ARMEB__ */
 {
     IxOsalInfoType *isr_proxy_info = (IxOsalInfoType *) dev_id;
 
@@ -197,12 +200,20 @@
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
     unsigned long flags;
     local_irq_save(flags);
+#ifndef __ARMEB__
+    return (int)flags;
+#endif /* __ARMEB__ */
 #else
     UINT32 flags;
     save_flags (flags);
     cli ();
+#ifndef __ARMEB__
+    return flags;
+#endif /* ! __ARMEB__ */
 #endif
+#ifdef __ARMEB__
     return (UINT32)flags;
+#endif /* __ARMEB__ */
 }
 
 /* Enable interrupts and task scheduling,
@@ -212,11 +223,15 @@
 PUBLIC void
 ixOsalIrqUnlock (UINT32 lockKey)
 {
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+#ifndef __ARMEB__
+  local_irq_restore(lockKey);
+#else /* __ARMEB__ */
     local_irq_restore((unsigned long)lockKey);
-# else
+#endif /* __ARMEB__ */
+#else
     restore_flags (lockKey);
-# endif
+#endif
 }
 
 PUBLIC UINT32
@@ -341,7 +356,11 @@
 PUBLIC void
 ixOsalSleep (UINT32 milliseconds)
 {
+#ifndef __ARMEB__
+    if (milliseconds != 0)
+#else /* __ARMEB__ */
     if (milliseconds*HZ >= 1000)
+#endif /* __ARMEB__ */
     {
         set_current_state(TASK_INTERRUPTIBLE); 
         schedule_timeout ((milliseconds * HZ) / 1000);
diff -bBdurN hannes/ixp_osal/os/linux/src/core/IxOsalOsSymbols.c merged/ixp_osal/os/linux/src/core/IxOsalOsSymbols.c
--- ixp_osal/os/linux/src/core/IxOsalOsSymbols.c	2005-10-07 09:29:02.388729473 -0700
+++ ixp_osal/os/linux/src/core/IxOsalOsSymbols.c	2005-10-07 15:08:43.167211007 -0700
@@ -64,10 +64,12 @@
 
 EXPORT_SYMBOL (ixOsalCacheDmaMalloc);
 EXPORT_SYMBOL (ixOsalCacheDmaFree);
+#ifdef __ARMEB__
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
 EXPORT_SYMBOL (ixOsalCacheInvalidateRange);
 EXPORT_SYMBOL (ixOsalCacheFlushRange);
 #endif
+#endif /* __ARMEB__ */
 
 EXPORT_SYMBOL (ixOsalThreadCreate);
 EXPORT_SYMBOL (ixOsalThreadStart);
diff -bBdurN hannes/ixp_osal/include/modules/ioMem/IxOsalIoMem.h merged/ixp_osal/include/modules/ioMem/IxOsalIoMem.h
--- ixp_osal/include/modules/ioMem/IxOsalIoMem.h	2005-04-17 20:56:25.000000000 -0700
+++ ixp_osal/include/modules/ioMem/IxOsalIoMem.h	2005-10-07 16:20:27.786083595 -0700
@@ -105,8 +105,8 @@
 #endif /* ndef __wince */
 
 #define IX_OSAL_SWAP_SHORT(sData)         ((sData >> 8) | ((sData & 0xFF) << 8))
-#define IX_OSAL_SWAP_SHORT_ADDRESS(sAddr) ((sAddr) ^ 0x2)
-#define IX_OSAL_SWAP_BYTE_ADDRESS(bAddr)  ((bAddr) ^ 0x3)
+#define IX_OSAL_SWAP_SHORT_ADDRESS(sAddr) ((UINT16*)((UINT32)(sAddr) ^ 0x2))
+#define IX_OSAL_SWAP_BYTE_ADDRESS(bAddr)  ((UINT8*)((UINT32)(bAddr) ^ 0x3))
 
 #define IX_OSAL_BE_XSTOBUSL(wData)  (wData)
 #define IX_OSAL_BE_XSTOBUSS(sData)  (sData)