1 From 127797e5cf8a036825007586b914b75897aba554 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Wed, 31 Oct 2007 16:39:31 -0600
4 Subject: [PATCH] Add Coldfire Support into existing headers.
6 Modifications to the various M68k header files to add
7 Coldfire processor support.
9 LTIBName: mcfv4e-coldfire-headers
10 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
12 include/asm-m68k/atomic.h | 23 ++-
13 include/asm-m68k/bitops.h | 426 ++++++++++++++++++++++++++++++++++++++++
14 include/asm-m68k/bootinfo.h | 13 ++
15 include/asm-m68k/byteorder.h | 12 +-
16 include/asm-m68k/cacheflush.h | 4 +
17 include/asm-m68k/checksum.h | 10 +
18 include/asm-m68k/delay.h | 26 +++
19 include/asm-m68k/div64.h | 4 +
20 include/asm-m68k/elf.h | 2 +-
21 include/asm-m68k/fpu.h | 2 +
22 include/asm-m68k/io.h | 26 +++-
23 include/asm-m68k/irq.h | 5 +-
24 include/asm-m68k/machdep.h | 7 +
25 include/asm-m68k/mmu_context.h | 84 ++++++++-
26 include/asm-m68k/page.h | 20 ++-
27 include/asm-m68k/page_offset.h | 7 +-
28 include/asm-m68k/pci.h | 99 ++++++----
29 include/asm-m68k/pgalloc.h | 4 +-
30 include/asm-m68k/pgtable.h | 15 ++
31 include/asm-m68k/processor.h | 46 ++++-
32 include/asm-m68k/ptrace.h | 11 +
33 include/asm-m68k/raw_io.h | 58 ++++++
34 include/asm-m68k/segment.h | 10 +
35 include/asm-m68k/setup.h | 27 +++
36 include/asm-m68k/signal.h | 5 +
37 include/asm-m68k/string.h | 2 +
38 include/asm-m68k/system.h | 17 ++-
39 include/asm-m68k/thread_info.h | 1 +
40 include/asm-m68k/tlbflush.h | 16 ++-
41 include/asm-m68k/uaccess.h | 4 +
42 30 files changed, 925 insertions(+), 61 deletions(-)
44 --- a/include/asm-m68k/atomic.h
45 +++ b/include/asm-m68k/atomic.h
47 #define __ARCH_M68K_ATOMIC__
50 -#include <asm/system.h>
51 +#include <asm/system.h> /* local_irq_XXX() */
54 * Atomic operations that C can't guarantee us. Useful for
55 @@ -21,12 +21,20 @@ typedef struct { int counter; } atomic_t
57 static inline void atomic_add(int i, atomic_t *v)
59 +#ifndef CONFIG_COLDFIRE
60 __asm__ __volatile__("addl %1,%0" : "+m" (*v) : "id" (i));
62 + __asm__ __volatile__("addl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
66 static inline void atomic_sub(int i, atomic_t *v)
68 +#ifndef CONFIG_COLDFIRE
69 __asm__ __volatile__("subl %1,%0" : "+m" (*v) : "id" (i));
71 + __asm__ __volatile__("subl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
75 static inline void atomic_inc(atomic_t *v)
76 @@ -46,6 +54,14 @@ static inline int atomic_dec_and_test(at
80 +static __inline__ int atomic_dec_and_test_lt(volatile atomic_t *v)
83 + __asm__ __volatile__("subql #1,%1; slt %0" : "=d" (c), "=m" (*v)
88 static inline int atomic_inc_and_test(atomic_t *v)
91 @@ -156,7 +172,12 @@ static inline int atomic_sub_and_test(in
92 static inline int atomic_add_negative(int i, atomic_t *v)
95 +#ifndef CONFIG_COLDFIRE
96 __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "+m" (*v): "g" (i));
98 + __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "=m" (*v)
99 + : "d" (i) , "m" (*v));
104 --- a/include/asm-m68k/bitops.h
105 +++ b/include/asm-m68k/bitops.h
108 * They use the standard big-endian m680x0 bit ordering.
110 +#ifndef CONFIG_COLDFIRE
112 #define test_and_set_bit(nr,vaddr) \
113 (__builtin_constant_p(nr) ? \
114 @@ -457,4 +458,429 @@ static inline int ext2_find_next_bit(con
116 #endif /* __KERNEL__ */
118 +#else /* CONFIG_COLDFIRE */
120 +#define test_and_set_bit(nr,vaddr) \
121 + (__builtin_constant_p(nr) ? \
122 + __constant_coldfire_test_and_set_bit(nr, vaddr) : \
123 + __generic_coldfire_test_and_set_bit(nr, vaddr))
126 +static __inline__ int __constant_coldfire_test_and_set_bit(int nr,
127 + volatile void *vaddr)
130 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
132 + __asm__ __volatile__ ("bset %2,%1; sne %0"
133 + : "=d" (retval), "+QUd" (*p)
138 +static __inline__ int __generic_coldfire_test_and_set_bit(int nr,
139 + volatile void *vaddr)
143 + __asm__ __volatile__ ("bset %2,%1; sne %0"
144 + : "=d" (retval), "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
149 +#define __test_and_set_bit(nr, vaddr) test_and_set_bit(nr, vaddr)
151 +#define set_bit(nr,vaddr) \
152 + (__builtin_constant_p(nr) ? \
153 + __constant_coldfire_set_bit(nr, vaddr) : \
154 + __generic_coldfire_set_bit(nr, vaddr))
156 +static __inline__ void __constant_coldfire_set_bit(int nr,
157 + volatile void *vaddr)
159 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
160 + __asm__ __volatile__ ("bset %1,%0"
161 + : "+QUd" (*p) : "di" (nr & 7));
164 +static __inline__ void __generic_coldfire_set_bit(int nr, volatile void *vaddr)
166 + __asm__ __volatile__ ("bset %1,%0"
167 + : "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
171 +#define __set_bit(nr, vaddr) set_bit(nr, vaddr)
173 +#define test_and_clear_bit(nr, vaddr) \
174 + (__builtin_constant_p(nr) ? \
175 + __constant_coldfire_test_and_clear_bit(nr, vaddr) : \
176 + __generic_coldfire_test_and_clear_bit(nr, vaddr))
178 +static __inline__ int __constant_coldfire_test_and_clear_bit(int nr,
179 + volatile void *vaddr)
182 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
184 + __asm__ __volatile__ ("bclr %2,%1; sne %0"
185 + : "=d" (retval), "+QUd" (*p)
191 +static __inline__ int __generic_coldfire_test_and_clear_bit(int nr,
192 + volatile void *vaddr)
196 + __asm__ __volatile__ ("bclr %2,%1; sne %0"
197 + : "=d" (retval), "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
203 +#define __test_and_clear_bit(nr, vaddr) test_and_clear_bit(nr, vaddr)
206 + * clear_bit() doesn't provide any barrier for the compiler.
208 +#define smp_mb__before_clear_bit() barrier()
209 +#define smp_mb__after_clear_bit() barrier()
211 +#define clear_bit(nr,vaddr) \
212 + (__builtin_constant_p(nr) ? \
213 + __constant_coldfire_clear_bit(nr, vaddr) : \
214 + __generic_coldfire_clear_bit(nr, vaddr))
216 +static __inline__ void __constant_coldfire_clear_bit(int nr,
217 + volatile void *vaddr)
219 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
220 + __asm__ __volatile__ ("bclr %1,%0"
221 + : "+QUd" (*p) : "id" (nr & 7));
224 +static __inline__ void __generic_coldfire_clear_bit(int nr,
225 + volatile void *vaddr)
227 + __asm__ __volatile__ ("bclr %1,%0"
228 + : "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
232 +#define __clear_bit(nr, vaddr) clear_bit(nr, vaddr)
234 +#define test_and_change_bit(nr, vaddr) \
235 + (__builtin_constant_p(nr) ? \
236 + __constant_coldfire_test_and_change_bit(nr, vaddr) : \
237 + __generic_coldfire_test_and_change_bit(nr, vaddr))
239 +static __inline__ int __constant_coldfire_test_and_change_bit(int nr,
240 + volatile void *vaddr)
243 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
245 + __asm__ __volatile__ ("bchg %2,%1; sne %0"
246 + : "=d" (retval), "+QUd" (*p)
252 +static __inline__ int __generic_coldfire_test_and_change_bit(int nr,
253 + volatile void *vaddr)
257 + __asm__ __volatile__ ("bchg %2,%1; sne %0"
258 + : "=d" (retval), "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
264 +#define __test_and_change_bit(nr, vaddr) test_and_change_bit(nr, vaddr)
265 +#define __change_bit(nr, vaddr) change_bit(nr, vaddr)
267 +#define change_bit(nr,vaddr) \
268 + (__builtin_constant_p(nr) ? \
269 + __constant_coldfire_change_bit(nr, vaddr) : \
270 + __generic_coldfire_change_bit(nr, vaddr))
272 +static __inline__ void __constant_coldfire_change_bit(int nr,
273 + volatile void *vaddr)
275 + volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
276 + __asm__ __volatile__ ("bchg %1,%0"
277 + : "+QUd" (*p) : "id" (nr & 7));
280 +static __inline__ void __generic_coldfire_change_bit(int nr,
281 + volatile void *vaddr)
283 + __asm__ __volatile__ ("bchg %1,%0"
284 + : "=m" (((volatile char *)vaddr)[(nr^31) >> 3])
289 +static inline int test_bit(int nr, const unsigned long *vaddr)
291 + return (vaddr[nr >> 5] & (1UL << (nr & 31))) != 0;
294 +static __inline__ unsigned long ffz(unsigned long word)
296 + unsigned long result = 0;
305 +/* find_next_zero_bit() finds the first zero bit in a bit string of length
306 + * 'size' bits, starting the search at bit 'offset'. This is largely based
307 + * on Linus's ALPHA routines.
309 +static __inline__ unsigned long find_next_zero_bit(void *addr,
310 + unsigned long size, unsigned long offset)
312 + unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
313 + unsigned long result = offset & ~31UL;
316 + if (offset >= size)
322 + tmp |= ~0UL >> (32-offset);
330 + while (size & ~31UL) {
342 + tmp |= ~0UL >> size;
344 + return result + ffz(tmp);
347 +#define find_first_zero_bit(addr, size) find_next_zero_bit(((void *)addr), \
350 +/* Ported from included/linux/bitops.h */
351 +static __inline__ int ffs(int x)
357 + if (!(x & 0xffff)) {
379 +#define __ffs(x) (ffs(x) - 1)
381 +/* find_next_bit - find the next set bit in a memory region
382 + * (from asm-ppc/bitops.h)
384 +static __inline__ unsigned long find_next_bit(const unsigned long *addr,
385 + unsigned long size, unsigned long offset)
387 + unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
388 + unsigned int result = offset & ~31UL;
391 + if (offset >= size)
397 + tmp &= ~0UL << offset;
405 + while (size >= 32) {
417 + tmp &= ~0UL >> (32 - size);
418 + if (tmp == 0UL) /* Are any bits set? */
419 + return result + size; /* Nope. */
421 + return result + __ffs(tmp);
424 +#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
428 +/* Ported from include/linux/bitops.h */
429 +static __inline__ int fls(int x)
435 + if (!(x & 0xffff0000u)) {
439 + if (!(x & 0xff000000u)) {
443 + if (!(x & 0xf0000000u)) {
447 + if (!(x & 0xc0000000u)) {
451 + if (!(x & 0x80000000u)) {
458 +#include <asm-generic/bitops/fls64.h>
459 +#include <asm-generic/bitops/sched.h>
460 +#include <asm-generic/bitops/hweight.h>
462 +#define minix_find_first_zero_bit(addr, size) find_next_zero_bit((addr), \
464 +#define minix_test_and_set_bit(nr, addr) test_and_set_bit((nr), \
465 + (unsigned long *)(addr))
466 +#define minix_set_bit(nr, addr) set_bit((nr), \
467 + (unsigned long *)(addr))
468 +#define minix_test_and_clear_bit(nr, addr) test_and_clear_bit((nr), \
469 + (unsigned long *)(addr))
471 +static inline int minix_test_bit(int nr, const volatile unsigned long *vaddr)
473 + int *a = (int *)vaddr;
477 + mask = 1 << (nr & 0x1f);
478 + return ((mask & *a) != 0);
481 +#define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 24, \
482 + (unsigned long *)(addr))
483 +#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, \
484 + (unsigned long *)(addr))
485 +#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 24, \
486 + (unsigned long *)(addr))
487 +#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, \
488 + (unsigned long *)(addr))
490 +static inline int ext2_test_bit(int nr, const void *vaddr)
492 + const unsigned char *p = vaddr;
493 + return (p[nr >> 3] & (1U << (nr & 7))) != 0;
496 +static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
498 + const unsigned long *p = vaddr, *addr = vaddr;
504 + size = (size >> 5) + ((size & 31) > 0);
505 + while (*p++ == ~0UL) {
507 + return (p - addr) << 5;
511 + for (res = 0; res < 32; res++)
512 + if (!ext2_test_bit (res, p))
514 + return (p - addr) * 32 + res;
517 +static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
520 + const unsigned long *addr = vaddr;
521 + const unsigned long *p = addr + (offset >> 5);
522 + int bit = offset & 31UL, res;
524 + if (offset >= size)
528 + /* Look for zero in first longword */
529 + for (res = bit; res < 32; res++)
530 + if (!ext2_test_bit (res, p))
531 + return (p - addr) * 32 + res;
534 + /* No zero yet, search remaining full bytes for a zero */
535 + res = ext2_find_first_zero_bit(p, size - 32 * (p - addr));
536 + return (p - addr) * 32 + res;
541 +#endif /* CONFIG_COLDFIRE */
543 #endif /* _M68K_BITOPS_H */
544 --- a/include/asm-m68k/bootinfo.h
545 +++ b/include/asm-m68k/bootinfo.h
546 @@ -49,6 +49,19 @@ struct bi_record {
547 #endif /* __ASSEMBLY__ */
550 +#ifndef __ASSEMBLY__
552 +struct uboot_record {
553 + unsigned long bd_info;
554 + unsigned long initrd_start;
555 + unsigned long initrd_end;
556 + unsigned long cmd_line_start;
557 + unsigned long cmd_line_stop;
560 +#endif /* __ASSEMBLY__ */
566 --- a/include/asm-m68k/byteorder.h
567 +++ b/include/asm-m68k/byteorder.h
569 #include <asm/types.h>
570 #include <linux/compiler.h>
574 +#if defined(__GNUC__)
575 +#if defined(__mcfisaaplus__) || defined(__mcfisac__)
576 +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 val)
578 + __asm__ ("byterev %0" : "=d" (val) : "0" (val));
581 +#define __arch__swab32(x) ___arch__swab32(x)
582 +#elif !defined(__mcoldfire__)
583 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 val)
585 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
586 @@ -14,6 +21,7 @@ static __inline__ __attribute_const__ __
587 #define __arch__swab32(x) ___arch__swab32(x)
592 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
593 # define __BYTEORDER_HAS_U64__
594 --- a/include/asm-m68k/cacheflush.h
595 +++ b/include/asm-m68k/cacheflush.h
598 #define FLUSH_I_AND_D (0x00000808)
599 #define FLUSH_I (0x00000008)
600 +#ifdef CONFIG_COLDFIRE
601 +#include <asm/cf_cacheflush.h>
602 +#else /* !CONFIG_COLDFIRE */
605 * Cache handling functions
606 @@ -153,4 +156,5 @@ static inline void copy_from_user_page(s
607 memcpy(dst, src, len);
610 +#endif /* !CONFIG_COLDFIRE */
611 #endif /* _M68K_CACHEFLUSH_H */
612 --- a/include/asm-m68k/checksum.h
613 +++ b/include/asm-m68k/checksum.h
614 @@ -34,6 +34,7 @@ extern __wsum csum_partial_copy_nocheck(
618 +#ifndef CONFIG_COLDFIRE /* CF has own copy in arch/m68k/lib/checksum.c */
620 * This is a version of ip_compute_csum() optimized for IP headers,
621 * which always checksum on 4 octet boundaries.
622 @@ -59,6 +60,9 @@ static inline __sum16 ip_fast_csum(const
624 return (__force __sum16)~sum;
627 +extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
631 * Fold a partial checksum
632 @@ -67,6 +71,11 @@ static inline __sum16 ip_fast_csum(const
633 static inline __sum16 csum_fold(__wsum sum)
635 unsigned int tmp = (__force u32)sum;
636 +#ifdef CONFIG_COLDFIRE
637 + tmp = (tmp & 0xffff) + (tmp >> 16);
638 + tmp = (tmp & 0xffff) + (tmp >> 16);
639 + return (__force __sum16) ~tmp;
641 __asm__("swap %1\n\t"
644 @@ -74,6 +83,7 @@ static inline __sum16 csum_fold(__wsum s
645 : "=&d" (sum), "=&d" (tmp)
646 : "0" (sum), "1" (tmp));
647 return (__force __sum16)~sum;
652 --- a/include/asm-m68k/delay.h
653 +++ b/include/asm-m68k/delay.h
656 static inline void __delay(unsigned long loops)
658 +#if defined(CONFIG_COLDFIRE)
659 + /* The coldfire runs this loop at significantly different speeds
660 + * depending upon long word alignment or not. We'll pad it to
661 + * long word alignment which is the faster version.
662 + * The 0x4a8e is of course a 'tstl %fp' instruction. This is better
663 + * than using a NOP (0x4e71) instruction because it executes in one
664 + * cycle not three and doesn't allow for an arbitary delay waiting
665 + * for bus cycles to finish. Also fp/a6 isn't likely to cause a
666 + * stall waiting for the register to become valid if such is added
667 + * to the coldfire at some stage.
669 + __asm__ __volatile__ (".balignw 4, 0x4a8e\n\t"
670 + "1: subql #1, %0\n\t"
672 + : "=d" (loops) : "0" (loops));
674 __asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
675 : "=d" (loops) : "0" (loops));
679 extern void __bad_udelay(void);
680 @@ -26,12 +43,17 @@ extern void __bad_udelay(void);
682 static inline void __const_udelay(unsigned long xloops)
684 +#if defined(CONFIG_COLDFIRE)
686 + __delay(((((unsigned long long) xloops * loops_per_jiffy))>>32)*HZ);
690 __asm__ ("mulul %2,%0:%1"
691 : "=d" (xloops), "=d" (tmp)
692 : "d" (xloops), "1" (loops_per_jiffy));
693 __delay(xloops * HZ);
697 static inline void __udelay(unsigned long usecs)
698 @@ -46,12 +68,16 @@ static inline void __udelay(unsigned lon
699 static inline unsigned long muldiv(unsigned long a, unsigned long b,
702 +#if defined(CONFIG_COLDFIRE)
703 + return (long)(((unsigned long long)a * b)/c);
707 __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
708 : "=d" (tmp), "=d" (a)
709 : "d" (b), "d" (c), "1" (a));
714 #endif /* defined(_M68K_DELAY_H) */
715 --- a/include/asm-m68k/div64.h
716 +++ b/include/asm-m68k/div64.h
719 /* n = n / base; return rem; */
721 +#ifndef CONFIG_COLDFIRE
722 #define do_div(n, base) ({ \
724 unsigned long n32[2]; \
730 +# include <asm-generic/div64.h>
733 extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
734 #endif /* _M68K_DIV64_H */
735 --- a/include/asm-m68k/elf.h
736 +++ b/include/asm-m68k/elf.h
737 @@ -60,7 +60,7 @@ typedef struct user_m68kfp_struct elf_fp
738 #define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
740 #define USE_ELF_CORE_DUMP
742 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
743 #define ELF_EXEC_PAGESIZE 4096
745 #define ELF_EXEC_PAGESIZE 8192
746 --- a/include/asm-m68k/fpu.h
747 +++ b/include/asm-m68k/fpu.h
749 #define FPSTATESIZE (96/sizeof(unsigned char))
750 #elif defined(CONFIG_M68KFPU_EMU)
751 #define FPSTATESIZE (28/sizeof(unsigned char))
752 +#elif defined(CONFIG_CFV4E)
753 +#define FPSTATESIZE (16/sizeof(unsigned char))
754 #elif defined(CONFIG_M68060)
755 #define FPSTATESIZE (12/sizeof(unsigned char))
757 --- a/include/asm-m68k/io.h
758 +++ b/include/asm-m68k/io.h
759 @@ -397,10 +397,12 @@ static inline void memcpy_toio(volatile
760 __builtin_memcpy((void __force *) dst, src, count);
764 -#define IO_SPACE_LIMIT 0xffff
766 +#if defined(CONFIG_SUN3)
767 #define IO_SPACE_LIMIT 0x0fffffff
768 +#elif defined(CONFIG_COLDFIRE)
769 +#define IO_SPACE_LIMIT 0xffffffff
771 +#define IO_SPACE_LIMIT 0xffff
774 #endif /* __KERNEL__ */
775 @@ -418,4 +420,22 @@ static inline void memcpy_toio(volatile
777 #define xlate_dev_kmem_ptr(p) p
779 +#ifdef CONFIG_COLDFIRE
781 +#define memset_io(a, b, c) memset((void *)(a), (b), (c))
782 +#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
783 +#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
785 +#define readb(addr) \
786 + ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
787 +#define readw(addr) \
788 + ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
789 +#define readl(addr) \
790 + ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
791 +#define writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
792 +#define writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
793 +#define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
795 +#endif /* CONFIG_COLDFIRE */
798 --- a/include/asm-m68k/irq.h
799 +++ b/include/asm-m68k/irq.h
801 * Currently the Atari has 72 and the Amiga 24, but if both are
802 * supported in the kernel it is better to make room for 72.
804 -#if defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
805 +#if defined(CONFIG_COLDFIRE)
806 +#define SYS_IRQS 256
807 +#define NR_IRQS SYS_IRQS
808 +#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
810 #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
812 --- a/include/asm-m68k/machdep.h
813 +++ b/include/asm-m68k/machdep.h
814 @@ -32,4 +32,11 @@ extern void (*mach_heartbeat) (int);
815 extern void (*mach_l2_flush) (int);
816 extern void (*mach_beep) (unsigned int, unsigned int);
818 +#ifdef CONFIG_COLDFIRE
819 +extern void __init config_coldfire(void);
820 +extern void __init mmu_context_init(void);
821 +extern irq_handler_t mach_default_handler;
822 +extern void (*mach_tick)(void);
825 #endif /* _M68K_MACHDEP_H */
826 --- a/include/asm-m68k/mmu_context.h
827 +++ b/include/asm-m68k/mmu_context.h
828 @@ -7,7 +7,7 @@ static inline void enter_lazy_tlb(struct
833 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
835 #include <asm/setup.h>
836 #include <asm/page.h>
837 @@ -102,7 +102,7 @@ static inline void activate_mm(struct mm
838 switch_mm_0460(next_mm);
841 -#else /* CONFIG_SUN3 */
842 +#elif defined(CONFIG_SUN3)
843 #include <asm/sun3mmu.h>
844 #include <linux/sched.h>
846 @@ -150,5 +150,83 @@ static inline void activate_mm(struct mm
847 activate_context(next_mm);
851 +#else /* CONFIG_COLDFIRE */
853 +#include <asm/atomic.h>
854 +#include <asm/bitops.h>
855 +#include <asm/mmu.h>
857 +#define NO_CONTEXT 256
858 +#define LAST_CONTEXT 255
859 +#define FIRST_CONTEXT 1
861 +extern void set_context(mm_context_t context, pgd_t *pgd);
862 +extern unsigned long context_map[];
863 +extern mm_context_t next_mmu_context;
865 +extern atomic_t nr_free_contexts;
866 +extern struct mm_struct *context_mm[LAST_CONTEXT+1];
867 +extern void steal_context(void);
869 +static inline void get_mmu_context(struct mm_struct *mm)
873 + if (mm->context != NO_CONTEXT)
875 + while (atomic_dec_and_test_lt(&nr_free_contexts)) {
876 + atomic_inc(&nr_free_contexts);
879 + ctx = next_mmu_context;
880 + while (test_and_set_bit(ctx, context_map)) {
881 + ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
882 + if (ctx > LAST_CONTEXT)
885 + next_mmu_context = (ctx + 1) & LAST_CONTEXT;
887 + context_mm[ctx] = mm;
891 + * Set up the context for a new address space.
893 +#define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0)
896 + * We're finished using the context for an address space.
898 +static inline void destroy_context(struct mm_struct *mm)
900 + if (mm->context != NO_CONTEXT) {
901 + clear_bit(mm->context, context_map);
902 + mm->context = NO_CONTEXT;
903 + atomic_inc(&nr_free_contexts);
907 +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
908 + struct task_struct *tsk)
910 + get_mmu_context(tsk->mm);
911 + set_context(tsk->mm->context, next->pgd);
915 + * After we have set current->mm to a new value, this activates
916 + * the context for the new mm so we see the new mappings.
918 +static inline void activate_mm(struct mm_struct *active_mm,
919 + struct mm_struct *mm)
921 + get_mmu_context(mm);
922 + set_context(mm->context, mm->pgd);
925 +#define deactivate_mm(tsk, mm) do { } while (0)
927 +extern void mmu_context_init(void);
929 +#endif /* CONFIG_COLDFIRE */
931 --- a/include/asm-m68k/page.h
932 +++ b/include/asm-m68k/page.h
934 #include <linux/const.h>
936 /* PAGE_SHIFT determines the page size */
938 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
939 #define PAGE_SHIFT (12)
941 #define PAGE_SHIFT (13)
942 @@ -116,10 +116,23 @@ typedef struct page *pgtable_t;
944 extern unsigned long m68k_memoffset;
947 +#if !defined(CONFIG_SUN3)
949 #define WANT_PAGE_VIRTUAL
951 +#if defined(CONFIG_COLDFIRE)
952 +static inline unsigned long ___pa(void *vaddr)
954 + return (((unsigned long)vaddr & 0x0fffffff) + CONFIG_SDRAM_BASE);
956 +#define __pa(vaddr) ___pa((void *)(vaddr))
958 +static inline void *__va(unsigned long paddr)
960 + return (void *)((paddr & 0x0fffffff) + PAGE_OFFSET);
964 static inline unsigned long ___pa(void *vaddr)
967 @@ -141,6 +154,7 @@ static inline void *__va(unsigned long p
968 : "0" (paddr), "i" (m68k_fixup_memoffset));
973 #else /* !CONFIG_SUN3 */
974 /* This #define is a horrible hack to suppress lots of warnings. --m */
975 @@ -172,6 +186,8 @@ static inline void *__va(unsigned long x
976 * memory node, but we have no highmem, so that works for now.
977 * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots
978 * of the shifts unnecessary.
980 + * PFNs are used to map physical pages. So PFN[0] maps to the base phys addr.
982 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
983 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
984 --- a/include/asm-m68k/page_offset.h
985 +++ b/include/asm-m68k/page_offset.h
988 /* This handles the memory map.. */
990 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
991 #define PAGE_OFFSET_RAW 0x00000000
993 +#elif defined(CONFIG_SUN3)
994 #define PAGE_OFFSET_RAW 0x0E000000
995 +#else /* CONFIG_COLDFIRE */
996 +#define PAGE_OFFSET_RAW 0xC0000000
997 +#define PHYS_OFFSET 0x40000000
1000 --- a/include/asm-m68k/pci.h
1001 +++ b/include/asm-m68k/pci.h
1003 -#ifndef _ASM_M68K_PCI_H
1004 -#define _ASM_M68K_PCI_H
1007 - * asm-m68k/pci_m68k.h - m68k specific PCI declarations.
1008 + * asm-m68k/pci.h - m68k specific PCI declarations.
1010 - * Written by Wout Klaren.
1011 + * Coldfire Implementation Copyright (c) 2007 Freescale Semiconductor, Inc.
1012 + * Kurt Mahan <kmahan@freescale.com>
1014 +#ifndef _ASM_M68K_PCI_H
1015 +#define _ASM_M68K_PCI_H
1017 -#include <asm/scatterlist.h>
1021 +#include <asm-generic/pci-dma-compat.h>
1024 - * Structure with hardware dependent information and functions of the
1026 + * The PCI address space does equal the physical memory
1027 + * address space. The networking and block device layers use
1028 + * this boolean for bounce buffer decisions.
1030 +#define PCI_DMA_BUS_IS_PHYS (1)
1032 -struct pci_bus_info
1035 - * Resources of the PCI bus.
1038 - struct resource mem_space;
1039 - struct resource io_space;
1040 +#define PCIBIOS_MIN_IO 0x00004000
1041 +#define PCIBIOS_MIN_MEM 0x02000000
1044 - * System dependent functions.
1046 +#define pcibios_assign_all_busses() 0
1047 +#define pcibios_scan_all_fns(a, b) 0
1049 - struct pci_ops *m68k_pci_ops;
1051 +pcibios_set_master(struct pci_dev *dev)
1053 + /* no special bus mastering setup handling */
1056 - void (*fixup)(int pci_modify);
1057 - void (*conf_device)(struct pci_dev *dev);
1060 +pcibios_penalize_isa_irq(int irq, int active)
1062 + /* no dynamic PCI IRQ allocation */
1065 -#define pcibios_assign_all_busses() 0
1066 -#define pcibios_scan_all_fns(a, b) 0
1068 +pcibios_add_platform_entries(struct pci_dev *dev)
1070 + /* no special handling */
1073 -static inline void pcibios_set_master(struct pci_dev *dev)
1075 +pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
1076 + struct resource *res)
1078 - /* No special bus mastering setup handling */
1079 +#ifdef CONFIG_M54455
1080 + if ((res->start == 0xa0000000) || (res->start == 0xa8000000)) {
1081 + /* HACK! FIX! kludge to fix bridge mapping */
1082 + region->start = res->start & 0x0fffffff;
1083 + region->end = res->end & 0x0fffffff;
1085 + region->start = res->start;
1086 + region->end = res->end;
1089 + region->start = res->start;
1090 + region->end = res->end;
1094 -static inline void pcibios_penalize_isa_irq(int irq, int active)
1096 +pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
1097 + struct pci_bus_region *region)
1099 - /* We don't do dynamic PCI IRQ allocation */
1100 + res->start = region->start;
1101 + res->end = region->end;
1104 -/* The PCI address space does equal the physical memory
1105 - * address space. The networking and block device layers use
1106 - * this boolean for bounce buffer decisions.
1108 -#define PCI_DMA_BUS_IS_PHYS (1)
1109 +static inline struct resource *
1110 +pcibios_select_root(struct pci_dev *pdev, struct resource *res)
1112 + struct resource *root = NULL;
1114 + if (res->flags & IORESOURCE_IO)
1115 + root = &ioport_resource;
1116 + if (res->flags & IORESOURCE_MEM)
1117 + root = &iomem_resource;
1122 +#endif /* CONFIG_PCI */
1123 #endif /* _ASM_M68K_PCI_H */
1124 --- a/include/asm-m68k/pgalloc.h
1125 +++ b/include/asm-m68k/pgalloc.h
1127 #include <asm/virtconvert.h>
1131 +#if defined(CONFIG_SUN3)
1132 #include <asm/sun3_pgalloc.h>
1133 +#elif defined(CONFIG_COLDFIRE)
1134 +#include <asm/cf_pgalloc.h>
1136 #include <asm/motorola_pgalloc.h>
1138 --- a/include/asm-m68k/pgtable.h
1139 +++ b/include/asm-m68k/pgtable.h
1141 /* PGDIR_SHIFT determines what a third-level page table entry can map */
1143 #define PGDIR_SHIFT 17
1144 +#elif defined(CONFIG_COLDFIRE)
1145 +#define PGDIR_SHIFT 22
1147 #define PGDIR_SHIFT 25
1150 #define PTRS_PER_PTE 16
1151 #define PTRS_PER_PMD 1
1152 #define PTRS_PER_PGD 2048
1153 +#elif defined(CONFIG_COLDFIRE)
1154 +#define PTRS_PER_PTE 512
1155 +#define PTRS_PER_PMD 1
1156 +#define PTRS_PER_PGD 1024
1158 #define PTRS_PER_PTE 1024
1159 #define PTRS_PER_PMD 8
1162 #define KMAP_START 0x0DC00000
1163 #define KMAP_END 0x0E000000
1164 +#elif defined(CONFIG_COLDFIRE)
1165 +#define KMAP_START 0xe0000000
1166 +#define KMAP_END 0xf0000000
1168 #define KMAP_START 0xd0000000
1169 #define KMAP_END 0xf0000000
1170 @@ -130,6 +139,8 @@ static inline void update_mmu_cache(stru
1173 #include <asm/sun3_pgtable.h>
1174 +#elif defined(CONFIG_COLDFIRE)
1175 +#include <asm/cf_pgtable.h>
1177 #include <asm/motorola_pgtable.h>
1179 @@ -140,6 +151,9 @@ static inline void update_mmu_cache(stru
1181 * Macro to mark a page protection value as "uncacheable".
1183 +#ifdef CONFIG_COLDFIRE
1184 +# define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | CF_PAGE_NOCACHE))
1185 +#else /* CONFIG_COLDFIRE */
1186 #ifdef SUN3_PAGE_NOCACHE
1187 # define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE
1189 @@ -154,6 +168,7 @@ static inline void update_mmu_cache(stru
1190 ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \
1193 +#endif /* CONFIG_COLDFIRE */
1194 #endif /* !__ASSEMBLY__ */
1197 --- a/include/asm-m68k/processor.h
1198 +++ b/include/asm-m68k/processor.h
1199 @@ -22,24 +22,38 @@ static inline unsigned long rdusp(void)
1203 +#ifndef CONFIG_COLDFIRE
1204 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
1206 + __asm__ __volatile__("movel %/usp,%0" : "=a" (usp));
1211 static inline void wrusp(unsigned long usp)
1213 +#ifndef CONFIG_COLDFIRE
1214 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
1216 + __asm__ __volatile__("movel %0,%/usp" : : "a" (usp));
1221 * User space process size: 3.75GB. This is hardcoded into a few places,
1222 * so don't change it unless you know what you are doing.
1224 -#ifndef CONFIG_SUN3
1225 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1226 #define TASK_SIZE (0xF0000000UL)
1227 +#elif defined(CONFIG_COLDFIRE)
1228 +#define TASK_SIZE (0xC0000000UL)
1229 +#else /* CONFIG_SUN3 */
1230 +#ifdef __ASSEMBLY__
1231 +#define TASK_SIZE (0x0E000000)
1233 #define TASK_SIZE (0x0E000000UL)
1238 #define STACK_TOP TASK_SIZE
1239 @@ -49,9 +63,11 @@ static inline void wrusp(unsigned long u
1240 /* This decides where the kernel will search for a free chunk of vm
1241 * space during mmap's.
1243 -#ifndef CONFIG_SUN3
1244 -#define TASK_UNMAPPED_BASE 0xC0000000UL
1246 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1247 +#define TASK_UNMAPPED_BASE 0xC0000000UL
1248 +#elif defined(CONFIG_COLDFIRE)
1249 +#define TASK_UNMAPPED_BASE 0x80000000UL
1250 +#else /* CONFIG_SUN3 */
1251 #define TASK_UNMAPPED_BASE 0x0A000000UL
1253 #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
1254 @@ -60,7 +76,11 @@ struct thread_struct {
1255 unsigned long ksp; /* kernel stack pointer */
1256 unsigned long usp; /* user stack pointer */
1257 unsigned short sr; /* saved status register */
1258 +#ifndef CONFIG_COLDFIRE
1259 unsigned short fs; /* saved fs (sfc, dfc) */
1263 unsigned long crp[2]; /* cpu root pointer */
1264 unsigned long esp0; /* points to SR of stack frame */
1265 unsigned long faddr; /* info about last fault */
1266 @@ -81,6 +101,7 @@ struct thread_struct {
1268 * Do necessary setup to start up a newly executed thread.
1270 +#ifndef CONFIG_COLDFIRE
1271 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
1274 @@ -91,6 +112,23 @@ static inline void start_thread(struct p
1275 regs->sr &= ~0x2000;
1280 + * Do necessary setup to start up a newly executed thread.
1282 + * pass the data segment into user programs if it exists,
1283 + * it can't hurt anything as far as I can tell
1285 +#define start_thread(_regs, _pc, _usp) \
1287 + set_fs(USER_DS); /* reads from user space */ \
1288 + (_regs)->pc = (_pc); \
1289 + if (current->mm) \
1290 + (_regs)->d5 = current->mm->start_data; \
1291 + (_regs)->sr &= ~0x2000; \
1296 /* Forward declaration, a strange C thing */
1298 --- a/include/asm-m68k/ptrace.h
1299 +++ b/include/asm-m68k/ptrace.h
1300 @@ -38,10 +38,21 @@ struct pt_regs {
1304 +#ifndef CONFIG_COLDFIRE
1307 unsigned format : 4; /* frame format specifier */
1308 unsigned vector : 12; /* vector offset */
1310 + unsigned long mmuar;
1311 + unsigned long mmusr;
1312 + unsigned format : 4; /* frame format specifier */
1314 + unsigned vector: 8;
1316 + unsigned short sr;
1322 --- a/include/asm-m68k/raw_io.h
1323 +++ b/include/asm-m68k/raw_io.h
1324 @@ -77,6 +77,7 @@ static inline void raw_outsb(volatile u8
1325 out_8(port, *buf++);
1328 +#ifndef CONFIG_COLDFIRE
1329 static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr)
1332 @@ -342,6 +343,63 @@ static inline void raw_outsw_swapw(volat
1333 : "d0", "a0", "a1", "d6");
1337 +#else /*CONFIG_COLDFIRE */
1339 +static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr)
1343 + for (i = 0; i < nr; i++)
1344 + *buf++ = raw_inw(port);
1347 +static inline void raw_outsw(volatile u16 *port, const u16 *buf,
1352 + for (i = 0; i < nr; i++, buf++)
1353 + raw_outw(*buf, port);
1356 +static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr)
1360 + for (i = 0; i < nr; i++)
1361 + *buf++ = raw_inl(port);
1364 +static inline void raw_outsl(volatile u32 *port, const u32 *buf,
1369 + for (i = 0; i < nr; i++, buf++)
1370 + raw_outl(*buf, port);
1373 +static inline void raw_insw_swapw(volatile u16 *port, u16 *buf,
1378 + for (i = 0; i < nr; i++)
1379 + *buf++ = in_le16(port);
1383 +static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
1388 + for (i = 0; i < nr; i++, buf++)
1389 + out_le16(port, *buf);
1391 +#endif /*CONFIG_COLDFIRE */
1393 #endif /* __KERNEL__ */
1395 #endif /* _RAW_IO_H */
1396 --- a/include/asm-m68k/segment.h
1397 +++ b/include/asm-m68k/segment.h
1398 @@ -29,6 +29,7 @@ typedef struct {
1399 * Get/set the SFC/DFC registers for MOVES instructions
1402 +#ifndef CONFIG_COLDFIRE
1403 static inline mm_segment_t get_fs(void)
1406 @@ -50,6 +51,15 @@ static inline void set_fs(mm_segment_t v
1407 : /* no outputs */ : "r" (val.seg) : "memory");
1410 +#else /* CONFIG_COLDFIRE */
1412 +#include <asm/current.h>
1413 +#define get_fs() (current->thread.fs)
1414 +#define set_fs(val) (current->thread.fs = (val))
1415 +#define get_ds() (KERNEL_DS)
1417 +#endif /* CONFIG_COLDFIRE */
1419 #define segment_eq(a,b) ((a).seg == (b).seg)
1421 #endif /* __ASSEMBLY__ */
1422 --- a/include/asm-m68k/setup.h
1423 +++ b/include/asm-m68k/setup.h
1425 #define MACH_HP300 9
1427 #define MACH_SUN3X 11
1428 +#define MACH_CFMMU 12
1430 #define COMMAND_LINE_SIZE 256
1432 @@ -189,6 +190,14 @@ extern unsigned long m68k_machtype;
1433 # define MACH_TYPE (MACH_SUN3X)
1436 +#if !defined(CONFIG_COLDFIRE)
1437 +# define MACH_IS_COLDFIRE (0)
1439 +# define CONFIG_COLDFIRE_ONLY
1440 +# define MACH_IS_COLDFIRE (1)
1441 +# define MACH_TYPE (MACH_CFMMU)
1445 # define MACH_TYPE (m68k_machtype)
1447 @@ -211,23 +220,31 @@ extern unsigned long m68k_machtype;
1448 #define CPUB_68030 1
1449 #define CPUB_68040 2
1450 #define CPUB_68060 3
1451 +#define CPUB_CFV4E 4
1453 #define CPU_68020 (1<<CPUB_68020)
1454 #define CPU_68030 (1<<CPUB_68030)
1455 #define CPU_68040 (1<<CPUB_68040)
1456 #define CPU_68060 (1<<CPUB_68060)
1457 +#define CPU_CFV4E (1<<CPUB_CFV4E)
1459 #define FPUB_68881 0
1460 #define FPUB_68882 1
1461 #define FPUB_68040 2 /* Internal FPU */
1462 #define FPUB_68060 3 /* Internal FPU */
1463 #define FPUB_SUNFPA 4 /* Sun-3 FPA */
1464 +#define FPUB_CFV4E 5
1466 #define FPU_68881 (1<<FPUB_68881)
1467 #define FPU_68882 (1<<FPUB_68882)
1468 #define FPU_68040 (1<<FPUB_68040)
1469 #define FPU_68060 (1<<FPUB_68060)
1470 #define FPU_SUNFPA (1<<FPUB_SUNFPA)
1471 +#ifndef CONFIG_M54455
1472 +#define FPU_CFV4E (1<<FPUB_CFV4E)
1474 +#define FPU_CFV4E 0
1477 #define MMUB_68851 0
1478 #define MMUB_68030 1 /* Internal MMU */
1479 @@ -235,6 +252,7 @@ extern unsigned long m68k_machtype;
1480 #define MMUB_68060 3 /* Internal MMU */
1481 #define MMUB_APOLLO 4 /* Custom Apollo */
1482 #define MMUB_SUN3 5 /* Custom Sun-3 */
1483 +#define MMUB_CFV4E 6
1485 #define MMU_68851 (1<<MMUB_68851)
1486 #define MMU_68030 (1<<MMUB_68030)
1487 @@ -242,6 +260,7 @@ extern unsigned long m68k_machtype;
1488 #define MMU_68060 (1<<MMUB_68060)
1489 #define MMU_SUN3 (1<<MMUB_SUN3)
1490 #define MMU_APOLLO (1<<MMUB_APOLLO)
1491 +#define MMU_CFV4E (1<<MMUB_CFV4E)
1495 @@ -341,6 +360,14 @@ extern int m68k_is040or060;
1499 +#if !defined(CONFIG_CFV4E)
1500 +# define CPU_IS_COLDFIRE (0)
1502 +# define CPU_IS_COLDFIRE (1)
1503 +# define CPU_IS_CFV4E (1)
1504 +# define MMU_IS_CFV4E (1)
1507 #define CPU_TYPE (m68k_cputype)
1509 #ifdef CONFIG_M68KFPU_EMU
1510 --- a/include/asm-m68k/signal.h
1511 +++ b/include/asm-m68k/signal.h
1512 @@ -150,6 +150,7 @@ typedef struct sigaltstack {
1514 #include <asm/sigcontext.h>
1516 +#ifndef CONFIG_COLDFIRE
1517 #define __HAVE_ARCH_SIG_BITOPS
1519 static inline void sigaddset(sigset_t *set, int _sig)
1520 @@ -200,6 +201,10 @@ static inline int sigfindinword(unsigned
1523 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
1526 +#define ptrace_signal_deliver(regs, cookie) do { } while (0)
1527 +#endif /* CONFIG_COLDFIRE */
1529 #endif /* __KERNEL__ */
1531 --- a/include/asm-m68k/string.h
1532 +++ b/include/asm-m68k/string.h
1533 @@ -93,6 +93,7 @@ static inline char *strchr(const char *s
1534 return (char *)s - 1;
1537 +#ifndef CONFIG_COLDFIRE
1538 #define __HAVE_ARCH_STRCMP
1539 static inline int strcmp(const char *cs, const char *ct)
1541 @@ -110,6 +111,7 @@ static inline int strcmp(const char *cs,
1542 : "+a" (cs), "+a" (ct), "=d" (res));
1547 #define __HAVE_ARCH_MEMSET
1548 extern void *memset(void *, int, __kernel_size_t);
1549 --- a/include/asm-m68k/system.h
1550 +++ b/include/asm-m68k/system.h
1551 @@ -63,16 +63,25 @@ asmlinkage void resume(void);
1552 #define smp_read_barrier_depends() ((void)0)
1554 /* interrupt control.. */
1556 -#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
1558 #include <linux/hardirq.h>
1559 +#ifndef CONFIG_COLDFIRE
1560 #define local_irq_enable() ({ \
1561 if (MACH_IS_Q40 || !hardirq_count()) \
1562 asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
1565 #define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory")
1566 +#else /* CONFIG_COLDFIRE */
1567 +#define local_irq_enable() \
1568 + asm volatile ("move.w %%sr, %%d0\n\t" \
1569 + "andil #0xf8ff,%%d0\n\t" \
1570 + "move.w %%d0, %%sr\n" \
1571 + : : : "cc", "d0", "memory")
1572 +#define local_irq_disable() \
1573 + asm volatile ("move %/sr,%%d0\n\t" \
1574 + "ori.l #0x0700,%%d0\n\t" \
1575 + "move %%d0,%/sr\n" \
1576 + : : : "cc", "%d0", "memory")
1578 #define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
1579 #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
1581 --- a/include/asm-m68k/thread_info.h
1582 +++ b/include/asm-m68k/thread_info.h
1583 @@ -58,5 +58,6 @@ struct thread_info {
1584 #define TIF_DELAYED_TRACE 14 /* single step a syscall */
1585 #define TIF_SYSCALL_TRACE 15 /* syscall trace active */
1586 #define TIF_MEMDIE 16
1587 +#define TIF_FREEZE 17 /* freezing processes */
1589 #endif /* _ASM_M68K_THREAD_INFO_H */
1590 --- a/include/asm-m68k/tlbflush.h
1591 +++ b/include/asm-m68k/tlbflush.h
1593 #define _M68K_TLBFLUSH_H
1596 -#ifndef CONFIG_SUN3
1597 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1599 #include <asm/current.h>
1601 @@ -92,7 +92,12 @@ static inline void flush_tlb_kernel_rang
1606 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1607 + unsigned long start, unsigned long end)
1611 +#elif defined(CONFIG_SUN3)
1614 /* Reserved PMEGs. */
1615 @@ -214,6 +219,13 @@ static inline void flush_tlb_kernel_page
1616 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG);
1619 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1620 + unsigned long start, unsigned long end)
1624 +#else /* CONFIG_COLDFIRE */
1625 +#include <asm/cf_tlbflush.h>
1628 #endif /* _M68K_TLBFLUSH_H */
1629 --- a/include/asm-m68k/uaccess.h
1630 +++ b/include/asm-m68k/uaccess.h
1632 #ifndef __M68K_UACCESS_H
1633 #define __M68K_UACCESS_H
1635 +#ifdef CONFIG_COLDFIRE
1636 +#include <asm/cf_uaccess.h>
1639 * User space memory access functions
1641 @@ -367,4 +370,5 @@ unsigned long __clear_user(void __user *
1643 #define strlen_user(str) strnlen_user(str, 32767)
1645 +#endif /* CONFIG_COLDFIRE */
1646 #endif /* _M68K_UACCESS_H */